郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
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
package com.gkhy.safePlatform.doublePrevention.controller;
 
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.doublePrevention.entity.PreventDangerRectify;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.*;
import com.gkhy.safePlatform.doublePrevention.service.RectifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.security.Principal;
 
@RestController
@RequestMapping("prevent/dangerRectify")
public class PreventDangerRectifyController {
 
    @Autowired
    private RectifyService rectifyService;
 
    /**
     * 隐患整改清单-分页查询
     */
    @PostMapping("/select/getDangerRectifyPage")
    public ResultVO<PreventDangerRectify> getDangerRectifyPage(Authentication authentication, @RequestBody PreventDangerRectifyQueryReqDTO rectifyQueryReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
        return rectifyService.getDangerRectifyPage(currentUser.getUid(), rectifyQueryReqDTO);
    }
 
    /**
     * 隐患整改清单-查询:待验收与已验收
     */
    @PostMapping("/select/getRectifyOverPage")
    public ResultVO<PreventDangerRectify> getRectifyOverPage(Authentication authentication, @RequestBody PreventRectifyOverQueryReqDTO rectifyOverQueryReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
        return rectifyService.getRectifyOverPage(currentUser.getUid(), rectifyOverQueryReqDTO);
    }
 
//    /**
//     * 隐患整改清单-新增
//     */
//    @PostMapping("/insert/saveDangerRectify")
//    public ResultVO<PreventDangerRectify> saveDangerRectify(Principal principal, @RequestBody PreventDangerRectifySaveReqDTO rectifySaveReqDTO) {
//
//        //此处principal.getName就是id
//        String userId =principal.getName();
//        return rectifyService.saveDangerRectify(Long.valueOf(userId), rectifySaveReqDTO);
//    }
 
    /**
     * 隐患整改清单-修改
     */
    @PostMapping("/update/updateDangerRectify")
    public ResultVO<PreventDangerRectify> updateDangerRectify(Authentication authentication, @RequestBody PreventDangerRectifyUpdateReqDTO rectifyUpdateReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
        return rectifyService.updateDangerRectify(currentUser.getUid(), rectifyUpdateReqDTO);
    }
 
    /**
     * 隐患整改清单-删除
     */
    @PostMapping("/delete/deleteDangerRectify")
    public ResultVO<PreventDangerRectify> deleteDangerRectify(Authentication authentication, @RequestBody PreventDangerRectifyDeleteReqDTO rectifyDeleteReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
        return rectifyService.deleteDangerRectify(currentUser.getUid(), rectifyDeleteReqDTO);
    }
 
    /**
     * 隐患整改清单--验收
     */
    @PostMapping("/update/reportRectify")
    public ResultVO<PreventDangerRectify> reportRectify(Authentication authentication, @RequestBody PreventDangerReportRectifyReqDTO reportRectiity) {
        //获取用户信息
        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
        return rectifyService.reportRectify(currentUser.getUid(), reportRectiity);
    }
 
    /**
     * 隐患整改清单-填报--整改
     */
    @PostMapping("/update/applyReport")
    public ResultVO<PreventDangerRectify> applyReport(Authentication authentication, @RequestBody PreventDangerReportRectifyReqDTO reportRectiity) {
        //获取用户信息
        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
        return rectifyService.applyReport(currentUser.getUid(), reportRectiity);
    }
 
    /**
     * 隐患整改--延期
     */
    @PostMapping("/update/timeOutRectify")
    public ResultVO<PreventDangerRectify> timeOutRectify(Authentication authentication, @RequestBody PreventDangerRectifyUpdateReqDTO updateReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
        return rectifyService.timeOutRectify(currentUser.getUid(), updateReqDTO);
    }
 
}