15810770710@163.com пре 4 година
родитељ
комит
f70f207747
21 измењених фајлова са 1683 додато и 0 уклоњено
  1. 216 0
      pom.xml
  2. 39 0
      src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/Application.java
  3. 220 0
      src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/action/BTYChannelActionImpl.java
  4. 33 0
      src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/config/SwaggerConfig.java
  5. 1 0
      src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/package-info.java
  6. 32 0
      src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/service/BTYChannelService.java
  7. 437 0
      src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/service/impl/BTYChannelServiceImpl.java
  8. 107 0
      src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/utils/DESedeUtil.java
  9. 42 0
      src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/utils/SupplierProperties.java
  10. 38 0
      src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/vo/DecodeThreeElementRequestObject.java
  11. 28 0
      src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/vo/TwoParamIdCardRequestObject.java
  12. 47 0
      src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/vo/TwoParamIdCardResponseObject.java
  13. 109 0
      src/main/resources/config/application-test.yml
  14. 3 0
      src/main/resources/config/banner.txt
  15. 27 0
      src/main/resources/config/bootstrap.yml
  16. 109 0
      src/main/resources/config/iov-sjjh-servicenode-supplier-10000002-hwtest.yml
  17. 37 0
      src/main/resources/config/logback-spring.xml
  18. 8 0
      src/main/resources/docker/Dockerfile
  19. 78 0
      src/test/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/test/http/ActionService.java
  20. 1 0
      src/test/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/test/package-info.java
  21. 71 0
      src/test/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/test/serviceTest/BTYChannelServiceTest.java

+ 216 - 0
pom.xml

@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.2.2.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+
+
+    <groupId>info.aspirecn.iov.sjjh</groupId>
+    <artifactId>iov-sjjh-servicenode-supplier-10000002</artifactId>
+    <version>1.3.5</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+        </dependency>
+
+        <!--链路日志-->
+        <dependency>
+            <groupId>info.aspirecn.rdc</groupId>
+            <artifactId>aspirecloud-commons-sleuthlog-starter</artifactId>
+            <version>5.0.1</version>
+        </dependency>
+
+        <!--错误日志-->
+        <dependency>
+            <groupId>info.aspirecn.rdc</groupId>
+            <artifactId>aspirecloud-commons-errorlog-starter</artifactId>
+            <version>5.0.2</version>
+        </dependency>
+
+        <!--常量-->
+        <dependency>
+            <groupId>info.aspirecn.iov.sjjh</groupId>
+            <artifactId>iov-sjjh-commons-lang</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+    <dependency>
+			<groupId>com.alibaba</groupId>
+			<artifactId>fastjson</artifactId>
+			<version>1.2.70</version>
+		</dependency>
+        <dependency>
+            <groupId>info.aspirecn.iov.sjjh</groupId>
+            <artifactId>iov-sjjh-servicenode-supplier-10000002-interface</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-config-client</artifactId>
+        </dependency>
+
+    </dependencies>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.cloud</groupId>
+                <artifactId>spring-cloud-dependencies</artifactId>
+                <version>Hoxton.RELEASE</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+    <build>
+        <plugins>
+            <plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <includes>
+                        <include>
+                            <groupId>info.aspirecn.iov.sjjh</groupId>
+                            <artifactId>iov-sjjh-servicenode-supplier-10000002-interface</artifactId>
+                        </include>
+                        <include>
+                            <groupId>info.aspirecn.iov.sjjh</groupId>
+                            <artifactId>iov-sjjh-commons-lang</artifactId>
+                        </include>
+                    </includes>
+                </configuration>
+			</plugin>
+			
+			<plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                            <classpathPrefix>lib/</classpathPrefix>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
+                            <excludeGroupIds>
+                                info.aspirecn.iov.sjjh
+                            </excludeGroupIds>
+                        </configuration>
+                    </execution>
+                    <execution>
+					    <id>copy</id>
+					    <phase>install</phase>
+					    <goals>
+					        <goal>copy-dependencies</goal>
+					    </goals>
+					    <configuration>
+					        <outputDirectory>
+					            ${project.build.directory}/lib
+					        </outputDirectory>
+					        <excludeGroupIds>
+					            info.aspirecn.iov.sjjh
+					        </excludeGroupIds>
+					    </configuration>
+					</execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>default-resources</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>target/classes</outputDirectory>
+                            <useDefaultDelimiters>false</useDefaultDelimiters>
+                            <delimiters>
+                                <delimiter>@</delimiter>
+                            </delimiters>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/resources/config</directory>
+                                    <targetPath>config</targetPath>
+                                    <filtering>true</filtering>
+                                    <includes>
+                                        <include>**</include>
+                                    </includes>
+                                </resource>
+                                <resource>
+                                    <directory>src/main/resources/docker</directory>
+                                    <targetPath>docker</targetPath>
+                                    <filtering>true</filtering>
+                                    <includes>
+                                        <include>**</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>com.spotify</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+                <version>1.2.0</version>
+                <configuration>
+                    <!-- 设置Docker 镜像名称 -->
+                    <imageName>hub.i139.cn/iov-sjjh/${project.artifactId}:${project.version}</imageName>
+                    <!-- 设置Dockerfile存放目录地址 -->
+                    <dockerDirectory>${project.basedir}/src/main/resources/docker</dockerDirectory>
+                    <resources>
+                        <resource>
+                            <targetPath>/</targetPath>
+                            <directory>${project.build.directory}</directory>
+                            <include>${project.build.finalName}.jar</include>
+                        </resource>
+                    </resources>
+                    <!-- 设置和setting.xml中的servers对应的server,里面存放了docker hub仓库的用户名、密码 -->
+                    <serverId>docker-hub</serverId>
+                    <!-- 设置docker hub仓库地址 -->
+                    <registryUrl>https://hub.i139.cn</registryUrl>
+                    <!-- 设置docker remote API地址 -->
+                    <!--<dockerHost>http://docker-in-docker.rdc-plugin:2375</dockerHost>-->
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 39 - 0
src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/Application.java

@@ -0,0 +1,39 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty;
+
+import info.aspirecn.rdc.aspirecloud.node.except.annotations.EnableAspireCloudRdcHandleExcept;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.core.env.Environment;
+import org.springframework.util.StopWatch;
+
+
+/**
+ * @author jianggang
+ * @Date 2018/10/24 17:24:02
+ * @Description
+ */
+
+@SpringBootApplication
+@EnableAspireCloudRdcHandleExcept
+@Slf4j
+@EnableEurekaClient
+@EnableFeignClients(basePackages = {"info.aspirecn.rdc"})
+@ComponentScan("info.aspirecn.rdc.aspirecloud.node.except")
+@ComponentScan("info.aspirecn.rdc.aspirecloud.node.brave")
+public class Application {
+
+    public static void main(String[] args) {
+        StopWatch watch = new StopWatch();
+        watch.start();
+        ApplicationContext context = SpringApplication.run(Application.class, args);
+        Environment environment = context.getBean(Environment.class);
+        String applicationName = environment.getProperty("spring.application.name");
+        watch.stop();
+        log.info("{} 启动完毕, times={}s", applicationName, watch.getTotalTimeSeconds());
+    }
+}

+ 220 - 0
src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/action/BTYChannelActionImpl.java

