From 16cd6a3d63f3352c1a20abb5fc73f48a4204bc62 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期四, 10 七月 2025 19:51:19 +0800
Subject: [PATCH] art: 技术状态鉴定工单-数据库设计修改

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java |  109 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 102 insertions(+), 7 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java
index a9246ce..65c5bd8 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java
@@ -1,6 +1,7 @@
 package org.jeecg.modules.eam.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -9,15 +10,16 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
+import org.flowable.engine.TaskService;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.constant.DataBaseConstant;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.eam.constant.BusinessCodeConst;
-import org.jeecg.modules.eam.constant.EamTechnicalStatusEvaluationOrderEnum;
 import org.jeecg.modules.eam.constant.HfTemplateCategoryEnum;
 import org.jeecg.modules.eam.constant.OrderCreationMethodEnum;
+import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationOrderStatusEnum;
 import org.jeecg.modules.eam.entity.EamBaseHFCode;
 import org.jeecg.modules.eam.entity.EamEquipment;
 import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationOrder;
@@ -26,18 +28,23 @@
 import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationOrderQuery;
 import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationOrderRequest;
 import org.jeecg.modules.eam.service.*;
+import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness;
+import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService;
+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.BaseFactory;
 import org.jeecg.modules.system.entity.BaseFactoryUser;
 import org.jeecg.modules.system.service.IBaseFactoryService;
 import org.jeecg.modules.system.service.IBaseFactoryUserService;
 import org.jeecg.modules.system.service.ISysBusinessCodeRuleService;
+import org.jeecg.modules.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -46,8 +53,8 @@
  * @Date: 2025-07-09
  * @Version: V1.0
  */
-@Service
-public class EamTechnicalStatusEvaluationOrderServiceImpl extends ServiceImpl<EamTechnicalStatusEvaluationOrderMapper, EamTechnicalStatusEvaluationOrder> implements IEamTechnicalStatusEvaluationOrderService {
+@Service("IEamTechnicalStatusEvaluationOrderService")
+public class EamTechnicalStatusEvaluationOrderServiceImpl extends ServiceImpl<EamTechnicalStatusEvaluationOrderMapper, EamTechnicalStatusEvaluationOrder> implements IEamTechnicalStatusEvaluationOrderService, FlowCallBackServiceI {
 
     @Autowired
     private IBaseFactoryUserService baseFactoryUserService;
@@ -63,6 +70,21 @@
     private IEamTechnicalStatusEvaluationStandardService standardService;
     @Autowired
     private IEamBaseHFCodeService hfCodeService;
+    @Autowired
+    private FlowCommonService flowCommonService;
+    @Autowired
+    private IFlowDefinitionService flowDefinitionService;
+    @Autowired
+    private IFlowMyBusinessService flowMyBusinessService;
+    @Autowired
+    private TaskService taskService;
+    @Autowired
+    private IFlowTaskService flowTaskService;
+
+    @Autowired
+    private ISysUserService sysUserService;
+    @Autowired
+    private IEamEquipmentExtendService equipmentExtendService;
 
     @Override
     public IPage<EamTechnicalStatusEvaluationOrder> queryPageList(Page<EamTechnicalStatusEvaluationOrder> page, EamTechnicalStatusEvaluationOrderQuery query) {
@@ -148,7 +170,7 @@
         request.setOrderNum(codeSeq);
         request.setCreationMethod(OrderCreationMethodEnum.MANUAL.name());
         //鐘舵�佸垵濮嬪寲
-        order.setEvaluationStatus(EamTechnicalStatusEvaluationOrderEnum.WAIT_EVALUATION.name());
+        order.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name());
         order.setCreationMethod(request.getCreationMethod());
         //鍒犻櫎鏍囪
         order.setDelFlag(CommonConstant.DEL_FLAG_0);
@@ -187,4 +209,77 @@
         }
         return true;
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean collect(String id) {
+        EamTechnicalStatusEvaluationOrder entity = super.getBaseMapper().selectById(id);
+        if (entity == null) {
+            throw new JeecgBootException("瑕侀鍙栫殑宸ュ崟涓嶅瓨鍦紝璇峰埛鏂伴噸璇曪紒");
+        }
+        if (!TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name().equals(entity.getEvaluationStatus())) {
+            throw new JeecgBootException("璇ュ伐鍗曞凡杩涜杩囬鍙栵紒");
+        }
+        EamEquipment equipment = equipmentService.getById(entity.getEquipmentId());
+        if (equipment == null) {
+            throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�");
+        }
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        if(sysUser == null) {
+            throw new JeecgBootException("涓嶆槸缁翠慨宸ワ紝鏃犳硶棰嗗彇姝ゅ伐鍗曪紒");
+        }
+        entity.setEvaluator(sysUser.getUsername());
+        entity.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.UNDER_EVALUATION.name());
+        entity.setActualStartTime(new Date());
+        this.getBaseMapper().updateById(entity);
+
+        //鍚姩娴佺▼
+        flowCommonService.initActBusiness("宸ュ崟鍙�: " + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";瀹夎浣嶇疆" + equipment.getInstallationPosition(),
+                entity.getId(), "IEamTechnicalStatusEvaluationOrderService", "technical_status_evaluation_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);
+//        List<String> usernames = new ArrayList<>();
+//        usernames.add(entity.getOperator());
+//        variables.put("NextAssignee", usernames);
+//        Result result = flowDefinitionService.startProcessInstanceByKey("second_maintenance_process", variables);
+//        if (result != null) {
+//            //鏇存柊璁惧淇濆吇鐘舵��
+//            eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_SECOND_MAINTENANCE.name());
+//            return result.isSuccess();
+//        }
+        return true;
+    }
+
+    @Override
+    public void afterFlowHandle(FlowMyBusiness business) {
+        business.getTaskNameId();//鎺ヤ笅鏉ュ鎵圭殑鑺傜偣
+        business.getValues();//鍓嶇浼犺繘鏉ョ殑鍙傛暟
+        business.getActStatus();
+    }
+
+    @Override
+    public Object getBusinessDataById(String dataId) {
+        return this.getById(dataId);
+    }
+
+    @Override
+    public Map<String, Object> flowValuesOfTask(String taskNameId, Map<String, Object> values) {
+        return null;
+    }
+
+    @Override
+    public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) {
+        //涓氬姟鏄惁骞查娴佺▼锛屼笟鍔″共棰勶紝娴佺▼骞查锛屾寚瀹氫汉鍛樿繘琛屽鐞�
+        //鑾峰彇涓嬩竴姝ュ鐞嗕汉
+        Object object = values.get("NextAssignee");
+        return (List<String>) object;
+    }
 }

--
Gitblit v1.9.3