From 3bc2339aa32cb6c3704bdb3a244c99b8d93ff39d Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期二, 08 七月 2025 09:15:46 +0800
Subject: [PATCH] art:技术状态鉴定规范-相关接口提交

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java |   50 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 45 insertions(+), 5 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 8ba1b11..a1c6644 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
@@ -6,6 +6,7 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.constant.CommonConstant;
@@ -16,10 +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.MaintenanceStandardStatusEnum;
 import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationStandardEnum;
-import org.jeecg.modules.eam.entity.EamMaintenanceStandard;
-import org.jeecg.modules.eam.entity.EamMaintenanceStandardDetail;
 import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard;
 import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandardDetail;
 import org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationStandardMapper;
@@ -29,8 +27,6 @@
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
@@ -183,4 +179,48 @@
         }
         return true;
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean upgrade(EamTechnicalStatusEvaluationStandardRequest request) {
+        EamTechnicalStatusEvaluationStandard entity = this.getBaseMapper().selectById(request.getId());
+        if(entity == null){
+            throw new JeecgBootException("鍗囩増鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�");
+        }
+
+        //鏂板涓�涓増鏈�
+        EamTechnicalStatusEvaluationStandard newEntity = new EamTechnicalStatusEvaluationStandard();
+        newEntity.setStandardCode(request.getStandardCode());
+        newEntity.setStandardName(request.getStandardName());
+        newEntity.setEvaluationPeriod(request.getEvaluationPeriod());
+        newEntity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.ENABLE.name());
+        //鐗堟湰閫掑
+        newEntity.setStandardVersion(SimpleVersionGenerateUtil.addVersion(entity.getStandardVersion()));
+        //璁惧澶勭悊
+        newEntity.setEquipmentId(request.getEquipmentId());
+        //鍒犻櫎鏍囪
+        newEntity.setDelFlag(CommonConstant.DEL_FLAG_0);
+        //閲嶅鎬ф牎楠�
+        EamTechnicalStatusEvaluationStandard exist = checkDuplicate(newEntity.getEquipmentId(), entity.getId());
+        if(exist != null){
+            throw new JeecgBootException("閴村畾瑙勮寖宸插瓨鍦紝涓嶈兘閲嶅娣诲姞锛�");
+        }
+        this.getBaseMapper().insert(newEntity);
+        //澶勭悊鏄庣粏鏁版嵁
+        if(CollectionUtil.isNotEmpty(request.getTableDetailList())) {
+            request.getTableDetailList().forEach(tableDetail -> {
+                tableDetail.setId(null);
+                tableDetail.setCreateBy(null);
+                tableDetail.setUpdateBy(null);
+                tableDetail.setCreateTime(null);
+                tableDetail.setUpdateTime(null);
+                tableDetail.setStandardId(newEntity.getId());
+            });
+            standardDetailService.saveBatch(request.getTableDetailList());
+        }
+        //绂佺敤鍘熸潵鐨勭増鏈�
+        entity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.DISABLE.name());
+        this.getBaseMapper().updateById(entity);
+        return true;
+    }
 }

--
Gitblit v1.9.3