@@ -0,0 +1,220 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.action;
+
+import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
+import info.aspirecn.iov.sjjh.commons.lang.Constant;
+import info.aspirecn.rdc.aspirecloud.node.except.utils.ErrorUtils;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.service.BTYChannelService;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.utils.SupplierProperties;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty_interface.action.BTYChannelAction;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.tomcat.util.ExceptionUtils;
+import org.apache.tomcat.util.codec.binary.Base64;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
+
+
+/**
+ * @author jianggang
+ * @Date 2018/10/24 17:31:46
+ * @Description 白天源供应商-接口接入
+ */
+
+@Slf4j
+@RestController
+public class BTYChannelActionImpl implements BTYChannelAction {
+
+    @Autowired
+    BTYChannelService btyChannelService;
+    @Autowired
+    SupplierProperties property;
+    @Override
+    public ChannelTypeHandleResponseObject twoParamIdCard(
+            @RequestHeader(name = "channelId", required = true) String channelId,
+            @RequestParam(name = "outTime", required = false) Integer outTime,
+            @RequestParam(name = "customBody", required = true) String customBody) {
+        log.info("白天源身份证而要素请求--->channelId:{}--->outTime:{},--->customBody:{}",channelId,outTime,customBody);
+        //日志记录通道类型 - 同步
+        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = servletRequestAttributes.getRequest();
+        request.setAttribute(Constant.CHANNEL_TYPE_KEY,Constant.CHANNEL_TYPE_SYNC);
+        request.setAttribute("x-isCharge",Constant.IS_NOT_CHARGE);
+        request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_ERROR_CODE);
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE);
+        ChannelTypeHandleResponseObject responseObject = new ChannelTypeHandleResponseObject();
+        try{
+         responseObject = btyChannelService.sendTwoParamIdCardRequest(
+        		request, channelId,outTime,customBody);
+        //日志记录通道响应码
+        if(responseObject.getCode() != 1){
+            request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_ERROR_CODE);
+        }else{
+        	 if(Constant.CUSTOMER_RETURN_JK.equals(request.getHeader(Constant.CUSTOMER_RETURN_TYPE_PARA))){
+             	String code = property.getCode().get(responseObject.getResultCode());
+             	if(code!=null){
+             		responseObject.setResultCode(Integer.valueOf(code));
+             	}
+             }
+            request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_SUCCESS_CODE);
+        }
+        //日志记录通道查询参数
+        if(customBody != null){
+            try {
+                request.setAttribute(Constant.CHANNEL_LOG_QUERY,Base64.encodeBase64String(customBody.getBytes("utf-8")));
+            } catch (UnsupportedEncodingException e) {
+                ExceptionUtils.handleThrowable(e);
+                log.error("异常信息:{}",e);
+            }
+        }
+
+        request.setAttribute("x-isCharge",responseObject.getIsCharge());
+
+        return responseObject;
+       }catch(Exception ex){
+    	   ErrorUtils.captureException(ex);
+    	   log.error("message:{}",ex);
+    	   return responseObject;
+       }
+    }
+
+    @Override
+    public ChannelTypeHandleResponseObject checkIdCardWeiZhong(
+            @RequestHeader(name = "channelId", required = true) String channelId,
+            @RequestParam(name = "outTime", required = false) Integer outTime,
+            @RequestParam(name = "customBody", required = true) String customBody) {
+        log.info("白天源身份证二要素-微众加密版--->channelId:{}--->outTime:{},--->customBody:{}",channelId,outTime,customBody);
+        //日志记录通道类型 - 同步
+        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = servletRequestAttributes.getRequest();
+        request.setAttribute(Constant.CHANNEL_TYPE_KEY,Constant.CHANNEL_TYPE_SYNC);
+        request.setAttribute("x-isCharge",Constant.IS_NOT_CHARGE);
+        request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_ERROR_CODE);
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE);
+        ChannelTypeHandleResponseObject responseObject = new ChannelTypeHandleResponseObject();
+        try{
+            responseObject = btyChannelService.checkIdCardWeiZhong(
+                    request, channelId,outTime,customBody);
+            //日志记录通道响应码
+            if(responseObject.getCode() != 1){
+                request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_ERROR_CODE);
+            }else{
+                if(Constant.CUSTOMER_RETURN_JK.equals(request.getHeader(Constant.CUSTOMER_RETURN_TYPE_PARA))){
+                    String code = property.getCode().get(responseObject.getResultCode());
+                    if(code!=null){
+                        responseObject.setResultCode(Integer.valueOf(code));
+                    }
+                }
+                request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_SUCCESS_CODE);
+            }
+            //日志记录通道查询参数
+            if(customBody != null){
+                try {
+                    request.setAttribute(Constant.CHANNEL_LOG_QUERY,Base64.encodeBase64String(customBody.getBytes("utf-8")));
+                } catch (UnsupportedEncodingException e) {
+                    ExceptionUtils.handleThrowable(e);
+                    log.error("异常信息:{}",e);
+                }
+            }
+
+            request.setAttribute("x-isCharge",responseObject.getIsCharge());
+
+            return responseObject;
+        }catch(Exception ex){
+            ErrorUtils.captureException(ex);
+            log.error("message:{}",ex);
+            return responseObject;
+        }
+    }
+
+    @Override
+    public ChannelTypeHandleResponseObject checkIdCardMD5(
+            @RequestHeader(name = "channelId", required = true) String channelId,
+            @RequestParam(name = "outTime", required = false) Integer outTime,
+            @RequestParam(name = "customBody", required = true) String customBody) {
+        log.info("白天源身份证二要素-MD5加密版--->channelId:{}--->outTime:{},--->customBody:{}",channelId,outTime,customBody);
+        //日志记录通道类型 - 同步
+        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = servletRequestAttributes.getRequest();
+        request.setAttribute(Constant.CHANNEL_TYPE_KEY,Constant.CHANNEL_TYPE_SYNC);
+        request.setAttribute("x-isCharge",Constant.IS_NOT_CHARGE);
+        request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_ERROR_CODE);
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE);
+        ChannelTypeHandleResponseObject responseObject = new ChannelTypeHandleResponseObject();
+        try{
+            responseObject = btyChannelService.checkIdCardMD5AndSHA256(
+                    request, channelId,outTime,customBody, "MD5");
+            //日志记录通道响应码
+            if(responseObject.getCode() != 1){
+                request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_ERROR_CODE);
+            }else{
+                request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_SUCCESS_CODE);
+            }
+            //日志记录通道查询参数
+            if(customBody != null){
+                try {
+                    request.setAttribute(Constant.CHANNEL_LOG_QUERY,Base64.encodeBase64String(customBody.getBytes("utf-8")));
+                } catch (UnsupportedEncodingException e) {
+                    ExceptionUtils.handleThrowable(e);
+                    log.error("异常信息:{}",e);
+                }
+            }
+
+            request.setAttribute("x-isCharge",responseObject.getIsCharge());
+
+            return responseObject;
+        }catch(Exception ex){
+            ErrorUtils.captureException(ex);
+            log.error("message:{}",ex);
+            return responseObject;
+        }
+    }
+
+    @Override
+    public ChannelTypeHandleResponseObject checkIdCardSHA256(
+            @RequestHeader(name = "channelId", required = true) String channelId,
+            @RequestParam(name = "outTime", required = false) Integer outTime,
+            @RequestParam(name = "customBody", required = true) String customBody) {
+        log.info("白天源身份证二要素-SHA256加密版--->channelId:{}--->outTime:{},--->customBody:{}",channelId,outTime,customBody);
+        //日志记录通道类型 - 同步
+        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = servletRequestAttributes.getRequest();
+        request.setAttribute(Constant.CHANNEL_TYPE_KEY,Constant.CHANNEL_TYPE_SYNC);
+        request.setAttribute("x-isCharge",Constant.IS_NOT_CHARGE);
+        request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_ERROR_CODE);
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE);
+        ChannelTypeHandleResponseObject responseObject = new ChannelTypeHandleResponseObject();
+        try{
+            responseObject = btyChannelService.checkIdCardMD5AndSHA256(
+                    request, channelId,outTime,customBody, "SHA256");
+            //日志记录通道响应码
+            if(responseObject.getCode() != 1){
+                request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_ERROR_CODE);
+            }else{
+                request.setAttribute("x-responseCode",Constant.CHANNEL_LOG_SUCCESS_CODE);
+            }
+            //日志记录通道查询参数
+            if(customBody != null){
+                try {
+                    request.setAttribute(Constant.CHANNEL_LOG_QUERY,Base64.encodeBase64String(customBody.getBytes("utf-8")));
+                } catch (UnsupportedEncodingException e) {
+                    ExceptionUtils.handleThrowable(e);
+                    log.error("异常信息:{}",e);
+                }
+            }
+
+            request.setAttribute("x-isCharge",responseObject.getIsCharge());
+
+            return responseObject;
+        }catch(Exception ex){
+            ErrorUtils.captureException(ex);
+            log.error("message:{}",ex);
+            return responseObject;
+        }
+    }
+}

