| | |
| | | import com.fzzy.api.service.ApiRemoteService; |
| | | import com.fzzy.api.service.ApiTriggerService; |
| | | import com.fzzy.api.utils.*; |
| | | import com.fzzy.api.view.repository.Api1208Rep; |
| | | import com.fzzy.api.view.repository.Api1404Rep; |
| | | import com.fzzy.api.view.repository.ApiLogRep; |
| | | |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | private ApiCommonService apiCommonService; |
| | | @Autowired |
| | | private ApiTriggerService apiTriggerService; |
| | | @Autowired |
| | | private Api1208Rep api1208Rep; |
| | | @Autowired |
| | | private ApiLogRep apiLogRep; |
| | | @Autowired |
| | |
| | | //获取指令id |
| | | String key = RedisConst.buildKey(RedisConst.KYE_ORDER, conf.getKqdm()); |
| | | String orderId = (String) redisUtil.get(key); |
| | | if (StringUtils.isEmpty(orderId)) { |
| | | log.error("指令id失效"); |
| | | ResponseDto responseDto = new ResponseDto(99, "指令id失效"); |
| | | apiLog.setStatus(99); |
| | | apiLog.setResult("指令id失效"); |
| | | apiLogRep.save(apiLog); |
| | | return responseDto; |
| | | } |
| | | // if (StringUtils.isEmpty(orderId)) { |
| | | // log.error("指令id失效"); |
| | | // ResponseDto responseDto = new ResponseDto(99, "指令id失效"); |
| | | // apiLog.setStatus(99); |
| | | // apiLog.setResult("指令id失效"); |
| | | // apiLogRep.save(apiLog); |
| | | // return responseDto; |
| | | // } |
| | | |
| | | //封装推送数据 |
| | | SX2024ReqDto reqData = new SX2024ReqDto(); |
| | |
| | | BeanUtils.copyProperties(data, apiData); |
| | | //设置統一仓房编码 |
| | | if (StringUtils.isEmpty(apiData.getTycfbm())) { |
| | | String tycfbm = apiCommonService.getTykqbm(apiData.getCfbh()); |
| | | String tycfbm = apiCommonService.getTycfbm(apiData.getCfbh()); |
| | | apiData.setTycfbm(tycfbm); |
| | | } |
| | | //设置統一廒间名称 |
| | |
| | | } |
| | | //设置文件流 |
| | | apiData.setWjl(FileUtils.fileToByteString(api1109.getWjdz())); |
| | | //设置文件名称:统一库区编码加三维顺序号 |
| | | //设置文件名称:统一库区编码_ |
| | | if (apiData.getWjmc().startsWith(apiData.getKqdm())) { |
| | | apiData.setWjmc(apiData.getWjmc().replace(apiData.getKqdm(), apiData.getTykqbm())); |
| | | } |
| | |
| | | if (apiData.getHth().startsWith(apiData.getHwdm().substring(0, 21))) { |
| | | apiData.setHth(apiData.getHth().replace(apiData.getHwdm().substring(0, 21), apiData.getTyhwbm().substring(0, 22))); |
| | | } |
| | | //设置入库结算单号:统一库区编码+yyyyMMdd+三位顺序号 |
| | | if (apiData.getRkjsdh().startsWith(api1202.getKqdm())) { |
| | | apiData.setRkjsdh(apiData.getRkjsdh().replace(api1202.getKqdm(), apiData.getTyhwbm().substring(0, 22))); |
| | | } |
| | | return apiData; |
| | | } |
| | | if (Constant.API_CODE_1203.equals(inteId)) { |
| | |
| | | if (apiData.getHth().startsWith(apiData.getHwdm().substring(0, 21))) { |
| | | apiData.setHth(apiData.getHth().replace(apiData.getHwdm().substring(0, 21), apiData.getTyhwbm().substring(0, 22))); |
| | | } |
| | | //设置出库结算单号:统一库区编码+yyyyMMdd+三位顺序号 |
| | | if (apiData.getCkjsdh().startsWith(apiData.getHwdm().substring(0, 21))) { |
| | | String tykqbm = apiCommonService.getTykqbm(apiData.getHwdm().substring(0, 21)); |
| | | apiData.setCkjsdh(apiData.getCkjsdh().replace(apiData.getHwdm().substring(0, 21), tykqbm)); |
| | | } |
| | | return apiData; |
| | | } |
| | | if (Constant.API_CODE_1206.equals(inteId)) { |
| | |
| | | BeanUtils.copyProperties(api1207, apiData); |
| | | //设置倒出库区统一编码 |
| | | if (StringUtils.isEmpty(apiData.getDckqtybm())) { |
| | | String dckqtybm = apiCommonService.getTykqbm(apiData.getDchwdm().substring(0, 21)); |
| | | String dckqtybm = apiCommonService.getTykqbm(apiData.getDcdw()); |
| | | apiData.setDckqtybm(dckqtybm); |
| | | } |
| | | //设置倒入库区统一编码 |
| | | if (StringUtils.isEmpty(apiData.getDrkqtybm())) { |
| | | String drkqtybm = apiCommonService.getTykqbm(apiData.getDrhwdm().substring(0, 21)); |
| | | String drkqtybm = apiCommonService.getTykqbm(apiData.getDrdw()); |
| | | apiData.setDrkqtybm(drkqtybm); |
| | | } |
| | | //设置倒出货位统一编码 |
| | |
| | | } |
| | | //设置粮权单位統一编码 |
| | | if (StringUtils.isEmpty(apiData.getLqgstydwbm())) { |
| | | String tydwbm = apiCommonService.getTydwbm(apiData.getHwdm()); |
| | | String tydwbm = apiCommonService.getTydwbm(apiData.getLqgsdwdm()); |
| | | apiData.setLqgstydwbm(tydwbm); |
| | | } |
| | | return apiData; |
| | |
| | | } |
| | | //实际损耗数量赋值 |
| | | apiData.setSjsysl(api1209.getJzsysl()); |
| | | |
| | | //设置品种、性质、等级、年度 |
| | | List<Api1208> api1208List = api1208Rep.findDataByHwdm(apiData.getHwdm()); |
| | | if (null != api1208List && api1208List.size() > 0) { |
| | | apiData.setLspzdm(api1208List.get(0).getLspzdm()); |
| | | apiData.setLsxzdm(api1208List.get(0).getLsxzdm()); |
| | | apiData.setLsdjdm(api1208List.get(0).getLsdjdm()); |
| | | apiData.setShnd(api1208List.get(0).getShnd()); |
| | | } |
| | | return apiData; |
| | | } |
| | | if (Constant.API_CODE_1210.equals(inteId)) { |
| | |
| | | Api1504 api1504 = (Api1504)data; |
| | | SX2024Api1504 apiData = new SX2024Api1504(); |
| | | BeanUtils.copyProperties(api1504, apiData); |
| | | //设置統一单位编码 |
| | | if (StringUtils.isEmpty(apiData.getXqydm())) { |
| | | String tydwbm = apiCommonService.getTydwbm(apiData.getCOrgCode()); |
| | | apiData.setXqydm(tydwbm); |
| | | } |
| | | //设置統一库区编码 |
| | | if (StringUtils.isEmpty(apiData.getXkqdm())) { |
| | | String tykqbm = apiCommonService.getTykqbm(api1504.getKqdm()); |
| | | apiData.setXkqdm(tykqbm); |
| | | } |
| | | return data; |
| | | return apiData; |
| | | } |
| | | if (Constant.API_CODE_1505.equals(inteId)) { |
| | | Api1505 api1505 = (Api1505)data; |
| | | SX2024Api1505 apiData = new SX2024Api1505(); |
| | | BeanUtils.copyProperties(data, apiData); |
| | | return data; |
| | | BeanUtils.copyProperties(api1505, apiData); |
| | | apiData.setCqunit(api1505.getCqunit() + ""); |
| | | return apiData; |
| | | } |
| | | if (Constant.API_CODE_1506.equals(inteId)) { |
| | | SX2024Api1506 apiData = new SX2024Api1506(); |
| | | BeanUtils.copyProperties(data, apiData); |
| | | return data; |
| | | return apiData; |
| | | } |
| | | if (Constant.API_CODE_1507.equals(inteId)) { |
| | | SX2024Api1507 apiData = new SX2024Api1507(); |
| | | BeanUtils.copyProperties(data, apiData); |
| | | return data; |
| | | return apiData; |
| | | } |
| | | if (Constant.API_CODE_1508.equals(inteId)) { |
| | | SX2024Api1508 apiData = new SX2024Api1508(); |
| | | BeanUtils.copyProperties(data, apiData); |
| | | return data; |
| | | return apiData; |
| | | } |
| | | if (Constant.API_CODE_1509.equals(inteId)) { |
| | | SX2024Api1509 apiData = new SX2024Api1509(); |
| | | BeanUtils.copyProperties(data, apiData); |
| | | return data; |
| | | return apiData; |
| | | } |
| | | if (Constant.API_CODE_1510.equals(inteId)) { |
| | | SX2024Api1510 apiData = new SX2024Api1510(); |
| | | BeanUtils.copyProperties(data, apiData); |
| | | return data; |
| | | return apiData; |
| | | } |
| | | return data; |
| | | } |