|
@@ -75,6 +75,8 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
private String bjcaRootTest;
|
|
|
@Value("${custom.decryptKey}")
|
|
|
private String decryptKey;
|
|
|
+ @Value("${custom.authMode-0x18}")
|
|
|
+ private String authMode18;
|
|
|
|
|
|
private OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
|
|
|
|
|
@@ -936,4 +938,84 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
}
|
|
|
return customBody;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ChannelTypeHandleResponseObject validateIdentityInfoValidity(HttpServletRequest request, String customBody, int outTime) {
|
|
|
+ ChannelTypeHandleResponseObject ret = new ChannelTypeHandleResponseObject();
|
|
|
+ ret.setIsCharge(Constant.INTERFACE_QUERY_NO_FEE);
|
|
|
+ String upstreamCode = Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
|
|
|
+ String returnType = request.getHeader(Constant.CUSTOMER_RETURN_TYPE_PARA);
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(returnType)) {
|
|
|
+ returnType = Constant.CUSTOMER_RETURN_ZW;
|
|
|
+ }
|
|
|
+ if (outTime <= 0) {
|
|
|
+ outTime = Constant.HTTPCLIENT_CONNECTTIMEOUT;
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("validateIdentityInfoValidity---customBody={},outTime={}", customBody, outTime);
|
|
|
+
|
|
|
+ try {
|
|
|
+ /* BASE64Decoder decoder = new BASE64Decoder();
|
|
|
+ customBody = new String(decoder.decodeBuffer(customBody));
|
|
|
+ log.info("BASE64解码后customBody === " + customBody);*/
|
|
|
+ ValidIdentityInfoJsonResolveObject jsonResolveObject = objectMapper.readValue(customBody,
|
|
|
+ ValidIdentityInfoJsonResolveObject.class);
|
|
|
+ // 参数校验
|
|
|
+ if (!validateCompositeIdentityParams(ret, returnType, jsonResolveObject)) {
|
|
|
+ ret.setCode(Constant.SUCCESS);
|
|
|
+ request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 申请
|
|
|
+ ApplyResponseObject apply = dataSignature(authMode18, outTime);
|
|
|
+ if (apply == null || !apply.getBizPackage().getSuccess().equals("true")) {
|
|
|
+ // 申请失败,返回查询错误
|
|
|
+ if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
|
|
|
+ ret.setResultCode(Constant.OTHER_ERROR_CODE);
|
|
|
+ } else {
|
|
|
+ ret.setResultCode(Constant.JK_RETURN_CODE_OTHER_ERROR);
|
|
|
+ }
|
|
|
+ ret.setResultBody(Constant.OTHER_ERROR);
|
|
|
+ ret.setResultDesc(Constant.OTHER_ERROR);
|
|
|
+ ret.setCode(Constant.SUCCESS);
|
|
|
+ request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
+ log.info("validateIdentityInfoValidity---apply失败");
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置请求参数
|
|
|
+ DataRequestObject requestObject = getRequestObject(jsonResolveObject, authMode18, apply.getBizPackage().getBusinessSerialNumber(), "");
|
|
|
+ log.info("supplier10000027.validateIdentityInfoValidity接口requestObject={}", requestObject);
|
|
|
+ // 发起业务请求
|
|
|
+ String responseContext = callService(requestUrl, JSONObject.toJSONString(requestObject), outTime);
|
|
|
+ log.info("请求上游");
|
|
|
+ log.info("supplier10000027.validateIdentityInfoValidity接口responseContext={}", responseContext);
|
|
|
+ DataResponseObject responseObject = objectMapper.readValue(responseContext, DataResponseObject.class);
|
|
|
+ log.info("supplier10000027.validateIdentityInfoValidity接口responseObject={}", responseObject);
|
|
|
+
|
|
|
+ if (responseObject != null && responseObject.getBizPackage().getSuccess().equals("true")) {
|
|
|
+ ret.setCode(Constant.SUCCESS);
|
|
|
+ setIdentityInfoResponse(ret, returnType, responseObject.getBizPackage().getAuthResult());
|
|
|
+ if (ret.getResultCode() == Constant.JK_RETURN_CODE_1174 || ret.getResultCode() == Constant.ZW_RETURN_CODE_114) {
|
|
|
+ ret.setResultBody(responseObject.getBizPackage().getAuthResultRetainData());
|
|
|
+ }
|
|
|
+ upstreamCode = responseObject.getBizPackage().getAuthResult();
|
|
|
+ } else {
|
|
|
+ ret.setCode(Constant.FAIL);
|
|
|
+ }
|
|
|
+ } catch (SocketTimeoutException ste) {
|
|
|
+ ErrorUtils.captureException(ste);
|
|
|
+ log.info("supplier10000027.validateIdentityInfoValidity接口SocketTimeoutException={}", ste);
|
|
|
+ ret.setCode(Constant.REQUEST_TIMEOUT);
|
|
|
+ } catch (Exception ioe) {
|
|
|
+ ErrorUtils.captureException(ioe);
|
|
|
+ log.info("supplier10000027.validateIdentityInfoValidity接口Exception={}", ioe);
|
|
|
+ ret.setCode(Constant.FAIL);
|
|
|
+ }
|
|
|
+ //上游返回码
|
|
|
+ request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
}
|