| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.JacksonUtils; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.MapperFeature; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.integration.drainage.model.*; |
| | |
| | | baseRequest.setOperatorID(operator.getOurOperatorId()); |
| | | baseRequest.setTimeStamp(timeStamp); |
| | | baseRequest.setSeq("0001"); |
| | | String jsonString = JacksonUtils.toJson(o); |
| | | // 使用 Jackson 转换为 JSON |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | objectMapper.enable(MapperFeature.USE_ANNOTATIONS); // 启用注解支持 |
| | | String jsonString = null; |
| | | try { |
| | | jsonString = objectMapper.writeValueAsString(o); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String encrypt = AesEncryption.encrypt(jsonString, DataSecret, DataSecretIV); |
| | | baseRequest.setData(encrypt); |
| | | baseRequest.setOperator(operator); |
| | | // baseRequest.setSig(buildSign(baseRequest)); |
| | | SequenceGenerator generator = new SequenceGenerator(); |
| | | String nextSequence = generator.getNextSequence(); |
| | | String hmacMD5 = HMacMD5Util.getHMacMD5(OperatorID,timeStamp+"", encrypt,nextSequence,SigSecret); |
| | | baseRequest.setSig(hmacMD5); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | post.body(request_json); |
| | | log.info("推送三方平台请求地址:" + post.getUrl()); |