Feat: Api fix log

This commit is contained in:
Owen 2024-12-31 11:20:18 +08:00
parent bb46296bd6
commit 7701cd7c6f
12 changed files with 159 additions and 94 deletions

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.haoka.api; package cn.iocoder.yudao.module.haoka.api;
import cn.iocoder.yudao.module.haoka.api.hainandianxin.HaiNanDianXinApi; import cn.iocoder.yudao.module.haoka.api.hainandianxin.HaiNanDianXinApi;
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
import com.mashape.unirest.http.exceptions.UnirestException; import com.mashape.unirest.http.exceptions.UnirestException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -36,28 +37,28 @@ public class ApiHaiNanDXService extends ApiConfigService {
} }
public HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.QryNbrListResponse> public HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.QryNbrListResponse>
qryNbrList(HaiNanDianXinApi.QryNbrListRequest param) throws UnirestException { qryNbrList(final SuperiorApiLogSaveReqVO logVO,HaiNanDianXinApi.QryNbrListRequest param) throws UnirestException {
return HaiNanDianXinApi.qryNbrList(this.getConfig(), param); return HaiNanDianXinApi.qryNbrList( logVO,this.getConfig(), param);
} }
public HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.FraudCheckResponse> public HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.FraudCheckResponse>
fraudCheck(HaiNanDianXinApi.FraudCheckRequest param) throws UnirestException { fraudCheck(final SuperiorApiLogSaveReqVO logVO, HaiNanDianXinApi.FraudCheckRequest param) throws UnirestException {
return HaiNanDianXinApi.fraudCheck(this.getConfig(), param); return HaiNanDianXinApi.fraudCheck( logVO,this.getConfig(), param);
} }
public HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.QueryOrderInfoResponse> public HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.QueryOrderInfoResponse>
queryOrderInfo(HaiNanDianXinApi.QueryOrderInfoRequest param) throws UnirestException { queryOrderInfo(final SuperiorApiLogSaveReqVO logVO,HaiNanDianXinApi.QueryOrderInfoRequest param) throws UnirestException {
return HaiNanDianXinApi.queryOrderInfo(this.getConfig(), param); return HaiNanDianXinApi.queryOrderInfo( logVO,this.getConfig(), param);
} }
public HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.GetLogisticsTrajectoryResponse> public HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.GetLogisticsTrajectoryResponse>
getLogisticsTrajectory(HaiNanDianXinApi.GetLogisticsTrajectoryRequest param) throws UnirestException { getLogisticsTrajectory(final SuperiorApiLogSaveReqVO logVO,HaiNanDianXinApi.GetLogisticsTrajectoryRequest param) throws UnirestException {
return HaiNanDianXinApi.getLogisticsTrajectory(this.getConfig(), param); return HaiNanDianXinApi.getLogisticsTrajectory( logVO,this.getConfig(), param);
} }
public HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.SynOrderInfoResponse> public HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.SynOrderInfoResponse>
synOrderInfo(HaiNanDianXinApi.SynOrderInfoRequest param) throws UnirestException { synOrderInfo(final SuperiorApiLogSaveReqVO logVO,HaiNanDianXinApi.SynOrderInfoRequest param) throws UnirestException {
return HaiNanDianXinApi.synOrderInfo(this.getConfig(), param); return HaiNanDianXinApi.synOrderInfo( logVO,this.getConfig(), param);
} }
@Override @Override

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.haoka.api;
import cn.iocoder.yudao.module.haoka.api.hunandianxin.HuNanDXApi; import cn.iocoder.yudao.module.haoka.api.hunandianxin.HuNanDXApi;
import cn.iocoder.yudao.module.haoka.api.hunandianxin.HaiNanDxInfo; import cn.iocoder.yudao.module.haoka.api.hunandianxin.HaiNanDxInfo;
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Map; import java.util.Map;
@ -40,8 +41,8 @@ public class ApiHuNanDXService extends ApiConfigService {
* @throws Exception 如果调用接口时发生异常 * @throws Exception 如果调用接口时发生异常
*/ */
public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.InternetCardQualificationResp> public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.InternetCardQualificationResp>
checkInternetCardQualification(HaiNanDxInfo.InternetCardQualificationParam param) throws Exception { checkInternetCardQualification(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.InternetCardQualificationParam param) throws Exception {
return HuNanDXApi.checkInternetCardQualification(getConfig(), param); return HuNanDXApi.checkInternetCardQualification(logVO,getConfig(), param);
} }
/** /**
@ -52,8 +53,8 @@ public class ApiHuNanDXService extends ApiConfigService {
* @throws Exception 如果调用接口时发生异常 * @throws Exception 如果调用接口时发生异常
*/ */
public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SyncOrderResp> public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SyncOrderResp>
syncOrder(HaiNanDxInfo.SyncOrderParam param) throws Exception { syncOrder(final SuperiorApiLogSaveReqVO logVO,HaiNanDxInfo.SyncOrderParam param) throws Exception {
return HuNanDXApi.syncOrder(getConfig(), param); return HuNanDXApi.syncOrder( logVO,getConfig(), param);
} }
/** /**
@ -64,8 +65,8 @@ public class ApiHuNanDXService extends ApiConfigService {
* @throws Exception 如果调用接口时发生异常 * @throws Exception 如果调用接口时发生异常
*/ */
public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryOrderResp> public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryOrderResp>
queryOrder(HaiNanDxInfo.QueryOrderParam param) throws Exception { queryOrder(final SuperiorApiLogSaveReqVO logVO,HaiNanDxInfo.QueryOrderParam param) throws Exception {
return HuNanDXApi.queryOrder(getConfig(), param); return HuNanDXApi.queryOrder( logVO,getConfig(), param);
} }
/** /**
@ -76,8 +77,8 @@ public class ApiHuNanDXService extends ApiConfigService {
* @throws Exception 如果调用接口时发生异常 * @throws Exception 如果调用接口时发生异常
*/ */
public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SendSmsCodeResp> public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SendSmsCodeResp>
sendSmsCode(HaiNanDxInfo.SendSmsCodeParam param) throws Exception { sendSmsCode(final SuperiorApiLogSaveReqVO logVO,HaiNanDxInfo.SendSmsCodeParam param) throws Exception {
return HuNanDXApi.sendSmsCode(getConfig(), param); return HuNanDXApi.sendSmsCode( logVO,getConfig(), param);
} }
/** /**
@ -88,8 +89,8 @@ public class ApiHuNanDXService extends ApiConfigService {
* @throws Exception 如果调用接口时发生异常 * @throws Exception 如果调用接口时发生异常
*/ */
public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.VerifySmsCodeResp> public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.VerifySmsCodeResp>
verifySmsCode(HaiNanDxInfo.VerifySmsCodeParam param) throws Exception { verifySmsCode(final SuperiorApiLogSaveReqVO logVO,HaiNanDxInfo.VerifySmsCodeParam param) throws Exception {
return HuNanDXApi.verifySmsCode(getConfig(), param); return HuNanDXApi.verifySmsCode( logVO,getConfig(), param);
} }
/** /**
@ -100,8 +101,8 @@ public class ApiHuNanDXService extends ApiConfigService {
* @throws Exception 如果调用接口时发生异常 * @throws Exception 如果调用接口时发生异常
*/ */
public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryPhoneNumberResp> public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryPhoneNumberResp>
queryPhoneNumber( HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.QueryPhoneNumberParam> param) throws Exception { queryPhoneNumber(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.QueryPhoneNumberParam> param) throws Exception {
return HuNanDXApi.queryPhoneNumber(getConfig(), param); return HuNanDXApi.queryPhoneNumber( logVO, getConfig(), param);
} }
/** /**
@ -112,8 +113,8 @@ public class ApiHuNanDXService extends ApiConfigService {
* @throws Exception 如果调用接口时发生异常 * @throws Exception 如果调用接口时发生异常
*/ */
public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.PossessPhoneNumberResp> public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.PossessPhoneNumberResp>
possessPhoneNumber(HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.PossessPhoneNumberParam> param) throws Exception { possessPhoneNumber(final SuperiorApiLogSaveReqVO logVO,HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.PossessPhoneNumberParam> param) throws Exception {
return HuNanDXApi.possessPhoneNumber(getConfig(), param); return HuNanDXApi.possessPhoneNumber( logVO,getConfig(), param);
} }
/** /**
@ -124,8 +125,8 @@ public class ApiHuNanDXService extends ApiConfigService {
* @throws Exception 如果调用接口时发生异常 * @throws Exception 如果调用接口时发生异常
*/ */
public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.BlackListCheckResp> public HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.BlackListCheckResp>
checkBlackList(HaiNanDxInfo.BlackListCheckParam param) throws Exception { checkBlackList(final SuperiorApiLogSaveReqVO logVO,HaiNanDxInfo.BlackListCheckParam param) throws Exception {
return HuNanDXApi.checkBlackList(getConfig(), param); return HuNanDXApi.checkBlackList( logVO, getConfig(), param);
} }
@Override @Override

View File

@ -35,6 +35,7 @@ public class GdDxApi {
logVO.setParam(jsonString); logVO.setParam(jsonString);
logVO.setUrl(url); logVO.setUrl(url);
HttpResponse<String> string = Unirest.post(url) HttpResponse<String> string = Unirest.post(url)
.header("Content-Type", "application/json") .header("Content-Type", "application/json")
.header("X-Sign", sign) .header("X-Sign", sign)

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.haoka.api.hainandianxin; package cn.iocoder.yudao.module.haoka.api.hainandianxin;
import cn.iocoder.yudao.module.haoka.api.liantong.util.StringUtils; import cn.iocoder.yudao.module.haoka.api.liantong.util.StringUtils;
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.HttpResponse;
@ -60,8 +61,8 @@ public class HaiNanDianXinApi {
* @return 防诈校验返回结果 * @return 防诈校验返回结果
* @throws UnirestException 请求异常 * @throws UnirestException 请求异常
*/ */
public static HaiNanResponseInfo<FraudCheckResponse> fraudCheck(HaiNanDianXinApiConfig config, FraudCheckRequest request) throws UnirestException { public static HaiNanResponseInfo<FraudCheckResponse> fraudCheck(final SuperiorApiLogSaveReqVO logVO,HaiNanDianXinApiConfig config, FraudCheckRequest request) throws UnirestException {
return doPost(config, "fraudCheck", request, FraudCheckResponse.class); return doPost( logVO,config, "fraudCheck", request, FraudCheckResponse.class);
} }
/** /**
@ -71,8 +72,8 @@ public class HaiNanDianXinApi {
* @return 号码查询列表返回结果 * @return 号码查询列表返回结果
* @throws UnirestException 请求异常 * @throws UnirestException 请求异常
*/ */
public static HaiNanResponseInfo<QryNbrListResponse> qryNbrList(HaiNanDianXinApiConfig config, QryNbrListRequest request) throws UnirestException { public static HaiNanResponseInfo<QryNbrListResponse> qryNbrList(final SuperiorApiLogSaveReqVO logVO,HaiNanDianXinApiConfig config, QryNbrListRequest request) throws UnirestException {
return doPost(config, "qryNbrList", request, QryNbrListResponse.class); return doPost( logVO,config, "qryNbrList", request, QryNbrListResponse.class);
} }
/** /**
@ -82,8 +83,8 @@ public class HaiNanDianXinApi {
* @return 订单信息查询返回结果 * @return 订单信息查询返回结果
* @throws UnirestException 请求异常 * @throws UnirestException 请求异常
*/ */
public static HaiNanResponseInfo<QueryOrderInfoResponse> queryOrderInfo(HaiNanDianXinApiConfig config, QueryOrderInfoRequest request) throws UnirestException { public static HaiNanResponseInfo<QueryOrderInfoResponse> queryOrderInfo(final SuperiorApiLogSaveReqVO logVO,HaiNanDianXinApiConfig config, QueryOrderInfoRequest request) throws UnirestException {
return doPost(config, "queryOrderInfo", request, QueryOrderInfoResponse.class); return doPost( logVO,config, "queryOrderInfo", request, QueryOrderInfoResponse.class);
} }
/** /**
@ -93,8 +94,9 @@ public class HaiNanDianXinApi {
* @return 物流轨迹查询返回结果 * @return 物流轨迹查询返回结果
* @throws UnirestException 请求异常 * @throws UnirestException 请求异常
*/ */
public static HaiNanResponseInfo<GetLogisticsTrajectoryResponse> getLogisticsTrajectory(HaiNanDianXinApiConfig config, GetLogisticsTrajectoryRequest request) throws UnirestException { public static HaiNanResponseInfo<GetLogisticsTrajectoryResponse> getLogisticsTrajectory(final SuperiorApiLogSaveReqVO logVO,
return doPost(config, "getLogisticsTrajectory", request, GetLogisticsTrajectoryResponse.class); HaiNanDianXinApiConfig config, GetLogisticsTrajectoryRequest request) throws UnirestException {
return doPost( logVO,config, "getLogisticsTrajectory", request, GetLogisticsTrajectoryResponse.class);
} }
/** /**
@ -104,8 +106,8 @@ public class HaiNanDianXinApi {
* @return 号卡订单收敛返回结果 * @return 号卡订单收敛返回结果
* @throws UnirestException 请求异常 * @throws UnirestException 请求异常
*/ */
public static HaiNanResponseInfo<SynOrderInfoResponse> synOrderInfo(HaiNanDianXinApiConfig config, SynOrderInfoRequest request) throws UnirestException { public static HaiNanResponseInfo<SynOrderInfoResponse> synOrderInfo(final SuperiorApiLogSaveReqVO logVO,HaiNanDianXinApiConfig config, SynOrderInfoRequest request) throws UnirestException {
return doPost(config, "synOrderInfo", request, SynOrderInfoResponse.class); return doPost(logVO,config, "synOrderInfo", request, SynOrderInfoResponse.class);
} }
/** /**
@ -119,15 +121,17 @@ public class HaiNanDianXinApi {
* @return 返回结果 * @return 返回结果
* @throws UnirestException 请求异常 * @throws UnirestException 请求异常
*/ */
private static <R, P> HaiNanResponseInfo<R> doPost(HaiNanDianXinApiConfig config, String method, P param, Class<R> rClass) throws UnirestException { private static <R, P> HaiNanResponseInfo<R> doPost(final SuperiorApiLogSaveReqVO logVO, HaiNanDianXinApiConfig config, String method, P param, Class<R> rClass) throws UnirestException {
String jsonString = JSON.toJSONString(param); String jsonString = JSON.toJSONString(param);
String encryptedBody = UopRSAUtils.encryptByPublicKey(jsonString, config.publicKey); String encryptedBody = UopRSAUtils.encryptByPublicKey(jsonString, config.publicKey);
logVO.setParam(encryptedBody);
String xAuthHeader = generateXAuthHeader(config, method, jsonString); String xAuthHeader = generateXAuthHeader(config, method, jsonString);
HttpResponse<String> response = Unirest.post(config.url) HttpResponse<String> response = Unirest.post(config.url)
.header("Content-Type", "application/json") .header("Content-Type", "application/json")
.header("x-auth", xAuthHeader) .header("x-auth", xAuthHeader)
.body(encryptedBody) .body(encryptedBody)
.asString(); .asString();
logVO.setResponse(response.getBody());
return dealResponse(response, rClass); return dealResponse(response, rClass);
} }

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.haoka.api.hunandianxin; package cn.iocoder.yudao.module.haoka.api.hunandianxin;
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
@ -28,69 +29,68 @@ public class HuNanDXApi {
// 接口1校验互联网卡下单资格_新(BPS)chk.ordercheck.InternetCardQualifica // 接口1校验互联网卡下单资格_新(BPS)chk.ordercheck.InternetCardQualifica
public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.InternetCardQualificationResp> public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.InternetCardQualificationResp>
checkInternetCardQualification(HaiNanDxInfo.ConfigInfo config, checkInternetCardQualification(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.ConfigInfo config,
HaiNanDxInfo.InternetCardQualificationParam param) throws Exception { HaiNanDxInfo.InternetCardQualificationParam param) throws Exception {
return doExecute(config, "chk.ordercheck.InternetCardQualifica", param, HaiNanDxInfo.InternetCardQualificationResp.class); return doExecute(logVO, config, "chk.ordercheck.InternetCardQualifica", param, HaiNanDxInfo.InternetCardQualificationResp.class);
} }
// 接口2同步订单信息给BPSsyn.orderinfo.SynJdServiceOrder // 接口2同步订单信息给BPSsyn.orderinfo.SynJdServiceOrder
public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SyncOrderResp> public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SyncOrderResp>
syncOrder(HaiNanDxInfo.ConfigInfo config, HaiNanDxInfo.SyncOrderParam param) throws Exception { syncOrder(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.ConfigInfo config, HaiNanDxInfo.SyncOrderParam param) throws Exception {
return doExecute(config, "syn.orderinfo.SynJdServiceOrder", param, HaiNanDxInfo.SyncOrderResp.class); return doExecute(logVO, config, "syn.orderinfo.SynJdServiceOrder", param, HaiNanDxInfo.SyncOrderResp.class);
} }
// 接口3查询BPS业务订单详情qry.order.QryBpsOrderInfo // 接口3查询BPS业务订单详情qry.order.QryBpsOrderInfo
public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryOrderResp> public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryOrderResp>
queryOrder(HaiNanDxInfo.ConfigInfo config, HaiNanDxInfo.QueryOrderParam param) throws Exception { queryOrder(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.ConfigInfo config, HaiNanDxInfo.QueryOrderParam param) throws Exception {
return doExecute(config, "qry.order.QryBpsOrderInfo", param, HaiNanDxInfo.QueryOrderResp.class); return doExecute(logVO, config, "qry.order.QryBpsOrderInfo", param, HaiNanDxInfo.QueryOrderResp.class);
} }
// 接口5短信渠道短信验证码发送push.sms.sendsmsCode // 接口5短信渠道短信验证码发送push.sms.sendsmsCode
public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SendSmsCodeResp> public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SendSmsCodeResp>
sendSmsCode(HaiNanDxInfo.ConfigInfo config, HaiNanDxInfo.SendSmsCodeParam param) throws Exception { sendSmsCode(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.ConfigInfo config, HaiNanDxInfo.SendSmsCodeParam param) throws Exception {
return doExecute(config, "push.sms.sendsmsCode", param, HaiNanDxInfo.SendSmsCodeResp.class); return doExecute(logVO, config, "push.sms.sendsmsCode", param, HaiNanDxInfo.SendSmsCodeResp.class);
} }
// 接口6短信渠道下发短信验证码是否验证通过push.sms.sendsmsCodeYz // 接口6短信渠道下发短信验证码是否验证通过push.sms.sendsmsCodeYz
public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.VerifySmsCodeResp> public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.VerifySmsCodeResp>
verifySmsCode(HaiNanDxInfo.ConfigInfo config, HaiNanDxInfo.VerifySmsCodeParam param) throws Exception { verifySmsCode(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.ConfigInfo config, HaiNanDxInfo.VerifySmsCodeParam param) throws Exception {
return doExecute(config, "push.sms.sendsmsCodeYz", param, HaiNanDxInfo.VerifySmsCodeResp.class); return doExecute(logVO, config, "push.sms.sendsmsCodeYz", param, HaiNanDxInfo.VerifySmsCodeResp.class);
} }
// 接口7号码查询qry.nmall.phoneNumberlList // 接口7号码查询qry.nmall.phoneNumberlList
public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryPhoneNumberResp> public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryPhoneNumberResp>
queryPhoneNumber(HaiNanDxInfo.ConfigInfo config, queryPhoneNumber(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.ConfigInfo config,
HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.QueryPhoneNumberParam> param) throws Exception { HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.QueryPhoneNumberParam> param) throws Exception {
// 生成签名 // 生成签名
JSONObject jsonObject = (JSONObject) JSON.toJSON(param); JSONObject jsonObject = (JSONObject) JSON.toJSON(param);
String sign = genSignFromMap(jsonObject, config.getSecret()); String sign = genSignFromMap(jsonObject, config.getSecret());
param.setSign(sign); param.setSign(sign);
return doExecute(config, "qry.nmall.phoneNumberlList", param, HaiNanDxInfo.QueryPhoneNumberResp.class); return doExecute(logVO, config, "qry.nmall.phoneNumberlList", param, HaiNanDxInfo.QueryPhoneNumberResp.class);
} }
// 接口8占用号码qry.nmall.possessPhoneNumber // 接口8占用号码qry.nmall.possessPhoneNumber
public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.PossessPhoneNumberResp> public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.PossessPhoneNumberResp>
possessPhoneNumber(HaiNanDxInfo.ConfigInfo config, possessPhoneNumber(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.ConfigInfo config,
HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.PossessPhoneNumberParam> param) throws Exception { HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.PossessPhoneNumberParam> param) throws Exception {
// 生成签名 // 生成签名
JSONObject jsonObject = (JSONObject) JSON.toJSON(param); JSONObject jsonObject = (JSONObject) JSON.toJSON(param);
String sign = genSignFromMap(jsonObject, config.getSecret()); String sign = genSignFromMap(jsonObject, config.getSecret());
param.setSign(sign); param.setSign(sign);
return doExecute(config, "qry.nmall.possessPhoneNumber", param, HaiNanDxInfo.PossessPhoneNumberResp.class); return doExecute(logVO, config, "qry.nmall.possessPhoneNumber", param, HaiNanDxInfo.PossessPhoneNumberResp.class);
} }
// 接口9联系电话黑名单接口getBlackDataByPhone // 接口9联系电话黑名单接口getBlackDataByPhone
public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.BlackListCheckResp> public static HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.BlackListCheckResp>
checkBlackList(HaiNanDxInfo.ConfigInfo config, HaiNanDxInfo.BlackListCheckParam param) throws Exception { checkBlackList(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.ConfigInfo config, HaiNanDxInfo.BlackListCheckParam param) throws Exception {
return doExecute(config, "getBlackDataByPhone", param, HaiNanDxInfo.BlackListCheckResp.class); return doExecute(logVO, config, "getBlackDataByPhone", param, HaiNanDxInfo.BlackListCheckResp.class);
} }
// 通用 API 调用方法 // 通用 API 调用方法
private static <T, R> HaiNanDxInfo.ResponseInfo<R> private static <T, R> HaiNanDxInfo.ResponseInfo<R>
doExecute(HaiNanDxInfo.ConfigInfo config, String method, T data, Class<R> rClass) throws Exception { doExecute(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.ConfigInfo config, String method, T data, Class<R> rClass) throws Exception {
JSONObject jsonObject = (JSONObject) JSON.toJSON(data); JSONObject jsonObject = (JSONObject) JSON.toJSON(data);
String calledApi = callApi(config, method, jsonObject); String calledApi = callApi(logVO, config, method, jsonObject);
System.out.println("-------{}--" + calledApi);
HaiNanDxInfo.ResponseInfo responseInfo = JSON.parseObject(calledApi, HaiNanDxInfo.ResponseInfo.class); HaiNanDxInfo.ResponseInfo responseInfo = JSON.parseObject(calledApi, HaiNanDxInfo.ResponseInfo.class);
JSONObject result = responseInfo.getResult(); JSONObject result = responseInfo.getResult();
@ -102,6 +102,7 @@ public class HuNanDXApi {
} }
return objectResponseInfo; return objectResponseInfo;
} }
private static CloseableHttpClient createHttpClientIgnoreSSL() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException { private static CloseableHttpClient createHttpClientIgnoreSSL() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException {
// 创建信任所有证书的TrustStrategy // 创建信任所有证书的TrustStrategy
TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;
@ -121,7 +122,7 @@ public class HuNanDXApi {
} }
// 通用 API 调用方法 // 通用 API 调用方法
private static String callApi(HaiNanDxInfo.ConfigInfo config, String method, JSONObject data) throws Exception { private static String callApi(final SuperiorApiLogSaveReqVO logVO, HaiNanDxInfo.ConfigInfo config, String method, JSONObject data) throws Exception {
// 构建请求体 // 构建请求体
Map<String, Object> requestBody = new TreeMap<>(); Map<String, Object> requestBody = new TreeMap<>();
requestBody.put("access_token", config.getAccessToken()); requestBody.put("access_token", config.getAccessToken());
@ -131,14 +132,17 @@ public class HuNanDXApi {
// 发送 HTTP 请求 // 发送 HTTP 请求
try (CloseableHttpClient httpClient = createHttpClientIgnoreSSL()) { try (CloseableHttpClient httpClient = createHttpClientIgnoreSSL()) {
HttpPost httpPost = new HttpPost(config.getBaseUrl()); String baseUrl = config.getBaseUrl();
logVO.setUrl(baseUrl);
logVO.setParam(JSON.toJSONString(requestBody));
HttpPost httpPost = new HttpPost(baseUrl);
httpPost.setHeader("Content-Type", "application/json; charset=UTF-8"); httpPost.setHeader("Content-Type", "application/json; charset=UTF-8");
httpPost.setEntity(new StringEntity(new ObjectMapper().writeValueAsString(requestBody))); httpPost.setEntity(new StringEntity(new ObjectMapper().writeValueAsString(requestBody)));
CloseableHttpResponse response = httpClient.execute(httpPost); CloseableHttpResponse response = httpClient.execute(httpPost);
String string = EntityUtils.toString(response.getEntity()); String string = EntityUtils.toString(response.getEntity());
log.info("Response Code: " + response.getStatusLine().getStatusCode()); logVO.setResponse(JSON.toJSONString(string));
httpClient.close(); httpClient.close();
return string; return string;
} }

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.haoka.controller.admin.api;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.haoka.api.ApiHaiNanDXService; import cn.iocoder.yudao.module.haoka.api.ApiHaiNanDXService;
import cn.iocoder.yudao.module.haoka.api.hainandianxin.HaiNanDianXinApi; import cn.iocoder.yudao.module.haoka.api.hainandianxin.HaiNanDianXinApi;
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
import com.mashape.unirest.http.exceptions.UnirestException; import com.mashape.unirest.http.exceptions.UnirestException;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -27,34 +28,34 @@ public class HaokaApiHaiNanDXController {
@Operation(summary = "海南电信-选号接口") @Operation(summary = "海南电信-选号接口")
public CommonResult<HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.QryNbrListResponse>> public CommonResult<HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.QryNbrListResponse>>
lianTongSelectNumber(@RequestBody HaiNanDianXinApi.QryNbrListRequest param) throws UnirestException { lianTongSelectNumber(@RequestBody HaiNanDianXinApi.QryNbrListRequest param) throws UnirestException {
return success(apiHaiNanDXService.qryNbrList(param)); return success(apiHaiNanDXService.qryNbrList(new SuperiorApiLogSaveReqVO(), param));
} }
@PostMapping("/fraudCheck") @PostMapping("/fraudCheck")
@Operation(summary = "海南电信-防诈校验接口") @Operation(summary = "海南电信-防诈校验接口")
public CommonResult<HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.FraudCheckResponse>> public CommonResult<HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.FraudCheckResponse>>
fraudCheck(@RequestBody HaiNanDianXinApi.FraudCheckRequest param) throws UnirestException { fraudCheck(@RequestBody HaiNanDianXinApi.FraudCheckRequest param) throws UnirestException {
return success(apiHaiNanDXService.fraudCheck(param)); return success(apiHaiNanDXService.fraudCheck(new SuperiorApiLogSaveReqVO(), param));
} }
@PostMapping("/queryOrderInfo") @PostMapping("/queryOrderInfo")
@Operation(summary = "海南电信-订单信息查询接口") @Operation(summary = "海南电信-订单信息查询接口")
public CommonResult<HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.QueryOrderInfoResponse>> public CommonResult<HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.QueryOrderInfoResponse>>
queryOrderInfo(@RequestBody HaiNanDianXinApi.QueryOrderInfoRequest param) throws UnirestException { queryOrderInfo(@RequestBody HaiNanDianXinApi.QueryOrderInfoRequest param) throws UnirestException {
return success(apiHaiNanDXService.queryOrderInfo(param)); return success(apiHaiNanDXService.queryOrderInfo(new SuperiorApiLogSaveReqVO(), param));
} }
@PostMapping("/getLogisticsTrajectory") @PostMapping("/getLogisticsTrajectory")
@Operation(summary = "海南电信-物流轨迹查询接口") @Operation(summary = "海南电信-物流轨迹查询接口")
public CommonResult<HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.GetLogisticsTrajectoryResponse>> public CommonResult<HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.GetLogisticsTrajectoryResponse>>
getLogisticsTrajectory(@RequestBody HaiNanDianXinApi.GetLogisticsTrajectoryRequest param) throws UnirestException { getLogisticsTrajectory(@RequestBody HaiNanDianXinApi.GetLogisticsTrajectoryRequest param) throws UnirestException {
return success(apiHaiNanDXService.getLogisticsTrajectory(param)); return success(apiHaiNanDXService.getLogisticsTrajectory(new SuperiorApiLogSaveReqVO(), param));
} }
@PostMapping("/synOrderInfo") @PostMapping("/synOrderInfo")
@Operation(summary = "海南电信-号卡订单收敛接口") @Operation(summary = "海南电信-号卡订单收敛接口")
public CommonResult<HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.SynOrderInfoResponse>> public CommonResult<HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.SynOrderInfoResponse>>
synOrderInfo(@RequestBody HaiNanDianXinApi.SynOrderInfoRequest param) throws UnirestException { synOrderInfo(@RequestBody HaiNanDianXinApi.SynOrderInfoRequest param) throws UnirestException {
return success(apiHaiNanDXService.synOrderInfo(param)); return success(apiHaiNanDXService.synOrderInfo(new SuperiorApiLogSaveReqVO(), param));
} }
} }

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.haoka.controller.admin.api;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.haoka.api.ApiHuNanDXService; import cn.iocoder.yudao.module.haoka.api.ApiHuNanDXService;
import cn.iocoder.yudao.module.haoka.api.hunandianxin.HaiNanDxInfo; import cn.iocoder.yudao.module.haoka.api.hunandianxin.HaiNanDxInfo;
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@ -28,35 +29,35 @@ public class HaokaHuNanDXController {
@Operation(summary = "湖南电信-校验互联网卡下单资格") @Operation(summary = "湖南电信-校验互联网卡下单资格")
public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.InternetCardQualificationResp>> public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.InternetCardQualificationResp>>
checkInternetCardQualification(@RequestBody HaiNanDxInfo.InternetCardQualificationParam param) throws Exception { checkInternetCardQualification(@RequestBody HaiNanDxInfo.InternetCardQualificationParam param) throws Exception {
return success(apiHuNanDXService.checkInternetCardQualification(param)); return success(apiHuNanDXService.checkInternetCardQualification(new SuperiorApiLogSaveReqVO(), param));
} }
@PostMapping("/syncOrder") @PostMapping("/syncOrder")
@Operation(summary = "湖南电信-同步订单信息") @Operation(summary = "湖南电信-同步订单信息")
public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SyncOrderResp>> public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SyncOrderResp>>
syncOrder(@RequestBody HaiNanDxInfo.SyncOrderParam param) throws Exception { syncOrder(@RequestBody HaiNanDxInfo.SyncOrderParam param) throws Exception {
return success(apiHuNanDXService.syncOrder(param)); return success(apiHuNanDXService.syncOrder(new SuperiorApiLogSaveReqVO(), param));
} }
@PostMapping("/queryOrder") @PostMapping("/queryOrder")
@Operation(summary = "湖南电信-查询订单详情") @Operation(summary = "湖南电信-查询订单详情")
public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryOrderResp>> public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryOrderResp>>
queryOrder(@RequestBody HaiNanDxInfo.QueryOrderParam param) throws Exception { queryOrder(@RequestBody HaiNanDxInfo.QueryOrderParam param) throws Exception {
return success(apiHuNanDXService.queryOrder(param)); return success(apiHuNanDXService.queryOrder(new SuperiorApiLogSaveReqVO(), param));
} }
@PostMapping("/sendSmsCode") @PostMapping("/sendSmsCode")
@Operation(summary = "湖南电信-发送短信验证码") @Operation(summary = "湖南电信-发送短信验证码")
public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SendSmsCodeResp>> public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SendSmsCodeResp>>
sendSmsCode(@RequestBody HaiNanDxInfo.SendSmsCodeParam param) throws Exception { sendSmsCode(@RequestBody HaiNanDxInfo.SendSmsCodeParam param) throws Exception {
return success(apiHuNanDXService.sendSmsCode(param)); return success(apiHuNanDXService.sendSmsCode(new SuperiorApiLogSaveReqVO(), param));
} }
@PostMapping("/verifySmsCode") @PostMapping("/verifySmsCode")
@Operation(summary = "湖南电信-验证短信验证码") @Operation(summary = "湖南电信-验证短信验证码")
public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.VerifySmsCodeResp>> public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.VerifySmsCodeResp>>
verifySmsCode(@RequestBody HaiNanDxInfo.VerifySmsCodeParam param) throws Exception { verifySmsCode(@RequestBody HaiNanDxInfo.VerifySmsCodeParam param) throws Exception {
return success(apiHuNanDXService.verifySmsCode(param)); return success(apiHuNanDXService.verifySmsCode(new SuperiorApiLogSaveReqVO(), param));
} }
@PermitAll @PermitAll
@ -64,20 +65,20 @@ public class HaokaHuNanDXController {
@Operation(summary = "湖南电信-查询号码") @Operation(summary = "湖南电信-查询号码")
public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryPhoneNumberResp>> public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryPhoneNumberResp>>
queryPhoneNumber(@RequestBody HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.QueryPhoneNumberParam> param) throws Exception { queryPhoneNumber(@RequestBody HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.QueryPhoneNumberParam> param) throws Exception {
return success(apiHuNanDXService.queryPhoneNumber(param)); return success(apiHuNanDXService.queryPhoneNumber(new SuperiorApiLogSaveReqVO(),param));
} }
@PostMapping("/possessPhoneNumber") @PostMapping("/possessPhoneNumber")
@Operation(summary = "湖南电信-占用号码") @Operation(summary = "湖南电信-占用号码")
public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.PossessPhoneNumberResp>> public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.PossessPhoneNumberResp>>
possessPhoneNumber(@RequestBody HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.PossessPhoneNumberParam> param) throws Exception { possessPhoneNumber(@RequestBody HaiNanDxInfo.NeedSignQueryParam<HaiNanDxInfo.PossessPhoneNumberParam> param) throws Exception {
return success(apiHuNanDXService.possessPhoneNumber(param)); return success(apiHuNanDXService.possessPhoneNumber(new SuperiorApiLogSaveReqVO(),param));
} }
@PostMapping("/checkBlackList") @PostMapping("/checkBlackList")
@Operation(summary = "湖南电信-检查黑名单") @Operation(summary = "湖南电信-检查黑名单")
public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.BlackListCheckResp>> public CommonResult<HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.BlackListCheckResp>>
checkBlackList(@RequestBody HaiNanDxInfo.BlackListCheckParam param) throws Exception { checkBlackList(@RequestBody HaiNanDxInfo.BlackListCheckParam param) throws Exception {
return success(apiHuNanDXService.checkBlackList(param)); return success(apiHuNanDXService.checkBlackList(new SuperiorApiLogSaveReqVO(),param));
} }
} }

View File

@ -3,9 +3,12 @@ package cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo;
import cn.iocoder.yudao.module.haoka.utils.SnowflakeId; import cn.iocoder.yudao.module.haoka.utils.SnowflakeId;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "管理后台 - 订单接口记录新增/修改 Request VO") @Schema(description = "管理后台 - 订单接口记录新增/修改 Request VO")
@ -32,24 +35,40 @@ public class SuperiorApiLogSaveReqVO {
private Integer apiType; private Integer apiType;
@Schema(description = "URl", example = "https://www.iocoder.cn") @Schema(description = "URl", example = "https://www.iocoder.cn")
private String url; private String url = "";
@Schema(description = "参数") @Schema(description = "参数")
private String param; private String param = "";
@Schema(description = "响应") @Schema(description = "响应")
private String response; private String response = "";
@Schema(description = "成功") @Schema(description = "成功")
private Boolean success; private Boolean success;
@Schema(description = "备注") @Schema(description = "备注")
private String innerNote; private String innerNote = "";
@Schema(description = "错误") @Schema(description = "错误")
private String errorInfo; private String errorInfo = "";
@Schema(description = "部门ID", example = "25249") @Schema(description = "部门ID", example = "25249")
private Long deptId; private Long deptId;
public void setParam(String param) {
this.param = this.param + param;
}
public void setResponse(String response) {
this.response = this.response + response;
}
public void setInnerNote(String innerNote) {
this.innerNote = this.innerNote + innerNote;
}
public void setErrorInfo(String errorInfo) {
this.errorInfo = this.errorInfo + errorInfo;
}
} }

View File

@ -37,6 +37,8 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
@Override @Override
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) { public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) {
logVO.setApiType(1); logVO.setApiType(1);
logVO.setHaokaOrderId(param.getId());
logVO.setHaokaProductId(param.getProductId());
try { try {
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(param.getProductId()); ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(param.getProductId());
if (apiDealStrategy == null) { if (apiDealStrategy == null) {
@ -45,7 +47,16 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
logVO.setErrorInfo(noneService); logVO.setErrorInfo(noneService);
return ApiDealResp.failed(noneService); return ApiDealResp.failed(noneService);
} }
return apiDealStrategy.createOrder(param); ApiDealResp<OrderApiCreateResp> respApiDealResp = apiDealStrategy.createOrder(param);
if (!respApiDealResp.getIsSupport()){
logVO.setSuccess(false);
logVO.setInnerNote(respApiDealResp.getMsg());
}
if (!respApiDealResp.getSuccess()){
logVO.setSuccess(false);
logVO.setInnerNote(respApiDealResp.getMsg());
}
return respApiDealResp;
} catch (Exception e) { } catch (Exception e) {
logVO.setSuccess(false); logVO.setSuccess(false);
logVO.setErrorInfo(e.getMessage()); logVO.setErrorInfo(e.getMessage());
@ -59,6 +70,8 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
@Override @Override
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) { public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) {
logVO.setApiType(2); logVO.setApiType(2);
logVO.setHaokaOrderId(param.getId());
logVO.setHaokaProductId(param.getProductId());
try { try {
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(param.getProductId()); ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(param.getProductId());
if (apiDealStrategy == null) { if (apiDealStrategy == null) {
@ -67,7 +80,16 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
logVO.setErrorInfo(noneService); logVO.setErrorInfo(noneService);
return ApiDealResp.failed(noneService); return ApiDealResp.failed(noneService);
} }
return apiDealStrategy.queryOrder(param); ApiDealResp<OrderApiQueryResp> respApiDealResp = apiDealStrategy.queryOrder(param);
if (!respApiDealResp.getIsSupport()){
logVO.setSuccess(false);
logVO.setInnerNote(respApiDealResp.getMsg());
}
if (!respApiDealResp.getSuccess()){
logVO.setSuccess(false);
logVO.setInnerNote(respApiDealResp.getMsg());
}
return respApiDealResp;
} catch (Exception e) { } catch (Exception e) {
logVO.setSuccess(false); logVO.setSuccess(false);
logVO.setErrorInfo(e.getMessage()); logVO.setErrorInfo(e.getMessage());

View File

@ -51,7 +51,8 @@ public class HaiNanDxApiDealStrategy implements ApiDealStrategy {
HaiNanDianXinApi.SynOrderInfoRequest createParam = new HaiNanDianXinApi.SynOrderInfoRequest(); HaiNanDianXinApi.SynOrderInfoRequest createParam = new HaiNanDianXinApi.SynOrderInfoRequest();
try { try {
HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.SynOrderInfoResponse> responseInfo = apiHaiNanDXService.synOrderInfo(createParam); HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.SynOrderInfoResponse> responseInfo
= apiHaiNanDXService.synOrderInfo(logVO, createParam);
HaiNanDianXinApi.SynOrderInfoResponse data = responseInfo.getData(); HaiNanDianXinApi.SynOrderInfoResponse data = responseInfo.getData();
if (data == null) { if (data == null) {
return ApiDealResp.failed(responseInfo.getErrMsg()); return ApiDealResp.failed(responseInfo.getErrMsg());
@ -72,7 +73,7 @@ public class HaiNanDxApiDealStrategy implements ApiDealStrategy {
try { try {
HaiNanDianXinApi.QueryOrderInfoRequest queryParam = new HaiNanDianXinApi.QueryOrderInfoRequest(); HaiNanDianXinApi.QueryOrderInfoRequest queryParam = new HaiNanDianXinApi.QueryOrderInfoRequest();
HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.QueryOrderInfoResponse> responseInfo = apiHaiNanDXService.queryOrderInfo(queryParam); HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.QueryOrderInfoResponse> responseInfo = apiHaiNanDXService.queryOrderInfo(logVO, queryParam);
if (responseInfo.getData() == null) { if (responseInfo.getData() == null) {
return ApiDealResp.failed(responseInfo.getErrMsg()); return ApiDealResp.failed(responseInfo.getErrMsg());

View File

@ -54,7 +54,7 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
HaiNanDianXinApi.SynOrderInfoRequest createParam = new HaiNanDianXinApi.SynOrderInfoRequest(); HaiNanDianXinApi.SynOrderInfoRequest createParam = new HaiNanDianXinApi.SynOrderInfoRequest();
try { try {
HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SyncOrderResp> responseInfo = apiHuNanDXService.syncOrder(orderParam); HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SyncOrderResp> responseInfo = apiHuNanDXService.syncOrder(logVO,orderParam);
if (responseInfo.getData() == null) { if (responseInfo.getData() == null) {
@ -75,7 +75,7 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
try { try {
HaiNanDxInfo.QueryOrderParam queryParam = new HaiNanDxInfo.QueryOrderParam(); HaiNanDxInfo.QueryOrderParam queryParam = new HaiNanDxInfo.QueryOrderParam();
queryParam.setOutId(param.getOuterOrderId()); queryParam.setOutId(param.getOuterOrderId());
HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryOrderResp> responseInfo = apiHuNanDXService.queryOrder(queryParam); HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryOrderResp> responseInfo = apiHuNanDXService.queryOrder(logVO,queryParam);
if (responseInfo.getData() == null) { if (responseInfo.getData() == null) {
return ApiDealResp.failed(responseInfo.getRes_message()); return ApiDealResp.failed(responseInfo.getRes_message());

View File

@ -52,11 +52,6 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
LianTongArea numAddress = getAddress(preProduct.getParentProduct().getBelongAreaCode()); LianTongArea numAddress = getAddress(preProduct.getParentProduct().getBelongAreaCode());
// 0占用号码 lianTongZhanHao
// 1提交资料 lianTongSubmitUserInfo
// 2提交预订单 得到token lianTongPreOrderSync
// 3 token提交正式订单 lianTongOrderSyncV2
// 0占用号码 lianTongZhanHao // 0占用号码 lianTongZhanHao
KingNumStateChangeRequest stateChangeRequest = new KingNumStateChangeRequest(); KingNumStateChangeRequest stateChangeRequest = new KingNumStateChangeRequest();
stateChangeRequest.setCityCode(numAddress.getPhoneCityCode()); stateChangeRequest.setCityCode(numAddress.getPhoneCityCode());
@ -65,8 +60,10 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
stateChangeRequest.setOccupiedFlag("S"); stateChangeRequest.setOccupiedFlag("S");
stateChangeRequest.setCertCode(param.getIdCardNum()); stateChangeRequest.setCertCode(param.getIdCardNum());
stateChangeRequest.setOccupiedTimeTag("S1"); stateChangeRequest.setOccupiedTimeTag("S1");
KingNumStateChangeResponse stateChangeResponse = apiLianTongService.lianTongZhanHao(stateChangeRequest);
logVO.setParam(JSON.toJSONString(stateChangeRequest));
KingNumStateChangeResponse stateChangeResponse = apiLianTongService.lianTongZhanHao(stateChangeRequest);
logVO.setResponse(JSON.toJSONString(stateChangeResponse));
if (!"0".equals(stateChangeResponse.getRspCode())) { if (!"0".equals(stateChangeResponse.getRspCode())) {
return ApiDealResp.failed(stateChangeResponse.getRspCode()); return ApiDealResp.failed(stateChangeResponse.getRspCode());
} }
@ -77,8 +74,12 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
ziLiao.setCity(numAddress.getPhoneCityCode()); ziLiao.setCity(numAddress.getPhoneCityCode());
ziLiao.setCertName(param.getIdCardName()); ziLiao.setCertName(param.getIdCardName());
ziLiao.setCertNum(param.getIdCardNum()); ziLiao.setCertNum(param.getIdCardNum());
logVO.setParam(JSON.toJSONString(ziLiao));
KingIdentityCustV2Response ziLiaoResponse KingIdentityCustV2Response ziLiaoResponse
= apiLianTongService.lianTongSubmitUserInfo(ziLiao); = apiLianTongService.lianTongSubmitUserInfo(ziLiao);
logVO.setResponse(JSON.toJSONString(ziLiaoResponse));
String rspCode = ziLiaoResponse.getaDesc(); String rspCode = ziLiaoResponse.getaDesc();
if (!"成功".equals(rspCode)) { if (!"成功".equals(rspCode)) {
@ -95,12 +96,18 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
preOrder.setPostCityCode(receiveAddress.getCityCode()); preOrder.setPostCityCode(receiveAddress.getCityCode());
preOrder.setPostDistrictCode(receiveAddress.getDistrictCode()); preOrder.setPostDistrictCode(receiveAddress.getDistrictCode());
preOrder.setPostAddr(param.getAddress()); preOrder.setPostAddr(param.getAddress());
String channel = apiLianTongService.getConfigValue(LianTongApiUtil.KEY_channel); String channel = apiLianTongService.getConfigValue(LianTongApiUtil.KEY_channel);
preOrder.setChannel(channel); preOrder.setChannel(channel);
preOrder.setCreateTime(format); preOrder.setCreateTime(format);
preOrder.setUpdateTime(format); preOrder.setUpdateTime(format);
preOrder.setContactNum(param.getAddressMobile()); preOrder.setContactNum(param.getAddressMobile());
logVO.setParam(JSON.toJSONString(preOrder));
KingPreOrderSyncResponse preOrderResponse = apiLianTongService.lianTongPreOrderSync(preOrder); KingPreOrderSyncResponse preOrderResponse = apiLianTongService.lianTongPreOrderSync(preOrder);
logVO.setResponse(JSON.toJSONString(preOrderResponse));
if (!"0000".equals(preOrderResponse.getRspCode())) { if (!"0000".equals(preOrderResponse.getRspCode())) {
return ApiDealResp.failed(stateChangeResponse.getRspDesc()); return ApiDealResp.failed(stateChangeResponse.getRspDesc());
} }
@ -117,13 +124,16 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
syncV2.setCreateTime(format); syncV2.setCreateTime(format);
syncV2.setPhoneNum(param.getPlanMobile()); syncV2.setPhoneNum(param.getPlanMobile());
syncV2.setGoodsId(preProduct.getSuperiorProductConfigRespVO().getSuperiorCode()); syncV2.setGoodsId(preProduct.getSuperiorProductConfigRespVO().getSuperiorCode());
syncV2.setToken("tokentokentokentoken");
KingOrderSyncResponse syncV2Response = apiLianTongService.lianTongOrderSyncV2(syncV2); syncV2.setToken(preOrderResponse.getBody());
if (!"0000".equals(syncV2Response.getRspCode())) {
logVO.setParam(JSON.toJSONString(syncV2));
KingOrderSyncResponse response = apiLianTongService.lianTongOrderSyncV2(syncV2);
logVO.setResponse(JSON.toJSONString(response));
if (!"0000".equals(response.getRspCode())) {
return ApiDealResp.failed(stateChangeResponse.getRspDesc()); return ApiDealResp.failed(stateChangeResponse.getRspDesc());
} }
KingOrderSyncResponse response = apiLianTongService.lianTongOrderSyncV2(syncV2);
OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp(); OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp();
orderApiCreateResp.setData(response); orderApiCreateResp.setData(response);
return ApiDealResp.ok(orderApiCreateResp); return ApiDealResp.ok(orderApiCreateResp);