From 2d73e7fbab48b729504704114f5c5272d9dad60d Mon Sep 17 00:00:00 2001
From: CZT <czt18638530771@163.com>
Date: 星期五, 15 十二月 2023 17:24:42 +0800
Subject: [PATCH] 修复粮情数据转换
---
src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java | 77 +++++++++++++++++++++++++++++++++++++-
1 files changed, 74 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java b/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java
index 07f20b3..eb1dd66 100644
--- a/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java
+++ b/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java
@@ -60,6 +60,8 @@
@Autowired
private Api1205Rep api1205Rep;
@Autowired
+ private Api1403Rep api1403Rep;
+ @Autowired
private Api1404Rep api1404Rep;
@Override
@@ -155,6 +157,64 @@
resd.setSuccess(responseDto.getCode() == 200 ? 0 : responseDto.getCode());
resd.setMsg(responseDto.getResult());
+ return resd;
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ return new ResponseDto(99, e.getMessage());
+ }
+ }
+
+ @Override
+ public ResponseDto pullData(ApiParam param, ApiConfs conf) {
+ String inteId = param.getInteId();
+ String kqdm = param.getKqdm();
+
+ try {
+ if (null == conf) {
+ conf = apiCommonService.getConf(kqdm);
+ }
+
+ //娣诲姞鏃ュ織
+ ApiLog apiLog = new ApiLog();
+ apiLog.setId(ContextUtil.getUUID());
+ apiLog.setInteId(inteId);
+
+ if (StringUtils.isEmpty(inteId)) {
+ ResponseDto responseDto = new ResponseDto(99, "娌℃湁鑾峰彇鍒版帴鍙�");
+ apiLog.setStatus(99);
+ apiLog.setResult("娌℃湁鑾峰彇鍒版帴鍙�");
+ apiLogRep.save(apiLog);
+ return responseDto;
+ }
+
+ if (conf == null) {
+ ResponseDto responseDto = new ResponseDto(99, "娌℃湁鑾峰彇鍒颁笂浼犻厤缃�");
+ apiLog.setStatus(99);
+ apiLog.setResult("娌℃湁鑾峰彇鍒颁笂浼犻厤缃�");
+ apiLogRep.save(apiLog);
+ return responseDto;
+ }
+
+ //鏌ヨ搴撳尯淇℃伅琛屾斂鍖哄垝鐮�
+ List<Api1102> api1102List = api1102Rep.findPushData(kqdm);
+ //灏佽鏁版嵁
+ SH2023PullReqDto reqData = new SH2023PullReqDto();;
+
+ reqData.setName(conf.getUserName());
+ reqData.setPwd(conf.getAppCode());
+
+ log.info("鎷夊彇鍏变韩鏁版嵁璇锋眰淇℃伅=" + JSON.toJSONString(reqData));
+
+ String url = conf.getApiUrl().replace("UPLOAD", "Shared");
+ SH2023PullRespDto responseDto = SH2023HttpClientUtil.postPullData(url + inteId, JSON.toJSONString(reqData));
+
+ apiLog.setStatus(responseDto.getRetcode() == 200 ? 0 : responseDto.getRetcode());
+ apiLog.setResult(responseDto.getRetMsg());
+ apiLogRep.save(apiLog);
+ ResponseDto resd = new ResponseDto();
+ resd.setSuccess(responseDto.getRetcode() == 200 ? 0 : responseDto.getRetcode());
+ resd.setMsg(responseDto.getRetMsg());
+ resd.setData(responseDto.getData());
return resd;
} catch (Exception e) {
log.error(e.getMessage(), e);
@@ -379,7 +439,12 @@
//璁剧疆绮杞崲骞村害
List<Api1404> api1404List = api1404Rep.getDataByJhmxdh(apiData.getJhmxh());
if (null != api1404List && api1404List.size() > 0) {
- api1202.setLhnd(api1404List.get(0).getShnd());
+ List<Api1403> api1403List = api1403Rep.getDataByLhjhdh(api1404List.get(0).getLhjhdh());
+ if(null != api1403List && api1403List.size() > 0){
+ if(StringUtils.isNotEmpty(api1403List.get(0).getJhnd())){
+ api1202.setLhnd(api1403List.get(0).getJhnd());
+ }
+ }
}
//璁剧疆鎵规鍙�
@@ -463,7 +528,12 @@
//璁剧疆绮杞崲骞村害
List<Api1404> api1404List = api1404Rep.getDataByJhmxdh(apiData.getJhmxh());
if (null != api1404List && api1404List.size() > 0) {
- api1205.setLhnd(api1404List.get(0).getShnd());
+ List<Api1403> api1403List = api1403Rep.getDataByLhjhdh(api1404List.get(0).getLhjhdh());
+ if(null != api1403List && api1403List.size() > 0){
+ if(StringUtils.isNotEmpty(api1403List.get(0).getJhnd())){
+ api1205.setLhnd(api1403List.get(0).getJhnd());
+ }
+ }
}
//璁剧疆鎵规鍙�
@@ -875,7 +945,7 @@
map.put(ceng, new ArrayList<>());
}
map.get(ceng).add(Double.valueOf(grain[0]));
- lwmx += grain[1] + ":" + grain[2] + ":" + grain[3] + "$" + grain[0];
+ lwmx += grain[2] + ":" + grain[3] +":" + grain[1] + "$" + grain[0];
if (Double.valueOf(grain[0]) <= -100) {
lwmx += "$" + "1" + "#";
errorNum++;
@@ -1228,4 +1298,5 @@
}
return object;
}
+
}
\ No newline at end of file
--
Gitblit v1.9.3