From b49bb4172817ebce1197710ae727ea9194b392a3 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 07 五月 2025 16:50:53 +0800
Subject: [PATCH] art: 设备管理-报修-点检、周保触发报修接口修改

---
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentFaultReasonServiceImpl.java |    7 +++++++
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java                      |    8 ++++++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java                |   25 +++++++++++++++++++------
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentFaultReasonService.java         |    7 ++++++-
 4 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java
index f33a01e..2cc0df8 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java
@@ -38,4 +38,12 @@
     //璁惧鑳芥簮閮�
     String PCR0005 = "PCR0005";
 
+    /**
+     * 鏁呴殰鍘熷洜缂栫爜
+     */
+    //鐐规鎵ц鏁呴殰
+    String EFR20250009 = "EFR20250009";
+    //鍛ㄤ繚鎵ц鏁呴殰
+    String EFR20250010 = "EFR20250010";
+
 }
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentFaultReasonService.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentFaultReasonService.java
index e0b0290..adf5a22 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentFaultReasonService.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentFaultReasonService.java
@@ -10,5 +10,10 @@
  * @Version: V1.0
  */
 public interface IEamEquipmentFaultReasonService extends IService<EamEquipmentFaultReason> {
-
+    /**
+     * 鏌ヨ鏁呴殰鍘熷洜
+     * @param faultCode 鏁呴殰缂栫爜
+     * @return
+     */
+    EamEquipmentFaultReason selectByFaultCode(String faultCode);
 }
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentFaultReasonServiceImpl.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentFaultReasonServiceImpl.java
index bccb006..5c0030c 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentFaultReasonServiceImpl.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentFaultReasonServiceImpl.java
@@ -1,5 +1,6 @@
 package org.jeecg.modules.eam.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.jeecg.modules.eam.entity.EamEquipmentFaultReason;
 import org.jeecg.modules.eam.mapper.EamEquipmentFaultReasonMapper;
 import org.jeecg.modules.eam.service.IEamEquipmentFaultReasonService;
@@ -16,4 +17,10 @@
 @Service
 public class EamEquipmentFaultReasonServiceImpl extends ServiceImpl<EamEquipmentFaultReasonMapper, EamEquipmentFaultReason> implements IEamEquipmentFaultReasonService {
 
+    @Override
+    public EamEquipmentFaultReason selectByFaultCode(String faultCode) {
+        LambdaQueryWrapper<EamEquipmentFaultReason> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(EamEquipmentFaultReason::getFaultCode, faultCode);
+        return this.baseMapper.selectOne(queryWrapper);
+    }
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java
index 3f89858..fcba01b 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java
@@ -17,6 +17,7 @@
 import org.jeecg.modules.eam.mapper.EamReportRepairMapper;
 import org.jeecg.modules.eam.request.EamReportRepairQuery;
 import org.jeecg.modules.eam.service.IEamEquipmentExtendService;
+import org.jeecg.modules.eam.service.IEamEquipmentFaultReasonService;
 import org.jeecg.modules.eam.service.IEamReportRepairService;
 import org.jeecg.modules.eam.vo.EquipmentRepairStatistics;
 import org.jeecg.modules.system.service.IMdcProductionService;
@@ -41,6 +42,8 @@
     private IEamEquipmentExtendService eamEquipmentExtendService;
     @Autowired
     private IMdcProductionService mdcProductionService;
+    @Autowired
+    private IEamEquipmentFaultReasonService eamEquipmentFaultReasonService;
 
     /**
      * 鍒嗛〉鍒楄〃
@@ -73,15 +76,20 @@
             sb.append(detail.getItemCode()).append("銆�");
             sb.append(detail.getExceptionDescription()).append(";");
         });
+        EamEquipmentFaultReason reason = eamEquipmentFaultReasonService.selectByFaultCode(BusinessCodeConst.EFR20250009);
         EamReportRepair entity = new EamReportRepair();
         entity.setEquipmentId(equipmentId);
         entity.setCreateBy(reportUser);
         entity.setFaultStartTime(new Date());
         entity.setBreakdownFlag(CommonConstant.DEFAULT_0);
         entity.setDelFlag(CommonConstant.DEL_FLAG_0);
-        entity.setFaultName("鍛ㄤ繚鎵ц鎶ヤ慨澶勭悊");
-        entity.setFaultDescription(sb.toString());
-        entity.setFaultType(CommonConstant.DEFAULT_1);
+        if(reason == null){
+            entity.setFaultName("鍛ㄤ繚鎵ц鎶ヤ慨澶勭悊");
+            entity.setFaultDescription(sb.toString());
+        }else {
+            entity.setFaultName(reason.getFaultName());
+            entity.setFaultType(reason.getFaultCategory());
+        }
         entity.setReportStatus(ReportRepairEnum.WAIT_REPAIR.name());
         this.baseMapper.insert(entity);
         //鏇存柊璁惧缁翠慨鐘舵��
@@ -98,15 +106,20 @@
             sb.append(detail.getItemCode()).append("銆�");
             sb.append(detail.getExceptionDescription()).append(";");
         });
+        EamEquipmentFaultReason reason = eamEquipmentFaultReasonService.selectByFaultCode(BusinessCodeConst.EFR20250010);
         EamReportRepair entity = new EamReportRepair();
         entity.setEquipmentId(equipmentId);
         entity.setCreateBy(reportUser);
         entity.setFaultStartTime(new Date());
         entity.setBreakdownFlag(CommonConstant.DEFAULT_0);
         entity.setDelFlag(CommonConstant.DEL_FLAG_0);
-        entity.setFaultName("鐐规鎵ц鎶ヤ慨澶勭悊");
-        entity.setFaultDescription(sb.toString());
-        entity.setFaultType(CommonConstant.DEFAULT_1);
+        if(reason == null){
+            entity.setFaultName("鐐规鎵ц鎶ヤ慨澶勭悊");
+            entity.setFaultDescription(sb.toString());
+        }else {
+            entity.setFaultName(reason.getFaultName());
+            entity.setFaultType(reason.getFaultCategory());
+        }
         entity.setReportStatus(ReportRepairEnum.WAIT_REPAIR.name());
         this.baseMapper.insert(entity);
         //鏇存柊璁惧缁翠慨鐘舵��

--
Gitblit v1.9.3