| | |
| | | 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.sh2023.dto.*; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | String inteId = param.getInteId(); |
| | | String kqdm = param.getKqdm(); |
| | | //查询库区信息行政区划码 |
| | | List<Api1102> api1102List = api1102Rep.findPushData(conf.getKqdm()); |
| | | List<Api1102> api1102List = api1102Rep.findPushData(kqdm); |
| | | try { |
| | | if (null == conf) { |
| | | conf = apiCommonService.getConf(kqdm); |
| | |
| | | |
| | | //获取指令id |
| | | String key = RedisConst.buildKey(RedisConst.KYE_ORDER, conf.getKqdm()); |
| | | String orderId = (String)redisUtil.get(key); |
| | | if(StringUtils.isEmpty(orderId)){ |
| | | OrderData orderData = (OrderData)redisUtil.get(key); |
| | | if(StringUtils.isEmpty(orderData.getOrderid())){ |
| | | log.error("指令id失效=" + jsonData); |
| | | ResponseDto responseDto = new ResponseDto(99, "指令id失效"); |
| | | apiLog.setStatus(99); |
| | | apiLog.setResult("指令id失效"); |
| | |
| | | //获取身份ID,即行政区划码 |
| | | reqData.setUid(conf.getUserName()); |
| | | //指令id |
| | | reqData.setOrderid(orderId); |
| | | reqData.setOrderid(orderData.getOrderid()); |
| | | |
| | | //身份签名,使用自有RSA私钥进行加密(地区行政区划代码_当天日期) |
| | | reqData.setAccess_token(RSAUtils.encryptData(reqData.getUid() + "_" + DateFormatUtils.format(new Date(), "yyyy-MM-dd"), conf.getPassword())); |
| | | //数据总条数 |
| | | List<Object> list = (List<Object>) data; |
| | | reqData.setDatalength(list.size()); |
| | | |
| | | //使用区级平台公钥对数据进行RSA加密 |
| | | reqData.setData(RSAUtils.encrypt(jsonData, conf.getPublicKey())); |
| | | //摘要,数据主体的MD5值 |
| | | reqData.setDigst(MyMD5Util.encrypt(jsonData)); |
| | | |
| | | SH2023RespDto responseDto = SH2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, reqData, conf); |
| | | SH2023RespDto responseDto = SH2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, JSON.toJSONString(reqData), conf); |
| | | |
| | | apiLog.setStatus(responseDto.getCode() == 200 ? 0 : responseDto.getCode()); |
| | | apiLog.setResult(responseDto.getResult()); |
| | | apiLogRep.save(apiLog); |
| | |
| | | |
| | | //获取指令id |
| | | String key = RedisConst.buildKey(RedisConst.KYE_ORDER, conf.getKqdm()); |
| | | String orderId = (String)redisUtil.get(key); |
| | | if(StringUtils.isEmpty(orderId)){ |
| | | OrderData orderData = (OrderData)redisUtil.get(key); |
| | | if(StringUtils.isEmpty(orderData.getOrderid())){ |
| | | ResponseDto responseDto = new ResponseDto(99, "指令id失效"); |
| | | apiLog.setStatus(99); |
| | | apiLog.setResult("指令id失效"); |
| | |
| | | //获取身份ID,即行政区划码 |
| | | reqData.setUid(conf.getUserName()); |
| | | //指令id |
| | | reqData.setOrderid(orderId); |
| | | reqData.setOrderid(orderData.getOrderid()); |
| | | //身份签名,使用自有RSA私钥进行加密(地区行政区划代码_当天日期) |
| | | reqData.setAccess_token(RSAUtils.encryptData(reqData.getUid() + "_" + DateFormatUtils.format(new Date(), "yyyy-MM-dd"), conf.getPassword())); |
| | | //数据总条数 |
| | |
| | | //摘要,数据主体的MD5值 |
| | | reqData.setDigst(MyMD5Util.encrypt(jsonData)); |
| | | |
| | | SH2023RespDto responseDto = SH2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, reqData, conf); |
| | | SH2023RespDto responseDto = SH2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, JSON.toJSONString(reqData), conf); |
| | | apiLog.setStatus(responseDto.getCode() == 200 ? 0 : responseDto.getCode()); |
| | | apiLog.setResult(responseDto.getResult()); |
| | | apiLogRep.save(apiLog); |