|
@@ -100,6 +100,8 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
private String urlV6;
|
|
|
@Value("${supplier.sensitive}")
|
|
|
private String[] sensitive;
|
|
|
+ @Value("${supplier.identityInfoV2Url}")
|
|
|
+ private String identityInfoV2Url;
|
|
|
@Autowired
|
|
|
SupplierProperties supplierProperties;
|
|
|
@Autowired
|
|
@@ -1782,4 +1784,88 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
|
|
|
proxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ChannelTypeHandleResponseObject twoElementsCheckV2(HttpServletRequest request, String customBody, int outTime, String decodeType) {
|
|
|
+ ChannelTypeHandleResponseObject ret = new ChannelTypeHandleResponseObject();
|
|
|
+ ret.setIsCharge(Constant.INTERFACE_QUERY_NO_FEE);
|
|
|
+ ret.setCode(Constant.SUCCESS);
|
|
|
+ String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
|
|
|
+ request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
+ String returnType = request.getHeader(Constant.CUSTOMER_RETURN_TYPE_PARA);
|
|
|
+ String channelId = request.getHeader("channelId");
|
|
|
+ if (StringUtils.isBlank(returnType)) {
|
|
|
+ returnType = Constant.CUSTOMER_RETURN_ZW;
|
|
|
+ }
|
|
|
+ if (outTime <= SjjhConstant.PARA_ZERO) {
|
|
|
+ outTime = Constant.HTTPCLIENT_CONNECTTIMEOUT;
|
|
|
+ }
|
|
|
+ log.info("supplier10000043.twoElementsCheckV2---customBody={},outTime={}", customBody, outTime);
|
|
|
+ String key="identityInfoBQ"+twoElementsMethod;
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ String ymd = dateTimeFormatter.format(now);
|
|
|
+ String hashKey = "043-"+ymd;
|
|
|
+ boolean flag = checkVisitCount(hashKey,key,supplierProperties.getIdentityInfoV2Up(),channelId);
|
|
|
+ if(!flag){
|
|
|
+ countOver(ret,Constant.CUSTOMER_RETURN_JK);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ if (!decodeType.equals(SjjhConstant.DECODE_TYPE_COMMON)) {
|
|
|
+ customBody = decodeParams(ret, returnType, customBody, decodeType);
|
|
|
+ if (StringUtils.isBlank(customBody)) {
|
|
|
+ ret.setCode(Constant.SUCCESS);
|
|
|
+ reduceVisitCount(hashKey,key);
|
|
|
+ request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ TwoElementsRequestObject requestObject = objectMapper.readValue(customBody,
|
|
|
+ TwoElementsRequestObject.class);
|
|
|
+ log.info("supplier10000043.twoElementsCheckV2---requestObject={}", requestObject);
|
|
|
+ // 参数校验
|
|
|
+ if (!validateRequestParams(ret, returnType, requestObject)) {
|
|
|
+ ret.setCode(Constant.SUCCESS);
|
|
|
+ reduceVisitCount(hashKey,key);
|
|
|
+ request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
|
|
|
+ factory.setServiceClass(NciicServicesPortType.class);// 设置请求接口
|
|
|
+ factory.setAddress(identityInfoV2Url);
|
|
|
+
|
|
|
+ NciicServicesPortType nciicServices = (NciicServicesPortType) factory.create(); // 创建客户端对象
|
|
|
+ // 设置客户端的配置信息,超时等.
|
|
|
+ Client proxy = ClientProxy.getClient(nciicServices);
|
|
|
+ common(request,proxy);
|
|
|
+ HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
|
|
|
+
|
|
|
+ HTTPClientPolicy policy = new HTTPClientPolicy();
|
|
|
+ policy.setConnectionTimeout(outTime); // 连接超时时间
|
|
|
+ policy.setReceiveTimeout(outTime);// 请求超时时间.
|
|
|
+ policy.setConnection(ConnectionType.CLOSE);
|
|
|
+ conduit.setClient(policy);
|
|
|
+ String paramXml = SjjhConstant.TWO_ELEMENTS_XML_TEMPLATE_V2
|
|
|
+ .replace("{fsd}", requestObject.getIdCode().substring(0, 6))
|
|
|
+ .replace("{ywlx}", SjjhConstant.PARAMETER_YWLX_BQ)
|
|
|
+ .replace("{idCode}", requestObject.getIdCode())
|
|
|
+ .replace("{name}", requestObject.getName());
|
|
|
+
|
|
|
+ String result = nciicServices.nciicCheck(SjjhConstant.TWO_ELEMENTS_SECRET_KEY_V2,paramXml);
|
|
|
+// String result = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><RESPONSE errorcode=\"-20\" code=\"0\" countrows=\"1\"><ROWS><ROW><ErrorCode>-20</ErrorCode><ErrorMsg>计费失败,请与管理员联系(errorcode=-20)!</ErrorMsg></ROW></ROWS></RESPONSE>";
|
|
|
+ log.info("twoElementsCheck上游返回xml:{}", result);
|
|
|
+ upstreamCode = setTwoElementsCheckResponse(ret, returnType, result);
|
|
|
+ } catch (WebServiceException ste) {
|
|
|
+ log.info("supplier10000043.twoElementsCheckV2接口-SocketTimeoutException:", ste);
|
|
|
+ ErrorUtils.captureException(ste);
|
|
|
+ ret.setCode(Constant.REQUEST_TIMEOUT);
|
|
|
+ } catch (Exception ioe) {
|
|
|
+ log.info("supplier10000043.twoElementsCheckV2接口-Exception:", ioe);
|
|
|
+ ErrorUtils.captureException(ioe);
|
|
|
+ ret.setCode(Constant.FAIL);
|
|
|
+ }
|
|
|
+ request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
}
|