From deba25af7b2a6fefce0e477782274ffd600abac8 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期二, 06 五月 2025 10:38:18 +0800
Subject: [PATCH] art: 设备管理-点检-设备台账状态变更,点检流程更新设备保养状态

---
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentExtendServiceImpl.java |   18 +++++++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java                 |   14 +++++++
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentMaintenanceStatus.java        |    9 +++-
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java        |   22 +++++++++--
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentExtendService.java         |    8 ++++
 5 files changed, 64 insertions(+), 7 deletions(-)

diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentMaintenanceStatus.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentMaintenanceStatus.java
index c767511..4810047 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentMaintenanceStatus.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentMaintenanceStatus.java
@@ -4,7 +4,10 @@
  * 淇濆吇鐘舵��
  */
 public enum EquipmentMaintenanceStatus {
-    NORMAL,
-    UNDER_MAINTENANCE,
-    WAIT_CONFIRM,;
+    NORMAL, //姝e父
+    UNDER_INSPECTION, //鐐规涓�
+    INSPECTION_CONFIRM, //鐐规纭涓�
+    UNDER_MAINTENANCE, //鍛ㄤ繚涓�
+    WAIT_CONFIRM, //鍛ㄤ繚纭涓�
+    ;
 }
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentExtendService.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentExtendService.java
index c886331..72afff7 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentExtendService.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentExtendService.java
@@ -25,4 +25,12 @@
      * @return
      */
     boolean updateEquipmentRepairStatus(String equipmentId, String status);
+
+    /**
+     * 鏇存柊璁惧缁翠慨鐘舵��
+     * @param equipmentId 璁惧id
+     * @param status 鐘舵��
+     * @return
+     */
+    boolean updateEquipmentInspectionStatus(String equipmentId, String status);
 }
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentExtendServiceImpl.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentExtendServiceImpl.java
index b7c322d..d85e370 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentExtendServiceImpl.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentExtendServiceImpl.java
@@ -1,5 +1,6 @@
 package org.jeecg.modules.eam.service.impl;
 
+import org.jeecg.modules.eam.constant.EquipmentMaintenanceStatus;
 import org.jeecg.modules.eam.entity.EamEquipmentExtend;
 import org.jeecg.modules.eam.mapper.EamEquipmentExtendMapper;
 import org.jeecg.modules.eam.service.IEamEquipmentExtendService;
@@ -45,4 +46,21 @@
         eamEquipmentExtendMapper.updateById(entity);
         return true;
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean updateEquipmentInspectionStatus(String equipmentId, String status) {
+        EamEquipmentExtend entity = eamEquipmentExtendMapper.selectById(equipmentId);
+        if (entity == null) {
+            return false;
+        }
+        //淇濆吇浼樺厛鐐规鐘舵�� 濡傛灉姝e湪淇濆吇涓紝鍒欑偣妫�鐘舵�佷笉瑕嗙洊淇濆吇鐘舵�侊紝鍙嶄箣 淇濆吇鐘舵�佸彲浠ヨ鐩栫偣妫�鐘舵��
+        if (EquipmentMaintenanceStatus.NORMAL.name().equals(entity.getMaintenanceStatus())
+                || EquipmentMaintenanceStatus.UNDER_INSPECTION.name().equals(entity.getMaintenanceStatus())
+                || EquipmentMaintenanceStatus.INSPECTION_CONFIRM.name().equals(entity.getMaintenanceStatus())) {
+            entity.setMaintenanceStatus(status);
+            eamEquipmentExtendMapper.updateById(entity);
+        }
+        return true;
+    }
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java
new file mode 100644
index 0000000..00f3bf7
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java
@@ -0,0 +1,14 @@
+package org.jeecg.modules.eam.controller;
+
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@Api(tags="璁惧绠$悊-棣栭〉鐪嬫澘鎺ュ彛")
+@RestController
+@RequestMapping("/eam/dashboard")
+public class EamDashboardController {
+
+}
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java
index fbcf6a5..e79f405 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java
@@ -23,6 +23,7 @@
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog;
 import org.jeecg.modules.eam.constant.BusinessCodeConst;
