| | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | 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.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | |
| | | 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.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.lang.reflect.AnnotatedType; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | |
| | | @Autowired |
| | | IUserService userService;//用户Service |
| | | |
| | | @Autowired |
| | | private PreventRiskDangerConfirmLogService confirmLogService; |
| | | |
| | | @Autowired |
| | | private RiskService riskService; |
| | | |
| | | /** |
| | | * 获取隐患上报列表 |
| | |
| | | /** |
| | | * 新增保存隐患上报------登记隐患 |
| | | */ |
| | | @Transactional |
| | | public ApiResult addDangerReportSave(String str, ApiRequestHeader header) { |
| | | //验证userId,loginName,token,deviceType,deviceId,appType 是否一致 |
| | | ApiRequestHeader requestHeader = getHeader(header); |
| | |
| | | try { |
| | | HiddenDangerCheckPoint hdcp = new ObjectMapper().readValue(str, HiddenDangerCheckPoint.class); |
| | | HiddenDangerCheck hdc = new HiddenDangerCheck(); |
| | | |
| | | if (ObjectUtils.isEmpty(hdcp.getCheckPerson())){ |
| | | throw new RuntimeException("检查人不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(hdcp.getFindTime())){ |
| | | throw new RuntimeException("发现时间不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(hdcp.getDangerSrc())){ |
| | | throw new RuntimeException("隐患来源不能为空"); |
| | | } |
| | | hdc.setCreateBy(header.loginName);//创建者 |
| | | hdc.setCreateTime(DateUtils.getNowDate());//获取创建时间 |
| | | hdc.setDangerDeptId(hdcp.getDangerDeptId()); |
| | |
| | | hdcp.setRegisterSubmitTime(DateUtils.getNowDate());//设置隐患上报提交时间 |
| | | |
| | | hdcp.setCompanyId(user.getCompanyId()); |
| | | hdcpService.insertHiddenDangerCheckPoint(hdcp); |
| | | int result = hdcpService.insertHiddenDangerCheckPoint(hdcp); |
| | | //20250623增加此逻辑 |
| | | int result1 = riskService.insertDangerInfo(hdcp.getId(), hdcp); |
| | | if (result1< 1){ |
| | | throw new RuntimeException("添加隐患附属信息失败"); |
| | | } |
| | | |
| | | hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送 |
| | | |
| | |
| | | } |
| | | hdcpService.updateHiddenDangerCheckPoint(hdcp); |
| | | |
| | | int result = confirmLogService.saveConfirmLog(hdcp); |
| | | if (result < 1){ |
| | | return ApiResult.error("操作失败"); |
| | | } |
| | | |
| | | hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送 |
| | | |
| | | return ApiResult.success("判定成功"); |