From 954480166aad6d24c9e9889906a0edf762f0da2a Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期一, 10 二月 2025 16:32:56 +0800
Subject: [PATCH] 优化库存同步

---
 src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1206PR.java |   49 ++++++++++++++++++++++++++-----------------------
 1 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1206PR.java b/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1206PR.java
index 187c528..1bbf80d 100644
--- a/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1206PR.java
+++ b/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1206PR.java
@@ -18,7 +18,6 @@
 import com.fzzy.api.view.repository.ApiInfoDataRep;
 import com.fzzy.otherview.whhpjl.WhjlConstant;
 import com.fzzy.otherview.whhpjl.dto.WhjlApi1206;
-import com.fzzy.otherview.whhpjl.dto.WhjlApi1206;
 import com.fzzy.otherview.whhpjl.dto.WhjlQDItem;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -52,7 +51,7 @@
 
     /**
      * 鑾峰彇鍒楄〃淇℃伅
-     * whjlApi1207PR#listData
+     * whjlApi1206PR#listData
      *
      * @return
      */
@@ -110,42 +109,46 @@
 
     /**
      * 鑾峰彇鍒楄〃淇℃伅
-     * whjlApi1207PR#listItem
+     * whjlApi1206PR#listItem
      *
      * @return
      */
     @DataProvider
-    public List<WhjlQDItem> listItem(String id) {
-        return null;
+    public List<WhjlQDItem> listItem(String code) {
+        return JSON.parseArray(code, WhjlQDItem.class);
     }
 
     /**
      * 鏇存柊鎴栦慨鏀�
-     * whjlApi1207PR#saveData
+     * whjlApi1206PR#saveData
      *
      * @param data
      * @return
      */
     @DataResolver
     public void saveData(WhjlApi1206 data) {
-        ApiInfoData infoData = new ApiInfoData();
-        infoData.setId(data.getBizId());
-        infoData.setKqdm(data.getKqdm());
-        infoData.setInteType(WhjlConstant.API_CATEGORY_12);
-        infoData.setInteId(WhjlConstant.API_CODE_1207);
-        infoData.setUpdateTime(new Date());
-        infoData.setDataId(data.getBizId());
-        infoData.setData(JSON.toJSONString(data));
-        infoData.setCzbz(data.getCzbz());
-        infoData.setRemarks("澶囨敞淇℃伅");
-
+        ApiInfoData infoData;
+        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(WhjlConstant.API_CODE_1206, data.getBizId(), data.getKqdm());
+        if (apiInfoList.size() != 0) {
+            infoData = apiInfoList.get(0);
+            infoData.setData(JSON.toJSONString(data));
+        } else {
+            infoData = new ApiInfoData();
+            infoData.setId(data.getBizId());
+            infoData.setKqdm(data.getKqdm());
+            infoData.setInteId(WhjlConstant.API_CODE_1206);
+            infoData.setUpdateTime(new Date());
+            infoData.setDataId(data.getBizId());
+            infoData.setData(JSON.toJSONString(data));
+            infoData.setCzbz(Constant.CZBZ_I);
+            infoData.setRemarks("澶囨敞淇℃伅");
+        }
         apiInfoDataRep.save(infoData);
     }
 
-
     /**
      * 鍒犻櫎
-     * whjlApi1207PR#delData
+     * whjlApi1206PR#delData
      *
      * @param data
      * @return
@@ -158,7 +161,7 @@
 
     /**
      * 鍒犻櫎鍚堝悓鍟嗗搧娓呭崟
-     * whjlApi1207PR#delItem
+     * whjlApi1206PR#delItem
      *
      * @param data
      * @return
@@ -170,7 +173,7 @@
 
     /**
      * 涓婁紶
-     * whjlApi1207PR#pushData
+     * whjlApi1206PR#pushData
      *
      * @param items
      * @return
@@ -188,7 +191,7 @@
         }
 
         //灏佽鍙傛暟
-        ApiParam param = new ApiParam(apiConf, WhjlConstant.API_CATEGORY_12, WhjlConstant.API_CODE_1207);
+        ApiParam param = new ApiParam(apiConf, WhjlConstant.API_CATEGORY_12, WhjlConstant.API_CODE_1206);
 
         //鑾峰彇瀹炵幇鎺ュ彛
         ApiRemoteService apiService = apiPushManager.getApiRemoteService(param.getPushProtocol());
@@ -207,7 +210,7 @@
                     infoData.setId(data.getBizId());
                     infoData.setKqdm(data.getKqdm());
                     infoData.setInteType(WhjlConstant.API_CATEGORY_12);
-                    infoData.setInteId(WhjlConstant.API_CODE_1207);
+                    infoData.setInteId(WhjlConstant.API_CODE_1206);
                     infoData.setUpdateTime(new Date());
                     infoData.setDataId(data.getBizId());
 

--
Gitblit v1.9.3