| | |
| | | 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.*; |
| | |
| | | private static final String DataSecret = "50a61b93919c9604"; |
| | | private static final String DataSecretIV = "7c8ac6861661d584"; |
| | | |
| | | |
| | | private static final String OurDataSecret = "50a61b93919c9605"; |
| | | private static final String OurDataSecretIV = "7c8ac6861661d585"; |
| | | private static final String OurSigSecret = "a6fedf0e1b27d6f6"; |
| | | private static final String OurOperatorID = "MA01H3BQ3"; |
| | | private static final String OurOperatorSecret = "f1331ef0b37c2d1a"; |
| | | @Autowired |
| | | private RedisService redisService; |
| | | public static final String TOKEN_KEY = "charge_token:"; |
| | |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送三方平台设备状态Data:" + decrypt); |
| | | NotificationStationStatusResult notificationStationStatusResult = JSON.parseObject(decrypt, NotificationStationStatusResult.class); |
| | | return notificationStationStatusResult; |
| | |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送三方平台充电状态Data:" + decrypt); |
| | | NotificationEquipChargeStatusResult notificationEquipChargeStatusResult = JSON.parseObject(decrypt, NotificationEquipChargeStatusResult.class); |
| | | return notificationEquipChargeStatusResult; |
| | |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送三方平台充电订单信息Data:" + decrypt); |
| | | NotificationChargeOrderInfoResult notificationChargeOrderInfoResult = JSON.parseObject(decrypt, NotificationChargeOrderInfoResult.class); |
| | | return notificationChargeOrderInfoResult; |
| | |
| | | baseRequest.setOperatorID(operator.getOurOperatorId()); |
| | | baseRequest.setTimeStamp(timeStamp); |
| | | baseRequest.setSeq("0001"); |
| | | String jsonString = JacksonUtils.toJson(o); |
| | | String encrypt = AesEncryption.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | // 使用 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()); |
| | |
| | | return ; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送充电用能统计信息Data:" + decrypt); |
| | | |
| | | } |
| | |
| | | return ; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送充换电站信息信息Data:" + decrypt); |
| | | } |
| | | /** |
| | |
| | | return ; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送充换电站实时功率信息Data:" + decrypt); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | BaseModel model = new BaseModel(); |
| | | model.setOperatorID("MA25CNM38"); |
| | | model.setOperatorID("MA01H3BQ2"); |
| | | model.setData("AoArdDDcmHcmOMkCLHodTpY1xLtt9yhLqxvKPyfdlmEOBj1LJnQM+Z4JOZllt3Pj9rubfgxJ51zMAfzquQegJzHGAT9Y7JrKFzFe6jGtXo0="); |
| | | model.setTimeStamp(20250205120800L); |
| | | model.setSeq("0001"); |