Просмотр исходного кода

添加泰康 添加 entranceForDecrypt、entranceForString、entranceForJson 接口

wlq 1 год назад
Родитель
Сommit
131122ecea

+ 62 - 1
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/service/TaiKangHttpService.java

@@ -738,10 +738,71 @@ public class TaiKangHttpService {
 
 
     /**
     /**
      *
      *
+     * entrance 返回的数据是加密数据的情况
      *
      *
      * @return
      * @return
      */
      */
-    public EntranceResult entrance(String tplatformId, String fromId, String orderId) {
+    public EntranceResult entranceForDecrypt(String tplatformId, String fromId, String orderId) {
+        EntranceParam param = new EntranceParam();
+        param.setChannelCode("OffWeb");
+        param.setFromID(fromId);
+        param.setOrderID(orderId);
+        param.setLeadsid("");
+        param.setReadTime("");
+        param.setIdcardOcrFlag("");
+        param.setCollectFlag("");
+
+        HttpHeaders httpHeaders = new HttpHeaders();
+        httpHeaders.add("tkCarRequestToken", token());
+
+        StringResponse response = client.request(HttpURL.entrance, param, httpHeaders, StringResponse.class);
+
+        checkResponseUnknownField(response);
+
+        // 解密
+        String json = AESDecryptor.decrypt(response.getData());
+
+        if (logger.isInfoEnabled()) {
+            logger.info("TaiKangHttpClient entranceForDecrypt decrypt body: {}", json);
+        }
+
+        EntranceResult.Response response1 = JsonUtil.readObjcet(json, EntranceResult.Response.class);
+
+        checkResponseUnknownField(response1);
+
+        return response1.getData();
+    }
+
+    /**
+     *
+     * entrance 返回的数据是字符串的情况
+     *
+     * @return
+     */
+    public String entranceForString(String tplatformId, String fromId, String orderId) {
+        EntranceParam param = new EntranceParam();
+        param.setChannelCode("OffWeb");
+        param.setFromID(fromId);
+        param.setOrderID(orderId);
+        param.setLeadsid("");
+        param.setReadTime("");
+        param.setIdcardOcrFlag("");
+        param.setCollectFlag("");
+
+        HttpHeaders httpHeaders = new HttpHeaders();
+        httpHeaders.add("tkCarRequestToken", token());
+
+        StringResponse response = client.request(HttpURL.entrance, param, httpHeaders, StringResponse.class);
+
+        return response.getData();
+    }
+
+    /**
+     *
+     * entrance 返回的数据是 json 的情况
+     * @return
+     */
+    public EntranceResult entranceForJson(String tplatformId, String fromId, String orderId) {
         EntranceParam param = new EntranceParam();
         EntranceParam param = new EntranceParam();
         param.setChannelCode("OffWeb");
         param.setChannelCode("OffWeb");
         param.setFromID(fromId);
         param.setFromID(fromId);

+ 1 - 1
tenant/insurance/quotation-taikang/src/test/java/com/jzg/quotation/taikang/service/TaiKangHttpServiceTest1.java

@@ -1159,7 +1159,7 @@ public class TaiKangHttpServiceTest1 {
 
 
         EngageEngageQueryParam.Privy privy = new EngageEngageQueryParam.Privy();
         EngageEngageQueryParam.Privy privy = new EngageEngageQueryParam.Privy();
 
 
-        EntranceResult result = taiKangHttpService.entrance(tplatformId, fromid, "WBPC202503071419220680000");
+        EntranceResult result = taiKangHttpService.entranceForJson(tplatformId, fromid, "WBPC202503071419220680000");
 
 
         assertNotNull(result);
         assertNotNull(result);