liujie
2026-05-20 7dae6f1ae2a3c6ba6c27ca7508e4d23ddb08cede
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package com.estate.expert.admin.controller.admin;
 
import com.estate.expert.admin.domain.common.request.BatchReq;
import com.estate.expert.admin.domain.common.request.PlanPageRequest;
import com.estate.expert.admin.domain.plan.PlanDto;
import com.estate.expert.admin.domain.plan.PlanMapper;
import com.estate.expert.admin.domain.user.User;
import com.estate.expert.admin.service.PlanService;
import com.estate.expert.common.domain.Session;
import com.estate.expert.common.rpc.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
@Api(tags = "管理后台/计划管理")
@CrossOrigin
@Slf4j
@RestController
@RequestMapping("/admin/plan")
@Validated
public class PlanController {
 
    @Resource
    private PlanService planService;
 
    @Resource
    private PlanMapper planMapper;
 
    @ApiOperation("计划列表")
    @PostMapping("/list")
    public Result list(@Validated @RequestBody PlanPageRequest request) {
        return Result.success(planService.list(request.getKeyword(), request.getPlanTypes(),
                request.getPlanStates(), request.getClientIds(),
                request.getCreatorId(), request.getPageReq()));
    }
 
    @ApiOperation("计划详情")
    @GetMapping("/detail")
    public Result detail(@RequestParam(value = "id") Integer id) {
        return Result.success(planService.detail(id));
    }
 
    @ApiOperation("添加计划")
    @PostMapping("/add")
    public Result add(@ApiParam(hidden = true) Session session,
                      @Validated @RequestBody PlanDto planDto) {
        planService.add((User) session.getUser(), planMapper.toEntity(planDto));
        return Result.success();
    }
 
    @ApiOperation("编辑计划")
    @PostMapping("/edit")
    public Result edit( @Validated @RequestBody PlanDto planDto) {
        planService.edit(planDto);
        return Result.success();
    }
 
    @ApiOperation("删除计划")
    @PostMapping("/batch/del")
    public Result batchDel(@Validated @RequestBody BatchReq request) {
        planService.deleteAllById(request.getIds());
        return Result.success();
    }
 
//    @PostMapping("/publish")
//    public Result publish(@RequestParam(value = "id") Integer idt) {
////        planService.publish(request.getIds());
//        return Result.success();
//    }
//    @GetMapping("/export")
//    @ResponseBody
//    public void export(@RequestParam(value = "clientId") Integer clientId,
//                       @RequestParam(value = "planId", required = false) Integer planId,
//                       HttpServletResponse response) throws IOException {
////        excelService.exportPlanExcel(planName, planTypeList, creatorId, response);
//    }
 
}