双重预防项目-国泰新华二开定制版
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
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.project.system.user.domain.User;
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/dangerAccept")
public class DangerAcceptController extends BaseController {
    private String prefix = "tr/hiddenDangerCheck/dangerAccept";
 
    @Autowired
    private IHiddenDangerCheckPointService hiddenDangerCheckPointService;
 
    @Autowired
    private RiskService riskService;
 
    @GetMapping()
    public String hiddenDangerCheckPoint() {
        return prefix + "/dangerAccept";
    }
 
    /**
     * 查询隐患排查列表头
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(HiddenDangerCheckPoint hiddenDangerCheckPoint) {
        startPage();
        hiddenDangerCheckPoint.setAcceptUserId(getSysUser().getUserId());//验收人为本登录帐号userId的
        List<HiddenDangerCheckPoint> list = hiddenDangerCheckPointService.selectHiddenDangerCheckPointList(hiddenDangerCheckPoint);
        for (HiddenDangerCheckPoint dangerCheckPoint : list) {
            PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoByDangerCheckPointId(dangerCheckPoint.getId());
            if (ObjectUtils.isNotEmpty(dangerInfo)){
                if (ObjectUtils.isNotEmpty(dangerInfo.getReportTime())){
                    dangerCheckPoint.setReportTime(dangerInfo.getReportTime());
                }
            }
        }
        return getDataTable(list);
    }
 
 
    /**
     * 隐患验收--验收
     */
    @Log(title = "隐患验收--验收")
    @GetMapping("/editDangerAccept/{id}")
    public String editDangerAccept(@PathVariable("id") Long id, ModelMap mmap) {
        //隐患排查实体
        HiddenDangerCheckPoint hiddenDangerCheckPoint = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(Long.valueOf(id));
        mmap.put("hdcp", hiddenDangerCheckPoint);
        return prefix + "/editDangerAccept";
    }
 
 
    /**
     * 隐患验收--保存
     */
    @Log(title = "隐患验收--保存", businessType = BusinessType.UPDATE)
    @PostMapping("/editDangerAcceptSave")
    @ResponseBody
    @Transactional
    public AjaxResult editDangerAcceptSave(HiddenDangerCheckPoint hiddenDangerCheckPoint) {
        //获取当前更新用户信息
        User sysUser = getSysUser();
        hiddenDangerCheckPoint.setUpdateBy(ShiroUtils.getLoginName());
        hiddenDangerCheckPoint.setUpdateTime(DateUtils.getNowDate());
        if (ObjectUtils.isEmpty(hiddenDangerCheckPoint.getAcceptCreateTime())){
            throw new RuntimeException("请填写验收时间");
        }
        if (!StringUtils.isEmpty(hiddenDangerCheckPoint.getAcceptResult())) {
            //验收结果 (0不通过 打回上一级整改阶段  1通过)
            if ("0".equals(hiddenDangerCheckPoint.getAcceptResult())) {
                hiddenDangerCheckPoint.setAcceptCreateTime(hiddenDangerCheckPoint.getAcceptCreateTime());//设置验收时间 todo 改为使用前端传输的时间
                hiddenDangerCheckPoint.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_RECTIFY);//隐患整改阶段(数据进入到隐患整改阶段)
                hiddenDangerCheckPoint.setRectifyStatus(TrHiddenDangerCheckConstants.RECTIFY_STATUS_NOT_RECTIFY);//整改状态(未整改)
                hiddenDangerCheckPoint.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_NOT_PASS);//验收状态(验收未通过)
            } else if ("1".equals(hiddenDangerCheckPoint.getAcceptResult())) {
                hiddenDangerCheckPoint.setAcceptCreateTime(hiddenDangerCheckPoint.getAcceptCreateTime());
                hiddenDangerCheckPoint.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_PASS);//验收状态(验收通过)
            }
        }
        int i = hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
 
        // todo-2022 验收通过,修改为已验收状态
        int result = riskService.updateDangerInfoAccept(hiddenDangerCheckPoint);
        if (result < 1){
            throw new RuntimeException("隐患验收信息保存失败");
        }
 
        hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
        return toAjax(i);
    }
 
 
    /**
     * 隐患验收--查看
     */
    @Log(title = "隐患验收--查看")
    @GetMapping("/detailDangerAccept/{id}")
    public String detailDangerAccept(@PathVariable("id") Long id, ModelMap mmap) {
        //隐患排查实体
        HiddenDangerCheckPoint hiddenDangerCheckPoint = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(Long.valueOf(id));
        PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoByDangerCheckPointId(hiddenDangerCheckPoint.getId());
        if (ObjectUtils.isNotEmpty(dangerInfo)){
            if (ObjectUtils.isNotEmpty(dangerInfo.getReportTime())){
                hiddenDangerCheckPoint.setReportTime(dangerInfo.getReportTime());
            }
        }
        mmap.put("hdcp", hiddenDangerCheckPoint);
        return prefix + "/detailDangerAccept";
    }
 
 
 
}