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

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