From a93ad6deba13025c021e59d209aec90f30ec79f9 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期三, 16 七月 2025 15:41:16 +0800
Subject: [PATCH] 三保流程处理

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamThirdMaintenanceRequest.java               |  124 ++++++++--
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java |  448 ++++++++++++++++++++++++++-------------
 db/LS/dict_ls.sql                                                                                         |   39 +++
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/ThirdMaintenanceStatusEnum.java       |    5 
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamThirdMaintenanceOrder.java           |    5 
 5 files changed, 434 insertions(+), 187 deletions(-)

diff --git a/db/LS/dict_ls.sql b/db/LS/dict_ls.sql
index de01d1e..ad1650c 100644
--- a/db/LS/dict_ls.sql
+++ b/db/LS/dict_ls.sql
@@ -1,6 +1,6 @@
 --鐐规宸ュ崟鐘舵��
-delete from [dbo].[sys_dict] where dict_code='inspection_status';
 delete from [dbo].[sys_dict_item] where dict_id in (select id from [dbo].[sys_dict] where dict_code='inspection_status');
+delete from [dbo].[sys_dict] where dict_code='inspection_status';
 
 INSERT INTO [dbo].[sys_dict] ([id], [dict_name], [dict_code], [description], [del_flag], [create_by], [create_time], [update_by], [update_time], [type]) VALUES (N'1907309268858290177', N'鐐规鐘舵��', N'inspection_status', N'璁惧绠$悊-鐐规鐘舵��', 0, N'admin', '2025-04-02 13:49:00.0000000', N'admin', '2025-04-02 13:49:19.6510000', NULL);
 
@@ -12,8 +12,8 @@
 INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1919938438058639361', N'1907309268858290177', N'宸茶繃鏈�', N'EXPIRED', '', 6, 1, N'admin', '2025-05-07 10:12:49.0210000', NULL, NULL);
 
 --鐐规缁撴灉鐘舵��
-delete from [dbo].[sys_dict] where dict_code='inspection_project_result';
 delete from [dbo].[sys_dict_item] where dict_id in (select id from [dbo].[sys_dict] where dict_code='inspection_project_result');
+delete from [dbo].[sys_dict] where dict_code='inspection_project_result';
 
 INSERT INTO [dbo].[sys_dict] ([id], [dict_name], [dict_code], [description], [del_flag], [create_by], [create_time], [update_by], [update_time], [type]) VALUES (N'1745288324644782081', N'鐐规缁撴灉', N'inspection_project_result', '', 0, N'admin', '2024-01-11 11:35:37.1360000', NULL, NULL, NULL);
 
@@ -26,3 +26,38 @@
 delete from [dbo].[sys_fill_rule] where rule_code='org_repair_deport_rule';
 
 INSERT INTO [dbo].[sys_fill_rule] ([id], [rule_name], [rule_code], [rule_class], [rule_params], [update_by], [update_time], [create_by], [create_time]) VALUES (N'1676142178556973058', N'缁翠慨閮ㄩ棬鐝粍缂栫爜鐢熸垚', N'org_repair_deport_rule', N'org.jeecg.modules.system.rule.OrgCodeRepDepRule', N'{"parentId":""}', N'admin', '2025-07-03 11:27:21.0000000', NULL, NULL);
