785834757 2 лет назад
Родитель
Сommit
34c33967c0
100 измененных файлов с 4140 добавлено и 47 удалено
  1. 26 0
      src/main/java/com/ydtech/components/OrderComponents.java
  2. 8 0
      src/main/java/com/ydtech/config/SwaggerConfig.java
  3. 3 0
      src/main/java/com/ydtech/modules/fee/service/FeeRuleSchemeNewService.java
  4. 440 0
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java
  5. 3 0
      src/main/java/com/ydtech/modules/ins/model/vo/KindInfoVo.java
  6. 2 0
      src/main/java/com/ydtech/modules/ins/model/vo/QuoteKindRespVo.java
  7. 3 5
      src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java
  8. 29 2
      src/main/java/com/ydtech/modules/order/components/InsOrdersComponents.java
  9. 1 1
      src/main/java/com/ydtech/modules/order/controller/BoHaiOrderApiController.java
  10. 1 1
      src/main/java/com/ydtech/modules/order/controller/DaJiaOrderController.java
  11. 1 1
      src/main/java/com/ydtech/modules/order/controller/DrivingInsuranceController.java
  12. 1 1
      src/main/java/com/ydtech/modules/order/controller/ExternalOrderController.java
  13. 7 0
      src/main/java/com/ydtech/modules/order/controller/GuoRenOrderApiController.java
  14. 1 1
      src/main/java/com/ydtech/modules/order/controller/HuaTaiOrderApiController.java
  15. 1 1
      src/main/java/com/ydtech/modules/order/controller/InsCrawlerOrderController.java
  16. 17 1
      src/main/java/com/ydtech/modules/order/controller/InsOrdersController.java
  17. 1 1
      src/main/java/com/ydtech/modules/order/controller/PingAnOrderApiController.java
  18. 244 0
      src/main/java/com/ydtech/modules/order/controller/QuoteController.java
  19. 1 1
      src/main/java/com/ydtech/modules/order/controller/YongAnOrderApiController.java
  20. 1 1
      src/main/java/com/ydtech/modules/order/controller/ZhongMeiOrderApiController.java
  21. 1 1
      src/main/java/com/ydtech/modules/order/controller/ZhongMeiOrderController.java
  22. 1 1
      src/main/java/com/ydtech/modules/order/controller/ZijinOrderApiController.java
  23. 17 0
      src/main/java/com/ydtech/modules/order/dao/InsBusinessInsuranceMapper.java
  24. 18 0
      src/main/java/com/ydtech/modules/order/dao/InsDrivingIntentionInsuranceMapper.java
  25. 12 0
      src/main/java/com/ydtech/modules/order/dao/InsDrivingIntentionInsuranceTypeCompanyMapper.java
  26. 17 0
      src/main/java/com/ydtech/modules/order/dao/InsDrivingIntentionInsuranceTypeMapper.java
  27. 99 0
      src/main/java/com/ydtech/modules/order/entity/InsBusinessInsurance.java
  28. 37 0
      src/main/java/com/ydtech/modules/order/entity/InsBusinessInsuranceOption.java
  29. 30 1
      src/main/java/com/ydtech/modules/order/entity/InsDrivingIntentionInsurance.java
  30. 68 0
      src/main/java/com/ydtech/modules/order/entity/InsDrivingIntentionInsuranceType.java
  31. 54 0
      src/main/java/com/ydtech/modules/order/entity/InsDrivingIntentionInsuranceTypeCompany.java
  32. 19 4
      src/main/java/com/ydtech/modules/order/entity/InsOrders.java
  33. 6 0
      src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteInfoVo.java
  34. 14 0
      src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteVo.java
  35. 1 0
      src/main/java/com/ydtech/modules/order/entity/vo/FeeOrderNewVo.java
  36. 38 0
      src/main/java/com/ydtech/modules/order/entity/vo/InsDrivingIntentionInsuranceSonVo.java
  37. 2 2
      src/main/java/com/ydtech/modules/order/entity/vo/InsDrivingIntentionInsuranceVo.java
  38. 9 0
      src/main/java/com/ydtech/modules/order/entity/vo/InsOrdersEditingVo.java
  39. 3 0
      src/main/java/com/ydtech/modules/order/entity/vo/OrderVo.java
  40. 7 0
      src/main/java/com/ydtech/modules/order/service/GuorenOrderApiService.java
  41. 24 0
      src/main/java/com/ydtech/modules/order/service/InsBusinessInsuranceService.java
  42. 22 0
      src/main/java/com/ydtech/modules/order/service/InsDrivingIntentionInsuranceService.java
  43. 12 0
      src/main/java/com/ydtech/modules/order/service/InsDrivingIntentionInsuranceTypeCompanyService.java
  44. 20 0
      src/main/java/com/ydtech/modules/order/service/InsDrivingIntentionInsuranceTypeService.java
  45. 5 0
      src/main/java/com/ydtech/modules/order/service/InsOrdersService.java
  46. 41 1
      src/main/java/com/ydtech/modules/order/service/impl/GuorenOrderApiServiceImpl.java
  47. 46 0
      src/main/java/com/ydtech/modules/order/service/impl/InsBusinessInsuranceServiceImpl.java
  48. 6 2
      src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java
  49. 145 11
      src/main/java/com/ydtech/modules/order/service/impl/InsDrivingIntentionInsuranceServiceImpl.java
  50. 19 0
      src/main/java/com/ydtech/modules/order/service/impl/InsDrivingIntentionInsuranceTypeCompanyServiceImpl.java
  51. 118 0
      src/main/java/com/ydtech/modules/order/service/impl/InsDrivingIntentionInsuranceTypeServiceImpl.java
  52. 187 3
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  53. 1 1
      src/main/java/com/ydtech/modules/order/service/impl/YongchengOrderApiServiceImpl.java
  54. 2 1
      src/main/java/com/ydtech/modules/protocol/constants/DispatchTypeConstants.java
  55. 7 0
      src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementInsCompanyDto.java
  56. 8 1
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceServiceImpl.java
  57. 0 1
      src/main/java/com/ydtech/modules/protocols/controller/PtlNewAgreementController.java
  58. 453 0
      src/main/java/com/ydtech/modules/scheme/controller/PtlSchemeController.java
  59. 19 0
      src/main/java/com/ydtech/modules/scheme/dao/PtlOptionalSchemeInsuranceDrivingIntentionMapper.java
  60. 31 0
      src/main/java/com/ydtech/modules/scheme/dao/PtlOptionalSchemeInsuranceMapper.java
  61. 26 0
      src/main/java/com/ydtech/modules/scheme/dao/PtlOptionalSchemeMapper.java
  62. 23 0
      src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeInsuranceDrivingIntentionMapper.java
  63. 46 0
      src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeInsuranceMapper.java
  64. 55 0
      src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeMapper.java
  65. 24 0
      src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeRulesAttrLinkMapper.java
  66. 19 0
      src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeRulesAttrMapper.java
  67. 24 0
      src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeRulesMapper.java
  68. 65 0
      src/main/java/com/ydtech/modules/scheme/entity/po/PtlOptionalScheme.java
  69. 16 0
      src/main/java/com/ydtech/modules/scheme/entity/po/PtlOptionalSchemeInsurance.java
  70. 16 0
      src/main/java/com/ydtech/modules/scheme/entity/po/PtlOptionalSchemeInsuranceDrivingIntention.java
  71. 69 0
      src/main/java/com/ydtech/modules/scheme/entity/po/PtlScheme.java
  72. 54 0
      src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeInsurance.java
  73. 57 0
      src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeInsuranceDrivingIntention.java
  74. 63 0
      src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeRules.java
  75. 68 0
      src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeRulesAttr.java
  76. 86 0
      src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeRulesAttrLink.java
  77. 16 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/AgreementVo.java
  78. 22 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/CompanyAgreementVo.java
  79. 30 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/CompanyOptionalSchemeVo.java
  80. 40 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/CompanySchemeVo.java
  81. 16 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/DrivingIntentionInsuranceReusltVo.java
  82. 38 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/DrivingIntentionQueryVo.java
  83. 137 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/OptionalSchemeSaveVo.java
  84. 28 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/PcCompanySchemeVo.java
  85. 16 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/PcSchemeResultVo.java
  86. 29 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/RuleFilterVo.java
  87. 24 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/RuleQueryVo.java
  88. 50 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/RuleResultVo.java
  89. 18 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/RuleSaveVo.java
  90. 54 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/RuleUndwrtAttrVo.java
  91. 32 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeKindInfoVo.java
  92. 29 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeQueryVo.java
  93. 32 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeResultVo.java
  94. 128 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeRuleAttrMappingVo.java
  95. 24 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeRuleResultVo.java
  96. 135 0
      src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeSaveVo.java
  97. 14 0
      src/main/java/com/ydtech/modules/scheme/service/PtlOptionalSchemeInsuranceDrivingIntentionService.java
  98. 24 0
      src/main/java/com/ydtech/modules/scheme/service/PtlOptionalSchemeInsuranceService.java
  99. 65 0
      src/main/java/com/ydtech/modules/scheme/service/PtlOptionalSchemeService.java
  100. 18 0
      src/main/java/com/ydtech/modules/scheme/service/PtlSchemeInsuranceDrivingIntentionService.java

+ 26 - 0
src/main/java/com/ydtech/components/OrderComponents.java

@@ -310,6 +310,32 @@ public class OrderComponents {
 
     }
 
+
+    public void checkEmptyApp(YaQuoteInfoVo yaQuoteInfoVo) {
+        if (yaQuoteInfoVo.getCarInfo() == null) {
+            throw new SystemException("车辆信息 不能为空!");
+        }
+
+        if (yaQuoteInfoVo.getPolicyHolderInfo() == null || yaQuoteInfoVo.getInsuredPersonInfo() == null) {
+            throw new SystemException("被保人信息 / 被保人信息 不能为空!");
+        }
+
+        if (StringUtils.isEmpty(yaQuoteInfoVo.getCarInfo().getFrameNo())) {
+            throw new SystemException("车架号不能为空");
+        }
+
+        if (yaQuoteInfoVo.getRiskList() == null || yaQuoteInfoVo.getRiskList().isEmpty()) {
+            throw new SystemException("投保信息 不能为空!");
+        }
+
+        CarInfoVo carInfo = yaQuoteInfoVo.getCarInfo();
+        if (VehicleType.VT_A1.getCode().equals(carInfo.getCimodelclass())) {
+            String limitLoad = carInfo.getLimitLoad();
+            AssertionUtils.isFail(StringUtils.isEmpty(limitLoad), "车辆种类为货车时,核定载质量必传");
+        }
+
+    }
+
 //    /**
 //     * 生成订单信息
 //     *

+ 8 - 0
src/main/java/com/ydtech/config/SwaggerConfig.java

