From f22c2bda5fbe1e016403c6585334cac15d256f49 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期三, 12 六月 2024 19:17:35 +0800
Subject: [PATCH] 调整石嘴山省平台配置文件信息
---
src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1104PR.java | 102 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 98 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1104PR.java b/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1104PR.java
index a9f9c00..b1b653a 100644
--- a/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1104PR.java
+++ b/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1104PR.java
@@ -1,11 +1,27 @@
package com.fzzy.otherview.whhpjl.pr;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.annotation.Expose;
+import com.fzzy.api.Constant;
+import com.fzzy.api.data.ApiParam;
+import com.fzzy.api.dto.ResponseDto;
+import com.fzzy.api.entity.ApiConfs;
+import com.fzzy.api.entity.ApiInfoData;
+import com.fzzy.api.service.ApiCommonService;
+import com.fzzy.api.service.ApiPushManager;
+import com.fzzy.api.service.ApiRemoteService;
+import com.fzzy.api.view.repository.ApiInfoDataRep;
+import com.fzzy.otherview.whhpjl.WhjlConstant;
import com.fzzy.otherview.whhpjl.dto.WhjlApi1104;
+import com.fzzy.otherview.whhpjl.dto.WhjlApi1104;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
/**
@@ -15,6 +31,13 @@
*/
@Component
public class WhjlApi1104PR {
+ @Autowired
+ private ApiCommonService apiCommonService;
+ @Autowired
+ private ApiPushManager apiPushManager;
+ @Autowired
+ private ApiInfoDataRep apiInfoDataRep;
+
/**
* 鑾峰彇鍒楄〃淇℃伅
* whjlApi1104PR#listData
@@ -23,8 +46,23 @@
*/
@DataProvider
public List<WhjlApi1104> listData() {
- return null;
+ List<ApiInfoData> result = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1104);
+ if (null == result || result.isEmpty()) {
+ return null;
+ }
+ List<WhjlApi1104> list = new ArrayList<>();
+ WhjlApi1104 whjlApi1104;
+ for (ApiInfoData infoData : result) {
+ whjlApi1104 = JSONObject.parseObject(infoData.getData(), WhjlApi1104.class);
+ whjlApi1104.setKqdm(infoData.getKqdm());
+ whjlApi1104.setCzbz(infoData.getCzbz());
+ whjlApi1104.setUpdateTime(infoData.getUpdateTime());
+ whjlApi1104.setBizId(infoData.getDataId());
+ list.add(whjlApi1104);
+ }
+ return list;
}
+
/**
* 鏇存柊鎴栦慨鏀�
@@ -34,9 +72,21 @@
* @return
*/
@DataResolver
- public String saveData(WhjlApi1104 data) {
- return null;
+ public void saveData(WhjlApi1104 data) {
+ ApiInfoData infoData = new ApiInfoData();
+ infoData.setId(data.getBizId());
+ infoData.setKqdm(data.getKqdm());
+ infoData.setInteType(WhjlConstant.API_CATEGORY_11);
+ infoData.setInteId(WhjlConstant.API_CODE_1104);
+ infoData.setUpdateTime(new Date());
+ infoData.setDataId(data.getBizId());
+ infoData.setData(JSON.toJSONString(data));
+ infoData.setCzbz(data.getCzbz());
+ infoData.setRemarks("澶囨敞淇℃伅");
+
+ apiInfoDataRep.save(infoData);
}
+
/**
* 鍒犻櫎
@@ -47,6 +97,7 @@
*/
@Expose
public String delData(WhjlApi1104 data) {
+ apiInfoDataRep.deleteById(data.getBizId());
return null;
}
@@ -59,6 +110,49 @@
*/
@Expose
public String pushData(List<WhjlApi1104> items) {
- return null;
+
+ String result = "";
+
+ String kqdm = items.get(0).getKqdm();
+ ApiConfs apiConf = apiCommonService.getConf(kqdm);
+
+ if (null == apiConf) {
+ return "绯荤粺娌℃湁鑾峰彇鍒板綋鍓嶅簱鍖洪厤缃俊鎭紝鎵ц澶辫触";
+ }
+
+ //灏佽鍙傛暟
+ ApiParam param = new ApiParam(apiConf, WhjlConstant.API_CATEGORY_11, WhjlConstant.API_CODE_1104);
+
+ //鑾峰彇瀹炵幇鎺ュ彛
+ ApiRemoteService apiService = apiPushManager.getApiRemoteService(param.getPushProtocol());
+ if (null == apiService) {
+ return "绯荤粺娌℃湁褰撳墠鎺ㄩ�佸崗璁厤缃紝鎵ц澶辫触";
+ }
+
+ ApiInfoData infoData;
+ ResponseDto responseDto;
+ for (WhjlApi1104 data : items) {
+ responseDto = apiService.pushData(param, apiConf, data);
+ if (responseDto.getSuccess() == 0) {
+ if (Constant.CZBZ_I.equals(data.getCzbz())) {
+
+ infoData = new ApiInfoData();
+ infoData.setId(data.getBizId());
+ infoData.setKqdm(data.getKqdm());
+ infoData.setInteType(WhjlConstant.API_CATEGORY_11);
+ infoData.setInteId(WhjlConstant.API_CODE_1104);
+ infoData.setUpdateTime(new Date());
+ infoData.setDataId(data.getBizId());
+
+ data.setCzbz(Constant.CZBZ_U);
+ infoData.setCzbz(Constant.CZBZ_U);
+ infoData.setData(JSON.toJSONString(data));
+
+ apiInfoDataRep.save(infoData);
+ }
+ }
+ result += responseDto.toString();
+ }
+ return result;
}
}
--
Gitblit v1.9.3