+import org.jeecg.modules.eam.constant.EquipmentMaintenanceStatus;
 import org.jeecg.modules.eam.constant.EquipmentOperationTagEnum;
 import org.jeecg.modules.eam.constant.InspectionStatus;
 import org.jeecg.modules.eam.entity.EamEquipment;
@@ -31,10 +32,7 @@
 import org.jeecg.modules.eam.mapper.EamInspectionOrderMapper;
 import org.jeecg.modules.eam.request.EamInspectionOrderQuery;
 import org.jeecg.modules.eam.request.EamInspectionOrderRequest;
-import org.jeecg.modules.eam.service.IEamEquipmentService;
-import org.jeecg.modules.eam.service.IEamInspectionOrderDetailService;
-import org.jeecg.modules.eam.service.IEamInspectionOrderService;
-import org.jeecg.modules.eam.service.IEamReportRepairService;
+import org.jeecg.modules.eam.service.*;
 import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness;
 import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl;
 import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI;
@@ -83,6 +81,8 @@
     private IMdcUserProductionService mdcUserProductionService;
     @Autowired
     private IEamReportRepairService eamReportRepairService;
+    @Autowired
+    private IEamEquipmentExtendService eamEquipmentExtendService;
 
     @Override
     public IPage<EamInspectionOrder> queryPageList(Page<EamInspectionOrder> page, EamInspectionOrderQuery query) {
@@ -180,6 +180,8 @@
         }
         if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) {
             triggerProcess(eamInspectionOrder);
+            //鏇存柊璁惧淇濆吇鐘舵��
+            eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name());
         }
         return true;
     }
@@ -219,11 +221,15 @@
 
 
     @Override
+    @Transactional(rollbackFor = {Exception.class})
     public boolean editInspectionOrder(EamInspectionOrderRequest eamInspectionOrderRequest) {
         EamInspectionOrder eamInspectionOrder = new EamInspectionOrder();
         BeanUtils.copyProperties(eamInspectionOrderRequest, eamInspectionOrder);
         if (StrUtil.isNotEmpty(eamInspectionOrder.getOperator())) {
             eamInspectionOrder.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name());
+            triggerProcess(eamInspectionOrder);
+            //鏇存柊璁惧淇濆吇鐘舵��
+            eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name());
         }
         super.updateById(eamInspectionOrder);
         //澶勭悊鏄庣粏鏁版嵁
@@ -261,6 +267,8 @@
             eamInspectionOrder.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name());
             this.triggerProcess(eamInspectionOrder);
             this.updateById(eamInspectionOrder);
+            //鏇存柊璁惧淇濆吇鐘舵��
+            eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name());
             return true;
         }
     }
@@ -446,6 +454,8 @@
                 }
                 eamInspectionOrderDetailService.remove(new QueryWrapper<EamInspectionOrderDetail>().eq("order_id", order.getId()));
                 eamInspectionOrderDetailService.saveBatch(request.getTableDetailList());
+                //鏇存柊璁惧淇濆吇鐘舵��
+                eamEquipmentExtendService.updateEquipmentInspectionStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.INSPECTION_CONFIRM.name());
             } else if (InspectionStatus.WAIT_CONFIRM.name().equals(order.getInspectionStatus()) && StrUtil.isNotEmpty(request.getConfirmDealType())) {
                 // 鐝粍闀跨‘璁や换鍔�
                 order.setInspectionStatus(InspectionStatus.COMPLETE.name());
@@ -453,6 +463,8 @@
                 order.setConfirmComment(request.getConfirmComment());
                 order.setConfirmDealType(request.getConfirmDealType());
                 order.setConfirmTime(new Date());
+                //鏇存柊璁惧淇濆吇鐘舵��
+                eamEquipmentExtendService.updateEquipmentInspectionStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.NORMAL.name());
             }
         }
     }
@@ -498,6 +510,8 @@
                 if (InspectionStatus.UNDER_INSPECTION.name().equals(type)) {
                     eamInspectionOrder.setOperator(loginUser.getUsername());
                     this.triggerProcess(eamInspectionOrder);
+                    //鏇存柊璁惧淇濆吇鐘舵��
+                    eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name());
                 } else {
                     eamInspectionOrder.setOperator(null);
                 }

--
Gitblit v1.9.3