Browse Source

修改 个人不良信息查询

15810770710@163.com 3 years ago
parent
commit
5a57fcb08f

+ 61 - 11
src/main/java/info/aspirecn/iov/sjjh/supplier10000040/action/ChannelAction.java

@@ -248,7 +248,8 @@ public class ChannelAction {
         HttpServletRequest request = servletRequestAttributes.getRequest();
         ChannelTypeHandleResponseObject responseObject = new ChannelTypeHandleResponseObject();
         try {
-            responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime, ChannelConstant.ILLEGAL_INFO_SIMPLE);
+            responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                    ChannelConstant.ILLEGAL_INFO_SIMPLE, ChannelConstant.ILLEGAL_INFO_METHOD_NORMAL_RESPONSE);
             log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
 
             recodeIllegalInfoV2RequestLog(responseObject, request, customBody);
@@ -276,7 +277,8 @@ public class ChannelAction {
         HttpServletRequest request = servletRequestAttributes.getRequest();
         ChannelTypeHandleResponseObject responseObject = new ChannelTypeHandleResponseObject();
         try {
-            responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime, ChannelConstant.ILLEGAL_INFO_SCORE);
+            responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                    ChannelConstant.ILLEGAL_INFO_SCORE, ChannelConstant.ILLEGAL_INFO_METHOD_NORMAL_RESPONSE);
             log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
 
             recodeIllegalInfoV2RequestLog(responseObject, request, customBody);
@@ -304,7 +306,8 @@ public class ChannelAction {
         HttpServletRequest request = servletRequestAttributes.getRequest();
         ChannelTypeHandleResponseObject responseObject = new ChannelTypeHandleResponseObject();
         try {
-            responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime, ChannelConstant.ILLEGAL_INFO_RESULT);
+            responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                    ChannelConstant.ILLEGAL_INFO_RESULT, ChannelConstant.ILLEGAL_INFO_METHOD_NORMAL_RESPONSE);
             log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
 
             recodeIllegalInfoV2RequestLog(responseObject, request, customBody);
@@ -339,7 +342,8 @@ public class ChannelAction {
             if (StringUtils.isNotBlank(decodeCustomBody)) {
                 customBody = decodeCustomBody;
                 // 调用业务接口
-                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime, ChannelConstant.ILLEGAL_INFO_DRUG_ESCAPE);
+                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                        ChannelConstant.ILLEGAL_INFO_DRUG_ESCAPE, ChannelConstant.ILLEGAL_INFO_METHOD_NORMAL_RESPONSE);
             }
             log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
 
@@ -375,7 +379,8 @@ public class ChannelAction {
             if (StringUtils.isNotBlank(decodeCustomBody)) {
                 customBody = decodeCustomBody;
                 // 调用业务接口
-                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime, ChannelConstant.ILLEGAL_INFO_SIMPLE);
+                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                        ChannelConstant.ILLEGAL_INFO_SIMPLE, ChannelConstant.ILLEGAL_INFO_METHOD_NORMAL_RESPONSE);
             }
             log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
 
@@ -417,7 +422,8 @@ public class ChannelAction {
             if (StringUtils.isNotBlank(decodeCustomBody)) {
                 customBody = decodeCustomBody;
                 // 调用业务接口
-                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime, ChannelConstant.ILLEGAL_INFO_SCORE);
+                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                        ChannelConstant.ILLEGAL_INFO_SCORE, ChannelConstant.ILLEGAL_INFO_METHOD_NORMAL_RESPONSE);
             }
             log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
 
@@ -453,7 +459,8 @@ public class ChannelAction {
             if (StringUtils.isNotBlank(decodeCustomBody)) {
                 customBody = decodeCustomBody;
                 // 调用业务接口
-                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime, ChannelConstant.ILLEGAL_INFO_SCORE);
+                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                        ChannelConstant.ILLEGAL_INFO_SCORE, ChannelConstant.ILLEGAL_INFO_METHOD_NORMAL_RESPONSE);
             }
             log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
 
@@ -489,7 +496,8 @@ public class ChannelAction {
             if (StringUtils.isNotBlank(decodeCustomBody)) {
                 customBody = decodeCustomBody;
                 // 调用业务接口
-                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime, ChannelConstant.ILLEGAL_INFO_DRUG_ESCAPE);
+                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                        ChannelConstant.ILLEGAL_INFO_DRUG_ESCAPE, ChannelConstant.ILLEGAL_INFO_METHOD_NORMAL_RESPONSE);
             }
             log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
 
@@ -525,7 +533,8 @@ public class ChannelAction {
             if (StringUtils.isNotBlank(decodeCustomBody)) {
                 customBody = decodeCustomBody;
                 // 调用业务接口
-                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime, ChannelConstant.ILLEGAL_INFO_DRUG_ESCAPE);
+                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                        ChannelConstant.ILLEGAL_INFO_DRUG_ESCAPE, ChannelConstant.ILLEGAL_INFO_METHOD_NORMAL_RESPONSE);
             }
             log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
 
@@ -561,7 +570,8 @@ public class ChannelAction {
             if (StringUtils.isNotBlank(decodeCustomBody)) {
                 customBody = decodeCustomBody;
                 // 调用业务接口
-                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime, ChannelConstant.ILLEGAL_INFO_SIMPLE);
+                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                        ChannelConstant.ILLEGAL_INFO_SIMPLE, ChannelConstant.ILLEGAL_INFO_METHOD_NORMAL_RESPONSE);
             }
             log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
 
@@ -597,7 +607,8 @@ public class ChannelAction {
             if (StringUtils.isNotBlank(decodeCustomBody)) {
                 customBody = decodeCustomBody;
                 // 调用业务接口
-                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime, ChannelConstant.ILLEGAL_INFO_SCORE);
+                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                        ChannelConstant.ILLEGAL_INFO_SCORE, ChannelConstant.ILLEGAL_INFO_METHOD_NORMAL_RESPONSE);
             }
             log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
 
@@ -613,6 +624,45 @@ public class ChannelAction {
         }
     }
 
