From 9f6dacf7b39e5aeba37d8faf575c9e56d8cbe51a Mon Sep 17 00:00:00 2001 From: czt <czt18638530771@163.com> Date: 星期六, 11 十月 2025 13:35:42 +0800 Subject: [PATCH] 武汉黄陂军粮-质检报告共享接口同步及推送 --- src/main/java/com/fzzy/push/whhpjl/WhjlPushService11.java | 290 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 266 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/fzzy/push/whhpjl/WhjlPushService11.java b/src/main/java/com/fzzy/push/whhpjl/WhjlPushService11.java index d626048..c185009 100644 --- a/src/main/java/com/fzzy/push/whhpjl/WhjlPushService11.java +++ b/src/main/java/com/fzzy/push/whhpjl/WhjlPushService11.java @@ -1,13 +1,16 @@ 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.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -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,25 +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; - for (WhjlApi1101 data : items) { - param.setBizId(data.getBizId()); - responseDto = apiRemoteService.pushData(param, data); - - if (responseDto.getSuccess() == 0) { + //鎺ㄩ�侊紝鏁版嵁涓洪泦鍚堝舰寮� + ResponseDto responseDto = apiRemoteService.pushData(param, list); + if (responseDto.getSuccess() == 0) { + //鎺ㄩ�佹垚鍔燂紝鏇存柊鏁版嵁涓婁紶鐘舵�� + for (ApiInfoData data : items) { if (Constant.CZBZ_I.equals(data.getCzbz())) { - //TODO 鏇存柊鎿嶄綔鏍囧織鐘舵�� + 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