zss
6 天以前 51ec98113c6d49d0f7eec4e3c030e55e337e97db
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package com.yuanchu.mom.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
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.dto.PersonSupervisionRecordDto;
import com.yuanchu.mom.pojo.PersonSupervisionControlSheet;
import com.yuanchu.mom.pojo.PersonSupervisionProcessingSheet;
import com.yuanchu.mom.pojo.PersonSupervisionRecord;
import com.yuanchu.mom.service.PersonSupervisionControlSheetService;
import com.yuanchu.mom.service.PersonSupervisionProcessingSheetService;
import com.yuanchu.mom.service.PersonSupervisionRecordService;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.time.LocalDate;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * <p>
 * 监督记录 前端控制器
 * </p>
 *
 * @author
 * @since 2024-10-10 04:16:49
 */
@Api(tags = "人员 - 监督记录")
@RestController
@RequestMapping("/personSupervisionRecord")
public class PersonSupervisionRecordController {
 
    @Autowired
    private PersonSupervisionRecordService personSupervisionRecordService;
 
    @Autowired
    private PersonSupervisionControlSheetService personSupervisionControlSheetService;
 
    @Autowired
    private PersonSupervisionProcessingSheetService personSupervisionProcessingSheetService;
 
    @ApiOperation(value = "新增/更新 监督记录")
    @PostMapping("addOrUpdatePersonSupervisionRecord")
    public Result<?> addOrUpdatePersonSupervisionRecord(@RequestBody PersonSupervisionRecord personSupervisionRecord) {
        personSupervisionRecordService.saveOrUpdate(personSupervisionRecord);
        return Result.success();
    }
 
    @ApiOperation(value = "批量删除 监督记录")
    @ApiImplicitParam(name = "ids", dataType = "array", allowMultiple = true, paramType = "query")
    @DeleteMapping("deletePersonSupervisionRecord")
    public Result<?> deletePersonSupervisionRecord(@RequestParam("ids") List<Integer> ids) {
        personSupervisionRecordService.deletePersonSupervisionRecord(ids);
        return Result.success();
    }
 
    @ApiOperation(value = "查询 监督记录")
    @GetMapping("personSupervisionRecordPage")
    public Result<IPage<PersonSupervisionRecordDto>> personSupervisionRecordPage(Page page,
                                                                                 Integer userId,
                                                                                 Integer departLimsId,
                                                                                 String userName) {
        return Result.success(personSupervisionRecordService.personSupervisionRecordPage(page, userId, userName, departLimsId));
    }
 
    @ApiOperation(value = "查询 监督记录 - 控制单")
    @GetMapping("personSupervisionControlSheetPage")
    public Result<?> personSupervisionControlSheetPage(Integer id) {
        PersonSupervisionControlSheet byId = personSupervisionControlSheetService.getOne(Wrappers.<PersonSupervisionControlSheet>lambdaQuery()
                .eq(PersonSupervisionControlSheet::getSupervisionRecordId, id));
        if (ObjectUtils.isEmpty(byId)) {
            return Result.fail(202);
        } else {
            return Result.success(byId);
        }
    }
 
    @ApiOperation(value = "查询 监督记录 - 处理单")
    @GetMapping("personSupervisionProcessingPage")
    public Result<?> personSupervisionProcessingPage(Integer id) {
        PersonSupervisionProcessingSheet byId = personSupervisionProcessingSheetService.getOne(Wrappers.<PersonSupervisionProcessingSheet>lambdaQuery()
                .eq(PersonSupervisionProcessingSheet::getSupervisionRecordId, id));
        if (ObjectUtils.isEmpty(byId)) {
            return Result.fail(202);
        } else {
            return Result.success(byId);
        }
    }
 
    @ApiOperation(value = "新增/更新 监督记录 - 控制单")
    @PostMapping("addOrUpdatePersonSupervisionControl")
    public Result<?> addOrUpdatePersonSupervisionControl(@RequestBody PersonSupervisionControlSheet personSupervisionControlSheet) {
        PersonSupervisionControlSheet supervisionControlSheet = personSupervisionControlSheetService.getOne(Wrappers.<PersonSupervisionControlSheet>lambdaQuery()
                .eq(PersonSupervisionControlSheet::getSupervisionRecordId, personSupervisionControlSheet.getSupervisionRecordId()));
        personSupervisionControlSheet.setCreateTime(LocalDate.now());
        if (ObjectUtils.isEmpty(supervisionControlSheet)) {
            personSupervisionControlSheetService.save(personSupervisionControlSheet);
        } else {
            personSupervisionControlSheetService.updateById(personSupervisionControlSheet);
        }
        return Result.success();
    }
 
    @ApiOperation(value = "新增/更新 监督记录 - 处理单")
    @PostMapping("addOrUpdatePersonnelServiceProcessing")
    public Result<?> addOrUpdatePersonnelServiceProcessing(@RequestBody PersonSupervisionProcessingSheet personSupervisionProcessingSheet) {
        PersonSupervisionProcessingSheet processingSheetServiceOne = personSupervisionProcessingSheetService.getOne(Wrappers.<PersonSupervisionProcessingSheet>lambdaQuery()
                .eq(PersonSupervisionProcessingSheet::getSupervisionRecordId, personSupervisionProcessingSheet.getSupervisionRecordId()));
        if (ObjectUtils.isEmpty(processingSheetServiceOne)) {
            personSupervisionProcessingSheetService.save(personSupervisionProcessingSheet);
        } else {
            personSupervisionProcessingSheetService.updateById(personSupervisionProcessingSheet);
        }
        return Result.success();
    }
 
    /**
     * 导出人员监督记录
     * @return
     */
    @ValueAuth
    @ApiOperation(value = "导出人员监督记录")
    @GetMapping("/exportPersonSupervisionRecord")
    public void exportPersonSupervisionRecord(Integer id, HttpServletResponse response){
        personSupervisionRecordService.exportPersonSupervisionRecord(id, response);
    }
 
 
    /**
     * 导出人员监督记录纠正控制单
     * @return
     */
    @ValueAuth
    @ApiOperation(value = "导出人员监督记录纠正控制单")
    @GetMapping("/exportSupervisionControlSheet")
    public void exportSupervisionControlSheet(Integer supervisionRecordId, HttpServletResponse response){
        personSupervisionControlSheetService.exportSupervisionControlSheet(supervisionRecordId, response);
    }
 
    /**
     * 导出人员监督记录纠正处理单
     * @return
     */
    @ValueAuth
    @ApiOperation(value = "导出人员监督记录纠正处理单")
    @GetMapping("/exportSupervisionProcessingSheet")
    public void exportSupervisionProcessingSheet(Integer supervisionRecordId, HttpServletResponse response){
        personSupervisionProcessingSheetService.exportSupervisionProcessingSheet(supervisionRecordId, response);
    }
}