+ 33 - 0
src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/config/SwaggerConfig.java

@@ -0,0 +1,33 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+/**
+ * @author jianggang
+ * @Date 2018/10/18 16:55:31
+ * @Description
+ */
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig {
+
+    @Bean
+    public Docket createRestApi() {
+
+        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
+                .apis(RequestHandlerSelectors.basePackage("info.aspirecn.rdc.iov.sjjh"))
+                .paths(PathSelectors.any()).build();
+    }
+
+    private ApiInfo apiInfo() {
+        return new ApiInfoBuilder().title("白天源-通道API").description("").termsOfServiceUrl("").version("1.0.0").build();
+    }
+}

+ 1 - 0
src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/package-info.java

@@ -0,0 +1 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty;

+ 32 - 0
src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/service/BTYChannelService.java

@@ -0,0 +1,32 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.service;
+
+import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty_interface.vo.ResponseObject;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author jianggang
+ * @Date 2018/10/25 09:36:56
+ * @Description
+ */
+
+public interface BTYChannelService {
+
+    /**
+     * 身份证二要素请求-白天源
+     * @param request
+     * @param channelId
+     * @param outTime
+     * @param customBody
+     * @return
+     */
+	ChannelTypeHandleResponseObject sendTwoParamIdCardRequest(
+            HttpServletRequest request, String channelId, Integer outTime, String customBody);
+
+	ChannelTypeHandleResponseObject checkIdCardWeiZhong(HttpServletRequest request, String channelId, Integer outTime, String customBody);
+
+	ChannelTypeHandleResponseObject checkIdCardMD5AndSHA256(HttpServletRequest request, String channelId, Integer outTime, String customBody, String encryptType);
+}

+ 437 - 0
src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/service/impl/BTYChannelServiceImpl.java