+
+--涓変繚宸ュ崟
+delete from [dbo].[sys_dict_item] where dict_id in (select id from [dbo].[sys_dict] where dict_code='third_maintenance_status');
+delete from [dbo].[sys_dict] where dict_code='third_maintenance_status';
+
+INSERT INTO [dbo].[sys_dict] ([id], [dict_name], [dict_code], [description], [del_flag], [create_by], [create_time], [update_by], [update_time], [type]) VALUES (N'1922909404263276545', N'涓変繚鐘舵��', N'third_maintenance_status', N'璁惧绠$悊浣跨敤', 0, N'admin', '2025-05-15 14:58:22.0000000', N'admin', '2025-05-15 14:58:49.8990000', NULL);
+
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1922910056741789698', N'1922909404263276545', N'寰呬繚鍏�', N'WAIT_MAINTENANCE', '', 1, 1, N'admin', '2025-05-15 15:00:58.1250000', NULL, NULL);
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1922910108998623233', N'1922909404263276545', N'淇濆吇涓�', N'UNDER_MAINTENANCE', '', 2, 1, N'admin', '2025-05-15 15:01:10.5850000', NULL, NULL);
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1922910161423228930', N'1922909404263276545', N'宸插畬鎴�', N'COMPLETE', '', 10, 1, N'admin', '2025-05-15 15:01:23.0000000', N'admin', '2025-07-15 17:13:54.3750000');
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1922910236320915457', N'1922909404263276545', N'宸蹭綔搴�', N'ABOLISH', '', 16, 1, N'admin', '2025-05-15 15:01:40.0000000', N'admin', '2025-07-15 17:14:40.2330000');
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943958519301062657', N'1922909404263276545', N'寰呮鏌�', N'WAIT_CHECK', '', 3, 1, N'admin', '2025-07-12 17:00:02.0000000', N'admin', '2025-07-12 17:01:49.4260000');
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943958562884075521', N'1922909404263276545', N'鎿嶄綔浜虹瀛�', N'OPERATOR_SIGNATURE', '', 6, 1, N'admin', '2025-07-12 17:00:13.0000000', N'admin', '2025-07-15 17:12:54.6730000');
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943958611886129153', N'1922909404263276545', N'缁翠慨浜虹瀛�', N'REPAIRMAN_SIGNATURE', '', 7, 1, N'admin', '2025-07-12 17:00:24.0000000', N'admin', '2025-07-15 17:13:01.7110000');
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_or der], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943958653095165954', N'1922909404263276545', N'缁翠慨瀹や富浠荤瀛�', N'REPAIR_MANAGER_SIGNATURE', '', 8, 1, N'admin', '2025-07-12 17:00:34.0000000', N'admin', '2025-07-15 17:13:42.1570000');
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943958696120336385', N'1922909404263276545', N'璁惧妫�鏌ヤ汉绛惧瓧', N'INSPECTOR_SIGNATURE', '', 9, 1, N'admin', '2025-07-12 17:00:44.0000000', N'admin', '2025-07-15 17:13:47.3310000');
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943958736733782017', N'1922909404263276545', N'宸查攣瀹�', N'FREEZE', '', 11, 1, N'admin', '2025-07-12 17:00:54.0000000', N'admin', '2025-07-15 17:14:00.0630000');
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943958772678967297', N'1922909404263276545', N'鍙樻洿涓�', N'CHANGE', '', 14, 1, N'admin', '2025-07-12 17:01:03.0000000', N'admin', '2025-07-15 17:14:14.6490000');
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943958818908585985', N'1922909404263276545', N'宸插彇娑�', N'CANCEL', '', 15, 1, N'admin', '2025-07-12 17:01:14.0000000', N'admin', '2025-07-15 17:14:32.3000000');
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1945048767556866049', N'1922909404263276545', N'绗竴娆¢獙鏀朵腑', N'UNDER_FIRST_ACCEPTANCE', '', 4, 1, N'admin', '2025-07-15 17:12:18.1080000', NULL, NULL);
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1945048856438362113', N'1922909404263276545', N'绗簩娆¢獙鏀朵腑', N'UNDER_SECOND_ACCEPTANCE', '', 5, 1, N'admin', '2025-07-15 17:12:39.2920000', NULL, NULL);
+
+--璁惧鍔熻兘鏄惁
+delete from [dbo].[sys_dict_item] where dict_id in (select id from [dbo].[sys_dict] where dict_code='equipment_function_yn');
+delete from [dbo].[sys_dict] where dict_code='equipment_function_yn';
+
+INSERT INTO [dbo].[sys_dict] ([id], [dict_name], [dict_code], [description], [del_flag], [create_by], [create_time], [update_by], [update_time], [type]) VALUES (N'1945027073496698882', N'璁惧鍔熻兘鏄惁', N'equipment_function_yn', N'璁惧绠$悊浣跨敤', 0, N'admin', '2025-07-15 15:46:05.8310000', NULL, NULL, NULL);
+
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1945027150818693122', N'1945027073496698882', N'鏄�', N'Y', '', 1, 1, N'admin', '2025-07-15 15:46:24.2780000', NULL, NULL);
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1945027186277339138', N'1945027073496698882', N'鍚�', N'N', '', 2, 1, N'admin', '2025-07-15 15:46:32.7290000', NULL, NULL);
+
+
+
+
+
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/ThirdMaintenanceStatusEnum.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/ThirdMaintenanceStatusEnum.java
index 52cb9ba..a14be14 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/ThirdMaintenanceStatusEnum.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/ThirdMaintenanceStatusEnum.java
@@ -1,9 +1,14 @@
 package org.jeecg.modules.eam.constant;
 