@@ -100,6 +100,7 @@ public class SwaggerConfig {
 
 
 
+
     @Bean(value = "largescreenApi")
     @Order(value = 11)
     public Docket largescreenApi() {
@@ -113,6 +114,13 @@ public class SwaggerConfig {
         return buildDocket("message", "消息接口");
     }
 
+    @Bean(value = "schemeApi")
+    @Order(value = 13)
+    public Docket schemeApi() {
+        return buildDocket("scheme", "方案");
+    }
+
+
     private ApiInfo apiInfo() {
         return new ApiInfoBuilder()
                 .title("晋掌柜 API 文档")

+ 3 - 0
src/main/java/com/ydtech/modules/fee/service/FeeRuleSchemeNewService.java

@@ -106,6 +106,9 @@ public interface FeeRuleSchemeNewService {
      */
     void calcCostsExternal(PtlAgreementProductCostsNew costsNew, InsAreaCompany insAreaCompany);
 
+
+    void calcCostsExternalTest(PtlAgreementProductCostsNew costsNew, InsAreaCompany insAreaCompany);
+
     /**
      * 电销计算费用
      *

+ 440 - 0
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -1521,6 +1521,446 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
         insFeeOrderNewService.saveOrUpdate(insFeeOrderNew);
     }
 
+
+    @Override
+    public void calcCostsExternalTest(PtlAgreementProductCostsNew ptlAgreementProductCostsNew, InsAreaCompany insAreaCompany) {
+        //获取协议信息
+        // 外部订单比例
+        PtlAgreement ptlAgreement = ptlAgreementService.getById(insAreaCompany.getAgreementId());
+        InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
+        SysUser sysUser = sysUserService.findByUserId(insOrders.getUserid());
+        BigDecimal enterProportion = sysSwitchConfigService.getEnterProportion(insOrders.getDeptid(), insOrders.getEntryStatus());
+
+        BigDecimal taxRadio = new BigDecimal("1.00");
+        //如果是外部订单则 不含税
+        if (ptlAgreement.getWithTax().equals("否")) {
+            taxRadio = new BigDecimal("1.06");
+        }
+        //税比例 固定1.06
+        //查找入口与出口费用比例
+
+        //出口配置
+        PtlAgreementProductCostsExport ptlAgreementProductCostsExport =
+                ptlAgreementProductCostsExportService.getOne(new LambdaQueryWrapper<PtlAgreementProductCostsExport>().eq(PtlAgreementProductCostsExport::getCostsId, ptlAgreementProductCostsNew.getId()));
+        InsFeeOrderNew insFeeOrderNew = new InsFeeOrderNew();
+        insFeeOrderNew.setId(IdGenerate.nextId());
+        insFeeOrderNew.setCostsId(ptlAgreementProductCostsNew.getId());
+        insFeeOrderNew.setAgreementId(insAreaCompany.getAgreementId());
+
+        //存储部门id与用户id
+        InsOrders order = insOrdersService.getById(insAreaCompany.getOrderno());
+        InsFeeOrderNew insFeeOrderNewByCompanyId = insFeeOrderNewService.getInsFeeOrderNewByCompanyId(insAreaCompany.getId());
+        if (insFeeOrderNewByCompanyId != null) {
+            insFeeOrderNew.setId(insFeeOrderNewByCompanyId.getId());
+        }
+        insFeeOrderNew.setDeptId(order.getDeptid());
+        insFeeOrderNew.setUserId(order.getUserid());
+        insFeeOrderNew.setInsOrderNo(insAreaCompany.getId());
+        insFeeOrderNew.setJqPremium(insAreaCompany.getJqpremium());
+        insFeeOrderNew.setSyPremium(insAreaCompany.getSypremium());
+        insFeeOrderNew.setNoPremium(insAreaCompany.getJypremium());
+        //不含税
+        BigDecimal bigDecimal = new BigDecimal("1.06");
+        insFeeOrderNew.setJqNoTaxPremium(insAreaCompany.getJqpremium().divide(bigDecimal, 2));
+        insFeeOrderNew.setSyNoTaxPremium(insAreaCompany.getSypremium().divide(bigDecimal, 2));
+        insFeeOrderNew.setNoNoTaxPremium(insAreaCompany.getJypremium().divide(bigDecimal, 2));
+
+        //region 计算入口费用
+
+        //交强入口信息
+        FeeOrderNewVo.EntranceFee jqEntranceFee = feeRuleSchemeService.calcEntranceFee(insFeeOrderNew.getJqPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getJqCarCostsProportion()),
+                new BigDecimal(ptlAgreementProductCostsNew.getJqCarOtherCostsProportion()), taxRadio);
+        insFeeOrderNew.setJqCostsProportion(jqEntranceFee.getTotalProportion());
+        insFeeOrderNew.setJqSuperviseCostsProportion(jqEntranceFee.getSuperviseCosts());
+        insFeeOrderNew.setJqSuperviseCostsPremiums(jqEntranceFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setJqOtherCostsProportion(jqEntranceFee.getOtherCostsProportion());
+        insFeeOrderNew.setJqOtherCostsPremiums(jqEntranceFee.getOtherCostsPremiums());
+        insFeeOrderNew.setJqCostsPremiums(insFeeOrderNew.getJqSuperviseCostsPremiums().add(insFeeOrderNew.getJqOtherCostsPremiums()));
+
+        //商业入口信息
+        FeeOrderNewVo.EntranceFee syEntranceFee = feeRuleSchemeService.calcEntranceFee(insFeeOrderNew.getSyPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getSyCarCostsProportion()),
+                new BigDecimal(ptlAgreementProductCostsNew.getSyCarOtherCostsProportion()), taxRadio);
+        insFeeOrderNew.setSyCostsProportion(syEntranceFee.getTotalProportion());
+        insFeeOrderNew.setSySuperviseCostsProportion(syEntranceFee.getSuperviseCosts());
+        insFeeOrderNew.setSySuperviseCostsPremiums(syEntranceFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setSyOtherCostsProportion(syEntranceFee.getOtherCostsProportion());
+        insFeeOrderNew.setSyOtherCostsPremiums(syEntranceFee.getOtherCostsPremiums());
+        insFeeOrderNew.setSyCostsPremiums(insFeeOrderNew.getSySuperviseCostsPremiums().add(insFeeOrderNew.getSyOtherCostsPremiums()));
+
+        //非车入口信息
+        FeeOrderNewVo.EntranceFee noEntranceFee = feeRuleSchemeService.calcEntranceFee(insFeeOrderNew.getNoPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getNoCarCostsProportion()),
+                new BigDecimal(ptlAgreementProductCostsNew.getNoCarOtherCostsProportion()), taxRadio);
+        insFeeOrderNew.setNoCostsProportion(noEntranceFee.getTotalProportion());
+        insFeeOrderNew.setNoSuperviseCostsProportion(noEntranceFee.getSuperviseCosts());
+        insFeeOrderNew.setNoSuperviseCostsPremiums(noEntranceFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setNoOtherCostsProportion(noEntranceFee.getOtherCostsProportion());
+        insFeeOrderNew.setNoOtherCostsPremiums(noEntranceFee.getOtherCostsPremiums());
+        insFeeOrderNew.setNoCostsPremiums(insFeeOrderNew.getNoSuperviseCostsPremiums().add(insFeeOrderNew.getNoOtherCostsPremiums()));
+        //endregion
+
+
+        //region 重新计算管理费比例和分销比例
+
+        List<EsmRetail> esmRetailList = esmRetailService.selectList(" where t.deptid=? and t.status = '1' ",
+                new Object[]{sysUser.getDeptId()});
+
+        Integer retailLevel = 0;
+
+        //默认分销比例设置
+        RetailProportion retailProportion = new RetailProportion();
+        if (!Objects.isNull(esmRetailList) && !esmRetailList.isEmpty()) {
+            retailLevel = Integer.parseInt(esmRetailList.get(0).getRetailtype());
+            //赋值默认的分销比例
+            retailProportion.setProportion(esmRetailList.get(0).getDisrate1(), esmRetailList.get(0).getDisrate2(), esmRetailList.get(0).getDisrate3());
+        }
+
+
+        //获取交强机构管理费总比例
+        BigDecimal jqDeptProportion = ptlAgreementProductCostsExport.getJqExportRadioLevel1()
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel2())
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel3())
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel4())
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel5());
+        //获取商业机构管理费总比例
+        BigDecimal syDeptProportion = ptlAgreementProductCostsExport.getSyExportRadioLevel1()
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel2())
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel3())
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel4())
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel5());
+        //获取非车机构管理费总比例
+        BigDecimal noDeptProportion = ptlAgreementProductCostsExport.getNoCarExportRadioLevel1()
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel2())
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel3())
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel4())
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel5());
+
+        //获取交强分销总比例
+        BigDecimal jqRetailProportion = retailProportion.getJqRetailLevel1Proportion()
+                .add(retailProportion.getJqRetailLevel2Proportion())
+                .add(retailProportion.getJqRetailLevel3Proportion());
+
+        //获取商业分销总比例
+        BigDecimal syRetailProportion = retailProportion.getSyRetailLevel1Proportion()
+                .add(retailProportion.getSyRetailLevel2Proportion())
+                .add(retailProportion.getSyRetailLevel3Proportion());
+
+        //获取非车分销总比例
+        BigDecimal noRetailProportion = retailProportion.getNoRetailLevel1Proportion()
+                .add(retailProportion.getNoRetailLevel2Proportion())
+                .add(retailProportion.getNoRetailLevel3Proportion());
+
+        //重新计算比例  入口是否超出支付的比例
+        ReCalcuLateProportion jqReCalcuLateProportion = recalculateProportion(
+                new BigDecimal(ptlAgreementProductCostsNew.getJqCostsProportion()),
+                jqDeptProportion,
+                jqRetailProportion,
+                taxRadio,
+                retailLevel,
+                ptlAgreementProductCostsExport,
+                retailProportion,
+                "jq",
+                enterProportion
+        );
+
+        ReCalcuLateProportion syReCalcuLateProportion = recalculateProportion(
+                new BigDecimal(ptlAgreementProductCostsNew.getSyCostsProportion()),
+                syDeptProportion,
+                syRetailProportion,
+                taxRadio,
+                retailLevel,
+                ptlAgreementProductCostsExport,
+                retailProportion,
+                "sy",
+                enterProportion
+        );
+
+        ReCalcuLateProportion noReCalcuLateProportion = recalculateProportion(
+                new BigDecimal(ptlAgreementProductCostsNew.getNoCostsProportion()),
+                noDeptProportion,
+                noRetailProportion,
+                taxRadio,
+                retailLevel,
+                ptlAgreementProductCostsExport,
+                retailProportion,
+                "no",
+                enterProportion
+        );
+
+        retailProportion.setProportion(jqReCalcuLateProportion, syReCalcuLateProportion, noReCalcuLateProportion);
+//        ptlAgreementProductCostsExportService.updateById(ptlAgreementProductCostsExport);
+
+
+        //endregion
+
+        //region 计算分销费用
+
+        //分销总比例
+        BigDecimal jqRetailRadio = new BigDecimal("0");
+        BigDecimal syRetailRadio = new BigDecimal("0");
+        BigDecimal noRetailRadio = new BigDecimal("0");
+
+        FeeOrderNewVo.RetailFee retailFeeLevel3 = new FeeOrderNewVo.RetailFee();
+        FeeOrderNewVo.RetailFee retailFeeLevel2 = new FeeOrderNewVo.RetailFee();
+        FeeOrderNewVo.RetailFee retailFeeLevel1 = new FeeOrderNewVo.RetailFee();
+
+        //分销总比例
+        BigDecimal retailRadio = new BigDecimal("0");
+        if (esmRetailList != null && !esmRetailList.isEmpty()) {
+            EsmRetail esmRetail = esmRetailList.get(0);
+            //分销等级
+            insFeeOrderNew.setDistributionStatus(esmRetailList.get(0).getRetailtype());
+            //用户分销人员id
+            List<EsmUserReferrer> parents = esmUserReferrerService.findParents(sysUser.getId());
+
+            if (esmRetail != null) {
+                BigDecimal sumPremium = insFeeOrderNew.getJqPremium().add(insFeeOrderNew.getSyPremium()).add(insFeeOrderNew.getNoPremium());
+                if (Integer.parseInt(esmRetail.getRetailtype()) >= 3) {
+                    insFeeOrderNew.setThirdDetailProportion(new BigDecimal(String.valueOf(esmRetail.getDisrate3())));
+                    retailRadio = retailRadio.add(insFeeOrderNew.getThirdDetailProportion()).setScale(2, BigDecimal.ROUND_DOWN);
+                    retailFeeLevel3 = feeRuleSchemeService.calcRetail(
+                            insFeeOrderNew.getJqPremium(),
+                            insFeeOrderNew.getJqCostsProportion(),
+                            insFeeOrderNew.getSyPremium(),
+                            insFeeOrderNew.getSyCostsProportion(),
+                            insFeeOrderNew.getNoPremium(),
+                            insFeeOrderNew.getNoCostsProportion(),
+                            retailProportion.getJqRetailLevel3Proportion(),
+                            retailProportion.getSyRetailLevel3Proportion(),
+                            retailProportion.getNoRetailLevel3Proportion());
+
+                    insFeeOrderNew.setThirdDetailPremiums(retailFeeLevel3.getTotalRetailPremiums());
+
+                    if (parents != null && parents.size() > 2) {
+                        insFeeOrderNew.setThreeLevelUserId(parents.get(2).getId());
+                    }
+                } else {
+                    insFeeOrderNew.setThirdDetailProportion(new BigDecimal(0));
+                }
+                if (Integer.parseInt(esmRetail.getRetailtype()) >= 2) {
+                    insFeeOrderNew.setSecondDetailProportion(new BigDecimal(String.valueOf(esmRetail.getDisrate2())));
+                    retailRadio = retailRadio.add(insFeeOrderNew.getSecondDetailProportion()).setScale(2, BigDecimal.ROUND_DOWN);
+                    retailFeeLevel2 = feeRuleSchemeService.calcRetail(insFeeOrderNew.getJqPremium(),
+                            insFeeOrderNew.getJqCostsProportion(),
+                            insFeeOrderNew.getSyPremium(),
+                            insFeeOrderNew.getSyCostsProportion(),
+                            insFeeOrderNew.getNoPremium(),
+                            insFeeOrderNew.getNoCostsProportion(),
+                            retailProportion.getJqRetailLevel2Proportion(),
+                            retailProportion.getSyRetailLevel2Proportion(),
+                            retailProportion.getNoRetailLevel2Proportion());
+                    insFeeOrderNew.setSecondDetailPremiums(retailFeeLevel2.getTotalRetailPremiums());
+                    if (parents != null && parents.size() > 1) {
+                        insFeeOrderNew.setTwoLevelUserId(parents.get(1).getId());
+                    }
+                } else {
+                    insFeeOrderNew.setSecondDetailProportion(new BigDecimal(0));
+                }
+                if (Integer.parseInt(esmRetail.getRetailtype()) >= 1) {
+                    insFeeOrderNew.setFirstDetailProportion(new BigDecimal(String.valueOf(esmRetail.getDisrate1())));
+                    retailRadio = retailRadio.add(insFeeOrderNew.getFirstDetailProportion()).setScale(2, BigDecimal.ROUND_DOWN);
+                    retailFeeLevel1 = feeRuleSchemeService.calcRetail(insFeeOrderNew.getJqPremium(),
+                            insFeeOrderNew.getJqCostsProportion(),
+                            insFeeOrderNew.getSyPremium(),
+                            insFeeOrderNew.getSyCostsProportion(),
+                            insFeeOrderNew.getNoPremium(),
+                            insFeeOrderNew.getNoCostsProportion(),
+                            retailProportion.getJqRetailLevel1Proportion(),
+                            retailProportion.getSyRetailLevel1Proportion(),
+                            retailProportion.getNoRetailLevel1Proportion());
+                    insFeeOrderNew.setFirstDetailPremiums(retailFeeLevel1.getTotalRetailPremiums());
+                    if (parents != null && !parents.isEmpty()) {
+                        insFeeOrderNew.setFirstLevelUserId(parents.get(0).getId());
+                    }
+                } else {
+                    insFeeOrderNew.setFirstDetailProportion(new BigDecimal(0));
+                }
+            } else {
+                insFeeOrderNew.setFirstDetailPremiums(new BigDecimal(0));
+                insFeeOrderNew.setSecondDetailPremiums(new BigDecimal(0));
+                insFeeOrderNew.setThirdDetailPremiums(new BigDecimal(0));
+            }
+        } else {
+            insFeeOrderNew.setFirstDetailProportion(new BigDecimal(0));
+            insFeeOrderNew.setSecondDetailProportion(new BigDecimal(0));
+            insFeeOrderNew.setThirdDetailProportion(new BigDecimal(0));
+        }
+        insFeeOrderNew.assignRetail(retailFeeLevel1, retailFeeLevel2, retailFeeLevel3);
+
+        //endregion
+
+        //region 设置机构管理费
+
+        //交强机构管理费
+        BigDecimal jqDeptRadio =
+                ptlAgreementProductCostsExport.getJqExportRadioLevel1().add(ptlAgreementProductCostsExport.getJqExportRadioLevel2()).add(ptlAgreementProductCostsExport.getJqExportRadioLevel3()).add(ptlAgreementProductCostsExport.getJqExportRadioLevel4()).add(ptlAgreementProductCostsExport.getJqExportRadioLevel5());
+        FeeOrderNewVo.DeptManagerFee jqDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(insFeeOrderNew.getJqPremium(),
+                ptlAgreementProductCostsExport.getJqExportRadioLevel1(), ptlAgreementProductCostsExport.getJqExportRadioLevel2(),
+                ptlAgreementProductCostsExport.getJqExportRadioLevel3(), ptlAgreementProductCostsExport.getJqExportRadioLevel4(),
+                ptlAgreementProductCostsExport.getJqExportRadioLevel5());
+        insFeeOrderNew.setJqDeptProportionLevel1(jqDeptManagerFee.getDeptProportionLevelOne());
+        insFeeOrderNew.setJqDeptPremiumsLevel1(twoPeople(jqDeptManagerFee.getDeptPremiumsLevelOne()));
+        insFeeOrderNew.setJqDeptProportionLevel2(jqDeptManagerFee.getDeptProportionLevelTwo());
+        insFeeOrderNew.setJqDeptPremiumsLevel2(twoPeople(jqDeptManagerFee.getDeptPremiumsLevelTwo()));
+        insFeeOrderNew.setJqDeptProportionLevel3(jqDeptManagerFee.getDeptProportionLevelThree());
+        insFeeOrderNew.setJqDeptPremiumsLevel3(twoPeople(jqDeptManagerFee.getDeptPremiumsLevelThree()));
+        insFeeOrderNew.setJqDeptProportionLevel4(jqDeptManagerFee.getDeptProportionLevelFoure());
+        insFeeOrderNew.setJqDeptPremiumsLevel4(twoPeople(jqDeptManagerFee.getDeptPremiumsLevelFoure()));
+        insFeeOrderNew.setJqDeptProportionLevel5(jqDeptManagerFee.getDeptProportionLevelFive());
+        insFeeOrderNew.setJqDeptPremiumsLevel5(twoPeople(jqDeptManagerFee.getDeptPremiumsLevelFive()));
+
+        BigDecimal syDeptRadio =
+                ptlAgreementProductCostsExport.getSyExportRadioLevel1().add(ptlAgreementProductCostsExport.getSyExportRadioLevel2()).add(ptlAgreementProductCostsExport.getSyExportRadioLevel3()).add(ptlAgreementProductCostsExport.getSyExportRadioLevel4()).add(ptlAgreementProductCostsExport.getSyExportRadioLevel5());
+        FeeOrderNewVo.DeptManagerFee syDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(insFeeOrderNew.getSyPremium(),
+                ptlAgreementProductCostsExport.getSyExportRadioLevel1(), ptlAgreementProductCostsExport.getSyExportRadioLevel2(),
+                ptlAgreementProductCostsExport.getSyExportRadioLevel3(), ptlAgreementProductCostsExport.getSyExportRadioLevel4(),
+                ptlAgreementProductCostsExport.getSyExportRadioLevel5());
+        insFeeOrderNew.setSyDeptProportionLevel1(syDeptManagerFee.getDeptProportionLevelOne());
+        insFeeOrderNew.setSyDeptPremiumsLevel1(twoPeople(syDeptManagerFee.getDeptPremiumsLevelOne()));
+        insFeeOrderNew.setSyDeptProportionLevel2(syDeptManagerFee.getDeptProportionLevelTwo());
+        insFeeOrderNew.setSyDeptPremiumsLevel2(twoPeople(syDeptManagerFee.getDeptPremiumsLevelTwo()));
+        insFeeOrderNew.setSyDeptProportionLevel3(syDeptManagerFee.getDeptProportionLevelThree());
+        insFeeOrderNew.setSyDeptPremiumsLevel3(twoPeople(syDeptManagerFee.getDeptPremiumsLevelThree()));
+        insFeeOrderNew.setSyDeptProportionLevel4(syDeptManagerFee.getDeptProportionLevelFoure());
+        insFeeOrderNew.setSyDeptPremiumsLevel4(twoPeople(syDeptManagerFee.getDeptPremiumsLevelFoure()));
+        insFeeOrderNew.setSyDeptProportionLevel5(syDeptManagerFee.getDeptProportionLevelFive());
+        insFeeOrderNew.setSyDeptPremiumsLevel5(twoPeople(syDeptManagerFee.getDeptPremiumsLevelFive()));
+
+        BigDecimal noDeptRadio =
+                ptlAgreementProductCostsExport.getNoCarExportRadioLevel1().add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel2()).add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel3()).add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel4()).add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel5());
+        FeeOrderNewVo.DeptManagerFee noDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(insFeeOrderNew.getNoPremium(),
+                ptlAgreementProductCostsExport.getNoCarExportRadioLevel1(), ptlAgreementProductCostsExport.getNoCarExportRadioLevel2(),
+                ptlAgreementProductCostsExport.getNoCarExportRadioLevel3(), ptlAgreementProductCostsExport.getNoCarExportRadioLevel4(),
+                ptlAgreementProductCostsExport.getNoCarExportRadioLevel5());
+        insFeeOrderNew.setNoDeptProportionLevel1(noDeptManagerFee.getDeptProportionLevelOne());
+        insFeeOrderNew.setNoDeptPremiumsLevel1(twoPeople(noDeptManagerFee.getDeptPremiumsLevelOne()));
+        insFeeOrderNew.setNoDeptProportionLevel2(noDeptManagerFee.getDeptProportionLevelTwo());
+        insFeeOrderNew.setNoDeptPremiumsLevel2(twoPeople(noDeptManagerFee.getDeptPremiumsLevelTwo()));
+        insFeeOrderNew.setNoDeptProportionLevel3(noDeptManagerFee.getDeptProportionLevelThree());
+        insFeeOrderNew.setNoDeptPremiumsLevel3(twoPeople(noDeptManagerFee.getDeptPremiumsLevelThree()));
+        insFeeOrderNew.setNoDeptProportionLevel4(noDeptManagerFee.getDeptProportionLevelFoure());
+        insFeeOrderNew.setNoDeptPremiumsLevel4(twoPeople(noDeptManagerFee.getDeptPremiumsLevelFoure()));
+        insFeeOrderNew.setNoDeptProportionLevel5(noDeptManagerFee.getDeptProportionLevelFive());
+        insFeeOrderNew.setNoDeptPremiumsLevel5(twoPeople(noDeptManagerFee.getDeptPremiumsLevelFive()));
+
+        //endregion
+
+        //region 出口费用
+
+        //交强出口手续费比例
+        FeeOrderNewVo.ExportFee jqExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getJqPremium(), new BigDecimal(ptlAgreementProductCostsNew.getJqCostsExportProportion()),
+                insFeeOrderNew.getJqCostsProportion(), jqDeptRadio, retailRadio, taxRadio, jqReCalcuLateProportion.getProxyProportion());
+
+        //商业出口手续费比例
+        FeeOrderNewVo.ExportFee syExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getSyPremium(), new BigDecimal(ptlAgreementProductCostsNew.getSyCostsExportProportion()),
+                insFeeOrderNew.getSyCostsProportion(), syDeptRadio, retailRadio, taxRadio, syReCalcuLateProportion.getProxyProportion());
+
+        //非车出口手续费比例
+        FeeOrderNewVo.ExportFee noExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getNoPremium(), new BigDecimal(ptlAgreementProductCostsNew.getNoCostsExportProportion()),
+                insFeeOrderNew.getNoCostsProportion(), noDeptRadio, retailRadio, taxRadio, noReCalcuLateProportion.getProxyProportion());
+
+        //出口手续费用
+        insFeeOrderNew.setJqExportSuperviseCostsPremiums(twoPeople(jqExportFee.getSuperviseCostsPremiums()));
+        insFeeOrderNew.setSyExportSuperviseCostsPremiums(twoPeople(syExportFee.getSuperviseCostsPremiums()));
+        insFeeOrderNew.setNoExportSuperviseCostsPremiums(twoPeople(noExportFee.getSuperviseCostsPremiums()));
+
+        //出口其他费用比例
+        insFeeOrderNew.setJqExportOtherCostsProportion(twoPeople(jqExportFee.getOtherCostsProportion()));
+        insFeeOrderNew.setSyExportOtherCostsProportion(twoPeople(syExportFee.getOtherCostsProportion()));
+        insFeeOrderNew.setNoExportOtherCostsProportion(twoPeople(noExportFee.getOtherCostsProportion()));
+
+        //出口其他费用
+        insFeeOrderNew.setJqExportOtherCostsPremiums(twoPeople(jqExportFee.getOtherCostsPremiums()));
+        insFeeOrderNew.setSyExportOtherCostsPremiums(twoPeople(syExportFee.getOtherCostsPremiums()));
+        insFeeOrderNew.setNoExportOtherCostsPremiums(twoPeople(noExportFee.getOtherCostsPremiums()));
+
+        //设置出口手续费比例
+        insFeeOrderNew.setJqCostsExportProportion(twoPeople(jqExportFee.getSuperviseCosts()));
+        insFeeOrderNew.setSyCostsExportProportion(twoPeople(syExportFee.getSuperviseCosts()));
+        insFeeOrderNew.setNoCostsExportProportion(twoPeople(noExportFee.getSuperviseCosts()));
+
+        // 外部订单费用
+        insFeeOrderNew.setJqExternalProportion(jqExportFee.getExternalProportion());
+        insFeeOrderNew.setJqExternalPremiums(jqExportFee.getExternalPremiums());
+
+        insFeeOrderNew.setSyExternalProportion(syExportFee.getExternalProportion());
+        insFeeOrderNew.setSyExternalPremiums(syExportFee.getExternalPremiums());
+
+        insFeeOrderNew.setNoExternalProportion(noExportFee.getExternalProportion());
+        insFeeOrderNew.setNoExternalPremiums(noExportFee.getExternalPremiums());
+
+        //endregion
+
+        //region 计算利润差值
+        //入口 - 出口 - 机构管理费 1-5级 - 分销费  = 差值
+
+        //分销交强费用
+        //分开算  1  2 3 级
+        BigDecimal jqFirst = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getFirstDetailProportion().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal jqSecond = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getSecondDetailProportion().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal jqThird = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getThirdDetailProportion().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal jqFenXiao = jqFirst.add(jqSecond).add(jqThird);
+        //分销商业费用
+        BigDecimal syFirst = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getFirstDetailProportion().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal sySecond = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getSecondDetailProportion().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal syThird = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getThirdDetailProportion().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal syFenXiao = syFirst.add(sySecond).add(syThird);
+        //分销非车费用
+        BigDecimal noFirst = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getFirstDetailProportion().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal noSecond = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getSecondDetailProportion().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal noThird = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getThirdDetailProportion().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal noFenXiao = noFirst.add(noSecond).add(noThird);
+
+        BigDecimal jqDifference = jqEntranceFee.getTotalAmount()
+                .subtract(jqExportFee.getExternalPremiums())
+                .subtract(
+                        (jqExportFee.getSuperviseCostsPremiums().add(jqExportFee.getOtherCostsPremiums())))
+                .subtract(
+                        (jqDeptManagerFee.getDeptPremiumsLevelOne().add(jqDeptManagerFee.getDeptPremiumsLevelTwo().add(jqDeptManagerFee.getDeptPremiumsLevelThree()).add(jqDeptManagerFee.getDeptPremiumsLevelFoure()).add(jqDeptManagerFee.getDeptPremiumsLevelFive())))
+                )
+                .subtract(jqFenXiao).setScale(5, BigDecimal.ROUND_HALF_DOWN);
+        insFeeOrderNew.setJqProfitMarginPremiums(jqDifference);
+
+        BigDecimal syDifference = syEntranceFee.getTotalAmount()
+                .subtract(syExportFee.getExternalPremiums())
+                .subtract(
+                        (syExportFee.getSuperviseCostsPremiums().add(syExportFee.getOtherCostsPremiums())))
+                .subtract(
+                        (syDeptManagerFee.getDeptPremiumsLevelOne().add(syDeptManagerFee.getDeptPremiumsLevelTwo().add(syDeptManagerFee.getDeptPremiumsLevelThree()).add(syDeptManagerFee.getDeptPremiumsLevelFoure()).add(syDeptManagerFee.getDeptPremiumsLevelFive())))
+                )
+                .subtract(syFenXiao).setScale(5, BigDecimal.ROUND_HALF_DOWN);
+        insFeeOrderNew.setSyProfitMarginPremiums(syDifference);
+
+        BigDecimal noDifference = noEntranceFee.getTotalAmount()
+                .subtract(noExportFee.getExternalPremiums())
+                .subtract(
+                        (noExportFee.getSuperviseCostsPremiums().add(noExportFee.getOtherCostsPremiums())))
+                .subtract(
+                        (noDeptManagerFee.getDeptPremiumsLevelOne().add(noDeptManagerFee.getDeptPremiumsLevelTwo().add(noDeptManagerFee.getDeptPremiumsLevelThree()).add(noDeptManagerFee.getDeptPremiumsLevelFoure()).add(noDeptManagerFee.getDeptPremiumsLevelFive())))
+                )
+                .subtract(noFenXiao).setScale(5, BigDecimal.ROUND_HALF_DOWN);
+
+        insFeeOrderNew.setNoProfitMarginPremiums(noDifference);
+
+        //endregion
+
+        //region 比例逆推是否等于0
+
+        if (!feeRuleSchemeService.calculateProportion(jqEntranceFee, jqDeptManagerFee, jqExportFee, retailRadio, taxRadio, insFeeOrderNew.getJqPremium()))
+            throw new SystemException("交强比例异常");
+
+        if (!feeRuleSchemeService.calculateProportion(syEntranceFee, syDeptManagerFee, syExportFee, retailRadio, taxRadio, insFeeOrderNew.getSyPremium()))
+            throw new SystemException("商业比例异常");
+
+        if (!feeRuleSchemeService.calculateProportion(noEntranceFee, noDeptManagerFee, noExportFee, retailRadio, taxRadio, insFeeOrderNew.getNoPremium()))
+            throw new SystemException("非车比例异常");
+
+        //endregion
+        insFeeOrderNewService.saveOrUpdate(insFeeOrderNew);
+    }
+
     @Override
     public void calcCostsExternalTelemarketing(PtlAgreementProductCostsExport ptlAgreementProductCostsExport, InsAreaCompany insAreaCompany) {
         //获取协议信息

+ 3 - 0
src/main/java/com/ydtech/modules/ins/model/vo/KindInfoVo.java

@@ -34,6 +34,9 @@ public class KindInfoVo {
     @ApiModelProperty("服务次数")
     private int serviceTimes;
 
+    @ApiModelProperty("别名")
+    private String alias;
+
     //扩展属性
     //seat: 乘客数(机动车车上人员责任保险-乘客)
     //repairFactorRate: 指定修理厂费率(指定专修厂险,国产车:车损险基准纯风险保费的10%~30%之间,选择国产默认10%;进口车:车损险基准纯风险保费的15%~60%之间,选择进口默认20%。)

+ 2 - 0
src/main/java/com/ydtech/modules/ins/model/vo/QuoteKindRespVo.java

@@ -45,4 +45,6 @@ public class QuoteKindRespVo {
 
     private double unitAmount;
 
+    private String grouping;
+
 }

+ 3 - 5
src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java

@@ -56,9 +56,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 @Aspect
 @Component
@@ -185,12 +183,12 @@ public class QuoteVerificationAspect {
                     }
                 }
                 //税源查询
-                BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(orderno, agreementId);
+                BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(orderno, ((BaseQuoteVo<?>) arg).getKinds());
                 //add by hxl  2024-06-12  改为从主订单表中获取数据用户id和部门id
                 SysUser user = sysUserService.getById(quoteInfo.getUserId());
                 String userId=quoteInfo.getUserId();
                 String deptId = user.getDeptId();
-                List<KindInfoVo> kinds = quoteInfo.getKindList();
+                List<KindInfoVo> kinds = Objects.isNull(quoteInfo.getKindList()) ? new ArrayList<>() : quoteInfo.getKindList();
                 List<RiskInfoVo> risks = quoteInfo.getRiskList();
 
                 ProductsType insuranceRisk = InsuranceRisk.determineInsuranceInformation(kinds, risks);

+ 29 - 2
src/main/java/com/ydtech/modules/order/components/InsOrdersComponents.java

@@ -2,15 +2,19 @@ package com.ydtech.modules.order.components;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
 import com.ydtech.modules.order.constants.OrderCacheConstant;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
+import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
 import com.ydtech.modules.order.service.InsOrdersService;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
 import org.springframework.util.ObjectUtils;
 
+import java.util.List;
+
 
 @Component
 public class InsOrdersComponents {
@@ -50,6 +54,29 @@ public class InsOrdersComponents {
         return quoteInfoVo;
     }
 
+    /**
+     * 通订单号获取报价信息
+     *
+     * @param orderNo 订单ID
+     * @return BaseQuoteInfoVo
+     */
+    public BaseQuoteInfoVo getQuoteInfo(String orderNo,List<KindInfoVo> kindInfoVoList) {
+        insOrdersService.existOrder(orderNo);
+        String s = redisTemplate.opsForValue().get(OrderCacheConstant.QUOTE_INFO_KEY + orderNo);
+
+        BaseQuoteInfoVo quoteInfoVo = JSON.parseObject(s, BaseQuoteInfoVo.class);
+        if (ObjectUtils.isEmpty(quoteInfoVo)) {
+            // 缓存中不存在,在数据库中取
+            InsOrders insOrders = insOrdersService.getById(orderNo);
+            return new BaseQuoteInfoVo(insOrders);
+        }
+        quoteInfoVo.setOrderNo(orderNo);
+        //替换商业险信息
+        quoteInfoVo.setKindList(kindInfoVoList);
+        // 核保规则
+        return quoteInfoVo;
+    }
+
 
 
 
@@ -63,10 +90,10 @@ public class InsOrdersComponents {
      * @param agreementId 协议id
      * @return BaseQuoteInfoVo
      */
-    public BaseQuoteInfoVo getQuoteInfo(String orderNo, String agreementId) {
+    public BaseQuoteInfoVo getQuoteInfo(String orderNo, String agreementId, List<KindInfoVo> kindInfoVoList) {
         // 核保规则
         proxyService.getQuoteRules(orderNo, agreementId);
-        return proxyService.getQuoteInfo(orderNo);
+        return proxyService.getQuoteInfo(orderNo,kindInfoVoList);
     }
 
     //查询子订单

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/BoHaiOrderApiController.java

@@ -67,7 +67,7 @@ public class BoHaiOrderApiController {
     @ApiOperation("报价")
     public HttpResult<QuoteRespVo> quote(@RequestBody BaseQuoteVo<QuoteAccidentalDrivingVo> quoteVo) throws Exception {
         BaseQuoteVo<List<BoHaiQuoteAccidentVo>> baseQuoteVo = insOrdersService.convertDriving(quoteVo);
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId());
+        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId(),quoteVo.getKinds());
         return this.boHaiOrderApiService.quote(quoteInfo, baseQuoteVo);
     }
 

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/DaJiaOrderController.java

@@ -36,7 +36,7 @@ public class DaJiaOrderController {
     @PostMapping("/quote")
     @ApiOperation("报价")
     public HttpResult<QuoteRespVo> quote(@RequestBody BaseQuoteVo<Object> quoteVo) {
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId());
+        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId(),quoteVo.getKinds());
         return this.daJiaOrderService.quote(quoteInfo, quoteVo);
     }
 

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/DrivingInsuranceController.java

@@ -89,7 +89,7 @@ public class DrivingInsuranceController extends BaseController {
     @ApiOperation(value = "根据规则获取驾意险信息")
     @PostMapping(value = "getDrivingInsuranceRule")
     public HttpResult<List<InsDrivingIntentionInsuranceVo>> getDrivingInsuranceRule(@RequestBody NoCarInsuranceQueryVo insuranceQueryVo) {
-        List<InsDrivingIntentionInsuranceVo> insDrivingIntentionInsuranceVo = insDrivingIntentionInsuranceService.getInsDrivingIntentionInsuranceRule(insuranceQueryVo);
+         List<InsDrivingIntentionInsuranceVo> insDrivingIntentionInsuranceVo = insDrivingIntentionInsuranceService.getInsDrivingIntentionInsuranceRule(insuranceQueryVo);
         return HttpResult.ok(insDrivingIntentionInsuranceVo);
     }
 

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/ExternalOrderController.java

@@ -45,7 +45,7 @@ public class ExternalOrderController {
     @PostMapping("/saveSubOrder")
     @ApiOperation("保存子订单")
     public HttpResult<QuoteRespVo> saveSubOrder(@RequestBody BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId());
+        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId(),quoteVo.getKinds());
         boolean result = this.insAreaCompanyService.saveSubOrder(quoteInfo, quoteVo);
         String successMsg="";
         String errorMsg ="";

+ 7 - 0
src/main/java/com/ydtech/modules/order/controller/GuoRenOrderApiController.java

@@ -100,6 +100,13 @@ public class GuoRenOrderApiController {
         return this.guorenOrderApiService.queryClauseData(agreementId);
     }
 
+
+    @PostMapping(value = "/queryClauseDataCompany")
+    @ApiOperation(value = "特约查询保险公司")
+    public HttpResult<List<GuoRenSpecialAgreement>> queryClauseDataCompany(@RequestSingleParam(value = "companyId") String companyId) {
+        return this.guorenOrderApiService.queryClauseDataCompanyId(companyId);
+    }
+
     @ApiOperation(value = "更新订单信息")
     @PostMapping("/updateOrderInfo")
     public HttpResult updateOrderInfoByIns(@RequestSingleParam(value = "companyId") String companyId) {

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/HuaTaiOrderApiController.java

@@ -45,7 +45,7 @@ public class HuaTaiOrderApiController {
     @PostMapping("/quote")
     @ApiOperation("报价")//3.5.	报价接口
     public HttpResult<QuoteRespVo> quote(@RequestBody BaseQuoteVo<AccidentalDrivingVo> zmQuoteVo) {
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(zmQuoteVo.getOrderNo(), zmQuoteVo.getAgreementId());
+        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(zmQuoteVo.getOrderNo(), zmQuoteVo.getAgreementId(),zmQuoteVo.getKinds());
         return this.huaTaiOrderApiService.quote(quoteInfo, zmQuoteVo);
     }
 

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/InsCrawlerOrderController.java

@@ -40,7 +40,7 @@ public class InsCrawlerOrderController extends BaseController {
     @ApiOperation("报价")
     public HttpResult<QuoteRespVo> quote(@RequestBody BaseQuoteVo<QuoteAccidentalDrivingVo> baseQuoteVo) {
         BaseQuoteVo baseQuoteVo1 = insOrdersService.convertDriving(baseQuoteVo);
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(baseQuoteVo.getOrderNo(), baseQuoteVo.getAgreementId());
+        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(baseQuoteVo.getOrderNo(), baseQuoteVo.getAgreementId(),baseQuoteVo.getKinds());
         return insuranceCrawlerOrderService.quote(quoteInfo, baseQuoteVo1);
     }
 

+ 17 - 1
src/main/java/com/ydtech/modules/order/controller/InsOrdersController.java

@@ -22,6 +22,7 @@ import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
 import com.ydtech.modules.order.entity.vo.*;
 import com.ydtech.modules.order.service.*;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
+import com.ydtech.modules.scheme.service.PtlSchemeRulesService;
 import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -36,7 +37,9 @@ import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 @Api(tags = "订单")
@@ -58,6 +61,8 @@ public class InsOrdersController extends BaseController {
 
     private final InsAreaCompanyPositionService insAreaCompanyPositionService;
 
+
+
     @Value("${upload.file.path}")
     private String uploadPath;
 
@@ -91,6 +96,10 @@ public class InsOrdersController extends BaseController {
     @ApiOperation(value = "生成订单")
     public HttpResult<InsOrders> generateOrder(@Validated @RequestBody BaseQuoteInfoVo quoteInfoVo) {
         SysUser user = getUser();
+        //app 订单取消了商业险信息
+        if(Objects.isNull(quoteInfoVo.getKindList())){
+            quoteInfoVo.setKindList(new ArrayList<>());
+        }
         InsOrders insOrders = this.insOrdersService.generateOrder(user, quoteInfoVo);
         return HttpResult.ok("success", insOrders);
     }
@@ -99,7 +108,7 @@ public class InsOrdersController extends BaseController {
     @ApiOperation(value = "通过订单ID查询订单信息")
     public HttpResult<BaseQuoteInfoVo> getByOrderNo(@RequestSingleParam(value = "orderNo") String orderNo) {
         BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(orderNo);
-        return HttpResult.ok("success", quoteInfo);
+        return HttpResult.ok("success", null);
     }
 
     @PostMapping("/revise")
@@ -109,6 +118,13 @@ public class InsOrdersController extends BaseController {
         return HttpResult.ok("success", insOrders);
     }
 
+    @PostMapping("/reviseApp")
+    @ApiOperation(value = "查询订单和子订单")
+    public HttpResult<InsOrdersEditingVo> reviseApp(@RequestSingleParam(value = "orderNo") String orderNo) {
+        InsOrdersEditingVo insOrders = this.insOrdersService.reviseApp(orderNo);
+        return HttpResult.ok("success", insOrders);
+    }
+
     @PostMapping("/queryPageOrder")
     @ApiOperation(value = "[1]分页查询订单接口")
     public HttpResult<BasePageResult<InsOrders>> queryPageOrder(@RequestBody @Valid OrderQueryVo orderQueryVo) {

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/PingAnOrderApiController.java

@@ -48,7 +48,7 @@ public class PingAnOrderApiController {
     @PostMapping("/quote")
     @ApiOperation("1报价-标的查询-车型查询-车辆确认-报价")
     public HttpResult<QuoteRespVo> quote(@RequestBody PingAnQuoteVo<Map<String,Object>> quoteVo) throws Exception {
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId());
+        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId(),quoteVo.getKinds());
         return this.pingAnOrderApiService.quote(quoteInfo, quoteVo);
     }
     /**

+ 244 - 0
src/main/java/com/ydtech/modules/order/controller/QuoteController.java

@@ -0,0 +1,244 @@
+package com.ydtech.modules.order.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.ydtech.constants.enums.InsuranceRisk;
+import com.ydtech.constants.enums.dict.agreement.ProductsType;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.ins.model.vo.QuoteRespVo;
+import com.ydtech.modules.order.aop.QuoteVerification;
+import com.ydtech.modules.order.components.InsOrdersComponents;
+import com.ydtech.modules.order.entity.vo.AccidentalDrivingVo;
+import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
+import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
+import com.ydtech.modules.order.entity.vo.QuoteAccidentalDrivingVo;
+import com.ydtech.modules.order.entity.vo.bohai.BoHaiQuoteAccidentVo;
+import com.ydtech.modules.order.entity.vo.guoren.GuoRenQuoteVo;
+import com.ydtech.modules.order.entity.vo.guoren.GuorenAccidentalDrivingVo;
+import com.ydtech.modules.order.entity.vo.zj.ZjQuoteAccidentVo;
+import com.ydtech.modules.order.service.*;
+import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
+import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
+import com.ydtech.modules.protocol.entity.constants.PtlApiType;
+import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
+import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
+import com.ydtech.modules.protocol.service.PtlTaxSourceNewService;
+import com.ydtech.modules.protocol.service.impl.TaxSourceExcludeServiceImpl;
+import com.ydtech.utils.StringUtils;
+import io.swagger.annotations.Api;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+@Api(tags = "报价")
+@RestController
+@RequestMapping(value = "/quote")
+public class QuoteController extends BaseController {
+
+    @Autowired
+    TaxSourceExcludeServiceImpl taxSourceExcludeService;
+
+    @Autowired
+    PtlTaxSourceNewService ptlTaxSourceNewService;
+
+    @Autowired
+    PtlTaxSourceNewMapper ptlTaxSourceNewMapper;
+
+    @Autowired
+    InsOrdersComponents insOrdersComponents;
+
+    @Autowired
+    PtlAgreementAttributionService ptlAgreementAttributionService;
+
+    @Autowired
+    InsCrawlerOrderService insCrawlerOrderService;
+
+    @Autowired
+    ZhongMeiOrderApiService zhongMeiOrderApiService;
+
+    @Autowired
+    ZijinOrderApiService zijinOrderApiService;
+
+    @Autowired
+    YongchengOrderApiService yongchengOrderApiService;
+
+    @Autowired
+    HuaTaiOrderApiService huaTaiOrderApiService;
+
+    @Autowired
+    GuorenOrderApiService guorenOrderApiService;
+
+    @Autowired
+    DaJiaOrderService daJiaOrderService;
+
+    @Autowired
+    BoHaiOrderApiService boHaiOrderApiService;
+
+    @Autowired
+    PingAnOrderApiService pingAnOrderApiService;
+
+    @Autowired
+    InsOrdersService insOrdersService;
+
+    @QuoteVerification("报价授权")
+    @PostMapping(value = "/quote")
+    public HttpResult<QuoteRespVo> quote(@RequestBody BaseQuoteVo<Object> quoteVo) throws Exception {
+        String isTaxSource = quoteVo.getIsTaxSource();
+        boolean isExclude = true;
+        //排除的部门信息
+        List<TaxSourceExcludeDto> excludeDepts =
+                taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>()
+                        .eq(TaxSourceExcludeDto::getExcludeInfo, getDeptId())
+                        .eq(TaxSourceExcludeDto::getInsCompanyId, quoteVo.getCompanyId())
+                        .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
+
+        BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId(),quoteVo.getKinds());
+        //部门排除
+        String finalDeptId = getDeptId();
+        if (excludeDepts.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(finalDeptId))) {
+            isExclude = false;
+        }
+        if(Objects.isNull(quoteVo.getKinds())){
+            quoteVo.setKinds(new ArrayList<>());
+        }
+        ProductsType insuranceRisk = InsuranceRisk.determineInsuranceInformation(quoteVo.getKinds(), quoteVo.getRisks());
+        //默认协议走逻辑判断 且不在排除部门中走默认判断逻辑
+        if(StringUtils.isNotBlank(isTaxSource) && "1".equals(isTaxSource) && isExclude){
+            String taxAgreementId = ptlTaxSourceNewService.getAgreementId(getDeptId(), getUserId(), quoteVo.getCompanyId(), quoteInfo,insuranceRisk.getCode(),quoteVo.getOrderNo());
+            quoteVo.setAgreementId(taxAgreementId);
+//            log.info("======================订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId+"=======================");
+            //throw new SystemException("订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId);
+        }else{
+            //不在排除部门内进行默认判断
+            if(isExclude){
+                //走正常协议判断是错误的   判断是否有默认配置,如果有不可能进来,前台报错
+                List<PtlTaxSourceNew> taxSourceDtoList = ptlTaxSourceNewMapper.selectList(new LambdaQueryWrapper<PtlTaxSourceNew>()
+                        .eq(PtlTaxSourceNew::getInsCompanyId, quoteVo.getCompanyId())
+                        .eq(PtlTaxSourceNew::getDefaultFlag,"1"));
+                if(taxSourceDtoList!=null && !taxSourceDtoList.isEmpty()){
+                    //throw new SystemException("配置默认协议且部门未排除应走默认逻辑,操作错误,请联系管理员!!");
+                    //强制走默认状态
+                    String taxAgreementId = ptlTaxSourceNewService.getAgreementId(getDeptId(), getUserId(), quoteVo.getCompanyId(), quoteInfo,insuranceRisk.getCode(),quoteVo.getOrderNo());
+                    quoteVo.setAgreementId(taxAgreementId);
+                }
+            }
+        }
+
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(quoteVo.getAgreementId());
+
+        if (PtlApiType.PTL_API_2.getCode() == ptlAgreementAttribution.getApiType()) {
+            BaseQuoteVo<QuoteAccidentalDrivingVo> quoteVo1 = new BaseQuoteVo<>();
+            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(quoteVo.getAccidentalDrivingVo()));
+            QuoteAccidentalDrivingVo javaObject = jsonObject.toJavaObject(QuoteAccidentalDrivingVo.class);
+            BeanUtils.copyProperties(quoteVo, quoteVo1);
+            quoteVo1.setAccidentalDrivingVo(javaObject);
+            BaseQuoteVo baseQuoteVo = insOrdersService.convertDriving(quoteVo1);
+            return insCrawlerOrderService.quote(quoteInfo, baseQuoteVo);
+        }
+
+        if("ZMBX1000000".equals(ptlAgreementAttribution.getInsCompanyId())){
+            BaseQuoteVo<AccidentalDrivingVo> quoteVo1 = new BaseQuoteVo<>();
+            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(quoteVo.getAccidentalDrivingVo()));
+            BeanUtils.copyProperties(quoteVo, quoteVo1);
+            if(jsonObject.size() > 0) {
+                AccidentalDrivingVo javaObject = jsonObject.toJavaObject(AccidentalDrivingVo.class);
+                quoteVo1.setAccidentalDrivingVo(javaObject);
+            }else{
+                quoteVo1.setAccidentalDrivingVo(null);
+            }
+            return zhongMeiOrderApiService.quote(quoteInfo, quoteVo1);
+        }
+        if("AICS1000000".equals(ptlAgreementAttribution.getInsCompanyId())){
+            BaseQuoteVo<QuoteAccidentalDrivingVo> quoteVo1 = new BaseQuoteVo<>();
+            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(quoteVo.getAccidentalDrivingVo()));
+            QuoteAccidentalDrivingVo javaObject = jsonObject.toJavaObject(QuoteAccidentalDrivingVo.class);
+            BeanUtils.copyProperties(quoteVo, quoteVo1);
+            quoteVo1.setAccidentalDrivingVo(javaObject);
+            //转换类型
+            BaseQuoteVo<AccidentalDrivingVo> baseQuoteVo = insOrdersService.convertDriving(quoteVo1);
+            return yongchengOrderApiService.quoteApi(baseQuoteVo);
+        }
+        if("YAIC1000000".equals(ptlAgreementAttribution.getInsCompanyId())){
+
+        }
+        if("ZKIC1000000".equals(ptlAgreementAttribution.getInsCompanyId())){
+            BaseQuoteVo<List<ZjQuoteAccidentVo>> quoteVo1 = new BaseQuoteVo<>();
+            JSONArray jsonObject = JSONArray.parseArray(JSONArray.toJSONString(quoteVo.getAccidentalDrivingVo()));
+            List<ZjQuoteAccidentVo> javaObject = jsonObject.toJavaList(ZjQuoteAccidentVo.class);
+            BeanUtils.copyProperties(quoteVo, quoteVo1);
+            quoteVo1.setAccidentalDrivingVo(javaObject);
+            return zijinOrderApiService.quote(quoteInfo, quoteVo1);
+        }
+        if("XDCX1000000".equals(ptlAgreementAttribution.getInsCompanyId())){
+            GuoRenQuoteVo<QuoteAccidentalDrivingVo> quoteVo1 = new GuoRenQuoteVo<>();
+            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(quoteVo.getAccidentalDrivingVo()));
+            QuoteAccidentalDrivingVo javaObject = jsonObject.toJavaObject(QuoteAccidentalDrivingVo.class);
+            BeanUtils.copyProperties(quoteVo, quoteVo1);
+            quoteVo1.setAccidentalDrivingVo(javaObject);
+
+            BaseQuoteVo<GuorenAccidentalDrivingVo> baseQuoteVo = insOrdersService.convertDriving(quoteVo1);
+            GuoRenQuoteVo guoRenQuoteVo = new GuoRenQuoteVo();
+            BeanUtils.copyProperties(baseQuoteVo, guoRenQuoteVo);
+            guoRenQuoteVo.setGuoRenSpecialAgreementVo(baseQuoteVo.getGuoRenSpecialAgreementVo());
+            return guorenOrderApiService.quoteApi(guoRenQuoteVo);
+        }
+        if("HTIC1000000".equals(ptlAgreementAttribution.getInsCompanyId())){
+
+            BaseQuoteVo<AccidentalDrivingVo> quoteVo1 = new BaseQuoteVo<>();
+            AccidentalDrivingVo javaObject = new AccidentalDrivingVo();
+            if(!Objects.isNull(quoteVo.getAccidentalDrivingVo())) {
+                JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(quoteVo.getAccidentalDrivingVo()));
+                javaObject= jsonObject.toJavaObject(AccidentalDrivingVo.class);
+            }
+            BeanUtils.copyProperties(quoteVo,quoteVo1);
+            quoteVo1.setAccidentalDrivingVo(javaObject);
+            return huaTaiOrderApiService.quote(quoteInfo, quoteVo1);
+        }
+        if("DJPC1000000".equals(ptlAgreementAttribution.getInsCompanyId())){
+            return daJiaOrderService.quote(quoteInfo, quoteVo);
+        }
+        if("BPIC1000000".equals(ptlAgreementAttribution.getInsCompanyId())){
+            BaseQuoteVo<List<BoHaiQuoteAccidentVo>> quoteVo1 = new BaseQuoteVo<>();
+            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(quoteVo.getAccidentalDrivingVo()));
+            BeanUtils.copyProperties(quoteVo, quoteVo1);
+            if(jsonObject.size() > 0) {
+                BoHaiQuoteAccidentVo javaObject = new BoHaiQuoteAccidentVo();
+                javaObject.setPackageCode(jsonObject.getString("projectCode"));
+                javaObject.setProductCode(jsonObject.getString("riskCode"));
+                javaObject.setCopies(jsonObject.getString("quantity"));
+                List<BoHaiQuoteAccidentVo> javaObjectList = new ArrayList<>();
+                javaObjectList.add(javaObject);
+
+                quoteVo1.setAccidentalDrivingVo(javaObjectList);
+            }else{
+                quoteVo1.setAccidentalDrivingVo(new ArrayList<>());
+            }
+            return boHaiOrderApiService.quote(quoteInfo, quoteVo1);
+        }
+        if("PAIC1000000".equals(ptlAgreementAttribution.getInsCompanyId())){
+//            BaseQuoteVo<AccidentalDrivingVo> quoteVo1 = new BaseQuoteVo<>();
+//            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(quoteVo.getAccidentalDrivingVo()));
+//            AccidentalDrivingVo javaObject = jsonObject.toJavaObject(AccidentalDrivingVo.class);
+//            BeanUtils.copyProperties(quoteVo,quoteVo1);
+//            quoteVo1.setAccidentalDrivingVo(javaObject);
+//            return pingAnOrderApiService.quote(quoteInfo, quoteVo1);
+        }
+
+        return null;
+    }
+}

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/YongAnOrderApiController.java

@@ -38,7 +38,7 @@ public class YongAnOrderApiController {
     @PostMapping("/quote")
     @ApiOperation("报价")
     public HttpResult quote(@RequestBody BaseQuoteVo<Object> quoteVo) {
-        BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId());
+        BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId(),quoteVo.getKinds());
         return this.yongAnOrderService.quote(quoteInfo, quoteVo);
     }
 

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/ZhongMeiOrderApiController.java

@@ -65,7 +65,7 @@ public class ZhongMeiOrderApiController {
     @ApiOperation("报价")
     public HttpResult<QuoteRespVo> quote(@RequestBody BaseQuoteVo<QuoteAccidentalDrivingVo> zmQuoteVo) {
         BaseQuoteVo<AccidentalDrivingVo> baseQuoteVo = insOrdersService.convertDriving(zmQuoteVo);
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(zmQuoteVo.getOrderNo(), zmQuoteVo.getAgreementId());
+        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(zmQuoteVo.getOrderNo(), zmQuoteVo.getAgreementId(),zmQuoteVo.getKinds());
         return this.zhongMeiOrderApiService.quote(quoteInfo, baseQuoteVo);
     }
 

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/ZhongMeiOrderController.java

@@ -37,7 +37,7 @@ public class ZhongMeiOrderController {
     @QuoteVerification("报价授权")
     @ApiOperation("报价")
     public HttpResult quote(@RequestBody BaseQuoteVo<AccidentalDrivingVo> zmQuoteVo) {
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(zmQuoteVo.getOrderNo(), zmQuoteVo.getAgreementId());
+        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(zmQuoteVo.getOrderNo(), zmQuoteVo.getAgreementId(),zmQuoteVo.getKinds());
         return this.zhongMeiOrderService.quote(quoteInfo, zmQuoteVo);
     }
 

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/ZijinOrderApiController.java

@@ -53,7 +53,7 @@ public class ZijinOrderApiController {
     @ApiOperation("报价")
     public HttpResult<QuoteRespVo> quote(@RequestBody BaseQuoteVo<List<QuoteAccidentalDrivingVo>> quoteVo) {
         BaseQuoteVo<List<ZjQuoteAccidentVo>> listBaseQuoteVo = insOrdersService.converDrivingZijin(quoteVo);
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId());
+        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId(),quoteVo.getKinds());
         return this.zijinOrderApiService.quote(quoteInfo, listBaseQuoteVo);
     }
 

+ 17 - 0
src/main/java/com/ydtech/modules/order/dao/InsBusinessInsuranceMapper.java

@@ -0,0 +1,17 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.InsBusinessInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.scheme.entity.vo.DrivingIntentionQueryVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Mapper
+ */
+public interface InsBusinessInsuranceMapper extends BaseMapper<InsBusinessInsurance> {
+
+    List<InsBusinessInsurance> getBusinessInsurance();
+}

+ 18 - 0
src/main/java/com/ydtech/modules/order/dao/InsDrivingIntentionInsuranceMapper.java

@@ -2,10 +2,28 @@ package com.ydtech.modules.order.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
+import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
+import com.ydtech.modules.scheme.entity.vo.DrivingIntentionQueryVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Mapper
  */
 public interface InsDrivingIntentionInsuranceMapper extends BaseMapper<InsDrivingIntentionInsurance> {
 
+    /**
+     * 获取驾意险 包含 son信息
+     * @param param
+     * @return
+     */
+    List<InsDrivingIntentionInsurance> getInsDrivingIntentionInsuranceList(@Param("param") DrivingIntentionQueryVo drivingIntentionQueryVo);
+
+
+    List<InsDrivingIntentionInsuranceVo> getInsDrivingIntentionInsuranceList1(@Param("param") DrivingIntentionQueryVo drivingIntentionQueryVo);
+
+    List<InsDrivingIntentionInsuranceType> getSchemeDrivingIntentionInsuranceType(String companyId);
+
 }

+ 12 - 0
src/main/java/com/ydtech/modules/order/dao/InsDrivingIntentionInsuranceTypeCompanyMapper.java

@@ -0,0 +1,12 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceTypeCompany;
+
+/**
+ * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Mapper
+ */
+public interface InsDrivingIntentionInsuranceTypeCompanyMapper extends BaseMapper<InsDrivingIntentionInsuranceTypeCompany> {
+
+}

+ 17 - 0
src/main/java/com/ydtech/modules/order/dao/InsDrivingIntentionInsuranceTypeMapper.java

@@ -0,0 +1,17 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
+
+import java.util.List;
+
+/**
+ * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Mapper
+ */
+public interface InsDrivingIntentionInsuranceTypeMapper extends BaseMapper<InsDrivingIntentionInsuranceType> {
+
+
+    List<InsDrivingIntentionInsuranceType> getDrivingIntentionInsuranceTypeByCompanyId(String companyId);
+
+}

+ 99 - 0
src/main/java/com/ydtech/modules/order/entity/InsBusinessInsurance.java

@@ -0,0 +1,99 @@
+package com.ydtech.modules.order.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 驾意险实体类
+ */
+@TableName(value = "ins_business_insurance")
+@Data
+public class InsBusinessInsurance implements Serializable {
+
+
+    private static final long serialVersionUID = 2549373518435897775L;
+    /**
+     *  id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private String id;
+
+    @TableField(value = "power_id")
+    private String powerId;
+
+    @TableField(value = "kind_name")
+    private String kindName;
+
+    @TableField(value = "alias")
+    private String alias;
+
+    @TableField(value = "kind_code")
+    private String kindCode;
+
+    @TableField(value = "grouping")
+    private String grouping;
+
+    @TableField(exist = false)
+    private Double amount;
+
+    @TableField(exist = false)
+    private String amountDesc;
+
+    @TableField(exist = false)
+    private List<InsBusinessInsuranceOption> amtList;
+
+    @TableField(exist = false)
+    private String max;
+
+
+    public InsBusinessInsurance(){
+        this.amount = Double.parseDouble("0");
+        this.amountDesc = "不投保";
+    }
+
+    //是否是主险
+    public static boolean isMainInsurance(String kindCode){
+        if(kindCode.equals("A") || kindCode.equals("B")){
+            return true;
+        }
+        return false;
+    }
+
+    //是否是附加险
+    public static boolean isAdditionalInsurance(String kindCode){
+        if(kindCode.equals("D3") || kindCode.equals("D4") || kindCode.equals("L") || kindCode.equals("MJ1") || kindCode.equals("MJ2") ||
+        kindCode.equals("MJ3") || kindCode.equals("MJ4") || kindCode.equals("SY_FJ_YBW1") || kindCode.equals("SY_FJ_YBW2") ||
+        kindCode.equals("SY_FJ_YBW3") || kindCode.equals("BD")){
+            return true;
+        }
+        return false;
+    }
+
+    //是否是服务险种
+    public static boolean isServiceInsurance(String kindCode){
+        if(kindCode.equals("TY1") || kindCode.equals("TY2") || kindCode.equals("TY3") || kindCode.equals("TY4")){
+            return true;
+        }
+        return false;
+    }
+
+    public static int checkInsurance(String kindCode){
+        if(isMainInsurance(kindCode)){
+            return 1;
+        }
+        if(isAdditionalInsurance(kindCode)){
+            return 2;
+        }
+        if(isServiceInsurance(kindCode)){
+            return 3;
+        }
+        return 0;
+    }
+
+}

+ 37 - 0
src/main/java/com/ydtech/modules/order/entity/InsBusinessInsuranceOption.java

@@ -0,0 +1,37 @@
+package com.ydtech.modules.order.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 驾意险实体类
+ */
+@TableName(value = "ins_business_insurance_option")
+@Data
+public class InsBusinessInsuranceOption implements Serializable {
+
+
+    private static final long serialVersionUID = 2549373518435897775L;
+    /**
+     *  id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    @JsonProperty("optionId")
+    private String optionId;
+
+    @TableField(value = "business_id")
+    private String businessId;
+
+    @TableField(value = "label")
+    private String label;
+
+    @TableField(value = "value")
+    private Double value;
+
+}

+ 30 - 1
src/main/java/com/ydtech/modules/order/entity/InsDrivingIntentionInsurance.java

@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceSonVo;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * 驾意险实体类
@@ -21,7 +23,7 @@ public class InsDrivingIntentionInsurance implements Serializable {
      *  id
      */
     @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
+    private String id;
 
 
     /**
@@ -30,6 +32,18 @@ public class InsDrivingIntentionInsurance implements Serializable {
     @TableField(value = "parent_id")
     private Integer parentId;
 
+    @TableField(exist = false)
+    private String parentCode;
+
+    @TableField(exist = false)
+    private String parentName;
+
+    @TableField(value = "type")
+    private Integer type;
+
+    @TableField(exist = false)
+    private String alias;
+
     /**
      * api类型(1、api对接,2、python对接)
      */
@@ -79,4 +93,19 @@ public class InsDrivingIntentionInsurance implements Serializable {
     @TableField(value = "request_data")
     private String requestData;
 
+    /**
+     * 份数
+     */
+    @TableField(exist = false)
+    private Integer quantity;
+
+    @TableField(exist = false)
+    private List<InsDrivingIntentionInsurance> insDrivingIntentionInsurances;
+
+    @TableField(exist = false)
+    private List<InsDrivingIntentionInsuranceSon> insDrivingIntentionInsuranceSon;
+
+    public InsDrivingIntentionInsurance() {
+        this.quantity = 1;
+    }
 }

+ 68 - 0
src/main/java/com/ydtech/modules/order/entity/InsDrivingIntentionInsuranceType.java

@@ -0,0 +1,68 @@
+package com.ydtech.modules.order.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 驾意险实体类
+ */
+@TableName(value = "ins_driving_intention_insurance_type")
+@Data
+public class InsDrivingIntentionInsuranceType implements Serializable {
+
+
+    private static final long serialVersionUID = 2549373518435897775L;
+    /**
+     *  id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private String id;
+
+
+    /**
+     * 父id
+     */
+    @TableField(value = "parent_id")
+    private Integer parentId;
+
+    /**
+     *
+     */
+    @TableField(value = "type_name")
+    private String typeName;
+
+    @TableField(value = "code")
+    private String code;
+
+    @TableField(value = "create_time")
+    private LocalDateTime createTime;
+
+    /**
+     * 是否多选 0 单选 1 多选
+     */
+    @TableField(exist = false)
+    private Integer isMultiple;
+
+    @TableField(exist = false)
+    private Integer isEnable;
+
+    @TableField(exist = false)
+    private boolean checked;
+
+    @TableField(exist = false)
+    private List<InsDrivingIntentionInsuranceType> children;
+
+    @TableField(exist = false)
+    private List<InsDrivingIntentionInsurance> drivingIntentionInsurances;
+
+    public InsDrivingIntentionInsuranceType(){
+        this.checked = false;
+    }
+}

+ 54 - 0
src/main/java/com/ydtech/modules/order/entity/InsDrivingIntentionInsuranceTypeCompany.java

@@ -0,0 +1,54 @@
+package com.ydtech.modules.order.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 驾意险实体类
+ */
+@TableName(value = "ins_driving_intention_insurance_type_company")
+@Data
+public class InsDrivingIntentionInsuranceTypeCompany implements Serializable {
+
+
+    private static final long serialVersionUID = 2549373518435897775L;
+    /**
+     *  id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private String id;
+
+
+    /**
+     * 父id
+     */
+    @TableField(value = "company_id")
+    private String companyId;
+
+    /**
+     *
+     */
+    @TableField(value = "type_id")
+    private Integer typeId;
+
+    @TableField(value = "is_multiple")
+    private Integer isMultiple;
+
+    @TableField(value = "is_enable")
+    private Integer isEnable;
+
+    @TableField(value = "create_time")
+    private LocalDateTime createTime;
+
+
+    @TableField(exist = false)
+    private List<InsDrivingIntentionInsurance> insDrivingIntentionInsurance;
+
+}

+ 19 - 4
src/main/java/com/ydtech/modules/order/entity/InsOrders.java

@@ -27,6 +27,7 @@ import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 保险订单表
@@ -231,6 +232,12 @@ public class InsOrders implements Serializable {
     @TableField(value = "insure_time")
     private LocalDateTime insureTime;
 
+    /**
+     * 订单来源
+     */
+//    @TableField(value = "order_source")
+//    private String orderSource;
+
     @TableField(exist = false)
     private List<InsAreaCompany> insAreaCompanyList; //子级集合
 
@@ -348,7 +355,15 @@ public class InsOrders implements Serializable {
         this.setKing(JSON.parseArray(JSON.toJSONString(quoteInfoVo.getKindList())));
 
         // 2.4 产品信息
-        this.productInformation(risks, kinds);
+        if(Objects.isNull(quoteInfoVo.getProductId())) {
+            this.productInformation(risks, kinds);
+        }else{
+            this.setProductid(quoteInfoVo.getProductId());
+            this.setProduct(ProductsType.getByCode(quoteInfoVo.getProductId()).getDesc());
+        }
+        if(!Objects.isNull(quoteInfoVo.getOrderSource())){
+//            this.setOrderSource(quoteInfoVo.getOrderSource());
+        }
         this.setCreatetime(LocalDateTime.now());
 
         // 2.5 车船税信息
@@ -381,9 +396,9 @@ public class InsOrders implements Serializable {
                 this.setSystartdate(riskInfoVo.getStartDate());
                 this.setSyenddate(riskInfoVo.getEndDate());
 
-                if (kinds.isEmpty()) {
-                    throw new SystemException("商业险险种未选择,不允许报价");
-                }
+//                if (kinds.isEmpty()) {
+//                    throw new SystemException("商业险险种未选择,不允许报价");
+//                }
             }
         }
     }

+ 6 - 0
src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteInfoVo.java

@@ -27,6 +27,12 @@ public class BaseQuoteInfoVo extends YaQuoteInfoVo {
     @ApiModelProperty("是否外部订单 1 外部订单录入 ")
     private Integer isExternal;
 
+    @ApiModelProperty("产品id")
+    private String productId;
+
+    @ApiModelProperty("订单来源")
+    private String orderSource;
+
     public BaseQuoteInfoVo() {
     }
 

+ 14 - 0
src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteVo.java

@@ -1,5 +1,9 @@
 package com.ydtech.modules.order.entity.vo;
 
+import com.alibaba.fastjson.JSONArray;
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
+import com.ydtech.modules.ins.model.vo.RiskInfoVo;
+import com.ydtech.modules.order.entity.vo.guoren.GuoRenSpecialAgreementVo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -27,6 +31,12 @@ public class BaseQuoteVo<T> {
     @ApiModelProperty("驾意险")
     private T accidentalDrivingVo;
 
+    @ApiModelProperty("主险种")
+    private List<RiskInfoVo> risks;
+
+    @ApiModelProperty("商业险种")
+    private List<KindInfoVo> kinds;
+
     //add 交强转保确认码  lig  2023-05-23
     @ApiModelProperty("交强转保确认码")
     private String renewalCodeJq;
@@ -152,4 +162,8 @@ public class BaseQuoteVo<T> {
     @ApiModelProperty("是否需要验车")
     private Boolean isInspect;
 
+
+
+    @ApiModelProperty("特别约定")
+    private List<GuoRenSpecialAgreementVo> guoRenSpecialAgreementVo;
 }

+ 1 - 0
src/main/java/com/ydtech/modules/order/entity/vo/FeeOrderNewVo.java

@@ -33,6 +33,7 @@ public class FeeOrderNewVo implements Serializable {
     @ApiModelProperty("分销费用")
     private List<RetailFee> retailFee;
 
+
     /**
      * 入口费用
      */

+ 38 - 0
src/main/java/com/ydtech/modules/order/entity/vo/InsDrivingIntentionInsuranceSonVo.java

@@ -0,0 +1,38 @@
+package com.ydtech.modules.order.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+@Data
+public class InsDrivingIntentionInsuranceSonVo {
+    /**
+     * 父id
+     */
+    @TableField(value = "driving_code_id")
+    private String drivingCodeId;
+
+    /**
+     * 产品名称
+     */
+    @TableField(value = "code")
+    private String code;
+
+    /**
+     * 产品code
+     */
+    @TableField(value = "name")
+    private String name;
+
+    /**
+     * 保额
+     */
+    @TableField(value = "amount")
+    private String amount;
+
+    /**
+     * 保费
+     */
+    @TableField(value = "premium")
+    private String premium;
+
+}

+ 2 - 2
src/main/java/com/ydtech/modules/order/entity/vo/InsDrivingIntentionInsuranceVo.java

@@ -21,7 +21,7 @@ public class InsDrivingIntentionInsuranceVo {
      *  id
      */
     @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
+    private String id;
 
 
     /**
@@ -101,7 +101,7 @@ public class InsDrivingIntentionInsuranceVo {
     }
 
 
-    public InsDrivingIntentionInsuranceVo(Integer id, Integer parentId, String projectName, String projectCode, String riskCode, String seatNum, String sumAmount, String sumPremium, Boolean isDefault, Integer quantity, List<RiskInfoVo> risks, List<KindInfoVo> kinds, List<InsDrivingIntentionInsuranceVo> children, List<InsDrivingIntentionInsuranceSon> son) {
+    public InsDrivingIntentionInsuranceVo(String id, Integer parentId, String projectName, String projectCode, String riskCode, String seatNum, String sumAmount, String sumPremium, Boolean isDefault, Integer quantity, List<RiskInfoVo> risks, List<KindInfoVo> kinds, List<InsDrivingIntentionInsuranceVo> children, List<InsDrivingIntentionInsuranceSon> son) {
         this.id = id;
         this.parentId = parentId;
         this.projectName = projectName;

+ 9 - 0
src/main/java/com/ydtech/modules/order/entity/vo/InsOrdersEditingVo.java

@@ -7,9 +7,11 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ydtech.modules.ins.model.vo.AccidentResponseVo;
 import com.ydtech.modules.ins.model.vo.QuoteKindRespVo;
 import com.ydtech.modules.ins.model.vo.QuoteRiskRespVo;
+import com.ydtech.modules.order.entity.InsBusinessInsurance;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.TaxArrears;
 import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.apache.commons.lang3.ObjectUtils;
@@ -78,6 +80,9 @@ public class InsOrdersEditingVo extends InsOrders implements Serializable {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime signDate;
 
+    @ApiModelProperty("规则过滤完后的保险公司")
+    private List<PtlAgreementInsCompanyDto> companyDtos;
+
     @Data
     public static class InsAreaCompanyEditingDto implements Serializable {
 
@@ -213,6 +218,10 @@ public class InsOrdersEditingVo extends InsOrders implements Serializable {
         @ApiModelProperty("总共出口费用")
         private BigDecimal sumExportFee;
 
+        @ApiModelProperty("驾意险信息")
+        private List<InsBusinessInsurance> drivingList = new ArrayList<>();
+
+
 
         public InsAreaCompanyEditingDto(InsAreaCompanyQueryDto insAreaCompany) {
             this.orderno = insAreaCompany.getOrderno();

+ 3 - 0
src/main/java/com/ydtech/modules/order/entity/vo/OrderVo.java

@@ -504,6 +504,9 @@ public class OrderVo implements Serializable {
     @ApiModelProperty(value = "机构来源(渠道、个代)")
     private String source;
 
+    @ApiModelProperty(value = "驾意险名称")
+    private String jyName;
+
     @ApiModelProperty(value = "核保原因")
     private String underwritingReason;
 

+ 7 - 0
src/main/java/com/ydtech/modules/order/service/GuorenOrderApiService.java

@@ -29,6 +29,13 @@ public interface GuorenOrderApiService {
      */
     HttpResult<List<GuoRenSpecialAgreement>> queryClauseData(String agreementId);
 
+    /**
+     * 特约查询 根据公司id
+     * @param companyId
+     * @return
+     */
+    HttpResult<List<GuoRenSpecialAgreement>> queryClauseDataCompanyId(String companyId);
+
     /**
      * 2 报价
      */

+ 24 - 0
src/main/java/com/ydtech/modules/order/service/InsBusinessInsuranceService.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.InsBusinessInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
+import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
+import com.ydtech.modules.order.entity.vo.NoCarInsuranceQueryVo;
+import com.ydtech.modules.scheme.entity.vo.DrivingIntentionQueryVo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Service
+ */
+public interface InsBusinessInsuranceService extends IService<InsBusinessInsurance> {
+
+    /**
+     * 获取所有商业险种信息
+     * @return
+     */
+    List<InsBusinessInsurance> getBusinessInsurance();
+}

+ 22 - 0
src/main/java/com/ydtech/modules/order/service/InsDrivingIntentionInsuranceService.java

@@ -3,8 +3,10 @@ package com.ydtech.modules.order.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
 import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
 import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
 import com.ydtech.modules.order.entity.vo.NoCarInsuranceQueryVo;
+import com.ydtech.modules.scheme.entity.vo.DrivingIntentionQueryVo;
 
 import java.util.List;
 import java.util.Map;
@@ -45,6 +47,11 @@ public interface InsDrivingIntentionInsuranceService extends IService<InsDriving
      * @return
      */
     List<InsDrivingIntentionInsuranceSon> getInsDrivingIntentionInsuranceSon(String companyId,String drivingCodeId);
+
+
+
+    List<InsDrivingIntentionInsurance> getInsDrivingIntentionInsurance(String companyId,String drivingCodeId);
+
     /**
      *  @version
      *  @author: hxl
@@ -52,4 +59,19 @@ public interface InsDrivingIntentionInsuranceService extends IService<InsDriving
      *  @Description:  获取平安的驾意外险信息
      */
     Map<String, List<InsDrivingIntentionInsuranceVo>> getPingAnDrivingInsuranceRule(NoCarInsuranceQueryVo insuranceQueryVo);
+
+    /**
+     * 获取方案的驾意险信息列表
+     * @param drivingIntentionQueryVo
+     * @return
+     */
+//    List<InsDrivingIntentionInsurance> getSchemeDrivingIntentionInsurance(DrivingIntentionQueryVo drivingIntentionQueryVo);
+    List<InsDrivingIntentionInsurance> getSchemeDrivingIntentionInsurance(DrivingIntentionQueryVo drivingIntentionQueryVo);
+
+    /**
+     * 获取方案的驾意险分类
+     * @param companyId
+     * @return
+     */
+    List<InsDrivingIntentionInsuranceType> getSchemeDrivingIntentionInsuranceType(String companyId);
 }

+ 12 - 0
src/main/java/com/ydtech/modules/order/service/InsDrivingIntentionInsuranceTypeCompanyService.java

@@ -0,0 +1,12 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceTypeCompany;
+
+/**
+ * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Service
+ */
+public interface InsDrivingIntentionInsuranceTypeCompanyService extends IService<InsDrivingIntentionInsuranceTypeCompany> {
+
+}

+ 20 - 0
src/main/java/com/ydtech/modules/order/service/InsDrivingIntentionInsuranceTypeService.java

@@ -0,0 +1,20 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
+import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
+import com.ydtech.modules.order.entity.vo.NoCarInsuranceQueryVo;
+import com.ydtech.modules.scheme.entity.vo.DrivingIntentionQueryVo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Service
+ */
+public interface InsDrivingIntentionInsuranceTypeService extends IService<InsDrivingIntentionInsuranceType> {
+
+    List<InsDrivingIntentionInsuranceType> getDrivingIntentionInsuranceTypeByCompanyId(String companyId);
+}

+ 5 - 0
src/main/java/com/ydtech/modules/order/service/InsOrdersService.java

@@ -67,6 +67,8 @@ public interface InsOrdersService extends IService<InsOrders> {
     InsOrders generateOrder(SysUser user, BaseQuoteInfoVo quoteInfoVo);
 
 
+
+
     BasePageResult<InsOrders> newQueryPageOrder(OrderQueryVo orderQueryVo);
 
     /**
@@ -100,6 +102,9 @@ public interface InsOrdersService extends IService<InsOrders> {
      */
     InsOrdersEditingVo revise(String orderNo);
 
+
+    InsOrdersEditingVo reviseApp(String orderNo);
+
     /**
      * 验证近期是否出过单子
      *

+ 41 - 1
src/main/java/com/ydtech/modules/order/service/impl/GuorenOrderApiServiceImpl.java

@@ -3,6 +3,7 @@ package com.ydtech.modules.order.service.impl;
 import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ydtech.config.properties.GuorenApiConfigurationProperties;
 import com.ydtech.constants.enums.InsurKind;
 import com.ydtech.constants.enums.InsurKindGuoRen;
@@ -177,6 +178,45 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
         return HttpResult.ok(list);
     }
 
+    @Override
+    public HttpResult<List<GuoRenSpecialAgreement>> queryClauseDataCompanyId(String companyId) {
+        // 获取协议配置信息
+        String specialAgreementKey = GR_SPECIAL_AGREEMENT_KEY + companyId;
+
+        // 从缓存中获取数据
+        String info = redisTemplate.opsForValue().get(specialAgreementKey);
+        if (!StringUtils.isEmpty(info)) {
+            List<GuoRenSpecialAgreement> list = JSON.parseArray(info, GuoRenSpecialAgreement.class);
+            return HttpResult.ok(list);
+        }
+        //挑选一个国任的协议
+        List<PtlAgreementAttribution> list1 = ptlAgreementAttributionService.list(new LambdaQueryWrapper<PtlAgreementAttribution>().eq(PtlAgreementAttribution::getInsCompanyId, companyId));
+
+        ChannelInfoDto channelInfo = gainChannelConfigInfo(list1.get(0).getId());
+        List<GuoRenSpecialAgreement> list = new ArrayList<>();
+        for (InsuranceRisk insuranceRisk : InsuranceRisk.getInsuranceRisk()) {
+            String riskCode = GuoRenRiskCode.toInsuranceRisk(insuranceRisk.getCode());
+            SpecialAgreementRequest specialAgreementRequest = new SpecialAgreementRequest(channelInfo.getComCode(),
+                    riskCode);
+            SpecialAgreementResponse response = guorenRequestApiComponent.request(specialAgreementRequest,
+                    PlatformInterfaceCode.API_IIRBT00005, SpecialAgreementResponse.class);
+
+            AssertionUtils.isFail("1".equals(response.getResultCode().toString()), response.getResultMsg());
+
+            List<GuoRenSpecialAgreement> collect =
+                    response.getData().stream().map(x -> new GuoRenSpecialAgreement(x, insuranceRisk)).collect(Collectors.toList());
+            list.addAll(collect);
+        }
+
+        // 数据存入缓存
+        if (!list.isEmpty()) {
+            redisTemplate.opsForValue().set(specialAgreementKey, JSON.toJSONString(list), GR_SPECIAL_AGREEMENT_TIME,
+                    TimeUnit.DAYS);
+        }
+
+        return HttpResult.ok(list);
+    }
+
     /**
      * 2 报价-
      */
@@ -185,7 +225,7 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
         log.debug("--------报价开始,订单号:{},协议号:{}--------------", quoteVo.getOrderNo(), quoteVo.getAgreementId());
         // 获取协议配置信息
         ChannelInfoDto channelInfo = gainChannelConfigInfo(quoteVo.getAgreementId());
-        BaseQuoteInfoVo yaQuoteInfoVo = insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo());
+        BaseQuoteInfoVo yaQuoteInfoVo = insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(),quoteVo.getKinds());
         InsOrders order = insOrdersService.getById(yaQuoteInfoVo.getOrderNo());
         CarInfoVo carInfo = yaQuoteInfoVo.getCarInfo();
 

+ 46 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsBusinessInsuranceServiceImpl.java

@@ -0,0 +1,46 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.constants.enums.InsuranceRisk;
+import com.ydtech.constants.enums.dict.agreement.ProductsType;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.order.dao.InsBusinessInsuranceMapper;
+import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceMapper;
+import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceSonMapper;
+import com.ydtech.modules.order.entity.InsBusinessInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
+import com.ydtech.modules.order.entity.PtlAgreementNonCarProductRule;
+import com.ydtech.modules.order.entity.api.pingan.request.ProductDetailsRequest;
+import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
+import com.ydtech.modules.order.entity.vo.NoCarInsuranceQueryVo;
+import com.ydtech.modules.order.service.*;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
+import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.scheme.entity.vo.DrivingIntentionQueryVo;
+import com.ydtech.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * 驾意险服务实现类
+ */
+@Service
+public class InsBusinessInsuranceServiceImpl extends ServiceImpl<InsBusinessInsuranceMapper, InsBusinessInsurance>
+        implements InsBusinessInsuranceService {
+
+    @Override
+    public List<InsBusinessInsurance> getBusinessInsurance() {
+        return baseMapper.getBusinessInsurance();
+    }
+}

+ 6 - 2
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -307,8 +307,12 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
             kind.setKindCode(kindInfoVo.getKindCode());
             kind.setKindName(kindInfoVo.getKindName());
 
-            kind.setCoveragePremium(map.get(kindInfoVo.getKindCode()));
-            kind.setUnitAmount(kindInfoVo.getUnitAmount());
+            if(map.get(kindInfoVo.getKindCode()) != null) {
+                kind.setCoveragePremium(map.get(kindInfoVo.getKindCode()));
+                kind.setUnitAmount(kindInfoVo.getUnitAmount());
+            }else{
+                kind.setServiceTimes(String.valueOf(kindInfoVo.getServiceTimes()));
+            }
 
             if (InsurKind.A.getCode().equals(kindInfoVo.getKindCode())) {
                 kind.setAmount(map.get("A_amount"));

+ 145 - 11
src/main/java/com/ydtech/modules/order/service/impl/InsDrivingIntentionInsuranceServiceImpl.java

@@ -7,26 +7,29 @@ import com.ydtech.constants.enums.dict.agreement.ProductsType;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceMapper;
 import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceSonMapper;
-import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
-import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
-import com.ydtech.modules.order.entity.PtlAgreementNonCarProductRule;
+import com.ydtech.modules.order.entity.*;
 import com.ydtech.modules.order.entity.api.pingan.request.ProductDetailsRequest;
 import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
 import com.ydtech.modules.order.entity.vo.NoCarInsuranceQueryVo;
-import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceService;
-import com.ydtech.modules.order.service.PingAnOrderApiService;
-import com.ydtech.modules.order.service.PtlAgreementNonCarProductRuleService;
+import com.ydtech.modules.order.service.*;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalScheme;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalSchemeInsuranceDrivingIntention;
+import com.ydtech.modules.scheme.service.PtlOptionalSchemeInsuranceDrivingIntentionService;
+import com.ydtech.modules.scheme.service.PtlOptionalSchemeService;
 import com.ydtech.utils.StringUtils;
+import com.ydtech.modules.scheme.entity.vo.DrivingIntentionQueryVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -52,6 +55,18 @@ public class InsDrivingIntentionInsuranceServiceImpl extends ServiceImpl<InsDriv
     @Autowired
     private PingAnOrderApiService pingAnOrderApiService;
 
+    @Autowired
+    private InsDrivingIntentionInsuranceTypeCompanyService insDrivingIntentionInsuranceTypeCompanyService;
+
+    @Autowired
+    private InsDrivingIntentionInsuranceTypeService insDrivingIntentionInsuranceTypeService;
+
+    @Autowired
+    private PtlOptionalSchemeInsuranceDrivingIntentionService ptlOptionalSchemeInsuranceDrivingIntentionService;
+
+    @Autowired
+    private PtlOptionalSchemeService ptlOptionalSchemeService;
+
     /**
      * 根据查询条件获取驾意险信息
      *
@@ -176,11 +191,24 @@ public class InsDrivingIntentionInsuranceServiceImpl extends ServiceImpl<InsDriv
 
     @Override
     public List<InsDrivingIntentionInsuranceSon> getInsDrivingIntentionInsuranceSon(String companyId, String drivingCodeId) {
-        List<InsDrivingIntentionInsuranceSon> insDrivingIntentionInsuranceSons = sonMapper.selectList(new LambdaQueryWrapper<InsDrivingIntentionInsuranceSon>()
-                .eq(InsDrivingIntentionInsuranceSon::getCompanyId, companyId)
-                .and(wrapper -> wrapper.eq(InsDrivingIntentionInsuranceSon::getCode, drivingCodeId)
-                        .or()
-                        .eq(InsDrivingIntentionInsuranceSon::getDrivingCodeId, drivingCodeId)));
+        List<InsDrivingIntentionInsuranceSon> insDrivingIntentionInsuranceSons = sonMapper.selectList(
+                new LambdaQueryWrapper<InsDrivingIntentionInsuranceSon>()
+                        .eq(InsDrivingIntentionInsuranceSon::getCompanyId, companyId)
+                        .and(wrapper -> wrapper.eq(InsDrivingIntentionInsuranceSon::getCode, drivingCodeId)
+                                .or()
+                                .eq(InsDrivingIntentionInsuranceSon::getDrivingCodeId, drivingCodeId)));
+        return insDrivingIntentionInsuranceSons;
+    }
+
+
+    @Override
+    public List<InsDrivingIntentionInsurance> getInsDrivingIntentionInsurance(String companyId, String drivingCodeId) {
+        List<InsDrivingIntentionInsurance> insDrivingIntentionInsuranceSons = baseMapper.selectList(
+                new LambdaQueryWrapper<InsDrivingIntentionInsurance>()
+                        .eq(InsDrivingIntentionInsurance::getCompanyId, companyId)
+                        .and(wrapper -> wrapper.eq(InsDrivingIntentionInsurance::getProjectCode, drivingCodeId)
+                                .or()
+                                .eq(InsDrivingIntentionInsurance::getRiskCode, drivingCodeId)));
         return insDrivingIntentionInsuranceSons;
     }
     /**
@@ -226,4 +254,110 @@ public class InsDrivingIntentionInsuranceServiceImpl extends ServiceImpl<InsDriv
         Map<String, List<InsDrivingIntentionInsuranceVo>> insDrivingIntentionInsuranceVos = pingAnOrderApiService.productQueryList(productDetailsRequest);
         return insDrivingIntentionInsuranceVos;
     }
+
+    /**
+     * 获取方案的驾意险信息列表
+     * @param drivingIntentionQueryVo
+     * @return
+     */
+//    @Override
+//    public List<InsDrivingIntentionInsurance> getSchemeDrivingIntentionInsurance(DrivingIntentionQueryVo drivingIntentionQueryVo){
+//        LambdaQueryWrapper<InsDrivingIntentionInsurance> queryWrapper = new LambdaQueryWrapper<>();
+//        //保险公司id
+//        queryWrapper.eq(InsDrivingIntentionInsurance::getCompanyId, drivingIntentionQueryVo.getCompanyId());
+//
+//        //座位数
+//        if(! drivingIntentionQueryVo.getSeatNum().equals("0")){
+//            queryWrapper.eq(InsDrivingIntentionInsurance::getSeatNum, drivingIntentionQueryVo.getSeatNum());
+//        }
+//
+//        List<InsDrivingIntentionInsurance> list = this.list(queryWrapper);
+//        return list;
+//    }
+
+    @Override
+    public List<InsDrivingIntentionInsurance> getSchemeDrivingIntentionInsurance(DrivingIntentionQueryVo drivingIntentionQueryVo){
+        LambdaQueryWrapper<InsDrivingIntentionInsurance> queryWrapper = new LambdaQueryWrapper<>();
+        //保险公司id
+        queryWrapper.eq(InsDrivingIntentionInsurance::getCompanyId, drivingIntentionQueryVo.getCompanyId());
+
+        //座位数
+        if(!Objects.isNull(drivingIntentionQueryVo.getSeatNum())){
+            queryWrapper.eq(InsDrivingIntentionInsurance::getSeatNum, drivingIntentionQueryVo.getSeatNum());
+        }
+
+        if(!Objects.isNull(drivingIntentionQueryVo.getDrivingIntentionIds())){
+            queryWrapper.in(InsDrivingIntentionInsurance::getId,drivingIntentionQueryVo.getDrivingIntentionIds());
+        }
+
+        //自选方案
+        if(!Objects.isNull(drivingIntentionQueryVo.getProductId())){
+            PtlOptionalScheme ptlOptionalScheme = ptlOptionalSchemeService.getOne(new LambdaQueryWrapper<PtlOptionalScheme>()
+                    .eq(PtlOptionalScheme::getCompanyId, drivingIntentionQueryVo.getCompanyId())
+                    .eq(PtlOptionalScheme::getProductId, drivingIntentionQueryVo.getProductId())
+                    .eq(PtlOptionalScheme::getEnergyType,drivingIntentionQueryVo.getEnergyType())
+                    .eq(PtlOptionalScheme::getVehicleType,drivingIntentionQueryVo.getVehicleType())
+                    .eq(PtlOptionalScheme::getCarnature,drivingIntentionQueryVo.getCarnature()));
+            LambdaQueryWrapper<PtlOptionalSchemeInsuranceDrivingIntention> eq = new LambdaQueryWrapper<PtlOptionalSchemeInsuranceDrivingIntention>()
+                    .eq(PtlOptionalSchemeInsuranceDrivingIntention::getSchemeId, ptlOptionalScheme.getId());
+            List<PtlOptionalSchemeInsuranceDrivingIntention> list = ptlOptionalSchemeInsuranceDrivingIntentionService.list(eq);
+            List<String> collect = list.stream().map(x -> x.getDrivingIntentionId()).collect(Collectors.toList());
+            if(collect.isEmpty()){
+                throw new SystemException("自选方案驾意险为空");
+            }
+            drivingIntentionQueryVo.setDrivingIntentionIds(collect);
+            drivingIntentionQueryVo.setParentId(collect);
+        }
+
+        List<InsDrivingIntentionInsurance> insDrivingIntentionInsurances = new ArrayList<>();
+        List<InsDrivingIntentionInsurance> list = baseMapper.getInsDrivingIntentionInsuranceList(drivingIntentionQueryVo);
+        if(!list.isEmpty()) {
+            //处理父级
+            if (list.get(0).getParentId() != null && list.get(0).getParentId() != 0) {
+                List<String> parentIds = list.stream().map(x -> x.getParentId().toString()).collect(Collectors.toList());
+                LambdaQueryWrapper<InsDrivingIntentionInsurance> queryWrapper1 = new LambdaQueryWrapper<>();
+                queryWrapper1.eq(InsDrivingIntentionInsurance::getCompanyId, drivingIntentionQueryVo.getCompanyId())
+                        .in(InsDrivingIntentionInsurance::getId, parentIds);
+                List<InsDrivingIntentionInsurance> parentInsurance = baseMapper.selectList(queryWrapper1);
+                list.addAll(parentInsurance);
+            }
+            insDrivingIntentionInsurances = this.buildHierarchy(list);
+        }
+
+        return insDrivingIntentionInsurances;
+    }
+
+    @Override
+    public List<InsDrivingIntentionInsuranceType> getSchemeDrivingIntentionInsuranceType(String companyId) {
+        return baseMapper.getSchemeDrivingIntentionInsuranceType(companyId);
+    }
+
+
+    public List<InsDrivingIntentionInsurance> buildHierarchy(List<InsDrivingIntentionInsurance> list) {
+        // 使用 Map 存储所有的对象,key 是 id,value 是对象本身
+        Map<String, InsDrivingIntentionInsurance> map = list.stream()
+                .collect(Collectors.toMap(InsDrivingIntentionInsurance::getId, Function.identity()));
+
+        // 创建一个根节点列表
+        List<InsDrivingIntentionInsurance> rootNodes = new ArrayList<>();
+
+        // 遍历所有对象,将每个对象添加到其父节点的子节点列表中
+        for (InsDrivingIntentionInsurance item : list) {
+            if (item.getParentId() == 0) {
+                // 没有父节点,说明是根节点
+                rootNodes.add(item);
+            } else {
+                // 有父节点,找到父节点并添加到其子节点列表中
+                InsDrivingIntentionInsurance parent = map.get(item.getParentId().toString());
+                if (parent != null) {
+                    if(parent.getInsDrivingIntentionInsurances() ==  null){
+                        parent.setInsDrivingIntentionInsurances(new ArrayList<>());
+                    }
+                    parent.getInsDrivingIntentionInsurances().add(item);
+                }
+            }
+        }
+
+        return rootNodes;
+    }
 }

+ 19 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsDrivingIntentionInsuranceTypeCompanyServiceImpl.java

@@ -0,0 +1,19 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceTypeCompanyMapper;
+import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceTypeMapper;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceTypeCompany;
+import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceTypeCompanyService;
+import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceTypeService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 驾意险服务实现类
+ */
+@Service
+public class InsDrivingIntentionInsuranceTypeCompanyServiceImpl extends ServiceImpl<InsDrivingIntentionInsuranceTypeCompanyMapper, InsDrivingIntentionInsuranceTypeCompany>
+        implements InsDrivingIntentionInsuranceTypeCompanyService {
+
+}

+ 118 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsDrivingIntentionInsuranceTypeServiceImpl.java

@@ -0,0 +1,118 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.constants.enums.InsuranceRisk;
+import com.ydtech.constants.enums.dict.agreement.ProductsType;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceMapper;
+import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceSonMapper;
+import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceTypeMapper;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
+import com.ydtech.modules.order.entity.PtlAgreementNonCarProductRule;
+import com.ydtech.modules.order.entity.api.pingan.request.ProductDetailsRequest;
+import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
+import com.ydtech.modules.order.entity.vo.NoCarInsuranceQueryVo;
+import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceService;
+import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceTypeService;
+import com.ydtech.modules.order.service.PingAnOrderApiService;
+import com.ydtech.modules.order.service.PtlAgreementNonCarProductRuleService;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
+import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.scheme.entity.vo.DrivingIntentionQueryVo;
+import com.ydtech.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * 驾意险服务实现类
+ */
+@Service
+public class InsDrivingIntentionInsuranceTypeServiceImpl extends ServiceImpl<InsDrivingIntentionInsuranceTypeMapper, InsDrivingIntentionInsuranceType>
+        implements InsDrivingIntentionInsuranceTypeService {
+
+    @Autowired
+    private InsDrivingIntentionInsuranceTypeService insDrivingIntentionInsuranceTypeService;
+
+    @Override
+    public List<InsDrivingIntentionInsuranceType> getDrivingIntentionInsuranceTypeByCompanyId(String companyId) {
+        List<InsDrivingIntentionInsuranceType> typeList = insDrivingIntentionInsuranceTypeService.list();
+        typeList = this.buildType(typeList);
+        List<InsDrivingIntentionInsuranceType> drivingIntentionInsuranceTypeByCompanyId = baseMapper.getDrivingIntentionInsuranceTypeByCompanyId(companyId);
+        List<InsDrivingIntentionInsuranceType> resultTypeList = this.filterType(typeList, drivingIntentionInsuranceTypeByCompanyId);
+        return resultTypeList;
+    }
+
+    /**
+     * 递归查找父节点
+     * @param list
+     * @return
+     */
+    public List<InsDrivingIntentionInsuranceType> buildType(List<InsDrivingIntentionInsuranceType> list) {
+        Map<String, InsDrivingIntentionInsuranceType> map = list.stream()
+                .collect(Collectors.toMap(InsDrivingIntentionInsuranceType::getId, Function.identity()));
+
+        // 创建一个根节点列表
+        List<InsDrivingIntentionInsuranceType> rootNodes = new ArrayList<>();
+
+        for (InsDrivingIntentionInsuranceType item : list) {
+            if (item.getParentId() == 0) {
+                // parent_id 为 0,说明是根节点
+                rootNodes.add(item);
+            } else {
+                // 有父节点,找到父节点并添加到其子节点列表中
+                InsDrivingIntentionInsuranceType parent = map.get(item.getParentId().toString());
+                if (parent != null) {
+                    if (parent.getChildren() == null) {
+                        parent.setChildren(new ArrayList<>());
+                    }
+                    parent.getChildren().add(item);
+                }
+            }
+        }
+
+        return rootNodes;
+    }
+
+    /**
+     * 过滤节点
+     * @param node          全部类型
+     * @param lastLevelMap  最后一级id集合
+     * @return
+     */
+    private InsDrivingIntentionInsuranceType filterNode(InsDrivingIntentionInsuranceType node, Map<String, InsDrivingIntentionInsuranceType> lastLevelMap) {
+        if (node.getChildren() == null || node.getChildren().isEmpty()) {
+            return lastLevelMap.getOrDefault(node.getId(), null);
+        } else {
+            List<InsDrivingIntentionInsuranceType> filteredChildren = node.getChildren().stream()
+                    .map(child -> filterNode(child, lastLevelMap))
+                    .filter(Objects::nonNull)
+                    .collect(Collectors.toList());
+
+            if (filteredChildren.isEmpty() && !lastLevelMap.containsKey(node.getId())) {
+                return null;
+            } else {
+                node.setChildren(filteredChildren);
+                return node;
+            }
+        }
+    }
+
+    public List<InsDrivingIntentionInsuranceType> filterType(List<InsDrivingIntentionInsuranceType> hierarchy, List<InsDrivingIntentionInsuranceType> lastLevelList) {
+        Map<String, InsDrivingIntentionInsuranceType> lastLevelMap = lastLevelList.stream()
+                .collect(Collectors.toMap(InsDrivingIntentionInsuranceType::getId, Function.identity()));
+
+        return hierarchy.stream()
+                .map(node -> filterNode(node, lastLevelMap))
+                .filter(Objects::nonNull)
+                .collect(Collectors.toList());
+    }
+}

+ 187 - 3
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -73,6 +73,9 @@ import com.ydtech.modules.protocols.entity.vo.AgreementProductCostsSave;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
 import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesAttrService;
+import com.ydtech.modules.scheme.entity.vo.RuleFilterVo;
+import com.ydtech.modules.scheme.service.PtlSchemeRulesService;
+import com.ydtech.modules.scheme.service.RuleFilteringService;
 import com.ydtech.utils.SnowFlakeUtil;
 import com.ydtech.utils.idgen.IdGenerate;
 import org.apache.commons.lang3.StringUtils;
@@ -170,6 +173,12 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
     @Autowired
     private InsAreaCompanyExternalPolicyService insAreaCompanyExternalPolicyService;
 
+    @Autowired
+    private PtlSchemeRulesService ptlSchemeRulesService;
+
+    @Autowired
+    private InsBusinessInsuranceService insBusinessInsuranceService;
+
 
     public InsOrdersServiceImpl(OrderComponents orderComponents, SysUserService sysUserService,
                                 SysUserRoleService sysUserRoleService,
@@ -265,7 +274,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
     }
 
     /**
-     * @param user        当前登录人
+     * @param sysUser        当前登录人
      * @param quoteInfoVo 报价信息
      * @return
      */
@@ -345,10 +354,16 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
 
         String licenseNo = quoteInfoVo.getCarInfo().getLicenseNo();
 
+        String productId = quoteInfoVo.getProductId();
+
         if (StringUtils.isNotEmpty(licenseNo) && !licenseNo.equals(insOrders1.getLicenseno())) {
             throw new SystemException("1001", "车牌与此订单不符,请重新录单");
         }
 
+        if(StringUtils.isNotEmpty(productId) && !productId.equals(insOrders1.getProductid())){
+            throw new SystemException("1001", "产品类型不符,请重新录单");
+        }
+
         // 3 订单操作
         if (!realUserId.equals(insOrders1.getUserid()) || StringUtils.isEmpty(quoteInfoVo.getOrderNo())) {
             // 存入订单
@@ -525,8 +540,6 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                         insOrdersExcel.setJyPolicyno(policyNumber);
                     }
                 }
-
-
             }
 
             // 设置险种信息
@@ -725,7 +738,20 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 insDrivingIntentionInsuranceSon.get(0).setPremium(orderAndAreaCompany.getJypremium().toString());
             }
             JSONArray accidentInfo = JSON.parseArray(JSON.toJSONString(insDrivingIntentionInsuranceSon));
+            if(accidentInfo.isEmpty()){
+                InsDrivingIntentionInsurance one = insDrivingIntentionInsuranceService.getOne(new LambdaQueryWrapper<InsDrivingIntentionInsurance>()
+                        .eq(InsDrivingIntentionInsurance::getProjectCode, insAreaCompanyAccidentalDriving.getRideRiskCode())
+                        .or()
+                        .eq(InsDrivingIntentionInsurance::getRiskCode, insAreaCompanyAccidentalDriving.getRideRiskCode()));
+                if(!Objects.isNull(one)){
+                    JSONObject accidentInfoObject = new JSONObject();
+                    accidentInfoObject.put("name",one.getProjectName());
+                    accidentInfoObject.put("premium",orderAndAreaCompany.getJypremium());
+                    accidentInfo.add(accidentInfoObject);
+                }
+            }
             orderAndAreaCompany.setAccidentInfo(accidentInfo);
+            orderAndAreaCompany.setJyName(insAreaCompanyAccidentalDriving.getRideRiskName());
         } else {
             orderAndAreaCompany.setAccidentInfo(new JSONArray());
         }
@@ -766,6 +792,159 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 insAreaCompanyService.lambdaQuery().eq(InsAreaCompany::getOrderno, orderNo).orderByDesc(InsAreaCompany::getCreatetime).list();
         insOrders.setInsAreaCompanyList(insAreaCompanyList);
         InsOrdersEditingVo insOrdersEditingVo = new InsOrdersEditingVo();
+        InsAreaCompanyExternalFee insAreaCompanyExternalFee = null;
+        BeanUtils.copyProperties(insOrders, insOrdersEditingVo);
+        List<InsBusinessInsurance> businessInsurance = insBusinessInsuranceService.getBusinessInsurance();
+        for(int i=0;i<insOrdersEditingVo.getKing().size();i++){
+            int finalI = i;
+            InsBusinessInsurance insurance = businessInsurance.stream().filter(x -> x.getKindCode()
+                    .equals(insOrdersEditingVo.getKing().getJSONObject(finalI).getString("kindCode"))).findFirst().orElse(null);
+            if(!Objects.isNull(insurance)){
+                insOrdersEditingVo.getKing().getJSONObject(i).put("grouping",insurance.getGrouping());
+            }
+        }
+        //如果是外部订单才回显这些数据
+        if (insAreaCompanyList.size() > 0 && insOrders.getIsExternal() == 1) {
+            insAreaCompanyExternalFee = insAreaCompanyExternalFeeService.getById(insAreaCompanyList.get(0).getId());
+            insOrdersEditingVo.setSigningTime(insAreaCompanyList.get(0).getSigningTime());
+            insOrdersEditingVo.setJqpremium(insAreaCompanyList.get(0).getJqpremium().compareTo(BigDecimal.ZERO) == 0 ? "" : insAreaCompanyList.get(0).getJqpremium().toString());
+            insOrdersEditingVo.setSypremium(insAreaCompanyList.get(0).getSypremium().compareTo(BigDecimal.ZERO) == 0 ? "" : insAreaCompanyList.get(0).getSypremium().toString());
+            insOrdersEditingVo.setJypremium(insAreaCompanyList.get(0).getJypremium().compareTo(BigDecimal.ZERO) == 0 ? "" : insAreaCompanyList.get(0).getJypremium().toString());
+            insOrdersEditingVo.setTaxamount(insAreaCompanyList.get(0).getTaxamount().toString());
+            insOrdersEditingVo.setJqpolicyno(insAreaCompanyList.get(0).getJqpolicyno());
+            insOrdersEditingVo.setSypolicyno(insAreaCompanyList.get(0).getSypolicyno());
+
+            insOrdersEditingVo.setScore(insAreaCompanyList.get(0).getScore());
+            insOrdersEditingVo.setJqRenewal(insAreaCompanyList.get(0).getJqRenewal());
+            insOrdersEditingVo.setSyRenewal(insAreaCompanyList.get(0).getSyRenewal());
+            //设置签单时间和非车保单号
+            insOrdersEditingVo.setSignDate(insAreaCompanyList.get(0).getSigningTime());
+            JSONArray crossInsurance = insAreaCompanyList.get(0).getCrossInsurance();
+            String application = "";
+            if (crossInsurance != null && crossInsurance.size() > 0) {
+                application = crossInsurance.getJSONObject(0).getString("application");
+            }
+            insOrdersEditingVo.setJypolicyno(application);
+
+            InsAreaCompanyExternalPolicy policyByCompanyId = insAreaCompanyExternalPolicyService.getPolicyByCompanyId(insAreaCompanyList.get(0).getId());
+//            insOrdersEditingVo.setExternalPolicy(policyByCompanyId);
+
+            List<InsAreaCompanyExternalPolicyVo> jqPolictList = new ArrayList<>();
+            if (policyByCompanyId != null) {
+                if (policyByCompanyId.getJqPolicy() != null && !policyByCompanyId.getJqPolicy().equals("")) {
+                    InsAreaCompanyExternalPolicyVo jqPolict = new InsAreaCompanyExternalPolicyVo();
+                    jqPolict.setUrl(policyByCompanyId.getJqPolicy());
+                    jqPolict.setName(policyByCompanyId.getJqPolicy().replaceAll("/", "_"));
+                    jqPolictList.add(jqPolict);
+                }
+                insOrdersEditingVo.setJqPolicyList(jqPolictList);
+
+                List<InsAreaCompanyExternalPolicyVo> syPolictList = new ArrayList<>();
+                if (policyByCompanyId.getSyPolicy() != null && !policyByCompanyId.getSyPolicy().equals("")) {
+                    InsAreaCompanyExternalPolicyVo syPolict = new InsAreaCompanyExternalPolicyVo();
+                    syPolict.setUrl(policyByCompanyId.getSyPolicy());
+                    syPolict.setName(policyByCompanyId.getSyPolicy().replaceAll("/", "_"));
+                    syPolictList.add(syPolict);
+                }
+                insOrdersEditingVo.setSyPolicyList(syPolictList);
+
+                List<InsAreaCompanyExternalPolicyVo> noPolictList = new ArrayList<>();
+                if (policyByCompanyId.getNoPolicy() != null && !policyByCompanyId.getNoPolicy().equals("")) {
+                    InsAreaCompanyExternalPolicyVo noPolict = new InsAreaCompanyExternalPolicyVo();
+                    noPolict.setUrl(policyByCompanyId.getNoPolicy());
+                    noPolict.setName(policyByCompanyId.getNoPolicy().replaceAll("/", "_"));
+                    noPolictList.add(noPolict);
+                }
+                insOrdersEditingVo.setNoPolicyList(noPolictList);
+
+                List<InsAreaCompanyExternalPolicyVo> jqSignList = new ArrayList<>();
+                if (policyByCompanyId.getJqSign() != null && !policyByCompanyId.getJqSign().equals("")) {
+                    InsAreaCompanyExternalPolicyVo jqSign = new InsAreaCompanyExternalPolicyVo();
+                    jqSign.setUrl(policyByCompanyId.getJqSign());
+                    jqSign.setName(policyByCompanyId.getJqSign().replaceAll("/", "_"));
+                    jqSignList.add(jqSign);
+                }
+                insOrdersEditingVo.setJqSignList(jqSignList);
+            }
+        }
+
+        List<InsAreaCompanyQueryDto> insAreaCompanyQueryDtos = insAreaCompanyService.getByOrderNo(orderNo);
+        List<InsOrdersEditingVo.InsAreaCompanyEditingDto> insAreaCompanyEditingDtos =
+                insAreaCompanyQueryDtos.stream().map(InsOrdersEditingVo.InsAreaCompanyEditingDto::new).collect(Collectors.toList());
+
+        List<String> companyIds = insAreaCompanyEditingDtos.stream().map(x -> x.getCompanyId()).collect(Collectors.toList());
+
+
+        List<InsFeeOrderNew> insFeeOrderNews = new ArrayList<>();
+        if (!companyIds.isEmpty()) {
+            insFeeOrderNews = insFeeOrderNewService.getInsFeeOrderNewListByCompanyId(companyIds);
+        }
+
+        if (insFeeOrderNews.size() > 0 && insAreaCompanyExternalFee != null) {
+            if (insFeeOrderNews.get(0).getJqCostsProportion().compareTo(BigDecimal.ZERO) > 0 ||
+                    insFeeOrderNews.get(0).getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
+                insOrdersEditingVo.setJqCostsProportion(insAreaCompanyExternalFee.getJqSuperviseCostsProportion().add(insAreaCompanyExternalFee.getJqOtherCostsProportion()));
+            }
+            if (insFeeOrderNews.get(0).getSyCostsProportion().compareTo(BigDecimal.ZERO) > 0 ||
+                    insFeeOrderNews.get(0).getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
+                insOrdersEditingVo.setSyCostsProportion(insAreaCompanyExternalFee.getSySuperviseCostsProportion().add(insAreaCompanyExternalFee.getSyOtherCostsProportion()));
+            }
+            if (insFeeOrderNews.get(0).getNoCostsProportion().compareTo(BigDecimal.ZERO) > 0 ||
+                    insFeeOrderNews.get(0).getNoOtherCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
+                insOrdersEditingVo.setNoCostsProportion(insAreaCompanyExternalFee.getNoSuperviseCostsProportion().add(insAreaCompanyExternalFee.getNoOtherCostsProportion()));
+            }
+        }
+
+        //计算费用
+        insFeeOrderNews.forEach(insFeeOrderNew -> {
+            SubOrderExportFeeVo subOrderExportFeeVo = costsCalcService.getExportFee(insFeeOrderNew);
+            insAreaCompanyEditingDtos.stream().filter(x -> x.getCompanyId().equals(insFeeOrderNew.getInsOrderNo())).findFirst().ifPresent(result -> {
+                result.setJqExportFee(subOrderExportFeeVo.getJqExportCosts());
+                result.setSyExportFee(subOrderExportFeeVo.getSyExportCosts());
+                result.setNoExportFee(subOrderExportFeeVo.getNoExportCosts());
+                result.setSumExportFee(subOrderExportFeeVo.getJqExportCosts()
+                        .add(subOrderExportFeeVo.getSyExportCosts())
+                        .add(subOrderExportFeeVo.getNoExportCosts()));
+            });
+
+        });
+        if (insAreaCompanyEditingDtos != null && insAreaCompanyEditingDtos.size() > 0) {
+            //根据出单员判断  编辑查看
+            //add  by  hxl   添加出单员不能查看优惠的限制    2024-07-16
+            String userId = new BaseController().getUserId();
+            SysUserRole sysUserRole = sysUserRoleService.selectByUserId(userId);
+            if (sysUserRole != null && sysUserRole.getRoleId() == 19) {
+                insAreaCompanyEditingDtos.forEach(item -> {
+                            item.setJqExportFee(null);
+                            item.setSyExportFee(null);
+                            item.setNoExportFee(null);
+                            item.setSumExportFee(null);
+                        }
+                );
+            }
+        }
+        insOrdersEditingVo.setInsAreaCompanyEditingDtos(insAreaCompanyEditingDtos);
+        return insOrdersEditingVo;
+    }
+
+    @Override
+    public InsOrdersEditingVo reviseApp(String orderNo) {
+        InsOrders insOrders = getById(orderNo);
+        InsOrdersEditingVo insOrdersEditingVo = new InsOrdersEditingVo();
+        //拉取规则过滤后的保险公司
+        RuleFilterVo ruleFilterVo = new RuleFilterVo();
+        ruleFilterVo.setProductId(insOrders.getProductid());
+        ruleFilterVo.setCarInfo(insOrders.getCarinfo().toJavaObject(CarInfoVo.class));
+        ruleFilterVo.setOwnerInfo(insOrders.getOwnerinfo().toJavaObject(CustomerInfoVo.class));
+        ruleFilterVo.setApplyInfo(insOrders.getApplyinfo().toJavaObject(CustomerInfoVo.class));
+        ruleFilterVo.setInsureInfo(insOrders.getInsureinfo().toJavaObject(CustomerInfoVo.class));
+
+        List<PtlAgreementInsCompanyDto> ptlAgreementInsCompanyDtos = ptlSchemeRulesService.ruleFilterCompany(BaseController.getUserId(), ruleFilterVo);
+        insOrdersEditingVo.setCompanyDtos(ptlAgreementInsCompanyDtos);
+        List<InsAreaCompany> insAreaCompanyList =
+                insAreaCompanyService.lambdaQuery().eq(InsAreaCompany::getOrderno, orderNo).orderByDesc(InsAreaCompany::getCreatetime).list();
+        insOrders.setInsAreaCompanyList(insAreaCompanyList);
+
         InsAreaCompanyExternalFee insAreaCompanyExternalFee = null;
         BeanUtils.copyProperties(insOrders, insOrdersEditingVo);
 
@@ -838,6 +1017,11 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         List<InsOrdersEditingVo.InsAreaCompanyEditingDto> insAreaCompanyEditingDtos =
                 insAreaCompanyQueryDtos.stream().map(InsOrdersEditingVo.InsAreaCompanyEditingDto::new).collect(Collectors.toList());
 
+        ptlAgreementInsCompanyDtos.forEach(companyDto->{
+            InsOrdersEditingVo.InsAreaCompanyEditingDto insAreaCompanyEditingDto = insAreaCompanyEditingDtos.stream().filter(x -> x.getInscompany().equals(companyDto.getNamesimple())).findFirst().orElse(null);
+            companyDto.setEditingDto(insAreaCompanyEditingDto);
+        });
+
         List<String> companyIds = insAreaCompanyEditingDtos.stream().map(x -> x.getCompanyId()).collect(Collectors.toList());
 
 

+ 1 - 1
src/main/java/com/ydtech/modules/order/service/impl/YongchengOrderApiServiceImpl.java

@@ -386,7 +386,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
 
         List<String> requestInfoList = new ArrayList<>();
         //获取报价信息
-        BaseQuoteInfoVo yaQuoteInfoVo = insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo());
+        BaseQuoteInfoVo yaQuoteInfoVo = insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(),quoteVo.getKinds());
         CoreModelsVo coreModelsVo = new CoreModelsVo();
 
         //build参数

+ 2 - 1
src/main/java/com/ydtech/modules/protocol/constants/DispatchTypeConstants.java

@@ -25,7 +25,8 @@ public enum DispatchTypeConstants {
     DISPATCH_TYPE_CONSTANTS_5(5, "NatureOfUse","使用性质"),
     DISPATCH_TYPE_CONSTANTS_6(6, "yqInsureFlag","交强投保"),
     DISPATCH_TYPE_CONSTANTS_7(7, "cxInsureFlag","车损投保"),
-    DISPATCH_TYPE_CONSTANTS_8(8, "ThirdPartyLiabilityInsurance","第三者责任险");
+    DISPATCH_TYPE_CONSTANTS_8(8, "ThirdPartyLiabilityInsurance","第三者责任险"),
+    DISPATCH_TYPE_CONSTANTS_9(9,"NewEnergy","新能源");
 
     private final Integer num;
 

+ 7 - 0
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementInsCompanyDto.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.protocol.entity.dto;
 
 import com.ydtech.modules.esm.model.EsmInsCompany;
+import com.ydtech.modules.order.entity.vo.InsOrdersEditingVo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -28,4 +29,10 @@ public class PtlAgreementInsCompanyDto extends EsmInsCompany implements Serializ
     @ApiModelProperty("协议信息")
     private List<PtlAgreementDto> agreement;
 
+    @ApiModelProperty("报价后的信息")
+    private InsOrdersEditingVo.InsAreaCompanyEditingDto editingDto;
+
+    @ApiModelProperty("投保指引")
+    private String insGuide;
+
 }

+ 8 - 1
src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceServiceImpl.java

@@ -590,6 +590,8 @@ public class PtlTaxSourceServiceImpl extends ServiceImpl<PtlTaxSourceNewMapper,
         String cxInsureFlag = !InsuranceRisk.getFlagByA(kinds) ?"0":"1";
         //8.第三者责任险
         String thirdPartyLiabilityInsurance =InsuranceRisk.getStringByB(kinds);
+        //9.能源类型
+        String energyType = quoteInfo.getCarInfo().getEnergyType();
         //报价信息
         msg = getString(msg, licenseNo,seats,exhaustScale,cimodelclassVal,vehicleUseVal,yqInsureFlag,cxInsureFlag,thirdPartyLiabilityInsurance);
         //通过调度id查询调度规则是否包含车牌、排量
@@ -601,6 +603,7 @@ public class PtlTaxSourceServiceImpl extends ServiceImpl<PtlTaxSourceNewMapper,
         boolean isExcludeYqInsureFlag= false;
         boolean isExcludeCxInsureFlag= false;
         boolean isExcludeThirdPartyLiabilityInsurance= false;
+        boolean isEnergyType = false;
         //通过默认公司id查询所有的协议按优先级排序
         Long ptlTaxSourceNewId = ptlTaxSourceNew.getId();
         List<PtlAgreementDispatchRulesAttrLink> list = ptlAgreementDispatchRulesAttrLinkService.list(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttrLink>()
@@ -611,6 +614,10 @@ public class PtlTaxSourceServiceImpl extends ServiceImpl<PtlTaxSourceNewMapper,
             if(!isExcludeLicense){
                 quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_1.getCode())+"的值为"+licenseNo+"未匹配"+"\n";
             }
+            isEnergyType = judgeIsExcludeFlag(energyType, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_9.getCode());
+            if(!isExcludeLicense){
+                quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_9.getCode())+"的值为"+energyType+"未匹配"+"\n";
+            }
             isExcludeSeats = judgeIsExcludeFlag(seats, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_2.getCode());
             if(!isExcludeSeats){
                 quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_2.getCode())+"的值为"+seats+"未匹配"+"\n";
@@ -645,7 +652,7 @@ public class PtlTaxSourceServiceImpl extends ServiceImpl<PtlTaxSourceNewMapper,
         logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"报价参数信息为:"+msg+"===============================");
         logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"未匹配信息为:"+quoteInfoErorMsg+"===============================");
         //if (isExclude && isExcludeLicense && isExcludeSeats && isExcludeVolume && isExcludeCimodelclass && isExcludeVehicleUse  && isExcludeYqInsureFlag  && isExcludeCxInsureFlag && isExcludeThirdPartyLiabilityInsurance ) {
-        if (isExcludeLicense && isExcludeSeats && isExcludeVolume && isExcludeCimodelclass && isExcludeVehicleUse  && isExcludeYqInsureFlag  && isExcludeCxInsureFlag && isExcludeThirdPartyLiabilityInsurance ) {
+        if (isExcludeLicense && isExcludeSeats && isExcludeVolume && isExcludeCimodelclass && isExcludeVehicleUse  && isExcludeYqInsureFlag  && isExcludeCxInsureFlag && isExcludeThirdPartyLiabilityInsurance && isEnergyType) {
             agreementId = ptlTaxSourceNew.getAgreementId();
         }
         PtlTaxSourceNewRecord  ptlTaxSourceNewRecord=new PtlTaxSourceNewRecord(orderno, ptlTaxSourceNew.toString(), ptlTaxSourceNew.getDispatchContent(), msg, quoteInfoErorMsg,new Date(), userId);

+ 0 - 1
src/main/java/com/ydtech/modules/protocols/controller/PtlNewAgreementController.java

@@ -95,7 +95,6 @@ public class PtlNewAgreementController extends BaseController {
         PtlAgreementProductCostsNew ptlAgreementProductCostsNew = ptlAgreementProductCostsNewService.getById(costsId);
         String companyId = ptlAgreementService.getById(ptlAgreementProductCostsNew.getAgreementId()).getPartnerCompaniesId();
         List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList(companyId);
-
         AgreementProductCostsSave agreementProductCosts = ptlAgreementProductCostsNewService.costsGet(costsId,undwrtRulesAttrList);
         return HttpResult.ok(agreementProductCosts);
     }

+ 453 - 0
src/main/java/com/ydtech/modules/scheme/controller/PtlSchemeController.java

@@ -0,0 +1,453 @@
+package com.ydtech.modules.scheme.controller;
+
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.aop.request.RequestSingleParam;
+import com.ydtech.constants.enums.InsuranceRisk;
+import com.ydtech.constants.enums.dict.agreement.ProductsType;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.core.page.PageResult;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.base.model.dto.PageDto;
+import com.ydtech.modules.esm.service.EsmInsCompanyService;
+import com.ydtech.modules.order.constants.JqInsuranceType;
+import com.ydtech.modules.order.entity.InsBusinessInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
+import com.ydtech.modules.order.entity.vo.FeeOrderNewRecordVo;
+import com.ydtech.modules.order.service.InsBusinessInsuranceService;
+import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceService;
+import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceTypeService;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.service.ITaxSourceService;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
+import com.ydtech.modules.protocols.entity.vo.*;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsTrajectoryService;
+import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesAttrService;
+import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesNewService;
+import com.ydtech.modules.scheme.entity.po.*;
+import com.ydtech.modules.scheme.entity.vo.*;
+import com.ydtech.modules.scheme.service.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+/**
+*@author: tz
+*@description: 方案controller
+*@create: 2024-7-30 10:12:52
+*/
+@Api(tags = "方案管理")
+@RequestMapping("/plt/scheme")
+@RestController
+public class PtlSchemeController extends BaseController {
+
+    @Autowired
+    private PtlSchemeRulesAttrService ptlSchemeRulesAttrService;
+
+    @Autowired
+    private PtlSchemeService ptlSchemeService;
+
+    @Autowired
+    private PtlSchemeRulesService ptlSchemeRulesService;
+
+    @Autowired
+    private PtlAgreementUndwrtRulesAttrService ptlAgreementUndwrtRulesAttrService;
+
+    @Autowired
+    private InsDrivingIntentionInsuranceService insDrivingIntentionInsuranceService;
+
+    @Autowired
+    private ITaxSourceService taxSourceService;
+
+    @Autowired
+    private InsDrivingIntentionInsuranceTypeService insDrivingIntentionInsuranceTypeService;
+
+    @Autowired
+    private InsBusinessInsuranceService insBusinessInsuranceService;
+
+    @Autowired
+    private PtlOptionalSchemeService ptlOptionalSchemeService;
+
+    @ApiOperation(value = "获取保险公司")
+    @PostMapping("/companyList")
+    public HttpResult companyList(@RequestBody SchemeQueryVo schemeQueryVo) {
+        Page page = buildPageRequest(schemeQueryVo.getPageDto());
+        return HttpResult.ok(ptlSchemeService.getAllCompany(page,schemeQueryVo));
+    }
+
+    //region 规则方法
+    @ApiOperation(value = "方案规则属性列表")
+    @GetMapping("/attr/list")
+    public HttpResult<List<PtlSchemeRulesAttr>> list() {
+        List<PtlSchemeRulesAttr> undwrtRulesAttrList = ptlSchemeRulesAttrService.getRulesAttrList();
+        return HttpResult.ok(undwrtRulesAttrList);
+    }
+
+    @ApiOperation(value = "根据保险公司id查询方案规则属性列表")
+    @GetMapping("/attr/listByCompanyId")
+    public HttpResult<List<PtlSchemeRulesAttr>> listByCompanyId(String companyId) {
+        List<PtlSchemeRulesAttr> undwrtRulesAttrList = ptlSchemeRulesAttrService.getRulesAttrList(companyId);
+        return HttpResult.ok(undwrtRulesAttrList);
+    }
+
+    @ApiOperation(value = "获取规则列表")
+    @PostMapping("/ruleList")
+    public HttpResult ruleList(@Validated @RequestBody RuleQueryVo ruleQueryVo) {
+        Page page = buildPageRequest(ruleQueryVo.getPageDto());
+        return HttpResult.ok(ptlSchemeRulesService.getRulesPage(page,ruleQueryVo));
+    }
+
+    @ApiOperation(value = "获取规则的详情信息")
+    @GetMapping("/ruleInfo")
+    public HttpResult ruleInfo(String ruleId){
+        List<PtlSchemeRulesAttr> schemeRulesAttrs = ptlSchemeRulesAttrService.getRulesAttrList();
+        RuleResultVo rulesInfoById = ptlSchemeRulesAttrService.getRulesInfoById(ruleId, schemeRulesAttrs);
+        return HttpResult.ok(rulesInfoById);
+    }
+
+    @ApiOperation(value = "添加规则")
+    @PostMapping("/ruleAdd")
+    public HttpResult ruleAdd(@RequestBody RuleSaveVo ruleSaveVo){
+        List<PtlSchemeRulesAttrLink> attrs = ruleSaveVo.getAttrs();
+        List<PtlSchemeRulesAttrLink> newAttrs = new ArrayList<>();
+        //过滤空的属性
+        attrs.forEach(item->{
+            if(item.getDictLabal().isEmpty()) {
+                if (((!Objects.isNull(item.getMin()) && !item.getMin().equals("") && !item.getMin().equals("0")) ||
+                        (!Objects.isNull(item.getOperator()) && !item.getOperator().equals("") && !item.getOperator().equals("1")) ||
+                        (!Objects.isNull(item.getMax()) && !item.getMax().equals("") && !item.getMax().equals("0")))) {
+                    item.setId(null);
+                    newAttrs.add(item);
+                }
+            }else{
+                if (((!Objects.isNull(item.getMin()) && !item.getMin().equals("")) ||
+                        (!Objects.isNull(item.getOperator()) && !item.getOperator().equals("")) ||
+                        (!Objects.isNull(item.getMax()) && !item.getMax().equals("")))) {
+                    item.setId(null);
+                    newAttrs.add(item);
+                }
+            }
+        });
+        //添加能源类型
+        newAttrs.add(PtlSchemeRulesAttrLink.NewEnergy(ruleSaveVo.getRule().getEnergyType()));
+        //添加车辆类型
+        newAttrs.add(PtlSchemeRulesAttrLink.CarType(ruleSaveVo.getRule().getVehicleType()));
+        //添加 使用性质  营业  非营业
+        if(!Objects.isNull(ruleSaveVo.getRule().getCarnature())){
+            newAttrs.add(PtlSchemeRulesAttrLink.carNature(ruleSaveVo.getRule().getCarnature()));
+        }
+        ruleSaveVo.setAttrs(newAttrs);
+        return ptlSchemeRulesService.addRules(ruleSaveVo) ?
+                HttpResult.ok("添加规则成功"):
+                HttpResult.error("添加规则成功");
+    }
+
+    @ApiOperation(value = "修改规则")
+    @PostMapping("/ruleUpdate")
+    public HttpResult ruleUpdate(@RequestBody RuleSaveVo ruleSaveVo){
+        PtlSchemeRules ptlSchemeRules = ptlSchemeRulesService.getById(ruleSaveVo.getRule().getId());
+        if(Objects.isNull(ptlSchemeRules)){
+            throw new SystemException("规则不存在");
+        }
+        List<PtlSchemeRulesAttrLink> attrs = ruleSaveVo.getAttrs();
+        List<PtlSchemeRulesAttrLink> newAttrs = new ArrayList<>();
+        //过滤空的属性
+        attrs.forEach(item->{
+            if(item.getDictLabal().isEmpty()) {
+
+                if (((!Objects.isNull(item.getMin()) && !item.getMin().equals("") && !item.getMin().equals("0")) ||
+                        (!Objects.isNull(item.getOperator()) && !item.getOperator().equals("") && !item.getOperator().equals("1")) ||
+                        (!Objects.isNull(item.getMax()) && !item.getMax().equals("") && !item.getMax().equals("0")))) {
+                    item.setId(null);
+                    newAttrs.add(item);
+                }
+            }else{
+                if(!Objects.isNull(item.getMin())){
+                    if(item.getMin().equals("")) {
+                        item.setMin(String.join(",", item.getMinArray()));
+                    }
+                }
+                if (((!Objects.isNull(item.getMin()) && !item.getMin().equals("")) ||
+                        (!Objects.isNull(item.getOperator()) && !item.getOperator().equals("")) ||
+                        (!Objects.isNull(item.getMax()) && !item.getMax().equals("")))) {
+                    item.setId(null);
+                    newAttrs.add(item);
+                }
+            }
+        });
+        //添加能源类型
+        newAttrs.add(PtlSchemeRulesAttrLink.NewEnergy(ruleSaveVo.getRule().getEnergyType()));
+        //添加车辆类型
+        newAttrs.add(PtlSchemeRulesAttrLink.CarType(ruleSaveVo.getRule().getVehicleType()));
+        //添加 使用性质  营业  非营业
+        if(!Objects.isNull(ruleSaveVo.getRule().getCarnature())){
+            newAttrs.add(PtlSchemeRulesAttrLink.carNature(ruleSaveVo.getRule().getCarnature()));
+        }
+        ruleSaveVo.setAttrs(newAttrs);
+        return ptlSchemeRulesService.updateRules(ruleSaveVo) ?
+                HttpResult.ok("修改规则成功"):
+                HttpResult.error("修改规则失败");
+    }
+
+    @ApiOperation(value = "删除规则")
+    @PostMapping("/ruleDelete")
+    public HttpResult ruleDelete(@RequestSingleParam("ruleId") String ruleId){
+        return ptlSchemeRulesService.deleteRules(ruleId) ?
+                HttpResult.ok("删除规则成功"):
+                HttpResult.error("删除规则失败");
+    }
+
+    @ApiOperation(value = "规则过滤保险公司")
+    @PostMapping("/ruleFilterCompany")
+    public HttpResult ruleFilterCompany(@Validated @RequestBody RuleFilterVo ruleFilterVo){
+        //如果没有传入险种 则显示用户所有的保险公司
+        if(Objects.isNull(ruleFilterVo.getProductId()))
+        {
+            return HttpResult.ok(taxSourceService.getAllAgreement(getDeptId(), getUserId()));
+        }
+        return HttpResult.ok(ptlSchemeRulesService.ruleFilterCompany(getUserId(),ruleFilterVo));
+    }
+    //endregion
+
+    //region 方案管理
+    @PostMapping("/getSchemeList")
+    @ApiOperation("查询方案规则列表")
+    public PageResult getProduct(@RequestBody SchemeQueryVo schemeQueryVo) {
+        Page<T> page = buildPageRequest(schemeQueryVo.getPageDto());
+        Page<PtlScheme> schemeQueryDto = ptlSchemeService.getSchemeList(page,schemeQueryVo);
+        return buildPageResponse(schemeQueryDto);
+    }
+
+    @ApiOperation(value = "方案添加")
+    @PostMapping("/shcemeAdd")
+    public HttpResult shcemeAdd(@RequestBody SchemeSaveVo schemeSaveVo){
+        List<SchemeResultVo> schemeInfoByCompanyId = ptlSchemeService.getSchemeInfoByCompanyId(
+                schemeSaveVo.getCompanyId(), schemeSaveVo.getProductId(),
+                schemeSaveVo.getVehicleType(),schemeSaveVo.getEnergyType(),
+                schemeSaveVo.getCarnature()
+                );
+        if(schemeInfoByCompanyId.size() > 0)
+        {
+            throw new SystemException("已存在方案");
+        }
+        return ptlSchemeService.addScheme(schemeSaveVo) ? HttpResult.ok("添加成功") : HttpResult.error("添加失败");
+    }
+
+    @ApiOperation(value = "方案列表")
+    @PostMapping("/schemeList")
+    public HttpResult schemeList(@Validated @RequestBody SchemeQueryVo schemeQueryVo){
+        Page page = buildPageRequest(schemeQueryVo.getPageDto());
+        return HttpResult.ok(ptlSchemeService.getSchemeList(page,schemeQueryVo));
+    }
+
+    @ApiOperation(value = "获取方案详情")
+    @GetMapping("/schemeInfo")
+    public HttpResult schemeInfo(String companyId,String productId,String vehicleType,String energyType,String carnature){
+        return HttpResult.ok(ptlSchemeService.getSchemeInfo(companyId,productId,vehicleType,energyType,carnature));
+    }
+
+    @ApiOperation(value = "更新方案")
+    @PostMapping("/schemeUpdate")
+    public HttpResult schemeUpdate(@Validated @RequestBody SchemeSaveVo schemeSaveVo){
+        return ptlSchemeService.updateScheme(schemeSaveVo) ? HttpResult.ok("修改成功") : HttpResult.error("修改失败");
+    }
+
+    @ApiOperation(value = "删除方案")
+    @PostMapping("/schemeDelete")
+    public HttpResult schemeDepete(@RequestBody SchemeQueryVo schemeQueryVo){
+        return ptlSchemeService.deleteScheme(schemeQueryVo) ? HttpResult.ok("删除成功") : HttpResult.error("删除失败");
+    }
+
+
+    @ApiOperation(value = "获取方案详情")
+    @PostMapping(value = "getScheneInfo")
+    public HttpResult getScheneInfo(@RequestBody SchemeQueryVo schemeQueryVo) {
+        return HttpResult.ok(ptlSchemeService.getSchemeInfoByCompanyId(
+                schemeQueryVo.getCompanyId(),schemeQueryVo.getProductId(),
+                schemeQueryVo.getVehicleType(),schemeQueryVo.getEnergyType(),
+                schemeQueryVo.getCarnature()));
+    }
+    //endregion
+
+    //region 驾意险方法
+    @ApiOperation(value = "获取驾意险分类信息")
+    @PostMapping(value = "/getDrivingType")
+    public HttpResult getDrivingType(@RequestBody DrivingIntentionQueryVo drivingIntentionQueryVo) {
+        return HttpResult.ok(insDrivingIntentionInsuranceTypeService.getDrivingIntentionInsuranceTypeByCompanyId(drivingIntentionQueryVo.getCompanyId()));
+    }
+
+    @ApiOperation(value = "获取驾意险信息")
+    @PostMapping(value = "/getDriving")
+    public HttpResult getDriving(@RequestBody DrivingIntentionQueryVo drivingIntentionQueryVo) {
+        return HttpResult.ok(insDrivingIntentionInsuranceService.getSchemeDrivingIntentionInsurance(drivingIntentionQueryVo));
+    }
+    //endregion
+
+
+    @ApiOperation(value = "获取商业险信息")
+    @PostMapping(value = "getBusinessInsurance")
+    public HttpResult getBusinessInsurance() {
+        return HttpResult.ok(insBusinessInsuranceService.getBusinessInsurance());
+    }
+
+
+    //region 自选方案
+    @ApiOperation(value = "自选方案添加")
+    @PostMapping(value = "addOptionalScheme")
+    public HttpResult addOptionalScheme(@RequestBody OptionalSchemeSaveVo optionalSchemeSaveVo) {
+        LambdaQueryWrapper<PtlOptionalScheme> eq = new LambdaQueryWrapper<PtlOptionalScheme>()
+                .eq(PtlOptionalScheme::getCompanyId, optionalSchemeSaveVo.getCompanyId())
+                .eq(PtlOptionalScheme::getProductId, optionalSchemeSaveVo.getProductId())
+                .eq(PtlOptionalScheme::getEnergyType,  optionalSchemeSaveVo.getEnergyType())
+                .eq(PtlOptionalScheme::getVehicleType, optionalSchemeSaveVo.getVehicleType())
+                .eq(!Objects.isNull(optionalSchemeSaveVo.getCarnature()),PtlOptionalScheme::getCarnature,optionalSchemeSaveVo.getCarnature());
+        List<PtlOptionalScheme> list = ptlOptionalSchemeService.list(eq);
+        if(list.size() > 0)
+        {
+            return HttpResult.error("已存在方案");
+        }
+        return HttpResult.ok(ptlOptionalSchemeService.addOptionScheme(optionalSchemeSaveVo)?
+                "添加成功" :
+                "添加失败");
+    }
+
+    @ApiOperation(value = "自选方案查询")
+    @GetMapping(value = "optionalSchemeInfo")
+    public HttpResult optionalSchemeInfo(String companyId,String productId,String carnature, String vehicleType, String energyType) {
+        return HttpResult.ok(
+        ptlOptionalSchemeService.optionalSchemeInfo(companyId,productId,carnature,vehicleType,energyType));
+    }
+
+    @ApiOperation(value = "自选方案修改")
+    @PostMapping(value = "updateOptionalScheme")
+    public HttpResult updateOptionalScheme(@RequestBody OptionalSchemeSaveVo optionalSchemeSaveVo) {
+        return HttpResult.ok(ptlOptionalSchemeService.updateOptionScheme(optionalSchemeSaveVo)?
+                "修改成功" :
+                "修改失败");
+    }
+
+    @ApiOperation(value = "自选方案列表")
+    @PostMapping(value = "optionalShcemeList")
+    public HttpResult optionalShcemeList( @RequestBody SchemeQueryVo schemeQueryVo) {
+        List<PtlOptionalScheme> optionalSchemeList = ptlOptionalSchemeService.getOptionalSchemeList(schemeQueryVo);
+        return HttpResult.ok(optionalSchemeList);
+    }
+
+    @ApiOperation(value = "自选方案删除")
+    @PostMapping(value = "optionalSchemeDelete")
+    public HttpResult optionalSchemeDelete(@RequestSingleParam("id") String id) {
+        return HttpResult.ok(ptlOptionalSchemeService.deleteOptionScheme(id)?
+                "删除成功" :
+                "删除失败");
+    }
+    //endregion
+
+
+    //region 前端接口
+
+    @ApiOperation(value = "获取保险公司的方案信息")
+    @PostMapping(value = "getCompanySchemeInfo")
+    public HttpResult getCompanySchemeInfo(@RequestBody SchemeQueryVo schemeQueryVo) {
+        List<CompanySchemeVo> companySchemeInfo = ptlSchemeService.getCompanySchemeInfo(schemeQueryVo);
+        return HttpResult.ok(companySchemeInfo);
+    }
+
+    @ApiOperation(value = "获取自选方案信息")
+    @PostMapping(value = "getCompanyOptionalSchemeInfo")
+    public HttpResult getCompanyOptionalSchemeInfo(@RequestBody SchemeQueryVo schemeQueryVo) {
+        CompanyOptionalSchemeVo companySchemeInfo = ptlOptionalSchemeService.getSchemeInsuranceInfo(schemeQueryVo);
+        JSONArray jqList = new JSONArray();
+        Arrays.stream(JqInsuranceType.values()).forEach(item->{
+            JSONObject tmp = new JSONObject();
+            tmp.put("name",item.getName());
+            tmp.put("amount",item.getAmount());
+            jqList.add(tmp);
+        });
+        companySchemeInfo.setJqList(jqList);
+        return HttpResult.ok(companySchemeInfo);
+    }
+
+    //endregion
+
+
+    //region pc端
+
+    @ApiModelProperty(value = "获取方案信息")
+    @PostMapping(value = "getAllSchemeList")
+    public HttpResult getAllSchemeList(@RequestBody SchemeQueryVo schemeQueryVo) {
+        PcSchemeResultVo resultVo = new PcSchemeResultVo();
+        List<CompanySchemeVo> companySchemeInfo = ptlSchemeService.getCompanySchemeInfo(schemeQueryVo);
+        List<PcCompanySchemeVo> pcCompanySchemeVos = new ArrayList<>();
+
+        //分组 主险 附加险 服务
+        companySchemeInfo.forEach(item->{
+            JSONArray main = new JSONArray();
+            JSONArray additional = new JSONArray();
+            JSONArray service = new JSONArray();
+            for(int i=0;i<item.getKinds().size();i++){
+                switch(InsBusinessInsurance.checkInsurance(item.getKinds().getJSONObject(i).getString("kindCode")))
+                {
+                    case 1:
+                        main.add(item.getKinds().getJSONObject(i));
+                        break;
+                    case 2:
+                        additional.add(item.getKinds().getJSONObject(i));
+                        break;
+                    case 3:
+                        service.add(item.getKinds().getJSONObject(i));
+                        break;
+                    default:
+                        break;
+                }
+            }
+            PcCompanySchemeVo pcCompanySchemeVo = item.toPc();
+            JSONObject kinds = new JSONObject();
+            kinds.put("main",main);
+            kinds.put("additional",additional);
+            kinds.put("service",service);
+            pcCompanySchemeVo.setKinds(kinds);
+            pcCompanySchemeVos.add(pcCompanySchemeVo);
+        });
+        resultVo.setSchemes(pcCompanySchemeVos);
+        resultVo.setOptionalScheme(ptlOptionalSchemeService.getPcSchemeInsuranceInfo(schemeQueryVo));
+        return HttpResult.ok(resultVo);
+    }
+
+    @ApiModelProperty(value = "获取产品信息")
+    @GetMapping(value = "getProductInfo")
+    public HttpResult getProductInfo() {
+        JSONArray array = new JSONArray();
+        Arrays.stream(ProductsType.values()).forEach(item->{
+            JSONObject obj = new JSONObject();
+            obj.put("code",item.getCode());
+            obj.put("desc",item.getDesc());
+            array.add(obj);
+        });
+        return HttpResult.ok(array);
+    }
+
+    @ApiModelProperty(value = "获取驾意险信息Son")
+    @GetMapping(value = "getDrivingSon")
+    public HttpResult getDrivingSon(String companyId,String projectCode) {
+        List<InsDrivingIntentionInsuranceSon> insDrivingIntentionInsuranceSon = insDrivingIntentionInsuranceService.getInsDrivingIntentionInsuranceSon(companyId, projectCode);
+        return HttpResult.ok(insDrivingIntentionInsuranceSon);
+    }
+
+    //endregion
+
+}

+ 19 - 0
src/main/java/com/ydtech/modules/scheme/dao/PtlOptionalSchemeInsuranceDrivingIntentionMapper.java

@@ -0,0 +1,19 @@
+package com.ydtech.modules.scheme.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalSchemeInsurance;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalSchemeInsuranceDrivingIntention;
+
+
+/**
+ * @author tz
+ * @description 自选方案mapper
+ * @createDate 2024年8月13日14:52:04
+ */
+public interface PtlOptionalSchemeInsuranceDrivingIntentionMapper extends BaseMapper<PtlOptionalSchemeInsuranceDrivingIntention> {
+
+}
+
+
+
+

+ 31 - 0
src/main/java/com/ydtech/modules/scheme/dao/PtlOptionalSchemeInsuranceMapper.java

@@ -0,0 +1,31 @@
+package com.ydtech.modules.scheme.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalScheme;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalSchemeInsurance;
+import com.ydtech.modules.scheme.entity.vo.CompanySchemeVo;
+import com.ydtech.modules.scheme.entity.vo.OptionalSchemeSaveVo;
+import com.ydtech.modules.scheme.entity.vo.SchemeKindInfoVo;
+import com.ydtech.modules.scheme.entity.vo.SchemeQueryVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * @author tz
+ * @description 自选方案mapper
+ * @createDate 2024年8月13日14:52:04
+ */
+public interface PtlOptionalSchemeInsuranceMapper extends BaseMapper<PtlOptionalSchemeInsurance> {
+    List<OptionalSchemeSaveVo.OptionsSchemeKinds> getSelectKinds(String schemeId);
+
+    List<SchemeKindInfoVo> getSchemeInsuranceInfo(@Param("param") SchemeQueryVo schemeQueryVo);
+
+    List<InsDrivingIntentionInsuranceType> getOptionalSchemeInsuranceType(String schemeId);
+}
+
+
+
+

+ 26 - 0
src/main/java/com/ydtech/modules/scheme/dao/PtlOptionalSchemeMapper.java

@@ -0,0 +1,26 @@
+package com.ydtech.modules.scheme.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.esm.model.EsmInsCompany;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalScheme;
+import com.ydtech.modules.scheme.entity.po.PtlScheme;
+import com.ydtech.modules.scheme.entity.vo.SchemeQueryVo;
+import com.ydtech.modules.scheme.entity.vo.SchemeResultVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * @author tz
+ * @description 自选方案mapper
+ * @createDate 2024年8月13日14:52:04
+ */
+public interface PtlOptionalSchemeMapper extends BaseMapper<PtlOptionalScheme> {
+
+}
+
+
+
+

+ 23 - 0
src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeInsuranceDrivingIntentionMapper.java

@@ -0,0 +1,23 @@
+package com.ydtech.modules.scheme.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeInsuranceDrivingIntention;
+
+import java.util.List;
+
+
+/**
+ * @author tz
+ * @description 方案匹配规则属性的数据库操作Mapper
+ * @createDate 2024-2-22 15:44:29
+ */
+public interface PtlSchemeInsuranceDrivingIntentionMapper extends BaseMapper<PtlSchemeInsuranceDrivingIntention> {
+
+    List<InsDrivingIntentionInsurance> getSchemeDrivingIntentionInsurance(List<String> drivingIntentionInsuranceIds);
+
+}
+
+
+
+

+ 46 - 0
src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeInsuranceMapper.java

@@ -0,0 +1,46 @@
+package com.ydtech.modules.scheme.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeInsurance;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesAttr;
+import com.ydtech.modules.scheme.entity.vo.SchemeKindInfoVo;
+import com.ydtech.modules.scheme.entity.vo.SchemeSaveVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * @author tz
+ * @description 方案匹配规则属性的数据库操作Mapper
+ * @createDate 2024-2-22 15:44:29
+ */
+public interface PtlSchemeInsuranceMapper extends BaseMapper<PtlSchemeInsurance> {
+
+    /**
+     * 获取选中的商业险
+     * @param schemeId
+     * @return
+     */
+    public List<SchemeKindInfoVo> getSelectKinds(String schemeId);
+
+    /**
+     * 获取方案的商业险信息
+     * @param schemeId
+     * @return
+     */
+    public List<KindInfoVo> getSchemeKinds(String schemeId);
+
+    /**
+     * 获取  回显的驾意险 list
+     * @param schemeId
+     * @return
+     */
+    public List<SchemeSaveVo.DrvingIntentionVo>  getSchemeDrivingIntentionList(@Param("companyId")String companyId,@Param("schemeId") String schemeId);
+}
+
+
+
+

+ 55 - 0
src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeMapper.java

@@ -0,0 +1,55 @@
+package com.ydtech.modules.scheme.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.esm.model.EsmInsCompany;
+import com.ydtech.modules.scheme.entity.po.PtlScheme;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRules;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesAttr;
+import com.ydtech.modules.scheme.entity.vo.SchemeQueryVo;
+import com.ydtech.modules.scheme.entity.vo.SchemeResultVo;
+import com.ydtech.modules.scheme.entity.vo.SchemeRuleResultVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * @author tz
+ * @description 方案匹配规则属性的数据库操作Mapper
+ * @createDate 2024-2-22 15:44:29
+ */
+public interface PtlSchemeMapper extends BaseMapper<PtlScheme> {
+
+    /**
+     * 获取所有不是外部订单的保险公司
+     * @param page
+     * @return
+     */
+    Page<EsmInsCompany> getAllCompany(Page page, SchemeQueryVo schemeQueryVo);
+
+    /**
+     * 获取方案列表
+     * @param page
+     * @param schemeQueryVo
+     * @return
+     */
+    Page<PtlScheme> getSchemeList(Page page, SchemeQueryVo schemeQueryVo);
+
+    /**
+     * 获取方案信息列表
+     * @param schemeQueryVo
+     * @return
+     */
+    List<SchemeResultVo> getSchemeResultList(@Param("companyId") String companyId,@Param("productId") String productId,
+                                             @Param("vehicleType") String vehicleType,@Param("energyType") String energyType,
+                                             @Param("carnature") String carnature);
+
+
+    List<PtlSchemeRules> getSchemeRules(@Param("companyIds") List<String> companyIds,@Param("productId") String productId,
+                                        @Param("vehicleType") String vehicleType,@Param("energyType") String energyType);
+}
+
+
+
+

+ 24 - 0
src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeRulesAttrLinkMapper.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.scheme.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttrLink;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesAttrLink;
+import com.ydtech.modules.scheme.entity.vo.SchemeRuleResultVo;
+
+import java.util.List;
+
+
+/**
+ * @author tz
+ * @description 方案规则属性关联的数据库操作Mapper
+ * @createDate 2024-2-22 15:44:29
+ */
+public interface PtlSchemeRulesAttrLinkMapper extends BaseMapper<PtlSchemeRulesAttrLink> {
+
+    List<SchemeRuleResultVo> getSchemeRulesAttrLinks(String companyId, String productId);
+
+}
+
+
+
+

+ 19 - 0
src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeRulesAttrMapper.java

@@ -0,0 +1,19 @@
+package com.ydtech.modules.scheme.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesAttr;
+
+
+/**
+ * @author tz
+ * @description 方案匹配规则属性的数据库操作Mapper
+ * @createDate 2024-2-22 15:44:29
+ */
+public interface PtlSchemeRulesAttrMapper extends BaseMapper<PtlSchemeRulesAttr> {
+
+}
+
+
+
+

+ 24 - 0
src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeRulesMapper.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.scheme.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRules;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesAttrLink;
+import com.ydtech.modules.scheme.entity.vo.RuleQueryVo;
+import com.ydtech.modules.scheme.entity.vo.RuleResultVo;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * @author tz
+ * @description 方案规则属性关联的数据库操作Mapper
+ * @createDate 2024-2-22 15:44:29
+ */
+public interface PtlSchemeRulesMapper extends BaseMapper<PtlSchemeRules> {
+
+    Page<RuleResultVo> getRulePage(Page page,@Param("ruleQueryVo") RuleQueryVo ruleQueryVo);
+}
+
+
+
+

+ 65 - 0
src/main/java/com/ydtech/modules/scheme/entity/po/PtlOptionalScheme.java

@@ -0,0 +1,65 @@
+package com.ydtech.modules.scheme.entity.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 方案规则属性
+ */
+@TableName(value = "ptl_optional_scheme", autoResultMap = true)
+@Data
+public class PtlOptionalScheme {
+
+    @TableId(value = "id", type = com.baomidou.mybatisplus.annotation.IdType.AUTO)
+    private String id;
+
+    @ApiModelProperty(value = "保险公司")
+    @TableField(value = "company_id")
+    private String companyId;
+
+    @ApiModelProperty(value = "产品id")
+    @TableField(value = "product_id")
+    private String productId;
+
+    @ApiModelProperty(value = "产品名称")
+    @TableField(value = "product_name")
+    private String productName;
+
+    @ApiModelProperty(value = "方案名称")
+    @TableField(value = "scheme_name")
+    private String schemeName;
+
+
+    @ApiModelProperty(value = "方案描述")
+    @TableField(value = "description")
+    private String description;
+
+    @ApiModelProperty(value = "能源类型")
+    @TableField(value = "energy_type")
+    private String energyType;
+
+    @ApiModelProperty(value = "车辆类型")
+    @TableField(value = "vehicle_type")
+    private String vehicleType;
+
+    @ApiModelProperty(value = "使用性质")
+    @TableField(value = "carnature")
+    private String carnature;
+
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "create_time")
+    private String createTime;
+
+
+    @ApiModelProperty(value = "创建人")
+    @TableField(value = "create_by")
+    private String createBy;
+
+    public PtlOptionalScheme() {}
+
+
+}

+ 16 - 0
src/main/java/com/ydtech/modules/scheme/entity/po/PtlOptionalSchemeInsurance.java

@@ -0,0 +1,16 @@
+package com.ydtech.modules.scheme.entity.po;
+
+import lombok.Data;
+
+@Data
+public class PtlOptionalSchemeInsurance {
+    private String id;
+
+    private String schemeId;
+
+    private String insuranceId;
+
+    private String optionId;
+
+    private Integer max;
+}

+ 16 - 0
src/main/java/com/ydtech/modules/scheme/entity/po/PtlOptionalSchemeInsuranceDrivingIntention.java

@@ -0,0 +1,16 @@
+package com.ydtech.modules.scheme.entity.po;
+
+import lombok.Data;
+
+/**
+ * 自选方案驾意险
+ */
+@Data
+public class PtlOptionalSchemeInsuranceDrivingIntention {
+    private String id;
+
+    private String schemeId;
+
+    private String drivingIntentionId;
+
+}

+ 69 - 0
src/main/java/com/ydtech/modules/scheme/entity/po/PtlScheme.java

@@ -0,0 +1,69 @@
+package com.ydtech.modules.scheme.entity.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesDictLabal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 方案规则属性
+ */
+@TableName(value = "ptl_scheme", autoResultMap = true)
+@Data
+public class PtlScheme {
+
+    @TableId(value = "id", type = com.baomidou.mybatisplus.annotation.IdType.AUTO)
+    private String id;
+
+    @ApiModelProperty(value = "保险公司")
+    @TableField(value = "company_id")
+    private String companyId;
+
+    @ApiModelProperty(value = "产品id")
+    @TableField(value = "product_id")
+    private String productId;
+
+    @ApiModelProperty(value = "产品名称")
+    @TableField(value = "product_name")
+    private String productName;
+
+    @ApiModelProperty(value = "方案名称")
+    @TableField(value = "scheme_name")
+    private String schemeName;
+
+
+    @ApiModelProperty(value = "方案描述")
+    @TableField(value = "description")
+    private String description;
+
+    @ApiModelProperty(value = "能源类型")
+    @TableField("energy_type")
+    private String energyType;
+
+    @ApiModelProperty(value = "车辆类型")
+    @TableField("vehicle_type")
+    private String vehicleType;
+
+    @ApiModelProperty(value = "使用性质")
+    @TableField("carnature")
+    private String carnature;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "create_time")
+    private String createTime;
+
+
+    @ApiModelProperty(value = "创建人")
+    @TableField(value = "create_by")
+    private String createBy;
+
+    public PtlScheme() {}
+
+
+}

+ 54 - 0
src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeInsurance.java

@@ -0,0 +1,54 @@
+package com.ydtech.modules.scheme.entity.po;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesDictLabal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 方案保险险种
+ */
+@TableName(value = "ptl_scheme_insurance", autoResultMap = true)
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PtlSchemeInsurance {
+
+    @ApiModelProperty(value = "方案id")
+    @TableId(value = "id")
+    private String id;
+
+//    @ApiModelProperty(value = "险种类型")
+//    @TableField(value = "risks" ,typeHandler = FastjsonTypeHandler.class)
+//    private String risks;
+
+    @ApiModelProperty(value = "方案id")
+    @TableField(value = "scheme_id")
+    private String schemeId;
+
+    @ApiModelProperty(value = "商业险种id ")
+    @TableField(value = "insurance_id")
+    private String insuranceId;
+
+    @ApiModelProperty(value = "optionId")
+    @TableField(value = "option_id")
+    private String optionId;
+
+    @ApiModelProperty(value = "max")
+    @TableField(value = "max")
+    private Integer max;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "create_time")
+    private LocalDateTime createTime;
+
+}

+ 57 - 0
src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeInsuranceDrivingIntention.java

@@ -0,0 +1,57 @@
+package com.ydtech.modules.scheme.entity.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDateTime;
+
+/**
+ * 方案保险驾意险
+ */
+@TableName(value = "ptl_scheme_insurance_driving_intention", autoResultMap = true)
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PtlSchemeInsuranceDrivingIntention {
+
+    @ApiModelProperty(value = "方案id")
+    @TableId(value = "id")
+    private String id;
+
+    @ApiModelProperty(value = "方案id")
+    @TableField(value = "scheme_id")
+    private String schemeId;
+
+    @ApiModelProperty(value = "座位数")
+    @TableField(value = "seat_num")
+    private String seatNum;
+
+    @ApiModelProperty(value = "驾意险id")
+    @TableField(value = "driving_intention_id")
+    private String drivingIntentionId;
+
+    @ApiModelProperty(value = "别名")
+    @TableField(value = "alias")
+    private String alias;
+
+    @ApiModelProperty(value = "组Id")
+    @TableField(value = "group_id")
+    private String groupId;
+
+    @ApiModelProperty(value = "份数")
+    @TableField(value = "quantity")
+    private String quantity;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "create_time")
+    private LocalDateTime createTime;
+
+    @TableField(exist = false)
+    private InsDrivingIntentionInsurance drivingIntentionInsurance;
+}

+ 63 - 0
src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeRules.java

@@ -0,0 +1,63 @@
+package com.ydtech.modules.scheme.entity.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesDictLabal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 方案规则属性
+ */
+@TableName(value = "ptl_scheme_rules", autoResultMap = true)
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PtlSchemeRules {
+
+    @TableId(value = "id", type = com.baomidou.mybatisplus.annotation.IdType.AUTO)
+    private String id;
+
+    @ApiModelProperty(value = "保险公司id")
+    @TableField(value = "company_id")
+    private String companyId;
+
+    @ApiModelProperty(value = "规则名称")
+    @TableField(value = "rule_name")
+    private String ruleName;
+
+    @ApiModelProperty(value = "规则描述")
+    @TableField(value = "rule_desc")
+    private String ruleDesc;
+
+    @ApiModelProperty(value = "产品id")
+    @TableField(value = "product_id")
+    private String productId;
+
+    @ApiModelProperty(value = "产品名称")
+    @TableField(value = "product_name")
+    private String productName;
+
+    @ApiModelProperty(value = "能源类型")
+    @TableField(value = "energy_type")
+    private String energyType;
+
+    @ApiModelProperty(value = "车辆类型")
+    @TableField(value = "vehicle_type")
+    private String vehicleType;
+
+    @ApiModelProperty(value = "使用性质")
+    @TableField(value = "carnature")
+    private String carnature;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "create_time")
+    private LocalDateTime createTime;
+
+}

+ 68 - 0
src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeRulesAttr.java

@@ -0,0 +1,68 @@
+package com.ydtech.modules.scheme.entity.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesDictLabal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 方案规则属性
+ */
+@TableName(value = "ptl_scheme_rules_attr", autoResultMap = true)
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PtlSchemeRulesAttr {
+
+    @TableId(value = "id", type = com.baomidou.mybatisplus.annotation.IdType.AUTO)
+    private String id;
+
+    @ApiModelProperty(value = "属性名称")
+    @TableField(value = "attr_name")
+    private String attrName;
+
+    @ApiModelProperty(value = "属性编码")
+    @TableField(value = "attr_code")
+    private String attrCode;
+
+    @ApiModelProperty(value = "表单类型")
+    @TableField(value = "attr_type")
+    private String attrType;
+
+    @ApiModelProperty(value = "字典Id")
+    @TableField(value = "dict_id")
+    private Integer dictId;
+
+    @ApiModelProperty(value = "分组")
+    @TableField(value = "attr_group")
+    private String attrGroup;
+
+    @ApiModelProperty(value = "排序")
+    @TableField(value = "sort")
+    private Integer sort;
+
+    @ApiModelProperty(value = "是否前端显示")
+    @TableField(value = "is_show")
+    private String isShow;
+
+    @TableField(exist = false)
+    private String min;
+
+    @TableField(exist = false)
+    private String[] minArray;
+
+    @TableField(exist = false)
+    private String operator;
+
+    @TableField(exist = false)
+    private String max;
+
+    @TableField(exist = false)
+    private List<PtlAgreementUndwrtRulesDictLabal> dictLabal;
+}

+ 86 - 0
src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeRulesAttrLink.java

@@ -0,0 +1,86 @@
+package com.ydtech.modules.scheme.entity.po;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ydtech.constants.enums.dict.insurance.VehicleType;
+import com.ydtech.modules.order.entity.api.bohai.constants.VehicleUsage;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 协议承保规则与规则属性关联表
+ */
+@TableName(value = "ptl_scheme_rules_attr_link", autoResultMap = true)
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PtlSchemeRulesAttrLink {
+
+    @TableId(value = "id", type = com.baomidou.mybatisplus.annotation.IdType.AUTO)
+    private String id;
+
+    @ApiModelProperty(value = "承包规则id")
+    @TableField(value = "rules_id")
+    private String rulesId;
+
+    @ApiModelProperty(value = "属性id")
+    @TableField(value = "attr_id")
+    private String attrId;
+
+    @ApiModelProperty(value = "属性编码")
+    @TableField(value = "attr_code")
+    private String attrCode;
+
+    @ApiModelProperty(value = "左操作数")
+    @TableField(value = "min")
+    private String min;
+
+    @ApiModelProperty(value = "左操作数数组")
+    @TableField(exist = false)
+    private String[] minArray;
+
+    @ApiModelProperty(value = "操作符")
+    @TableField(value = "operator")
+    private String operator;
+
+    @ApiModelProperty(value = "右操作数")
+    @TableField(value = "max")
+    private String max;
+
+    @TableField(exist = false)
+    private JSONArray dictLabal;
+
+    @ApiModelProperty(value = "关联属性使用")
+    @TableField(exist = false)
+    private PtlSchemeRulesAttrLink children;
+
+
+
+    public static PtlSchemeRulesAttrLink NewEnergy(String energyType){
+        PtlSchemeRulesAttrLink link = new PtlSchemeRulesAttrLink();
+        link.attrId = "52";
+        link.attrCode = "NewEnergy";
+        link.min = energyType;
+        return link;
+    }
+
+    public static PtlSchemeRulesAttrLink CarType(String carType){
+        PtlSchemeRulesAttrLink link = new PtlSchemeRulesAttrLink();
+        link.attrId = "58";
+        link.attrCode = "CarType";
+        link.min = VehicleType.getByCode(carType);
+        return link;
+    }
+
+    public static PtlSchemeRulesAttrLink carNature(String carNature){
+        PtlSchemeRulesAttrLink link = new PtlSchemeRulesAttrLink();
+        VehicleUsage vehicleUsageEnum = VehicleUsage.valueOf("VU_" + carNature);
+        link.attrCode = "carnature";
+        link.min = vehicleUsageEnum.getDesc();
+        return link;
+    }
+}

+ 16 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/AgreementVo.java

@@ -0,0 +1,16 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import lombok.Data;
+
+@Data
+public class AgreementVo {
+    private String agreementId;
+
+    private String agreementName;
+
+    private String apiType;
+
+    private String businessDescription;
+
+    private String jobDescription;
+}

+ 22 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/CompanyAgreementVo.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class CompanyAgreementVo {
+
+    private String id;
+
+    private String name;
+
+    private String namesimple;
+
+    private String logo;
+
+    private List<AgreementVo> agreements;
+
+}
+
+

+ 30 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/CompanyOptionalSchemeVo.java

@@ -0,0 +1,30 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+
+import com.alibaba.fastjson.JSONArray;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class CompanyOptionalSchemeVo {
+    private String schemeId;
+
+    private String schemeName;
+
+    private String description;
+
+    private String isJq;
+
+    private String isSy;
+
+    private List<SchemeKindInfoVo> kinds;
+
+    private JSONArray jqList;
+
+    private List<InsDrivingIntentionInsurance> drivingList;
+
+    private List<InsDrivingIntentionInsuranceType> drivingTypeList;
+}

+ 40 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/CompanySchemeVo.java

@@ -0,0 +1,40 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.alibaba.fastjson.JSONArray;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class CompanySchemeVo {
+
+    private String schemeId;
+
+    private String schemeName;
+
+    private String description;
+
+    private String isJq;
+
+    private String isSy;
+
+    private List<String> risks;
+
+    private JSONArray kinds;
+
+    private List<InsDrivingIntentionInsurance> drivingList;
+
+
+    public PcCompanySchemeVo toPc(){
+        PcCompanySchemeVo pcCompanySchemeVo = new PcCompanySchemeVo();
+        pcCompanySchemeVo.setSchemeId(schemeId);
+        pcCompanySchemeVo.setSchemeName(schemeName);
+        pcCompanySchemeVo.setDescription(description);
+        pcCompanySchemeVo.setIsJq(isJq);
+        pcCompanySchemeVo.setIsSy(isSy);
+        pcCompanySchemeVo.setRisks(risks);
+        pcCompanySchemeVo.setDrivingList(drivingList);
+        return pcCompanySchemeVo;
+    }
+}

+ 16 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/DrivingIntentionInsuranceReusltVo.java

@@ -0,0 +1,16 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import lombok.Data;
+
+/**
+ * 驾意险返回类型
+ */
+@Data
+public class DrivingIntentionInsuranceReusltVo {
+
+    private String typeName;
+
+    private InsDrivingIntentionInsurance insruance;
+
+}

+ 38 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/DrivingIntentionQueryVo.java

@@ -0,0 +1,38 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class DrivingIntentionQueryVo {
+
+    @ApiModelProperty("产品id")
+    private String productId;
+
+    @ApiModelProperty("保险公司id")
+    private String companyId;
+
+    @ApiModelProperty("座位数")
+    private String seatNum;
+
+    @ApiModelProperty("车型种类")
+    private String vehicleType;
+
+    @ApiModelProperty("能源类型")
+    String energyType;
+
+    @ApiModelProperty("使用性质")
+    String carnature;
+
+    @ApiModelProperty("驾意险类型")
+    private String type;
+
+    @ApiModelProperty("驾意险ids")
+    private List<String> drivingIntentionIds;
+
+    @ApiModelProperty("父id ")
+    private List<String> parentId;
+}

+ 137 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/OptionalSchemeSaveVo.java

@@ -0,0 +1,137 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.ydtech.modules.order.entity.InsBusinessInsuranceOption;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalScheme;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalSchemeInsurance;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalSchemeInsuranceDrivingIntention;
+import com.ydtech.utils.idgen.IdGenerate;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 自选方案 保存Vo
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class OptionalSchemeSaveVo {
+
+    private String id;
+
+    private String companyId;
+
+    private String productId;
+
+    private String productName;
+
+    private String schemeName;
+
+    private String description;
+
+    private String energyType;
+
+    private String vehicleType;
+
+    private String carnature;
+
+    private List<OptionsSchemeKinds>  kinds;
+
+    private List<String> drvingIntentions;
+
+
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class OptionsSchemeKinds{
+        private String id;
+
+        private String powerId;
+
+        private String kindName;
+
+        private String kindCode;
+
+        private List<String> amount;
+
+        private String amountDesc;
+
+        private List<InsBusinessInsuranceOption> amtList;
+
+        private String max;
+
+//        private List<String> labels;
+
+    }
+
+    /**
+     * 获取自选方案对象
+     * @return
+     */
+    public PtlOptionalScheme getOptionSchemeObject(){
+        PtlOptionalScheme ptlOptionalScheme = new PtlOptionalScheme();
+        ptlOptionalScheme.setId(id);
+        ptlOptionalScheme.setCompanyId(companyId);
+        ptlOptionalScheme.setProductId(productId);
+        ptlOptionalScheme.setProductName(productName);
+        ptlOptionalScheme.setSchemeName(schemeName);
+        ptlOptionalScheme.setDescription(description);
+        ptlOptionalScheme.setVehicleType(vehicleType);
+        ptlOptionalScheme.setEnergyType(energyType);
+        ptlOptionalScheme.setCarnature(carnature);
+        return ptlOptionalScheme;
+    }
+
+    /**
+     * 获取自选方案商业险列表
+     * @return
+     */
+    public List<PtlOptionalSchemeInsurance> getOptionsSchemeKindsList(String schemeId){
+        List<PtlOptionalSchemeInsurance> list = new ArrayList<>();
+        this.kinds.forEach(item->{
+            if(item.getKindCode().equals("TY2") || item.getKindCode().equals("TY3") || item.getKindCode().equals("TY4"))
+            {
+                if(!item.getMax().equals("0")) {
+                    PtlOptionalSchemeInsurance insurance = new PtlOptionalSchemeInsurance();
+                    insurance.setId(IdGenerate.nextId());
+                    insurance.setSchemeId(schemeId);
+                    insurance.setInsuranceId(item.id);
+                    insurance.setMax(Integer.parseInt(item.max));
+                    list.add(insurance);
+                }
+            }else {
+                item.amount.forEach(amount -> {
+                    PtlOptionalSchemeInsurance insurance = new PtlOptionalSchemeInsurance();
+                    insurance.setId(IdGenerate.nextId());
+                    insurance.setSchemeId(schemeId);
+                    insurance.setInsuranceId(item.id);
+                    insurance.setOptionId(amount);
+
+                    list.add(insurance);
+                });
+            }
+        });
+        return list;
+    }
+
+    /**
+     * 获取自选方案驾意险列表
+     * @param schemeId
+     * @return
+     */
+    public List<PtlOptionalSchemeInsuranceDrivingIntention> getOptionsSchemeInsruanceDrvingIntentionList(String schemeId){
+        List<PtlOptionalSchemeInsuranceDrivingIntention> intentions = new ArrayList<>();
+        this.drvingIntentions.forEach(item->{
+            PtlOptionalSchemeInsuranceDrivingIntention intention = new PtlOptionalSchemeInsuranceDrivingIntention();
+            intention.setId(IdGenerate.nextId());
+            intention.setSchemeId(schemeId);
+            intention.setDrivingIntentionId(item);
+            intentions.add(intention);
+        });
+        return intentions;
+    }
+
+}

+ 28 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/PcCompanySchemeVo.java

@@ -0,0 +1,28 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class PcCompanySchemeVo {
+
+    private String schemeId;
+
+    private String schemeName;
+
+    private String description;
+
+    private String isJq;
+
+    private String isSy;
+
+    private List<String> risks;
+
+    private JSONObject kinds;
+
+    private List<InsDrivingIntentionInsurance> drivingList;
+}

+ 16 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/PcSchemeResultVo.java

@@ -0,0 +1,16 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import javassist.bytecode.LineNumberAttribute;
+import lombok.Data;
+
+import java.util.List;
+
+//PC端方案返回VO
+@Data
+public class PcSchemeResultVo {
+
+    List<PcCompanySchemeVo> schemes;
+
+    CompanyOptionalSchemeVo optionalScheme;
+
+}

+ 29 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/RuleFilterVo.java

@@ -0,0 +1,29 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.ydtech.modules.ins.model.vo.CarInfoVo;
+import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+public class RuleFilterVo {
+
+    @ApiModelProperty(value = "产品id")
+    private String productId;
+
+    @ApiModelProperty(value = "车辆信息")
+    private CarInfoVo carInfo;
+
+    @ApiModelProperty(value = "车主信息")
+    private CustomerInfoVo ownerInfo;
+
+    @ApiModelProperty(value = "投保人信息")
+    private CustomerInfoVo applyInfo;
+
+    @ApiModelProperty(value = "被保人信息")
+    private CustomerInfoVo insureInfo;
+
+}

+ 24 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/RuleQueryVo.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.ydtech.core.page.PageRequest;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+public class RuleQueryVo extends PageRequest {
+
+    @NotBlank(message = "保险公司id不能为空")
+    @ApiModelProperty("保险公司id")
+    private String companyId;
+
+    @ApiModelProperty("能源类型")
+    private String energyType;
+
+    @ApiModelProperty("车辆类型")
+    private String vehicleType;
+
+    @ApiModelProperty("使用性质")
+    private String carnature;
+}

+ 50 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/RuleResultVo.java

@@ -0,0 +1,50 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRules;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesAttr;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesAttrLink;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Data
+public class RuleResultVo {
+    private String id;
+
+    @ApiModelProperty(value = "保险公司id")
+    private String companyId;
+
+    @ApiModelProperty(value = "规则名称")
+    private String ruleName;
+
+    @ApiModelProperty(value = "规则描述")
+    private String ruleDesc;
+
+    @ApiModelProperty(value = "产品id")
+    private String productId;
+
+    @ApiModelProperty(value = "产品名称")
+    private String productName;
+
+    @ApiModelProperty(value = "创建时间")
+    private LocalDateTime createTime;
+
+    @ApiModelProperty(value = "规则属性")
+    List<PtlSchemeRulesAttr> attrs;
+
+    public RuleResultVo(){}
+
+    public RuleResultVo(PtlSchemeRules ptlSchemeRules){
+        this.id = ptlSchemeRules.getId();
+        this.companyId = ptlSchemeRules.getCompanyId();
+        this.ruleName = ptlSchemeRules.getRuleName();
+        this.ruleDesc = ptlSchemeRules.getRuleDesc();
+        this.productId = ptlSchemeRules.getProductId();
+        this.productName = ptlSchemeRules.getProductName();
+        this.createTime = ptlSchemeRules.getCreateTime();
+    }
+}

+ 18 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/RuleSaveVo.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRules;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesAttrLink;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class RuleSaveVo {
+
+    @ApiModelProperty(value = "规则")
+    PtlSchemeRules rule;
+
+    @ApiModelProperty(value = "规则属性")
+    List<PtlSchemeRulesAttrLink> attrs;
+}

+ 54 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/RuleUndwrtAttrVo.java

@@ -0,0 +1,54 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesDictLabal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class RuleUndwrtAttrVo {
+    @TableId(value = "id", type = com.baomidou.mybatisplus.annotation.IdType.AUTO)
+    private String id;
+
+    @ApiModelProperty(value = "属性名称")
+    @TableField(value = "attr_name")
+    private String attrName;
+
+    @ApiModelProperty(value = "属性编码")
+    @TableField(value = "attr_code")
+    private String attrCode;
+
+    @ApiModelProperty(value = "表单类型")
+    @TableField(value = "attr_type")
+    private String attrType;
+
+    @ApiModelProperty(value = "字典Id")
+    @TableField(value = "dict_id")
+    private Integer dictId;
+
+    @ApiModelProperty(value = "分组")
+    @TableField(value = "attr_group")
+    private String attrGroup;
+
+    @ApiModelProperty(value = "排序")
+    @TableField(value = "sort")
+    private Integer sort;
+
+    @TableField(exist = false)
+    private String min;
+
+    @TableField(exist = false)
+    private String[] minArray;
+
+    @TableField(exist = false)
+    private String operator;
+
+    @TableField(exist = false)
+    private String max;
+
+    @TableField(exist = false)
+    private List<PtlAgreementUndwrtRulesDictLabal> dictLabal;
+}

+ 32 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeKindInfoVo.java

@@ -0,0 +1,32 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
+import com.ydtech.modules.order.entity.InsBusinessInsuranceOption;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class SchemeKindInfoVo extends KindInfoVo {
+
+    @ApiModelProperty(value = "id")
+    private String id;
+
+    @ApiModelProperty(value = "max")
+    private String max;
+
+    @ApiModelProperty(value = "描述")
+    private String desc;
+
+    @ApiModelProperty(value = "分组")
+    private String grouping;
+
+    @ApiModelProperty(value = "amountDesc")
+    private String amountDesc;
+
+    @ApiModelProperty(value = "保额列表")
+    @JsonProperty("amtList")
+    private List<InsBusinessInsuranceOption> amtList;
+}

+ 29 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeQueryVo.java

@@ -0,0 +1,29 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.ydtech.core.page.PageRequest;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class SchemeQueryVo extends PageRequest {
+    @ApiModelProperty("保险公司名称")
+    String companyName;
+
+    @ApiModelProperty("保险公司id")
+    String companyId;
+
+    @ApiModelProperty("产品id")
+    String productId;
+
+    @ApiModelProperty("座位数")
+    String seatNum;
+
+    @ApiModelProperty("车辆类型")
+    String vehicleType;
+
+    @ApiModelProperty("能源类型")
+    String energyType;
+
+    @ApiModelProperty("使用性质")
+    String carnature;
+}

+ 32 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeResultVo.java

@@ -0,0 +1,32 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.alibaba.fastjson.JSONArray;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeInsuranceDrivingIntention;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class SchemeResultVo {
+
+    private String id;
+
+    private String companyId;
+
+    private String productId;
+
+    private String productName;
+
+    private String schemeName;
+
+    private String description;
+
+    private JSONArray risks;
+
+    private JSONArray kinds;
+
+    @ApiModelProperty(value = "驾意险id")
+    private List<PtlSchemeInsuranceDrivingIntention> drivingIntentions;
+
+}

+ 128 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeRuleAttrMappingVo.java

@@ -0,0 +1,128 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.ydtech.constants.enums.dict.insurance.VehicleType;
+import com.ydtech.modules.fee.dto.vo.RuleAttrMappingVo;
+import com.ydtech.modules.ins.model.vo.CarInfoVo;
+import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
+import com.ydtech.modules.order.entity.api.bohai.constants.VehicleUsage;
+import com.ydtech.modules.order.entity.api.dajia.constants.TypeVehicleMapping;
+import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
+import com.ydtech.modules.protocol.entity.po.PtlNewCarJudgeRules;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDate;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class SchemeRuleAttrMappingVo {
+    @ApiModelProperty(value = "因子属性Code")
+    private String attrCode;
+
+    @ApiModelProperty(value = "值")
+    private String value;
+
+
+    public SchemeRuleAttrMappingVo(String attrCode, String value) {
+        this.attrCode = attrCode;
+        this.value = value;
+    }
+
+    public static List<SchemeRuleAttrMappingVo> getRuleAttrMappingVoList(CarInfoVo carInfo,
+                                                                   CustomerInfoVo ownerInfo,
+                                                                   CustomerInfoVo policyHolderInfo,
+                                                                   CustomerInfoVo insuredPersonInfo,
+                                                                   PtlNewCarJudgeRules carJudgeRule) {
+        List<SchemeRuleAttrMappingVo> ruleAttrMappingVoList = new ArrayList<>();
+        //车牌号
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("LicenseNo", carInfo.getLicenseNo()));
+        //品牌型号
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("BrandandModel", carInfo.getModelcname()));
+        //座位数
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("PassengerCarSeatingCapacity", carInfo.getSeatCount()));
+        //新车购置价
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("PurchasePriceofNewVehicle", carInfo.getPurchasePrice()));
+        //车辆用途
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("NatureOfUse", TypeVehicleMapping.getByCode(carInfo.getVehicleUse())));
+        //车辆种类
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarType", VehicleType.getByCode(carInfo.getCimodelclass())));
+        //使用性质
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("carnature", VehicleUsage.valueOf("VU_" + carInfo.getCarnature()).getDesc()));
+        //核定载质量
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("AuthorizedLoadWeight", carInfo.getLimitLoad()));
+        //整备质量
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CurbWeight", carInfo.getVehicleweight()));
+        //能源类型
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("NewEnergy", carInfo.getEnergyType()));
+        //注册日期
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("RegistrationDate", carInfo.getRegisterDate()));
+        //是否过户
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("TransferVehicle", carInfo.isTransferFlag() ? "1" : "0"));
+        //是否新车
+        //使用注册日期算出自然月 然后判断是否是新旧车
+        LocalDate registrationDate = LocalDate.parse(carInfo.getRegisterDate());
+        LocalDate currentDate = LocalDate.now();
+
+        boolean isNoLicenseFlag = false;
+//        if (carJudgeRule != null) {
+//            if (carJudgeRule.getUnitTypeCode().equals("天")) {
+//                long days = ChronoUnit.DAYS.between(registrationDate, currentDate);
+//                if (days < Integer.parseInt(carJudgeRule.getUnitTypeValue())) {
+//                    isNoLicenseFlag = true;
+//                }
+//            }
+//            if (carJudgeRule.getUnitTypeCode().equals("月")) {
+//                long months = ChronoUnit.MONTHS.between(registrationDate, currentDate);
+//                if (months < Integer.parseInt(carJudgeRule.getUnitTypeValue())) {
+//                    isNoLicenseFlag = true;
+//                }
+//            }
+//        }
+
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("NewAndOldCars", isNoLicenseFlag ? "1" : "0"));
+
+        //发证日期
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("DateofIssuance", carInfo.getIssueDate()));
+        //车长
+//        ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleLength", carInfo.getCarLength()));
+
+        //车主 证件号码(前6位)
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnersIDNumber", ownerInfo.getIdentifyNumber()));
+        //车主 年龄
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnersAge", ownerInfo.getAge()));
+        //车主 性别
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnersSex", ownerInfo.getGender().equals("男") ? "1" : "2"));
+        //车主 姓名
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnerName", ownerInfo.getName()));
+
+        //投保人 证件号码(前6位)
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("ApplicantIDNumber", policyHolderInfo.getIdentifyNumber()));
+        //投保人 年龄
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("ApplicantAge", policyHolderInfo.getAge()));
+        //投保人 性别
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("ApplicantSex", policyHolderInfo.getGender().equals("男") ? "1" : "2"));
+
+        //被保人 证件号码(前6位)
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("InsuredIDNumber", insuredPersonInfo.getIdentifyNumber()));
+        //被保人 年龄
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("InsuredAge", insuredPersonInfo.getAge()));
+        //被保人 性别
+        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("InsuredSex", insuredPersonInfo.getGender().equals("男") ? "1" : "2"));
+
+        //2024-06-20 起保日期 月份判断
+//        if(quoteInfoVo.get() != null && !insAreaCompany.getJqStartDate().equals("")){
+//            LocalDateTime jqStartDate = LocalDateTime.parse(insAreaCompany.getJqStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+//            ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqStartMonth", String.valueOf(jqStartDate.getMonthValue())));
+//        }
+//        if(insAreaCompany.getSyStartDate() != null && !insAreaCompany.getSyStartDate().equals("")) {
+//            LocalDateTime syStartDate = LocalDateTime.parse(insAreaCompany.getSyStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+//            ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyStartMonth", String.valueOf(syStartDate.getMonthValue())));
+//        }
+
+        return ruleAttrMappingVoList;
+    }
+
+}

