فهرست منبع

[众安] feat(报价): queryJyytVehicleModel

wlq 1 سال پیش
والد
کامیت
b05a4b90cf

+ 1 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/client/ZhongAnAPI.java

@@ -11,6 +11,7 @@ public enum ZhongAnAPI implements CrawlerRequestUrlStandard {
     CacheInputQuery("/open/bmw/index_controller/cache_input_query.json", "发起创建保单"),
     CacheCarInfo("/open/bmw/car_controller/cache_car_info.json", "缓存保单数据"),
     QueryCarInfo("/open/bmw/car_controller/query_car_info.json", "查询车信息"),
+    QueryJyytVehicleModel("/open/bmw/car_controller/query_jyyt_vehicle_model.json", "车型查询"),
 
     ;
 

+ 10 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/model/param/ZhongAnQueryJyytVehicleModelParam.java

@@ -0,0 +1,10 @@
+package com.jzg.quotation.zhongan.crawler.model.param;
+
+import com.jzg.quotation.commons.utils.UnknownFieldEntity;
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class ZhongAnQueryJyytVehicleModelParam extends UnknownFieldEntity {
+}

+ 48 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/model/result/ZhongAnQueryJyytVehicleModelResult.java

@@ -0,0 +1,48 @@
+package com.jzg.quotation.zhongan.crawler.model.result;
+
+import com.jzg.quotation.commons.utils.UnknownFieldEntity;
+import com.jzg.quotation.zhongan.crawler.client.ZhongAnResponse2;
+import com.jzg.quotation.zhongan.crawler.model.entity.ZhongAnVehicleModel;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+@Setter
+@Getter
+public class ZhongAnQueryJyytVehicleModelResult extends UnknownFieldEntity {
+    public static class Response extends ZhongAnResponse2<ZhongAnQueryJyytVehicleModelResult, Object> {
+    }
+
+    private Data datas;
+
+
+    @Override
+    protected void addChildUnknownFields() {
+        addChildUnknownField("datas", datas);
+    }
+
+
+
+
+
+    @Setter
+    @Getter
+    public static class Data extends UnknownFieldEntity {
+        /**
+         * 最低价格车辆信息
+         */
+        private ZhongAnVehicleModel minPriceVehicle;
+
+        /**
+         * 车辆型号列表
+         */
+        private List<ZhongAnVehicleModel> vehicleModelList;
+
+        @Override
+        protected void addChildUnknownFields() {
+            addChildUnknownField("minPriceVehicle", minPriceVehicle);
+            addChildUnknownField("vehicleModelList", vehicleModelList);
+        }
+    }
+}

+ 26 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/service/ZhongAnAPIService.java

@@ -69,6 +69,32 @@ public class ZhongAnAPIService {
         return response.getValue();
     }
 
+    /**
+     * 车型查询
+     *
+     * @param token
+     * @param flowId
+     * @param vehicleFrameNo
+     * @return
+     */
+    public ZhongAnQueryJyytVehicleModelResult queryJyytVehicleModel(String token, String flowId, String vehicleFrameNo) {
+        HttpHeaders headers = new HttpHeaders();
+        headers.add("Cookie", token);
+
+        MultiValueMap<String, String> param  = new LinkedMultiValueMap<>();
+        param.set("flowId", flowId);
+        param.set("vehicleFrameNo", vehicleFrameNo);
+        param.set("callVehicleModelLibraryFlag", "0");
+        param.set("vehicleType", "");
+        param.set("page", "/baseInfo");
+        param.set("i", "e");
+        param.set("flag", "0");
+
+        ZhongAnQueryJyytVehicleModelResult.Response response = form(ZhongAnAPI.QueryJyytVehicleModel, param, ZhongAnQueryJyytVehicleModelResult.Response.class, headers);
+
+        return response.getValue();
+    }
+
 
     /**
      * 查询保单地址

+ 3 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/service/ZhongAnQuotaionApiBaseServiceImpl.java

@@ -42,6 +42,9 @@ public class ZhongAnQuotaionApiBaseServiceImpl implements QuotationApiBaseServic
         // 此接口可能不支持并发,参看 cacheCarInfo 接口注释。
         zhongAnAPIService.cacheInputQuery(token, flowId, zhongAnCacheInputQueryParam);
 
+        // 车型查询
+        ZhongAnQueryJyytVehicleModelResult zhongAnQueryJyytVehicleModelResult = zhongAnAPIService.queryJyytVehicleModel(token, flowId, carInfoVo.getVinNo());
+
         ZhongAnCacheCarInfoParam zhongAnCacheCarInfoParam = new ZhongAnCacheCarInfoParam();
         zhongAnCacheCarInfoParam.setInsurePlace("晋城市");
         zhongAnCacheCarInfoParam.setInsurePlaceCode("140500");

+ 139 - 0
tenant/insurance/quotation-zhongan/src/test/java/com/jzg/quotation/zhongan/crawler/model/result/ZhongAnQueryJyytVehicleModelResultTest.java

@@ -0,0 +1,139 @@
+package com.jzg.quotation.zhongan.crawler.model.result;
+
+import com.jzg.quotation.zhongan.crawler.JsonUtil;
+import org.junit.jupiter.api.Test;
+
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+public class ZhongAnQueryJyytVehicleModelResultTest {
+
+    @Test
+    public void test() {
+        String json = """
+                {
+                    "errorMsg": "",
+                    "ruleMsgTips": "",
+                    "errorCode": "",
+                    "value": {
+                        "datas": {
+                            "minPriceVehicle": {
+                                "vehicleCode": "BTABGD0009",
+                                "vehicleName": "本田GHA6480KAC5A多用途乘用车",
+                                "companyName": "广汽本田汽车有限公司",
+                                "companyCode": "MK03138",
+                                "brandName": "广汽本田",
+                                "brandCode": "BTA1",
+                                "familyName": "冠道",
+                                "familyCode": "BTA1AS",
+                                "remark": "CVT 两驱精英版 国Ⅴ",
+                                "vehicleClassCode": "IC02",
+                                "vehicleClass": "越野车类",
+                                "vehicleImport": "合资",
+                                "purchasePrice": 203000,
+                                "purchasePriceTax": 220350,
+                                "kindredPrice": 0,
+                                "kindredPriceTax": "0",
+                                "jqxClassid": "KA",
+                                "jqxClassname": "六座以下客车",
+                                "syxClassid": "KA",
+                                "syxClassname": "六座以下客车",
+                                "seat": "5",
+                                "fullWeight": "1708",
+                                "fullWeightMax": 1708,
+                                "fullWeightMin": 1708,
+                                "displacement": 1.498,
+                                "marketDate": "201703",
+                                "gearBoxType": "CVT",
+                                "engineDesc": "1.5T",
+                                "vehicleWeight": "2180",
+                                "groupName": "冠道(16/10-20/03)",
+                                "groupCode": "BTA1AS01",
+                                "stopFlag": "1",
+                                "vehicleHyName": "本田GHA6480KAC5A 精英版",
+                                "vehicleHyCode": "BGQEGAUC0003",
+                                "configName": "2017款 两驱精英版",
+                                "hfCode": "0",
+                                "hfName": "正常",
+                                "vehiclePubName": "本田",
+                                "vehiclePubCode": "GHA6480KAC5A",
+                                "yearPattern": "2017",
+                                "power": "142",
+                                "familyShortName": "冠道",
+                                "powerType": "汽油",
+                                "powerTypeCode": "D1"
+                            },
+                            "vehicleModelList": [
+                                {
+                                    "vehicleCode": "BTABGD0009",
+                                    "vehicleName": "本田GHA6480KAC5A多用途乘用车",
+                                    "companyName": "广汽本田汽车有限公司",
+                                    "companyCode": "MK03138",
+                                    "brandName": "广汽本田",
+                                    "brandCode": "BTA1",
+                                    "familyName": "冠道",
+                                    "familyCode": "BTA1AS",
+                                    "remark": "CVT 两驱精英版 国Ⅴ",
+                                    "vehicleClassCode": "IC02",
+                                    "vehicleClass": "越野车类",
+                                    "vehicleImport": "合资",
+                                    "purchasePrice": 203000,
+                                    "purchasePriceTax": 220350,
+                                    "kindredPrice": 0,
+                                    "kindredPriceTax": "0",
+                                    "jqxClassid": "KA",
+                                    "jqxClassname": "六座以下客车",
+                                    "syxClassid": "KA",
+                                    "syxClassname": "六座以下客车",
+                                    "seat": "5",
+                                    "fullWeight": "1708",
+                                    "fullWeightMax": 1708,
+                                    "fullWeightMin": 1708,
+                                    "displacement": 1.498,
+                                    "marketDate": "201703",
+                                    "gearBoxType": "CVT",
+                                    "engineDesc": "1.5T",
+                                    "vehicleWeight": "2180",
+                                    "groupName": "冠道(16/10-20/03)",
+                                    "groupCode": "BTA1AS01",
+                                    "stopFlag": "1",
+                                    "vehicleHyName": "本田GHA6480KAC5A 精英版",
+                                    "vehicleHyCode": "BGQEGAUC0003",
+                                    "configName": "2017款 两驱精英版",
+                                    "hfCode": "0",
+                                    "hfName": "正常",
+                                    "vehiclePubName": "本田",
+                                    "vehiclePubCode": "GHA6480KAC5A",
+                                    "yearPattern": "2017",
+                                    "power": "142",
+                                    "vehicleSize": "4816*1942*1669",
+                                    "familyShortName": "冠道",
+                                    "powerType": "汽油",
+                                    "powerTypeCode": "D1",
+                                    "airBagNum": "4",
+                                    "vehicleHyCCode": "BGQEGAUC0003",
+                                    "topSpeed": "198"
+                                }
+                            ]
+                        }
+                    },
+                    "additionalInfo": {},
+                    "success": true
+                }
+                """;
+
+        ZhongAnQueryJyytVehicleModelResult.Response result = JsonUtil.readObjcet(json, ZhongAnQueryJyytVehicleModelResult.Response.class);
+
+        assertNotNull(result);
+
+        Map<String, Object> unknownFields = result.getUnknownFields();
+
+        System.out.println();
+        System.out.println();
+        System.out.println(unknownFields);
+
+        assertNull(unknownFields);
+    }
+}