Browse Source

添加泰康

wlq 1 year ago
parent
commit
7a5e3f0ef8

+ 1 - 4
.gitignore

@@ -4,10 +4,7 @@ target/
 !**/src/test/**/target/
 
 ### IntelliJ IDEA ###
-.idea/modules.xml
-.idea/jarRepositories.xml
-.idea/compiler.xml
-.idea/libraries/
+.idea
 *.iws
 *.iml
 *.ipr

+ 10 - 0
pom.xml

@@ -244,6 +244,16 @@
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.13.0</version>
+        <configuration>
+          <source>17</source>
+          <target>17</target>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>

+ 1 - 0
tenant/insurance/pom.xml

@@ -25,6 +25,7 @@
         <module>quotation-yangguang</module>
         <module>quotation-guoren</module>
         <module>quotation-huanong</module>
+        <module>quotation-taikang</module>
     </modules>
 
     <dependencies>

+ 39 - 0
tenant/insurance/quotation-taikang/pom.xml

@@ -0,0 +1,39 @@
+<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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.jzg</groupId>
+        <artifactId>tenant</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>quotation-taikang</artifactId>
+    <packaging>jar</packaging>
+    <url>http://maven.apache.org</url>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.jzg</groupId>
+            <artifactId>quotation-commons</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <mainClass>com.jzg.organization.OrganizationApplication</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 44 - 0
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/AESDecryptor.java

@@ -0,0 +1,44 @@
+package com.jzg.quotation.taikang;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+
+public class AESDecryptor {
+    // 假设的密钥和IV(在实际应用中,这些应该是安全的,并且不应该硬编码在代码中)
+    private static final String SECRET_KEY = "MP5t1OVqJCBALNKc"; // 需要是16, 24, 或 32字节长,对应AES-128, AES-192, AES-256
+    private static final String INIT_VECTOR = "A9CAED282E409002"; // 需要是16字节长,对应AES的块大小
+
+    // 将十六进制字符串转换为字节数组
+    private static byte[] hexStringToByteArray(String s) {
+        int len = s.length();
+        byte[] data = new byte[len / 2];
+        for (int i = 0; i < len; i += 2) {
+            data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+                    + Character.digit(s.charAt(i+1), 16));
+        }
+        return data;
+    }
+
+    // AES解密方法
+    public static String decrypt(String hexString) throws Exception {
+        // 将十六进制字符串转换为字节数组
+        byte[] encrypted = hexStringToByteArray(hexString);
+
+        // 创建密钥和IV
+        SecretKey secretKey = new SecretKeySpec(SECRET_KEY.getBytes(StandardCharsets.UTF_8), "AES");
+        IvParameterSpec iv = new IvParameterSpec(INIT_VECTOR.getBytes(StandardCharsets.UTF_8));
+
+        // 创建Cipher实例并初始化为解密模式
+        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+        cipher.init(Cipher.DECRYPT_MODE, secretKey, iv);
+
+        // 执行解密
+        byte[] decrypted = cipher.doFinal(encrypted);
+
+        // 返回解密后的字符串
+        return new String(decrypted, StandardCharsets.UTF_8);
+    }
+}

+ 4 - 0
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/Client.java

@@ -0,0 +1,4 @@
+package com.jzg.quotation.taikang;
+
+public class Client {
+}

+ 18 - 0
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/client/BaseResponse.java

@@ -0,0 +1,18 @@
+package com.jzg.quotation.taikang.client;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+@Setter
+@Getter
+public class BaseResponse<T> implements Serializable {
+    private Integer status;
+
+    private String statusText;
+
+    private T data;
+
+    private String extra;
+}

+ 5 - 0
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/client/HttpURL.java

@@ -0,0 +1,5 @@
+package com.jzg.quotation.taikang.client;
+
+public class HttpURL {
+
+}

+ 28 - 0
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/client/TaiKangHttpClient.java

@@ -0,0 +1,28 @@
+package com.jzg.quotation.taikang.client;
+
+import com.jzg.quotation.commons.component.RequestComponent;
+import com.jzg.quotation.taikang.properties.TaiKangApiProperties;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+@Setter
+@RequiredArgsConstructor
+public class TaiKangHttpClient {
+
+    private RequestComponent requestComponent;
+
+    private TaiKangApiProperties taiKangApiProperties;
+
+    public <T, B extends BaseResponse> B requestUrl(String url, String requestBody, Class<B> responseType, HttpHeaders httpHeaders) {
+        ResponseEntity<B> bResponseEntity = requestComponent.post(url, requestBody, responseType, httpHeaders);
+        return bResponseEntity.getBody();
+    }
+
+
+}

