13693261870
2024-09-12 b5326f8d497a6f6e97a487cb9c565fdae1dc4790
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
package com.se.simu.service;
 
import cn.hutool.json.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
 
import javax.annotation.Resource;
 
/**
 * SDDB服务类
 *
 * @author WWW
 * @date   2024-09-12
 */
@Slf4j
@Service
public class SedbService {
    @Value("${sedb.url}")
    String url;
 
    @Value("${sedb.user}")
    String user;
 
    @Value("${sedb.pwd}")
    String pwd;
 
    @Resource
    RestTemplate restTemplate;
 
    public String getToken() {
        //http://106.120.22.26:8013/account-service/security/publickey
        String key = getPublicKey();
 
 
        return key;
    }
 
    public String getPublicKey() {
        String uri = url + "account-service/security/publickey";
 
        //{"datetime":"2024-09-12 17:24:38","code":200,"data":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtFwJCh2taVTEi05C8qT2oG7Y+rDmJhlO4zicpSeRtiro9LsytePeWI7BXM6sfDU0WeKun1izawcfgGkZgnoJuMBluAOKI1tL0uCrR+DreNLqMVtnXHwoWEIk/hGJedDWaf3q22aGDyEB5h9qCq0JklSShP1Ih4ppap4LmgxdTPQIDAQAB"}
        JSONObject obj = restTemplate.getForObject(uri, JSONObject.class);
 
        return obj.getStr("data");
    }
}