| | |
| | | import com.fzzy.api.service.ApiTriggerService; |
| | | import com.fzzy.api.utils.*; |
| | | import com.fzzy.api.view.repository.*; |
| | | import com.fzzy.order.data.OrderData; |
| | | import com.fzzy.push.nx2023.dto.*; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Override |
| | | public ResponseDto pushData(ApiParam param, ApiConfs conf, Object data) { |
| | | String inteId = param.getInteId(); |
| | | String kqdm = param.getKqdm(); |
| | | //查询库区信息行政区划码 |
| | | List<Api1102> api1102List = api1102Rep.findPushData(kqdm); |
| | | |
| | | try { |
| | | if (null == conf) { |
| | | conf = apiCommonService.getConf(kqdm); |
| | |
| | | ApiLog apiLog = new ApiLog(); |
| | | apiLog.setId(ContextUtil.getUUID()); |
| | | |
| | | //若为财务1501、1502、1503接口,则接口编码填写1114 |
| | | if (NX2023Constant.NX_2023_API_CODE_1114_1501.equals(param.getInteId()) |
| | | || NX2023Constant.NX_2023_API_CODE_1114_1502.equals(param.getInteId()) |
| | | || NX2023Constant.NX_2023_API_CODE_1114_1503.equals(param.getInteId())) { |
| | | inteId = NX2023Constant.NX_2023_API_CODE_1114; |
| | | } |
| | | //获取接口编码 |
| | | String inteId = this.getInteId(param.getInteId()); |
| | | apiLog.setInteId(inteId); |
| | | |
| | | if (StringUtils.isEmpty(inteId)) { |
| | |
| | | reqData.setUid(conf.getUserName()); |
| | | //指令id |
| | | String key = RedisConst.buildKey(RedisConst.KYE_ORDER, conf.getKqdm()); |
| | | String orderId = reqData.getId(); |
| | | OrderData orderData = (OrderData) redisUtil.get(key); |
| | | if (null != orderData && StringUtils.isNotEmpty(orderData.getOrderid())) { |
| | | orderId = orderData.getOrderid(); |
| | | String orderId = (String) redisUtil.get(key); |
| | | if (StringUtils.isEmpty(orderId)) { |
| | | orderId = reqData.getId(); |
| | | } |
| | | reqData.setOrderid(orderId); |
| | | |
| | |
| | | //摘要,数据主体的MD5值 |
| | | reqData.setDigst(MyMD5Util.encrypt(jsonData)); |
| | | log.info("上报数据信息=" + JSON.toJSONString(reqData)); |
| | | Nx2023RespDto responseDto = NX2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, JSON.toJSONString(reqData), conf); |
| | | Nx2023RespDto responseDto = NX2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, JSON.toJSONString(reqData)); |
| | | |
| | | apiLog.setStatus(responseDto.getCode() == 200 ? 0 : responseDto.getCode()); |
| | | apiLog.setResult(responseDto.getResult()); |
| | |
| | | */ |
| | | private Object getJsonApiData(String inteId, Object data) { |
| | | if (NX2023Constant.NX_2023_API_CODE_1101.equals(inteId)) { |
| | | |
| | | Nx2023Api1101 api1101 = new Nx2023Api1101(); |
| | | BeanUtils.copyProperties(data, api1101); |
| | | return api1101; |
| | |
| | | if (NX2023Constant.NX_2023_API_CODE_1102.equals(inteId)) { |
| | | Nx2023Api1102 api1102 = new Nx2023Api1102(); |
| | | BeanUtils.copyProperties(data, api1102); |
| | | api1102.setLkxz("1"); |
| | | return api1102; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1103.equals(inteId)) { |
| | | Nx2023Api1103 api1103 = new Nx2023Api1103(); |
| | | BeanUtils.copyProperties(data, api1103); |
| | | return api1103; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1104.equals(inteId)) { |
| | | Nx2023Api1104 api1104 = new Nx2023Api1104(); |
| | | BeanUtils.copyProperties(data, api1104); |
| | | return api1104; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1105.equals(inteId)) { |
| | | Nx2023Api1105 api1105 = new Nx2023Api1105(); |
| | | BeanUtils.copyProperties(data, api1105); |
| | | return api1105; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1106.equals(inteId)) { |
| | | Nx2023Api1106 api1106 = new Nx2023Api1106(); |
| | | BeanUtils.copyProperties(data, api1106); |
| | | return api1106; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1107.equals(inteId)) { |
| | | Nx2023Api1107 api1107 = new Nx2023Api1107(); |
| | | BeanUtils.copyProperties(data, api1107); |
| | | return api1107; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1108.equals(inteId)) { |
| | | Nx2023Api1108 api1108 = new Nx2023Api1108(); |
| | |
| | | api1109.setWjl(JSON.toJSONString(map)); |
| | | return api1109; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1110.equals(inteId)) { |
| | | Nx2023Api1110 api1110 = new Nx2023Api1110(); |
| | | BeanUtils.copyProperties(data, api1110); |
| | | return api1110; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1111.equals(inteId)) { |
| | | Nx2023Api1111 api1111 = new Nx2023Api1111(); |
| | | BeanUtils.copyProperties(data, api1111); |
| | | return api1111; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1112.equals(inteId)) { |
| | | Api1112 apiData = (Api1112) data; |
| | | Nx2023Api1112 api1112 = new Nx2023Api1112(); |
| | | BeanUtils.copyProperties(data, api1112); |
| | | BeanUtils.copyProperties(apiData, api1112); |
| | | return api1112; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1113.equals(inteId)) { |
| | |
| | | return api1113; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1201.equals(inteId)) { |
| | | Api1201 apiData = (Api1201) data; |
| | | Nx2023Api1201 api1201 = new Nx2023Api1201(); |
| | | BeanUtils.copyProperties(data, api1201); |
| | | BeanUtils.copyProperties(apiData, api1201); |
| | | return api1201; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1202.equals(inteId)) { |
| | | Nx2023Api1202 api1202 = new Nx2023Api1202(); |
| | | BeanUtils.copyProperties(data, api1202); |
| | | return api1202; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1203.equals(inteId)) { |
| | | Nx2023Api1203 api1203 = new Nx2023Api1203(); |
| | | BeanUtils.copyProperties(data, api1203); |
| | | return api1203; |
| | | } |
| | | |
| | | if (NX2023Constant.NX_2023_API_CODE_1211.equals(inteId)) { |
| | | Nx2023Api1211 api1211 = new Nx2023Api1211(); |
| | | BeanUtils.copyProperties(data, api1211); |
| | | return api1211; |
| | | if (NX2023Constant.NX_2023_API_CODE_1204.equals(inteId)) { |
| | | Nx2023Api1204 api1204 = new Nx2023Api1204(); |
| | | BeanUtils.copyProperties(data, api1204); |
| | | return api1204; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1205.equals(inteId)) { |
| | | Nx2023Api1205 api1205 = new Nx2023Api1205(); |
| | | BeanUtils.copyProperties(data, api1205); |
| | | api1205.setSzlx("09"); |
| | | return api1205; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1206.equals(inteId)) { |
| | | Api1206 apiData = (Api1206) data; |
| | | Nx2023Api1206 api1206 = new Nx2023Api1206(); |
| | | BeanUtils.copyProperties(apiData, api1206); |
| | | return api1206; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1207.equals(inteId)) { |
| | | Nx2023Api1207 api1207 = new Nx2023Api1207(); |
| | | BeanUtils.copyProperties(data, api1207); |
| | | return api1207; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1208.equals(inteId)) { |
| | | Nx2023Api1208 api1208 = new Nx2023Api1208(); |
| | | BeanUtils.copyProperties(data, api1208); |
| | | return api1208; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1209.equals(inteId)) { |
| | | Nx2023Api1209 api1209 = new Nx2023Api1209(); |
| | | BeanUtils.copyProperties(data, api1209); |
| | | return api1209; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1210.equals(inteId)) { |
| | | Nx2023Api1210 api1210 = new Nx2023Api1210(); |
| | | BeanUtils.copyProperties(data, api1210); |
| | | return api1210; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1211.equals(inteId)) { |
| | | Nx2023Api1211 api1211 = new Nx2023Api1211(); |
| | | BeanUtils.copyProperties(data, api1211); |
| | | return api1211; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1212.equals(inteId)) { |
| | | Nx2023Api1212 api1212 = new Nx2023Api1212(); |
| | | BeanUtils.copyProperties(data, api1212); |
| | | return api1212; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1301.equals(inteId)) { |
| | | Nx2023Api1301 api1301 = new Nx2023Api1301(); |
| | | BeanUtils.copyProperties(data, api1301); |
| | | return api1301; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1302.equals(inteId)) { |
| | | Nx2023Api1302 api1302 = new Nx2023Api1302(); |
| | | BeanUtils.copyProperties(data, api1302); |
| | | return api1302; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1303.equals(inteId)) { |
| | | Nx2023Api1303 api1303 = new Nx2023Api1303(); |
| | | BeanUtils.copyProperties(data, api1303); |
| | | return api1303; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1304.equals(inteId)) { |
| | | Nx2023Api1304 api1304 = new Nx2023Api1304(); |
| | | BeanUtils.copyProperties(data, api1304); |
| | | return api1304; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1305.equals(inteId)) { |
| | | Nx2023Api1305 api1305 = new Nx2023Api1305(); |
| | | BeanUtils.copyProperties(data, api1305); |
| | | return api1305; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1306.equals(inteId)) { |
| | | Nx2023Api1306 api1306 = new Nx2023Api1306(); |
| | |
| | | BeanUtils.copyProperties(data, api1308); |
| | | return api1308; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1309.equals(inteId)) { |
| | | Nx2023Api1309 api1309 = new Nx2023Api1309(); |
| | | BeanUtils.copyProperties(data, api1309); |
| | | return api1309; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1310.equals(inteId)) { |
| | | Nx2023Api1310 api1310 = new Nx2023Api1310(); |
| | | BeanUtils.copyProperties(data, api1310); |
| | | return api1310; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1401.equals(inteId)) { |
| | | Nx2023Api1401 api1401 = new Nx2023Api1401(); |
| | | BeanUtils.copyProperties(data, api1401); |
| | | return api1401; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1402.equals(inteId)) { |
| | | Nx2023Api1402 api1402 = new Nx2023Api1402(); |
| | | BeanUtils.copyProperties(data, api1402); |
| | | return api1402; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1403.equals(inteId)) { |
| | | Nx2023Api1403 api1403 = new Nx2023Api1403(); |
| | | BeanUtils.copyProperties(data, api1403); |
| | | return api1403; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1404.equals(inteId)) { |
| | | Nx2023Api1404 api1404 = new Nx2023Api1404(); |
| | | BeanUtils.copyProperties(data, api1404); |
| | | return api1404; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1405.equals(inteId)) { |
| | | Nx2023Api1405 api1405 = new Nx2023Api1405(); |
| | | BeanUtils.copyProperties(data, api1405); |
| | | return api1405; |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | /** |
| | | * 获取上传的接口编码 |
| | | * @param inteId |
| | | * @return |
| | | */ |
| | | private String getInteId(String inteId) { |
| | | if (NX2023Constant.NX_2023_API_CODE_1114_1501.equals(inteId)) { |
| | | return NX2023Constant.NX_2023_API_CODE_1114; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1114_1502.equals(inteId)) { |
| | | return NX2023Constant.NX_2023_API_CODE_1114; |
| | | } |
| | | if (NX2023Constant.NX_2023_API_CODE_1114_1503.equals(inteId)) { |
| | | return NX2023Constant.NX_2023_API_CODE_1114; |
| | | } |
| | | return inteId; |
| | | } |
| | | |
| | | /** |
| | |
| | | try { |
| | | Field zhgxsj = object.getClass().getDeclaredField("zhgxsj"); |
| | | zhgxsj.setAccessible(true); |
| | | zhgxsj.set(object, new Date()); |
| | | zhgxsj.set(object, DateUtils.addSeconds(new Date(), -10)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private List<NxFinanceDto> copyApi1503(Api1503 data) { |
| | | Api1503 api1503 = data; |
| | | private List<NxFinanceDto> copyApi1503(Api1503 api1503) { |
| | | List<NxFinanceDto> list = new ArrayList<>(); |
| | | NxFinanceDto nxFinanceDto = new NxFinanceDto(); |
| | | nxFinanceDto.setDwdm(api1503.getDwdm()); |
| | | nxFinanceDto.setKqdm(api1503.getKqdm()); |
| | | |
| | | nxFinanceDto.setBbsj(DateFormatUtils.format(api1503.getBbsj(), "yyyyMMdd")); |
| | | nxFinanceDto.setBbm("03"); |
| | | nxFinanceDto.setCzbz(api1503.getCzbz()); |
| | | nxFinanceDto.setZhgxsj(DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss")); |
| | | nxFinanceDto.setZhgxsj(DateFormatUtils.format(DateUtils.addSeconds(new Date(), -10), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | paddingData(nxFinanceDto, list, "0", "项目//t", "本期金额//t", "本年累计//t"); |
| | | paddingData(nxFinanceDto, list, "1", "一、营业收入", api1503.getYyzsrbqye() + "", api1503.getYyzsrbnlj() + ""); |
| | |
| | | return list; |
| | | } |
| | | |
| | | private List<NxFinanceDto> copyApi1502(Api1502 data) { |
| | | Api1502 api1502 = data; |
| | | private List<NxFinanceDto> copyApi1502(Api1502 api1502) { |
| | | List<NxFinanceDto> list = new ArrayList<>(); |
| | | NxFinanceDto nxFinanceDto = new NxFinanceDto(); |
| | | nxFinanceDto.setDwdm(api1502.getDwdm()); |
| | |
| | | nxFinanceDto.setBbsj(DateFormatUtils.format(api1502.getBbsj(), "yyyyMMdd")); |
| | | nxFinanceDto.setBbm("02"); |
| | | nxFinanceDto.setCzbz(api1502.getCzbz()); |
| | | nxFinanceDto.setZhgxsj(DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss")); |
| | | nxFinanceDto.setZhgxsj(DateFormatUtils.format(DateUtils.addSeconds(new Date(), -10), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | paddingData(nxFinanceDto, list, "0", "项目//t", "本月数//t", "本年累计数//t"); |
| | | paddingData(nxFinanceDto, list, "1", "一、经营活动产生的现金流量:", api1502.getJyhdxjllbys() + "", api1502.getJyhdxjllbnljs() + ""); |
| | |
| | | return list; |
| | | } |
| | | |
| | | private List<NxFinanceDto> copyApi1501(Api1501 data) { |
| | | Api1501 api1501 = data; |
| | | private List<NxFinanceDto> copyApi1501(Api1501 api1501) { |
| | | List<NxFinanceDto> list = new ArrayList<>(); |
| | | NxFinanceDto nxFinanceDto = new NxFinanceDto(); |
| | | nxFinanceDto.setDwdm(api1501.getDwdm()); |
| | |
| | | nxFinanceDto.setBbsj(DateFormatUtils.format(api1501.getBbsj(), "yyyyMMdd")); |
| | | nxFinanceDto.setBbm("01"); |
| | | nxFinanceDto.setCzbz(api1501.getCzbz()); |
| | | nxFinanceDto.setZhgxsj(DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss")); |
| | | nxFinanceDto.setZhgxsj(DateFormatUtils.format(DateUtils.addSeconds(new Date(), -10), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | paddingData(nxFinanceDto, list, "0", "资产//t", "期末余额//t", "年初余额//t"); |
| | | paddingData(nxFinanceDto, list, "1", "流动资产:", api1501.getLdzchjqmye() + "", api1501.getLdzchjncye() + ""); |