From c15c980814508369fcbb2dbfcfb53fe95688e005 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期四, 10 七月 2025 15:44:31 +0800
Subject: [PATCH] art: 技术状态鉴定-新增接口修改

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java |   80 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 77 insertions(+), 3 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 3cd996f..a9246ce 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
@@ -1,5 +1,6 @@
 package org.jeecg.modules.eam.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -10,14 +11,21 @@
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.constant.DataBaseConstant;
+import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.eam.constant.BusinessCodeConst;
+import org.jeecg.modules.eam.constant.EamTechnicalStatusEvaluationOrderEnum;
+import org.jeecg.modules.eam.constant.HfTemplateCategoryEnum;
+import org.jeecg.modules.eam.constant.OrderCreationMethodEnum;
+import org.jeecg.modules.eam.entity.EamBaseHFCode;
+import org.jeecg.modules.eam.entity.EamEquipment;
 import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationOrder;
+import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard;
 import org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationOrderMapper;
 import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationOrderQuery;
-import org.jeecg.modules.eam.service.IEamEquipmentService;
-import org.jeecg.modules.eam.service.IEamTechnicalStatusEvaluationOrderDetailService;
-import org.jeecg.modules.eam.service.IEamTechnicalStatusEvaluationOrderService;
+import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationOrderRequest;
+import org.jeecg.modules.eam.service.*;
 import org.jeecg.modules.system.entity.BaseFactory;
 import org.jeecg.modules.system.entity.BaseFactoryUser;
 import org.jeecg.modules.system.service.IBaseFactoryService;
@@ -25,6 +33,7 @@
 import org.jeecg.modules.system.service.ISysBusinessCodeRuleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Arrays;
 import java.util.List;
@@ -50,6 +59,10 @@
     private IEamEquipmentService equipmentService;
     @Autowired
     private ISysBusinessCodeRuleService businessCodeRuleService;
+    @Autowired
+    private IEamTechnicalStatusEvaluationStandardService standardService;
+    @Autowired
+    private IEamBaseHFCodeService hfCodeService;
 
     @Override
     public IPage<EamTechnicalStatusEvaluationOrder> queryPageList(Page<EamTechnicalStatusEvaluationOrder> page, EamTechnicalStatusEvaluationOrderQuery query) {
@@ -113,4 +126,65 @@
         queryWrapper.orderByDesc("ems.create_time");
         return this.getBaseMapper().queryPageList(page, queryWrapper);
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean addTechnicalStatusEvaluationOrder(EamTechnicalStatusEvaluationOrderRequest request) {
+        EamEquipment equipment = equipmentService.getById(request.getEquipmentId());
+        if (equipment == null) {
+            throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�");
+        }
+        EamTechnicalStatusEvaluationStandard standard = standardService.getById(request.getStandardId());
+        if(standard == 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.setRemark(request.getRemark());
+        String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TECHNICAL_STATUS_EVALUATION_ORDER_CODE_RULE);
+        request.setOrderNum(codeSeq);
+        request.setCreationMethod(OrderCreationMethodEnum.MANUAL.name());
+        //鐘舵�佸垵濮嬪寲
+        order.setEvaluationStatus(EamTechnicalStatusEvaluationOrderEnum.WAIT_EVALUATION.name());
+        order.setCreationMethod(request.getCreationMethod());
+        //鍒犻櫎鏍囪
+        order.setDelFlag(CommonConstant.DEL_FLAG_0);
+        //鎶�鏈姸鎬侀壌瀹氳〃
+        EamBaseHFCode eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.TECHNICAL_STATUS_EVALUATION.name());
+        if(eamBaseHFCode == null) {
+            throw new JeecgBootException("鏈厤缃妧鏈姸鎬侀壌瀹氳〃鐨凥F缂栫爜锛屾坊鍔犲け璐ワ紒");
+        }
+        order.setHfCodeA(eamBaseHFCode.getHfCode());
+        //鎶�鏈姸鎬侀壌瀹氬畨鍏ㄨ缃鏌ヨ〃
+        eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.TECHNICAL_STATUS_EVALUATION_SAFETY_CHECK.name());
+        if(eamBaseHFCode == null) {
+            throw new JeecgBootException("鏈厤缃畨鍏ㄨ缃鏌ヨ〃鐨凥F缂栫爜锛屾坊鍔犲け璐ワ紒");
+        }
+        order.setHfCodeB(eamBaseHFCode.getHfCode());
+        //鎶�鏈姸鎬侀壌瀹氬叾浠栨鏌ヨ〃
+        eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.TECHNICAL_STATUS_EVALUATION_OTHER_CHECK.name());
+        if(eamBaseHFCode == null) {
+            throw new JeecgBootException("鏈厤缃叾浠栨鏌ヨ〃鐨凥F缂栫爜锛屾坊鍔犲け璐ワ紒");
+        }
+        order.setHfCodeD(eamBaseHFCode.getHfCode());
+        //鎶�鏈姸鎬侀壌瀹氳澶囩簿搴︽鏌ヨ〃
+        eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.TECHNICAL_STATUS_EVALUATION_PRECISION_CHECK.name());
+        if(eamBaseHFCode == null) {
+            throw new JeecgBootException("鏈厤缃澶囩簿搴︽鏌ヨ〃鐨凥F缂栫爜锛屾坊鍔犲け璐ワ紒");
+        }
+        order.setHfCodeC(eamBaseHFCode.getHfCode());
+        this.getBaseMapper().insert(order);
+        //澶勭悊鏄庣粏鏁版嵁
+        if (CollectionUtil.isNotEmpty(request.getTableDetailList())) {
+            request.getTableDetailList().forEach(tableDetail -> {
+                tableDetail.setId(null);
+                tableDetail.setOrderId(order.getId());
+            });
+            orderDetailService.saveBatch(request.getTableDetailList());
+        }
+        return true;
+    }
 }

--
Gitblit v1.9.3