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-biz/src/main/java/jnpf/limsService/impl/LimsWendingxingXiaohuiShenqingServiceImpl.java | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 104 insertions(+), 0 deletions(-)
diff --git a/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/impl/LimsWendingxingXiaohuiShenqingServiceImpl.java b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/impl/LimsWendingxingXiaohuiShenqingServiceImpl.java
new file mode 100644
index 0000000..a4432d4
--- /dev/null
+++ b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/impl/LimsWendingxingXiaohuiShenqingServiceImpl.java
@@ -0,0 +1,104 @@
+package jnpf.limsService.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import jnpf.audit.sdk.annotation.AuditLog;
+import jnpf.exception.DataException;
+import jnpf.limsEntity.LimsWendingxingXiaohuiShenqingEntity;
+import jnpf.limsMapper.LimsWendingxingXiaohuiShenqingMapper;
+import jnpf.limsService.LimsWendingxingXiaohuiShenqingService;
+import jnpf.limsService.support.LimsWendingxingXiaohuiFlowStatusResolver;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+import java.util.Objects;
+
+@Service
+public class LimsWendingxingXiaohuiShenqingServiceImpl
+ implements LimsWendingxingXiaohuiShenqingService {
+
+ @Autowired
+ private LimsWendingxingXiaohuiShenqingMapper xiaohuiShenqingMapper;
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ @AuditLog(action = "FLOW_START", label = "绋冲畾鎬ч攢姣佹祦绋嬪彂璧�", bizType = "WENDINGXING",
+ bizCodeExpr = "#flowId", bizCodeRequired = false,
+ targetTable = "lims_wendingxing_xiaohui_shenqing",
+ targetIdExpr = "T(jnpf.limsService.support.LimsAuditTargetIds).wendingxingDestroyByFlow(#flowId, #taskId)",
+ diff = true, entityClass = LimsWendingxingXiaohuiShenqingEntity.class)
+ public void syncFlowStarted(String flowId, String taskId) throws DataException {
+ LimsWendingxingXiaohuiShenqingEntity shenqing = findByFlow(flowId, taskId);
+ if (LimsWendingxingXiaohuiFlowStatusResolver.COMPLETED.equals(shenqing.getBizStatus())) {
+ return;
+ }
+ updateBizStatus(shenqing, LimsWendingxingXiaohuiFlowStatusResolver.PROCESSING);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ @AuditLog(action = "FLOW_END", label = "绋冲畾鎬ч攢姣佹祦绋嬬粨鏉�", bizType = "WENDINGXING",
+ bizCodeExpr = "#flowId", bizCodeRequired = false,
+ targetTable = "lims_wendingxing_xiaohui_shenqing",
+ targetIdExpr = "T(jnpf.limsService.support.LimsAuditTargetIds).wendingxingDestroyByFlow(#flowId, #taskId)",
+ diff = true, entityClass = LimsWendingxingXiaohuiShenqingEntity.class)
+ public void syncFlowEnded(String flowId, String taskId, Integer flowState) throws DataException {
+ if (!LimsWendingxingXiaohuiFlowStatusResolver.isTerminal(flowState)) {
+ throw new DataException("娴佺▼灏氭湭缁撴潫锛屽綋鍓嶇姸鎬侊細" + flowState);
+ }
+ LimsWendingxingXiaohuiShenqingEntity shenqing = findByFlow(flowId, taskId);
+ updateBizStatus(shenqing, LimsWendingxingXiaohuiFlowStatusResolver.COMPLETED);
+ }
+
+ private LimsWendingxingXiaohuiShenqingEntity findByFlow(String flowId, String taskId)
+ throws DataException {
+ String resolvedFlowId = trimToEmpty(flowId);
+ String resolvedTaskId = trimToEmpty(taskId);
+ if (!StringUtils.hasText(resolvedFlowId)) {
+ throw new DataException("娴佺▼id(flow_id)涓嶈兘涓虹┖");
+ }
+ if (!StringUtils.hasText(resolvedTaskId)) {
+ throw new DataException("娴佺▼浠诲姟id(task_id)涓嶈兘涓虹┖");
+ }
+
+ LambdaQueryWrapper<LimsWendingxingXiaohuiShenqingEntity> query = new LambdaQueryWrapper<>();
+ query.eq(LimsWendingxingXiaohuiShenqingEntity::getFFlowId, resolvedFlowId)
+ .eq(LimsWendingxingXiaohuiShenqingEntity::getFFlowTaskId, resolvedTaskId)
+ .and(w -> w.isNull(LimsWendingxingXiaohuiShenqingEntity::getFDeleteMark)
+ .or()
+ .ne(LimsWendingxingXiaohuiShenqingEntity::getFDeleteMark, 1));
+ List<LimsWendingxingXiaohuiShenqingEntity> list = xiaohuiShenqingMapper.selectList(query);
+ if (list == null || list.isEmpty()) {
+ throw new DataException("绋冲畾鎬ч攢姣佺敵璇蜂笉瀛樺湪锛歠low_id=" + resolvedFlowId
+ + ", task_id=" + resolvedTaskId);
+ }
+ if (list.size() > 1) {
+ throw new DataException("澶氫釜绋冲畾鎬ч攢姣佺敵璇峰叧鑱斿悓涓�娴佺▼浠诲姟锛歵ask_id=" + resolvedTaskId);
+ }
+ return list.get(0);
+ }
+
+ private void updateBizStatus(LimsWendingxingXiaohuiShenqingEntity shenqing, String targetStatus)
+ throws DataException {
+ if (Objects.equals(shenqing.getBizStatus(), targetStatus)) {
+ return;
+ }
+ LambdaUpdateWrapper<LimsWendingxingXiaohuiShenqingEntity> update = new LambdaUpdateWrapper<>();
+ update.eq(LimsWendingxingXiaohuiShenqingEntity::getId, shenqing.getId())
+ .eq(LimsWendingxingXiaohuiShenqingEntity::getFTenantId, shenqing.getFTenantId())
+ .and(w -> w.isNull(LimsWendingxingXiaohuiShenqingEntity::getFDeleteMark)
+ .or()
+ .ne(LimsWendingxingXiaohuiShenqingEntity::getFDeleteMark, 1))
+ .set(LimsWendingxingXiaohuiShenqingEntity::getBizStatus, targetStatus);
+ if (xiaohuiShenqingMapper.update(null, update) != 1) {
+ throw new DataException("绋冲畾鎬ч攢姣佺敵璇风姸鎬佹洿鏂板け璐ワ紝璇峰埛鏂板悗閲嶈瘯");
+ }
+ }
+
+ private String trimToEmpty(String value) {
+ return value == null ? "" : value.trim();
+ }
+}
--
Gitblit v1.8.0