| | |
| | | @Autowired |
| | | private ApiLogRep apiLogRep; |
| | | @Autowired |
| | | private Api1101Rep api1101Rep; |
| | | @Autowired |
| | | private Api1102Rep api1102Rep; |
| | | @Autowired |
| | | private Api1104Rep api1104Rep; |
| | |
| | | private Api1202Rep api1202Rep; |
| | | @Autowired |
| | | private Api1205Rep api1205Rep; |
| | | @Autowired |
| | | private Api1404Rep api1404Rep; |
| | | |
| | | @Override |
| | | public String getProtocol() { |
| | |
| | | reqData.setData(ShRSAUtils.encryptByPubKey(jsonData, conf.getPublicKey())); |
| | | //摘要,数据主体的MD5值 |
| | | reqData.setDigst(MyMD5Util.encrypt(jsonData)); |
| | | |
| | | log.info("上报数据信息=" + JSON.toJSONString(reqData)); |
| | | SH2023RespDto responseDto = SH2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, JSON.toJSONString(reqData), conf); |
| | | |
| | | apiLog.setStatus(responseDto.getCode() == 200 ? 0 : responseDto.getCode()); |
| | |
| | | map.put(apiData.getWjmc(), FileUtils.fileToByteString(apiData.getWjdz())); |
| | | api1109.setWjl(JSON.toJSONString(map)); |
| | | //上海市平台文件名称规则:库区编码_业务流水号_分类码_顺序码.jpg,例如:91310114703439394M001_142211080101_GL_00.jpg |
| | | api1109.setWjmc(getWjmc(api1109.getWjmc())); |
| | | api1109.setWjmc(getWjmc(api1109.getWjlx(), api1109.getWjmc())); |
| | | //设置空属性为默认值 |
| | | changeObject(api1109); |
| | | return api1109; |
| | |
| | | Api1202 apiData = (Api1202) data; |
| | | BeanUtils.copyProperties(apiData, api1202); |
| | | api1202.setBjw(ShAreaBjw.getBjw(code)); |
| | | api1202.setPch(apiData.getHwdm() + apiData.getShnd()); |
| | | api1202.setJzrq(apiData.getCmsj()); |
| | | if (StringUtils.isEmpty(api1202.getCddm())) { |
| | | api1202.setCddm(api1202.getHwdm().substring(2, 8)); |
| | |
| | | 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()); |
| | | } |
| | | |
| | | //设置批次号 |
| | | api1202.setPch(apiData.getHwdm() + apiData.getShnd()); |
| | | //设置空属性为默认值 |
| | | changeObject(api1202); |
| | | return api1202; |
| | |
| | | Api1203 apiData = (Api1203) data; |
| | | BeanUtils.copyProperties(apiData, api1203); |
| | | api1203.setBjw(ShAreaBjw.getBjw(code)); |
| | | //查询收获年份 |
| | | List<Api1202> api1202List = api1202Rep.getDataById(apiData.getRkywdh()); |
| | | api1203.setPch(apiData.getHwdm() + api1202List.get(0).getShnd()); |
| | | if (StringUtils.isEmpty(api1203.getJyxm())) { |
| | | api1203.setJyxm("0"); |
| | | } |
| | |
| | | if (StringUtils.isEmpty(api1203.getZkl())) { |
| | | api1203.setZkl("0"); |
| | | } |
| | | //设置批次号 |
| | | List<Api1202> api1202List = api1202Rep.getDataById(apiData.getRkywdh()); |
| | | api1203.setPch(apiData.getHwdm() + api1202List.get(0).getShnd()); |
| | | |
| | | //设置空属性为默认值 |
| | | changeObject(api1203); |
| | | return api1203; |
| | |
| | | Api1204 apiData = (Api1204) data; |
| | | BeanUtils.copyProperties(apiData, api1204); |
| | | api1204.setBjw(ShAreaBjw.getBjw(code)); |
| | | |
| | | //设置批次号 |
| | | api1204.setPch(apiData.getHwdm() + DateFormatUtils.format(apiData.getJssj(), "yyyy")); |
| | | |
| | | //设置空属性为默认值 |
| | |
| | | Api1205 apiData = (Api1205) data; |
| | | BeanUtils.copyProperties(apiData, api1205); |
| | | api1205.setBjw(ShAreaBjw.getBjw(code)); |
| | | api1205.setPch(apiData.getHwdm() + DateFormatUtils.format(apiData.getCmsj(), "yyyy")); |
| | | |
| | | api1205.setJzrq(apiData.getCmsj()); |
| | | if (StringUtils.isEmpty(api1205.getCddm())) { |
| | | api1205.setCddm(api1205.getHwdm().substring(2, 8)); |
| | |
| | | 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()); |
| | | } |
| | | |
| | | //设置批次号 |
| | | api1205.setPch(apiData.getHwdm() + apiData.getShnd()); |
| | | |
| | | //设置空属性为默认值 |
| | | changeObject(api1205); |
| | | return api1205; |
| | |
| | | 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")); |
| | | // List<Api1205> api1205List = api1205Rep.getDataById(apiData.getCkjsdh()); |
| | | //设置批次号 |
| | | // api1206.setPch(api1205List.get(0).getHwdm() + DateFormatUtils.format(api1205List.get(0).getCmsj(), "yyyy")); |
| | | |
| | | //设置空属性为默认值 |
| | | changeObject(api1206); |
| | |
| | | api1208.setZglkdm(api1208.getHwdm().substring(0, 21)); |
| | | |
| | | api1208.setBjw(ShAreaBjw.getBjw(code)); |
| | | //设置批次号 |
| | | api1208.setPch(apiData.getHwdm() + apiData.getShnd()); |
| | | if (StringUtils.isEmpty(api1208.getCd())) { |
| | | api1208.setCd(api1208.getHwdm().substring(2, 8)); |
| | |
| | | BeanUtils.copyProperties(apiData, api1307); |
| | | api1307.setBjw(ShAreaBjw.getBjw(code)); |
| | | api1307.setAjdm(apiData.getHwdm().substring(0, 28)); |
| | | List<Api1109> api1109List = api1109Rep.getDataByFileId(apiData.getFileStorageId()); |
| | | api1307.setTxbh(api1109List.get(0).getWjmc()); |
| | | |
| | | //设置空属性为默认值 |
| | | changeObject(api1307); |
| | |
| | | |
| | | BeanUtils.copyProperties(apiData, api1308); |
| | | api1308.setBjw(ShAreaBjw.getBjw(code)); |
| | | List<Api1109> api1109List = api1109Rep.getDataByFileId(apiData.getFileStorageId()); |
| | | api1308.setTxbh(api1109List.get(0).getWjmc()); |
| | | api1308.setSpbh(api1109List.get(0).getWjmc()); |
| | | |
| | | //设置空属性为默认值 |
| | | changeObject(api1308); |
| | |
| | | BeanUtils.copyProperties(apiData, api1310); |
| | | api1310.setBjw(ShAreaBjw.getBjw(code)); |
| | | api1310.setJyrq(apiData.getJysj()); |
| | | |
| | | if (StringUtils.isEmpty(api1310.getJyxm())) { |
| | | api1310.setJyxm("0"); |
| | | } |
| | |
| | | api1310.setJyxmz("0"); |
| | | } |
| | | String lsxzdm = "122"; |
| | | String pch = apiData.getHwdm() + DateFormatUtils.format(new Date(), "yyyy"); |
| | | List<Api1208> api1208List = api1208Rep.getDataByHwdm(api1310.getHwdm()); |
| | | 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(); |
| | | } |
| | | } |
| | | //设置批次号 |
| | | api1310.setPch(pch); |
| | | api1310.setLsxzdm(lsxzdm); |
| | | if (api1310.getYpsl() == 0.0){ |
| | | api1310.setYpsl(5.0); |
| | |
| | | if(StringUtils.isEmpty(api1310.getShrxm())){ |
| | | api1310.setShrxm("审核人"); |
| | | } |
| | | |
| | | //设置空属性为默认值 |
| | | changeObject(api1310); |
| | | return api1310; |
| | |
| | | SH2023Api1403 api1403 = new SH2023Api1403(); |
| | | Api1403 apiData = (Api1403) data; |
| | | BeanUtils.copyProperties(apiData, api1403); |
| | | api1403.setJhzxdw(apiData.getJhxddw()); |
| | | api1403.setJhzxdwmc(apiData.getJhxddwmc()); |
| | | List<Api1101> api1101List = api1101Rep.findDataByDwdm(apiData.getLhjhdh().substring(0, 18)); |
| | | |
| | | api1403.setJhzxdw(api1101List.get(0).getDwdm()); |
| | | api1403.setJhzxdwmc(api1101List.get(0).getDwmc()); |
| | | api1403.setBjw(ShAreaBjw.getBjw(code)); |
| | | |
| | | //设置空属性为默认值 |
| | |
| | | return data; |
| | | } |
| | | |
| | | private String getWjmc(String wjmc){ |
| | | if(wjmc.endsWith(".jpg")) { |
| | | wjmc = wjmc.replaceAll(".jpg", "_00.jpg"); |
| | | } |
| | | if(wjmc.endsWith(".png")) { |
| | | wjmc = wjmc.replaceAll(".png", "_00.png"); |
| | | 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; |
| | | } |