From 1ee0b1a27899d03f946a86c70c4df4c6388fb160 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期二, 12 八月 2025 18:16:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/org/jeecg/modules/mes/job/FeishuUserService.java                       |    7 +++++--
 src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java               |    4 ++--
 src/main/java/org/jeecg/modules/mes/controller/MesProductionWorkOrderController.java |   23 +++++++++++++++++++----
 src/main/java/org/jeecg/modules/mes/enums/ProductionWorkOrderStatus.java             |    8 ++++++--
 src/main/resources/application-dev.yml                                               |    6 ++++++
 src/main/resources/application-prod.yml                                              |    8 +++++++-
 6 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/jeecg/modules/mes/controller/MesProductionWorkOrderController.java b/src/main/java/org/jeecg/modules/mes/controller/MesProductionWorkOrderController.java
index 3f2cbac..b0321ff 100644
--- a/src/main/java/org/jeecg/modules/mes/controller/MesProductionWorkOrderController.java
+++ b/src/main/java/org/jeecg/modules/mes/controller/MesProductionWorkOrderController.java
@@ -167,8 +167,8 @@
     @PostMapping(value = "/republish")
     public Result<String> republish(@RequestBody MesProductionWorkOrderRepublishRequest request) {
         MesProductionWorkOrder workOrder = mesProductionWorkOrderService.getById(request.getId());
-        //todo 鍒ゆ柇鐝鏄惁缁撴潫鐨勯�昏緫
-        if (!ProductionWorkOrderStatus.PUBLISHED.name().equals(workOrder.getWorkOrderStatus())) {
+        if (ProductionWorkOrderStatus.NEW.name().equals(workOrder.getWorkOrderStatus())
+                || ProductionWorkOrderStatus.CLOSED.name().equals(workOrder.getWorkOrderStatus())) {
             return Result.error("褰撳墠宸ュ崟鐘舵�佷笉鏀寔閲嶅彂甯冿紒");
         }
         MesProductionWorkOrder republish = new MesProductionWorkOrder()
@@ -176,12 +176,27 @@
                 .setPlanQuantity(request.getPlanQuantity())
                 .setRepublisher(Objects.requireNonNull(getCurrentUser()).getUsername())
                 .setRepublishTime(new Date())
-                .setRepublishReason(request.getRepublishReason())
-                .setWorkOrderStatus(ProductionWorkOrderStatus.REPUBLISHED.name());
+                .setRepublishReason(request.getRepublishReason());
         mesProductionWorkOrderService.updateById(republish);
         return Result.ok("閲嶅彂甯冩垚鍔燂紒");
     }
 
+    @AutoLog(value = "鎺掍骇宸ュ崟-鎵ц鎺掍骇宸ュ崟璁″垝")
+    @ApiOperation(value = "鎺掍骇宸ュ崟-鎵ц鎺掍骇宸ュ崟璁″垝", notes = "鎺掍骇宸ュ崟-鎵ц鎺掍骇宸ュ崟璁″垝")
+    @GetMapping(value = "/execute")
+    public Result<?> execute(@RequestParam("id") String id) {
+        MesProductionWorkOrder workOrder = mesProductionWorkOrderService.getById(id);
+        if (!ProductionWorkOrderStatus.PUBLISHED.name().equals(workOrder.getWorkOrderStatus())) {
+            return Result.error("褰撳墠宸ュ崟鐘舵�佷笉鑳芥墽琛岋紒");
+        }
+        //todo 榻愬鎬ф鏌ャ�佸伐鑹虹偣妫�銆佽澶囩偣妫� 鐨勬牎楠岄�昏緫
+        MesProductionWorkOrder executeOrder = new MesProductionWorkOrder()
+                .setId(id)
+                .setWorkOrderStatus(ProductionWorkOrderStatus.EXECUTING.name());
+        mesProductionWorkOrderService.updateById(executeOrder);
+        return Result.ok("鎵ц鎴愬姛锛�");
+    }
+
     /**
      * 缂栬緫
      *
diff --git a/src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java b/src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java
index efccd0d..db5c5ca 100644
--- a/src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java
+++ b/src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java
@@ -92,8 +92,8 @@
     @ApiModelProperty(value = "鎺掍骇鏃ユ湡")
     private Date workOrderDate;
 	/**宸ュ崟鐘舵��*/
-	@Excel(name = "宸ュ崟鐘舵��", width = 15, dicCode = "mes_work_order_status")
-	@Dict(dicCode = "mes_work_order_status")
+	@Excel(name = "宸ュ崟鐘舵��", width = 15, dicCode = "work_order_status")
+	@Dict(dicCode = "work_order_status")
     @ApiModelProperty(value = "宸ュ崟鐘舵��")
     private String workOrderStatus;
 	/**瀹為檯鎶ュ伐鏁伴噺*/
diff --git a/src/main/java/org/jeecg/modules/mes/enums/ProductionWorkOrderStatus.java b/src/main/java/org/jeecg/modules/mes/enums/ProductionWorkOrderStatus.java
index e2c6de7..ef79537 100644
--- a/src/main/java/org/jeecg/modules/mes/enums/ProductionWorkOrderStatus.java
+++ b/src/main/java/org/jeecg/modules/mes/enums/ProductionWorkOrderStatus.java
@@ -11,7 +11,11 @@
      */
     PUBLISHED,
     /**
-     * 閲嶅彂甯�
+     * 鎵ц涓�
      */
-    REPUBLISHED
+    EXECUTING,
+    /**
+     * 宸插叧闂�
+     */
+    CLOSED
 }
