From 650b17081633bd2cce2a07d8fb4ebbfbd50a8edf Mon Sep 17 00:00:00 2001
From: hyingbo <1363390067@qq.com>
Date: 星期五, 18 七月 2025 16:53:55 +0800
Subject: [PATCH] 修改点检结果为异常,异常是否报修为否的情况下生成故障数据的逻辑

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java |   40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

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..1339141 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
@@ -6,6 +6,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 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 com.fasterxml.jackson.core.JsonProcessingException;
@@ -35,13 +36,13 @@
 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.vo.InspectionVo;
 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;
 import org.jeecg.modules.flowable.apithird.service.FlowCommonService;
 import org.jeecg.modules.flowable.service.IFlowDefinitionService;
 import org.jeecg.modules.flowable.service.IFlowTaskService;
-import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.IMdcUserProductionService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -50,7 +51,6 @@
 
 import javax.annotation.Resource;
 import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * @Description: 鐐规宸ュ崟
@@ -197,8 +197,7 @@
         } else {
             eamInspectionOrder.setEquipmentCode(equipment.getEquipmentCode());
         }
-        System.out.println("璁惧鐐规锛�" + eamInspectionOrder.getId());
-        flowCommonService.initActBusiness("宸ュ崟鍙凤細" + eamInspectionOrder.getOrderNum() + "璁惧缂栧彿" + eamInspectionOrder.getEquipmentCode() + "杩涜璁惧鐐规",
+        flowCommonService.initActBusiness("宸ュ崟鍙�: " + eamInspectionOrder.getOrderNum() + ";璁惧缂栧彿: " + eamInspectionOrder.getEquipmentCode() + ";瀹夎浣嶇疆: " + equipment.getInstallationPosition(),
                 eamInspectionOrder.getId(), "IEamInspectionOrderService", "eam_inspection", null);
         Map<String, Object> variables = new HashMap<>();
         variables.put("dataId", eamInspectionOrder.getId());
@@ -394,17 +393,13 @@
         Map<String, Object> values = new HashMap<>();
         if (InspectionStatus.UNDER_INSPECTION.name().equals(order.getInspectionStatus()) && user.getUsername().equals(order.getOperator())) {
             // 鐐规浜虹偣妫�缁撴潫
-            String orgId = Optional.ofNullable(iEamEquipmentService.getById(order.getEquipmentId()))
-                    .map(equipment -> equipment.getOrgId())
+            String manager = Optional.ofNullable(iEamEquipmentService.getById(order.getEquipmentId()))
+                    .map(EamEquipment::getEquipmentManager)
                     .orElse(null);
-            if (orgId == null) {
-                throw new IllegalArgumentException("鏈壘鍒拌澶囩殑缁勭粐 ID");
+            if (manager == null) {
+                throw new IllegalArgumentException("璁惧绠$悊鍛樻湭閰嶇疆");
             }
-            List<SysUser> sysUserList = mdcUserProductionService.queryByPostAndProId("PCR0003", orgId);
-            List<String> usernameList = sysUserList.stream().map(SysUser::getUsername).collect(Collectors.toList());
-            if (usernameList.isEmpty()) {
-                throw new IllegalArgumentException("鏈壘鍒拌璁惧瀵瑰簲杞﹂棿鐨勭彮缁勯暱锛岃鑱旂郴绠$悊鍛樺鐞�");
-            }
+            List<String> usernameList = Collections.singletonList(manager);
             values.put("dataId", order.getId());
             values.put("organization", "鐐规浜虹偣妫�缁撴潫");
             values.put("comment", "鐐规浜虹偣妫�缁撴潫");
@@ -470,6 +465,10 @@
         List<EamInspectionOrderDetail> eamInspectionOrderDetails = eamInspectionOrderDetailService
                 .list(new QueryWrapper<EamInspectionOrderDetail>()
                         .eq("order_id", eamInspectionOrder.getId()).eq("report_flag", "1").eq("inspection_result", "2"));
+        //鍙湁淇濆吇椤规槑缁嗕腑鈥滅偣妫�缁撴灉鈥濅负鈥滃紓甯糕�濓紝骞朵笖"寮傚父鏄惁鎶ヤ慨"涓衡�滄槸鈥濈殑鎯呭喌鎵嶄細鐢熸垚鏁呴殰鏁版嵁锛屽叾浠栨儏鍐靛垯涓嶇敓鎴�
+        if (CollectionUtils.isEmpty(eamInspectionOrderDetails)) {
+            return;
+        }
         eamReportRepairService.reportRepairFromInspection(eamInspectionOrder.getEquipmentId(), eamInspectionOrder.getOperator(), eamInspectionOrderDetails);
     }
 
@@ -547,4 +546,19 @@
         Object object = values.get("NextAssignee");
         return (List<String>) object;
     }
+
+    @Override
+    public List<InspectionVo> findInspectionResult(String equipmentId,String itemDemand,String yearMonth) {
+        return this.baseMapper.findInspectionResult(equipmentId,itemDemand,yearMonth);
+    }
+
+    @Override
+    public List<InspectionVo> findInspectionUser(String equipmentId,String yearMonth) {
+        return this.baseMapper.findInspectionUser(equipmentId,yearMonth);
+    }
+
+    @Override
+    public List<Map<String, Object>> findInspectionStandard(String equipmentId) {
+        return this.baseMapper.findInspectionStandard(equipmentId);
+    }
 }

--
Gitblit v1.9.3