双重预防项目-国泰新华二开定制版
heheng
2025-04-15 7be0d5b901b999d2347774df3cc1a64927838bb3
src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerReportController.java
@@ -6,7 +6,9 @@
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.doublePrevention.service.baseService.PreventRiskDangerConfirmLogService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
@@ -57,6 +59,9 @@
    @Autowired
    private RiskService riskService;
    @Autowired
    private PreventRiskDangerConfirmLogService confirmLogService;
    @GetMapping()
    public String hiddenDangerCheck(ModelMap mmap) {
        User currentUser = getSysUser();
@@ -93,7 +98,6 @@
        hiddenDangerCheckPoint.setJudgeQueryByUserIdList(userIdList);//隐患整改人ID 为登陆账号companyId下的userId的
        startPage();
        List<HiddenDangerCheckPoint> list = hiddenDangerCheckPointService.selectHiddenDangerCheckPointList(hiddenDangerCheckPoint);
        return getDataTable(list);
    }
@@ -113,7 +117,6 @@
        List<HiddenDangerCheckPoint> resultList = new ArrayList<>();
        for (HiddenDangerCheckPoint dangerCheckPoint : list) {
            // todo-2022 修改前查询
            PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoById(dangerCheckPoint.getId());
            if (ObjectUtils.isNotEmpty(dangerInfo)){
                dangerCheckPoint.setHazardCode(dangerInfo.getHazardCode());
@@ -122,10 +125,9 @@
                dangerCheckPoint.setHazardDangerType(dangerInfo.getHazardDangerType());
                dangerCheckPoint.setDangerResult(dangerInfo.getDangerResult());
            }
            resultList.add(dangerCheckPoint);
        }
        return getDataTable(resultList);
        return getDataTable(list);
    }
    /**
@@ -147,19 +149,25 @@
        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")
    @ResponseBody
    @Transactional
    public AjaxResult addDangerReportSave(HiddenDangerCheckPoint hdcp) {
        if (ObjectUtils.isEmpty(hdcp.getCheckPerson())){
            throw new RuntimeException("检查人不能为空");
        }
        if (ObjectUtils.isEmpty(hdcp.getFindTime())){
            throw new RuntimeException("发现时间不能为空");
        }
        HiddenDangerCheck hiddenDangerCheck  = new HiddenDangerCheck();
        hiddenDangerCheck.setCreateBy(ShiroUtils.getLoginName());//创建者
        hiddenDangerCheck.setCreateTime(DateUtils.getNowDate());//获取创建时间
@@ -183,13 +191,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());//查询未执行任务总数量并推送
@@ -232,7 +240,12 @@
        HiddenDangerCheck hiddenDangerCheck  = new HiddenDangerCheck();
//        hiddenDangerCheck.setCreateBy(ShiroUtils.getLoginName());//创建者
//        hiddenDangerCheck.setCreateTime(DateUtils.getNowDate());//获取创建时间
        if (ObjectUtils.isEmpty(hdcp.getCheckPerson())){
            throw new RuntimeException("检查人不能为空");
        }
        if (ObjectUtils.isEmpty(hdcp.getFindTime())){
            throw new RuntimeException("发现时间不能为空");
        }
        hiddenDangerCheck.setCreateBy(ShiroUtils.getLoginName());//创建者
        hiddenDangerCheck.setCreateTime(hdcp.getRectifyCreateTime());//获取创建时间
@@ -242,7 +255,7 @@
        hiddenDangerCheck.setDangerPlaceName(hdcp.getDangerPlaceName());
        hiddenDangerCheckService.insertHiddenDangerCheck(hiddenDangerCheck);//构造隐患排查对象保存,主要保存隐患责任部门,隐患地点
        // todo-2022 1.全流程隐患上报信息封装
        //1.全流程隐患上报信息封装
        hdcp.setCheckId(hiddenDangerCheck.getCheckId());
@@ -278,7 +291,6 @@
                hdcp.setExamineStatus(TrHiddenDangerCheckConstants.EXAMINE_STATUS_NOT_EXAMINE);//核查状态(待核查)
            }
        }
        // todo-2022 2.全流程隐患提交信息封装-未操作
        //隐患核查
@@ -294,8 +306,6 @@
            }
        }
        // todo-2022 3.全流程隐患核查信息封装-未操作
        //隐患整改
//        hdcp.setRectifyCreateTime(DateUtils.getNowDate());//设置整改时间
@@ -304,7 +314,7 @@
        hdcp.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_ACCEPT);//隐患验收阶段(数据进入到隐患验收阶段)
        // todo-2022 4.全流程隐患整改信息封装-未操作
        //4.全流程隐患整改信息封装-未操作
        //隐患验收
        if (!StringUtils.isEmpty(hdcp.getAcceptResult())) {
@@ -318,7 +328,7 @@
//              hdcp.setAcceptCreateTime(DateUtils.getNowDate());//设置验收时间
                hdcp.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_PASS);//验收状态(验收通过)
                // todo-2022 5.全流程隐患验收信息封装-未操作
                //5.全流程隐患验收信息封装-未操作
            }
        }
@@ -343,11 +353,6 @@
    /**
     * 修改隐患上报
     */
@@ -357,11 +362,13 @@
        // todo-2022 修改前查询
        PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoById(hdcp.getId());
        hdcp.setHazardCode(dangerInfo.getHazardCode());
        hdcp.setDangerSrc(dangerInfo.getDangerSrc());
        hdcp.setDangerReason(dangerInfo.getDangerReason());
        hdcp.setHazardDangerType(dangerInfo.getHazardDangerType());
        hdcp.setDangerResult(dangerInfo.getDangerResult());
        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);
@@ -401,10 +408,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();
@@ -445,7 +452,6 @@
    /**
     * 修改判定隐患上报保存
     * todo-2022 隐患核查(判定隐患) 以判定的隐患,才需要上报
     */
    @Log(title = "修改判定隐患上报保存", businessType = BusinessType.UPDATE)
    @PostMapping("/editJudgeDangerReportSave")
@@ -464,15 +470,20 @@
                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("整改信息保存失败");
                }
//                //
//                int result = riskService.updateDangerInfoJudge(hiddenDangerCheckPoint);
//                if (result < 1){
//                    throw new RuntimeException("整改信息保存失败");
//                }
            }
        }
        int i = hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
        int result = confirmLogService.saveConfirmLog(hiddenDangerCheckPoint);
        if (result < 1){
            return AjaxResult.error("操作失败");
        }
        hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
@@ -497,11 +508,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();