diff --git a/src/main/java/org/jeecg/modules/mes/job/FeishuUserService.java b/src/main/java/org/jeecg/modules/mes/job/FeishuUserService.java
index 138a910..b5b3991 100644
--- a/src/main/java/org/jeecg/modules/mes/job/FeishuUserService.java
+++ b/src/main/java/org/jeecg/modules/mes/job/FeishuUserService.java
@@ -40,6 +40,9 @@
     @Value("${feishu.appSecret:}")
     private String appSecret;
 
+    @Value("${feishu.url:}")
+    private String feishuUrl;
+
     /**
      * 鍚屾椋炰功閮ㄩ棬鐢ㄦ埛鍒扮郴缁熺敤鎴疯〃
      * @param departmentId 椋炰功閮ㄩ棬ID
@@ -87,7 +90,7 @@
 
     private String getFeishuAccessToken() {
         try {
-            String url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal";
+            String url = feishuUrl + "open-apis/auth/v3/tenant_access_token/internal";
 
             log.info("寮�濮嬭幏鍙栭涔﹁闂护鐗岋紝AppId: {}",
                     appId != null ? appId.substring(0, Math.min(appId.length(), 10)) + "..." : "null");
@@ -135,7 +138,7 @@
             log.info("浣跨敤鐨勮闂护鐗屽墠缂�: Bearer {}", accessToken.substring(0, Math.min(20, accessToken.length())) + "...");
 
             // 椋炰功API绔偣
-            String url = "https://open.feishu.cn/open-apis/contact/v3/users/find_by_department";
+            String url = feishuUrl + "open-apis/contact/v3/users/find_by_department";
 
             String pageToken = null;
             int pageNumber = 1;
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 509414e..84dc636 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -298,3 +298,9 @@
     poolSize: 5               # 绾跨▼姹犳暟閲�
     expirationTime: 10000     # 杩囨湡鏃堕棿
     peekLimit: 10             # 宄板��
+feishu:
+  url: https://open.feishu.cn/
+  appId: cli_a74aab6353b7d00e
+  appSecret: mx5wm7X9S8WSzZCOYlxcggXTFL8iujIT
+  sync:
+    departmentId: od-47692f32e6b66cc3985d317fee780a8b
\ No newline at end of file
diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml
index e69e853..e28975a 100644
--- a/src/main/resources/application-prod.yml
+++ b/src/main/resources/application-prod.yml
@@ -296,4 +296,10 @@
     lang: ZH                  # 璇█
     poolSize: 5               # 绾跨▼姹犳暟閲�
     expirationTime: 10000     # 杩囨湡鏃堕棿
-    peekLimit: 10             # 宄板��
\ No newline at end of file
+    peekLimit: 10             # 宄板��
+feishu:
+  url: https://open.feishu.cn/
+  appId: cli_a74aab6353b7d00e
+  appSecret: mx5wm7X9S8WSzZCOYlxcggXTFL8iujIT
+  sync:
+    departmentId: od-47692f32e6b66cc3985d317fee780a8b
\ No newline at end of file

--
Gitblit v1.9.3