+ 24 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeRuleResultVo.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesAttrLink;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class SchemeRuleResultVo {
+
+    private String id;
+
+    private String companyId;
+
+    private String ruleName;
+
+    private String ruleDesc;
+
+    private String productId;
+
+    private String productName;
+
+    private List<PtlSchemeRulesAttrLink> attrLinks;
+}

+ 135 - 0
src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeSaveVo.java

@@ -0,0 +1,135 @@
+package com.ydtech.modules.scheme.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceType;
+import com.ydtech.modules.scheme.entity.po.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+
+import java.util.List;
+
+@Data
+public class SchemeSaveVo {
+
+    @ApiModelProperty(value = "保险公司id")
+    private String companyId;
+
+    @ApiModelProperty(value = "产品id")
+    private String productId;
+
+    @ApiModelProperty(value = "产品名称")
+    private String productName;
+
+    @ApiModelProperty(value = "能源类型")
+    private String energyType;
+
+    @ApiModelProperty(value = "车辆类型")
+    private String vehicleType;
+
+    @ApiModelProperty(value = "使用性质")
+    private String carnature;
+
+    @ApiModelProperty(value = "方案列表")
+    @JsonProperty("productList")
+    private List<ProductVo> productList;
+
+
+    @Data
+    public static class ProductVo{
+        @ApiModelProperty(value = "id")
+        private String id;
+
+        @ApiModelProperty(value = "方案名称")
+        private String schemeName;
+
+        @ApiModelProperty(value = "描述")
+        private String description;
+
+        @ApiModelProperty(value = "商业险种")
+        @JsonProperty("kinds")
+        private List<SchemeKindInfoVo> kinds;
+
+        @ApiModelProperty(value = "驾意险")
+        @JsonProperty("drvingIntentions")
+        private List<DrvingIntentionsVo> drvingIntentions;
+
+        public ProductVo() {
+        }
+
+        public ProductVo(String schemeName, String description, List<SchemeKindInfoVo> kinds, List<DrvingIntentionsVo> drvingIntentions){
+            this.schemeName = schemeName;
+            this.description = description;
+            this.kinds = kinds;
+            this.drvingIntentions = drvingIntentions;
+        }
+    }
+
+    @Data
+    public static class DrvingIntentionsVo{
+        @ApiModelProperty(value = "驾意险分类")
+        @JsonProperty("driverType")
+        private List<InsDrivingIntentionInsuranceType> driverType;
+
+        @ApiModelProperty(value = "驾意险列表")
+        @JsonProperty("list")
+        private List<DrvingIntentionVo>  list;
+
+        public DrvingIntentionsVo(){}
+
+        public DrvingIntentionsVo(List<DrvingIntentionVo> list) {
+            this.list = list;
+        }
+    }
+
+
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class DrvingIntentionVo{
+        @ApiModelProperty(value = "是否多选")
+        private Integer isMultiple;
+
+        @ApiModelProperty(value = "code")
+        private String code;
+
+        @ApiModelProperty(value = "类型名称")
+        private String typeName;
+
+        @ApiModelProperty(value = "驾意险id")
+        private String drivingIntentionId;
+
+        @ApiModelProperty(value = "驾意险ids")
+        private List<String> drivingIntentionIds;
+
+        @ApiModelProperty(value = "别名")
+        private String alias;
+
+        private String parentId;
+
+        private List<String> parentIds;
+
+        @ApiModelProperty(value = "座位数")
+        private String seatNum;
+
+        @ApiModelProperty(value = "份数")
+        private String quantity;
+
+        @ApiModelProperty(value = "group_id")
+        private String groupId;
+
+        @ApiModelProperty(value = "驾意险列表")
+        private List<InsDrivingIntentionInsurance> drvingList;
+
+        @ApiModelProperty(value = "已选的驾意险")
+        private List<InsDrivingIntentionInsurance> LiabilityTerms;
+    }
+
+    public SchemeSaveVo() {
+    }
+
+
+}

