Przeglądaj źródła

fix 恒邦财险 商业险

liub 3 miesięcy temu
rodzic
commit
9fe63cf3cb
15 zmienionych plików z 573 dodań i 128 usunięć
  1. 12 2
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/build/DaDiCrawlerQuoteResultVoBuild.java
  2. 55 5
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/component/DaDiCrawlerRequestComponent.java
  3. 31 40
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/constant/entity/DaDiFuelVehicleInsurance.java
  4. 30 0
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/constant/entity/DaDiNewEnergyVehicleInsurance.java
  5. 1 0
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/constant/enums/RequestUrl.java
  6. 212 24
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/request/DaDiInsurancePlanRequest.java
  7. 13 13
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/request/DaDiVehiclePricRequest.java
  8. 19 0
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/response/DaDiJointSalesResponse.java
  9. 4 0
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/response/DaDiQuoteResponse.java
  10. 7 39
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/response/DaDiSpecialInformationResponse.java
  11. 57 0
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/response/DaDiVehicleCheckInfoResponse.java
  12. 0 1
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/service/impl/DaDiCrawlerRequestImpl.java
  13. 1 2
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/utils/DaDiAESUtils.java
  14. 2 2
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/utils/DaDiVehicleUtils.java
  15. 129 0
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/utils/GsonUtils.java

+ 12 - 2
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/build/DaDiCrawlerQuoteResultVoBuild.java

@@ -50,11 +50,21 @@ public class DaDiCrawlerQuoteResultVoBuild {
         ciRiskInfoVo.setRiskCode(quoteVo.getCiRiskInfoVo().getRiskCode());
         quoteResultsVo.setCiRiskInfoVo(ciRiskInfoVo);
 
+        //商业险
+        RiskInfoVo biRiskInfoVo = buildBiInfo(daDiQuoteResponse);
+        biRiskInfoVo.setRiskCode(quoteVo.getBiRiskInfoVo().getRiskCode());
+        quoteResultsVo.setBiRiskInfoVo(biRiskInfoVo);
+
         //设置保费,车船税,投保单号
         buildParams(daDiQuoteResponse, quoteResultsVo);
         return quoteResultsVo;
     }
 
+    private static RiskInfoVo buildBiInfo(DaDiQuoteResponse daDiQuoteResponse) {
+        RiskInfoVo biRiskInfoVo = new RiskInfoVo();
+        return getRiskInfoVo(false, true, biRiskInfoVo, daDiQuoteResponse);
+    }
+
     public static RiskInfoVo buildCiInfo(DaDiQuoteResponse daDiQuoteResponse) {
         RiskInfoVo ciRiskInfoVo = new RiskInfoVo();
 
@@ -68,8 +78,8 @@ public class DaDiCrawlerQuoteResultVoBuild {
             begintime = daDiQuoteResponse.getInsurancePlan().getTrafficEffectiveStartDate();
             endtime = daDiQuoteResponse.getInsurancePlan().getTrafficEffectiveEndDate();
         } else if (isBiInfo) {
-            begintime = "";
-            endtime = "";
+            begintime = daDiQuoteResponse.getInsurancePlan().getBusinessEffectiveStartDate();
+            endtime = daDiQuoteResponse.getInsurancePlan().getBusinessEffectiveEndDate();
         }
         if (TextUtils.isEmpty(begintime) || TextUtils.isEmpty(endtime)) {
             return null;

+ 55 - 5
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/component/DaDiCrawlerRequestComponent.java

@@ -1,5 +1,6 @@
 package com.jzg.quotation.dadi.crawler.component;
 
+import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.nacos.common.utils.CollectionUtils;
@@ -235,13 +236,58 @@ public class DaDiCrawlerRequestComponent {
                     }
                 }
             }
-
         } else {
             throw new ValidateException("车型查询异常,请联系开发人员");
         }
+        if (vehicleModelVO == null) {
+            throw new ValidateException("未匹配到车型,请更换车型后重新报价");
+        } else {
+            vehicleModelVO.setSeatCount(Integer.parseInt(carInfo.getSeatCount()));
+            if (!TextUtils.isEmpty(carInfo.getLimitLoad())) {
+                vehicleModelVO.setTonCount(Integer.parseInt(carInfo.getLimitLoad()));
+            }
+            if (!TextUtils.isEmpty(carInfo.getCompleteKerbMass())) {
+                vehicleModelVO.setNet(Integer.parseInt(carInfo.getCompleteKerbMass()));
+            }
+        }
+        DaDiVehicleCheckInfoResponse daDiVehicleCheckInfo = checkCarModel(headers, carInfo, vehicleModelVO, agentInfo, vehiclePricVo);
+        if (daDiVehicleCheckInfo.getSameFlag().equals("N")) {
+            vehicleModelVO.setVehicleJingyou(daDiVehicleCheckInfo.getCarModelList().get(0).getVehicleJingyou());
+        } else {
+            DaDiVehicleChannelInfoResponse.VehicleJingyou vehicleJingyou = vehicleModelVO.getVehicleJingyou();
+            vehicleJingyou.setIndustryVehicleCode(daDiVehicleCheckInfo.getCarModelList().get(0).getIndustryVehicleCode());
+            vehicleModelVO.setVehicleJingyou(vehicleJingyou);
+        }
+        if (!TextUtils.isEmpty(carInfo.getDisplacement())) {
+            vehicleModelVO.getVehicleJingyou().setDisplacement(carInfo.getDisplacement());
+        }
         return vehicleModelVO;
     }
 
