聚合平台

master
WeiRan 2024-09-09 16:11:41 +08:00
parent ca4b00c59f
commit 2164e9b989
1 changed files with 23 additions and 22 deletions

View File

@ -2,6 +2,7 @@ package com.muyu.data.mart.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.muyu.cloud.background.common.BasicApi;
import com.muyu.cloud.background.domin.juhe.JuHeResult;
import com.muyu.cloud.background.domin.realname.RealNameReq;
@ -76,27 +77,27 @@ public class RealNameServiceImpl implements BasicApi<RealNameReq, RealNameResp>{
}
in.close();
System.out.println(response);
// //{"reason":"参数错误:身份证不合法","result":null,"error_code":210304} 或
// //{"reason":"成功","result":{"realname":"魏然","idcard":"321183200303152916","res":1},"error_code":0}
// StringBuffer stringBuffer = new StringBuffer(response);
// JSONObject jsonObject = JSONObject.parseObject(stringBuffer.toString());
// String reason = jsonObject.getString("reason");
// JSONObject resultObj = jsonObject.getJSONObject("result");
// String realname = resultObj.getString("realname");
// String idcard = resultObj.getString("idcard");
// int res = resultObj.getIntValue("res");
// int errorCode = jsonObject.getIntValue("error_code");
// return new JuHeResult<RealNameJuHeResp>(){{
// setErrorCode(errorCode);
// setReason(reason);
// setResult(
// RealNameJuHeResp.builder()
// .realName(realname)
// .idCard(idcard)
// .res(res)
// .build()
// );
// }};
//{"reason":"参数错误:身份证不合法","result":null,"error_code":210304} 或
//{"reason":"成功","result":{"realname":"魏然","idcard":"321183200303152916","res":1},"error_code":0}
StringBuffer stringBuffer = new StringBuffer(response);
JSONObject jsonObject = JSONObject.parseObject(stringBuffer.toString());
String reason = jsonObject.getString("reason");
JSONObject resultObj = jsonObject.getJSONObject("result");
String realname = resultObj.getString("realname");
String idcard = resultObj.getString("idcard");
int res = resultObj.getIntValue("res");
int errorCode = jsonObject.getIntValue("error_code");
return new JuHeResult<RealNameJuHeResp>(){{
setErrorCode(errorCode);
setReason(reason);
setResult(
RealNameJuHeResp.builder()
.realName(realname)
.idCard(idcard)
.res(res)
.build()
);
}};
// return new JuHeResult<RealNameJuHeResp>(){{
// setErrorCode(0);
@ -109,7 +110,7 @@ public class RealNameServiceImpl implements BasicApi<RealNameReq, RealNameResp>{
// .build()
// );
// }};
return null;
}