+ 14 - 0
src/main/java/com/ydtech/modules/scheme/service/PtlOptionalSchemeInsuranceDrivingIntentionService.java

@@ -0,0 +1,14 @@
+package com.ydtech.modules.scheme.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalSchemeInsurance;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalSchemeInsuranceDrivingIntention;
+
+/**
+*@author: tz
+*@description: 自选方案 service
+*@create: 2024-8-13 14:53:39
+*/
+public interface PtlOptionalSchemeInsuranceDrivingIntentionService extends IService<PtlOptionalSchemeInsuranceDrivingIntention> {
+
+}

+ 24 - 0
src/main/java/com/ydtech/modules/scheme/service/PtlOptionalSchemeInsuranceService.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.scheme.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalScheme;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalSchemeInsurance;
+import com.ydtech.modules.scheme.entity.vo.*;
+
+import java.util.List;
+
+/**
+*@author: tz
+*@description: 自选方案 service
+*@create: 2024-8-13 14:53:39
+*/
+public interface PtlOptionalSchemeInsuranceService extends IService<PtlOptionalSchemeInsurance> {
+    List<OptionalSchemeSaveVo.OptionsSchemeKinds> getSelectKinds(String schemeId);
+
+    /**
+     * 获取自选方案的商业险种信息
+     * @param schemeQueryVo
+     * @return
+     */
+    List<SchemeKindInfoVo> getSchemeInsuranceInfo(SchemeQueryVo schemeQueryVo);
+}