+import lombok.Getter;
+
+@Getter
 public enum ThirdMaintenanceStatusEnum {
     WAIT_MAINTENANCE, //寰呬繚鍏�
     UNDER_MAINTENANCE, //淇濆吇涓�
     WAIT_CHECK, //寰呮鏌�
+    UNDER_FIRST_ACCEPTANCE, //绗竴娆¢獙鏀朵腑
+    UNDER_SECOND_ACCEPTANCE, //绗簩娆¢獙鏀朵腑
     OPERATOR_SIGNATURE, // 鎿嶄綔浜虹瀛�
     REPAIRMAN_SIGNATURE, // 缁翠慨浜虹瀛�
     REPAIR_MANAGER_SIGNATURE, //缁翠慨瀹や富浠荤瀛�
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamThirdMaintenanceOrder.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamThirdMaintenanceOrder.java
index 4d1e8db..2b52df0 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamThirdMaintenanceOrder.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamThirdMaintenanceOrder.java
@@ -1,6 +1,5 @@
 package org.jeecg.modules.eam.entity;
 
-import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -98,7 +97,7 @@
      */
     @Excel(name = "缁翠慨浜�", width = 15)
     @ApiModelProperty(value = "缁翠慨浜�")
-    @Dict(dicCode = "sys_user, realname, username")
+    @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname")
     private String repairman;
     /**
      * 淇濆吇鐘舵��
@@ -159,7 +158,6 @@
      */
     @Excel(name = "鍗忓姪鎿嶄綔浜�", width = 15)
     @ApiModelProperty(value = "鍗忓姪鎿嶄綔浜�")
-    @Dict(dicCode = "sys_user, realname, username")
     private String assistantOperator;
     /**
      * 鎿嶄綔浜虹瀛楁椂闂�
@@ -181,7 +179,6 @@
      */
     @Excel(name = "鍗忓姪缁翠慨浜�", width = 15)
     @ApiModelProperty(value = "鍗忓姪缁翠慨浜�")
-    @Dict(dicCode = "sys_user, realname, username")
     private String assistantRepairman;
     /**
      * 缁翠慨浜虹瀛楁椂闂�
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamThirdMaintenanceRequest.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamThirdMaintenanceRequest.java
index d2df4bf..e0a2d9e 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamThirdMaintenanceRequest.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamThirdMaintenanceRequest.java
@@ -6,9 +6,10 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import org.jeecg.common.api.vo.FileUploadResult;
+import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecg.modules.eam.entity.EamThirdMaintenanceOrderDetail;
 import org.jeecg.modules.flowable.domain.vo.FlowTaskVo;
+import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
@@ -18,55 +19,120 @@
 @Data
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
-@ApiModel(value="涓変繚瀵硅薄", description="涓変繚")
+@ApiModel(value = "涓変繚瀵硅薄", description = "涓変繚")
 public class EamThirdMaintenanceRequest extends FlowTaskVo implements Serializable {
 
-    /**涓婚敭*/
+    private static final long serialVersionUID = -385597100123768119L;
+
+    /**
+     * 涓婚敭
+     */
     @ApiModelProperty(value = "涓婚敭")
     private String id;
-    /**宸ュ崟鍙�*/
+    /**
+     * 宸ュ崟鍙�
+     */
     @ApiModelProperty(value = "宸ュ崟鍙�")
     private String orderNum;
-    /**璁惧ID*/
+    /**
+     * 璁惧ID
+     */
     @ApiModelProperty(value = "璁惧ID")
     private String equipmentId;
-    /**鏍囧噯ID*/
+    /**
+     * 鏍囧噯ID
+     */
     @ApiModelProperty(value = "鏍囧噯ID")
     private String standardId;
-    /**淇濆吇鏃ユ湡*/
+    /**
+     * 淇濆吇鏃ユ湡
+     */
     @ApiModelProperty(value = "淇濆吇鏃ユ湡")
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date maintenanceDate;
-    /**淇濆吇浜�*/
-    @ApiModelProperty(value = "淇濆吇浜�")
-    private String operator;
-    /**淇濆吇鍥剧墖*/
-    @ApiModelProperty(value = "淇濆吇鍥剧墖")
-    private String imageFiles;
-    /**淇濆吇鍥剧墖*/
-    @ApiModelProperty(value = "淇濆吇鍥剧墖")
-    private List<FileUploadResult> imageFilesResult;
-    /**澶囨敞*/
+    /**
+     * 缁翠慨浜�
+     */
+    @ApiModelProperty(value = "缁翠慨浜�")
+    @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname")
+    private String repairman;
+    /**
+     * 淇濆吇鐘舵��
+     */
+    @ApiModelProperty(value = "淇濆吇鐘舵��;寰呬繚鍏汇�佷繚鍏讳腑銆佸緟妫�鏌ャ�佹搷浣滀汉绛惧瓧銆佺淮淇汉绛惧瓧銆佺淮淇涓讳换绛惧瓧銆佽澶囨鏌ヤ汉绛惧瓧銆佸凡瀹屾垚銆佸凡閿佸畾銆佸彉鏇翠腑銆佸凡鍙栨秷")
+    @Dict(dicCode = "third_maintenance_status")
+    private String maintenanceStatus;
+    /**
+     * 澶囨敞
+     */
     @ApiModelProperty(value = "澶囨敞")
     private String remark;
-    /**鍒涘缓鏂瑰紡*/
+    /**
+     * 鍒涘缓鏂瑰紡
+     */
     @ApiModelProperty(value = "鍒涘缓鏂瑰紡")
+    @Dict(dicCode = "order_creation_method")
     private String creationMethod;
-    /**鍒楄〃 淇濆吇椤规槑缁�*/
+    /**
+     * 璁惧鍔熻兘鏄惁榻愬;鏄惁
+     */
+    @ApiModelProperty(value = "璁惧鍔熻兘鏄惁榻愬;鏄惁")
+    @Dict(dicCode = "equipment_function_yn")
+    private String fullyFunctional;
+    /**
+     * 璁惧鍔熻兘鏄惁榻愬;鏄惁
+     */
+    @ApiModelProperty(value = "璁惧鍔熻兘鏄惁姝e父杩愯浆;鏄惁")
+    @Dict(dicCode = "equipment_function_yn")
+    private String runningNormally;
+    /**
+     * 闂鎻忚堪
+     */
+    @ApiModelProperty(value = "闂鎻忚堪")
+    private String problemDescription;
+    /**
+     * 鍒楄〃 淇濆吇椤规槑缁�
+     */
     @ApiModelProperty(value = "鍒楄〃 淇濆吇椤规槑缁�")
     private List<EamThirdMaintenanceOrderDetail> tableDetailList;
-    /**鍒犻櫎 淇濆吇椤规槑缁�*/
+    /**
+     * 鍒犻櫎 淇濆吇椤规槑缁�
+     */
     @ApiModelProperty(value = "鍒犻櫎 淇濆吇椤规槑缁�")
     private List<EamThirdMaintenanceOrderDetail> removeDetailList;
 
-    //纭鎿嶄綔
-    /**纭鎰忚*/
-    @ApiModelProperty(value = "纭鎰忚")
-    private String confirmComment;
-    @ApiModelProperty(value = "纭绫诲瀷")
-    private String confirmDealType;
-    /**棰嗗纭鎰忚*/
-    @ApiModelProperty(value = "棰嗗纭鎰忚")
-    private String leaderConfirmComment;
+    /**
+     * 鎿嶄綔浜虹瀛�
+     */
+    @ApiModelProperty(value = "鎿嶄綔浜虹瀛�")
+    private String operatorSignatureResult;
+    /**
+     * 鍗忓姪鎿嶄綔浜�
+     */
+    @ApiModelProperty(value = "鍗忓姪鎿嶄綔浜�")
+    private String assistantOperator;
+
+    /**
+     * 缁翠慨浜虹瀛�
+     */
+    @ApiModelProperty(value = "缁翠慨浜虹瀛�")
+    private String repairmanSignatureResult;
+    /**
+     * 鍗忓姪缁翠慨浜�
+     */
+    @Excel(name = "鍗忓姪缁翠慨浜�", width = 15)
+    @ApiModelProperty(value = "鍗忓姪缁翠慨浜�")
+    private String assistantRepairman;
+    /**
+     * 缁翠慨瀹や富浠荤瀛�
+     */
+    @ApiModelProperty(value = "缁翠慨瀹や富浠荤瀛�")
+    private String repairManagerSignatureResult;
+    /**
+     * 璁惧妫�鏌ヤ汉绛惧瓧
+     */
+    @ApiModelProperty(value = "璁惧妫�鏌ヤ汉绛惧瓧")
+    private String inspectorSignatureResult;
+
 }
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 4d4acbe..d114fe5 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
@@ -18,6 +18,7 @@
 import org.jeecg.common.constant.DataBaseConstant;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.StrUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog;
 import org.jeecg.modules.eam.constant.*;
