郑永安
2023-09-19 69185134fcfaf913ea45f1255677225a2cc311a4
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
package com.gk.hotwork.doublePrevention.controller;
 
import com.gk.hotwork.Controller.Base.BaseController;
import com.gk.hotwork.Domain.Utils.PageUtils;
import com.gk.hotwork.Domain.Vo.PageQuery;
import com.gk.hotwork.Domain.co.ContextCacheUser;
import com.gk.hotwork.Domain.Vo.ResultVO;
import com.gk.hotwork.doublePrevention.entity.PreventDangerRectify;
import com.gk.hotwork.doublePrevention.entity.dto.query.OwnRectifyPageQuery;
import com.gk.hotwork.doublePrevention.entity.dto.req.*;
import com.gk.hotwork.doublePrevention.service.RectifyService;
import com.gk.hotwork.doublePrevention.utils.CacheUserTransfer;
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;
 
@RestController
@RequestMapping("prevent/dangerRectify")
public class PreventDangerRectifyController extends BaseController {
 
    @Autowired
    private RectifyService rectifyService;
 
    /**
     * 隐患整改清单-分页查询
     */
    @PostMapping("/select/getDangerRectifyPage")
    public ResultVO<PreventDangerRectify> getDangerRectifyPage(Authentication authentication, @RequestBody PreventDangerRectifyQueryReqDTO rectifyQueryReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return rectifyService.getDangerRectifyPage(currentUser.getUid(), rectifyQueryReqDTO);
    }
 
    /**
     * 隐患整改清单-查询:待验收与已验收
     */
    @PostMapping("/select/getRectifyOverPage")
    public ResultVO<PreventDangerRectify> getRectifyOverPage(Authentication authentication, @RequestBody PreventRectifyOverQueryReqDTO rectifyOverQueryReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        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 = CacheUserTransfer.transfer(getUser());
        return rectifyService.updateDangerRectify(currentUser.getUid(), rectifyUpdateReqDTO);
    }
 
    /**
     * 隐患整改清单-删除
     */
    @PostMapping("/delete/deleteDangerRectify")
    public ResultVO<PreventDangerRectify> deleteDangerRectify(Authentication authentication, @RequestBody PreventDangerRectifyDeleteReqDTO rectifyDeleteReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return rectifyService.deleteDangerRectify(currentUser.getUid(), rectifyDeleteReqDTO);
    }
 
    /**
     * 隐患整改清单--验收
     */
    @PostMapping("/update/reportRectify")
    public ResultVO<PreventDangerRectify> reportRectify(Authentication authentication, @RequestBody PreventDangerReportRectifyReqDTO reportRectiity) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return rectifyService.reportRectify(currentUser.getUid(), reportRectiity);
    }
 
    /**
     * 隐患整改清单-填报--整改
     */
    @PostMapping("/update/applyReport")
    public ResultVO<PreventDangerRectify> applyReport(Authentication authentication, @RequestBody PreventDangerReportRectifyReqDTO reportRectiity) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return rectifyService.applyReport(currentUser.getUid(), reportRectiity);
    }
 
    /**
     * 隐患整改--延期
     */
    @PostMapping("/update/timeOutRectify")
    public ResultVO<PreventDangerRectify> timeOutRectify(Authentication authentication, @RequestBody PreventDangerRectifyUpdateReqDTO updateReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return rectifyService.timeOutRectify(currentUser.getUid(), updateReqDTO);
    }
 
    /**
    * @Description: 获取当前用户需要他整改的即将超期的隐患单子
    */
    @PostMapping("/own/toRectify/page")
    public ResultVO ownRectifyPage(@RequestBody PageQuery<OwnRectifyPageQuery> pageQuery) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        PageUtils.checkCheck(pageQuery);
        return rectifyService.listOwnRectifyPage(currentUser, pageQuery);
    }
 
 
 
 
}