+ 65 - 0
src/main/java/com/ydtech/modules/scheme/service/PtlOptionalSchemeService.java

@@ -0,0 +1,65 @@
+package com.ydtech.modules.scheme.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.esm.model.EsmInsCompany;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalScheme;
+import com.ydtech.modules.scheme.entity.po.PtlScheme;
+import com.ydtech.modules.scheme.entity.vo.*;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+*@author: tz
+*@description: 自选方案 service
+*@create: 2024-8-13 14:53:39
+*/
+public interface PtlOptionalSchemeService extends IService<PtlOptionalScheme> {
+
+    /**
+     * 添加自选方案
+     * @param optionalSchemeSaveVo
+     * @return
+     */
+    boolean addOptionScheme(OptionalSchemeSaveVo optionalSchemeSaveVo);
+
+    /**
+     * 修改自选方案
+     * @param optionalSchemeSaveVo
+     * @return
+     */
+    boolean updateOptionScheme(OptionalSchemeSaveVo optionalSchemeSaveVo);
+
+    /**
+     * 删除自选方案
+     * @param id
+     * @return
+     */
+    boolean deleteOptionScheme(String id);
+
+    /**
+     * 自选方案详情
+     * @param companyId
+     * @param productId
+     * @return
+     */
+    OptionalSchemeSaveVo optionalSchemeInfo(String companyId,String productId,String carnature, String vehicleType, String energyType);
+
+    List<PtlOptionalScheme> getOptionalSchemeList(SchemeQueryVo schemeQueryVo);
+
+    /**
+     * 获取自选方案的商业险信息
+     * @param schemeQueryVo
+     * @return
+     */
+    CompanyOptionalSchemeVo getSchemeInsuranceInfo(SchemeQueryVo schemeQueryVo);
+
+    CompanyOptionalSchemeVo getPcSchemeInsuranceInfo(SchemeQueryVo schemeQueryVo);
+
+    /**
+     * 获取保险公司投保指引
+     * @return
+     */
+    String getCompanyInsGuide(String companyId,String productId,String carnature, String vehicleType, String energyType);
+}

+ 18 - 0
src/main/java/com/ydtech/modules/scheme/service/PtlSchemeInsuranceDrivingIntentionService.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.scheme.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeInsuranceDrivingIntention;
+
+import java.util.List;
+
+/**
+*@author: tz
+*@description: 方案规则属性 service
+*@create: 2024-7-30 10:14:47
+*/
+public interface PtlSchemeInsuranceDrivingIntentionService extends IService<PtlSchemeInsuranceDrivingIntention> {
+
+    List<InsDrivingIntentionInsurance> getSchemeDrivingIntentionInsurance(List<String> drivingIntentionInsuranceIds);
+
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов