zhangherong
2025-07-11 d073e531919d945344ae37b2df0737f245e345d3
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java
@@ -11,6 +11,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.flowable.engine.TaskService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.DataBaseConstant;
import org.jeecg.common.exception.JeecgBootException;
@@ -221,6 +222,10 @@
        if (!TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name().equals(entity.getEvaluationStatus())) {
            throw new JeecgBootException("该工单已进行过领取!");
        }
        EamTechnicalStatusEvaluationStandard standard = standardService.getById(entity.getStandardId());
        if(standard == null) {
            throw new JeecgBootException("设备保养标准不存在,请检查!");
        }
        EamEquipment equipment = equipmentService.getById(entity.getEquipmentId());
        if (equipment == null) {
            throw new JeecgBootException("设备不存在,添加失败!");
@@ -231,9 +236,9 @@
        }
        List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002);
        if (CollectionUtil.isEmpty(userSelectors)) {
            throw new JeecgBootException("设备未分配给车间班组长,无法进入下级审批!");
            throw new JeecgBootException("设备未分配给维修工,无法领取!");
        }
        List<String> userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
        entity.setEvaluator(sysUser.getUsername());
        entity.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.UNDER_EVALUATION.name());
        entity.setActualStartTime(new Date());
@@ -252,15 +257,34 @@
            variables.put("comment", entity.getRemark());
        }
        variables.put("proofreading", true);
        List<String> usernames = new ArrayList<>();
        usernames.add(entity.getEquipmentCode());
        variables.put("NextAssignee", usernames);
//        Result result = flowDefinitionService.startProcessInstanceByKey("second_maintenance_process", variables);
//        if (result != null) {
//            //更新设备保养状态
//            eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_SECOND_MAINTENANCE.name());
//            return result.isSuccess();
//        }
        if(CommonConstant.STATUS_1.equals(standard.getHasSafetyEquipmentCheck())) {
            variables.put("hasSafetyEquipmentCheck", CommonConstant.STATUS_1);
            variables.put("safety_equipment_check", userApprovalList);
            entity.setSafetyCheckCompleted(CommonConstant.STATUS_0);
        } else {
            variables.put("hasSafetyEquipmentCheck", CommonConstant.STATUS_0);
            variables.put("safety_equipment_check", userApprovalList);
        }
        if(CommonConstant.STATUS_1.equals(standard.getHasPrecisionCheck())) {
            variables.put("hasPrecisionCheck", CommonConstant.STATUS_1);
            variables.put("equipment_precision_check", userApprovalList);
            entity.setPrecisionCheckCompleted(CommonConstant.STATUS_0);
        } else {
            variables.put("hasPrecisionCheck", CommonConstant.STATUS_0);
            variables.put("equipment_precision_check", userApprovalList);
        }
        if(CommonConstant.STATUS_1.equals(standard.getHasOtherCheck())) {
            variables.put("hasOtherCheck", CommonConstant.STATUS_1);
            variables.put("other_check", userApprovalList);
            entity.setOtherCheckCompleted(CommonConstant.STATUS_0);
        } else {
            variables.put("hasOtherCheck ", CommonConstant.STATUS_0);
            variables.put("other_check", userApprovalList);
        }
        Result<?> result = flowDefinitionService.startProcessInstanceByKey("technical_status_evaluation_process", variables);
        if(result == null || !result.isSuccess()) {
            throw new JeecgBootException("启动流程失败,领取失败");
        }
        return true;
    }