+    /**
+     * 验证车型信息
+     *
+     * @param headers
+     * @param vehicleModelVO 车辆信息
+     * @return
+     */
+    private DaDiVehicleCheckInfoResponse checkCarModel(HttpHeaders headers, CarInfoVo carInfo, DaDiVehicleChannelInfoResponse.CarModel vehicleModelVO, DaDiAgentInfoResponse agentInfo, DaDiVehiclePricResponse vehiclePricVo) throws Exception {
+        String url = RequestUrl.CHECK_CAR_MODEL.getRequestUrl(daDiCrawlerProperties.getBaseUrl());
+        DaDiVehicleModelRequest carModelRequest = new DaDiVehicleModelRequest(carInfo, vehicleModelVO, agentInfo, vehiclePricVo);
+        String requestBody = DaDiAESUtils.encryptStr(JSON.toJSONString(carModelRequest));
+        String responseBody = networkRequest.doPost(url, requestBody, headers);
+        log.info("\n----------------------> 验证车型信息信息请求成功, \n----------------------> 响应结果:[{}],", responseBody);
+        DaDiBaseResponse daDiCrawlerCaptcha = JSONObject.parseObject(responseBody, DaDiBaseResponse.class);
+        if (!daDiCrawlerCaptcha.isSuccess()) {
+            throw new ValidateException(daDiCrawlerCaptcha.getMsg());
+        }
+        String resJson = DaDiAESUtils.decryptStr(daDiCrawlerCaptcha.getData());
+        log.info("\n----------------------> 验证车型信息结果解析成功, \n----------------------> 解析结果:[{}],", resJson);
+        DaDiVehicleCheckInfoResponse daDiVehicleCheckInfo = JSONObject.parseObject(resJson, DaDiVehicleCheckInfoResponse.class);
+        return daDiVehicleCheckInfo;
+    }
+
+
     /**
      * 获取车辆价格信息
      *
@@ -376,16 +422,20 @@ public class DaDiCrawlerRequestComponent {
 //        log.info("\n----------------------> 新能源车险类型, \n----------------------> 新能源车险类型:[{}],", JSON.toJSONString(daDiNewEnergyVehicleInsurance));
 
         //2.4 获取尊享保障方案
-//        DaDiJointSalesResponse jointSales = getJointSales(headers, quoteVo, daDiVehicleChannelRequest, orderId);
+        DaDiJointSalesResponse jointSales = null;
+        if (!CollUtil.isEmpty(quoteVo.getAccidentalDrivings())) {
+            jointSales = getJointSales(headers, quoteVo, daDiVehicleChannelRequest, orderId);
+        }
+
         //2.6 获取特约信息
-//        DaDiSpecialInformationResponse specialInformation = getSpecialInformation(headers, daDiVehicleChannelRequest, orderId);
+        DaDiSpecialInformationResponse specialInformation = getSpecialInformation(headers, daDiVehicleChannelRequest, orderId);
 
         // 获取税务信息
         DaDiTaxConfigResponse taxConfig = getTaxConfig(headers, orderId, quoteVo, daDiVehicleChannelRequest);
-        //构造车险信息
-        DaDiInsurancePlanRequest daDiInsurancePlanRequest = new DaDiInsurancePlanRequest(quoteVo, taxConfig);
         //构造车型信息
         DaDiVehicleModelRequest carModelRequest = new DaDiVehicleModelRequest(quoteVo.getCarInfoVo(), vehicleModelVO, agentInfoVo, vehiclePricVo);
+        //构造车险信息
+        DaDiInsurancePlanRequest daDiInsurancePlanRequest = new DaDiInsurancePlanRequest(quoteVo, taxConfig, carModelRequest, daDiFuelVehicleInsurance, daDiNewEnergyVehicleInsurance, specialInformation, jointSales);
 
         String url = RequestUrl.CALCULATION_PREMIUM.getRequestUrl(daDiCrawlerProperties.getBaseUrl());
 

+ 31 - 40
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/constant/entity/DaDiFuelVehicleInsurance.java

@@ -3,6 +3,9 @@ package com.jzg.quotation.dadi.crawler.constant.entity;
 import com.google.gson.annotations.SerializedName;
 import lombok.Data;
 
+import java.util.LinkedHashMap;
+import java.util.Map;
+
 /**
  * @author Liub
  * @version 1.0
@@ -141,8 +144,6 @@ public class DaDiFuelVehicleInsurance {
         this.a = new DaDiFuelKindInfo();
         a.setKindCode("C101332");
         a.setKindName("机动车损失保险");
-        a.setKindFlag("A");
-        a.setRiskIndex("A");
         a.setSelected(true);
         a.setAmount("29350.8");
         a.setUnitAmount("");
@@ -161,8 +162,6 @@ public class DaDiFuelVehicleInsurance {
         this.b = new DaDiFuelKindInfo();
         b.setKindCode("C101352");
         b.setKindName("机动车第三者责任保险");
-        b.setKindFlag("B");
-        b.setRiskIndex("B");
         b.setSelected(false);
         b.setAmount("2000000");
         b.setUnitAmount("");
@@ -181,8 +180,6 @@ public class DaDiFuelVehicleInsurance {
         this.d3 = new DaDiFuelKindInfo();
         d3.setKindCode("C101353");
         d3.setKindName("机动车车上人员责任保险(司机)");
-        d3.setKindFlag("D3");
-        d3.setRiskIndex("D3");
         d3.setSelected(false);
         d3.setAmount("10000");
         d3.setUnitAmount("");
@@ -201,8 +198,6 @@ public class DaDiFuelVehicleInsurance {
         this.d4 = new DaDiFuelKindInfo();
         d4.setKindCode("C101354");
         d4.setKindName("机动车车上人员责任保险(乘客)");
-        d4.setKindFlag("D4");
-        d4.setRiskIndex("D4");
         d4.setSelected(false);
         d4.setAmount("60000");
         d4.setUnitAmount("10000");
@@ -221,8 +216,6 @@ public class DaDiFuelVehicleInsurance {
         this.l = new DaDiFuelKindInfo();
         l.setKindCode("C101369");
         l.setKindName("附加车身划痕损失险");
-        l.setKindFlag("L");
-        l.setRiskIndex("L");
         l.setSelected(true);
         l.setAmount("2000");
         l.setUnitAmount("");
@@ -241,8 +234,6 @@ public class DaDiFuelVehicleInsurance {
         this.bd = new DaDiFuelKindInfo();
         bd.setKindCode("C101371");
         bd.setKindName("附加法定节假日限额翻倍险");
-        bd.setKindFlag("BD");
-        bd.setRiskIndex("BD");
         bd.setSelected(true);
         bd.setAmount("2000000");
         bd.setUnitAmount("");
@@ -261,8 +252,6 @@ public class DaDiFuelVehicleInsurance {
         this.syFjYbw1 = new DaDiFuelKindInfo();
         syFjYbw1.setKindCode("C101361");
         syFjYbw1.setKindName("医保外用药险(三者)");
-        syFjYbw1.setKindFlag("SY_FJ_YBW1");
-        syFjYbw1.setRiskIndex("SY_FJ_YBW1");
         syFjYbw1.setSelected(false);
         syFjYbw1.setAmount("100000");
         syFjYbw1.setUnitAmount("");
@@ -281,8 +270,6 @@ public class DaDiFuelVehicleInsurance {
         this.syFjYbw3 = new DaDiFuelKindInfo();
         syFjYbw3.setKindCode("C101382");
         syFjYbw3.setKindName("医保外用药险(司机)");
-        syFjYbw3.setKindFlag("SY_FJ_YBW3");
-        syFjYbw3.setRiskIndex("SY_FJ_YBW3");
         syFjYbw3.setSelected(false);
         syFjYbw3.setAmount("10000");
         syFjYbw3.setUnitAmount("");
@@ -301,8 +288,6 @@ public class DaDiFuelVehicleInsurance {
         this.syFjYbw2 = new DaDiFuelKindInfo();
         syFjYbw2.setKindCode("C101383");
         syFjYbw2.setKindName("医保外用药险(乘客)");
-        syFjYbw2.setKindFlag("SY_FJ_YBW2");
-        syFjYbw2.setRiskIndex("SY_FJ_YBW2");
         syFjYbw2.setSelected(true);
         syFjYbw2.setAmount("600000");
         syFjYbw2.setUnitAmount("100000");
@@ -321,8 +306,6 @@ public class DaDiFuelVehicleInsurance {
         this.ty1 = new DaDiFuelKindInfo();
         ty1.setKindCode("C101372");
         ty1.setKindName("附加道路救援服务特约条款");
-        ty1.setKindFlag("TY1");
-        ty1.setRiskIndex("TY1");
         ty1.setSelected(false);
         ty1.setAmount("");
         ty1.setUnitAmount("");
@@ -341,8 +324,6 @@ public class DaDiFuelVehicleInsurance {
         this.ty2 = new DaDiFuelKindInfo();
         ty2.setKindCode("C101373");
         ty2.setKindName("附加车辆安全检测特约条款");
-        ty2.setKindFlag("TY2");
-        ty2.setRiskIndex("TY2");
         ty2.setSelected(false);
         ty2.setAmount("");
         ty2.setUnitAmount("");
@@ -361,8 +342,6 @@ public class DaDiFuelVehicleInsurance {
         this.ty3 = new DaDiFuelKindInfo();
         ty3.setKindCode("C101374");
         ty3.setKindName("附加代为驾驶服务特约条款");
-        ty3.setKindFlag("TY3");
-        ty3.setRiskIndex("TY3");
         ty3.setSelected(true);
         ty3.setAmount("");
         ty3.setUnitAmount("");
@@ -381,8 +360,6 @@ public class DaDiFuelVehicleInsurance {
         this.ty4 = new DaDiFuelKindInfo();
         ty4.setKindCode("C101375");
         ty4.setKindName("附加代为送检服务特约条款");
-        ty4.setKindFlag("TY4");
-        ty4.setRiskIndex("TY4");
         ty4.setSelected(false);
         ty4.setAmount("");
         ty4.setUnitAmount("");
@@ -401,8 +378,6 @@ public class DaDiFuelVehicleInsurance {
         this.mj1 = new DaDiFuelKindInfo();
         mj1.setKindCode("C101362");
         mj1.setKindName("免赔率(车损)");
-        mj1.setKindFlag("MJ1");
-        mj1.setRiskIndex("MJ1");
         mj1.setSelected(true);
         mj1.setAmount("");
         mj1.setUnitAmount("");
@@ -421,8 +396,6 @@ public class DaDiFuelVehicleInsurance {
         this.mj2 = new DaDiFuelKindInfo();
         mj2.setKindCode("C101363");
         mj2.setKindName("免赔率(三者)");
-        mj2.setKindFlag("MJ2");
-        mj2.setRiskIndex("MJ2");
         mj2.setSelected(true);
         mj2.setAmount("");
         mj2.setUnitAmount("");
@@ -441,8 +414,6 @@ public class DaDiFuelVehicleInsurance {
         this.mj3 = new DaDiFuelKindInfo();
         mj3.setKindCode("C101364");
         mj3.setKindName("免赔率(司机)");
-        mj3.setKindFlag("MJ3");
-        mj3.setRiskIndex("MJ3");
         mj3.setSelected(true);
         mj3.setAmount("");
         mj3.setUnitAmount("");
@@ -461,8 +432,6 @@ public class DaDiFuelVehicleInsurance {
         this.mj4 = new DaDiFuelKindInfo();
         mj4.setKindCode("C101365");
         mj4.setKindName("免赔率(乘客)");
-        mj4.setKindFlag("MJ4");
-        mj4.setRiskIndex("MJ4");
         mj4.setSelected(true);
         mj4.setAmount("");
         mj4.setUnitAmount("");
@@ -481,8 +450,6 @@ public class DaDiFuelVehicleInsurance {
         this.syFjYbw4 = new DaDiFuelKindInfo();
         syFjYbw4.setKindCode("C101360");
         syFjYbw4.setKindName("精神损害抚慰金险(三者)");
-        syFjYbw4.setKindFlag("SY_FJ_YBW4");
-        syFjYbw4.setRiskIndex("SY_FJ_YBW4");
         syFjYbw4.setSelected(true);
         syFjYbw4.setAmount("10000");
         syFjYbw4.setUnitAmount("");
@@ -501,8 +468,6 @@ public class DaDiFuelVehicleInsurance {
         this.syFjYbw5 = new DaDiFuelKindInfo();
         syFjYbw5.setKindCode("C101381");
         syFjYbw5.setKindName("精神损害抚慰金险(乘客)");
-        syFjYbw5.setKindFlag("SY_FJ_YBW5");
-        syFjYbw5.setRiskIndex("SY_FJ_YBW5");
         syFjYbw5.setSelected(true);
         syFjYbw5.setAmount("40000");
         syFjYbw5.setUnitAmount("10000");
@@ -521,8 +486,6 @@ public class DaDiFuelVehicleInsurance {
         this.syFjYbw6 = new DaDiFuelKindInfo();
         syFjYbw6.setKindCode("C101380");
         syFjYbw6.setKindName("精神损害抚慰金险(司机)");
-        syFjYbw6.setKindFlag("SY_FJ_YBW6");
-        syFjYbw6.setRiskIndex("SY_FJ_YBW6");
         syFjYbw6.setSelected(true);
         syFjYbw6.setAmount("10000");
         syFjYbw6.setUnitAmount("");
@@ -538,4 +501,32 @@ public class DaDiFuelVehicleInsurance {
         syFjYbw6.setRate("");
     }
 
+    /**
+     * 将实体类转换为Map,key为险种标识,value为险种信息
+     */
+    public Map<String, DaDiFuelKindInfo> toMap() {
+        Map<String, DaDiFuelKindInfo> map = new LinkedHashMap<>();
+        map.put("A", this.a);
+        map.put("B", this.b);
+        map.put("D3", this.d3);
+        map.put("D4", this.d4);
+        map.put("L", this.l);
+        map.put("BD", this.bd);
+        map.put("SY_FJ_YBW1", this.syFjYbw1);
+        map.put("SY_FJ_YBW3", this.syFjYbw3);
+        map.put("SY_FJ_YBW2", this.syFjYbw2);
+        map.put("TY1", this.ty1);
+        map.put("TY2", this.ty2);
+        map.put("TY3", this.ty3);
+        map.put("TY4", this.ty4);
+        map.put("MJ1", this.mj1);
+        map.put("MJ2", this.mj2);
+        map.put("MJ3", this.mj3);
+        map.put("MJ4", this.mj4);
+        map.put("SY_FJ_YBW4", this.syFjYbw4);
+        map.put("SY_FJ_YBW5", this.syFjYbw5);
+        map.put("SY_FJ_YBW6", this.syFjYbw6);
+        return map;
+    }
+
 }

