修改天融信获取随机数接口传参方式

develop
bayuzhen 2024-08-28 20:42:36 +08:00
parent d04c55602f
commit b436c8d59d
1 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,8 @@
package com.bocloud.sms.service; package com.bocloud.sms.service;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -54,13 +56,16 @@ public class TrxServiceImpl implements TrxService {
@Override @Override
public GeneralResult getRandomstr(String ngxCookie) { public GeneralResult getRandomstr(String ngxCookie) {
String url = trxUrl + "/getRandomStr"; String url = trxUrl + "/getRandomStr";
Map<String, Object> paramsMap = new HashMap<>(); Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("isToken", false); paramsMap.put("isToken", "false");
paramsMap.put("ngx_cookie", ngxCookie); paramsMap.put("ngx_cookie", ngxCookie);
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
try { try {
log.info("调用天融信获取随机字符串接口, url:" + url + ", 参数:" + JSONObject.toJSONString(paramsMap)); log.info("调用天融信获取随机字符串接口, url:" + url + ", 参数:" + JSONObject.toJSONString(paramsMap));
result = JSONObject.parseObject(HttpUtil.get(url, paramsMap, 10000)); HttpResponse response = HttpRequest.get(url)
.addHeaders(paramsMap)
.execute();
result = JSONObject.parseObject(response.body());
if ("-1".equals(result.getString("result"))) { if ("-1".equals(result.getString("result"))) {
return new GeneralResult(false, "获取随机数失败" + result.getString("errmsg")); return new GeneralResult(false, "获取随机数失败" + result.getString("errmsg"));
} }
@ -224,6 +229,7 @@ public class TrxServiceImpl implements TrxService {
// 获取天融信用户在权限系统的门户应用的菜单 // 获取天融信用户在权限系统的门户应用的菜单
public List<AppModule> queryQxCategoryList(String userToken ,String userId) { public List<AppModule> queryQxCategoryList(String userToken ,String userId) {
List<AppModule> appModules = JSONArray.parseArray(qxUtils.queryAppModules(userToken, userId), AppModule.class); List<AppModule> appModules = JSONArray.parseArray(qxUtils.queryAppModules(userToken, userId), AppModule.class);
log.info("获取用户在指定应用中可操作的功能模块信息结果:" + JSONObject.toJSONString(appModules));
return appModules; return appModules;
} }