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/LimsShebeiYiqiWeibaoServiceImpl.java |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/impl/LimsShebeiYiqiWeibaoServiceImpl.java b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/impl/LimsShebeiYiqiWeibaoServiceImpl.java
new file mode 100644
index 0000000..7cb0cb9
--- /dev/null
+++ b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/impl/LimsShebeiYiqiWeibaoServiceImpl.java
@@ -0,0 +1,60 @@
+package jnpf.limsService.impl;
+
+import jnpf.audit.sdk.annotation.AuditLog;
+
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import jnpf.exception.DataException;
+import jnpf.limsEntity.LimsShebeiYiqiWeibaoEntity;
+import jnpf.limsEntity.LimsShebeiYiqiWeibaoZixiangEntity;
+import jnpf.limsMapper.LimsShebeiYiqiWeibaoMapper;
+import jnpf.limsMapper.LimsShebeiYiqiWeibaoZixiangMapper;
+import jnpf.limsService.LimsShebeiYiqiWeibaoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+public class LimsShebeiYiqiWeibaoServiceImpl implements LimsShebeiYiqiWeibaoService {
+
+    @Autowired
+    private LimsShebeiYiqiWeibaoMapper weibaoMapper;
+
+    @Autowired
+    private LimsShebeiYiqiWeibaoZixiangMapper weibaoZixiangMapper;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    @AuditLog(action = "MAINTENANCE_SYNC", label = "鍚屾浠櫒缁翠繚瀛愰」", bizType = "SHEBEI_YIQI",
+            bizCodeExpr = "#result > 0 ? #weibaoId : ''", targetTable = "lims_shebei_yiqi_weibao_zixiang",
+            targetIdExpr = "T(jnpf.limsService.support.LimsAuditTargetIds).firstMaintenanceItem(#weibaoId)",
+            diff = true, entityClass = LimsShebeiYiqiWeibaoZixiangEntity.class)
+    public int syncToZixiang(String weibaoId) throws DataException {
+        String id = trimToEmpty(weibaoId);
+        if (id.isEmpty()) {
+            throw new DataException("缁翠繚璁板綍ID(weibao_id)涓嶈兘涓虹┖");
+        }
+
+        LimsShebeiYiqiWeibaoEntity weibao = weibaoMapper.selectById(id);
+        if (weibao == null) {
+            throw new DataException("缁翠繚璁板綍涓嶅瓨鍦細" + id);
+        }
+
+        LambdaUpdateWrapper<LimsShebeiYiqiWeibaoZixiangEntity> update = new LambdaUpdateWrapper<>();
+        update.eq(LimsShebeiYiqiWeibaoZixiangEntity::getForeignId, id)
+                .set(LimsShebeiYiqiWeibaoZixiangEntity::getYiqiId, weibao.getYiqiId())
+                .set(LimsShebeiYiqiWeibaoZixiangEntity::getYiqiMingcheng, weibao.getYiqiMingcheng())
+                .set(LimsShebeiYiqiWeibaoZixiangEntity::getYiqiBianhao, weibao.getYiqiBianhao())
+                .set(LimsShebeiYiqiWeibaoZixiangEntity::getWeihuRen, weibao.getWeihuRen())
+                .set(LimsShebeiYiqiWeibaoZixiangEntity::getWeihuRiqi, weibao.getWeihuRiqi())
+                .set(LimsShebeiYiqiWeibaoZixiangEntity::getBeizhu, weibao.getBeizhu());
+        int updated = weibaoZixiangMapper.update(null, update);
+        if (updated <= 0) {
+            throw new DataException("鏈壘鍒板叧鑱旂殑缁翠繚瀛愰」锛�" + id);
+        }
+        return updated;
+    }
+
+    private String trimToEmpty(String value) {
+        return value == null ? "" : value.trim();
+    }
+}

--
Gitblit v1.8.0