+ 30 - 0
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/constant/entity/DaDiNewEnergyVehicleInsurance.java

@@ -3,6 +3,9 @@ package com.jzg.quotation.dadi.crawler.constant.entity;
 import com.google.gson.annotations.SerializedName;
 import lombok.Data;
 
+import java.util.LinkedHashMap;
+import java.util.Map;
+
 /**
  * @author Liub
  * @version 1.0
@@ -563,4 +566,31 @@ public class DaDiNewEnergyVehicleInsurance {
         syFjYbw6.setRate("");
     }
 
+    /**
+     * 将实体类转换为Map,key为险种标识,value为险种信息
+     */
+    public Map<String, DaDiFuelKindInfo> toMap() {
+        Map<String, DaDiFuelKindInfo> map = new LinkedHashMap<>();
+        map.put("A", this.a);
+        map.put("B", this.b);
+        map.put("D3", this.d3);
+        map.put("D4", this.d4);
+        map.put("L", this.l);
+        map.put("BD", this.bd);
+        map.put("SY_FJ_YBW1", this.syFjYbw1);
+        map.put("SY_FJ_YBW3", this.syFjYbw3);
+        map.put("SY_FJ_YBW2", this.syFjYbw2);
+        map.put("TY1", this.ty1);
+        map.put("TY2", this.ty2);
+        map.put("TY3", this.ty3);
+        map.put("TY4", this.ty4);
+        map.put("MJ1", this.mj1);
+        map.put("MJ2", this.mj2);
+        map.put("MJ3", this.mj3);
+        map.put("MJ4", this.mj4);
+        map.put("SY_FJ_YBW4", this.syFjYbw4);
+        map.put("SY_FJ_YBW5", this.syFjYbw5);
+        map.put("SY_FJ_YBW6", this.syFjYbw6);
+        return map;
+    }
 }

