From 218ab860ed4708f6f70a519775c56c9554000fe7 Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期五, 27 六月 2025 13:42:41 +0800
Subject: [PATCH] 去除多余引用

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionCycleController.java |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionCycleController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionCycleController.java
index 47c27ad..7f69705 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionCycleController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionCycleController.java
@@ -21,10 +21,13 @@
 import org.jeecg.common.util.DateUtils;
 
 import org.jeecg.modules.eam.entity.*;
+import org.jeecg.modules.eam.mapper.InspectionCycleMapper;
 import org.jeecg.modules.eam.service.IInspectionCycleService;
 import org.jeecg.modules.eam.service.IInspectionProjectService;
 
+import org.jeecg.modules.eam.service.IdentityService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
@@ -55,6 +58,15 @@
 
     @Autowired
     private ISysBaseAPI sysBaseApi;
+
+    @Autowired
+    private InspectionCycleMapper inspectionCycleMapper;
+
+    @Autowired
+    @Lazy
+    private IdentityService sysIdentityService;
+
+
 //
 //
 //    @Autowired
@@ -125,6 +137,9 @@
     public Result<String> addNew(@RequestBody InspectionCycle inspectionCycle) {
         String cycleUnit = sysBaseApi.queryDictTextByKey("cycle_unit", String.valueOf(inspectionCycle.getCycleUnit()));
         inspectionCycle.setName(String.valueOf(inspectionCycle.getCycle()).concat(cycleUnit));
+//        String num = "DJ" + DateUtils.date2Str(DateUtils.yyyyMMdd.get()) + inspectionCycleMapper.getInspectionCycleNum();
+        String num = sysIdentityService.getNumByTypeAndLength("InspectionCycle", 4);
+        inspectionCycle.setCode(num);
         inspectionCycleService.save(inspectionCycle);
         return Result.OK("娣诲姞鎴愬姛锛�");
     }
@@ -342,6 +357,8 @@
         inspectionCycle.setCreateTime(new Date());
         inspectionCycle.setUpdateBy(null);
         inspectionCycle.setUpdateTime(null);
+        inspectionCycle.setLoseEfficacyTime(null);
+        inspectionCycle.setTakeEffectTime(null);
         boolean b = inspectionCycleService.save(inspectionCycle);
         if(b){
             return Result.OK("鐗堟湰鍗囩骇鎴愬姛锛�");
@@ -376,8 +393,10 @@
         List<InspectionCycle> list = inspectionCycleService.lambdaQuery().eq(InspectionCycle::getCode, inspectionCycle.getCode()).eq(InspectionCycle::getVersionStatus, "2").list();
         for (InspectionCycle cycle : list) {
             cycle.setVersionStatus("3");
+            cycle.setLoseEfficacyTime(new Date());
             inspectionCycleService.updateById(cycle);
         }
+        inspectionCycle.setTakeEffectTime(new Date());
         boolean b = inspectionCycleService.updateById(inspectionCycle);
         if (b){
             return Result.OK("缂栬緫鎴愬姛!");

--
Gitblit v1.9.3