@@ -0,0 +1,437 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
+import com.google.common.base.Preconditions;
+import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
+import info.aspirecn.iov.sjjh.commons.lang.Constant;
+import info.aspirecn.iov.sjjh.commons.lang.PatternTools;
+import info.aspirecn.rdc.aspirecloud.node.except.utils.ErrorUtils;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.service.BTYChannelService;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.utils.DESedeUtil;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.utils.SupplierProperties;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.vo.DecodeThreeElementRequestObject;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.vo.TwoParamIdCardRequestObject;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.vo.TwoParamIdCardResponseObject;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty_interface.vo.CustomBodyObject;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.*;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.net.SocketTimeoutException;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author jianggang
+ * @Date 2018/10/25 09:37:28
+ * @Description
+ */
+
+@Slf4j
+@Service
+public class BTYChannelServiceImpl implements BTYChannelService {
+    /**
+     * 一致
+     */
+    private static final String MATCH_OK = "1100";
+    /**
+     * 不一致
+     */
+    private static final String NO_MATCH = "1101";
+    /**
+     * 库中无此号
+     */
+    private static final String NO_FIND = "1102";
+    /**
+     * 无效身份证
+     */
+    private static final String INVALID_CARD = "1103";
+    /***/
+    private static final String PARA_ERROR_TITLE = "参数错误或姓名身份证号无效";
+
+    @Autowired
+    private SupplierProperties supplierProperties;
+
+    private OkHttpClient client = new OkHttpClient.Builder().build();
+
+    //private static final ConnectionPool POOL = new ConnectionPool(4000,
+    //        5, TimeUnit.MINUTES);
+
+    @Override
+    public ChannelTypeHandleResponseObject sendTwoParamIdCardRequest(HttpServletRequest request,
+                                                                     String channelId, Integer outTime, String customBody) {
+        TwoParamIdCardResponseObject twoParamIdCardResponseObject = new TwoParamIdCardResponseObject();
+        ChannelTypeHandleResponseObject res = new ChannelTypeHandleResponseObject();
+        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;
+        }
+        try {
+
+            Preconditions.checkNotNull(channelId, "通道id为空");
+            Preconditions.checkNotNull(customBody, "请求json字符串为空");
+
+            ObjectMapper mapper = new ObjectMapper();
+            CustomBodyObject customBodyObject = mapper.readValue(customBody, CustomBodyObject.class);
+            boolean code = checkCustomeBody(customBodyObject, returnType, res);
+            if (!code) {
+                res.setCode(Constant.SUCCESS);
+                request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+                return res;
+            }
+
+            if (outTime == null && outTime <= 0) {
+                outTime = Constant.HTTPCLIENT_CONNECTTIMEOUT;
+            }
+            OkHttpClient okHttpClient = client.newBuilder()
+                    .connectTimeout(outTime, TimeUnit.MILLISECONDS)
+                    .writeTimeout(outTime, TimeUnit.MILLISECONDS)
+                    .readTimeout(outTime, TimeUnit.MILLISECONDS)
+                    .build();
+
+            TwoParamIdCardRequestObject requestObject = new TwoParamIdCardRequestObject();
+            requestObject.setName(customBodyObject.getName());
+            requestObject.setIdCard(customBodyObject.getIdCode());
+            String body = JSON.toJSONString(requestObject);
+            RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), body);
+            Request okRequest = new Request.Builder()
+                    .url(supplierProperties.getUrl())
+                    .header("AppCode", supplierProperties.getAppCode())
+                    .header("pcode", supplierProperties.getPCode())
+                    .post(requestBody)
+                    .build();
+            Response response = okHttpClient.newCall(okRequest).execute();
+            String responseJson = response.body().string();
+            log.info("接口返回数据为:---{}", responseJson);
+            twoParamIdCardResponseObject = mapper.readValue(responseJson, TwoParamIdCardResponseObject.class);
+
+            //判断是否计费:code为100且responseObject.getData().getState()为1100或1101时收费
+            boolean resultBool = "100".equals(twoParamIdCardResponseObject.getCode()) &&
+                    twoParamIdCardResponseObject.getData() != null &&
+                    (MATCH_OK.equals(twoParamIdCardResponseObject.getData().getState()) ||
+                            NO_MATCH.equals(twoParamIdCardResponseObject.getData().getState()));
+            if (resultBool) {
+                res.setIsCharge(Constant.INTERFACE_QUERY_FEE);
+            } else {
+                res.setIsCharge(Constant.INTERFACE_QUERY_NO_FEE);
+            }
+
+            res.setCode(Constant.SUCCESS);
+            upstreamCode = twoParamIdCardResponseObject.getCode();
+            getChannelTypeHandleResponseObject(
+                    returnType, res, twoParamIdCardResponseObject);
+
+        } catch (SocketTimeoutException e) {
+            log.error("SocketTimeoutException message:{}", e);
+            ErrorUtils.captureException(e);
+            res.setCode(Constant.REQUEST_TIMEOUT);
+            res.setIsCharge(Constant.INTERFACE_QUERY_NO_FEE);
+            return res;
+        }  catch(UnrecognizedPropertyException upe) {
+            log.info("BTY身份二要素-UnrecognizedPropertyException:{}", upe);
+            ErrorUtils.captureException(upe);
+            res.setCode(Constant.SUCCESS);
+            res.setIsCharge(Constant.IS_NOT_CHARGE);
+            /**参数错误*/
+            if(Constant.CUSTOMER_RETURN_JK.equals(returnType)){
+                res.setResultCode(Constant.JK_RETURN_CODE_9909);
+            } else {
+                res.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            }
+            res.setResultBody(Constant.PARAMETER_NAME_ERROR);
+            res.setResultDesc(Constant.PARAMETER_NAME_ERROR);
+            return res;
+        } catch (Exception e) {
+            log.error("Exception message:{}", e);
+            ErrorUtils.captureException(e);
+            res.setCode(Constant.FAIL);
+            res.setIsCharge(Constant.INTERFACE_QUERY_NO_FEE);
+            return res;
+        }
+
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+        return res;
+    }
+
+    /**
+     * 根据客户不同,返回对应码
+     *
+     * @param returnType
+     * @param res
+     * @param responseObject
+     * @return
+     */
+    private ChannelTypeHandleResponseObject getChannelTypeHandleResponseObject(
+            String returnType,
+            ChannelTypeHandleResponseObject res,
+            TwoParamIdCardResponseObject responseObject) {
+        if ("1".equals(returnType)) {
+            if (MATCH_OK.equals(responseObject.getData().getState())) {
+                //匹配
+                res.setResultCode(Constant.JK_RETURN_CODE_MATCH);
+                res.setResultBody(Constant.MATCH);
+                res.setResultDesc(Constant.MATCH);
+            } else if (NO_MATCH.equals(responseObject.getData().getState())) {
+                //不匹配
+                res.setResultCode(Constant.JK_RETURN_CODE_NO_MATCH);
+                res.setResultBody(Constant.UN_MATCH);
+                res.setResultDesc(Constant.UN_MATCH);
+            } else if (NO_FIND.equals(responseObject.getData().getState())) {
+                //未找到
+                res.setResultCode(Constant.JK_RETURN_CODE_NO_INFO);
+                res.setResultBody(Constant.UN_FIND_NUM);
+                res.setResultDesc(Constant.UN_FIND_NUM);
+            } else if (INVALID_CARD.equals(responseObject.getData().getState())) {
+                //无效身份证
+                res.setResultCode(Constant.JK_RETURN_CODE_INVALID_PARAMETER);
+                res.setResultBody(PARA_ERROR_TITLE);
+                res.setResultDesc(PARA_ERROR_TITLE);
+            } else {
+                //其他错误
+                res.setResultCode(Constant.JK_RETURN_CODE_OTHER_ERROR);
+                res.setResultBody(Constant.OTHER_ERROR);
+                res.setResultDesc(Constant.OTHER_ERROR);
+            }
+        } else {
+            if (MATCH_OK.equals(responseObject.getData().getState())) {
+                //匹配
+                res.setResultCode(Constant.MATCH_CODE);
+                res.setResultBody(Constant.MATCH);
+                res.setResultDesc(Constant.MATCH);
+            } else if (NO_MATCH.equals(responseObject.getData().getState())) {
+                //不匹配
+                res.setResultCode(Constant.UN_MATCH_CODE);
+                res.setResultBody(Constant.UN_MATCH);
+                res.setResultDesc(Constant.UN_MATCH);
+            } else if (NO_FIND.equals(responseObject.getData().getState())) {
+                //未找到
+                res.setResultCode(Constant.UN_FIND_NUM_CODE);
+                res.setResultBody(Constant.UN_FIND_NUM);
+                res.setResultDesc(Constant.UN_FIND_NUM);
+            } else if (INVALID_CARD.equals(responseObject.getData().getState())) {
+                //无效身份证
+                res.setResultCode(Constant.INVALID_PARAMETER_CODE);
+                res.setResultBody(PARA_ERROR_TITLE);
+                res.setResultDesc(PARA_ERROR_TITLE);
+            } else {
+                //其他错误
+                res.setResultCode(Constant.OTHER_ERROR_CODE);
+                res.setResultBody(Constant.OTHER_ERROR);
+                res.setResultDesc(Constant.OTHER_ERROR);
+            }
+        }
+        return res;
+    }
+
+    public boolean checkCustomeBody(CustomBodyObject customBodyObject, String returnType, ChannelTypeHandleResponseObject ret) {
+        String name = customBodyObject.getName();
+        String idCode = customBodyObject.getIdCode();
+        if (StringUtils.isBlank(name) || !PatternTools.checkResult(Constant.PATTERN_CN_NAME_REGEX, name)) {
+            if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
+                ret.setResultCode(Constant.NAME_FORMAT_ERROR_CODE);
+                ret.setResultBody(Constant.NAME_FORMAT_ERROR);
+                ret.setResultDesc(Constant.NAME_FORMAT_ERROR);
+            } else {
+                ret.setResultCode(Constant.JK_NAME_FORMAT_ERROR_CODE);
+                ret.setResultBody(Constant.JK_NAME_FORMAT_ERROR);
+                ret.setResultDesc(Constant.JK_NAME_FORMAT_ERROR);
+            }
+            return false;
+        }
+        if (StringUtils.isBlank(idCode) || !PatternTools.checkResult(Constant.PATTERN_ID_NUMBER_REGEX, idCode)) {
+            if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
+                ret.setResultCode(Constant.IDCODE_FORMAT_ERROR_CODE);
+                ret.setResultBody(Constant.IDCODE_FORMAT_ERROR);
+                ret.setResultDesc(Constant.IDCODE_FORMAT_ERROR);
+            } else {
+                ret.setResultCode(Constant.JK_IDCODE_FORMAT_ERROR_CODE);
+                ret.setResultBody(Constant.JK_IDCODE_FORMAT_ERROR);
+                ret.setResultDesc(Constant.JK_IDCODE_FORMAT_ERROR);
+            }
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public ChannelTypeHandleResponseObject checkIdCardWeiZhong(HttpServletRequest request, String channelId, Integer outTime, String customBody) {
+        String returnType = request.getHeader(Constant.CUSTOMER_RETURN_TYPE_PARA);
+        ChannelTypeHandleResponseObject ret = new ChannelTypeHandleResponseObject();
+        String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
+
+        JSONObject requestParamObject = JSONObject.parseObject(customBody);
+        if (requestParamObject.get("params") == null) {
+            if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
+                ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+                ret.setResultBody(Constant.INVALID_PARAMETER);
+                ret.setResultDesc(Constant.INVALID_PARAMETER);
+            } else {
+                ret.setResultCode(Constant.JK_RETURN_CODE_INVALID_PARAMETER);
+                ret.setResultBody(Constant.INVALID_PARAMETER);
+                ret.setResultDesc(Constant.INVALID_PARAMETER);
+            }
+            return ret;
+        }
+        customBody = DESedeUtil.decryptMode(requestParamObject.getString("params"), supplierProperties.getDecryptKey());
+        if (StringUtils.isBlank(customBody)) {
+            if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
+                ret.setResultCode(Constant.ZW_RETURN_CODE_133);
+                ret.setResultBody(Constant.RETURN_MESSAGE_133);
+                ret.setResultDesc(Constant.RETURN_MESSAGE_133);
+            } else {
+                ret.setResultCode(Constant.JK_RETURN_CODE_9931);
+                ret.setResultBody(Constant.RETURN_MESSAGE_133);
+                ret.setResultDesc(Constant.RETURN_MESSAGE_133);
+            }
+            ret.setCode(Constant.SUCCESS);
+            request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+            return ret;
+        }
+        return sendTwoParamIdCardRequest(request, channelId, outTime, customBody);
+    }
+
+    @Override
+    public ChannelTypeHandleResponseObject checkIdCardMD5AndSHA256(HttpServletRequest request, String channelId,
+                                                                   Integer outTime, String customBody, String decodeType) {
+        String returnType = request.getHeader(Constant.CUSTOMER_RETURN_TYPE_PARA);
+        ChannelTypeHandleResponseObject ret = new ChannelTypeHandleResponseObject();
+        String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
+
+        JSONObject requestParamObject = JSONObject.parseObject(customBody);
+
+        if (requestParamObject.get("idCode") == null || requestParamObject.get("name") == null) {
+            if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
+                ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+                ret.setResultBody(Constant.PARAMETER_NAME_ERROR);
+                ret.setResultDesc(Constant.PARAMETER_NAME_ERROR);
+            } else {
+                ret.setResultCode(Constant.JK_RETURN_CODE_INVALID_PARAMETER);
+                ret.setResultBody(Constant.PARAMETER_NAME_ERROR);
+                ret.setResultDesc(Constant.PARAMETER_NAME_ERROR);
+            }
+            return ret;
+        } else if (StringUtils.isBlank(requestParamObject.getString("idCode"))
+                || StringUtils.isBlank(requestParamObject.getString("name"))) {
+            if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
+                ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+                ret.setResultBody(Constant.INVALID_PARAMETER);
+                ret.setResultDesc(Constant.INVALID_PARAMETER);
+            } else {
+                ret.setResultCode(Constant.JK_RETURN_CODE_INVALID_PARAMETER);
+                ret.setResultBody(Constant.INVALID_PARAMETER);
+                ret.setResultDesc(Constant.INVALID_PARAMETER);
+            }
+            return ret;
+        } else if (decodeType.equals("MD5")
+                && (requestParamObject.getString("idCode").length() != 32
+                || requestParamObject.getString("name").length() !=32)) {
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+            if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
+                ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+                ret.setResultBody(Constant.INVALID_PARAMETER);
+                ret.setResultDesc(Constant.INVALID_PARAMETER);
+            } else {
+                ret.setResultCode(Constant.JK_RETURN_CODE_INVALID_PARAMETER);
+                ret.setResultBody(Constant.INVALID_PARAMETER);
+                ret.setResultDesc(Constant.INVALID_PARAMETER);
+            }
+            return ret;
+        } else if (decodeType.equals("SHA256")
+                && (requestParamObject.getString("idCode").length() != 64
+                || requestParamObject.getString("name").length() != 64)) {
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+            if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
+                ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+                ret.setResultBody(Constant.INVALID_PARAMETER);
+                ret.setResultDesc(Constant.INVALID_PARAMETER);
+            } else {
+                ret.setResultCode(Constant.JK_RETURN_CODE_INVALID_PARAMETER);
+                ret.setResultBody(Constant.INVALID_PARAMETER);
+                ret.setResultDesc(Constant.INVALID_PARAMETER);
+            }
+            return ret;
+        } else {
+            CustomBodyObject customBodyObject = JSON.toJavaObject(requestParamObject, CustomBodyObject.class);
+
+            customBodyObject = getDecodeIdCard(customBodyObject, outTime, decodeType);
+            if (customBodyObject == null
+                    || StringUtils.isBlank(customBodyObject.getIdCode())
+                    || StringUtils.isBlank(customBodyObject.getName())) {
+                if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
+                    ret.setResultCode(Constant.ZW_RETURN_CODE_134);
+                    ret.setResultBody(Constant.RETURN_MESSAGE_134);
+                    ret.setResultDesc(Constant.RETURN_MESSAGE_134);
+                } else {
+                    ret.setResultCode(Constant.JK_RETURN_CODE_9932);
+                    ret.setResultBody(Constant.RETURN_MESSAGE_134);
+                    ret.setResultDesc(Constant.RETURN_MESSAGE_134);
+                }
+                ret.setCode(Constant.SUCCESS);
+                request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+                return ret;
+            }
+            return sendTwoParamIdCardRequest(request, channelId, outTime, JSON.toJSONString(customBodyObject));
+        }
+    }
+
+    private CustomBodyObject getDecodeIdCard(CustomBodyObject customBodyObject, Integer outTime, String decodeType) {
+        DecodeThreeElementRequestObject.DecodeThreeElementRequestData dataObject = new DecodeThreeElementRequestObject.DecodeThreeElementRequestData();
+        dataObject.setId_number(customBodyObject.getIdCode());
+        dataObject.setName(customBodyObject.getName());
+        dataObject.setEncrypt(decodeType);
+        DecodeThreeElementRequestObject requestObject = new DecodeThreeElementRequestObject();
+        requestObject.setApi(supplierProperties.getDecodeApi());
+        requestObject.setAppKey(supplierProperties.getDecodeAppKey());
+        requestObject.setAppSecret(supplierProperties.getDecodeAppSecret());
+        requestObject.setData(dataObject);
+
+        MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
+        RequestBody requestBody = RequestBody.create(mediaType, JSON.toJSONString(requestObject));
+        Request okHttpRequest = new Request.Builder()
+                .post(requestBody)
+                .url(supplierProperties.getDecodeUrl())
+                .build();
+        OkHttpClient decodeClient = new OkHttpClient.Builder()
+                .connectTimeout(outTime, TimeUnit.MILLISECONDS)
+                .readTimeout(outTime, TimeUnit.MILLISECONDS)
+                .writeTimeout(outTime, TimeUnit.MILLISECONDS)
+                .build();
+        try {
+            Response decodeResponse = decodeClient.newCall(okHttpRequest).execute();
+            String decodeResponseContext = "";
+            if (decodeResponse.body() != null) {
+                decodeResponseContext = decodeResponse.body().string();
+            }
+            log.info("supplier10000008.scmDecodeIdCode接口decodeResponseContext={}", decodeResponseContext);
+            JSONObject decodeResponseObject = JSON.parseObject(decodeResponseContext);
+            if (decodeResponseObject != null && decodeResponseObject.getString("code").equals("200") && decodeResponseObject.getString("data").equals("1")) {
+                JSONObject msg = JSON.parseObject(JSON.toJSONString(decodeResponseObject.get("msg")));
+                CustomBodyObject result = new CustomBodyObject();
+                result.setIdCode(msg.getString("idcard"));
+                result.setName(msg.getString("name"));
+                return result;
+            } else {
+                return null;
+            }
+        } catch (SocketTimeoutException ste) {
+            ErrorUtils.captureException(ste);
+            log.info("supplier10000002.getDecodeIdCard接口SocketTimeoutException={}", ste);
+            return null;
+        } catch (Exception e) {
+            ErrorUtils.captureException(e);
+            log.info("supplier10000002.decodeIdCode接口Exception={}", e);
+            return null;
+        }
+    }
+}