@@ -40,6 +41,7 @@
 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;
@@ -76,8 +78,6 @@
     @Autowired
     private IEamEquipmentService eamEquipmentService;
     @Autowired
-    private IEamReportRepairService eamReportRepairService;
-    @Autowired
     private IEamEquipmentExtendService eamEquipmentExtendService;
 
     @Resource
@@ -87,6 +87,8 @@
 
     @Resource
     private IEamBaseHFCodeService eamBaseHFCodeService;
+    @Resource
+    private IEamThirdMaintenanceOrderDetailService eamThirdMaintenanceOrderDetailService;
 
     @Override
     public IPage<EamThirdMaintenanceOrder> queryPageList(Page<EamThirdMaintenanceOrder> page, EamThirdMaintenanceQuery query) {
@@ -108,7 +110,7 @@
                 Set<String> factoryIds = baseFactoryUserList.stream().map(BaseFactoryUser::getFactoryId).collect(Collectors.toSet());
                 Set<String> factoryCode = baseFactoryService.listByIds(factoryIds).stream().map(BaseFactory::getOrgCode).collect(Collectors.toSet());
                 queryWrapper.in("e.factory_org_code", factoryCode);
-            }else {
+            } else {
                 return page;
             }
         }
@@ -254,24 +256,19 @@
         if (equipment == null) {
             throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�");
         }
