自动化立体仓库 - WMS系统
13
zhang
2025-05-24 954799493a5d4a63a8844fd53e8a14c8ea9f6cea
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
package com.zy.asrs.third;
 
import com.alibaba.fastjson.JSON;
import com.zy.common.utils.HttpHandler;
 
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
 
public class TokenUtils {
    private static String clientId = "xincai";
 
    private static String clientSecret = "123456";
 
    private static String erpId = "1130021";
 
    private static String tokenUrl = "/getMsg/v2/createToken";
 
    public static Map<String, Object> getToken(String ip) {
        Map<String, Object> data = new HashMap<>();
        Map<String, String> tokenData = new HashMap<>();
        tokenData.put("clientId", clientId);
        tokenData.put("clientSecret", clientSecret);
        tokenData.put("erpId", erpId);
        String response = null;
        try {
            response = new HttpHandler.Builder()
                    .setUri(ip)
                    .setPath(tokenUrl)
                    .setJson(JSON.toJSONString(tokenData))
                    .build()
                    .doPost();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        MesResponse jsonObject = JSON.parseObject(response, MesResponse.class);
        if (jsonObject.getCode().equals(200)) {
            data.put("token", JSON.parseObject(jsonObject.getData()).getString("token"));
        }
        return null;
    }
 
 
}