+ 107 - 0
src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/utils/DESedeUtil.java

@@ -0,0 +1,107 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.utils;
+
+import lombok.extern.slf4j.Slf4j;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.UnsupportedEncodingException;
+
+@Slf4j
+public class DESedeUtil {
+    //定义加密算法,有DES、DESede(即3DES)、Blowfish
+    private static final String Algorithm = "DESede";
+
+    /**
+     * 加密方法
+     *
+     * @param src 源数据的字节数组
+     * @return
+     */
+    public static String encryptMode(String src, String key) {
+        try {
+            log.info("开始加密");
+            SecretKey deskey = new SecretKeySpec(build3DesKey(key), Algorithm);    //生成密钥
+            Cipher c1 = Cipher.getInstance(Algorithm);    //实例化负责加密/解密的Cipher工具类
+            c1.init(Cipher.ENCRYPT_MODE, deskey);    //初始化为加密模式
+            return byteToHexString(c1.doFinal(src.getBytes()));
+
+        } catch (Exception e) {
+            log.error("加密失败:src={},key={}", src,key,e);
+        }
+        return "";
+    }
+
+
+
+    /**
+     * 解密函数
+     *
+     * @param src 密文的字节数组
+     * @return
+     */
+    public static String decryptMode(String src, String key) {
+        String result="";
+        try {
+            log.info("开始解密");
+            byte[] srcArray = hexStringToBytes(src);
+            SecretKey deskey = new SecretKeySpec(build3DesKey(key), Algorithm);
+            Cipher c1 = Cipher.getInstance(Algorithm);
+            c1.init(Cipher.DECRYPT_MODE, deskey); //初始化为解密模式
+            result= new String(c1.doFinal(srcArray));
+        } catch (Exception e) {
+            log.error("解密失败:src={},key={}", src,key,e);
+        }
+        return result;
+    }
+
+    public static String byteToHexString(byte[] b) {
+        String a = "";
+
+        for(int i = 0; i < b.length; ++i) {
+            String hex = Integer.toHexString(b[i] & 255);
+            if(hex.length() == 1) {
+                hex = '0' + hex;
+            }
+
+            a = a + hex;
+        }
+
+        return a;
+    }
+
+    public static byte[] build3DesKey(String keyStr) throws UnsupportedEncodingException {
+        byte[] key = new byte[24];    //声明一个24位的字节数组,默认里面都是0
+        byte[] temp = keyStr.getBytes("UTF-8");    //将字符串转成字节数组
+        if (key.length > temp.length) {
+            //如果temp不够24位,则拷贝temp数组整个长度的内容到key数组中
+            System.arraycopy(temp, 0, key, 0, temp.length);
+        } else {
+            //如果temp大于24位,则拷贝temp数组24个长度的内容到key数组中
+            System.arraycopy(temp, 0, key, 0, key.length);
+        }
+        return key;
+    }
+
+    public static byte[] hexStringToBytes(String hexString) {
+        if (hexString != null && !hexString.equals("")) {
+            hexString = hexString.toUpperCase();
+            int length = hexString.length() / 2;
+            char[] hexChars = hexString.toCharArray();
+            byte[] d = new byte[length];
+
+            for (int i = 0; i < length; ++i) {
+                int pos = i * 2;
+                d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
+            }
+            return d;
+        } else {
+            return null;
+        }
+    }
+
+    static byte charToByte(char c) {
+        return (byte) "0123456789ABCDEF".indexOf(c);
+    }
+
+}

