From dc66963d36e0a479e7334092241834b60bf8bbe2 Mon Sep 17 00:00:00 2001
From: CZT <czt18638530771@163.com>
Date: 星期五, 27 十月 2023 19:42:43 +0800
Subject: [PATCH] 优化武汉接口

---
 src/main/java/com/fzzy/push/whhpjl/WhjlPushService11.java |  291 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 266 insertions(+), 25 deletions(-)

diff --git a/src/main/java/com/fzzy/push/whhpjl/WhjlPushService11.java b/src/main/java/com/fzzy/push/whhpjl/WhjlPushService11.java
index ab9be50..c185009 100644
--- a/src/main/java/com/fzzy/push/whhpjl/WhjlPushService11.java
+++ b/src/main/java/com/fzzy/push/whhpjl/WhjlPushService11.java
@@ -1,14 +1,17 @@
 package com.fzzy.push.whhpjl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.fzzy.api.Constant;
 import com.fzzy.api.data.ApiParam;
 import com.fzzy.api.data.PushProtocol;
 import com.fzzy.api.dto.ResponseDto;
+import com.fzzy.api.entity.ApiInfoData;
 import com.fzzy.api.service.ApiRemoteService;
 import com.fzzy.api.service.PushService11;
-import com.fzzy.whjl.WhjlConstant;
-import com.fzzy.whjl.dto.WhjlApi1101;
+import com.fzzy.api.view.repository.ApiInfoDataRep;
+import com.fzzy.otherview.whhpjl.WhjlConstant;
+import com.fzzy.otherview.whhpjl.dto.*;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import java.util.ArrayList;
@@ -26,6 +29,8 @@
 
     @Autowired
     private WhjlApiRemoteService apiRemoteService;
+    @Autowired
+    private ApiInfoDataRep apiInfoDataRep;
 
     @Override
     public String getProtocol() {
@@ -39,18 +44,18 @@
         //鎺ㄩ�佸啗宸ヤ紒涓氫俊鎭�
         this.pushData1101(apiRemoteService, param);
 
-        //TODO 鎺ㄩ�佸啗宸ョ珯鐐逛俊鎭�
-
-        //TODO 鎺ㄩ�佸啗绮汉鍛樹俊鎭�
-
-        //TODO 鎺ㄩ�佷粨鎴夸俊鎭�
-
-        //TODO 鎺ㄩ�佸粧闂翠俊鎭�
-
-        //TODO 鎺ㄩ�佽揣浣嶄俊鎭�
-
-        //TODO 鎺ㄩ�佷粨鍌ㄨ澶囦俊鎭�
-
+        // 鎺ㄩ�佸啗宸ョ珯鐐逛俊鎭�
+        this.pushData1102(apiRemoteService, param);
+        // 鎺ㄩ�佸啗绮汉鍛樹俊鎭�
+        this.pushData1103(apiRemoteService, param);
+        // 鎺ㄩ�佷粨鎴夸俊鎭�
+        this.pushData1105(apiRemoteService, param);
+        // 鎺ㄩ�佸粧闂翠俊鎭�
+        this.pushData1107(apiRemoteService, param);
+        // 鎺ㄩ�佽揣浣嶄俊鎭�
+        this.pushData1108(apiRemoteService, param);
+        // 鎺ㄩ�佷粨鍌ㄨ澶囦俊鎭�
+        this.pushData1111(apiRemoteService, param);
 
         log.info("姝︽眽鍐涚伯鐪佸钩鍙�--->>>鍩虹淇℃伅 涓婃姤缁撴潫");
     }
@@ -60,26 +65,262 @@
      */
     private void pushData1101(ApiRemoteService apiRemoteService, ApiParam param) {
 
-        //TODO 鑾峰彇鍐涘伐浼佷笟淇℃伅
-        List<WhjlApi1101> items = new ArrayList<>();
+        //鑾峰彇鍐涘伐浼佷笟淇℃伅
+        List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1101);
+
         if (null == items || items.isEmpty()) {
             return;
         }
         param.setInteCategory(WhjlConstant.API_CATEGORY_11);
         param.setInteId(WhjlConstant.API_CODE_1101);
