New file |
| | |
| | | package com.ruoyi.integration.drainage.kuaidian; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.core.utils.SpringUtils; |
| | | import com.ruoyi.integration.drainage.AESUtil; |
| | | import com.ruoyi.integration.drainage.SignUtil; |
| | | import com.ruoyi.integration.drainage.TCECUtil; |
| | | import com.ruoyi.integration.drainage.kuaidian.model.NotificationStationChangeResult; |
| | | import com.ruoyi.integration.drainage.kuaidian.model.StationChange; |
| | | import com.ruoyi.integration.drainage.model.*; |
| | | import com.ruoyi.integration.drainage.model.enu.InterfaceUrlEnum; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import com.ruoyi.other.api.feignClient.OperatorClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.time.Instant; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 中电联TCEC标准(快电) |
| | | * @author zhibing.pu |
| | | * @Date 2025/1/21 11:48 |
| | | */ |
| | | @Slf4j |
| | | public class TCECKDUtil extends TCECUtil { |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 站点变更通知 |
| | | * @param operator |
| | | * @param type |
| | | * @param siteIds |
| | | * @return |
| | | */ |
| | | public static NotificationStationChangeResult notificationStationChange(Operator operator, Integer type, List<Integer> siteIds) { |
| | | StationChange stationChange = new StationChange(); |
| | | stationChange.setOperatorId(operator.getOurOperatorId()); |
| | | stationChange.setType(type); |
| | | List<String> collect = siteIds.stream().map(String::valueOf).collect(Collectors.toList()); |
| | | stationChange.setStationIds(collect); |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_STATION_CHANGE.getUrl()); |
| | | buildBody(post, stationChange, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台站点变更通知失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送三方平台站点变更通知响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台站点变更通知失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | log.info("推送三方平台站点变更通知Data:" + decrypt); |
| | | NotificationStationChangeResult notificationStationChangeResult = JSON.parseObject(decrypt, NotificationStationChangeResult.class); |
| | | return notificationStationChangeResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |