双重预防项目-国泰新华二开定制版
heheng
2 天以前 ac8870aae3ec2b5ec5315cc668b482858195cfa4
src/main/java/com/ruoyi/project/mobile/service/ApiHiddenDangerCheckService.java
@@ -127,6 +127,9 @@
                for (HiddenDangerCheckPoint dangerCheckPoint : resultList) {
                    PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoByDangerCheckPointId(dangerCheckPoint.getId());
                    if (ObjectUtils.isNotEmpty(dangerInfo)){
                        if (ObjectUtils.isNotEmpty(dangerInfo.getDangerSrc())){
                            dangerCheckPoint.setDangerSrc(dangerInfo.getDangerSrc());
                        }
                        if (ObjectUtils.isNotEmpty(dangerInfo.getReportTime())){
                            dangerCheckPoint.setReportTime(dangerInfo.getReportTime());
                        }
@@ -178,12 +181,13 @@
            }
            return ApiResult.success("隐患核查保存成功");
        } catch (Exception e) {
            return ApiResult.error("异常");
            return ApiResult.error(e.getMessage());
        }
    }
    /**
     * 隐患核查--保存
     */
    @Transactional
    public ApiResult editDangerExamineSave(String str, ApiRequestHeader header) {
        //验证userId,loginName,token,deviceType,deviceId,appType 是否一致
        ApiRequestHeader requestHeader = getHeader(header);
@@ -209,12 +213,27 @@
            }
            hdcpService.updateHiddenDangerCheckPoint(hdcp);
            //此处插入隐患附属表
            int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
            if (result< 1){
                throw new RuntimeException("添加隐患附属信息失败");
            //20250623 修改此处
            PreventRiskDangerInfo dangerInfoByDangerCheckPointId = riskService.getDangerInfoByDangerCheckPointId(hdcp.getId());
            if (ObjectUtils.isNotEmpty(dangerInfoByDangerCheckPointId)){
                //此处插入隐患附属表
                int result = riskService.updateDangerInfo(hdcp);
                if (result < 1){
                    throw new RuntimeException("修改失败");
                }
            }else {
                //此处插入隐患附属表
                int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
                if (result < 1){
                    throw new RuntimeException("添加隐患附属信息失败");
                }
            }
//            //此处插入隐患附属表
//            int result = riskService.updateCheckLog(hdcp.getId(), hdcp);
//            if (result< 1){
//                throw new RuntimeException("添加隐患附属信息失败");
//            }
            HiddenDangerCheckPoint hiddenDangerCheckPoint = hiddenDangerCheckPointService.getHiddenDangerCheckPointById(hdcp.getId());
            int confirmResult = confirmLogService.saveConfirmLog(hiddenDangerCheckPoint);
@@ -226,13 +245,14 @@
            return ApiResult.success("隐患核查保存成功");
        } catch (Exception e) {
            return ApiResult.error("异常");
            return ApiResult.error(e.getMessage());
        }
    }
    /**
     * 隐患整改--保存
     */
    @Transactional
    public ApiResult editDangerRectifySave(String str, ApiRequestHeader header) {
        //验证userId,loginName,token,deviceType,deviceId,appType 是否一致
        ApiRequestHeader requestHeader = getHeader(header);
@@ -265,6 +285,7 @@
    /**
     * 整改延期--保存
     */
    @Transactional
    public ApiResult rectifyTimeOutSave(String str, ApiRequestHeader header) {
        //验证userId,loginName,token,deviceType,deviceId,appType 是否一致
        ApiRequestHeader requestHeader = getHeader(header);
@@ -291,6 +312,7 @@
    /**
     * 隐患验收--保存
     */
    @Transactional
    public ApiResult editDangerAcceptSave(String str, ApiRequestHeader header) {
        //验证userId,loginName,token,deviceType,deviceId,appType 是否一致
        ApiRequestHeader requestHeader = getHeader(header);
@@ -415,6 +437,7 @@
    /**
     * 隐患计划执行中---隐患登记
     */
    @Transactional
    public ApiResult editPointDangerRegisterSave(String str, ApiRequestHeader header) {
        //验证userId,loginName,token,deviceType,deviceId,appType 是否一致
        ApiRequestHeader requestHeader = getHeader(header);
@@ -428,6 +451,9 @@
            }
            if (ObjectUtils.isEmpty(hdcp.getFindTime())){
                throw new RuntimeException("发现时间不能为空");
            }
            if(ObjectUtils.isEmpty(hdcp.getDangerSrc())){
                throw new RuntimeException("隐患来源不能为空");
            }
            hdcp.setRegisterCreateTime(DateUtils.getNowDate());//设置隐患登记上报创建时间
            hdcp.setRegisterUserId(Long.valueOf(header.userId));//设置隐患登记上报创建人ID
@@ -456,17 +482,36 @@
                hdcp.setCompanyId(user.getCompanyId());
                i = hdcpService.insertHiddenDangerCheckPoint(hdcp);
                //20250623增加此逻辑
                int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
                if (result< 1){
                    throw new RuntimeException("添加隐患附属信息失败");
                }
            }else{
                hdcp.setUpdateBy(user.getLoginName());
                hdcp.setUpdateTime(DateUtils.getNowDate());
                i = hdcpService.updateHiddenDangerCheckPoint(hdcp);
                //20250623增加此逻辑
                PreventRiskDangerInfo dangerInfoByDangerCheckPointId = riskService.getDangerInfoByDangerCheckPointId(hdcp.getId());
                if (dangerInfoByDangerCheckPointId != null){
                    // todo-2022 此处修改附属表 20250623 放开
                    int result = riskService.updateDangerInfo(hdcp);
                    if (result < 1){
                        throw new RuntimeException("修改失败");
                    }
                }else {
                    int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
                    if (result < 1){
                        throw new RuntimeException("修改失败");
                    }
                }
            }
            hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送
            return ApiResult.success("隐患排查计划执行--隐患登记--成功");
        } catch (Exception e) {
            return ApiResult.error("异常");
            return ApiResult.error(e.getMessage());
        }
    }