From f595d1fc19019f30bb1ee8729eb50aab8999f50f Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期四, 07 三月 2024 13:46:42 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java |   47 +++++++++++++++++++++++++++++++----------------
 1 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java
index 956c65e..be57c41 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java
@@ -11,6 +11,7 @@
 import com.example.erp.service.userInfo.SysErrorService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.text.SimpleDateFormat;
@@ -20,6 +21,7 @@
 
 @Service
 @DS("pp")
+@Transactional(rollbackFor = Exception.class)
 public class ReplenishService {
     @Autowired
     PatchLogMapper patchMapper;
@@ -97,24 +99,37 @@
 
     public Boolean updateReplenish(Map<String,Object> object) {
         boolean saveState = true;
-
-        String userName = "";
-        String userId = "";
-        if (object.get("userName") != null) {
-            userName = object.get("userName").toString();
-        }
-        if (object.get("userId") != null) {
-            userId = object.get("userId").toString();
-        }
-        //鑾峰彇瀵硅薄闆嗗悎寰幆杩涜鏂板淇敼
-        List<PatchLog> patchLoglist = JSONArray.parseArray(JSONObject.toJSONString(object.get("patchLog")), PatchLog.class);
-        if (!patchLoglist.isEmpty()){
-            for (PatchLog patchLog : patchLoglist) {
-                //瀹℃牳
-                patchMapper.updateReplenish(patchLog,userName);
+        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
+        try {
+            String userName = "";
+            String userId = "";
+            if (object.get("userName") != null) {
+                userName = object.get("userName").toString();
             }
-        }
+            if (object.get("userId") != null) {
+                userId = object.get("userId").toString();
+            }
+            //鑾峰彇瀵硅薄闆嗗悎寰幆杩涜鏂板淇敼
+            List<PatchLog> patchLoglist = JSONArray.parseArray(JSONObject.toJSONString(object.get("patchLog")), PatchLog.class);
+            if (!patchLoglist.isEmpty()){
+                for (PatchLog patchLog : patchLoglist) {
+                    //瀹℃牳
+                    patchMapper.updateReplenish(patchLog,userName);
+                    //淇敼灏忕墖娴佺▼鍗℃暟閲�
+                    patchMapper.updateOrderProcessDetail(patchLog);
+                }
+            }
 
+        } catch (Exception e) {
+            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
+            //灏嗗紓甯镐紶鍏ユ暟鎹簱
+            SysError sysError = new SysError();
+            sysError.setError(e.toString());
+            sysError.setFunc("saveOrder");
+            sysErrorService.insert(sysError);
+            saveState = false;
+
+        }
 
         return saveState;
 

--
Gitblit v1.8.0