+ 11 - 0
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/entity/DD.java

@@ -0,0 +1,11 @@
+package com.jzg.quotation.taikang.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class DD {
+    private String tkCarRequestToken;
+    private String userName;
+}

+ 37 - 0
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/properties/TaiKangApiProperties.java

@@ -0,0 +1,37 @@
+package com.jzg.quotation.taikang.properties;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Setter
+@Getter
+@Component
+@ConfigurationProperties(prefix = "taikang.api")
+public class TaiKangApiProperties {
+
+    // 为接入方提供获取token服务地址
+    private String accessTokenUrl;
+
+    // 车险业务地址
+    private String url;
+
+    // 支付地址
+    private String payUrl;
+
+    //新支付
+    private String newPayUrl;
+
+    // 订单详情查询服务
+    private String orderUrl;
+
+    // 订单状态查询
+    private String orderDetailUrl;
+
+    // 下载保单地址
+    private String downLoadDocument;
+
+    // 对接三方渠道验车链接接口
+    private String sendCheckCarLink;
+}

+ 7 - 0
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/service/Service.java

@@ -0,0 +1,7 @@
+package com.jzg.quotation.taikang.service;
+
+public class Service {
+    public void aa() {
+
+    }
+}

+ 68 - 0
tenant/insurance/quotation-taikang/src/test/http/AA.http

@@ -0,0 +1,68 @@
+POST http://car.tk.cn/carSelfService/rest/controller/identity
+Content-Type: application/json
+
+{"channelCode":"OffWeb","tplatformId":"feda77e829d4dedbbd8b4e236bacfac5"}
+
+###
+
+POST https://car.tk.cn/carSelfService/rest/init/identify
+Content-Type: application/json
+tkCarRequestToken: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZXFNYXAiOiJ7XCJjYXJSZXF1ZXN0SWRcIjpcIlRPS0UyMDI1MDMwNDE2MDAzNDIwOTAwMDBcIn0iLCJpc3MiOiJ0ay5jbiIsImV4cCI6MTc0MTE2MTYzNH0.8Y4QGD4Vdmm_ba-8ykPjqYR7W0qbv-igbCkOJpqrv5w
+
+{"fromId":"67107","channelCode":"OffWeb","tplatformId":"feda77e829d4dedbbd8b4e236bacfac5","orderID":"WBPC202503041553228380000","comCode":"0114"}
+
+###
+
+POST https://tbonline.tk.cn/backtrack/call/uatuadmin/retrospect/receive
+Content-Type: application/json
+token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJUSzIwMjAmTGlmZXRrIiwiYXBwaWQiOiJUSzIwMjAmTGlmZXRrIiwiZXhwIjoxNzQxMTU5NDUxLCJpYXQiOjE3NDEwNzMwNTF9.ZD_zFsd3OVIyXGnrlM5__nBdq7t1QJLAIj3dqKqla7Q
+
+{"businessId":"2ec7534b-7352-4d6c-8727-b17361a3f4ba","orderNo":"TK000013_WBPC202503041553228380000","policyNo":"","tradeNo":"","productCode":"","productName":"","applyCode":"","applyName":"","certifyType":"","certifyCode":"","source":"PC出单","status":"0","fromId":"67107","reservation1":"2021-10-28","reservation2":""}
+
+###
+
+POST https://car.tk.cn/carSelfService/rest/init/car/type
+Content-Type: application/json
+tkCarRequestToken: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZXFNYXAiOiJ7XCJjYXJSZXF1ZXN0SWRcIjpcIlRPS0UyMDI1MDMwNDE2MDAzNDIwOTAwMDBcIn0iLCJpc3MiOiJ0ay5jbiIsImV4cCI6MTc0MTE2MTYzNH0.8Y4QGD4Vdmm_ba-8ykPjqYR7W0qbv-igbCkOJpqrv5w
+
+
+{"fromId":"67107","comCode":"0114","channelCode":"OffWeb","tplatformId":"feda77e829d4dedbbd8b4e236bacfac5"}
+
+###
+
+POST https://car.tk.cn/carSelfService/rest/agent/discount/type
+Content-Type: application/json
+tkCarRequestToken: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZXFNYXAiOiJ7XCJjYXJSZXF1ZXN0SWRcIjpcIlRPS0UyMDI1MDMwNDE2MDAzNDIwOTAwMDBcIn0iLCJpc3MiOiJ0ay5jbiIsImV4cCI6MTc0MTE2MTYzNH0.8Y4QGD4Vdmm_ba-8ykPjqYR7W0qbv-igbCkOJpqrv5w
+
+{"orderID":"WBPC202503041553228380000","channelCode":"OffWeb","tplatformId":"feda77e829d4dedbbd8b4e236bacfac5"}
+
+###
+
+POST https://car.tk.cn/carSelfService/rest/agent/fuzzy
+Content-Type: application/json
+tkCarRequestToken: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZXFNYXAiOiJ7XCJjYXJSZXF1ZXN0SWRcIjpcIlRPS0UyMDI1MDMwNDE2MDAzNDIwOTAwMDBcIn0iLCJpc3MiOiJ0ay5jbiIsImV4cCI6MTc0MTE2MTYzNH0.8Y4QGD4Vdmm_ba-8ykPjqYR7W0qbv-igbCkOJpqrv5w
+
+{"fromId":"67107","tplatformId":"feda77e829d4dedbbd8b4e236bacfac5","agentCode":"","agencyKeyword":"泰康人寿","lifeAgencyCode":"J","property":"2","orderID":"WBPC202503041644465390000"}
+
+
+###
+
+POST https://car.tk.cn/carSelfService/rest/agent/query
+Content-Type: application/json
+tkCarRequestToken: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZXFNYXAiOiJ7XCJjYXJSZXF1ZXN0SWRcIjpcIlRPS0UyMDI1MDMwNDE2MDAzNDIwOTAwMDBcIn0iLCJpc3MiOiJ0ay5jbiIsImV4cCI6MTc0MTE2MTYzNH0.8Y4QGD4Vdmm_ba-8ykPjqYR7W0qbv-igbCkOJpqrv5w
+
+{"fromId":"64827","tplatformId":"feda77e829d4dedbbd8b4e236bacfac5","agentCode":"R35016546","agencyKeyword":"泰康人寿(个险)(64827)","lifeAgencyCode":"J","property":"2","orderID":"WBPC202503041644465390000"}
+
+
+###
+
+POST https://car.tk.cn/carSelfService/rest/area/user
+Content-Type: application/json
+tkCarRequestToken: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZXFNYXAiOiJ7XCJjYXJSZXF1ZXN0SWRcIjpcIlRPS0UyMDI1MDMwNDE2MDAzNDIwOTAwMDBcIn0iLCJpc3MiOiJ0ay5jbiIsImV4cCI6MTc0MTE2MTYzNH0.8Y4QGD4Vdmm_ba-8ykPjqYR7W0qbv-igbCkOJpqrv5w
+
+{"tplatformId":"feda77e829d4dedbbd8b4e236bacfac5","agencyKeyword":"","lifeAgencyCode":"J","property":"2","orderID":"WBPC202503041644465390000","fromId":"64827","agentCode":"R35016546"}
+
+
+
+
+

