双重预防项目-国泰新华二开定制版
16639036659
2023-09-11 c3447610c46c47b52fb8a191e2ea45ac50f426f6
src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerPlanExecuteController.java
@@ -23,6 +23,7 @@
import com.ruoyi.project.tr.hiddenTroubleType.service.IHiddenTroubleTypeService;
import com.ruoyi.project.tr.riskCheckPoint.service.IRiskCheckPointService;
import com.ruoyi.project.tr.riskEvaluationPlan.service.IRiskEvaluationPlanService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
@@ -371,6 +372,9 @@
//        hiddenDangerCheckPoint.setCheckStatus(TrHiddenDangerCheckConstants.CHECK_STATUS_ALREADY_CHECK);//排查状态(已排查)
//        hiddenDangerCheckPoint.setPlanFormulateStatus(TrHiddenDangerCheckConstants.PLAN_FORMULATE_STATUS_ALREADY_COMPLETE);//隐患排查计划制定(已完成)
//        hiddenDangerCheckPoint.setPlanExecuteStatus(TrHiddenDangerCheckConstants.PLAN_EXECUTE_STATUS_ALREADY_COMPLETE);//隐患排查计划执行(已完成)
        if(ObjectUtils.isEmpty(hiddenDangerCheckPoint.getMobileCode())){
            throw new RuntimeException("手机识别码为空,请使用终端机进行填写");
        }
        int i = hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
        hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
@@ -387,7 +391,9 @@
        //隐患排查检查点实体
        HiddenDangerCheckPoint hiddenDangerCheckPoint = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(Long.valueOf(id));
        mmap.put("hiddenDangerCheckPoint", hiddenDangerCheckPoint);
        if(ObjectUtils.isEmpty(hiddenDangerCheckPoint.getMobileCode())){
            throw new RuntimeException("手机识别码为空,请使用终端机进行填写");
        }
        //隐患类别
        User sysUser = getSysUser();
        HiddenTroubleType hiddenTroubleType = new HiddenTroubleType();
@@ -400,8 +406,8 @@
    /**
     * 检查点隐患登记--保存
     * todo-2022 手机端-暂时未改动
     * 检查点隐患登记--保存 na li lai de huo dong ,rang ye hen xin dong ,wojiu zhiji na zou le a
     * todo-2022 手机端
     */
    @Log(title = "检查点隐患登记--保存", businessType = BusinessType.UPDATE)
    @PostMapping("/editPointDangerRegisterSave")
@@ -420,7 +426,6 @@
        hiddenDangerCheckPoint.setDangerSources(TrHiddenDangerCheckConstants.DANGER_SOURCES_PLAN_PRODUCE); //隐患来源(隐患计划排查生成)
        HiddenDangerCheckPoint queryExist = new HiddenDangerCheckPoint();
        queryExist.setWhetherDanger(TrHiddenDangerCheckConstants.WHETHER_DANGER_YES);//是否为隐患(是隐患)
        queryExist.setCheckPointId(hiddenDangerCheckPoint.getCheckPointId());
@@ -435,24 +440,24 @@
            hiddenDangerCheckPoint.setCompanyId(getSysUser().getCompanyId());
            i = hiddenDangerCheckPointService.insertHiddenDangerCheckPoint(hiddenDangerCheckPoint);
            // todo-2022 此处插入附属表
            //获取Id返回值
            hiddenDangerCheckPoint.getId();
            int result = riskService.insertDangerInfo(hiddenDangerCheckPoint.getId(), hiddenDangerCheckPoint);
            if (result< 1){
                throw new RuntimeException("添加隐患附属信息失败");
            }
//            // todo-2022 此处插入附属表
//            //获取Id返回值
//            hiddenDangerCheckPoint.getId();
//            int result = riskService.insertDangerInfo(hiddenDangerCheckPoint.getId(), hiddenDangerCheckPoint);
//            if (result< 1){
//                throw new RuntimeException("添加隐患附属信息失败");
//            }
        } else {
            hiddenDangerCheckPoint.setUpdateBy(getSysUser().getLoginName());
            hiddenDangerCheckPoint.setUpdateTime(DateUtils.getNowDate());
            i = hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
            // todo-2022 此处修改附属表
            int result = riskService.updateDangerInfo(hiddenDangerCheckPoint);
            if (result < 1){
                throw new RuntimeException("修改失败");
            }
//            // todo-2022 此处修改附属表
//            int result = riskService.updateDangerInfo(hiddenDangerCheckPoint);
//            if (result < 1){
//                throw new RuntimeException("修改失败");
//            }
        }
        hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
        return toAjax(i);