huliguo
1 天以前 8115295a64e0809246897fefb8c45de06dce0799
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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;
    }
    
 
    
    
}