From 60aeab7298b4ca8ef5369b52e05a905f0c453a7d Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期二, 08 七月 2025 11:53:37 +0800
Subject: [PATCH] art:技术状态鉴定规范-接口变更修改

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java |  107 ++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 88 insertions(+), 19 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java
index 3f69197..1ead9e5 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java
@@ -17,6 +17,7 @@
 import org.jeecg.modules.eam.base.entity.BaseFactoryUser;
 import org.jeecg.modules.eam.base.service.IBaseFactoryService;
 import org.jeecg.modules.eam.base.service.IBaseFactoryUserService;
+import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationCheckCategoryEnum;
 import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationStandardEnum;
 import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard;
 import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandardDetail;
@@ -101,6 +102,10 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean addEamTechnicalStatusEvaluationStandard(EamTechnicalStatusEvaluationStandardRequest request) {
+        if(!CommonConstant.STATUS_1.equals(request.getHasOtherCheck()) && !CommonConstant.STATUS_1.equals(request.getHasSafetyEquipmentCheck()) && !CommonConstant.STATUS_1.equals(request.getHasPrecisionCheck())) {
+            //蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫�
+            throw new JeecgBootException("蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫伙紒");
+        }
         EamTechnicalStatusEvaluationStandard entity = new EamTechnicalStatusEvaluationStandard();
         BeanUtils.copyProperties(request, entity);
         entity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.WAIT_SUBMIT.name());
@@ -121,7 +126,31 @@
             request.getTableDetailList().forEach(tableDetail -> {
                 tableDetail.setStandardId(entity.getId());
             });
-            standardDetailService.saveBatch(request.getTableDetailList());
+            //鏍规嵁鍒嗙被鍒ゆ柇鏄惁淇濆瓨
+            if(CommonConstant.STATUS_1.equals(entity.getHasOtherCheck())) {
+                //淇濆瓨鍏朵粬鍒嗙被
+                List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                if(CollectionUtils.isEmpty(collect)) {
+                    throw new JeecgBootException("鍏朵粬妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒");
+                }
+                standardDetailService.saveBatch(collect);
+            }
+            if(CommonConstant.STATUS_1.equals(entity.getHasSafetyEquipmentCheck())) {
+                //淇濆瓨瀹夊叏瑁呯疆鍒嗙被
+                List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                if(CollectionUtils.isEmpty(collect)) {
+                    throw new JeecgBootException("瀹夊叏瑁呯疆妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒");
+                }
+                standardDetailService.saveBatch(collect);
+            }
+            if(CommonConstant.STATUS_1.equals(entity.getHasPrecisionCheck())) {
+                //淇濆瓨绮惧害妫�楠屽垎绫�
+                List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                if(CollectionUtils.isEmpty(collect)) {
+                    throw new JeecgBootException("绮惧害妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒");
+                }
+                standardDetailService.saveBatch(collect);
+            }
         }
         return true;
     }
@@ -147,6 +176,10 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean editEamTechnicalStatusEvaluationStandard(EamTechnicalStatusEvaluationStandardRequest request) {
+        if(!CommonConstant.STATUS_1.equals(request.getHasOtherCheck()) && !CommonConstant.STATUS_1.equals(request.getHasSafetyEquipmentCheck()) && !CommonConstant.STATUS_1.equals(request.getHasPrecisionCheck())) {
+            //蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫�
+            throw new JeecgBootException("蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫伙紒");
+        }
         EamTechnicalStatusEvaluationStandard entity = this.getBaseMapper().selectById(request.getId());
         if(entity == null){
             throw new JeecgBootException("缂栬緫鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�");
@@ -159,26 +192,34 @@
         this.getBaseMapper().updateById(entity);
         //澶勭悊璇︽儏
         if(CollectionUtil.isNotEmpty(request.getTableDetailList())) {
-            List<EamTechnicalStatusEvaluationStandardDetail> addList = new ArrayList<>();
-            List<EamTechnicalStatusEvaluationStandardDetail> updateList = new ArrayList<>();
-            request.getTableDetailList().forEach(tableDetail -> {
-                tableDetail.setStandardId(entity.getId());
-                if(tableDetail.getId() == null){
-                    addList.add(tableDetail);
-                }else {
-                    updateList.add(tableDetail);
+            //鍏堝垹闄ゆ鏌ラ」
+            standardDetailService.removeByStandardId(entity.getId());
+
+            //鏍规嵁鍒嗙被鍒ゆ柇鏄惁淇濆瓨
+            if(CommonConstant.STATUS_1.equals(entity.getHasOtherCheck())) {
+                //淇濆瓨鍏朵粬鍒嗙被
+                List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                if(CollectionUtils.isEmpty(collect)) {
+                    throw new JeecgBootException("鍏朵粬妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒");
                 }
-            });
-            if(CollectionUtil.isNotEmpty(addList)){
-                standardDetailService.saveBatch(addList);
+                standardDetailService.saveBatch(collect);
             }
-            if(CollectionUtil.isNotEmpty(updateList)){
-                standardDetailService.updateBatchById(updateList);
+            if(CommonConstant.STATUS_1.equals(entity.getHasSafetyEquipmentCheck())) {
+                //淇濆瓨瀹夊叏瑁呯疆鍒嗙被
+                List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                if(CollectionUtils.isEmpty(collect)) {
+                    throw new JeecgBootException("瀹夊叏瑁呯疆妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒");
+                }
+                standardDetailService.saveBatch(collect);
             }
-        }
-        if(CollectionUtil.isNotEmpty(request.getRemoveDetailList())) {
-            List<String> ids = request.getRemoveDetailList().stream().map(EamTechnicalStatusEvaluationStandardDetail::getId).collect(Collectors.toList());
-            standardDetailService.removeBatchByIds(ids);
+            if(CommonConstant.STATUS_1.equals(entity.getHasPrecisionCheck())) {
+                //淇濆瓨绮惧害妫�楠屽垎绫�
+                List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                if(CollectionUtils.isEmpty(collect)) {
+                    throw new JeecgBootException("绮惧害妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒");
+                }
+                standardDetailService.saveBatch(collect);
+            }
         }
         return true;
     }
@@ -186,6 +227,10 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean upgrade(EamTechnicalStatusEvaluationStandardRequest request) {
+        if(!CommonConstant.STATUS_1.equals(request.getHasOtherCheck()) && !CommonConstant.STATUS_1.equals(request.getHasSafetyEquipmentCheck()) && !CommonConstant.STATUS_1.equals(request.getHasPrecisionCheck())) {
+            //蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫�
+            throw new JeecgBootException("蹇呴』瑕侀�夋嫨涓�涓鏌ュ垎绫伙紒");
+        }
         EamTechnicalStatusEvaluationStandard entity = this.getBaseMapper().selectById(request.getId());
         if(entity == null){
             throw new JeecgBootException("鍗囩増鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�");
@@ -222,7 +267,31 @@
                 tableDetail.setUpdateTime(null);
                 tableDetail.setStandardId(newEntity.getId());
             });
-            standardDetailService.saveBatch(request.getTableDetailList());
+            //鏍规嵁鍒嗙被鍒ゆ柇鏄惁淇濆瓨
+            if(CommonConstant.STATUS_1.equals(entity.getHasOtherCheck())) {
+                //淇濆瓨鍏朵粬鍒嗙被
+                List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                if(CollectionUtils.isEmpty(collect)) {
+                    throw new JeecgBootException("鍏朵粬妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒");
+                }
+                standardDetailService.saveBatch(collect);
+            }
+            if(CommonConstant.STATUS_1.equals(entity.getHasSafetyEquipmentCheck())) {
+                //淇濆瓨瀹夊叏瑁呯疆鍒嗙被
+                List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                if(CollectionUtils.isEmpty(collect)) {
+                    throw new JeecgBootException("瀹夊叏瑁呯疆妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒");
+                }
+                standardDetailService.saveBatch(collect);
+            }
+            if(CommonConstant.STATUS_1.equals(entity.getHasPrecisionCheck())) {
+                //淇濆瓨绮惧害妫�楠屽垎绫�
+                List<EamTechnicalStatusEvaluationStandardDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                if(CollectionUtils.isEmpty(collect)) {
+                    throw new JeecgBootException("绮惧害妫�鏌ユ槑缁嗕笉鑳戒负绌猴紒");
+                }
+                standardDetailService.saveBatch(collect);
+            }
         }
         //绂佺敤鍘熸潵鐨勭増鏈�
         entity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.DISABLE.name());

--
Gitblit v1.9.3