+    @ApiOperation(value = "个人不良信息查询V2-评分版-SM3-拼接版", notes = "")
+    @PostMapping(value = "/getIllegalInfoV2ScoreSM3Criminal.do")
+    public ChannelTypeHandleResponseObject getIllegalInfoV2ScoreSM3Criminal(
+            @ApiParam(value = "通道ID") @RequestHeader(name = "channelId") String channelId,
+            @ApiParam(value = "超时时间,单位:毫秒", example = "10000") @RequestParam(name = "outTime", required = true) int outTime,
+            @ApiParam(value = "请求参数JSON串") @RequestParam(name = "customBody", required = true) String customBody) {
+        log.info("个人不良信息查询V2-评分版SM3请求--->channelId:{}--->outTime:{},--->customBody:{}", channelId, outTime, customBody);
+        Long startTime = System.currentTimeMillis();
+        //日志记录通道类型 - 同步
+        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = servletRequestAttributes.getRequest();
+        ChannelTypeHandleResponseObject responseObject = new ChannelTypeHandleResponseObject();
+        try {
+            // scm解密
+            String decodeCustomBody = channelService.getDecodeIdCard(request, customBody, outTime, ChannelConstant.DECODE_TYPE_SM3, responseObject);
+            log.info("scm解密耗时:{}", System.currentTimeMillis() - startTime);
+
+            if (StringUtils.isNotBlank(decodeCustomBody)) {
+                customBody = decodeCustomBody;
+                // 调用业务接口
+                responseObject = channelService.validateIllegalInfoV2(request, customBody, outTime,
+                        ChannelConstant.ILLEGAL_INFO_SCORE, ChannelConstant.ILLEGAL_INFO_METHOD_SPECIAL);
+            }
+            log.info("调用业务接口时延:{}", System.currentTimeMillis() - startTime);
+
+            recodeIllegalInfoV2RequestLog(responseObject, request, customBody);
+            if (System.currentTimeMillis() - startTime < delayedTime) {
+                delay();
+            }
+            log.info("action总体耗时:{}", System.currentTimeMillis() - startTime);
+            return responseObject;
+        } catch (Exception ex) {
+            log.error("message:{}", ex);
+            return responseObject;
+        }
+    }
+
+
+
     private void delay() {
         Long startTime = System.currentTimeMillis();
         try {

+ 9 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier10000040/constant/ChannelConstant.java

@@ -42,4 +42,13 @@ public class ChannelConstant {
      * 证件类型;1:身份证 2:统一信用代码
      */
     public static final String[] CARD_TYPE_ARRAY = {"1", "2"};
+
+    // 社会风险预警-人员核验-通用版(纯上游)
+    public static final String ILLEGAL_INFO_METHOD_COMMON = "1";
+
+    // 社会风险预警-人员核验-接口拼接版
+    public static final String ILLEGAL_INFO_METHOD_SPECIAL = "2";
+
+    // 社会风险预警-人员核验-超时固定返回版
+    public static final String ILLEGAL_INFO_METHOD_NORMAL_RESPONSE = "3";
 }

+ 1 - 1
src/main/java/info/aspirecn/iov/sjjh/supplier10000040/service/ChannelService.java

@@ -37,7 +37,7 @@ public interface ChannelService {
      * @param interfaceType
      * @return
      */
-    ChannelTypeHandleResponseObject validateIllegalInfoV2(HttpServletRequest request, String customBody, int outTime, String interfaceType);
+    ChannelTypeHandleResponseObject validateIllegalInfoV2(HttpServletRequest request, String customBody, int outTime, String interfaceType, String method);
 
     String getDecodeIdCard(HttpServletRequest request, String customBody, int outTime, String decodeType, ChannelTypeHandleResponseObject ret);
 

+ 19 - 2
src/main/java/info/aspirecn/iov/sjjh/supplier10000040/service/ChannelServiceImpl.java

@@ -98,6 +98,12 @@ public class ChannelServiceImpl implements ChannelService {
     @Value("${supplier.vehicleInfo.encodeKey}")
     private String vehicleInfoEncodeKey;
 
+    @Value("${supplier.illegalInfoV3.url}")
+    private String illegalInfoV3Url;
+
+    @Value("${supplier.illegalInfoV4.url}")
+    private String illegalInfoV4Url;
+
     DateTimeFormatter yMdHms = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
 
     private static final String MEDIA_TYPE = "application/json;charset=UTF-8";
@@ -417,7 +423,7 @@ public class ChannelServiceImpl implements ChannelService {
     }
 
     @Override
-    public ChannelTypeHandleResponseObject validateIllegalInfoV2(HttpServletRequest request, String customBody, int outTime, String interfaceType) {
+    public ChannelTypeHandleResponseObject validateIllegalInfoV2(HttpServletRequest request, String customBody, int outTime, String interfaceType, String method) {
         ChannelTypeHandleResponseObject ret = new ChannelTypeHandleResponseObject();
         ret.setIsCharge(Constant.INTERFACE_QUERY_NO_FEE);
         String upstreamCode = Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
@@ -454,9 +460,20 @@ public class ChannelServiceImpl implements ChannelService {
         MediaType mediaType = MediaType.parse(MEDIA_TYPE);
         RequestBody requestBody = RequestBody.create(mediaType, JSON.toJSONString(illegalInfoRequestObject));
 
+        String requestUrl;
+        if (method.equals(ChannelConstant.ILLEGAL_INFO_METHOD_COMMON)) {
+            // 调用 通用版(纯上游)
+            requestUrl = illegalInfoV4Url;
+        } else if (method.equals(ChannelConstant.ILLEGAL_INFO_METHOD_SPECIAL)) {
+            // 调用 接口拼接版
+            requestUrl = illegalInfoV2Url;
+        } else {
+            // 调用 超时固定返回版
+            requestUrl = illegalInfoV3Url;
+        }
         Request okRequest = new Request.Builder()
                 .post(requestBody)
-                .url(illegalInfoV2Url)
+                .url(requestUrl)
                 .build();
         OkHttpClient client = okHttpClient.newBuilder()
                 .connectTimeout(outTime, TimeUnit.MILLISECONDS)