双重预防项目-国泰新华二开定制版
16639036659
2023-08-21 7d22021bf70d7c9a940928e0b437579844f6ae94
src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerReportController.java
@@ -5,6 +5,8 @@
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.entity.dto.resp.PreventRiskUnitCodeAndNameListQueryRespDTO;
import com.ruoyi.doublePrevention.service.RiskService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
@@ -19,6 +21,7 @@
import com.ruoyi.project.tr.hiddenDangerCheckPoint.service.IHiddenDangerCheckPointService;
import com.ruoyi.project.tr.hiddenTroubleType.domain.HiddenTroubleType;
import com.ruoyi.project.tr.hiddenTroubleType.service.IHiddenTroubleTypeService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
@@ -107,6 +110,19 @@
        // 第二:1.隐患上报创建人(register_user_id) 或者 2.(判定人(judge_user_id),report_status 不为null )------为本登录帐号userId的
        hiddenDangerCheckPoint.setJudgeQueryByUserId(getSysUser().getUserId());
        List<HiddenDangerCheckPoint> list = hiddenDangerCheckPointService.selectHiddenDangerCheckPointList(hiddenDangerCheckPoint);
        List<HiddenDangerCheckPoint> resultList = new ArrayList<>();
        for (HiddenDangerCheckPoint dangerCheckPoint : list) {
            PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoById(dangerCheckPoint.getId());
            if (ObjectUtils.isNotEmpty(dangerInfo)){
                dangerCheckPoint.setHazardCode(dangerInfo.getHazardCode());
                dangerCheckPoint.setDangerSrc(dangerInfo.getDangerSrc());
                dangerCheckPoint.setDangerReason(dangerInfo.getDangerReason());
                dangerCheckPoint.setHazardDangerType(dangerInfo.getHazardDangerType());
                dangerCheckPoint.setDangerResult(dangerInfo.getDangerResult());
            }
            resultList.add(dangerCheckPoint);
        }
        return getDataTable(list);
    }
@@ -129,13 +145,13 @@
        hiddenTroubleType.setCompanyId(sysUser.getCompanyId());
        List<HiddenTroubleType> hiddenTroubleTypeList = hiddenTroubleTypeService.selectHiddenTroubleTypeList(hiddenTroubleType);
        mmap.put("hiddenTroubleTypeList", hiddenTroubleTypeList);
        List<PreventRiskUnitCodeAndNameListQueryRespDTO> respDTOS = riskService.listRiskUnitCodeAndName();
        mmap.put("riskUnits", respDTOS);
        return prefix + "/addDangerReport";
    }
    /**
     * 新增保存隐患上报
     * todo-2022 隐患上报   tr_hidden_danger_check_point
     */
    @Log(title = "隐患上报", businessType = BusinessType.INSERT)
    @PostMapping("/addDangerReportSave")
@@ -165,13 +181,13 @@
            throw new RuntimeException("添加隐患信息失败");
        }
        // todo-2022 此处插入附属表
        //获取Id返回值
        hdcp.getId();
        int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
        if (result< 1){
            throw new RuntimeException("添加隐患附属信息失败");
        }
//        // 此处插入附属表  ---  此处已弃用,在核查整改后插入
//        //获取Id返回值
//        hdcp.getId();
//        int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
//        if (result< 1){
//            throw new RuntimeException("添加隐患附属信息失败");
//        }
        hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
@@ -224,7 +240,7 @@
        hiddenDangerCheck.setDangerPlaceName(hdcp.getDangerPlaceName());
        hiddenDangerCheckService.insertHiddenDangerCheck(hiddenDangerCheck);//构造隐患排查对象保存,主要保存隐患责任部门,隐患地点
        // todo-2022 1.全流程隐患上报信息封装
        //1.全流程隐患上报信息封装
        hdcp.setCheckId(hiddenDangerCheck.getCheckId());
