| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.security.ShiroUtils; |
| | | import com.ruoyi.doublePrevention.service.RiskService; |
| | | import com.ruoyi.doublePrevention.service.baseService.PreventRiskDangerConfirmLogService; |
| | | 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; |
| | | import org.springframework.data.redis.connection.ReactiveListCommands; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | |
| | | |
| | | @Autowired |
| | | private RiskService riskService; |
| | | |
| | | @Autowired |
| | | private PreventRiskDangerConfirmLogService confirmLogService; |
| | | |
| | | |
| | | @Autowired |
| | | private IHiddenDangerCheckPointService hiddenDangerCheckPointService; |
| | | |
| | | /** |
| | | * 获取隐患列表 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 隐患核查--再次核查 |
| | | */ |
| | | @Transactional |
| | | public ApiResult editNextConfirmSave(String str, ApiRequestHeader header) { |
| | | //验证userId,loginName,token,deviceType,deviceId,appType 是否一致 |
| | | ApiRequestHeader requestHeader = getHeader(header); |
| | | if (!(header.equals(requestHeader))) { |
| | | return ApiResult.errorToken("验证userId,loginName,token,deviceType,deviceId,appType 不一致"); |
| | | } |
| | | try { |
| | | Map<String, String> map = new ObjectMapper().readValue(str, HashMap.class); |
| | | HiddenDangerCheckPoint hdcp = new ObjectMapper().readValue(str, HiddenDangerCheckPoint.class); |
| | | // todo-2022 中间核查,插入多人核查附属表 |
| | | if(ObjectUtils.isEmpty(hdcp.getId())){ |
| | | throw new RuntimeException("id不能为空"); |
| | | } |
| | | // report_status , 上报判定结果(0未判定 1不是隐患 2是隐患) |
| | | // if(ObjectUtils.isEmpty(hdcp.getReportStatus())){ |
| | | // throw new RuntimeException("判定结果不能为空"); |
| | | // } |
| | | // examine_user_id , 核查人id |
| | | if(ObjectUtils.isEmpty(hdcp.getExamineUserId())){ |
| | | throw new RuntimeException("核查人Id不能为空"); |
| | | } |
| | | // examine_user_name |
| | | if(ObjectUtils.isEmpty(hdcp.getExamineUserName())){ |
| | | throw new RuntimeException("核查人姓名不能为空"); |
| | | } |
| | | // examine_opinion 意见 |
| | | // if(ObjectUtils.isEmpty(hdcp.getRectifyDeadlineTime())){ |
| | | // throw new RuntimeException("核查意见不能为空"); |
| | | // } |
| | | int confirmResult = confirmLogService.saveConfirmLog(hdcp); |
| | | if (confirmResult < 1){ |
| | | throw new RuntimeException("操作失败"); |
| | | } |
| | | return ApiResult.success("隐患核查保存成功"); |
| | | } catch (Exception e) { |
| | | return ApiResult.error("异常"); |
| | | } |
| | | } |
| | | /** |
| | | * 隐患核查--保存 |
| | | */ |
| | |
| | | try { |
| | | Map<String, String> map = new ObjectMapper().readValue(str, HashMap.class); |
| | | HiddenDangerCheckPoint hdcp = new ObjectMapper().readValue(str, HiddenDangerCheckPoint.class); |
| | | // todo-2023 此处最终核查 |
| | | hdcp.setUpdateBy(header.loginName); |
| | | hdcp.setUpdateTime(DateUtils.getNowDate()); |
| | | hdcp.setExamineCreateTime(DateUtils.getNowDate());//设置核查时间 |
| | |
| | | hdcp.setWhetherDanger(TrHiddenDangerCheckConstants.WHETHER_DANGER_NOT);//是否为隐患(正常) |
| | | } |
| | | } |
| | | |
| | | hdcpService.updateHiddenDangerCheckPoint(hdcp); |
| | | |
| | | hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送 |
| | | |
| | | // todo-2022 此处插入附属表 |
| | | // HiddenDangerCheckPoint hiddenDangerCheckPointById = hiddenDangerCheckPointService.getHiddenDangerCheckPointById(hiddenDangerCheckPoint.getId()); |
| | | //此处插入隐患附属表 |
| | | int result = riskService.insertDangerInfo(hdcp.getId(), hdcp); |
| | | if (result< 1){ |
| | | throw new RuntimeException("添加隐患附属信息失败"); |
| | | } |
| | | |
| | | HiddenDangerCheckPoint hiddenDangerCheckPoint = hiddenDangerCheckPointService.getHiddenDangerCheckPointById(hdcp.getId()); |
| | | int confirmResult = confirmLogService.saveConfirmLog(hiddenDangerCheckPoint); |
| | | if (confirmResult < 1){ |
| | | throw new RuntimeException("操作失败"); |
| | | } |
| | | |
| | | hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送 |
| | | |
| | | return ApiResult.success("隐患核查保存成功"); |
| | | } catch (Exception e) { |