优化政务端

wushunjie
杜函宇 10 months ago
parent 74a75572b7
commit e02740686c

@ -45,6 +45,12 @@ public class ChiefController {
@Value("${appkey}") @Value("${appkey}")
private String appkey; private String appkey;
@Value("${getInfoId}")
private String getInfoId;
@Value("${getAllInfo}")
private String getAllInfo;
@Resource @Resource
private SingleLoginService singleLoginService; private SingleLoginService singleLoginService;
@ -58,7 +64,6 @@ public class ChiefController {
String encode = URLEncoder.encode(Base64.encode((HMAC256Config.HmacSHA256(clientId + timespan + userToken, clientSecret))), "UTF-8"); String encode = URLEncoder.encode(Base64.encode((HMAC256Config.HmacSHA256(clientId + timespan + userToken, clientSecret))), "UTF-8");
if (encode.equals(signature)) { if (encode.equals(signature)) {
//经济大脑(政务端)获取用户信息接口 //经济大脑(政务端)获取用户信息接口
String url = "https://qyt.sipac.gov.cn/enterprise-gateway/sipsg-enterprise/sys/third/userInfo";
UserInfoRequestDTO req = new UserInfoRequestDTO(); UserInfoRequestDTO req = new UserInfoRequestDTO();
req.setClientId(clientId); req.setClientId(clientId);
req.setUserToken(userToken); req.setUserToken(userToken);
@ -70,7 +75,7 @@ public class ChiefController {
JSONObject jsonObject = new JSONObject();//存放参数 JSONObject jsonObject = new JSONObject();//存放参数
jsonObject.set("clientId", clientId); jsonObject.set("clientId", clientId);
jsonObject.set("userToken", userToken); jsonObject.set("userToken", userToken);
HttpResponse response = HttpRequest.post(url) HttpResponse response = HttpRequest.post(getInfoId)
.addHeaders(headers) .addHeaders(headers)
.body(jsonObject.toString()) .body(jsonObject.toString())
.execute(); .execute();
@ -79,7 +84,8 @@ public class ChiefController {
//经济大脑(政务端)获取用户信息接口 //经济大脑(政务端)获取用户信息接口
JSONObject jsonObj = JSONUtil.parseObj(response.body()); JSONObject jsonObj = JSONUtil.parseObj(response.body());
ThirdUserInfoResponse res = JSONUtil.toBean(jsonObj.get("data").toString(), ThirdUserInfoResponse.class); ThirdUserInfoResponse res = JSONUtil.toBean(jsonObj.get("data").toString(), ThirdUserInfoResponse.class);
String getInfo = "http://uid.sipac.gov.cn/open/api/identity/data/FindUserById?id=" + res.getUserId() + "&appkey=" + appkey; //政务通获取用户信息接口(可选)
String getInfo = getAllInfo+"?id=" + res.getUserId() + "&appkey=" + appkey;
HttpResponse getMain = HttpRequest.get(getInfo).execute(); HttpResponse getMain = HttpRequest.get(getInfo).execute();
if (getMain.getStatus() == 200) { if (getMain.getStatus() == 200) {
JSONObject dataJson = JSONUtil.parseObj(getMain.body()); JSONObject dataJson = JSONUtil.parseObj(getMain.body());

@ -126,18 +126,22 @@ xss:
# 匹配链接 # 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/* urlPatterns: /system/*,/monitor/*,/tool/*
#单点登陆url #企业端单点登陆url
url: https://qytt.sipac.gov.cn/api/usercenter/User/ssoLogin url: https://qytt.sipac.gov.cn/api/usercenter/User/ssoLogin
#用户信息url #企业端用户信息url
infoUrl: https://qytt.sipac.gov.cn/api/usercenter/User/getInfo infoUrl: https://qytt.sipac.gov.cn/api/usercenter/User/getInfo
#退出登录url #企业端退出登录url
logoutUrl: https://qytt.sipac.gov.cn/api/usercenter/User/ssoLogOut logoutUrl: https://qytt.sipac.gov.cn/api/usercenter/User/ssoLogOut
#政务端clientId #政务端clientId
clientId: 987d5975437043ff85c0522a0a282a6b clientId: 987d5975437043ff85c0522a0a282a6b
#政务端key #政务端appkey
appkey: db90cb33-6551-4d1f-875e-236d66af4fcc appkey: db90cb33-6551-4d1f-875e-236d66af4fcc
#政务端clientSecret #政务端clientSecret
clientSecret: Q5ym8T9XIEZAn+DSQl+aXA== clientSecret: Q5ym8T9XIEZAn+DSQl+aXA==
#政务端经济大脑(政务端)获取用户信息接口
getInfoId: https://qyt.sipac.gov.cn/enterprise-gateway/sipsg-enterprise/sys/third/userInfo
#政务端政务通获取用户信息接口(可选)
getAllInfo: http://uid.sipac.gov.cn/open/api/identity/data/FindUserById

Loading…
Cancel
Save