From a1d6638c3dad0a2c42aa3f35b0c080738f69bd9b Mon Sep 17 00:00:00 2001 From: CZT <czt18638530771@163.com> Date: 星期一, 15 一月 2024 19:05:39 +0800 Subject: [PATCH] 调整上海接口数据实时性 --- src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java | 511 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 420 insertions(+), 91 deletions(-) diff --git a/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java b/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java index 4b2c9dc..a4607a9 100644 --- a/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java +++ b/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java @@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.DateFormatUtils; +import com.fzzy.api.utils.NumberUtil; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -47,15 +48,21 @@ @Autowired private Api1102Rep api1102Rep; @Autowired + private Api1103Rep api1103Rep; + @Autowired private Api1104Rep api1104Rep; @Autowired private Api1208Rep api1208Rep; + @Autowired + private Api1210Rep api1210Rep; @Autowired private Api1109Rep api1109Rep; @Autowired private Api1202Rep api1202Rep; @Autowired private Api1205Rep api1205Rep; + @Autowired + private Api1403Rep api1403Rep; @Autowired private Api1404Rep api1404Rep; @@ -159,6 +166,61 @@ } } + @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; + } + + //灏佽鏁版嵁 + 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); + return new ResponseDto(99, e.getMessage()); + } + } + /** * 杞负JSON * @@ -177,10 +239,15 @@ } else { List<Object> list = new ArrayList<>(); Object object = getJsonApiData(inteId, data, code); + + //闄ゅ簱瀛樻帴鍙e锛屽叾浠栨帴鍙d笂浼犲墠鏇存柊鏈�鍚庢洿鏂版椂闂� + if(!SH2023Constant.SH_2023_API_CODE_1208.equals(inteId)){ + setZhgxsjValue(object); + } + list.add(object); return JSON.toJSONString(list); } - } /** @@ -192,7 +259,6 @@ * @return */ private Object getJsonApiData(String inteId, Object data, String code) { - List<Object> list = new ArrayList<>(); //鍏蜂綋鏍规嵁鎺ュ彛杩涜灏佽 if (SH2023Constant.SH_2023_API_CODE_1101.equals(inteId)) { SH2023Api1101 api1101 = new SH2023Api1101(); @@ -221,9 +287,30 @@ if (SH2023Constant.SH_2023_API_CODE_1104.equals(inteId)) { SH2023Api1104 api1104 = new SH2023Api1104(); Api1104 apiData = (Api1104) data; + + //鏌ヨ浠撴埧淇℃伅 + List<Api1103> api1103List = api1103Rep.findPushDataByCfdm(apiData.getCfbh()); + List<Api1104> api1104List = api1104Rep.findDataByCfbh(apiData.getCfbh()); + int num = 2; + if (null != api1104List && api1104List.size() > 0) { + num = api1104List.size(); + } + if (null != api1103List && api1103List.size() > 0) { + Api1103 api1103 = api1103List.get(0); + BeanUtils.copyProperties(api1103, api1104); + api1104.setCwc(api1103.getCwc() / num); + api1104.setCnc(api1103.getCnc() / num); + api1104.setSjcr(api1103.getSjcr() / num); + } BeanUtils.copyProperties(apiData, api1104); api1104.setAjdm(apiData.getAjdh()); api1104.setCfdm(apiData.getCfbh()); + + //璁剧疆绮鎬ц川浠g爜(鏌ョ湅寤掗棿瀵瑰簲鐨勬渶鏂板簱瀛樿繘琛岃祴鍊�) + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1104.getAjdm() + "01"); + if (null != api1208List && api1208List.size() > 0) { + api1104.setLsxzdm(api1208List.get(0).getLsxzdm()); + } //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1104); @@ -275,6 +362,8 @@ api1109.setWjl(JSON.toJSONString(map)); //涓婃捣甯傚钩鍙版枃浠跺悕绉拌鍒欙細搴撳尯缂栫爜_涓氬姟娴佹按鍙穇鍒嗙被鐮乢椤哄簭鐮�.jpg锛屼緥濡傦細91310114703439394M001_142211080101_GL_00.jpg api1109.setWjmc(getWjmc(api1109.getWjlx(), api1109.getWjmc())); + //涓氬姟绫诲瀷 + api1109.setYwdh(getYwdh(api1109.getWjlx(), api1109.getWjmc(), api1109.getYwdh())); //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1109); return api1109; @@ -306,6 +395,7 @@ BeanUtils.copyProperties(data, api1112); api1112.setHdrychsj(api1112.getQdzgzchzyzgsj()); api1112.setBjw(ShAreaBjw.getBjw(code)); + api1112.setZy("01"); //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1112); @@ -333,6 +423,11 @@ if (StringUtils.isEmpty(api1201.getShr())) { api1201.setShr("瀹℃壒浜�"); } + //璁剧疆璐攢鏂瑰紡,榛樿瀹㈡埛缁熶竴淇$敤鐮佷负绌猴紝鍒欎负浜ч攢锛屽弽涔嬩负绔炰环锛�(1-瀹氬悜锛�2-绔炰环锛�3-浜ч攢) + api1201.setGxfs("2"); + if(StringUtils.isEmpty(api1201.getKhtyshxydm())){ + api1201.setGxfs("3"); + } //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1201); return api1201; @@ -346,24 +441,33 @@ if (StringUtils.isEmpty(api1202.getCddm())) { api1202.setCddm(api1202.getHwdm().substring(2, 8)); } - if (StringUtils.isEmpty(api1202.getHth())) { - api1202.setHth("鏃�"); - } - if (StringUtils.isEmpty(api1202.getJhmxh())) { - api1202.setJhmxh("璁″垝鏄庣粏鍙�"); - } if (StringUtils.isEmpty(api1202.getRkjsdh())) { api1202.setRkjsdh("0"); } - - //璁剧疆绮杞崲骞村害 + //璁剧疆绮杞崲骞村害,鏍规嵁璁″垝鏄庣粏鍙锋煡璇㈣鍒掓槑缁嗭紝鍐嶆牴鎹鍒掓槑缁嗘煡璇㈣疆鎹㈣鍒� List<Api1404> api1404List = api1404Rep.getDataByJhmxdh(apiData.getJhmxh()); - if(null != api1404List && api1404List.size() >0){ - api1202.setLhnd(api1404List.get(0).getShnd()); + if (null != api1404List && api1404List.size() > 0) { + api1202.setShnd(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()); + } + } } - + //鏌ヨ绮鎬ц川杞彉鍗曞彿(鏍规嵁鍏ュ簱鏃堕棿鍜岃揣浣嶄唬鐮佹煡璇㈢伯椋熸�ц川杞彉鍗�) + List<Api1210> api1210List = api1210Rep.findDataByHwdmAndTime(api1202.getHwdm(), api1202.getCmsj()); + if (null != api1210List && api1210List.size() > 0) { + api1202.setLsxzzbdh(api1210List.get(0).getLsxzzbdh()); + } //璁剧疆鎵规鍙� - api1202.setPch(apiData.getHwdm() + apiData.getShnd()); + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1202.getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1202.setPch(apiData.getHwdm() + api1208List.get(0).getShnd()); + } + //绮鎬ц川 + api1202.setLsxzdm("200"); + //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1202); return api1202; @@ -386,9 +490,18 @@ api1203.setZkl("0"); } //璁剧疆鎵规鍙� - List<Api1202> api1202List = api1202Rep.getDataById(apiData.getRkywdh()); - api1203.setPch(apiData.getHwdm() + api1202List.get(0).getShnd()); - + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1203.getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1203.setPch(apiData.getHwdm() + api1208List.get(0).getShnd()); + } + //璁剧疆璐ㄦ缂栫爜(榛樿绛夊悓浜庡叆搴撹川妫�鍗曞彿),鑻ヤ负鑸硅繍锛屽垯璁剧疆涓虹郴缁熷唴鑸硅繍鐨勫崟鍙� + api1203.setZjbh(api1203.getRkjydh()); + List<Api1202> api1202List = api1202Rep.getDataById(api1203.getRkywdh()); + if (null != api1202List && api1202List.size() > 0) { + if(api1202List.get(0).getYsgj().equals("3")){ + api1203.setZjbh(api1202List.get(0).getBizId().substring(2)); + } + } //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1203); return api1203; @@ -399,9 +512,22 @@ BeanUtils.copyProperties(apiData, api1204); api1204.setBjw(ShAreaBjw.getBjw(code)); - //TODO 鏌ヨ鍚堝悓鑾峰彇鎵规鍙� //璁剧疆鎵规鍙� - api1204.setPch(apiData.getHwdm() + DateFormatUtils.format(apiData.getJssj(), "yyyy")); + if (StringUtils.isNotEmpty(api1204.getHth())) { + List<Api1202> api1202List = api1202Rep.getDataByRkjsdh(api1204.getRkjsdh()); + if (null != api1202List && api1202List.size() > 0) { + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1202List.get(0).getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1204.setPch(api1208List.get(0).getHwdm() + api1208List.get(0).getShnd()); + } + } + } + if (StringUtils.isNotEmpty(api1204.getHwdm())) { + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1204.getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1204.setPch(api1208List.get(0).getHwdm() + api1208List.get(0).getShnd()); + } + } //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1204); @@ -418,24 +544,26 @@ if (StringUtils.isEmpty(api1205.getCddm())) { api1205.setCddm(api1205.getHwdm().substring(2, 8)); } - if (StringUtils.isEmpty(api1205.getHth())) { - api1205.setHth("鏃�"); - } - if (StringUtils.isEmpty(api1205.getJhmxh())) { - api1205.setJhmxh("璁″垝鏄庣粏鍙�"); - } if (StringUtils.isEmpty(api1205.getCkjsdh())) { api1205.setCkjsdh("0"); } //璁剧疆绮杞崲骞村害 List<Api1404> api1404List = api1404Rep.getDataByJhmxdh(apiData.getJhmxh()); - if(null != api1404List && api1404List.size() >0){ - api1205.setLhnd(api1404List.get(0).getShnd()); + if (null != api1404List && api1404List.size() > 0) { + 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()); + } + } } //璁剧疆鎵规鍙� - api1205.setPch(apiData.getHwdm() + apiData.getShnd()); + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1205.getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1205.setPch(apiData.getHwdm() + api1208List.get(0).getShnd()); + } //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1205); @@ -446,15 +574,22 @@ Api1206 apiData = (Api1206) data; BeanUtils.copyProperties(apiData, api1206); api1206.setBjw(ShAreaBjw.getBjw(code)); -// List<Api1205> api1205List = api1205Rep.getDataById(apiData.getCkjsdh()); - //璁剧疆鎵规鍙� -// api1206.setPch(api1205List.get(0).getHwdm() + DateFormatUtils.format(api1205List.get(0).getCmsj(), "yyyy")); - + //鎵规鍙� + if (StringUtils.isNotEmpty(api1206.getHth())) { + List<Api1205> api1205List = api1205Rep.getDataByCkjsdh(api1206.getCkjsdh()); + if (null != api1205List && api1205List.size() > 0) { + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1205List.get(0).getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1206.setPch(api1208List.get(0).getHwdm() + api1208List.get(0).getShnd()); + } + } + } //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1206); return api1206; } if (SH2023Constant.SH_2023_API_CODE_1207.equals(inteId)) { + //鍊掍粨鍊掑嚭 SH2023Api1207 api1207 = new SH2023Api1207(); Api1207 apiData = (Api1207) data; BeanUtils.copyProperties(apiData, api1207); @@ -462,8 +597,10 @@ api1207.setDcrq(apiData.getDcrq()); api1207.setBjw(ShAreaBjw.getBjw(code)); - api1207.setPch(apiData.getDchwdm() + DateFormatUtils.format(apiData.getDcrq(), "yyyy")); - api1207.setKddh(apiData.getDcdh().substring(21, 33)); + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1207.getDchwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1207.setPch(api1207.getDchwdm() + api1208List.get(0).getShnd()); + } //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1207); @@ -481,6 +618,13 @@ if (StringUtils.isEmpty(api1208.getCd())) { api1208.setCd(api1208.getHwdm().substring(2, 8)); } + //鍖呰鍌ㄧ伯鏄紝鏍告煡鍖呭瓨绮寘鏁� + if(null == apiData.getBclbs()){ + apiData.setBclbs(0); + } + if("2".equals(apiData.getClfs()) && apiData.getBclbs() == 0){ + apiData.setBclbs((int)(apiData.getSjsl()/25)); + } //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1208); return api1208; @@ -496,7 +640,13 @@ api1209.setZrshde(apiData.getQzzrshde()); api1209.setBjw(ShAreaBjw.getBjw(code)); api1209.setJzrq(apiData.getYwrq()); - api1209.setPch(apiData.getHwdm() + DateFormatUtils.format(apiData.getYwrq(), "yyyy")); + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1209.getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1209.setPch(api1209.getHwdm() + api1208List.get(0).getShnd()); + } + + //绮鎬ц川,鏆傛椂榛樿鍖虹骇鍌ㄥ + api1209.setLsxzdm("122"); //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1209); @@ -508,7 +658,28 @@ BeanUtils.copyProperties(apiData, api1210); api1210.setBjw(ShAreaBjw.getBjw(code)); - api1210.setPch(apiData.getHwdm() + DateFormatUtils.format(apiData.getHzrq(), "yyyy")); + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1210.getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1210.setPch(apiData.getHwdm() + api1208List.get(0).getShnd()); + } + + //鑻ヨ鍒掓槑缁嗗彿涓虹┖锛岃缃鍒掓槑缁嗗彿锛屾牴鎹垝杞�ц川鏌ヨ鍑哄叆搴撲俊鎭幏鍙栬鍒掑彿 + if(StringUtils.isEmpty(api1210.getJhmxdh())){ + if("200".equals(api1210.getHzqlsxzdm())){ + //鑻ュ垝杞墠鎬ц川涓哄晢鍝佺伯锛屽垯鏌ヨ鍏ュ簱淇℃伅鑾峰彇璁″垝鏄庣粏鍙� + List<Api1202> api1202List = api1202Rep.getDataByHwdmAndTime(api1210.getHwdm(), api1210.getHzrq()); + if (null != api1202List && api1202List.size() > 0) { + api1210.setJhmxdh(api1202List.get(0).getJhmxh()); + } + } + if("200".equals(api1210.getHzhlsxzdm())){ + //鑻ュ垝杞悗鎬ц川涓哄晢鍝佺伯锛屽垯鏌ヨ鍑哄簱淇℃伅鑾峰彇璁″垝鏄庣粏鍙� + List<Api1205> api1205List = api1205Rep.getDataByHwdmAndTime(api1210.getHwdm(), api1210.getHzrq()); + if (null != api1205List && api1205List.size() > 0) { + api1210.setJhmxdh(api1205List.get(0).getJhmxh()); + } + } + } //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1210); @@ -522,8 +693,12 @@ api1211.setZglkdm(api1211.getKqdm()); api1211.setBjw(ShAreaBjw.getBjw(code)); api1211.setPch(apiData.getHwdm() + DateFormatUtils.format(apiData.getYwrq(), "yyyyMM")); + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1211.getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1211.setPch(apiData.getHwdm() + api1208List.get(0).getShnd()); + } + //涓荤绮簱浠g爜 api1211.setZglkdm(apiData.getKqdm()); - //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1211); return api1211; @@ -551,12 +726,14 @@ Api1302 apiData = (Api1302) data; BeanUtils.copyProperties(apiData, api1302); api1302.setBjw(ShAreaBjw.getBjw(code)); - api1302.setPch(apiData.getHwdm() + DateFormatUtils.format(apiData.getJcsj(), "yyyy")); - api1302.setCpjw(String.valueOf(apiData.getLspjw())); - api1302.setCzgw(String.valueOf(apiData.getLspjw())); - api1302.setCzdw(String.valueOf(apiData.getLspjw())); - api1302.setGfwjw(String.valueOf(apiData.getLspjw())); - api1302.setLwmx(apiData.getLswdzjh()); + api1302.setLqjs("1"); + //鎵规鍙� + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1302.getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1302.setPch(apiData.getHwdm() + api1208List.get(0).getShnd()); + } + //缁熻灞傞珮銆佸眰浣庛�佸眰鍧囨俯绛変俊鎭� + api1302 = packageData1302(api1302); //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1302); @@ -567,8 +744,10 @@ Api1303 apiData = (Api1303) data; BeanUtils.copyProperties(apiData, api1303); api1303.setBjw(ShAreaBjw.getBjw(code)); - api1303.setPch(apiData.getHwdm() + DateFormatUtils.format(apiData.getJcsj(), "yyyy")); - + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1303.getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1303.setPch(apiData.getHwdm() + api1208List.get(0).getShnd()); + } //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1303); return api1303; @@ -578,7 +757,10 @@ Api1304 apiData = (Api1304) data; BeanUtils.copyProperties(apiData, api1304); api1304.setBjw(ShAreaBjw.getBjw(code)); - api1304.setPch(apiData.getHwdm() + DateFormatUtils.format(apiData.getJcsj(), "yyyy")); + List<Api1208> api1208List = api1208Rep.findDataByHwdm(api1304.getHwdm()); + if (null != api1208List && api1208List.size() > 0) { + api1304.setPch(apiData.getHwdm() + api1208List.get(0).getShnd()); + } //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1304); @@ -660,10 +842,10 @@ api1310.setJyxmz("0"); } String lsxzdm = "122"; - String pch = apiData.getHwdm() + DateFormatUtils.format(new Date(), "yyyy"); + String pch = ""; List<Api1208> api1208List = api1208Rep.getDataByHwdm(api1310.getHwdm()); - if(null != api1208List && api1208List.size() > 0){ - if(StringUtils.isNotEmpty(api1208List.get(0).getLsxzdm())){ + if (null != api1208List && api1208List.size() > 0) { + if (StringUtils.isNotEmpty(api1208List.get(0).getLsxzdm())) { lsxzdm = api1208List.get(0).getLsxzdm(); pch = apiData.getHwdm() + api1208List.get(0).getShnd(); } @@ -671,17 +853,20 @@ //璁剧疆鎵规鍙� api1310.setPch(pch); api1310.setLsxzdm(lsxzdm); - if (api1310.getYpsl() == 0.0){ + if (api1310.getYpsl() == 0.0) { api1310.setYpsl(5.0); } - if(StringUtils.isEmpty(api1310.getQyrxm())){ + if (StringUtils.isEmpty(api1310.getQyrxm())) { api1310.setQyrxm("鎵︽牱浜�"); } - if(StringUtils.isEmpty(api1310.getJdrxm())){ + if (StringUtils.isEmpty(api1310.getJdrxm())) { api1310.setJdrxm("鐩戠潱浜�"); } - if(StringUtils.isEmpty(api1310.getShrxm())){ + if (StringUtils.isEmpty(api1310.getShrxm())) { api1310.setShrxm("瀹℃牳浜�"); + } + if (StringUtils.isEmpty(api1310.getBglx())) { + api1310.setBglx("1"); } //璁剧疆绌哄睘鎬т负榛樿鍊� @@ -725,6 +910,22 @@ api1403.setJhzxdwmc(api1101List.get(0).getDwmc()); api1403.setBjw(ShAreaBjw.getBjw(code)); + //鏌ヨ杞崲璁″垝鐨勮疆鍏ユ暟閲忓拰杞嚭鏁伴噺 + List<Api1404> list = api1404Rep.getDataByLhjhdh(api1403.getLhjhdh()); + Double lrsl = 0.0, lcsl = 0.0; //鐢ㄤ簬缁熻杞叆鏁伴噺鍜岃疆鍑烘暟閲� + if(null != list && list.size() > 0){ + for (Api1404 api1404 : list) { + if(null!= api1404.getLhlx() && "2".equals(api1404.getLhlx())){ + lrsl += api1404.getLhsl(); + } + if(null!= api1404.getLhlx() && "1".equals(api1404.getLhlx())){ + lcsl += api1404.getLhsl(); + } + } + } + api1403.setLrsl(lrsl + ""); + api1403.setLcsl(lcsl + ""); + //璁剧疆绌哄睘鎬т负榛樿鍊� changeObject(api1403); return api1403; @@ -745,9 +946,15 @@ return data; } if (SH2023Constant.SH_2023_API_CODE_2102.equals(inteId)) { + SH2023Api2102 apiData = new SH2023Api2102(); + BeanUtils.copyProperties(data, apiData); + List<Api1208> api1208List = api1208Rep.findDataByHwdm(apiData.getDrhwdm()); + if (null != api1208List && api1208List.size() > 0) { + apiData.setPch(apiData.getDrhwdm() + api1208List.get(0).getShnd()); + } //璁剧疆绌哄睘鎬т负榛樿鍊� - changeObject(data); - return data; + changeObject(apiData); + return apiData; } if (SH2023Constant.SH_2023_API_CODE_2103.equals(inteId)) { SH2023Api2103 apiData = new SH2023Api2103(); @@ -777,16 +984,141 @@ return data; } - private String getWjmc(String wjlx, String wjmc){ - if("2".equals(wjlx) || "3".equals(wjlx) || "4".equals(wjlx) || "5".equals(wjlx)){ - if(wjmc.endsWith(".jpg")) { - wjmc = wjmc.replaceAll(".jpg", "_00.jpg"); + /** + * 璧嬪�兼渶鍚庢洿鏂版椂闂� + * @param object + * @return + */ + private Object setZhgxsjValue(Object object) { + // 浣跨敤鍙嶅皠鑾峰彇灞炴�у垪琛� vo涓哄疄浣撳璞″悕 + try { + Field zhgxsj = object.getClass().getDeclaredField("zhgxsj"); + zhgxsj.setAccessible(true); + zhgxsj.set(object, new Date()); + } catch (Exception e) { + e.printStackTrace(); + } + return object; + } + + /** + * 鏍规嵁涓婃捣鏁版嵁鏍煎紡杩涜灏佽 + * 灞傚潎娓╋細 + * 灞傞珮娓╋細 + * 灞備綆娓╋細 + * 鍚勮寖鍥村潎娓╋細 + * 绮俯鏄庣粏锛� + * 绮俯鐘舵�侊細 + * 寮傚父鐐逛釜鏁帮細 + * + * @param data + * @return + */ + private SH2023Api1302 packageData1302(SH2023Api1302 data) { + if (StringUtils.isEmpty(data.getLswdzjh())) { + return data; + } + String lswdzjh = data.getLswdzjh(); + String[] split = lswdzjh.split("\\|"); + Map<Integer, List<Double>> map = new HashMap<>(); + Integer ceng; + Integer errorNum = 0; //寮傚父鐐逛釜鏁� + String lwmx = ""; //绮俯鏄庣粏 + String lwzt = "0"; //绮俯鐘舵�� + String gfwjw = ""; //鍚勮寖鍥村潎娓� + for (String s : split) { + String[] grain = s.split(","); + ceng = Integer.valueOf(grain[1]); + if (null == map.get(ceng)) { + map.put(ceng, new ArrayList<>()); } - if(wjmc.endsWith(".png")) { - wjmc = wjmc.replaceAll(".png", "_00.png"); + map.get(ceng).add(Double.valueOf(grain[0])); + lwmx += grain[2] + ":" + grain[3] +":" + grain[1] + "$" + grain[0]; + if (Double.valueOf(grain[0]) <= -100) { + lwmx += "$" + "1" + "#"; + errorNum++; + } else { + lwmx += "$" + "5" + "#"; } } - return wjmc; + String cpjw = ""; //灞傚钩鍧囨俯 + String czgw = ""; //灞傛渶楂樻俯 + String czdw = ""; //灞傛渶浣庢俯 + + List<Double> payPoints; + Double sum; + int num; + Double tempH; + Double tempL; + Double tempA; + Double tempValue1 = 0.0; //鑼冨洿鍧囨俯1 + Double tempValue2 = 0.0; //鑼冨洿鍧囨俯2 + Double tempValue3 = 0.0; //鑼冨洿鍧囨俯3 + Integer numValue = 0; //璁$畻鑼冨洿鍧囨俯 + for (Integer cengNum : map.keySet()) { + payPoints = map.get(cengNum); + sum = 0.0; + num = 0; + tempH = null; + tempL = null; + tempA = 0.0; + for (Double point : payPoints) { + if(point > -100){ + sum += point; + num++; + if (tempH == null) { + tempH = point; + } + if (tempL == null) { + tempL = point; + } + if (tempH < point) { + tempH = point; + } + if (tempL > point) { + tempL = point; + } + } + } + if (num > 0) { + tempA = sum / num; + } + cpjw += cengNum + "$" + NumberUtil.keepPrecision(tempA, 1) + "#"; + czgw += cengNum + "$" + tempH + "#"; + czdw += cengNum + "$" + tempL + "#"; + //鑼冨洿鍧囨俯灏佽 + if (cengNum == 1) { + tempValue1 = NumberUtil.keepPrecision(tempA, 1); + } else if (cengNum == map.keySet().size()) { + tempValue3 = NumberUtil.keepPrecision(tempA, 1); + } else { + tempValue2 += tempA; + numValue++; + } + } + + if (errorNum > 0) { + lwzt = "2"; + } + if (numValue > 0) { + tempValue2 = NumberUtil.keepPrecision(tempValue2 / numValue, 1); + } + gfwjw += tempValue1 + "#"; + if (map.keySet().size() == 2) { + gfwjw += tempValue3 + "#"; + } + if (map.keySet().size() > 3) { + gfwjw += tempValue2 + "#" + tempValue3 + "#"; + } + data.setCpjw(cpjw); + data.setCzgw(czgw); + data.setCzdw(czdw); + data.setGfwjw(gfwjw); + data.setLwmx(lwmx); + data.setLwzt(lwzt); + data.setYcdgs(errorNum); + + return data; } /** @@ -807,35 +1139,14 @@ } } - /** - * Object绫诲瀷杞彉涓篖ist - * - * @param obj - * @param clazz - * @param <T> - * @return - */ - public static <T> List<T> castList(Object obj, Class<T> clazz) { - List<T> result = new ArrayList<T>(); - if (obj instanceof List<?>) { - for (Object o : (List<?>) obj) { - result.add(clazz.cast(o)); - } - return result; - } - return null; - } - - - private List<SHFinanceDto> copyApi1503(Api1503 data) { - Api1503 api1503 = data; + private List<SHFinanceDto> copyApi1503(Api1503 api1503) { List<SHFinanceDto> list = new ArrayList<>(); SHFinanceDto shFinanceDto = new SHFinanceDto(); shFinanceDto.setDwdm(api1503.getDwdm()); shFinanceDto.setBbsj(DateFormatUtils.format(api1503.getBbsj(), "yyyyMMdd")); shFinanceDto.setBbm("03"); shFinanceDto.setCzbz(api1503.getCzbz()); - shFinanceDto.setZhgxsj(DateFormatUtils.format(api1503.getZhgxsj(), "yyyy-MM-dd HH:mm:ss")); + shFinanceDto.setZhgxsj(DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss")); paddingData(shFinanceDto, list, "椤圭洰//t", "鏈湡閲戦//t", "鏈勾绱//t"); paddingData(shFinanceDto, list, "涓�銆佽惀涓氭敹鍏�", api1503.getYyzsrbqye() + "", api1503.getYyzsrbnlj() + ""); @@ -878,15 +1189,14 @@ return list; } - private List<SHFinanceDto> copyApi1502(Api1502 data) { - Api1502 api1502 = data; + private List<SHFinanceDto> copyApi1502(Api1502 api1502) { List<SHFinanceDto> list = new ArrayList<>(); SHFinanceDto shFinanceDto = new SHFinanceDto(); shFinanceDto.setDwdm(api1502.getDwdm()); shFinanceDto.setBbsj(DateFormatUtils.format(api1502.getBbsj(), "yyyyMMdd")); shFinanceDto.setBbm("02"); shFinanceDto.setCzbz(api1502.getCzbz()); - shFinanceDto.setZhgxsj(DateFormatUtils.format(api1502.getZhgxsj(), "yyyy-MM-dd HH:mm:ss")); + shFinanceDto.setZhgxsj(DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss")); paddingData(shFinanceDto, list, "椤圭洰//t", "鏈湀鏁�//t", "鏈勾绱鏁�//t"); paddingData(shFinanceDto, list, "涓�銆佺粡钀ユ椿鍔ㄤ骇鐢熺殑鐜伴噾娴侀噺锛�", api1502.getJyhdxjllbys() + "", api1502.getJyhdxjllbnljs() + ""); @@ -931,15 +1241,14 @@ return list; } - private List<SHFinanceDto> copyApi1501(Api1501 data) { - Api1501 api1501 = data; + private List<SHFinanceDto> copyApi1501(Api1501 api1501) { List<SHFinanceDto> list = new ArrayList<>(); SHFinanceDto shFinanceDto = new SHFinanceDto(); shFinanceDto.setDwdm(api1501.getDwdm()); shFinanceDto.setBbsj(DateFormatUtils.format(api1501.getBbsj(), "yyyyMMdd")); shFinanceDto.setBbm("01"); shFinanceDto.setCzbz(api1501.getCzbz()); - shFinanceDto.setZhgxsj(DateFormatUtils.format(api1501.getZhgxsj(), "yyyy-MM-dd HH:mm:ss")); + shFinanceDto.setZhgxsj(DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss")); paddingData(shFinanceDto, list, "璧勪骇//t", "鏈熸湯浣欓//t", "骞村垵浣欓//t"); paddingData(shFinanceDto, list, "娴佸姩璧勪骇锛�", api1501.getLdzchjqmye() + "", api1501.getLdzchjncye() + ""); @@ -1029,6 +1338,25 @@ list.add(shFinanceDto); } + private String getWjmc(String wjlx, String wjmc) { + if ("2".equals(wjlx) || "3".equals(wjlx) || "4".equals(wjlx) || "5".equals(wjlx)) { + if (wjmc.endsWith(".jpg")) { + wjmc = wjmc.replaceAll(".jpg", "_00.jpg"); + } + if (wjmc.endsWith(".png")) { + wjmc = wjmc.replaceAll(".png", "_00.png"); + } + } + return wjmc; + } + private String getYwdh(String wjlx, String wjmc, String ywdh) { + String[] s = wjmc.split("_"); + if ("2".equals(wjlx) || "3".equals(wjlx)) { + ywdh = s[1]; + } + return ywdh; + } + private Object changeObject(Object object) { // 浣跨敤鍙嶅皠鑾峰彇灞炴�у垪琛� vo涓哄疄浣撳璞″悕 Field[] fields = object.getClass().getDeclaredFields(); @@ -1057,4 +1385,5 @@ } return object; } + } \ No newline at end of file -- Gitblit v1.9.3