From 5f0bc1e4ad0c51a8bf1382dc3f98e282c1393c3b Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期四, 11 九月 2025 17:48:55 +0800
Subject: [PATCH] 真空热处理炉批量打印接口 三保 加工设备保养计划变更申请单批量打印接口 设备精度检查单批量打印接口开发

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java |  325 +++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 224 insertions(+), 101 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java
index e0dcd6d..5fd573e 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java
@@ -17,12 +17,14 @@
 import org.jeecg.common.constant.DataBaseConstant;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.eam.constant.*;
 import org.jeecg.modules.eam.entity.*;
 import org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationOrderMapper;
 import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationOrderQuery;
 import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationOrderRequest;
+import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationOrderResult;
 import org.jeecg.modules.eam.service.*;
 import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness;
 import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService;
@@ -41,6 +43,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDate;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -84,6 +87,8 @@
     private ISysUserService sysUserService;
     @Autowired
     private IEamEquipmentExtendService equipmentExtendService;
+    @Autowired
+    private IEamTechnicalStatusEvaluationOrderDetailService eamTechnicalStatusEvaluationOrderDetailService;
 
     @Override
     public IPage<EamTechnicalStatusEvaluationOrder> queryPageList(Page<EamTechnicalStatusEvaluationOrder> page, EamTechnicalStatusEvaluationOrderQuery query) {
@@ -165,15 +170,20 @@
         if (CollectionUtil.isEmpty(standardDetailList)) {
             throw new JeecgBootException("鎶�鏈姸鎬侀壌瀹氳鑼冩鏌ラ」涓虹┖锛屾坊鍔犲け璐ワ紒");
         }
+        EamTechnicalStatusEvaluationOrder unCompleted = checkDuplicate(request.getEquipmentId());
+        if(unCompleted != null) {
+            throw new JeecgBootException("璁惧宸插瓨鍦ㄦ湭瀹屾垚鐨勬妧鏈姸鎬侀壌瀹氬伐鍗曪紝鏃犳硶鍐嶆鏂板锛�");
+        }
         EamTechnicalStatusEvaluationOrder order = new EamTechnicalStatusEvaluationOrder();
-        order.setOrderNum(request.getOrderNum());
         order.setEquipmentId(request.getEquipmentId());
         order.setStandardId(request.getStandardId());
         order.setEvaluationDate(request.getEvaluationDate());
+        order.setFreezeOrderDate(request.getFreezeOrderDate());
+        order.setOrderExpirationDate(request.getOrderExpirationDate());
         order.setRemark(request.getRemark());
         String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TECHNICAL_STATUS_EVALUATION_ORDER_CODE_RULE);
         order.setOrderNum(codeSeq);
-        order.setCreationMethod(OrderCreationMethodEnum.MANUAL.name());
+        order.setCreationMethod(request.getCreationMethod());
         //鐘舵�佸垵濮嬪寲
         order.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name());
         //鍒犻櫎鏍囪
@@ -245,7 +255,7 @@
         this.getBaseMapper().updateById(entity);
 
         //鍚姩娴佺▼
-        flowCommonService.initActBusiness("宸ュ崟鍙�: " + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";瀹夎浣嶇疆" + equipment.getInstallationPosition(),
+        flowCommonService.initActBusiness("宸ュ崟鍙�: " + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode(),
                 entity.getId(), "IEamTechnicalStatusEvaluationOrderService", "technical_status_evaluation_process", null);
         Map<String, Object> variables = new HashMap<>();
         variables.put("dataId", entity.getId());
@@ -331,6 +341,9 @@
         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);
@@ -343,7 +356,10 @@
                 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());
@@ -353,102 +369,93 @@
                 }
                 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;
@@ -488,6 +495,7 @@
                 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);
@@ -497,8 +505,6 @@
                     values.put("NextAssignee", userApprovalList);
                     entity.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.REPAIRER_SIGNING.name());
                 }
-//                //鏇存柊璁惧淇濆吇鐘舵��
-//                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.NORMAL.name());
                 break;
             case PROCESS_TECHNICIAN_SIGNING:
                 //宸ヨ壓鍛樼瀛�
@@ -534,14 +540,15 @@
                 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);
-                    entity.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.PROCESS_TECHNICIAN_SIGNING.name());
+                    entity.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.INSPECTOR_SIGNING.name());
                 } else {
                     userApprovalList = Collections.singletonList(entity.getProcessTechnicianSignature());
                     values.put("NextAssignee", userApprovalList);
-                    entity.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.INSPECTOR_SIGNING.name());
+                    entity.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.PROCESS_TECHNICIAN_SIGNING.name());
                 }
                 break;
             case INSPECTOR_SIGNING:
@@ -557,6 +564,11 @@
                 entity.setInspectorComment(request.getInspectorComment());
                 entity.setEvaluationResult(request.getEvaluationResult());
                 entity.setEvaluationReason(request.getEvaluationReason());
+                //鏇存柊璁惧鎶�鏈姸鎬�
+                // 鎸夌収濉姤瀹屾垚鏃ユ湡璁$畻鏈涓変繚鏃ユ湡锛屽幓闄ゆ椂鍒嗙
+                Date evaluationDate = DateUtils.localDateToDate(DateUtils.dateToLocalDate(entity.getActualEndTime()));
+                equipmentExtendService.updateTechnologyParam(equipment.getId(), entity.getEvaluationResult(),
+                        evaluationDate, CommonConstant.STATUS_0);
                 break;
         }
         request.setValues(values);
@@ -575,12 +587,123 @@
     @Transactional(rollbackFor = Exception.class)
     public boolean updateEvaluationStatus(String orderId, String evaluationStatus) {
         UpdateWrapper<EamTechnicalStatusEvaluationOrder> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("order_id", orderId);
+        updateWrapper.eq("id", orderId);
         updateWrapper.set("evaluation_status", evaluationStatus);
         updateWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0);
-        updateWrapper.eq("evaluation_status", TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name());
+        updateWrapper.in("evaluation_status", Arrays.asList(TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name(), TechnicalStatusEvaluationOrderStatusEnum.LOCKED.name()));
         int update = this.getBaseMapper().update(null, updateWrapper);
         return update > 0;
