From b463880866cb946b824e989667ff3f0c0faf22f6 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期一, 14 七月 2025 17:09:33 +0800
Subject: [PATCH] art: 我的待办-查询问题修正

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java |  106 ++++++++++++++--------------------------------------
 1 files changed, 29 insertions(+), 77 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java
index fdff9fd..4d4acbe 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java
@@ -9,13 +9,10 @@
 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;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.flowable.engine.TaskService;
 import org.flowable.task.api.Task;
-import org.jeecg.common.api.vo.FileUploadResult;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.constant.DataBaseConstant;
@@ -23,10 +20,8 @@
 import org.jeecg.common.system.vo.LoginUser;
 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.ThirdMaintenanceStatusEnum;
+import org.jeecg.modules.eam.constant.*;
+import org.jeecg.modules.eam.entity.EamBaseHFCode;
 import org.jeecg.modules.eam.entity.EamEquipment;
 import org.jeecg.modules.eam.entity.EamThirdMaintenanceOrder;
 import org.jeecg.modules.eam.entity.EamThirdMaintenanceOrderDetail;
@@ -45,7 +40,6 @@
 import org.jeecg.modules.system.service.IBaseFactoryService;
 import org.jeecg.modules.system.service.IBaseFactoryUserService;
 import org.jeecg.modules.system.service.ISysUserService;
-import org.jeecg.modules.system.vo.UserSelector;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -85,13 +79,14 @@
     private IEamReportRepairService eamReportRepairService;
     @Autowired
     private IEamEquipmentExtendService eamEquipmentExtendService;
-    @Autowired
-    private IEamPrecisionCheckDetailService precisionCheckDetailService;
 
     @Resource
     private IBaseFactoryUserService baseFactoryUserService;
     @Resource
     private IBaseFactoryService baseFactoryService;
+
+    @Resource
+    private IEamBaseHFCodeService eamBaseHFCodeService;
 
     @Override
     public IPage<EamThirdMaintenanceOrder> queryPageList(Page<EamThirdMaintenanceOrder> page, EamThirdMaintenanceQuery query) {
@@ -154,23 +149,40 @@
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public boolean addMaintenance(EamThirdMaintenanceRequest request) {
+    public Result<String> addMaintenance(EamThirdMaintenanceRequest request) {
+        if (request == null) {
+            return Result.error("娣诲姞鐨勫璞′笉鑳戒负绌猴紒");
+        }
+        if (CollectionUtil.isEmpty(request.getTableDetailList())) {
+            return Result.error("淇濆吇椤逛笉鑳戒负绌猴紒");
+        }
         EamEquipment equipment = eamEquipmentService.getById(request.getEquipmentId());
         if (equipment == null) {
-            throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�");
+            return Result.error("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�");
         }
         EamThirdMaintenanceOrder order = new EamThirdMaintenanceOrder();
         order.setOrderNum(request.getOrderNum());
         order.setEquipmentId(request.getEquipmentId());
         order.setStandardId(request.getStandardId());
         order.setMaintenanceDate(request.getMaintenanceDate());
-        order.setOperator(request.getOperator());
         order.setRemark(request.getRemark());
         //鐘舵�佸垵濮嬪寲
         order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.WAIT_MAINTENANCE.name());
         order.setCreationMethod(request.getCreationMethod());
         //鍒犻櫎鏍囪
         order.setDelFlag(CommonConstant.DEL_FLAG_0);
+        //HF鐮佸鐞�  涓変繚绉讳氦鍗旽F缂栫爜
+        EamBaseHFCode hFCodeA = eamBaseHFCodeService.selectByCategory(HfTemplateCategoryEnum.THIRD_MAINTENANCE_HANDOVER.name());
+        if (hFCodeA == null) {
+            return Result.error("娣诲姞澶辫触,鏈厤缃笁淇濈Щ浜ゅ崟HF缂栫爜锛�");
+        }
+        order.setHfCodeA(hFCodeA.getHfCode());
+        // 涓変繚楠屾敹鍗旽F缂栫爜
+        EamBaseHFCode hFCodeB = eamBaseHFCodeService.selectByCategory(HfTemplateCategoryEnum.THIRD_MAINTENANCE_ACCEPTANCE.name());
+        if (hFCodeB == null) {
+            return Result.error("娣诲姞澶辫触,鏈厤缃笁淇濋獙鏀跺崟HF缂栫爜锛�");
+        }
+        order.setHfCodeB(hFCodeB.getHfCode());
         eamThirdMaintenanceOrderMapper.insert(order);
         //澶勭悊鏄庣粏鏁版嵁
         if (CollectionUtil.isNotEmpty(request.getTableDetailList())) {
@@ -180,41 +192,8 @@
             });
             thirdMaintenanceOrderDetailService.saveBatch(request.getTableDetailList());
         }