File diff suppressed because it is too large
+ 8 - 0
tenant/insurance/quotation-taikang/src/test/java/com/jzg/quotation/taikang/AESDecryptorTest.java


+ 35 - 0
tenant/insurance/quotation-taikang/src/test/java/com/jzg/quotation/taikang/TaiKangHttpClientTest.java

@@ -0,0 +1,35 @@
+package com.jzg.quotation.taikang;
+
+import com.jzg.quotation.commons.component.RequestComponent;
+import com.jzg.quotation.commons.config.WebClientConfig;
+import com.jzg.quotation.taikang.client.BaseResponse;
+import com.jzg.quotation.taikang.client.TaiKangHttpClient;
+import com.jzg.quotation.taikang.entity.DD;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.reactive.function.client.WebClient;
+
+public class TaiKangHttpClientTest {
+    private static final class AA extends BaseResponse<DD> {}
+
+    public static void main(String[] args) {
+        WebClient webClient = new WebClientConfig().clientBuilder();
+
+        RequestComponent requestComponent = new RequestComponent(webClient);
+
+        TaiKangHttpClient client = new TaiKangHttpClient();
+
+        client.setRequestComponent(requestComponent);
+
+
+        String body = "{\"channelCode\":\"OffWeb\",\"tplatformId\":\"feda77e829d4dedbbd8b4e236bacfac5\"}";
+
+        HttpHeaders httpHeaders = new HttpHeaders();
+
+        AA aa = client.requestUrl("http://car.tk.cn/carSelfService/rest/controller/identity", body, AA.class, httpHeaders);
+
+        System.out.println("结果:");
+        System.out.println("结果 token:" + aa.getData().getTkCarRequestToken());
+        System.out.println("结果 name :" + aa.getData().getUserName());
+
+    }
+}

Some files were not shown because too many files changed in this diff