+ 1 - 0
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/constant/enums/RequestUrl.java

@@ -20,6 +20,7 @@ public enum RequestUrl implements CrawlerRequestUrlStandard {
     GET_LOGIN_COM_INFO("/csv/commonAgent/searchAgentList", "获取代理人列表"),
     GET_AGENCY_AGREEMENT_INFO("/csv/channel/agentQuery", "获取代理协议信息"),
     QUERY_CAR_MODEL("/csv/vehicleModel/getCarModel", "车型查询"),
+    CHECK_CAR_MODEL("/csv/vehicleModel/checkCarModel", "验证车型"),
     GET_CAR_PRICE("/csv/vehicle/calculateActualValue", "车价查询"),
 
     GET_TEMPORARY_ORDER("/csv/vehicle/saveTemporaryOrder", "获取订单号"),

+ 212 - 24
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/request/DaDiInsurancePlanRequest.java

@@ -1,15 +1,20 @@
 package com.jzg.quotation.dadi.crawler.entity.request;
 
 import com.jzg.commons.entity.quote.vo.AccidentalDrivingVo;
+import com.jzg.commons.entity.quote.vo.KindInfoVo;
 import com.jzg.commons.entity.quote.vo.QuoteVo;
 import com.jzg.commons.entity.quote.vo.RiskInfoVo;
+import com.jzg.quotation.dadi.crawler.constant.entity.DaDiFuelKindInfo;
+import com.jzg.quotation.dadi.crawler.constant.entity.DaDiFuelVehicleInsurance;
+import com.jzg.quotation.dadi.crawler.constant.entity.DaDiNewEnergyVehicleInsurance;
+import com.jzg.quotation.dadi.crawler.entity.response.DaDiJointSalesResponse;
+import com.jzg.quotation.dadi.crawler.entity.response.DaDiSpecialInformationResponse;
 import com.jzg.quotation.dadi.crawler.entity.response.DaDiTaxConfigResponse;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
 
 /**
  * @author Liub
@@ -114,7 +119,7 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
     /**
      * 商业险险种列表
      */
-    private List<Object> businessRisks;
+    private List<DaDiFuelKindInfo> businessRisks;
 
     /**
      * 非浮动原因编码
@@ -254,17 +259,17 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
     /**
      * 意外险投保信息(可为空)
      */
-    private List<Object> accidentInsure;
+    private List<DaDiJointSalesResponse.AccidentInsuranceDTO> accidentInsure;
 
     /**
      * 健康险投保信息(可为空)
      */
-    private List<Object> healthInsure;
+    private List<DaDiJointSalesResponse.HealthInsuranceDTO> healthInsure;
 
     /**
      * 财产险投保信息(可为空)
      */
-    private List<Object> propertyInsure;
+    private List<DaDiJointSalesResponse.PropertyInsuranceDTO> propertyInsure;
 
     /**
      * 总保费
@@ -274,23 +279,28 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
     /**
      * 意外险方案
      */
-    private List<Object> accidentInsurance;
+    private List<DaDiJointSalesResponse.AccidentInsuranceDTO> accidentInsurance;
 
     /**
      * 健康险方案
      */
-    private List<Object> healthInsurance;
+    private List<DaDiJointSalesResponse.HealthInsuranceDTO> healthInsurance;
 
     /**
      * 财产险方案
      */
-    private List<Object> propertyInsurance;
+    private List<DaDiJointSalesResponse.PropertyInsuranceDTO> propertyInsurance;
 
     /**
      * 再保险项
      */
     private List<Object> reInsureItem;
 
+    /*
+     * 特约
+     */
+    private List<DaDiSpecialInformationResponse.EngagesDTO> engageList;
+
     /**
      * 车船税信息
      */
@@ -363,7 +373,12 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
         private String taxpayerNo;
     }
 
