双重预防项目-国泰新华二开定制版
heheng
2025-06-24 e98eeaaa5766511fdb8e6d5e412eb1c59d1f07ce
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
package com.ruoyi.project.tr.hiddenDangerCheck.controller;
 
import com.ruoyi.common.constant.TrHiddenDangerCheckConstants;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.doublePrevention.entity.PreventRiskDangerInfo;
import com.ruoyi.doublePrevention.service.RiskService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.service.JpushService;
import com.ruoyi.project.system.user.domain.User;
import com.ruoyi.project.system.user.service.IUserService;
import com.ruoyi.project.tr.hiddenDangerCheckPoint.domain.HiddenDangerCheckPoint;
import com.ruoyi.project.tr.hiddenDangerCheckPoint.service.IHiddenDangerCheckPointService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * 隐患整改Controller
 *
 *
 * @date 2020-05-08
 */
@Controller
@RequestMapping("/tr/hiddenDangerCheck/dangerRectify")
public class DangerRectifyController extends BaseController {
    private String prefix = "tr/hiddenDangerCheck/dangerRectify";
 
    @Autowired
    private IHiddenDangerCheckPointService hiddenDangerCheckPointService;
 
    @Autowired
    private IUserService userService;
 
    @Autowired
    JpushService jpushService;
 
    @Autowired
    private RiskService riskService;
 
    @GetMapping()
    public String hiddenDangerCheckPoint() {
        return prefix + "/dangerRectify";
    }
 
    /**
     * 查询隐患整改列表
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(HiddenDangerCheckPoint hiddenDangerCheckPoint) {
        startPage();
        hiddenDangerCheckPoint.setRectifyUserId(getSysUser().getUserId());//整改人为本登录帐号userId的
        List<HiddenDangerCheckPoint> list = hiddenDangerCheckPointService.selectHiddenDangerCheckPointList(hiddenDangerCheckPoint);
        return getDataTable(list);
    }
 
    /**
     * 隐患整改--整改
     *
     */
    @Log(title = "隐患整改--整改")
    @GetMapping("/editDangerRectify/{id}")
    public String editDangerRectify(@PathVariable("id") Long id, ModelMap mmap) {
        //隐患排查实体
        HiddenDangerCheckPoint hiddenDangerCheckPoint = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(Long.valueOf(id));
        mmap.put("hdcp", hiddenDangerCheckPoint);
 
        //获取所在公司人员信息
        User sysUser = getSysUser();
        if (sysUser != null && sysUser.getCompanyId() != null) {
            User userTemp = new User();
            userTemp.setCompanyId(sysUser.getCompanyId());
            List<User> userList = userService.selectUserList(userTemp);
            mmap.put("userList", userList);
        }
        return prefix + "/editDangerRectify";
    }
 
    /**
     * 隐患整改--延期
     *
     */
    @Log(title = "隐患整改--整改")
    @GetMapping("/delayDangerRectify/{id}")
    public String delayDangerRectify(@PathVariable("id") Long id, ModelMap mmap) {
        //隐患排查实体
        HiddenDangerCheckPoint hiddenDangerCheckPoint = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(Long.valueOf(id));
        mmap.put("hdcp", hiddenDangerCheckPoint);
 
        //获取所在公司人员信息
        User sysUser = getSysUser();
        if (sysUser != null && sysUser.getCompanyId() != null) {
            User userTemp = new User();
            userTemp.setCompanyId(sysUser.getCompanyId());
            List<User> userList = userService.selectUserList(userTemp);
            mmap.put("userList", userList);
        }
        return prefix + "/delayDangerRectify";
    }
 
 
    /**
     * 隐患整改--保存
     */
    @Log(title = "隐患整改--保存", businessType = BusinessType.UPDATE)
    @PostMapping("/editDangerRectifySave")
    @ResponseBody
    @Transactional
    public AjaxResult editDangerRectifySave(HiddenDangerCheckPoint hiddenDangerCheckPoint) {
        //获取当前更新用户信息
        hiddenDangerCheckPoint.setUpdateBy(ShiroUtils.getLoginName());
        hiddenDangerCheckPoint.setUpdateTime(DateUtils.getNowDate());
        hiddenDangerCheckPoint.setRectifyCreateTime(DateUtils.getNowDate());//设置整改时间
        hiddenDangerCheckPoint.setRectifyStatus(TrHiddenDangerCheckConstants.RECTIFY_STATUS_ALREADY_RECTIFY);//整改状态(已整改)
        hiddenDangerCheckPoint.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_NOT_ACCEPT);//验收状态(未验收)
        hiddenDangerCheckPoint.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_ACCEPT);//隐患验收阶段(数据进入到隐患验收阶段)
        int i = hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
 
        // todo-2022 隐患信息附属表
        int result = riskService.updateDangerInfoRectify(hiddenDangerCheckPoint);
        if (result < 1){
            throw new RuntimeException("整改信息保存失败");
        }
 
        hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
 
        return toAjax(i);
    }
 
 
 
    /**
     * 隐患整改--查看
     */
    @Log(title = "隐患整改--查看")
    @GetMapping("/detailDangerRectify/{id}")
    public String detailDangerRectify(@PathVariable("id") Long id, ModelMap mmap) {
        //隐患排查实体
        HiddenDangerCheckPoint hiddenDangerCheckPoint = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(Long.valueOf(id));
        PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoById(hiddenDangerCheckPoint.getId());
        if (ObjectUtils.isNotEmpty(dangerInfo)){
            hiddenDangerCheckPoint.setHazardCode(dangerInfo.getHazardCode());
            hiddenDangerCheckPoint.setDangerSrc(dangerInfo.getDangerSrc());
            hiddenDangerCheckPoint.setDangerReason(dangerInfo.getDangerReason());
            hiddenDangerCheckPoint.setHazardDangerType(dangerInfo.getHazardDangerType());
            hiddenDangerCheckPoint.setDangerResult(dangerInfo.getDangerResult());
        }
        mmap.put("hdcp", hiddenDangerCheckPoint);
        return prefix + "/detailDangerRectify";
    }
 
 
    /**
     * 隐患整改延期 - 保存
     */
    @Log(title = "隐患上报", businessType = BusinessType.DELETE)
    @PostMapping("/rectifyTimeOut")
    @ResponseBody
    @Transactional
    public AjaxResult rectifyTimeOutSave(HiddenDangerCheckPoint hdcp) {
        if(ObjectUtils.isEmpty(hdcp.getId())){
            return AjaxResult.error("id不能为空");
        }
        if(ObjectUtils.isEmpty(hdcp.getRectifyDeadlineTime())){
            return AjaxResult.error("延期时间不能为空");
        }
        int i = hiddenDangerCheckPointService.rectifyTimeOut(hdcp.getId(), hdcp.getRectifyDeadlineTime());
        if (i < 1){
            return AjaxResult.error("操作失败");
        }
        return AjaxResult.success();
    }
 
 
}