zss
2024-12-23 5172db1a5ceda6bfbeaad6fef8f77b184cffa914
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package com.yuanchu.mom.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.annotation.ValueAuth;
import com.yuanchu.mom.annotation.ValueClassify;
import com.yuanchu.mom.common.GetLook;
import com.yuanchu.mom.dto.PersonSupervisePlanDetailsDto;
import com.yuanchu.mom.dto.PersonSupervisePlanDto;
import com.yuanchu.mom.pojo.PersonSupervisePlan;
import com.yuanchu.mom.pojo.PersonSupervisePlanDetails;
import com.yuanchu.mom.service.*;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.Date;
 
/**
 * <p>
 * 监管计划 前端控制器
 * </p>
 *
 * @author tangbowen
 * @since 2024-09-29 11:13:25
 */
@Api(tags = "人员 - 监督计划")
@AllArgsConstructor
@RestController
@RequestMapping("/superVisePlan")
//@CustomClazzName(name = "资源要求", index = 8)
public class SuperVisePlanController {
 
    private PersonSupervisePlanDetailsService personSupervisePlanDetailsService;
 
    private PersonSupervisePlanService personSupervisePlanService;
 
    private GetLook getLook;
 
    @ValueClassify("监督计划")
    @ApiOperation(value = "查询 年度计划")
    @GetMapping("/yearPlanList")
    public Result<IPage<PersonSupervisePlanDto>> yearPlanList(Integer size, Integer current, @RequestParam(value = "organizationPerson",required = false) String organizationPerson) {
       return Result.success(personSupervisePlanService.yearPlanDtoIPage(new Page<>(current, size), organizationPerson));
    }
 
    @ValueClassify("监督计划")
    @ApiOperation(value = "批准 年度计划")
    @GetMapping("/yearPlanDetailApproval")
    public Result yearPlanDetailApproval(Integer id,Integer approvalStatus) {
        personSupervisePlanService.update(Wrappers.<PersonSupervisePlan>lambdaUpdate()
                .eq(PersonSupervisePlan::getId, id)
                .set(PersonSupervisePlan::getApprovalStatus, approvalStatus)
                .set(PersonSupervisePlan::getApprovalId,getLook.selectPowerByMethodAndUserId(null).get("userId"))
                .set(PersonSupervisePlan::getApprovalDate, LocalDateTime.now()));
        return Result.success("更新成功");
    }
 
    @ValueClassify("监督计划")
    @ApiOperation(value = "删除 年度计划")
    @DeleteMapping("/yearPlanDel")
    public Result yearPlanDel(String id) {
        personSupervisePlanService.removeById(id);
        // 对应的年度计划详情也需删除
        personSupervisePlanDetailsService.remove(Wrappers.<PersonSupervisePlanDetails>lambdaQuery()
                .eq(PersonSupervisePlanDetails::getPlanId, id));
        return Result.success();
    }
 
    @ValueClassify("监督计划")
    @ApiOperation(value = "查询 年度计划详情")
    @GetMapping("/yearPlanDetailList")
    public Result<IPage<PersonSupervisePlanDetailsDto>> yearPlanDetailList(Page page,
                                                                           Integer planId,
                                                                           @RequestParam(value = "date",required = false) String date,
                                                                           @RequestParam(value = "project",required = false) String project) {
        return Result.success(personSupervisePlanDetailsService.yearPlanDetailPage(page, date,project, planId));
    }
 
    @ValueClassify("监督计划")
    @ApiOperation(value = "导入 年度计划")
    @PostMapping("/yearPlanDetailImport")
    public Result yearPlanDetailImport(@RequestPart("file") MultipartFile file) {
        personSupervisePlanService.yearPlanDetailImport(file);
        return Result.success();
    }
 
    @ValueClassify("监督计划")
    @ApiOperation(value = "删除 年度计划详情")
    @DeleteMapping("/yearPlanDetailDel")
    public Result yearPlanDetailDel(String id) {
        return Result.success(personSupervisePlanDetailsService.removeById(id));
    }
 
    @ValueClassify("监督计划")
    @ApiOperation(value = "新增 年度计划详情")
    @PostMapping("/yearPlanDetailAdd")
    public Result yearPlanDetailAdd(@RequestBody PersonSupervisePlanDetails personSupervisePlanDetails) {
        personSupervisePlanDetailsService.save(personSupervisePlanDetails);
        return Result.success();
    }
 
    @ValueClassify("监督计划")
    @ApiOperation(value = "编辑 年度计划详情")
    @PostMapping("/yearPlanDetailEdit")
    public Result yearPlanDetailEdit(@RequestBody PersonSupervisePlanDetails personSupervisePlanDetails) {
        personSupervisePlanDetailsService.updateById(personSupervisePlanDetails);
        return Result.success("保存成功");
    }
 
    /**
     * 导出人员监督计划
     * @return
     */
    @ValueAuth
    @ApiOperation(value = "导出人员监督计划")
    @PostMapping("/exportSuperVisePlan")
    public void exportSuperVisePlan(Integer id, HttpServletResponse response){
        personSupervisePlanService.exportSuperVisePlan(id, response);
    }
}