From 9ad231b419cfb6c07385d06eb68961126651af2f Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期一, 11 九月 2023 19:03:11 +0800
Subject: [PATCH] 页面修改

---
 src/main/java/com/fzzy/otherview/sh2023/pr/SHApi2101PR.java |   54 +++++++++++++++++++++++++++++-------------------------
 1 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/src/main/java/com/fzzy/otherview/sh2023/pr/SHApi2101PR.java b/src/main/java/com/fzzy/otherview/sh2023/pr/SHApi2101PR.java
index 44afe90..01284de 100644
--- a/src/main/java/com/fzzy/otherview/sh2023/pr/SHApi2101PR.java
+++ b/src/main/java/com/fzzy/otherview/sh2023/pr/SHApi2101PR.java
@@ -17,8 +17,10 @@
 import com.fzzy.api.service.ApiRemoteService;
 import com.fzzy.api.utils.ContextUtil;
 import com.fzzy.api.view.repository.ApiInfoDataRep;
+import com.fzzy.otherview.gd2022.dto.GdApi1023;
 import com.fzzy.otherview.whhpjl.WhjlConstant;
 import com.fzzy.otherview.whhpjl.dto.WhjlApi1101;
+import com.fzzy.push.gd2022.ApiCodeConstant;
 import com.fzzy.push.sh2023.SH2023Constant;
 import com.fzzy.push.sh2023.dto.SH2023Api2101;
 import org.apache.commons.lang.StringUtils;
@@ -118,15 +120,22 @@
         if (null == data.getPch() || data.getPch() == "") {
             data.setPch(data.getHwdm() + DateFormatUtils.format(data.getJjrq(), "yyyy"));
         }
-        ApiInfoData infoData = new ApiInfoData();
-        infoData.setId(data.getJjdh());
-        infoData.setKqdm(data.getKqdm());
-        infoData.setInteId(SH2023Constant.SH_2023_API_CODE_2101);
-        infoData.setUpdateTime(new Date());
-        infoData.setDataId(data.getJjdh());
-        infoData.setData(JSON.toJSONString(data));
-        infoData.setCzbz(data.getCzbz());
-        infoData.setRemarks("澶囨敞淇℃伅");
+        ApiInfoData infoData;
+        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh());
+        if (apiInfoList.size() != 0) {
+            infoData = apiInfoList.get(0);
+            infoData.setData(JSON.toJSONString(data));
+        } else {
+            infoData = new ApiInfoData();
+            infoData.setId(ContextUtil.getUUID());
+            infoData.setKqdm(data.getKqdm());
+            infoData.setInteId(SH2023Constant.SH_2023_API_CODE_2101);
+            infoData.setUpdateTime(new Date());
+            infoData.setDataId(data.getJjdh());
+            infoData.setData(JSON.toJSONString(data));
+            infoData.setCzbz(data.getCzbz());
+            infoData.setRemarks("澶囨敞淇℃伅");
+        }
 
         apiInfoDataRep.save(infoData);
     }
@@ -136,19 +145,21 @@
      */
     @Expose
     public void delData(SH2023Api2101 data) {
-        apiInfoDataRep.deleteById(data.getJjdh());
+        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh());
+        apiInfoDataRep.deleteById(apiInfoList.get(0).getId());
     }
 
     /**
      * sHApi2101PR#delUpdate
      */
     @Expose
-    public String delUpdate(SH2023Api2101 entity) {
-        if (null == entity) {
+    public String delUpdate(SH2023Api2101 data) {
+        if (null == data) {
             return "鏃犳暟鎹墽琛�";
         }
-        entity.setCzbz(Constant.CZBZ_D);
-        apiInfoDataRep.updateStatus(entity.getJjdh(), JSON.toJSONString(entity), Constant.CZBZ_D);
+        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh());
+        data.setCzbz(Constant.CZBZ_D);
+        apiInfoDataRep.updateStatus(apiInfoList.get(0).getId(), JSON.toJSONString(data), Constant.CZBZ_D);
         return null;
     }
 
@@ -177,23 +188,16 @@
         responseDto = apiService.pushData(param, apiConf, items);
         if (responseDto.getSuccess() == 0) {
             //鎺ㄩ�佹垚鍔燂紝鏇存柊鏁版嵁涓婁紶鐘舵��
-
             ApiInfoData infoData;
             for (SH2023Api2101 data : items) {
                 if (Constant.CZBZ_I.equals(data.getCzbz())) {
-
-                    infoData = new ApiInfoData();
-                    infoData.setId(data.getJjdh());
-                    infoData.setKqdm(data.getKqdm());
-                    infoData.setInteType("21");
-                    infoData.setInteId(SH2023Constant.SH_2023_API_CODE_2101);
-                    infoData.setUpdateTime(new Date());
-                    infoData.setDataId(data.getJjdh());
-
+                    //鎺ㄩ�佹垚鍔燂紝鏇存柊鏁版嵁涓婁紶鐘舵��
+                    List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh());
                     data.setCzbz(Constant.CZBZ_U);
+                    infoData = apiInfoList.get(0);
+                    infoData.setUpdateTime(new Date());
                     infoData.setCzbz(Constant.CZBZ_U);
                     infoData.setData(JSON.toJSONString(data));
-
                     apiInfoDataRep.save(infoData);
                 }
             }

--
Gitblit v1.9.3