+        List<WhjlApi1101> list = new ArrayList<>();
+        WhjlApi1101 whjlApi1101;
+        for (ApiInfoData infoData : items) {
+            whjlApi1101 = JSONObject.parseObject(infoData.getData(), WhjlApi1101.class);
+            whjlApi1101.setKqdm(infoData.getKqdm());
+            whjlApi1101.setCzbz(infoData.getCzbz());
+            whjlApi1101.setUpdateTime(infoData.getUpdateTime());
+            whjlApi1101.setBizId(infoData.getDataId());
+            list.add(whjlApi1101);
+        }
 
         //鎺ㄩ�侊紝鏁版嵁涓洪泦鍚堝舰寮�
-        ResponseDto responseDto = apiRemoteService.pushData(param, items);
+        ResponseDto responseDto = apiRemoteService.pushData(param, list);
         if (responseDto.getSuccess() == 0) {
             //鎺ㄩ�佹垚鍔燂紝鏇存柊鏁版嵁涓婁紶鐘舵��
-            WhjlApi1101 d;
-            for (WhjlApi1101 data : items) {
-                d = new WhjlApi1101();
-                BeanUtils.copyProperties(data, d);
-                if("i".equals(d.getCzbz())){
-                    d.setCzbz("u");
-                    //TODO 鏇存柊鐘舵�侊紝寰呭疄鐜�
+            for (ApiInfoData data : items) {
+                if (Constant.CZBZ_I.equals(data.getCzbz())) {
 
+                    data.setCzbz(Constant.CZBZ_U);
+                    apiInfoDataRep.save(data);
+                }
+            }
+        }
+    }
+
+    /**
+     * 1102 鍐涗緵绔欑偣淇℃伅
+     */
+    private void pushData1102(ApiRemoteService apiRemoteService, ApiParam param) {
+
+        //鑾峰彇鍐涘伐浼佷笟淇℃伅
+        List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1102);
+
+        if (null == items || items.isEmpty()) {
+            return;
+        }
+        param.setInteCategory(WhjlConstant.API_CATEGORY_11);
+        param.setInteId(WhjlConstant.API_CODE_1102);
+        List<WhjlApi1102> list = new ArrayList<>();
+        WhjlApi1102 whjlApi1102;
+        for (ApiInfoData infoData : items) {
+            whjlApi1102 = JSONObject.parseObject(infoData.getData(), WhjlApi1102.class);
+            whjlApi1102.setKqdm(infoData.getKqdm());
+            whjlApi1102.setCzbz(infoData.getCzbz());
+            whjlApi1102.setUpdateTime(infoData.getUpdateTime());
+            whjlApi1102.setBizId(infoData.getDataId());
+            list.add(whjlApi1102);
+        }
+
+        //鎺ㄩ�侊紝鏁版嵁涓洪泦鍚堝舰寮�
+        ResponseDto responseDto = apiRemoteService.pushData(param, list);
+        if (responseDto.getSuccess() == 0) {
+            //鎺ㄩ�佹垚鍔燂紝鏇存柊鏁版嵁涓婁紶鐘舵��
+            for (ApiInfoData data : items) {
+                if (Constant.CZBZ_I.equals(data.getCzbz())) {
+
+                    data.setCzbz(Constant.CZBZ_U);
+                    apiInfoDataRep.save(data);
+                }
+            }
+        }
+    }
+
+    /**
+     * 1103 鍐涘伐浜哄憳淇℃伅
+     */
+    private void pushData1103(ApiRemoteService apiRemoteService, ApiParam param) {
+
+        //鑾峰彇鍐涘伐浼佷笟淇℃伅
+        List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1103);
+
+        if (null == items || items.isEmpty()) {
+            return;
+        }
+        param.setInteCategory(WhjlConstant.API_CATEGORY_11);
+        param.setInteId(WhjlConstant.API_CODE_1103);
+        List<WhjlApi1103> list = new ArrayList<>();
+        WhjlApi1103 whjlApi1103;
+        for (ApiInfoData infoData : items) {
+            whjlApi1103 = JSONObject.parseObject(infoData.getData(), WhjlApi1103.class);
+            whjlApi1103.setKqdm(infoData.getKqdm());
+            whjlApi1103.setCzbz(infoData.getCzbz());
+            whjlApi1103.setUpdateTime(infoData.getUpdateTime());
+            whjlApi1103.setBizId(infoData.getDataId());
+            list.add(whjlApi1103);
+        }
+
+        //鎺ㄩ�侊紝鏁版嵁涓洪泦鍚堝舰寮�
+        ResponseDto responseDto = apiRemoteService.pushData(param, list);
+        if (responseDto.getSuccess() == 0) {
+            //鎺ㄩ�佹垚鍔燂紝鏇存柊鏁版嵁涓婁紶鐘舵��
+            for (ApiInfoData data : items) {
+                if (Constant.CZBZ_I.equals(data.getCzbz())) {
+
+                    data.setCzbz(Constant.CZBZ_U);
+                    apiInfoDataRep.save(data);
+                }
+            }
+        }
+    }
+
+    /**
+     * 1105 浠撴埧淇℃伅
+     */
+    private void pushData1105(ApiRemoteService apiRemoteService, ApiParam param) {
+
+        //鑾峰彇鍐涘伐浼佷笟淇℃伅
+        List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1105);
+
+        if (null == items || items.isEmpty()) {
+            return;
+        }
+        param.setInteCategory(WhjlConstant.API_CATEGORY_11);
+        param.setInteId(WhjlConstant.API_CODE_1105);
+        List<WhjlApi1105> list = new ArrayList<>();
+        WhjlApi1105 whjlApi1105;
+        for (ApiInfoData infoData : items) {
+            whjlApi1105 = JSONObject.parseObject(infoData.getData(), WhjlApi1105.class);
+            whjlApi1105.setKqdm(infoData.getKqdm());
+            whjlApi1105.setCzbz(infoData.getCzbz());
+            whjlApi1105.setUpdateTime(infoData.getUpdateTime());
+            whjlApi1105.setBizId(infoData.getDataId());
+            list.add(whjlApi1105);
+        }
+
+        //鎺ㄩ�侊紝鏁版嵁涓洪泦鍚堝舰寮�
+        ResponseDto responseDto = apiRemoteService.pushData(param, list);
+        if (responseDto.getSuccess() == 0) {
+            //鎺ㄩ�佹垚鍔燂紝鏇存柊鏁版嵁涓婁紶鐘舵��
+            for (ApiInfoData data : items) {
+                if (Constant.CZBZ_I.equals(data.getCzbz())) {
+
+                    data.setCzbz(Constant.CZBZ_U);
+                    apiInfoDataRep.save(data);
+                }
+            }
+        }
+    }
+
+    /**
+     * 1106 寤掗棿淇℃伅
+     */
+    private void pushData1107(ApiRemoteService apiRemoteService, ApiParam param) {
+
+        //鑾峰彇鍐涘伐浼佷笟淇℃伅
+        List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1107);
+
+        if (null == items || items.isEmpty()) {
+            return;
+        }
+        param.setInteCategory(WhjlConstant.API_CATEGORY_11);
+        param.setInteId(WhjlConstant.API_CODE_1107);
+        List<WhjlApi1107> list = new ArrayList<>();
+        WhjlApi1107 whjlApi1106;
+        for (ApiInfoData infoData : items) {
+            whjlApi1106 = JSONObject.parseObject(infoData.getData(), WhjlApi1107.class);
+            whjlApi1106.setKqdm(infoData.getKqdm());
+            whjlApi1106.setCzbz(infoData.getCzbz());
+            whjlApi1106.setUpdateTime(infoData.getUpdateTime());
+            whjlApi1106.setBizId(infoData.getDataId());
+            list.add(whjlApi1106);
+        }
+
+        //鎺ㄩ�侊紝鏁版嵁涓洪泦鍚堝舰寮�
+        ResponseDto responseDto = apiRemoteService.pushData(param, list);
+        if (responseDto.getSuccess() == 0) {
+            //鎺ㄩ�佹垚鍔燂紝鏇存柊鏁版嵁涓婁紶鐘舵��
+            for (ApiInfoData data : items) {
+                if (Constant.CZBZ_I.equals(data.getCzbz())) {
+
+                    data.setCzbz(Constant.CZBZ_U);
+                    apiInfoDataRep.save(data);
+                }
+            }
+        }
+    }
+
+    /**
+     * 1107 璐т綅淇℃伅
+     */
+    private void pushData1108(ApiRemoteService apiRemoteService, ApiParam param) {
+
+        //鑾峰彇鍐涘伐浼佷笟淇℃伅
+        List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1108);
+
+        if (null == items || items.isEmpty()) {
+            return;
+        }
+        param.setInteCategory(WhjlConstant.API_CATEGORY_11);
+        param.setInteId(WhjlConstant.API_CODE_1108);
+        List<WhjlApi1108> list = new ArrayList<>();
+        WhjlApi1108 whjlApi1107;
+        for (ApiInfoData infoData : items) {
+            whjlApi1107 = JSONObject.parseObject(infoData.getData(), WhjlApi1108.class);
+            whjlApi1107.setKqdm(infoData.getKqdm());
+            whjlApi1107.setCzbz(infoData.getCzbz());
+            whjlApi1107.setUpdateTime(infoData.getUpdateTime());
+            whjlApi1107.setBizId(infoData.getDataId());
+            list.add(whjlApi1107);
+        }
+
+        //鎺ㄩ�侊紝鏁版嵁涓洪泦鍚堝舰寮�
+        ResponseDto responseDto = apiRemoteService.pushData(param, list);
+        if (responseDto.getSuccess() == 0) {
+            //鎺ㄩ�佹垚鍔燂紝鏇存柊鏁版嵁涓婁紶鐘舵��
+            for (ApiInfoData data : items) {
+                if (Constant.CZBZ_I.equals(data.getCzbz())) {
+
+                    data.setCzbz(Constant.CZBZ_U);
+                    apiInfoDataRep.save(data);
+                }
+            }
+        }
+    }
+
+    /**
+     * 1111 浠撳偍璁惧淇℃伅
+     */
+    private void pushData1111(ApiRemoteService apiRemoteService, ApiParam param) {
+
+        //鑾峰彇鍐涘伐浼佷笟淇℃伅
+        List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1111);
+
+        if (null == items || items.isEmpty()) {
+            return;
+        }
+        param.setInteCategory(WhjlConstant.API_CATEGORY_11);
+        param.setInteId(WhjlConstant.API_CODE_1111);
+        List<WhjlApi1112> list = new ArrayList<>();
+        WhjlApi1112 whjlApi1111;
+        for (ApiInfoData infoData : items) {
+            whjlApi1111 = JSONObject.parseObject(infoData.getData(), WhjlApi1112.class);
+            whjlApi1111.setKqdm(infoData.getKqdm());
+            whjlApi1111.setCzbz(infoData.getCzbz());
+            whjlApi1111.setUpdateTime(infoData.getUpdateTime());
+            whjlApi1111.setBizId(infoData.getDataId());
+            list.add(whjlApi1111);
+        }
+
+        //鎺ㄩ�侊紝鏁版嵁涓洪泦鍚堝舰寮�
+        ResponseDto responseDto = apiRemoteService.pushData(param, list);
+        if (responseDto.getSuccess() == 0) {
+            //鎺ㄩ�佹垚鍔燂紝鏇存柊鏁版嵁涓婁紶鐘舵��
+            for (ApiInfoData data : items) {
+                if (Constant.CZBZ_I.equals(data.getCzbz())) {
+
+                    data.setCzbz(Constant.CZBZ_U);
+                    apiInfoDataRep.save(data);
                 }
             }
         }

--
Gitblit v1.9.3