广州市综治平台后端
xusd
2025-06-07 36306491396230522fa20585c2621a7fc899849a
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
package cn.huge.module.grid.service;
 
import cn.huge.base.common.bo.R;
import cn.huge.base.common.utils.HttpClientUtils;
import cn.huge.base.common.utils.SpringContextUtil;
import cn.huge.module.sys.dto.GridCoordinateDTO;
import cn.huge.module.grid.domain.dto.SpecialPersonDTO;
import cn.huge.module.grid.domain.vo.HeadVo;
import cn.huge.module.grid.domain.vo.SpecialPersonRequestVo;
import cn.huge.module.grid.domain.vo.SpecialPersonVo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
 
import java.util.HashMap;
import java.util.UUID;
 
@Slf4j
@Service
public class GridSpecialPersonService {
    @Value("${grid.url:http://219.137.166.84:8061}")
    private String gridUrl;
    private String testUrl = "http://183.2.142.21:9007";
    @Value("${grid.username:mtxt0011}")
    private String userName;
    @Value("${grid.password}")
    private String passWord;
    @Value("${grid.secret:BZb2hLCx05}")
    private String secret;
    @Value("${grid.passid:b08c0ec0-772d-caf8-5c9b-1f7d86295a95}")
    private String passid;
    public HashMap<String,String> initHeadVo() {
        long timestamp = System.currentTimeMillis()/1000;
        HashMap<String,String> headVo = new HashMap<>();
        headVo.put("x-rio-paasid",passid);
        headVo.put("x-rio-timestamp",timestamp+"");
        headVo.put("x-rio-nonce","mt");
        headVo.put("x-rio-signature", DigestUtils.sha256Hex(timestamp+secret+"mt"+timestamp));
        return headVo;
    }
    public R<SpecialPersonDTO> getLabelInfo(SpecialPersonVo specialPersonVo) {
        log.info("specialPersonVo:{}", JSON.toJSONString(specialPersonVo));
        HashMap<String,String> headVo= initHeadVo();
        log.info("requestVo:{}", JSON.toJSONString(specialPersonVo));
        String s;
        try {
            String httpPostUrl = gridUrl + "/sys/getLabelInfoByIdNumber";
            log.info("httpPostUrl:{}", httpPostUrl);
            s = HttpClientUtils.httpPostRaw(httpPostUrl, JSON.toJSONString(specialPersonVo), headVo, "utf-8");
 
        } catch (Exception e) {
            log.info("xsderror:{}", e);
            throw new RuntimeException(e);
        }
        log.info("res:{}", s);
        SpecialPersonDTO specialPersonDTO = JSONObject.parseObject(s).getObject("data", SpecialPersonDTO.class);
        String msg = JSONObject.parseObject(s).getString("desc");
        // String code = JSONObject.parseObject(s).getString("code");
        return R.ok(specialPersonDTO,msg);
 
    }
}