+    }
+
+    @Override
+    public List<EamTechnicalStatusEvaluationOrder> selectWaitEvaluationOrderList() {
+        LambdaQueryWrapper<EamTechnicalStatusEvaluationOrder> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(EamTechnicalStatusEvaluationOrder::getEvaluationStatus, TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name());
+        queryWrapper.isNotNull(EamTechnicalStatusEvaluationOrder::getFreezeOrderDate);
+        queryWrapper.eq(EamTechnicalStatusEvaluationOrder::getDelFlag, CommonConstant.DEL_FLAG_0);
+        LocalDate localDate = LocalDate.now();
+        queryWrapper.lt(EamTechnicalStatusEvaluationOrder::getFreezeOrderDate, localDate.toString());
+        return this.getBaseMapper().selectList(queryWrapper);
+    }
+
+    @Override
+    public List<EamTechnicalStatusEvaluationOrder> selectUncompletedEvaluationOrderList() {
+        LambdaQueryWrapper<EamTechnicalStatusEvaluationOrder> queryWrapper = new LambdaQueryWrapper<>();
+        List<String> statusList = Arrays.asList(TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.UNDER_EVALUATION.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.REPAIRER_SIGNING.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.REPAIR_MANAGER_SIGNING.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.PROCESS_TECHNICIAN_SIGNING.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.DEPART_TECHNICAL_LEADER_SIGNING.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.INSPECTOR_SIGNING.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.LOCKED.name()
+        );
+        queryWrapper.in(EamTechnicalStatusEvaluationOrder::getEvaluationStatus, statusList);
+        queryWrapper.isNotNull(EamTechnicalStatusEvaluationOrder::getOrderExpirationDate);
+        queryWrapper.eq(EamTechnicalStatusEvaluationOrder::getDelFlag, CommonConstant.DEL_FLAG_0);
+        LocalDate localDate = LocalDate.now();
+        queryWrapper.lt(EamTechnicalStatusEvaluationOrder::getOrderExpirationDate, localDate.toString());
+        return this.getBaseMapper().selectList(queryWrapper);
+    }
+
+    /**
+     * 鎶�鏈壌瀹氳〃鎵归噺鎵撳嵃鎺ュ彛
+     * @param ids
+     * @param type
+     * @return
+     */
+    @Override
+    public List<EamTechnicalStatusEvaluationOrderResult> batchPrint(String ids, String type){
+        QueryWrapper<EamTechnicalStatusEvaluationOrder> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("ems.del_flag",CommonConstant.DEL_FLAG_0.toString());
+        queryWrapper.eq("ems.evaluation_status",TechnicalStatusEvaluationOrderStatusEnum.COMPLETED.name());
+        //鐢ㄦ埛鏁版嵁鏉冮檺
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        if (sysUser == null) {
+            return new ArrayList<>();
+        }
+        if (StringUtils.isNotBlank(sysUser.getEamEquipmentIds())) {
+            //閫夋嫨浜嗚澶囷紝鏍规嵁璁惧id杩囨护璁惧
+            List<String> equipArr = Arrays.asList(sysUser.getEamEquipmentIds().split(","));
+            queryWrapper.in("e.equipment_code", equipArr);
+        } else {
+            //娌℃湁閫夋嫨璁惧锛屾牴鎹腑蹇冭繃婊よ澶�
+            List<BaseFactoryUser> baseFactoryUserList=baseFactoryUserService.
+                    list(new LambdaQueryWrapper<BaseFactoryUser>().eq(BaseFactoryUser::getUserId,sysUser.getId()));
+            if(!CollectionUtils.isEmpty(baseFactoryUserList)){
+                Set<String> factoryIds = baseFactoryUserList.stream().map(BaseFactoryUser::getFactoryId).collect(Collectors.toSet());
+                Set<String> factoryCode= baseFactoryService.listByIds(factoryIds).stream().map(BaseFactory::getOrgCode).collect(Collectors.toSet());
+                queryWrapper.in("e.factory_org_code", factoryCode);
+            } else {
+                return new ArrayList<>();
+            }
+        }
+        //鏌ヨ鏉′欢杩囨护
+        if (StrUtil.isNotEmpty(ids)) {
+            List<String> idList = Arrays.asList(ids.split(","));
+            queryWrapper.in("ems.id", idList);
+        } else {
+            queryWrapper.orderByDesc("ems.create_time");
+        }
+        List<EamTechnicalStatusEvaluationOrderResult> list = this.baseMapper.queryList(queryWrapper);
+        list.forEach(item->{
+            if (TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK.name().equals(type)){
+                List<EamTechnicalStatusEvaluationOrderDetail> evaluationStandardDetails=
+                        eamTechnicalStatusEvaluationOrderDetailService.queryList(item.getId(),TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK.name());
+                item.setTableSafetyDetailList(evaluationStandardDetails);
+            }else if (TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK.name().equals(type)){
+                List<EamTechnicalStatusEvaluationOrderDetail> evaluationOrderDetails=
+                        eamTechnicalStatusEvaluationOrderDetailService.queryList(item.getId(),TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK.name());
+                item.setTablePrecisionDetailList(evaluationOrderDetails);
+            }else  if (TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK.name().equals(type)){
+                List<EamTechnicalStatusEvaluationOrderDetail> evaluationOrderDetails=
+                        eamTechnicalStatusEvaluationOrderDetailService.queryList(item.getId(),TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK.name());
+                item.setTableOtherDetailList(evaluationOrderDetails);
+            }
+        });
+        return list;
+    }
+
+    private EamTechnicalStatusEvaluationOrder checkDuplicate(String equipmentId) {
+        LambdaQueryWrapper<EamTechnicalStatusEvaluationOrder> queryWrapper = new LambdaQueryWrapper<>();
+        List<String> statusList = Arrays.asList(TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.UNDER_EVALUATION.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.REPAIRER_SIGNING.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.REPAIR_MANAGER_SIGNING.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.PROCESS_TECHNICIAN_SIGNING.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.DEPART_TECHNICAL_LEADER_SIGNING.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.INSPECTOR_SIGNING.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.LOCKED.name(),
+                TechnicalStatusEvaluationOrderStatusEnum.CHANGING.name()
+        );
+        queryWrapper.in(EamTechnicalStatusEvaluationOrder::getEvaluationStatus, statusList);
+        queryWrapper.eq(EamTechnicalStatusEvaluationOrder::getDelFlag, CommonConstant.DEL_FLAG_0);
+        queryWrapper.eq(EamTechnicalStatusEvaluationOrder::getEquipmentId, equipmentId);
+        List<EamTechnicalStatusEvaluationOrder> list = this.getBaseMapper().selectList(queryWrapper);
+        if (CollectionUtil.isEmpty(list)) {
+            return null;
+        }
+        return list.get(0);
     }
 
     private void checkDetailResult(List<EamTechnicalStatusEvaluationOrderDetail> detailList, TechnicalStatusEvaluationCheckCategoryEnum checkCategory) {
@@ -588,19 +711,19 @@
         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;

--
Gitblit v1.9.3