| | |
| | | public boolean addInspectionOrder(EamInspectionOrderRequest eamInspectionOrderRequest) { |
| | | EamInspectionOrder eamInspectionOrder = new EamInspectionOrder(); |
| | | BeanUtils.copyProperties(eamInspectionOrderRequest, eamInspectionOrder); |
| | | //修改状态 |
| | | if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) { |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name()); |
| | | } else { |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.WAIT_INSPECTION.name()); |
| | | eamInspectionOrder.setInspectionDate(new Date()); |
| | | eamInspectionOrder.setOperateTime(new Date()); |
| | | LoginUser user = getCurrentUser(); |
| | | if (user == null || StrUtil.isBlank(user.getId())) { |
| | | throw new JeecgBootException("账号不存在"); |
| | | } |
| | | eamInspectionOrder.setOperator(user.getUsername()); |
| | | ////修改状态 |
| | | //if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) { |
| | | // eamInspectionOrder.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name()); |
| | | //} else { |
| | | // eamInspectionOrder.setInspectionStatus(InspectionStatus.WAIT_INSPECTION.name()); |
| | | //} |
| | | save(eamInspectionOrder); |
| | | //处理明细数据 |
| | | if (CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getTableDetailList())) { |
| | |
| | | }); |
| | | eamInspectionOrderDetailService.saveBatch(eamInspectionOrderRequest.getTableDetailList()); |
| | | } |
| | | //处理附件 |
| | | if (CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getFileList())) { |
| | | FileUploadResult fileUploadResult = eamInspectionOrderRequest.getFileList().get(0); |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | try { |
| | | String referenceFile = mapper.writeValueAsString(fileUploadResult); |
| | | eamInspectionOrder.setImageFiles(referenceFile); |
| | | } catch (JsonProcessingException e) { |
| | | log.error("JSON转换失败:" + e.getMessage(), e); |
| | | } |
| | | } |
| | | if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) { |
| | | triggerProcess(eamInspectionOrder); |
| | | } |
| | | ////处理附件 |
| | | //if (CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getFileList())) { |
| | | // FileUploadResult fileUploadResult = eamInspectionOrderRequest.getFileList().get(0); |
| | | // ObjectMapper mapper = new ObjectMapper(); |
| | | // try { |
| | | // String referenceFile = mapper.writeValueAsString(fileUploadResult); |
| | | // eamInspectionOrder.setImageFiles(referenceFile); |
| | | // } catch (JsonProcessingException e) { |
| | | // log.error("JSON转换失败:" + e.getMessage(), e); |
| | | // } |
| | | //} |
| | | //if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) { |
| | | // triggerProcess(eamInspectionOrder); |
| | | //} |
| | | return true; |
| | | } |
| | | |