From 34981c30a78e8bbd7791131059a9210f9928b62c Mon Sep 17 00:00:00 2001
From: 刘光辉 <347230014@qq.com>
Date: 星期四, 17 九月 2026 09:24:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master
---
jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/limsController/LimsSxtFlowStatusController.java | 87 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 87 insertions(+), 0 deletions(-)
diff --git a/jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/limsController/LimsSxtFlowStatusController.java b/jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/limsController/LimsSxtFlowStatusController.java
new file mode 100644
index 0000000..fcbe7ae
--- /dev/null
+++ b/jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/limsController/LimsSxtFlowStatusController.java
@@ -0,0 +1,87 @@
+package jnpf.limsController;
+
+import cn.dev33.satoken.annotation.SaCheckLogin;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jnpf.exception.DataException;
+import jnpf.flowable.WorkFlowApi;
+import jnpf.flowable.entity.TaskEntity;
+import jnpf.limsEntity.LimsSxtFlowEventParam;
+import jnpf.limsService.LimsSxtJihuaService;
+import jnpf.util.R;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 宸ヤ綔娴佽妭鐐逛簨浠舵帴鍙c�傜珯鍐呮暟鎹帴鍙d細閫忎紶娴佺▼鎿嶄綔鑰呬护鐗岋紝鏁呬笉鍏佽鍖垮悕璋冪敤銆�
+ */
+@Slf4j
+@Tag(name = "姘寸郴缁熻鍒掓祦绋嬩簨浠�", description = "")
+@RestController
+@SaCheckLogin
+@RequestMapping("/lims/biz/sxt/flow-status")
+public class LimsSxtFlowStatusController {
+
+ @Autowired
+ private LimsSxtJihuaService jihuaService;
+ @Autowired
+ private WorkFlowApi workFlowApi;
+
+ @Operation(summary = "姘寸郴缁熻鍒掓祦绋嬪彂璧蜂簨浠�")
+ @PostMapping("/start")
+ public R<Object> syncFlowStarted(@RequestBody LimsSxtFlowEventParam param) {
+ String validationMessage = validateFlowEventParam(param);
+ if (validationMessage != null) {
+ return R.error(validationMessage);
+ }
+ try {
+ jihuaService.syncFlowStarted(param.getFlowId(), param.getTaskId());
+ return R.success();
+ } catch (DataException e) {
+ log.warn("姘寸郴缁熸祦绋嬪彂璧风姸鎬佸悓姝ュけ璐ワ紝flowId={}, taskId={}", param.getFlowId(), param.getTaskId(), e);
+ return R.error(e.getMessage());
+ }
+ }
+
+ @Operation(summary = "姘寸郴缁熻鍒掓祦绋嬬粨鏉熶簨浠�")
+ @PostMapping("/end")
+ public R<Object> syncFlowEnded(@RequestBody LimsSxtFlowEventParam param) {
+ String validationMessage = validateFlowEventParam(param);
+ if (validationMessage != null) {
+ return R.error(validationMessage);
+ }
+ TaskEntity task = workFlowApi.getInfoSubmit(param.getTaskId());
+ if (task == null) {
+ return R.error("鏈壘鍒版祦绋嬩换鍔★細" + param.getTaskId());
+ }
+ if (!param.getTaskId().equals(task.getId())) {
+ return R.error("娴佺▼浠诲姟涓庝紶鍏ヤ换鍔D涓嶅尮閰�");
+ }
+ try {
+ jihuaService.syncFlowEnded(param.getFlowId(), param.getTaskId(), task.getStatus());
+ return R.success();
+ } catch (DataException e) {
+ log.warn("姘寸郴缁熸祦绋嬬粨鏉熺姸鎬佸悓姝ュけ璐ワ紝flowId={}, taskId={}, status={}",
+ param.getFlowId(), param.getTaskId(), task.getStatus(), e);
+ return R.error(e.getMessage());
+ }
+ }
+
+ private String validateFlowEventParam(LimsSxtFlowEventParam param) {
+ if (param == null) {
+ return "璇锋眰鍙傛暟涓嶈兘涓虹┖";
+ }
+ if (!StringUtils.hasText(param.getFlowId())) {
+ return "娴佺▼id(flow_id)涓嶈兘涓虹┖";
+ }
+ if (!StringUtils.hasText(param.getTaskId())) {
+ return "娴佺▼浠诲姟id(task_id)涓嶈兘涓虹┖";
+ }
+ return null;
+ }
+}
--
Gitblit v1.8.0