-    public DaDiInsurancePlanRequest(QuoteVo quoteVo, DaDiTaxConfigResponse taxConfig) {
+    public DaDiInsurancePlanRequest(QuoteVo quoteVo, DaDiTaxConfigResponse taxConfig,
+                                    DaDiVehicleModelRequest carModelRequest,
+                                    DaDiFuelVehicleInsurance daDiFuelVehicleInsurance,
+                                    DaDiNewEnergyVehicleInsurance daDiNewEnergyVehicleInsurance,
+                                    DaDiSpecialInformationResponse specialInformation,
+                                    DaDiJointSalesResponse jointSales) {
         // 基础字段
         this.quoteFlag = "1";
         this.planCode = "s";
@@ -384,7 +399,25 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
 
         // 商业险险种列表
         if (quoteVo.getKindInfoVo() != null && !quoteVo.getKindInfoVo().isEmpty()) {
-            this.businessRisks = new ArrayList<>(quoteVo.getKindInfoVo());
+            List<DaDiFuelKindInfo> daDiFuelKindInfo = new ArrayList<>();
+            String actualValue = carModelRequest.getActualValue();
+            String priceCoefficient = "1.0";
+            int seatCount = Integer.parseInt(carModelRequest.getSeatCount());
+
+            boolean isNewEnergy = "DEN".equals(carModelRequest.getSyriskCode());
+            Map<String, DaDiFuelKindInfo> insuranceMap = isNewEnergy
+                    ? daDiNewEnergyVehicleInsurance.toMap()
+                    : daDiFuelVehicleInsurance.toMap();
+
+            for (KindInfoVo kindInfoVo : quoteVo.getKindInfoVo()) {
+                String mKindCode = kindInfoVo.getKindCode();
+                DaDiFuelKindInfo target = insuranceMap.get(mKindCode);
+                if (target != null) {
+                    applyNewEnergySpecialProcessing(target, kindInfoVo, actualValue, priceCoefficient, seatCount);
+                    daDiFuelKindInfo.add(target);
+                }
+            }
+            this.businessRisks = daDiFuelKindInfo;
         }
 
         // 交强险信息
@@ -395,6 +428,16 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
             this.trafficEffectiveEndDate = ciRisk.getEndDate();
             this.trafficIsEffective = ciRisk.isInstantFlag() ? "1" : "0";
             this.trafficSumInsured = 200000;
+            if (ciRisk.getRiskCode().contains("B") || ciRisk.getRiskCode().contains("D3")) {
+                for (DaDiSpecialInformationResponse.EngagesDTO item : specialInformation.getBizEngages()) {
+                    if (item.getSpecialAgreementCode().equals("A00184")) {
+                        item.setSelected("1");
+                        item.setServiceItems(new ArrayList<>());
+                        item.setSpecialAgreementContent(item.getSpecialContent());
+                        this.engageList = Collections.singletonList(item);
+                    }
+                }
+            }
         } else {
             this.trafficChecked = "0";
             this.trafficIsEffective = "0";
@@ -412,19 +455,20 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
             }
 
             // 按产品分类拆分到意外险/健康险/财产险
-            List<Object> accidentList = new ArrayList<>();
-            List<Object> healthList = new ArrayList<>();
-            List<Object> propertyList = new ArrayList<>();
-
-            for (AccidentalDrivingVo item : accidentalDrivings) {
-                String categoryName = item.getProductCategoryName();
-                String categoryCode = item.getProductCategoryCode();
-                if (categoryName != null && categoryName.contains("意外")) {
-                    accidentList.add(item);
-                } else if (categoryName != null && categoryName.contains("健康")) {
-                    healthList.add(item);
-                } else {
-                    propertyList.add(item);
+            List<DaDiJointSalesResponse.AccidentInsuranceDTO> accidentList = new ArrayList<>();
+            List<DaDiJointSalesResponse.HealthInsuranceDTO> healthList = new ArrayList<>();
+            List<DaDiJointSalesResponse.PropertyInsuranceDTO> propertyList = new ArrayList<>();
+
+            for (Map.Entry<String, List<?>> stringListEntry : jointSales.toMap().entrySet()) {
+                switch (stringListEntry.getKey()) {
+                    case "accidentInsurance":
+                        accidentList.addAll((List<DaDiJointSalesResponse.AccidentInsuranceDTO>) stringListEntry.getValue());
+                        break;
+                    case "healthInsurance":
+                        healthList.addAll((List<DaDiJointSalesResponse.HealthInsuranceDTO>) stringListEntry.getValue());
+                        break;
+                    case "propertyInsurance":
+                        propertyList.addAll((List<DaDiJointSalesResponse.PropertyInsuranceDTO>) stringListEntry.getValue());
                 }
             }
 
@@ -442,6 +486,150 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
         }
     }
 
+    /**
+     * 新能源车险特殊处理:根据平台险种编码,将源KindInfoVo的字段映射到目标DaDiFuelKindInfo
+     */
+    private void applyNewEnergySpecialProcessing(DaDiFuelKindInfo target, KindInfoVo source,
+                                                 String actualValue, String priceCoefficient, int seatCount) {
+        String platformKindCode = source.getKindCode();
+
+        switch (platformKindCode) {
+            case "A":
+                // 车损险:保额 = 车辆真实价值 × 价格系数
+                double value = Double.parseDouble(actualValue) * Double.parseDouble(priceCoefficient);
+                target.setAmount(String.format("%.2f", value));
+                break;
+
+            case "B":
+                // 第三者责任保险:直接取保额
+                target.setAmount(source.getAmount());
+                break;
+
+            case "D3":
+                // 车上人员责任保险(司机):保额转整数
+                target.setAmount(String.valueOf(Integer.parseInt(source.getAmount())));
+                break;
+
+            case "D4":
+                // 车上人员责任保险(乘客):单人金额 × (座位数-1)
+                int d4UnitAmount = Integer.parseInt(source.getAmount());
+                int d4Quantity = seatCount - 1;
+                target.setUnitAmount(String.valueOf(d4UnitAmount));
+                target.setQuantity(String.valueOf(d4Quantity));
+                target.setAmount(String.valueOf(d4UnitAmount * d4Quantity));
+                break;
+
+            case "L":
+                // 附加车身划痕损失险:直接取保额
+                target.setAmount(source.getAmount());
+                break;
+
+            case "BD":
+                // 附加法定节假日限额翻倍险:无需额外处理
+                break;
+
+            case "SY_FJ_YBW1":
+                // 附加医保外医疗费用责任险(三者)
+                target.setAmount(source.getAmount());
+                break;
+
+            case "SY_FJ_YBW3":
+                // 附加医保外医疗费用责任险(司机)
+                target.setAmount(source.getAmount());
+                break;
+
+            case "SY_FJ_YBW2":
+                // 附加医保外医疗费用责任险(乘客):单人金额 × (座位数-1)
+                int ybw2UnitAmount = Integer.parseInt(source.getAmount());
+                int ybw2Quantity = seatCount - 1;
+                target.setUnitAmount(source.getAmount());
+                target.setQuantity(String.valueOf(ybw2Quantity));
+                target.setAmount(String.valueOf(ybw2UnitAmount * ybw2Quantity));
+                break;
+
+            case "TY1":
+                // 附加道路救援服务特约条款
+                target.setQuantity(String.valueOf(Integer.parseInt(source.getServiceTimes())));
+                break;
+
+            case "TY2":
+                // 附加车辆安全检测特约条款
+                target.setQuantity(String.valueOf(Integer.parseInt(source.getServiceTimes())));
+                break;
+
+            case "TY3":
+                // 附加代为驾驶服务特约条款
+                target.setQuantity(String.valueOf(Integer.parseInt(source.getServiceTimes())));
+                break;
+
+            case "TY4":
+                // 附加代为送检服务特约条款
+                target.setQuantity(String.valueOf(Integer.parseInt(source.getServiceTimes())));
+                break;
+
+            case "MJ1":
+                // 附加绝对免赔率特约条款(车损险)
+                setDeductibleRateFromSource(target, source);
+                break;
+
+            case "MJ2":
+                // 附加绝对免赔率特约条款(三者)
+                setDeductibleRateFromSource(target, source);
+                break;
+
+            case "MJ3":
+                // 附加绝对免赔率特约条款(司机)
+                setDeductibleRateFromSource(target, source);
+                break;
+
+            case "MJ4":
+                // 附加绝对免赔率特约条款(乘客)
+                setDeductibleRateFromSource(target, source);
+                break;
+
+            case "SY_WBDWGZ":
+                // 附加外部电网故障损失险
+                target.setAmount(source.getAmount());
+                break;
+
+            case "SY_FJ_YBW4":
+                // 精神损害抚慰金险(三者)
+                target.setAmount(source.getAmount());
+                break;
+
+            case "SY_FJ_YBW5":
+                // 精神损害抚慰金险(乘客):单人金额 × (座位数-1)
+                int ybw5UnitAmount = Integer.parseInt(source.getAmount());
+                int ybw5Quantity = seatCount - 1;
+                target.setUnitAmount(source.getAmount());
+                target.setQuantity(String.valueOf(ybw5Quantity));
+                target.setAmount(String.valueOf(ybw5UnitAmount * ybw5Quantity));
+                break;
+
+            case "SY_FJ_YBW6":
+                // 精神损害抚慰金险(司机)
+                target.setAmount(source.getAmount());
+                break;
+
+            default:
+                break;
+        }
+    }
+
+    /**
+     * 从源KindInfoVo中提取免赔率(百分比格式如"5%"),转为小数(如0.05)设置到目标
+     */
+    private void setDeductibleRateFromSource(DaDiFuelKindInfo target, KindInfoVo source) {
+        String deductibleRate = source.getDeductibleRate();
+        if (deductibleRate != null && !deductibleRate.isEmpty()) {
+            String digits = deductibleRate.replaceAll("\\D+", "");
+            if (!digits.isEmpty()) {
+                double rate = Double.parseDouble(digits) / 100.0;
+                target.setDeductibleRate(String.valueOf(rate));
+            }
+        }
+    }
+
     @NotNull
     private static Tax getTax(QuoteVo quoteVo, DaDiTaxConfigResponse taxConfig) {
         Tax tax = new Tax();

+ 13 - 13
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/request/DaDiVehiclePricRequest.java

@@ -5,7 +5,6 @@ import com.jzg.quotation.dadi.crawler.entity.response.DaDiVehicleChannelInfoResp
 import com.jzg.quotation.dadi.utils.DaDiVehicleUtils;
 import lombok.Data;
 import lombok.NoArgsConstructor;
-import org.springframework.util.StringUtils;
 
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
@@ -95,6 +94,7 @@ public class DaDiVehiclePricRequest extends DaDiBaseRequest {
      */
     private String gasType;
 
+
     public DaDiVehiclePricRequest(CarInfoVo carInfo, DaDiVehicleChannelRequest daDiVehicleChannelRequest, DaDiVehicleChannelInfoResponse.CarModel vehicleModelVO) {
 
         // === 日期信息 ===
@@ -106,9 +106,10 @@ public class DaDiVehiclePricRequest extends DaDiBaseRequest {
         setFirstyearDate("");
 
         // === 车辆配置 ===
-        setPurchasePrice(vehicleModelVO.getPurchasePrice());
-        setSeatCount(carInfo.getSeatCount());
-        setTonCount(carInfo.getTonCount());
+        DaDiVehicleChannelInfoResponse.VehicleJingyou vehicleJingyou = vehicleModelVO.getVehicleJingyou();
+        setPurchasePrice(Double.parseDouble(vehicleJingyou.getPurchasePrice()));
+        setSeatCount(vehicleJingyou.getSeat());
+        setTonCount(vehicleJingyou.getTonnage());
 
         // === 使用与分类 ===
         setUseNatureCode(DaDiVehicleUtils.getCarNatureCode(carInfo));
@@ -118,19 +119,18 @@ public class DaDiVehiclePricRequest extends DaDiBaseRequest {
         setChgOwnerFlag(DaDiVehicleUtils.getTransferInfo(carInfo)[0]);
 
         // === 车辆品牌与进/国产 ===
-        setBrandName(carInfo.getBrandName());
-        String importFlag = "0";
-        if (vehicleModelVO != null) {
-            String modelImportFlag = vehicleModelVO.getImportFlag();
-            if (StringUtils.hasLength(modelImportFlag)) {
-                importFlag = modelImportFlag;
-            }
-        }
-        setImportFlag(importFlag);
+        setBrandName(vehicleJingyou.getBrandName());
+        setImportFlag(DaDiVehicleUtils.getImportFlag(vehicleModelVO.getImportFlag()));
 
         // === 用户与公司代码(继承自DaDiBaseRequest) ===
         setUserCode(daDiVehicleChannelRequest.getUserCode());
         setComCode(daDiVehicleChannelRequest.getComCode());
 
+        if (DaDiVehicleUtils.getCarSyriskCode(carInfo)[2].equals("DEN")) {
+            setProductCode("DEN");
+            setRegionCode("140000");
+            setGasType(vehicleJingyou.getPowerTypeCode());
+        }
+
     }
 }

+ 19 - 0
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/response/DaDiJointSalesResponse.java

@@ -4,7 +4,9 @@ import com.google.gson.annotations.SerializedName;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author Liub
@@ -469,4 +471,21 @@ public class DaDiJointSalesResponse extends DaDiBaseResponse{
             }
         }
     }
+
+    /**
+     * 将险种列表转换为Map,key为险种类型标识,value为对应的险种列表
+     */
+    public Map<String, List<?>> toMap() {
+        Map<String, List<?>> map = new LinkedHashMap<>();
+        if (accidentInsurance != null) {
+            map.put("accidentInsurance", accidentInsurance);
+        }
+        if (healthInsurance != null) {
+            map.put("healthInsurance", healthInsurance);
+        }
+        if (propertyInsurance != null) {
+            map.put("propertyInsurance", propertyInsurance);
+        }
+        return map;
+    }
 }

+ 4 - 0
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/response/DaDiQuoteResponse.java

@@ -92,6 +92,10 @@ public class DaDiQuoteResponse extends DaDiBaseResponse {
         private String trafficEffectiveStartDate;
         @SerializedName("trafficEffectiveEndDate")
         private String trafficEffectiveEndDate;
+        @SerializedName("businessEffectiveStartDate")
+        private String businessEffectiveStartDate;
+        @SerializedName("businessEffectiveEndDate")
+        private String businessEffectiveEndDate;
         @SerializedName("trafficIsEffective")
         private String trafficIsEffective;
         @SerializedName("trafficSumInsured")

+ 7 - 39
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/response/DaDiSpecialInformationResponse.java

@@ -19,7 +19,7 @@ public class DaDiSpecialInformationResponse extends DaDiBaseResponse{
     @SerializedName("engages")
     private List<EngagesDTO> engages;
     @SerializedName("bizEngages")
-    private List<BizEngagesDTO> bizEngages;
+    private List<EngagesDTO> bizEngages;
 
     @NoArgsConstructor
     @Data
@@ -48,44 +48,12 @@ public class DaDiSpecialInformationResponse extends DaDiBaseResponse{
         private List<ServiceTypesDTO> serviceTypes;
         @SerializedName("specialContent")
         private String specialContent;
-
-        @NoArgsConstructor
-        @Data
-        public static class ServiceTypesDTO {
-            @SerializedName("comCode")
-            private String comCode;
-            @SerializedName("serviceItems")
-            private List<Object> serviceItems;
-        }
-    }
-
-    @NoArgsConstructor
-    @Data
-    public static class BizEngagesDTO {
-        @SerializedName("id")
-        private int id;
-        @SerializedName("specialAgreementCode")
-        private String specialAgreementCode;
-        @SerializedName("specialAgreementName")
-        private String specialAgreementName;
-        @SerializedName("comCode")
-        private String comCode;
-        @SerializedName("specialContent")
-        private String specialContent;
-        @SerializedName("validStatus")
-        private String validStatus;
-        @SerializedName("modifyFlag")
-        private String modifyFlag;
-        @SerializedName("productCode")
-        private String productCode;
-        @SerializedName("type")
-        private String type;
-        @SerializedName("createTime")
-        private String createTime;
-        @SerializedName("updateTime")
-        private String updateTime;
-        @SerializedName("serviceTypes")
-        private List<ServiceTypesDTO> serviceTypes;
+        @SerializedName("selected")
+        private String selected;
+        @SerializedName("serviceItems")
+        private List<Object> serviceItems;
+        @SerializedName("specialAgreementContent")
+        private String specialAgreementContent;
 
         @NoArgsConstructor
         @Data

+ 57 - 0
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/response/DaDiVehicleCheckInfoResponse.java

@@ -0,0 +1,57 @@
+package com.jzg.quotation.dadi.crawler.entity.response;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * @author Liub
+ * @version 1.0
+ * @description: 【】
+ * @date 2026/5/30 11:07
+ */
+@NoArgsConstructor
+@Data
+public class DaDiVehicleCheckInfoResponse extends DaDiBaseResponse{
+
+
+    @SerializedName("sameFlag")
+    private String sameFlag;
+    @SerializedName("carModelBaseVO")
+    private CarModelBaseVODTO carModelBaseVO;
+    @SerializedName("carModelList")
+    private List<CarModelListDTO> carModelList;
+
+    @NoArgsConstructor
+    @Data
+    public static class CarModelBaseVODTO {
+    }
+
+    @NoArgsConstructor
+    @Data
+    public static class CarModelListDTO {
+        @SerializedName("vehicleBrand")
+        private String vehicleBrand;
+        @SerializedName("modelCode")
+        private String modelCode;
+        @SerializedName("modelName")
+        private String modelName;
+        @SerializedName("brandCode")
+        private String brandCode;
+        @SerializedName("brandName")
+        private String brandName;
+        @SerializedName("industryVehicleCode")
+        private String industryVehicleCode;
+        @SerializedName("derailleurType")
+        private String derailleurType;
+        @SerializedName("familyName")
+        private String familyName;
+
+        /** 车辆精油(精友)信息 */
+        @SerializedName("vehicleJingyou")
+        private DaDiVehicleChannelInfoResponse.VehicleJingyou vehicleJingyou;
+
+    }
+}

+ 0 - 1
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/service/impl/DaDiCrawlerRequestImpl.java

@@ -105,7 +105,6 @@ public class DaDiCrawlerRequestImpl implements DaDiCrawlerRequest {
             daDiCrawlerOrderService.save(daDiCrawlerOrder);
         }
 
-
         return DaDiCrawlerQuoteResultVoBuild.build(quoteVo, daDiQuoteResponse);
     }
 

+ 1 - 2
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/utils/DaDiAESUtils.java

@@ -57,9 +57,8 @@ public class DaDiAESUtils {
     public static String decryptStr(String input) throws Exception {
         byte[] decode = Base64.getDecoder().decode(input);
         byte[] decryptedBytes = decrypt(decode, key.getBytes());
-        Gson gson = new GsonBuilder().setPrettyPrinting().create();
         String json = new String(decryptedBytes, CharsetKit.UTF_8);
-        return "\n" + gson.toJson(JsonParser.parseString(json)) + "\n";
+        return GsonUtils.formatJson(json);
     }
 
     /**

+ 2 - 2
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/utils/DaDiVehicleUtils.java

@@ -177,9 +177,9 @@ public class DaDiVehicleUtils {
         String licenseType = "02";
         String syriskCode = "DEJ";
         if (carInfo.isNewEnergyMark()) {
-            syriskCode = "DEN";
-            licenseType = "06";
             licenseColorCode = "52";
+            licenseType = "06";
+            syriskCode = "DEN";
         }
         return new String[]{licenseColorCode, licenseType, syriskCode};
     }

+ 129 - 0
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/utils/GsonUtils.java

@@ -0,0 +1,129 @@
+package com.jzg.quotation.dadi.utils;
+
+import com.alibaba.excel.support.cglib.beans.BeanMap;
+import com.alibaba.excel.util.StringUtils;
+import com.alibaba.fastjson.JSONArray;
+import com.google.common.collect.Maps;
+import com.google.gson.*;
+import com.google.gson.reflect.TypeToken;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * @author Liub
+ * @version 1.0
+ * @description:  Gson工具类
+ * @date 2026/5/29 17:50
+ */
+public class GsonUtils {
+    /**
+     * 单位缩进字符串。
+     */
+    private static final String SPACE = "   ";
+
+    private static final Gson gson = new GsonBuilder().create();
+
+    public static String toJson(Object value) {
+        return gson.toJson(value);
+    }
+
+    /**
+     * 转成bean
+     */
+    public static <T> T stringToBean (String gsonString, Class<T> cls) {
+        T t = null;
+        if (gson != null) {
+            t = gson.fromJson(gsonString, cls);
+        }
+        return t;
+    }
+
+
+    @SuppressWarnings("unchecked")
+    public static <T> T fromJson(String json, Type typeOfT) throws JsonParseException {
+        return gson.fromJson(json, typeOfT);
+    }
+
+    /**
+     * 转成list
+     */
+    public static <T> ArrayList<T> fromJsonList(String gsonString, Class<T> cls) {
+        ArrayList<T> list = new ArrayList<>();
+        if (gson != null) {
+            JsonArray array = new JsonParser().parse(gsonString).getAsJsonArray();
+            for (final JsonElement elem : array) {
+                list.add(gson.fromJson(elem, cls));
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 转成list, 有可能造成类型擦除
+     */
+    public static <T> ArrayList<T> fromJsonList(String gsonString) {
+        ArrayList<T> list = null;
+        if (gson != null) {
+            list = gson.fromJson(gsonString, new TypeToken<ArrayList<T>>() {
+            }.getType());
+        }
+        return list;
+    }
+
+    /**
+     * 返回格式化JSON字符串。
+     *
+     * @param json 未格式化的JSON字符串。
+     * @return 格式化的JSON字符串。
+     */
+    public static String formatJson(String json) {
+        Gson gson = new GsonBuilder().setPrettyPrinting().create();
+        return "\n" + gson.toJson(JsonParser.parseString(json)) + "\n";
+    }
+
+    /**
+     * 返回指定次数的缩进字符串。每一次缩进三个空格,即SPACE。
+     *
+     * @param number 缩进次数。
+     * @return 指定缩进次数的字符串。
+     */
+    private static String indent(int number) {
+        StringBuffer result = new StringBuffer();
+        for (int i = 0; i < number; i++) {
+            result.append(SPACE);
+        }
+        return result.toString();
+    }
+
+    public static String toJSONString2(Object obj) {
+        JSONArray jsonObj = (JSONArray) JSONArray.toJSON(obj);
+        return jsonObj.toJSONString();
+    }
+
+    /**
+     * javaBean转map(空字段给默认值:空字符串)
+     *
+     * @param bean 待转换的bean对象
+     * @return Map<String, String> 转换后的Map,无null值
+     */
+    public static <T> Map<String, Object> objToStringMapWithDefault(T bean) {
+        Map<String, Object> map = Maps.newHashMap();
+        if (Objects.nonNull(bean)) {
+            BeanMap beanMap = BeanMap.create(bean);
+            for (Object key : beanMap.keySet()) {
+                Object tmp = beanMap.get(key);
+                if (Objects.nonNull(tmp)) {
+                    map.put(key.toString(), tmp);
+                } else {
+                    // null值字段填充为空字符串
+                    map.put(key.toString(), new Object());
+                }
+            }
+        }
+        return map;
+    }
+
+}