forked from gzzfw/backEnd/gz-dyh

xusd
2024-09-13 6fe79229a8a57556970f577cdab74423e13fe0e4
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
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.GridUserVo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
 
import java.util.HashMap;
 
@Slf4j
@Service
public class GridUserService {
    private String gridUrl = "http://219.137.166.84:8061";
 
    public R<GridUserVo> getUserInfo(String token) {
        String s = null;
        try {
            log.info("xsd:{}",JSON.toJSONString(token));
            log.info("xsdurl:{}",gridUrl + "/sys/getUserByToken");
            s = HttpClientUtils.httpPostRaw(gridUrl + "/sys/getUserByToken", JSON.toJSONString(token), 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);
    }
}