-//        if (StringUtils.isBlank(equipment.getEquipmentManager())) {
-//            throw new JeecgBootException("璁惧鏈垎閰嶈澶囩鐞嗗憳锛屾棤娉曡繘鍏ヤ笅绾у鎵癸紒");
-//        }
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        if (sysUser == null || !BusinessCodeConst.PCR0001.equals(sysUser.getPost())) {
-            throw new JeecgBootException("涓嶆槸鎿嶄綔宸ワ紝鏃犳硶棰嗗彇姝ゅ伐鍗曪紒");
+        if (sysUser == null || !BusinessCodeConst.PCR0002.equals(sysUser.getPost())) {
+            throw new JeecgBootException("涓嶆槸缁翠慨宸ワ紝鏃犳硶棰嗗彇姝ゅ伐鍗曪紒");
         }
         entity.setRepairman(sysUser.getUsername());
-        entity.setMaintenanceStatus(ThirdMaintenanceStatusEnum.UNDER_MAINTENANCE.name());
+        entity.setMaintenanceStatus(ThirdMaintenanceStatusEnum.WAIT_CHECK.name());
         entity.setActualStartTime(new Date());
         eamThirdMaintenanceOrderMapper.updateById(entity);
 
         //鍚姩娴佺▼
-        flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";瀹夎浣嶇疆" + equipment.getInstallationPosition(),
+        flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + (equipment.getInstallationPosition() == null ? "" : ";瀹夎浣嶇疆: " + 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);
         variables.put("dataId", entity.getId());
         if (StrUtil.isEmpty(entity.getRemark())) {
             variables.put("organization", "鏂板涓変繚宸ュ崟榛樿鍚姩娴佺▼");
@@ -281,9 +278,10 @@
             variables.put("comment", entity.getRemark());
         }
         variables.put("proofreading", true);
-        //骞惰浠诲姟浼氱
-        variables.put("maintenance_execution", Collections.singletonList(sysUser.getUsername()));
-//        variables.put("precision_check", Collections.singletonList(equipment.getEquipmentManager()));
+        // 璁剧疆涓嬩竴姝ュ鐞嗕汉
+        List<String> usernames = new ArrayList<>();
+        usernames.add(entity.getRepairman());
+        variables.put("NextAssignee", usernames);
         Result result = flowDefinitionService.startProcessInstanceByKey("third_maintenance_process", variables);
         if (result != null) {
             //鏇存柊璁惧淇濆吇鐘舵��
@@ -296,144 +294,290 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     @EquipmentHistoryLog(operationTag = EquipmentOperationTagEnum.THIRD_MAINTENANCE, businessTable = "eam_third_maintenance_order")
-    public EamThirdMaintenanceOrder approval(EamThirdMaintenanceRequest request) {
-        EamThirdMaintenanceOrder entity = eamThirdMaintenanceOrderMapper.selectById(request.getId());
-        if (entity == null) {
-            throw new JeecgBootException("瀹℃壒鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�");
+    public EamThirdMaintenanceOrder approval(EamThirdMaintenanceRequest eamThirdMaintenanceRequest) {
+        EamThirdMaintenanceOrder eamThirdMaintenanceOrder = eamThirdMaintenanceOrderMapper.selectById(eamThirdMaintenanceRequest.getId());
+        if (eamThirdMaintenanceOrder == null) {
+            throw new JeecgBootException("寰呭鐞嗙殑鏁版嵁宸插垹闄わ紝璇峰埛鏂伴噸璇曪紒");
         }
-//        // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛
-//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-//        if (user == null || StrUtil.isBlank(user.getId())) {
-//            throw new JeecgBootException("鏈幏鍙栧埌鐧诲綍鐢ㄦ埛锛岃閲嶆柊鐧诲綍鍚庡啀璇曪紒");
-//        }
-//        request.setAssignee(user.getUsername());
-//        // 鑾峰彇娴佺▼涓氬姟璁板綍
-//        FlowMyBusiness flowMyBusiness = flowMyBusinessService.getFlowMyBusiness(request.getInstanceId(), request.getTaskId());
-//        if (flowMyBusiness == null) {
-//            throw new JeecgBootException("娴佺▼瀹炰緥涓嶅瓨鍦紝璇峰埛鏂板悗閲嶈瘯锛�");
-//        }
-//
-//        boolean userAuthorized = isUserAuthorized(flowMyBusiness, user);
-//        if (!userAuthorized) {
-//            throw new JeecgBootException("鐢ㄦ埛鏃犳潈鎿嶄綔姝や换鍔★紝璇峰埛鏂板悗閲嶈瘯锛�");
-//        }
-//        // 璁ら浠诲姟
-//        if (!claimTask(flowMyBusiness.getTaskId(), user)) {
-//            throw new JeecgBootException("浠诲姟涓嶅瓨鍦ㄣ�佸凡瀹屾垚鎴栧凡琚粬浜鸿棰嗭紒");
-//        }
-//
-//        EamEquipment equipment = eamEquipmentService.getById(entity.getEquipmentId());
-//        if (equipment == null) {
-//            throw new JeecgBootException("璁惧涓嶅瓨鍦紝璇锋鏌ワ紒");
-//        }
-//
-//        ThirdMaintenanceStatusEnum status = ThirdMaintenanceStatusEnum.getInstance(entity.getMaintenanceStatus());
-//        if (status == null) {
-//            return null;
-//        }
-//        //娴佺▼鍙橀噺
-//        Map<String, Object> values = new HashMap<>();
-//        List<String> userApprovalList;
-//        List<UserSelector> userSelectors;
-//        switch (status) {
-//            case UNDER_MAINTENANCE:
-//                boolean parallelCompletion = flowTaskService.checkParallelCompletion(flowMyBusiness.getTaskId());
-//                //鎵ц瀹屾垚
-//                userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), null, BusinessCodeConst.PCR0006);
-//                if (CollectionUtil.isEmpty(userSelectors)) {
-//                    throw new JeecgBootException("璁惧鏈垎閰嶇粰杞﹂棿鐝粍闀匡紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
-//                }
-//                userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
-//                values.put("dataId", entity.getId());
-//                values.put("organization", "涓変繚鎵ц缁撴潫");
-//                values.put("comment", "涓変繚鎵ц缁撴潫");
-//                if (parallelCompletion) {
-//                    values.put("NextAssignee", userApprovalList);
-//                }
-//                request.setComment("涓変繚鎵ц缁撴潫");
-//                //璁剧疆entity
-//                if (parallelCompletion) {
-//                    entity.setMaintenanceStatus(ThirdMaintenanceStatusEnum.WAIT_CONFIRM.name());
-//                    entity.setActualEndTime(new Date());
-//                }
-//                if ("maintenance_execution".equals(flowMyBusiness.getTaskNameId())) {
-//                    //鎵ц淇濆吇
-//                    //澶勭悊闄勪欢
-//                    if (CollectionUtil.isNotEmpty(request.getImageFilesResult())) {
-//                        List<FileUploadResult> fileUploadResultList = request.getImageFilesResult();
-//                        ObjectMapper mapper = new ObjectMapper();
-//                        try {
-//                            String referenceFile = mapper.writeValueAsString(fileUploadResultList);
-//                            entity.setImageFiles(referenceFile);
-//                        } catch (JsonProcessingException e) {
-//                            log.error("JSON杞崲澶辫触锛�" + e.getMessage(), e);
-//                        }
-//                    }
-//                    //澶勭悊璇︽儏
-//                    if (CollectionUtil.isNotEmpty(request.getTableDetailList())) {
-//                        thirdMaintenanceOrderDetailService.updateBatchById(request.getTableDetailList());
-//                    }
-//                } else if ("precision_check".equals(flowMyBusiness.getTaskNameId())) {
-//                    entity.setPrecisionChecker(user.getUsername());
-//                    entity.setPrecisionCheckTime(new Date());
-//                    //澶勭悊绮惧害妫�楠�
-//                    if (CollectionUtil.isNotEmpty(request.getPrecisionDetailList())) {
-//                        precisionCheckDetailService.updateBatchById(request.getPrecisionDetailList());
-//                    }
-//                }
-//                if (parallelCompletion) {
-//                    //鏇存柊璁惧淇濆吇鐘舵��
-//                    eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.THIRD_MAINTENANCE_WAIT_CONFIRM.name());
-//                }
-//                break;
-//            case WAIT_CONFIRM:
-//                userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(),null, BusinessCodeConst.PCR0003);
-//                if (CollectionUtil.isEmpty(userSelectors)) {
-//                    throw new JeecgBootException("璁惧鏈垎閰嶇粰杞﹂棿鐝粍闀匡紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
-//                }
-//                //鐝粍闀跨‘璁�
-//                userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
-//                values.put("dataId", entity.getId());
-//                values.put("organization", request.getConfirmComment());
-//                values.put("comment", request.getConfirmComment());
-//                values.put("NextAssignee", userApprovalList);
-//                values.put("confirmation", request.getConfirmDealType());
-//                request.setComment(request.getConfirmComment());
-//                //璁剧疆entity
-//                entity.setMaintenanceStatus(ThirdMaintenanceStatusEnum.WAIT_LEADER_CONFIRM.name());
-//                entity.setConfirmUser(user.getUsername());
-//                entity.setConfirmComment(request.getConfirmComment());
-//                entity.setConfirmTime(new Date());
-//                //澶勭悊鎶ヤ慨
-//                List<EamThirdMaintenanceOrderDetail> collect = request.getTableDetailList().stream().filter((detail) -> CommonConstant.DEFAULT_1.equals(detail.getReportFlag())).collect(Collectors.toList());
-//                if (CollectionUtil.isNotEmpty(collect)) {
-//                    eamReportRepairService.reportRepairFromThirdMaintenance(equipment.getId(), entity.getOperator(), collect);
-//                }
-//                break;
-//            case WAIT_LEADER_CONFIRM:
-//                values.put("dataId", entity.getId());
-//                values.put("organization", request.getLeaderConfirmComment());
-//                values.put("comment", request.getLeaderConfirmComment());
-//                request.setComment(request.getLeaderConfirmComment());
-//                //璁剧疆entity
-//                entity.setMaintenanceStatus(ThirdMaintenanceStatusEnum.COMPLETE.name());
-//                entity.setConfirmLeader(user.getUsername());
-//                entity.setLeaderConfirmComment(request.getLeaderConfirmComment());
-//                entity.setLeaderConfirmTime(new Date());
-//                //鏇存柊璁惧淇濆吇鐘舵��
-//                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.NORMAL.name());
-//                break;
-//        }
-//        request.setValues(values);
-//
-//        // 瀹屾垚娴佺▼浠诲姟
-//        Result result = flowTaskService.complete(request);
-//        if (!result.isSuccess()) {
-//            throw new JeecgBootException("瀹℃壒澶辫触锛岃鍒锋柊鏌ョ湅锛�");
-//        }
-//        //淇濆瓨宸ュ崟
-//        eamThirdMaintenanceOrderMapper.updateById(entity);
-        return entity;
+        // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        if (user == null || StrUtil.isBlank(user.getId())) {
+            throw new JeecgBootException("鏈幏鍙栧埌鐧诲綍鐢ㄦ埛锛岃閲嶆柊鐧诲綍鍚庡啀璇曪紒");
+        }
+        eamThirdMaintenanceRequest.setAssignee(user.getUsername());
+        // 鑾峰彇娴佺▼涓氬姟璁板綍
+        FlowMyBusiness flowMyBusiness = flowMyBusinessService.getFlowMyBusiness(eamThirdMaintenanceRequest.getInstanceId(), eamThirdMaintenanceRequest.getTaskId());
+        if (flowMyBusiness == null) {
+            throw new JeecgBootException("娴佺▼瀹炰緥涓嶅瓨鍦紝璇峰埛鏂板悗閲嶈瘯锛�");
+        }
+
+        if (!isUserAuthorized(flowMyBusiness, user)) {
+            throw new JeecgBootException("鐢ㄦ埛鏃犳潈鎿嶄綔姝や换鍔★紝璇峰埛鏂板悗閲嶈瘯锛�");
+        }
+        // 璁ら浠诲姟
+        if (!claimTask(flowMyBusiness.getTaskId(), user)) {
+            throw new JeecgBootException("浠诲姟涓嶅瓨鍦ㄣ�佸凡瀹屾垚鎴栧凡琚粬浜鸿棰嗭紒");
+        }
+
+        EamEquipment equipment = eamEquipmentService.getById(eamThirdMaintenanceOrder.getEquipmentId());
+        if (equipment == null) {
+            throw new JeecgBootException("璁惧涓嶅瓨鍦紝璇锋鏌ワ紒");
+        }
+
+        // 璁剧疆娴佺▼鍙橀噺
+        setupProcessVariables(eamThirdMaintenanceRequest, eamThirdMaintenanceOrder, user, equipment);
+
+        // 瀹屾垚娴佺▼浠诲姟
+        Result result = flowTaskService.complete(eamThirdMaintenanceRequest);
+
+        // 鏍规嵁浠诲姟瀹屾垚缁撴灉鏇存柊宸ュ崟鐘舵��
+        updateOrderStatus(result, eamThirdMaintenanceRequest, eamThirdMaintenanceOrder, user);
+
+        //鏇存柊宸ュ崟淇℃伅
+        eamThirdMaintenanceOrderMapper.updateById(eamThirdMaintenanceOrder);
+        return eamThirdMaintenanceOrder;
+    }
+
+    /**
+     * 璁剧疆娴佺▼鍙橀噺
+     */
+    private void setupProcessVariables(EamThirdMaintenanceRequest request, EamThirdMaintenanceOrder order, LoginUser user, EamEquipment equipment) {
+        //娴佺▼鍙橀噺
+        Map<String, Object> values = new HashMap<>();
+        List<String> userApprovalList;
+        List<UserSelector> userSelectors;
+        ThirdMaintenanceStatusEnum status = ThirdMaintenanceStatusEnum.getInstance(order.getMaintenanceStatus());
+        switch (status) {
+            case WAIT_CHECK:
+                // 鎶�鏈姸鎬侀壌瀹氱粨鏉�
+                values.put("dataId", order.getId());
+                values.put("organization", "鎶�鏈姸鎬侀壌瀹氱粨鏉�");
+                values.put("comment", "鎶�鏈姸鎬侀壌瀹氱粨鏉�");
+                if (CommonConstant.YN_Y.equals(request.getFullyFunctional()) && CommonConstant.YN_Y.equals(request.getRunningNormally())) {
+                    values.put("confirmation", "1");
+                    // 鑾峰彇涓嬩竴姝ユ墽琛屼汉
+                    userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002);
+                    if (CollectionUtil.isEmpty(userSelectors)) {
+                        throw new JeecgBootException("璁惧鏈垎閰嶇粰缁翠慨宸ワ紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
+                    }
+                    userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
+                    values.put("NextAssignee", userApprovalList);
+                    request.setComment("妫�鏌ヤ汉妫�鏌ョ粨鏉�");
+                    //鏇存柊璁惧淇濆吇鐘舵��
+                    eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_THIRD_MAINTENANCE.name());
+                } else {
+                    values.put("confirmation", "2");
+                }
+                break;
+            case UNDER_MAINTENANCE:
+                // 淇濆吇缁撴潫
+                values.put("dataId", order.getId());
+                values.put("organization", "淇濆吇浜轰繚鍏荤粨鏉�");
+                values.put("comment", "淇濆吇浜轰繚鍏荤粨鏉�");
+                // 鑾峰彇涓嬩竴姝ユ墽琛屼汉
+                userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002);
+                if (CollectionUtil.isEmpty(userSelectors)) {
+                    throw new JeecgBootException("璁惧鏈垎閰嶇粰缁翠慨宸ワ紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
+                }
+                userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
+                values.put("NextAssignee", userApprovalList);
+                request.setComment("淇濆吇浜轰繚鍏荤粨鏉�");
+                //鏇存柊璁惧淇濆吇鐘舵��
+                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.THIRD_MAINTENANCE_WAIT_CONFIRM.name());
+                break;
+            case UNDER_FIRST_ACCEPTANCE:
+                // 绗竴娆¢獙鏀剁粨鏉�
+                values.put("dataId", order.getId());
+                values.put("organization", "绗竴娆¢獙鏀剁粨鏉�");
+                values.put("comment", "绗竴娆¢獙鏀剁粨鏉�");
+                boolean flag = false;
+                if (!CollectionUtil.isEmpty(request.getTableDetailList())) {
+                    for (EamThirdMaintenanceOrderDetail eamThirdMaintenanceOrderDetail : request.getTableDetailList()) {
+                        if ("2".equals(eamThirdMaintenanceOrderDetail.getFirstInspectResult())) {
+                            flag = true;
+                            break;
+                        }
+                    }
+                }
+                if (flag) {
+                    // 寮�鍚浜屾楠屾敹
+                    values.put("confirmation", "2");
+                    List<String> usernames = new ArrayList<>();
+                    usernames.add(user.getUsername());
+                    values.put("NextAssignee", usernames);
+                } else {
+                    // 娴佺▼娴佽浆鍒版搷浣滀汉绛惧瓧
+                    values.put("confirmation", "1");
+                    // 鑾峰彇涓嬩竴姝ユ墽琛屼汉
+                    userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0001);
+                    if (CollectionUtil.isEmpty(userSelectors)) {
+                        throw new JeecgBootException("璁惧鏈垎閰嶇粰鎿嶄綔宸ワ紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
+                    }
+                    userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
+                    values.put("NextAssignee", userApprovalList);
+                }
+                request.setComment("绗竴娆¢獙鏀剁粨鏉�");
+                break;
+            case UNDER_SECOND_ACCEPTANCE:
+                // 绗簩娆¢獙鏀剁粨鏉�
+                values.put("dataId", order.getId());
+                values.put("organization", "绗簩娆¢獙鏀剁粨鏉�");
+                values.put("comment", "绗簩娆¢獙鏀剁粨鏉�");
+                // 鑾峰彇涓嬩竴姝ユ墽琛屼汉
+                userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0001);
+                if (CollectionUtil.isEmpty(userSelectors)) {
+                    throw new JeecgBootException("璁惧鏈垎閰嶇粰鎿嶄綔宸ワ紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
+                }
+                userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
+                values.put("NextAssignee", userApprovalList);
+                request.setComment("绗簩娆¢獙鏀剁粨鏉�");
+                break;
+            case OPERATOR_SIGNATURE:
+                // 鎿嶄綔浜虹瀛楃粨鏉�
+                values.put("dataId", order.getId());
+                values.put("organization", "鎿嶄綔浜虹瀛楃粨鏉�");
+                values.put("comment", "鎿嶄綔浜虹瀛楃粨鏉�");
+                // 鑾峰彇涓嬩竴姝ユ墽琛屼汉
+                userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002);
+                if (CollectionUtil.isEmpty(userSelectors)) {
+                    throw new JeecgBootException("璁惧鏈垎閰嶇粰缁翠慨宸ワ紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
+                }
+                userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
+                values.put("NextAssignee", userApprovalList);
+                request.setComment("鎿嶄綔浜虹瀛楃粨鏉�");
+                break;
+            case REPAIRMAN_SIGNATURE:
+                // 缁翠慨浜虹瀛楃粨鏉�
+                values.put("dataId", order.getId());
+                values.put("organization", "缁翠慨浜虹瀛楃粨鏉�");
+                values.put("comment", "缁翠慨浜虹瀛楃粨鏉�");
+                // 鑾峰彇涓嬩竴姝ユ墽琛屼汉
+                userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0008);
+                if (CollectionUtil.isEmpty(userSelectors)) {
+                    throw new JeecgBootException("璁惧鏈垎閰嶇粰缁翠慨瀹や富浠伙紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
+                }
+                userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
+                values.put("NextAssignee", userApprovalList);
+                request.setComment("缁翠慨浜虹瀛楃粨鏉�");
+                break;
+            case REPAIR_MANAGER_SIGNATURE:
+                // 缁翠慨瀹や富浠荤瀛楃粨鏉�
+                values.put("dataId", order.getId());
+                values.put("organization", "缁翠慨瀹や富浠荤瀛楃粨鏉�");
+                values.put("comment", "缁翠慨瀹や富浠荤瀛楃粨鏉�");
+                // 鑾峰彇涓嬩竴姝ユ墽琛屼汉
+                userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0003);
+                if (CollectionUtil.isEmpty(userSelectors)) {
+                    throw new JeecgBootException("璁惧鏈垎閰嶇粰璁惧妫�楠屽憳锛屾棤娉曡繘鍏ヤ笅绾у鎵癸紒");
+                }
+                userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
+                values.put("NextAssignee", userApprovalList);
+                request.setComment("缁翠慨瀹や富浠荤瀛楃粨鏉�");
+                break;
+            case INSPECTOR_SIGNATURE:
+                // 璁惧妫�鏌ヤ汉绛惧瓧缁撴潫
+                values.put("dataId", order.getId());
+                values.put("organization", "缁翠慨瀹や富浠荤瀛楃粨鏉�");
+                values.put("comment", "缁翠慨瀹や富浠荤瀛楃粨鏉�");
+                request.setComment("缁翠慨瀹や富浠荤瀛楃粨鏉�");
+                //鏇存柊璁惧淇濆吇鐘舵��
+                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.NORMAL.name());
+                break;
+        }
+        request.setValues(values);
+    }
+
+    /**
+     * 鏇存柊宸ュ崟鐘舵��
+     */
+    private void updateOrderStatus(Result result, EamThirdMaintenanceRequest request, EamThirdMaintenanceOrder order, LoginUser user) {
+        if (result.isSuccess()) {
+            ThirdMaintenanceStatusEnum status = ThirdMaintenanceStatusEnum.getInstance(order.getMaintenanceStatus());
+            switch (status) {
+                case WAIT_CHECK:
+                    // 鎶�鏈姸鎬侀壌瀹氱粨鏉�
+                    order.setInspector(user.getUsername());
+                    order.setFullyFunctional(request.getFullyFunctional());
+                    order.setRunningNormally(request.getRunningNormally());
+                    order.setInspectTime(new Date());
+                    if (CommonConstant.YN_Y.equals(request.getFullyFunctional()) && CommonConstant.YN_Y.equals(request.getRunningNormally())) {
+                        // 閴村畾閫氳繃
+                        order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.UNDER_MAINTENANCE.name());
+                    } else {
+                        // 閴村畾鏈�氳繃
+                        order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.CANCEL.name());
+                        order.setProblemDescription(request.getProblemDescription());
+                        order.setActualEndTime(new Date());
+                    }
+                    break;
+                case UNDER_MAINTENANCE:
+                    // 淇濆吇缁撴潫
+                    order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.UNDER_FIRST_ACCEPTANCE.name());
+                    order.setRepairman(user.getUsername());
+                    order.setActualEndTime(new Date());
+                    // 涓変繚鏄庣粏澶勭悊
+                    eamThirdMaintenanceOrderDetailService.remove(new LambdaQueryWrapper<EamThirdMaintenanceOrderDetail>().eq(EamThirdMaintenanceOrderDetail::getOrderId, order.getId()));
+                    eamThirdMaintenanceOrderDetailService.saveBatch(request.getTableDetailList());
+                    break;
+                case UNDER_FIRST_ACCEPTANCE:
+                    // 绗竴娆¢獙鏀剁粨鏉�
+                    boolean flag = false;
+                    if (!CollectionUtil.isEmpty(request.getTableDetailList())) {
+                        for (EamThirdMaintenanceOrderDetail eamThirdMaintenanceOrderDetail : request.getTableDetailList()) {
+                            if ("2".equals(eamThirdMaintenanceOrderDetail.getFirstInspectResult())) {
+                                flag = true;
+                                break;
+                            }
+                        }
+                    }
+                    if (flag) {
+                        order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.UNDER_SECOND_ACCEPTANCE.name());
+                    } else {
+                        order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.OPERATOR_SIGNATURE.name());
+                    }
+                    // 涓変繚鏄庣粏澶勭悊
+                    eamThirdMaintenanceOrderDetailService.remove(new LambdaQueryWrapper<EamThirdMaintenanceOrderDetail>().eq(EamThirdMaintenanceOrderDetail::getOrderId, order.getId()));
+                    eamThirdMaintenanceOrderDetailService.saveBatch(request.getTableDetailList());
+                    break;
+                case UNDER_SECOND_ACCEPTANCE:
+                    // 绗簩娆¢獙鏀剁粨鏉�
+                    order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.OPERATOR_SIGNATURE.name());
+                    // 涓変繚鏄庣粏澶勭悊
+                    eamThirdMaintenanceOrderDetailService.remove(new LambdaQueryWrapper<EamThirdMaintenanceOrderDetail>().eq(EamThirdMaintenanceOrderDetail::getOrderId, order.getId()));
+                    eamThirdMaintenanceOrderDetailService.saveBatch(request.getTableDetailList());
+                    break;
+                case OPERATOR_SIGNATURE:
+                    // 鎿嶄綔浜虹瀛楃粨鏉�
+                    if (!StrUtils.isEmpty(request.getAssistantOperator())) {
+                        order.setAssistantOperator(request.getAssistantOperator());
+                    }
+                    order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.REPAIRMAN_SIGNATURE.name());
+                    order.setOperatorSignature(user.getUsername());
+                    order.setOperatorSignatureTime(new Date());
+                    break;
+                case REPAIRMAN_SIGNATURE:
+                    // 缁翠慨浜虹瀛楃粨鏉�
+                    if (!StrUtils.isEmpty(request.getAssistantRepairman())) {
+                        order.setAssistantRepairman(request.getAssistantRepairman());
+                    }
+                    order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.REPAIR_MANAGER_SIGNATURE.name());
+                    order.setRepairmanSignature(user.getUsername());
+                    order.setRepairmanSignatureTime(new Date());
+                    break;
+                case REPAIR_MANAGER_SIGNATURE:
+                    // 缁翠慨瀹や富浠荤瀛楃粨鏉�
+                    order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.INSPECTOR_SIGNATURE.name());
+                    order.setRepairManagerSignature(user.getUsername());
+                    order.setRepairManagerSignatureTime(new Date());
+                    break;
+                case INSPECTOR_SIGNATURE:
+                    // 璁惧妫�鏌ヤ汉绛惧瓧缁撴潫
+                    order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.COMPLETE.name());
+                    order.setInspectorSignature(user.getUsername());
+                    order.setInspectorSignatureTime(new Date());
+                    break;
+            }
+        }
     }
 
     private boolean isUserAuthorized(FlowMyBusiness flowMyBusiness, LoginUser user) {

--
Gitblit v1.9.3