forked from gzzfw/backEnd/gz-dyh

xusd
2024-09-14 0940d6bc6cbfca313ac635b02ae06eb65a631968
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 cn.huge.module.grid.service;
 
import cn.huge.base.common.bo.R;
import cn.huge.base.common.utils.HttpClientUtils;
import cn.huge.module.grid.domain.vo.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
 
import java.util.HashMap;
import java.util.UUID;
 
@Slf4j
@Service
public class GridUserService {
    private String gridUrl = "http://219.137.166.84:8061";
    private String testUrl = "http://183.2.142.46:9007";
 
    public R<GridUserVo> getUserInfo(GridTokenVo gridTokenVo) {
        String s = null;
        HeadVo headVo = initHeadVo();
        GridUserRequestVo requestVo = new GridUserRequestVo();
        requestVo.setHeadVo(headVo);
        requestVo.setBodyVo(gridTokenVo);
        try {
//            log.info("xsdobject:{}",JSON.toJSONString(requestVo));
            log.info("xsdurl:{}",gridUrl + "/sys/getUserByToken");
//            log.info("xsdurl:{}",testUrl + "/sys/getUserByToken");
            s = HttpClientUtils.httpPostRaw(gridUrl + "/sys/getUserByToken", JSON.toJSONString(requestVo), new HashMap<>(), "utf-8");
            log.info("xsd:{}",s);
        } catch (Exception e) {
            log.info("xsderror:{}",e.getLocalizedMessage());
            throw new RuntimeException(e);
        }
        GridUserVo gridUserVo = JSONObject.parseObject(s).getObject("data", GridUserVo.class);
        return R.ok(gridUserVo);
    }
 
    public HeadVo initHeadVo() {
        HeadVo headVo = new HeadVo();
        headVo.setUsername("mtxt001");
        headVo.setPassword("aek8CdcaM");
        headVo.setRequestId(UUID.randomUUID().toString());
        headVo.setSource("string");
        return headVo;
    }
}