| | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.security.ShiroUtils; |
| | | import com.ruoyi.doublePrevention.entity.PreventRiskDangerCheckAndMeasure; |
| | | import com.ruoyi.doublePrevention.entity.PreventRiskDangerCheckLog; |
| | | import com.ruoyi.doublePrevention.service.RiskService; |
| | | import com.ruoyi.doublePrevention.service.baseService.PreventRiskDangerCheckAndMeasureService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.mobile.domain.ApiRequestHeader; |
| | | import com.ruoyi.project.mobile.domain.ApiResult; |
| | |
| | | import com.ruoyi.project.tr.hiddenDangerCheck.service.IHiddenDangerCheckService; |
| | | import com.ruoyi.project.tr.hiddenDangerCheckPoint.domain.HiddenDangerCheckPoint; |
| | | import com.ruoyi.project.tr.hiddenDangerCheckPoint.service.IHiddenDangerCheckPointService; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Autowired |
| | | private RiskService riskService; |
| | | |
| | | @Autowired |
| | | private PreventRiskDangerCheckAndMeasureService riskDangerCheckAndMeasureService;//隐患检查点Service |
| | | |
| | | @Autowired |
| | | private PreventRiskDangerCheckAndMeasureService preventRiskDangerCheckAndMeasureService; |
| | | /** |
| | | * 获取定时任务隐患列表 |
| | | * |
| | |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | hiddenDangerCheckService.updateHiddenDangerCheck(hiddenDangerCheck); |
| | | |
| | | hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送 |
| | |
| | | |
| | | |
| | | /** |
| | | * 设置为记录正常 |
| | | * 设置为记录正常 todo |
| | | */ |
| | | public ApiResult editPointScheduleSetNormal(String str, ApiRequestHeader header) { |
| | | //验证userId,loginName,token,deviceType,deviceId,appType 是否一致 |
| | |
| | | hdcp.setScheduleCheckStatus(TrHiddenDangerCheckConstants.CHECK_STATUS_ALREADY_CHECK);//排查状态(已排查) |
| | | hdcpService.updateHiddenDangerCheckPoint(hdcp); |
| | | |
| | | PreventRiskDangerCheckAndMeasure dangerCheckPointInfo = preventRiskDangerCheckAndMeasureService.getByDangerCheckPointId(hdcp.getId()); |
| | | int result = riskService.updateCheckLog(dangerCheckPointInfo.getCheckId(), hdcp); |
| | | if (result < 1){ |
| | | return ApiResult.error("隐患排查记录附属表:写入手机识别码错误"); |
| | | } |
| | | |
| | | //添加检查说明信息 |
| | | int result1 = riskDangerCheckAndMeasureService.updateCheckDesc(hdcp); |
| | | if (result1 < 1){ |
| | | throw new RuntimeException("登记检查上报结果失败"); |
| | | } |
| | | hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送 |
| | | |
| | | return ApiResult.success("定时隐患排查--设置为正常--成功"); |
| | |
| | | |
| | | /** |
| | | * 定时隐患排查---隐患登记 |
| | | * todo-2022 手机端-暂时未改动 |
| | | */ |
| | | @Transactional |
| | | public ApiResult editPointScheduleDangerRegisterSave(String str, ApiRequestHeader header) { |
| | |
| | | } |
| | | try { |
| | | HiddenDangerCheckPoint hdcp = new ObjectMapper().readValue(str, HiddenDangerCheckPoint.class); |
| | | if (ObjectUtils.isEmpty(hdcp.getCheckPerson())){ |
| | | throw new RuntimeException("检查人不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(hdcp.getFindTime())){ |
| | | throw new RuntimeException("发现时间不能为空"); |
| | | } |
| | | hdcp.setUpdateBy(header.loginName); |
| | | hdcp.setUpdateTime(DateUtils.getNowDate()); |
| | | hdcp.setRegisterCreateTime(DateUtils.getNowDate());//设置隐患登记上报创建时间 |
| | |
| | | hdcp.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_EXAMINE);//隐患核查阶段(数据进入到隐患核查阶段) |
| | | hdcp.setDangerSources(TrHiddenDangerCheckConstants.DANGER_SOURCES_SCHEDULE_PRODUCE); //隐患来源(定时器任务生成) |
| | | |
| | | |
| | | HiddenDangerCheckPoint queryExist = new HiddenDangerCheckPoint(); |
| | | queryExist.setWhetherDanger(TrHiddenDangerCheckConstants.WHETHER_DANGER_YES);//是否为隐患(是隐患) |
| | | queryExist.setCheckPointId(hdcp.getCheckPointId()); |
| | | queryExist.setCheckId(hdcp.getCheckId()); |
| | | |
| | | hdcp.setReportStatus("0"); |
| | | |
| | | /** |
| | | * 本次查询结果 :如果未上报过隐患,必定为空 |
| | | * 同一个检查任务,同一个排查点,可能多次上报隐患。 |
| | | * 本次查询未用到id,导致数据不唯一 |
| | | * */ |
| | | List<HiddenDangerCheckPoint> queryExistList = hdcpService.selectHiddenDangerCheckPointList(queryExist); |
| | | int i=0; |
| | | //如果隐患信息已经存在,就新插入一条;如果不存在,就修改隐患信息 |
| | | if(queryExistList.size()>0){ |
| | | hdcp.setId(null); |
| | | hdcp.setCheckTime(DateUtils.getNowDate()); |
| | |
| | | |
| | | hdcp.setCompanyId(user.getCompanyId()); |
| | | i = hdcpService.insertHiddenDangerCheckPoint(hdcp); |
| | | if (i< 1){ |
| | | throw new RuntimeException("添加隐患信息失败"); |
| | | } |
| | | |
| | | // todo-2022 此处插入附属表 |
| | | //获取Id返回值 |
| | | //获取Id返回值 20250623 放开 |
| | | hdcp.getId(); |
| | | int result = riskService.insertDangerInfo(hdcp.getId(), hdcp); |
| | | if (result< 1){ |
| | | throw new RuntimeException("添加隐患附属信息失败"); |
| | | } |
| | | |
| | | // PreventRiskDangerCheckAndMeasure dangerCheckPointInfo = preventRiskDangerCheckAndMeasureService.getByDangerCheckPointId(hdcp.getId()); |
| | | // riskService.updateCheckLog(dangerCheckPointInfo.getCheckId(), hdcp); |
| | | |
| | | }else{ |
| | | hdcp.setUpdateBy(user.getLoginName()); |
| | | hdcp.setUpdateTime(DateUtils.getNowDate()); |
| | | i = hdcpService.updateHiddenDangerCheckPoint(hdcp); |
| | | |
| | | // todo-2022 此处修改附属表 |
| | | // todo-2022 此处修改附属表 20250623 放开 |
| | | int result = riskService.updateDangerInfo(hdcp); |
| | | if (result < 1){ |
| | | throw new RuntimeException("修改失败"); |
| | | } |
| | | // int result = riskService.insertDangerInfo(hdcp.getId(), hdcp); |
| | | // if (result< 1){ |
| | | // throw new RuntimeException("添加隐患附属信息失败"); |
| | | // } |
| | | |
| | | PreventRiskDangerCheckAndMeasure dangerCheckPointInfo = preventRiskDangerCheckAndMeasureService.getByDangerCheckPointId(hdcp.getId()); |
| | | riskService.updateCheckLog(dangerCheckPointInfo.getCheckId(), hdcp); |
| | | } |
| | | hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送 |
| | | |