+ 42 - 0
src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/utils/SupplierProperties.java

@@ -0,0 +1,42 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.utils;
+
+import lombok.Data;
+
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author jianggang
+ * @Date 2018/12/20 10:50:38
+ * @Description
+ */
+
+@Data
+@Component
+@ConfigurationProperties(prefix ="supplier")
+public class SupplierProperties {
+
+    private String url;
+
+    private String sleepTime;
+
+    private Map<Integer,String> code;
+    private Map<Integer,String> desc;
+
+    private String appCode;
+
+    private String pCode;
+
+    private String decryptKey;
+
+    private String decodeApi;
+
+    private String decodeUrl;
+
+    private String decodeAppKey;
+
+    private String decodeAppSecret;
+}

+ 38 - 0
src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/vo/DecodeThreeElementRequestObject.java

@@ -0,0 +1,38 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.vo;
+
+import lombok.Data;
+import lombok.ToString;
+
+/**
+ * @description:
+ * @author: xusonglin
+ * @create: 2019/9/29 15:04
+ * @version: V1.0
+ **/
+@Data
+@ToString
+public class DecodeThreeElementRequestObject {
+    /**接口名*/
+    private String api;
+    /**appkey*/
+    private String appKey;
+    /**密钥*/
+    private String appSecret;
+    /**被查询人对象*/
+    private DecodeThreeElementRequestData data;
+
+    @Data
+    @ToString(callSuper = true, includeFieldNames = true)
+    public static class DecodeThreeElementRequestData {
+        /**姓名*/
+        private String name;
+        /**身份证号*/
+        private String id_number;
+        /**手机号*/
+        private String mobile;
+        /**加密方式*/
+        private String encrypt;
+        /**sign*/
+        private String sign;
+    }
+}

+ 28 - 0
src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/vo/TwoParamIdCardRequestObject.java

@@ -0,0 +1,28 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.vo;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author jianggang
+ * @Date 2018/10/24 16:26:16
+ * @Description
+ */
+
+@ApiModel(value = "白天源-身份证二要素接口请求对象")
+@Data
+public class TwoParamIdCardRequestObject implements Serializable {
+
+    @ApiModelProperty(name = "姓名", required = true)
+    private String name;
+
+    @ApiModelProperty(name = "身份证号", required = true)
+    @JSONField(name = "idNo")
+    private String idCard;
+
+}

+ 47 - 0
src/main/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/vo/TwoParamIdCardResponseObject.java

@@ -0,0 +1,47 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author jianggang
+ * @Date 2018/10/24 16:28:07
+ * @Description
+ */
+
+@Data
+public class TwoParamIdCardResponseObject implements Serializable {
+
+    private String code;
+
+    private String orderNo;
+
+    private boolean charge;
+
+    private String pcode;
+
+    private String time;
+
+    private String message;
+
+    private Param param;
+
+    private Data data;
+
+    @lombok.Data
+    public class Param implements Serializable{
+
+        private String name;
+
+        private String idNo;
+    }
+
+    @lombok.Data
+    public class Data implements Serializable{
+
+        private String result;
+
+        private String state;
+    }
+}

+ 109 - 0
src/main/resources/config/application-test.yml

@@ -0,0 +1,109 @@
+server:
+  tomcat:
+    accesslog:
+      buffered: false
+      enabled: true
+      pattern: '{"DateTime":"%{yyyy-MM-dd''T''HH:mm:ss.SSSZZ}t","ClientIP":"%a","Method":"%m","URI":"%U","RequestProtocol":"%H","ResponseCode":%s,
+                  "ResponseTime":%D,"UserAgent":"-","X-Forwarded-For":"-","X-User-IP":"%{X-Real-IP}i","traceId":"%{x-b3-traceid}r","id":"%{x-b3-spanid}r",
+                  "parentId":"%{x-b3-parentspanid}r","ApplicationName":"${spring.application.name}","MG-IsCharge":%{x-isCharge}r,"MG-Upstream-ResponseCode":"%{upResponseCode}r","MG-ChannelId":%{channelId}r,
+                  "MG-ResponseCode":%{x-responseCode}r,"MG-CustomBody":"%{x-requestQuery}r","MG-SellingPrice":%{price}r,"req_type":"%{req_type}r","MG-ProductId":%{productId}r,"MG-UserId":%{userid}r,"MG-IfCj":"%{ifcj}r"}'
+      prefix: access_${HOSTNAME}_${spring.application.name}_${server.port}
+      directory: ${logging.path}
+  servlet:
+    context-path: /
+
+spring:
+  elasticsearch:
+    jest:
+      read-timeout: 300s
+      connection-timeout: 10s
+      uris: http://10.8.17.117:9200,http://10.8.17.118:9200,http://10.8.17.119:9200
+  sleuth:
+    sampler:
+      probability: 0.1
+    web:
+      additional-skip-pattern: /api/v2/spans
+  zipkin:
+    base-url: http://127.0.0.1:${server.port}
+  mvc:
+    favicon:
+      enabled: false
+  cloud:
+    config:
+      overrideSystemProperties: true
+      allowOverride: true
+      overrideNone: true
+    stream:
+      kafka:
+        binder:
+          brokers: 10.8.17.118:9092,10.8.17.119:9092,10.8.17.120:9092
+          auto-add-partitions: true
+          auto-create-topics: true
+          required-acks: 1
+      bindings:
+        output:
+          destination: iov_sjjh_callback_downstream_test1
+          content-type: text/plain
+          producer:
+            partitionCount: 3
+            partitionKeyExpression: headers.id
+
+#management
+management:
+  endpoints:
+    enabled-by-default: true
+    web:
+      exposure:
+        include: '*'
+  endpoint:
+    health:
+      show-details: always
+    shutdown:
+      enabled: true
+
+
+#logging
+logging:
+  file:
+    path: /Users/jkxy/root-logs/apps/var/jakarta/logs
+    name: ${logging.path}/catalina_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.out
+  config: classpath:config/logback-spring.xml
+  level:
+    root: INFO
+  path: /Users/jkxy/root-logs/apps/var/jakarta/logs
+#error logging
+#sleuth logging
+rdc:
+  logging:
+    error-file: ${logging.path}/error_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.log
+    sleuth-file: ${logging.path}/sleuth_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.log
+
+#eureka
+eureka:
+  instance:
+    prefer-ip-address: true
+    instance-id: ${spring.cloud.client.ip-address}:${server.port}:${spring.application.name}
+    metadata-map:
+      management:
+        server:
+          port: ${management.server.port}
+    health-check-url: http://${spring.cloud.client.ip-address}:${management.server.port}${eureka.instance.health-check-url-path}
+    health-check-url-path: /actuator/health
+  client:
+    serviceUrl:
+      defaultZone: http://localhost:8888/eureka
+    enabled: true
+
+supplier:
+  url: http://if.jkcredit.com:8081/baitian/api/data
+  sleepTime: 0
+  code: {1: 1000,2: 1001,3: 9901,4: 1099,8: 9909,10: 9903,22: 9920,23: 9921,24: 9922}
+  desc: {22: 姓名为空或格式不规范,23: 身份证为空或格式不规范,24: 手机号为空或格式不规范,9920: 姓名格式错误,9921: 身份证号格式错误,9922: 手机号格式错误,1000: 一致,1001: 不一致,1099: 库无,9903: 手机号码非移动号码,
+         9909: 请求数据格式错误,9901: 查询错误,1: 匹配,2: 不匹配,3: 其他问题,4: 库中无此号,8: 参数错误,10: 非移动号段}
+  appCode: 435467190414606336
+  pCode: P_001_0003
+  decryptKey: JK568FG2823
+  decodeApi: CMCC_3RD_DECRYPT
+  decodeUrl: http://jkxy.h11.site/gateway?api=credit.sec.data
+  decodeAppKey: JIAO_KE
+  decodeAppSecret: D78C393359BF128715C65D91C67051478A4DFC13

+ 3 - 0
src/main/resources/config/banner.txt

@@ -0,0 +1,3 @@
+*******************************************************************************
+	 @project.artifactId@  (version:@project.version@)
+*******************************************************************************

+ 27 - 0
src/main/resources/config/bootstrap.yml

@@ -0,0 +1,27 @@
+spring:
+  application:
+    name: iov-sjjh-servicenode-supplier-10000002
+  banner:
+    location: classpath:config/banner.txt
+  profiles:
+    active: hwtest
+  cloud:
+    config:
+      discovery:
+        enabled: false
+      uri: http://10.8.18.157:32533
+      label: trunk
+      name: ${spring.application.name}
+      profile: ${spring.profiles.active}
+server:
+  port: 20902
+management:
+  server:
+    port: 21092
+
+info:
+  name: '@project.description@'
+  version: '@project.version@'
+logging:
+  file:
+    name: ${logging.file.path}/catalina_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.out

+ 109 - 0
src/main/resources/config/iov-sjjh-servicenode-supplier-10000002-hwtest.yml

@@ -0,0 +1,109 @@
+server:
+  tomcat:
+    accesslog:
+      buffered: false
+      enabled: true
+      pattern: '{"DateTime":"%{yyyy-MM-dd''T''HH:mm:ss.SSSZZ}t","ClientIP":"%a","Method":"%m","URI":"%U","RequestProtocol":"%H","ResponseCode":%s,
+                  "ResponseTime":%D,"UserAgent":"-","X-Forwarded-For":"-","X-User-IP":"%{X-Real-IP}i","traceId":"%{x-b3-traceid}r","id":"%{x-b3-spanid}r",
+                  "parentId":"%{x-b3-parentspanid}r","ApplicationName":"${spring.application.name}","MG-IsCharge":%{x-isCharge}r,"MG-Upstream-ResponseCode":"%{upResponseCode}r","MG-ChannelId":%{channelId}r,
+                  "MG-ResponseCode":%{x-responseCode}r,"MG-CustomBody":"%{x-requestQuery}r","MG-SellingPrice":%{price}r,"req_type":"%{req_type}r","MG-ProductId":%{productId}r,"MG-UserId":%{userid}r,"MG-IfCj":"%{ifcj}r"}'
+      prefix: access_${HOSTNAME}_${spring.application.name}_${server.port}
+      directory: ${logging.path}
+  servlet:
+    context-path: /
+
+spring:
+  elasticsearch:
+    jest:
+      read-timeout: 300s
+      connection-timeout: 10s
+      uris: http://10.8.17.117:9200,http://10.8.17.118:9200,http://10.8.17.119:9200
+  sleuth:
+    sampler:
+      probability: 0.1
+    web:
+      additional-skip-pattern: /api/v2/spans
+  zipkin:
+    base-url: http://127.0.0.1:${server.port}
+  mvc:
+    favicon:
+      enabled: false
+  cloud:
+    config:
+      overrideSystemProperties: true
+      allowOverride: true
+      overrideNone: true
+    stream:
+      kafka:
+        binder:
+          brokers: 10.8.17.118:9092,10.8.17.119:9092,10.8.17.120:9092
+          auto-add-partitions: true
+          auto-create-topics: true
+          required-acks: 1
+      bindings:
+        output:
+          destination: iov_sjjh_callback_downstream_test1
+          content-type: text/plain
+          producer:
+            partitionCount: 3
+            partitionKeyExpression: headers.id
+
+#management
+management:
+  endpoints:
+    enabled-by-default: true
+    web:
+      exposure:
+        include: '*'
+  endpoint:
+    health:
+      show-details: always
+    shutdown:
+      enabled: true
+
+
+#logging
+logging:
+  file:
+    path: /apps/var/jakarta/logs
+    name: ${logging.path}/catalina_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.out
+  config: classpath:config/logback-spring.xml
+  level:
+    root: INFO
+  path: /apps/var/jakarta/logs
+#error logging
+#sleuth logging
+rdc:
+  logging:
+    error-file: ${logging.path}/error_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.log
+    sleuth-file: ${logging.path}/sleuth_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.log
+
+#eureka
+eureka:
+  instance:
+    prefer-ip-address: true
+    instance-id: ${spring.cloud.client.ip-address}:${server.port}:${spring.application.name}
+    metadata-map:
+      management:
+        server:
+          port: ${management.server.port}
+    health-check-url: http://${spring.cloud.client.ip-address}:${management.server.port}${eureka.instance.health-check-url-path}
+    health-check-url-path: /actuator/health
+  client:
+    serviceUrl:
+      defaultZone: http://10.8.18.172:31102/eureka
+    enabled: true
+
+supplier:
+  url: http://if.jkcredit.com:8081/baitian/api/data.do
+  sleepTime: 0
+  code: {1: 1000,2: 1001,3: 9901,4: 1099,8: 9909,10: 9903,22: 9920,23: 9921,24: 9922}
+  desc: {22: 姓名为空或格式不规范,23: 身份证为空或格式不规范,24: 手机号为空或格式不规范,9920: 姓名格式错误,9921: 身份证号格式错误,9922: 手机号格式错误,1000: 一致,1001: 不一致,1099: 库无,9903: 手机号码非移动号码,
+         9909: 请求数据格式错误,9901: 查询错误,1: 匹配,2: 不匹配,3: 其他问题,4: 库中无此号,8: 参数错误,10: 非移动号段}
+  appCode: 435467190414606336
+  pCode: P_001_0003
+  decryptKey: JK568FG2823
+  decodeApi: CMCC_3RD_DECRYPT
+  decodeUrl: http://jkxy.h11.site/gateway?api=credit.sec.data
+  decodeAppKey: JIAO_KE
+  decodeAppSecret: D78C393359BF128715C65D91C67051478A4DFC13

+ 37 - 0
src/main/resources/config/logback-spring.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+	<include resource="org/springframework/boot/logging/logback/defaults.xml" />
+	<include
+		resource="org/springframework/boot/logging/logback/console-appender.xml" />
+
+	<property name="LOG_FILE"
+		value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/spring.log}" />		
+	<springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="/apps/var/jakarta/logs" />
+	<springProperty scope="context" name="application_name" source="spring.application.name" defaultValue="test-servicenode-supplier-2" />
+	<springProperty scope="context" name="sleuth_file" source="rdc.logging.sleuth-file" defaultValue="${LOG_PATH}/sleuth/sleuth.log" />
+	<springProperty scope="context" name="error_file" source="rdc.logging.error-file" defaultValue="${LOG_PATH}/error/error.log" />
+
+	<include resource="info/aspirecn/rdc/aspirecloud/node/except/xml/defaults.xml" />
+	<include resource="info/aspirecn/rdc/aspirecloud/node/brave/xml/defaults.xml" />
+
+	<appender name="TIME_FILE"
+		class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<encoder>
+			<pattern>${FILE_LOG_PATTERN}</pattern>
+		</encoder>
+		<file>${LOG_FILE}</file>
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+			<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i</fileNamePattern>
+			<maxHistory>8</maxHistory>
+			<timeBasedFileNamingAndTriggeringPolicy
+				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+				<maxFileSize>100MB</maxFileSize>
+			</timeBasedFileNamingAndTriggeringPolicy>
+		</rollingPolicy>
+	</appender>
+	
+	<root level="INFO">
+		<appender-ref ref="CONSOLE" />
+		<appender-ref ref="TIME_FILE" />
+	</root>
+</configuration>

+ 8 - 0
src/main/resources/docker/Dockerfile

@@ -0,0 +1,8 @@
+FROM hub.i139.cn/rdc-commons/official-openjdk:8u191-jre-alpine3.9
+VOLUME /tmp
+COPY target/lib/ ./lib/
+ADD *.jar app.jar
+RUN sh -c 'touch /app.jar'
+ENV JAVA_OPTS="-Xmx256M -Xms256M -Xss256k -Duser.timezone=Asia/Shanghai"
+ENV APP_OPTS=""
+ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar $APP_OPTS" ]

+ 78 - 0
src/test/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/test/http/ActionService.java

@@ -0,0 +1,78 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.test.http;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.Application;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.vo.TwoParamIdCardRequestObject;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty_interface.vo.CustomBodyObject;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
+import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import java.io.IOException;
+import java.util.Scanner;
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+@WebAppConfiguration
+public class ActionService {
+    private MockMvc mockMvc;
+
+    @Autowired
+    private WebApplicationContext context;
+    @Autowired
+    private ObjectMapper objectMapper;
+
+
+    @Before
+    public void before() throws Exception {
+        mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
+    }
+
+    @Test
+    public void checkIdCardForBTY() throws Exception {
+        CustomBodyObject twoParamIdCardRequestObject = new CustomBodyObject();
+        String channelId = "1000001";
+        twoParamIdCardRequestObject.setIdCode("41xexstesfss");
+        twoParamIdCardRequestObject.setName("chen");
+        twoParamIdCardRequestObject.setPlateNumber("1111");
+        String customBody = objectMapper.writeValueAsString(twoParamIdCardRequestObject);
+        mockMvc.perform(
+                MockMvcRequestBuilders.post("/checkIdCardForBTY.do")
+                        .header("channelId",channelId)
+                        .param("outTime", "1000")
+                        .param("customBody", customBody)
+        )
+                .andExpect(MockMvcResultMatchers.status().isOk())
+                .andDo(MockMvcResultHandlers.print());
+
+    }
+
+    @Test
+    public void checkIdCardWeiZhong() throws Exception {
+        CustomBodyObject twoParamIdCardRequestObject = new CustomBodyObject();
+        String channelId = "1000001";
+        twoParamIdCardRequestObject.setIdCode("41xexstesfss");
+        twoParamIdCardRequestObject.setName("chen");
+        twoParamIdCardRequestObject.setPlateNumber("1111");
+        String customBody = objectMapper.writeValueAsString(twoParamIdCardRequestObject);
+        mockMvc.perform(
+                MockMvcRequestBuilders.post("/checkIdCardWeiZhong.do")
+                        .header("channelId",channelId)
+                        .param("outTime", "1000")
+                        .param("customBody", customBody)
+        )
+                .andExpect(MockMvcResultMatchers.status().isOk())
+                .andDo(MockMvcResultHandlers.print());
+
+    }
+
+}

+ 1 - 0
src/test/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/test/package-info.java

@@ -0,0 +1 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.test;

+ 71 - 0
src/test/java/info/aspirecn/rdc/iov/sjjh/servicenode/supplier/bty/test/serviceTest/BTYChannelServiceTest.java

@@ -0,0 +1,71 @@
+package info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.test.serviceTest;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
+import info.aspirecn.iov.sjjh.commons.lang.Constant;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.Application;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.service.BTYChannelService;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty.vo.TwoParamIdCardResponseObject;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty_interface.vo.CustomBodyObject;
+import info.aspirecn.rdc.iov.sjjh.servicenode.supplier.bty_interface.vo.ResponseObject;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+
+/**
+ * @Auther jianggang
+ * @Date 2018/10/25 14:33:50
+ * @Description
+ */
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+@Slf4j
+public class BTYChannelServiceTest {
+
+    @Autowired
+    BTYChannelService btyChannelService;
+
+    @Test
+    public void sendTwoParamIdCardRequestTest() throws IOException {
+        CustomBodyObject customBodyObject = new CustomBodyObject();
+        customBodyObject.setName("江港");
+        customBodyObject.setIdCode("421022199701017517");
+        ObjectMapper mapper = new ObjectMapper();
+        String customBodyString = mapper.writeValueAsString(customBodyObject);
+
+        MockHttpServletRequest request = new MockHttpServletRequest();
+        request.addHeader(Constant.CUSTOMER_RETURN_TYPE_PARA,1);
+        ChannelTypeHandleResponseObject responseObject = btyChannelService.sendTwoParamIdCardRequest(request,"20000002",1000,customBodyString);
+        log.info("responseObject========>{}",responseObject.toString());
+        Assert.assertEquals((int)responseObject.getCode(),Constant.SUCCESS);
+        Assert.assertEquals((int)responseObject.getIsCharge(),Constant.INTERFACE_QUERY_FEE);
+        Assert.assertEquals(((TwoParamIdCardResponseObject)responseObject.getResultBody()).getCode(),"100");
+        Assert.assertEquals(((TwoParamIdCardResponseObject)responseObject.getResultBody()).getData().getResult(),"一致");
+    }
+    @Test
+    public void checkIdCardWeiZhongTest() throws IOException {
+        CustomBodyObject customBodyObject = new CustomBodyObject();
+        customBodyObject.setName("江港");
+        customBodyObject.setIdCode("421022199701017517");
+        ObjectMapper mapper = new ObjectMapper();
+        String customBodyString = mapper.writeValueAsString(customBodyObject);
+
+        MockHttpServletRequest request = new MockHttpServletRequest();
+        request.addHeader(Constant.CUSTOMER_RETURN_TYPE_PARA,1);
+        ChannelTypeHandleResponseObject responseObject = btyChannelService.checkIdCardWeiZhong(request,"20000002",1000,customBodyString);
+        log.info("responseObject========>{}",responseObject.toString());
+        Assert.assertEquals((int)responseObject.getCode(),Constant.SUCCESS);
+        Assert.assertEquals((int)responseObject.getIsCharge(),Constant.INTERFACE_QUERY_FEE);
+        Assert.assertEquals(((TwoParamIdCardResponseObject)responseObject.getResultBody()).getCode(),"100");
+        Assert.assertEquals(((TwoParamIdCardResponseObject)responseObject.getResultBody()).getData().getResult(),"一致");
+    }
+}