@@ -260,7 +276,6 @@
                hdcp.setExamineStatus(TrHiddenDangerCheckConstants.EXAMINE_STATUS_NOT_EXAMINE);//核查状态(待核查)
            }
        }
        // todo-2022 2.全流程隐患提交信息封装-未操作
        //隐患核查
@@ -276,8 +291,6 @@
            }
        }
        // todo-2022 3.全流程隐患核查信息封装-未操作
        //隐患整改
//        hdcp.setRectifyCreateTime(DateUtils.getNowDate());//设置整改时间
@@ -286,7 +299,7 @@
        hdcp.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_ACCEPT);//隐患验收阶段(数据进入到隐患验收阶段)
        // todo-2022 4.全流程隐患整改信息封装-未操作
        //4.全流程隐患整改信息封装-未操作
        //隐患验收
        if (!StringUtils.isEmpty(hdcp.getAcceptResult())) {
@@ -300,7 +313,7 @@
//              hdcp.setAcceptCreateTime(DateUtils.getNowDate());//设置验收时间
                hdcp.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_PASS);//验收状态(验收通过)
                // todo-2022 5.全流程隐患验收信息封装-未操作
                //5.全流程隐患验收信息封装-未操作
            }
        }
@@ -325,17 +338,23 @@
    /**
     * 修改隐患上报
     */
    @GetMapping("/editDangerReport/{id}")
    public String editDangerReport(@PathVariable("id") Long id, ModelMap mmap) {
        HiddenDangerCheckPoint hdcp = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(id);
        // todo-2022 修改前查询
        PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoById(hdcp.getId());
        if (ObjectUtils.isNotEmpty(dangerInfo)){
            hdcp.setHazardCode(dangerInfo.getHazardCode());
            hdcp.setDangerSrc(dangerInfo.getDangerSrc());
            hdcp.setDangerReason(dangerInfo.getDangerReason());
            hdcp.setHazardDangerType(dangerInfo.getHazardDangerType());
            hdcp.setDangerResult(dangerInfo.getDangerResult());
        }
        mmap.put("hiddenDangerCheckPoint", hdcp);
        //获取所在公司人员信息
@@ -374,10 +393,10 @@
            hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
            // todo-2022 此处修改附属表
            int result = riskService.updateDangerInfo(hiddenDangerCheckPoint);
            if (result < 1){
                throw new RuntimeException("修改失败");
            }
//            int result = riskService.updateDangerInfo(hiddenDangerCheckPoint);
//            if (result < 1){
//                throw new RuntimeException("修改失败");
//            }
            hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
            return AjaxResult.success();
@@ -437,11 +456,11 @@
                hiddenDangerCheckPoint.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_EXAMINE);//隐患核查阶段(数据进入到隐患核查阶段)
                hiddenDangerCheckPoint.setExamineStatus(TrHiddenDangerCheckConstants.EXAMINE_STATUS_NOT_EXAMINE);//核查状态(待核查)
                // todo-2022 隐患信息判定
                int result = riskService.updateDangerInfoJudge(hiddenDangerCheckPoint);
                if (result < 1){
                    throw new RuntimeException("整改信息保存失败");
                }
//                // todo-2022 隐患信息判定
//                int result = riskService.updateDangerInfoJudge(hiddenDangerCheckPoint);
//                if (result < 1){
//                    throw new RuntimeException("整改信息保存失败");
//                }
            }
        }
@@ -470,11 +489,10 @@
            hiddenDangerCheckService.deleteHiddenDangerCheckById(hdcp.getCheckId());
            // todo-2022 此处删除附属表
            int result = riskService.deleteDangerInfo(hdcp.getId());
            if (result < 1){
                throw  new RuntimeException("删除失败");
            }
//            int result = riskService.deleteDangerInfo(hdcp.getId());
//            if (result < 1){
//                throw  new RuntimeException("删除失败");
//            }
            hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
            return AjaxResult.success();