聚合平台

master
WeiRan 2024-09-09 01:14:55 +08:00
parent 3698babadf
commit ca4b00c59f
1 changed files with 23 additions and 23 deletions

View File

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