| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | List<UserSelector> userSelectors; |
| | | switch (status) { |
| | | case UNDER_EVALUATION: |
| | | if(CollectionUtil.isEmpty(request.getTableDetailList())) { |
| | | throw new JeecgBootException("检查明细信息为空!"); |
| | | } |
| | | boolean parallelCompletion = flowTaskService.checkParallelCompletion(flowMyBusiness.getTaskId()); |
| | | //执行完成 |
| | | userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0008); |
| | |
| | | values.put("comment", "技术状态鉴定执行结束"); |
| | | request.setComment("技术状态鉴定执行结束"); |
| | | //设置entity |
| | | if (parallelCompletion) { |
| | | if (CommonConstant.STATUS_1.equals(entity.getSafetyCheckCompleted()) |
| | | && CommonConstant.STATUS_1.equals(entity.getPrecisionCheckCompleted()) |
| | | && CommonConstant.STATUS_1.equals(entity.getOtherCheckCompleted()) |
| | | && parallelCompletion) { |
| | | //多个任务都已完成且维修室主任都已审批通过,会签完成,进行维修工签字 |
| | | userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002); |
| | | userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); |
| | |
| | | } |
| | | if ("safety_equipment_check".equals(flowMyBusiness.getTaskNameId())) { |
| | | //执行安全检查 |
| | | if (CommonConstant.STATUS_1.equals(entity.getSafetyCheckCompleted())) { |
| | | values.put("safetyEquipmentCheckFlag", request.getSafetyCheckConfirmResult()); |
| | | entity.setSafetyCheckConfirmResult(request.getSafetyCheckConfirmResult()); |
| | | entity.setSafetyCheckConfirm(user.getUsername()); |
| | | entity.setSafetyCheckConfirmTime(new Date()); |
| | | entity.setSafetyCheckConfirmComment(request.getSafetyCheckConfirmComment()); |
| | | //维修室主任审批 |
| | | if (!CommonConstant.STATUS_1.equals(request.getSafetyCheckConfirmResult())) { |
| | | //驳回 给监察人 |
| | | userApprovalList = Collections.singletonList(request.getTableDetailList().get(0).getRepairmanSignature()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | entity.setSafetyCheckCompleted(CommonConstant.STATUS_0); |
| | | } |
| | | } else { |
| | | //安全装置检查结果填报 |
| | | List<EamTechnicalStatusEvaluationOrderDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); |
| | | if(CollectionUtil.isEmpty(collect)) { |
| | | throw new JeecgBootException("安全装置检查项明细为空!"); |
| | | } |
| | | //结果项检查 |
| | | checkDetailResult(request.getTableDetailList(), TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK); |
| | | //添加操作人信息 |
| | | for (EamTechnicalStatusEvaluationOrderDetail detail : collect) { |
| | | detail.setRepairmanSignature(user.getUsername()); |
| | | detail.setRepairmanSignatureTime(new Date()); |
| | | } |
| | | orderDetailService.updateBatchById(collect); |
| | | //安全装置检查结果填报 |
| | | List<EamTechnicalStatusEvaluationOrderDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); |
| | | if (CollectionUtil.isEmpty(collect)) { |
| | | throw new JeecgBootException("安全装置检查项明细为空!"); |
| | | } |
| | | //结果项检查 |
| | | checkDetailResult(request.getTableDetailList(), TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK); |
| | | //添加操作人信息 |
| | | for (EamTechnicalStatusEvaluationOrderDetail detail : collect) { |
| | | detail.setRepairmanSignature(user.getUsername()); |
| | | detail.setRepairmanSignatureTime(new Date()); |
| | | } |
| | | orderDetailService.updateBatchById(collect); |
| | | values.put("NextAssignee", userApprovalList); |
| | | entity.setSafetyCheckCompleted(CommonConstant.STATUS_1); |
| | | } else if ("safety_equipment_check_confirm".equals(flowMyBusiness.getTaskNameId()) && CommonConstant.STATUS_1.equals(entity.getSafetyCheckCompleted())) { |
| | | values.put("safetyEquipmentCheckFlag", request.getSafetyCheckConfirmResult()); |
| | | entity.setSafetyCheckConfirmResult(request.getSafetyCheckConfirmResult()); |
| | | entity.setSafetyCheckConfirm(user.getUsername()); |
| | | entity.setSafetyCheckConfirmTime(new Date()); |
| | | entity.setSafetyCheckConfirmComment(request.getSafetyCheckConfirmComment()); |
| | | //维修室主任审批 |
| | | if (!CommonConstant.STATUS_1.equals(request.getSafetyCheckConfirmResult())) { |
| | | //驳回 给监察人 |
| | | userApprovalList = Collections.singletonList(request.getTableDetailList().get(0).getRepairmanSignature()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | entity.setSafetyCheckCompleted(CommonConstant.STATUS_1); |
| | | entity.setSafetyCheckCompleted(CommonConstant.STATUS_0); |
| | | } |
| | | } else if ("equipment_precision_check".equals(flowMyBusiness.getTaskNameId())) { |
| | | //处理精度检验 |
| | | if (CommonConstant.STATUS_1.equals(entity.getPrecisionCheckCompleted())) { |
| | | values.put("precisionCheckFlag", request.getPrecisionCheckConfirmResult()); |
| | | entity.setPrecisionCheckConfirmResult(request.getPrecisionCheckConfirmResult()); |
| | | entity.setPrecisionCheckConfirm(user.getUsername()); |
| | | entity.setPrecisionCheckConfirmTime(new Date()); |
| | | entity.setPrecisionCheckConfirmComment(request.getPrecisionCheckConfirmComment()); |
| | | //维修室主任审批 |
| | | if (!CommonConstant.STATUS_1.equals(request.getPrecisionCheckConfirmResult())) { |
| | | //驳回 给监察人 |
| | | userApprovalList = Collections.singletonList(request.getTableDetailList().get(0).getRepairmanSignature()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | entity.setPrecisionCheckCompleted(CommonConstant.STATUS_0); |
| | | } |
| | | } else { |
| | | //设备精度检查结果填报 |
| | | List<EamTechnicalStatusEvaluationOrderDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); |
| | | if(CollectionUtil.isEmpty(collect)) { |
| | | throw new JeecgBootException("设备精度检查项明细为空!"); |
| | | } |
| | | //结果项检查 |
| | | checkDetailResult(request.getTableDetailList(), TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK); |
| | | //添加操作人信息 |
| | | for (EamTechnicalStatusEvaluationOrderDetail detail : collect) { |
| | | detail.setRepairmanSignature(user.getUsername()); |
| | | detail.setRepairmanSignatureTime(new Date()); |
| | | } |
| | | orderDetailService.updateBatchById(collect); |
| | | values.put("NextAssignee", userApprovalList); |
| | | entity.setPrecisionCheckCompleted(CommonConstant.STATUS_1); |
| | | //设备精度检查结果填报 |
| | | List<EamTechnicalStatusEvaluationOrderDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); |
| | | if (CollectionUtil.isEmpty(collect)) { |
| | | throw new JeecgBootException("设备精度检查项明细为空!"); |
| | | } |
| | | |
| | | //结果项检查 |
| | | checkDetailResult(request.getTableDetailList(), TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK); |
| | | //添加操作人信息 |
| | | for (EamTechnicalStatusEvaluationOrderDetail detail : collect) { |
| | | detail.setRepairmanSignature(user.getUsername()); |
| | | detail.setRepairmanSignatureTime(new Date()); |
| | | } |
| | | orderDetailService.updateBatchById(collect); |
| | | values.put("NextAssignee", userApprovalList); |
| | | entity.setPrecisionCheckCompleted(CommonConstant.STATUS_1); |
| | | } else if ("equipment_precision_check_confirm".equals(flowMyBusiness.getTaskNameId()) && CommonConstant.STATUS_1.equals(entity.getPrecisionCheckCompleted())) { |
| | | values.put("precisionCheckFlag", request.getPrecisionCheckConfirmResult()); |
| | | entity.setPrecisionCheckConfirmResult(request.getPrecisionCheckConfirmResult()); |
| | | entity.setPrecisionCheckConfirm(user.getUsername()); |
| | | entity.setPrecisionCheckConfirmTime(new Date()); |
| | | entity.setPrecisionCheckConfirmComment(request.getPrecisionCheckConfirmComment()); |
| | | //维修室主任审批 |
| | | if (!CommonConstant.STATUS_1.equals(request.getPrecisionCheckConfirmResult())) { |
| | | //驳回 给监察人 |
| | | userApprovalList = Collections.singletonList(request.getTableDetailList().get(0).getRepairmanSignature()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | entity.setPrecisionCheckCompleted(CommonConstant.STATUS_0); |
| | | } |
| | | } else if ("other_check".equals(flowMyBusiness.getTaskNameId())) { |
| | | //处理其他检查 |
| | | if (CommonConstant.STATUS_1.equals(entity.getOtherCheckCompleted())) { |
| | | values.put("otherCheckFlag", request.getOtherCheckResult()); |
| | | entity.setOtherCheckResult(request.getOtherCheckConfirmResult()); |
| | | entity.setOtherCheckConfirm(user.getUsername()); |
| | | entity.setOtherCheckConfirmTime(new Date()); |
| | | entity.setOtherCheckConfirmComment(request.getOtherCheckConfirmComment()); |
| | | //维修室主任审批 |
| | | if (!CommonConstant.STATUS_1.equals(request.getOtherCheckConfirmResult())) { |
| | | //驳回 给监察人 |
| | | userApprovalList = Collections.singletonList(request.getTableDetailList().get(0).getRepairmanSignature()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | entity.setOtherCheckCompleted(CommonConstant.STATUS_0); |
| | | } |
| | | } else { |
| | | //其他检查结果填报 |
| | | List<EamTechnicalStatusEvaluationOrderDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); |
| | | if(CollectionUtil.isEmpty(collect)) { |
| | | throw new JeecgBootException("其他检查项明细为空!"); |
| | | } |
| | | //结果项检查 |
| | | checkDetailResult(request.getTableDetailList(), TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK); |
| | | //添加操作人信息 |
| | | for (EamTechnicalStatusEvaluationOrderDetail detail : collect) { |
| | | detail.setRepairmanSignature(user.getUsername()); |
| | | detail.setRepairmanSignatureTime(new Date()); |
| | | } |
| | | orderDetailService.updateBatchById(collect); |
| | | //其他检查结果填报 |
| | | List<EamTechnicalStatusEvaluationOrderDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList()); |
| | | if (CollectionUtil.isEmpty(collect)) { |
| | | throw new JeecgBootException("其他检查项明细为空!"); |
| | | } |
| | | //结果项检查 |
| | | checkDetailResult(request.getTableDetailList(), TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK); |
| | | //添加操作人信息 |
| | | for (EamTechnicalStatusEvaluationOrderDetail detail : collect) { |
| | | detail.setRepairmanSignature(user.getUsername()); |
| | | detail.setRepairmanSignatureTime(new Date()); |
| | | } |
| | | orderDetailService.updateBatchById(collect); |
| | | values.put("NextAssignee", userApprovalList); |
| | | entity.setOtherCheckCompleted(CommonConstant.STATUS_1); |
| | | } else if ("other_check_confirm".equals(flowMyBusiness.getTaskNameId()) && CommonConstant.STATUS_1.equals(entity.getOtherCheckCompleted())) { |
| | | values.put("otherCheckFlag", request.getOtherCheckConfirmResult()); |
| | | entity.setOtherCheckConfirmResult(request.getOtherCheckConfirmResult()); |
| | | entity.setOtherCheckConfirm(user.getUsername()); |
| | | entity.setOtherCheckConfirmTime(new Date()); |
| | | entity.setOtherCheckConfirmComment(request.getOtherCheckConfirmComment()); |
| | | //维修室主任审批 |
| | | if (!CommonConstant.STATUS_1.equals(request.getOtherCheckConfirmResult())) { |
| | | //驳回 给监察人 |
| | | userApprovalList = Collections.singletonList(request.getTableDetailList().get(0).getRepairmanSignature()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | entity.setPrecisionCheckCompleted(CommonConstant.STATUS_1); |
| | | values.put("NextAssignee", userApprovalList); |
| | | entity.setOtherCheckCompleted(CommonConstant.STATUS_1); |
| | | entity.setOtherCheckCompleted(CommonConstant.STATUS_0); |
| | | } |
| | | } |
| | | break; |
| | |
| | | entity.setRepairManagerSignature(user.getUsername()); |
| | | entity.setRepairManagerSignatureTime(new Date()); |
| | | entity.setRepairManagerComment(request.getRepairManagerComment()); |
| | | entity.setRepairManagerSignatureResult(request.getRepairManagerSignatureResult()); |
| | | //设置entity |
| | | if (BusinessCodeConst.APPROVED.equals(request.getRepairManagerSignatureResult())) { |
| | | values.put("NextAssignee", userApprovalList); |
| | |
| | | entity.setDepartTechnicalLeaderSignature(user.getUsername()); |
| | | entity.setDepartTechnicalLeaderSignatureTime(new Date()); |
| | | entity.setDepartTechnicalLeaderComment(request.getDepartTechnicalLeaderComment()); |
| | | entity.setDepartTechnicalLeaderSignatureResult(request.getDepartTechnicalLeaderSignatureResult()); |
| | | //设置entity |
| | | if (BusinessCodeConst.APPROVED.equals(request.getDepartTechnicalLeaderSignatureResult())) { |
| | | values.put("NextAssignee", userApprovalList); |
| | |
| | | return entity; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateEvaluationStatus(String orderId, String evaluationStatus) { |
| | | UpdateWrapper<EamTechnicalStatusEvaluationOrder> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.eq("order_id", orderId); |
| | | updateWrapper.set("evaluation_status", evaluationStatus); |
| | | updateWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0); |
| | | updateWrapper.eq("evaluation_status", TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name()); |
| | | int update = this.getBaseMapper().update(null, updateWrapper); |
| | | return update > 0; |
| | | } |
| | | |
| | | private void checkDetailResult(List<EamTechnicalStatusEvaluationOrderDetail> detailList, TechnicalStatusEvaluationCheckCategoryEnum checkCategory) { |
| | | boolean b; |
| | | switch (checkCategory) { |
| | | case SAFETY_EQUIPMENT_CHECK: |
| | | b = detailList.stream().allMatch(item -> StringUtils.isNotBlank(item.getSafetyEquipmentCheckResult())); |
| | | if(!b) { |
| | | if (!b) { |
| | | throw new JeecgBootException("有安全装置检查结果未填写!"); |
| | | } |
| | | break; |
| | | case PRECISION_CHECK: |
| | | b = detailList.stream().allMatch(item -> item.getPrecisionCheckResult() != null); |
| | | if(!b) { |
| | | if (!b) { |
| | | throw new JeecgBootException("有设备精度检查结果未填写!"); |
| | | } |
| | | break; |
| | | case OTHER_CHECK: |
| | | b = detailList.stream().allMatch(item -> StringUtils.isNotBlank(item.getOtherCheckResult())); |
| | | if(!b) { |
| | | if (!b) { |
| | | throw new JeecgBootException("有其他检查结果未填写!"); |
| | | } |
| | | break; |