-        //澶勭悊绮惧害鍙傛暟
-        if (CollectionUtil.isNotEmpty(request.getPrecisionDetailList())) {
-            request.getPrecisionDetailList().forEach(tableDetail -> {
-                tableDetail.setId(null);
-                tableDetail.setOrderId(order.getId());
-            });
-            precisionCheckDetailService.saveBatch(request.getPrecisionDetailList());
-        }
-        //鍒ゆ柇鏄惁瀛樺湪淇濆吇浜� 濡傛灉瀛樺湪鍒欏惎鍔ㄦ祦绋�
-        if (StringUtils.isNotBlank(order.getOperator())) {
-            //鍚姩娴佺▼
-            flowCommonService.initActBusiness("宸ュ崟鍙�:" + order.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";瀹夎浣嶇疆" + equipment.getInstallationPosition(),
-                    order.getId(), "IEamThirdMaintenanceOrderService", "third_maintenance_process", null);
-            Map<String, Object> variables = new HashMap<>();
-            variables.put("dataId", order.getId());
-            if (StrUtil.isEmpty(order.getRemark())) {
-                variables.put("organization", "鏂板涓変繚宸ュ崟榛樿鍚姩娴佺▼");
-                variables.put("comment", "鏂板涓変繚宸ュ崟榛樿鍚姩娴佺▼");
-            } else {
-                variables.put("organization", order.getRemark());
-                variables.put("comment", order.getRemark());
-            }
-            variables.put("proofreading", true);
-            //骞惰浠诲姟浼氱
-            variables.put("maintenance_execution", Collections.singletonList(request.getOperator()));
-//            variables.put("precision_check", Collections.singletonList(equipment.getEquipmentManager()));
-            Result result = flowDefinitionService.startProcessInstanceByKey("third_maintenance_process", variables);
-            if (result != null) {
-                //鏇存柊璁惧淇濆吇鐘舵��
-                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_THIRD_MAINTENANCE.name());
-                return result.isSuccess();
-            }
-        }
 
-        return true;
+        return Result.OK("娣诲姞鎴愬姛锛�");
     }
 
     @Override
@@ -232,7 +211,6 @@
             throw new JeecgBootException("鍙湁寰呬繚鍏荤姸鎬佺殑鏁版嵁鎵嶅彲缂栬緫锛�");
         }
         entity.setMaintenanceDate(request.getMaintenanceDate());
-        entity.setOperator(request.getOperator());
         entity.setRemark(request.getRemark());
 
         eamThirdMaintenanceOrderMapper.updateById(entity);
@@ -259,32 +237,6 @@
             List<String> ids = request.getRemoveDetailList().stream().map(EamThirdMaintenanceOrderDetail::getId).collect(Collectors.toList());
             thirdMaintenanceOrderDetailService.removeBatchByIds(ids);
         }
-        //鍒ゆ柇鏄惁瀛樺湪淇濆吇浜� 濡傛灉瀛樺湪鍒欏惎鍔ㄦ祦绋�
-        if (StringUtils.isNotBlank(entity.getOperator())) {
-            //鍚姩娴佺▼
-            flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";瀹夎浣嶇疆" + equipment.getInstallationPosition(),
-                    entity.getId(), "IEamThirdMaintenanceOrderService", "third_maintenance_process", null);
-            Map<String, Object> variables = new HashMap<>();
-            variables.put("dataId", entity.getId());
-            if (StrUtil.isEmpty(entity.getRemark())) {
-                variables.put("organization", "鏂板涓変繚宸ュ崟榛樿鍚姩娴佺▼");
-                variables.put("comment", "鏂板涓変繚宸ュ崟榛樿鍚姩娴佺▼");
-            } else {
-                variables.put("organization", entity.getRemark());
-                variables.put("comment", entity.getRemark());
-            }
-            variables.put("proofreading", true);
-            //骞惰浠诲姟浼氱
-            variables.put("maintenance_execution", Collections.singletonList(request.getOperator()));
-//            variables.put("precision_check", Collections.singletonList(equipment.getEquipmentManager()));
-            Result result = flowDefinitionService.startProcessInstanceByKey("third_maintenance_process", variables);
-            if (result != null) {
-                //鏇存柊璁惧淇濆吇鐘舵��
-                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_THIRD_MAINTENANCE.name());
-                return result.isSuccess();
-            }
-
-        }
         return true;
     }
 
@@ -309,7 +261,7 @@
         if (sysUser == null || !BusinessCodeConst.PCR0001.equals(sysUser.getPost())) {
             throw new JeecgBootException("涓嶆槸鎿嶄綔宸ワ紝鏃犳硶棰嗗彇姝ゅ伐鍗曪紒");
         }
-        entity.setOperator(sysUser.getUsername());
+        entity.setRepairman(sysUser.getUsername());
         entity.setMaintenanceStatus(ThirdMaintenanceStatusEnum.UNDER_MAINTENANCE.name());
         entity.setActualStartTime(new Date());
         eamThirdMaintenanceOrderMapper.updateById(entity);
@@ -318,8 +270,8 @@
         flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";瀹夎浣嶇疆" + equipment.getInstallationPosition(),
                 entity.getId(), "IEamThirdMaintenanceOrderService", "third_maintenance_process", null);
         Map<String, Object> variables = new HashMap<>();
-        boolean equipmentPrecisionFlag = precisionCheckDetailService.hasPrecisionCheckDetail(entity.getId());
-        variables.put("equipmentPrecisionFlag", equipmentPrecisionFlag);
+//        boolean equipmentPrecisionFlag = precisionCheckDetailService.hasPrecisionCheckDetail(entity.getId());
+//        variables.put("equipmentPrecisionFlag", equipmentPrecisionFlag);
         variables.put("dataId", entity.getId());
         if (StrUtil.isEmpty(entity.getRemark())) {
             variables.put("organization", "鏂板涓変繚宸ュ崟榛樿鍚姩娴佺▼");

--
Gitblit v1.9.3