修改天融信下线接口传参

develop
bayuzhen 2024-08-29 09:29:26 +08:00
parent 38c3a78765
commit 67e437d646
1 changed files with 15 additions and 10 deletions

View File

@ -86,38 +86,38 @@ public class TrxServiceImpl implements TrxService {
Map<String, Object> paramsMap = new HashMap<>(); Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("cookie", trxAuthModel.getClientHello()); paramsMap.put("cookie", trxAuthModel.getClientHello());
List<Map<String, Object>> authen = new ArrayList<>(); List<Map<String, Object>> authenList = new ArrayList<>();
Map<String, Object> userMap = new HashMap<>(); Map<String, Object> userMap = new HashMap<>();
userMap.put("loginName", trxAuthModel.getLoginName()); userMap.put("loginName", trxAuthModel.getLoginName());
userMap.put("passwd", trxAuthModel.getPasswd()); userMap.put("passwd", trxAuthModel.getPasswd());
authen.add(userMap); authenList.add(userMap);
Map<String, Object> md5Map = new HashMap<>(); Map<String, Object> md5Map = new HashMap<>();
md5Map.put("certMd5", trxAuthModel.getServerHello()); md5Map.put("certMd5", trxAuthModel.getServerHello());
md5Map.put("value", ""); md5Map.put("value", "");
md5Map.put("hashType", ""); md5Map.put("hashType", "");
authen.add(md5Map); authenList.add(md5Map);
Map<String, Object> passcodeMap = new HashMap<>(); Map<String, Object> passcodeMap = new HashMap<>();
passcodeMap.put("passcode", ""); passcodeMap.put("passcode", "");
authen.add(passcodeMap); authenList.add(passcodeMap);
Map<String, Object> dfCodeMap = new HashMap<>(); Map<String, Object> dfCodeMap = new HashMap<>();
dfCodeMap.put("df_code", ""); dfCodeMap.put("df_code", "");
authen.add(dfCodeMap); authenList.add(dfCodeMap);
Map<String, Object> ipMap = new HashMap<>(); Map<String, Object> ipMap = new HashMap<>();
ipMap.put("client_ip", trxAuthModel.getClientIp()); ipMap.put("client_ip", trxAuthModel.getClientIp());
authen.add(ipMap); authenList.add(ipMap);
paramsMap.put("Authen", authen); paramsMap.put("Authen", authenList);
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
GeneralResult<Map<String, Object>> login = new GeneralResult<>(); GeneralResult<Map<String, Object>> login = new GeneralResult<>();
try { try {
HttpRequest httpRequest = HttpRequest.post("http://your_backend_url/trx/userAuthen") HttpRequest httpRequest = HttpRequest.post(url)
.header("isToken", "false") .header("isToken", "false")
.body(JSONObject.toJSONString(paramsMap)); .body(JSONObject.toJSONString(paramsMap));
log.info("调用天融信获取随机字符串接口, 请求信息:" + JSONObject.toJSONString(httpRequest)); log.info("调用天融信用户登录接口, 请求信息:" + JSONObject.toJSONString(httpRequest));
HttpResponse response = httpRequest.execute(); HttpResponse response = httpRequest.execute();
result = JSONObject.parseObject(response.body()); result = JSONObject.parseObject(response.body());
if (!"0".equals(result.getString("result"))) { if (!"0".equals(result.getString("result"))) {
@ -225,7 +225,12 @@ public class TrxServiceImpl implements TrxService {
Map<String, Object> paramsMap = new HashMap<>(); Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("token", trxAuthModel.getTrxToken()); paramsMap.put("token", trxAuthModel.getTrxToken());
paramsMap.put("client_ip", trxAuthModel.getClientIp()); paramsMap.put("client_ip", trxAuthModel.getClientIp());
JSONObject result = JSONObject.parseObject(HttpUtil.post(url, paramsMap)); HttpRequest httpRequest = HttpRequest.post(url)
.header("isToken", "false")
.body(JSONObject.toJSONString(paramsMap));
log.info("调用天融信下线接口, 请求信息:" + JSONObject.toJSONString(httpRequest));
HttpResponse response = httpRequest.execute();
JSONObject result = JSONObject.parseObject(response.body());
if (!"0".equals(result.getString("result"))) { if (!"0".equals(result.getString("result"))) {
return new GeneralResult(false, "下线失败" + result.getString("msg")); return new GeneralResult(false, "下线失败" + result.getString("msg"));
} }