Sfoglia il codice sorgente

1.添加协议调度功能实现,添加协议调度的添加规则表以及记录表,添加规则验证的逻辑
2.添加前台页面返回所有协议添加默认值
3.前台报价默认值走协议调度的判断逻辑
4.添加协议规则验证的记录表添加验证记录方便排查问题

hxl13994548489 2 anni fa
parent
commit
1c842109a5
47 ha cambiato i file con 2982 aggiunte e 9 eliminazioni
  1. 143 0
      sql/Online.sql
  2. 51 0
      src/main/java/com/ydtech/constants/enums/InsuranceRisk.java
  3. 19 3
      src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java
  4. 3 0
      src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteVo.java
  5. 62 0
      src/main/java/com/ydtech/modules/protocol/constants/DispatchTypeConstants.java
  6. 135 0
      src/main/java/com/ydtech/modules/protocol/controller/PtlTaxSourceNewController.java
  7. 18 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlTaxSourceNewHistoryMapper.java
  8. 60 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlTaxSourceNewMapper.java
  9. 18 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlTaxSourceNewRecordMapper.java
  10. 38 0
      src/main/java/com/ydtech/modules/protocol/entity/dto/PtlTaxSourceNewDto.java
  11. 96 0
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlTaxSourceNew.java
  12. 89 0
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlTaxSourceNewHistory.java
  13. 76 0
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlTaxSourceNewRecord.java
  14. 26 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewAddDeptIdsVo.java
  15. 79 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewAddVo.java
  16. 23 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewIdsVo.java
  17. 80 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewSaveVo.java
  18. 68 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewVo.java
  19. 8 0
      src/main/java/com/ydtech/modules/protocol/service/PtlTaxSourceNewHistoryService.java
  20. 14 0
      src/main/java/com/ydtech/modules/protocol/service/PtlTaxSourceNewRecordService.java
  21. 76 0
      src/main/java/com/ydtech/modules/protocol/service/PtlTaxSourceNewService.java
  22. 18 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceRecordServiceImpl.java
  23. 13 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceServiceHistoryImpl.java
  24. 782 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceServiceImpl.java
  25. 17 6
      src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java
  26. 178 0
      src/main/java/com/ydtech/modules/protocol/utils/RulesMergeStrUtils.java
  27. 18 0
      src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesAttrLinkHistoryMapper.java
  28. 18 0
      src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesAttrLinkMapper.java
  29. 18 0
      src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesAttrMapper.java
  30. 19 0
      src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesDictLabalMapper.java
  31. 17 0
      src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesDictMapper.java
  32. 67 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesAttr.java
  33. 58 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesAttrLink.java
  34. 77 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesAttrLinkHistory.java
  35. 41 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesDict.java
  36. 49 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesDictLabal.java
  37. 13 0
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesAttrLinkHistoryService.java
  38. 13 0
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesAttrLinkService.java
  39. 35 0
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesAttrService.java
  40. 14 0
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesDictLabalService.java
  41. 22 0
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesDictService.java
  42. 18 0
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesAttrLinkHistoryServiceImpl.java
  43. 18 0
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesAttrLinkServiceImpl.java
  44. 92 0
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesAttrServiceImpl.java
  45. 24 0
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesDictLabalServiceImpl.java
  46. 53 0
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesDictServiceImpl.java
  47. 108 0
      src/main/resources/mapper/modules/protocol/PtlTaxSourceNewMapper.xml

+ 143 - 0
sql/Online.sql

@@ -0,0 +1,143 @@
+-- 协议调度表   add by hxl  2024-05-29
+DROP TABLE IF EXISTS `ptl_tax_source_new`;
+CREATE TABLE `ptl_tax_source_new`  (
+                                       `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
+                                       `ins_company_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '保险公司id',
+                                       `ins_company_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '保险公司名称',
+                                       `agreement_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '协议id',
+                                       `priority` int NULL DEFAULT NULL COMMENT '优先级',
+                                       `default_flag` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '是否默认',
+                                       `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+                                       `create_user` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建人',
+                                       `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
+                                       `update_user` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '修改人',
+                                       `dispatch_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '调度内容',
+                                       PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '协议调度管理' ROW_FORMAT = Dynamic;
+
+-- 协议调度历史记录表   add by hxl  2024-05-29
+DROP TABLE IF EXISTS `ptl_tax_source_new_history`;
+CREATE TABLE `ptl_tax_source_new_history`  (
+                                               `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
+                                               `ins_company_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '保险公司id',
+                                               `ins_company_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '保险公司名称',
+                                               `agreement_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '协议id',
+                                               `priority` int NULL DEFAULT NULL COMMENT '优先级',
+                                               `default_flag` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '是否默认',
+                                               `operator_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+                                               `modifier` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建人',
+                                               `dispatch_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '调度内容',
+                                               `ptl_tax_source_new_id` bigint NULL DEFAULT NULL COMMENT '协议调度表id',
+                                               `batch_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '批次id',
+                                               `batch_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '批次类型',
+                                               PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '协议调度历史记录表' ROW_FORMAT = Dynamic;
+
+-- 协议调度关联表   add by hxl  2024-05-29
+DROP TABLE IF EXISTS `ptl_agreement_dispatch_rules_attr_link`;
+CREATE TABLE `ptl_agreement_dispatch_rules_attr_link`  (
+                                                           `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键/自增',
+                                                           `rules_id` bigint NOT NULL COMMENT '协议规则id',
+                                                           `attr_id` bigint NULL DEFAULT NULL COMMENT '协议属性id',
+                                                           `attr_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '协议code',
+                                                           `min` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '左操作数',
+                                                           `operator` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '运算符\r\n1.等于\r\n2.不等于\r\n3.小于等于\r\n4.大于等于',
+                                                           `max` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '右操作符',
+                                                           PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '协议调度关联表' ROW_FORMAT = Dynamic;
+
+-- 协议调度关联历史记录表   add by hxl  2024-05-29
+DROP TABLE IF EXISTS `ptl_agreement_dispatch_rules_attr_link_history`;
+CREATE TABLE `ptl_agreement_dispatch_rules_attr_link_history`  (
+                                                                   `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键/自增',
+                                                                   `rules_id` int NULL DEFAULT NULL COMMENT '承包规则id',
+                                                                   `attr_id` int NULL DEFAULT NULL COMMENT '属性id',
+                                                                   `attr_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性编码',
+                                                                   `min` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '左操作数',
+                                                                   `operator` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作符',
+                                                                   `batch` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '右操作数',
+                                                                   `operator_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '批次',
+                                                                   `modifier` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作类型',
+                                                                   `operator_time` datetime NULL DEFAULT NULL COMMENT '操作人',
+                                                                   `max` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作时间',
+                                                                   PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '协议调度关联历史记录表' ROW_FORMAT = Dynamic;
+
+-- 协议调度规则属性   add by hxl  2024-05-29
+DROP TABLE IF EXISTS `ptl_agreement_dispatch_rules_attr`;
+CREATE TABLE `ptl_agreement_dispatch_rules_attr`  (
+                                                      `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键/自增',
+                                                      `attr_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性名称',
+                                                      `attr_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性code',
+                                                      `attr_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '表单类型',
+                                                      `dict_id` bigint NULL DEFAULT NULL COMMENT '关联字典id',
+                                                      `attr_group` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '分组',
+                                                      `company_ids` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '保险公司id',
+                                                      `sort` int NULL DEFAULT NULL COMMENT '排序',
+                                                      PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '协议调度规则属性' ROW_FORMAT = DYNAMIC;
+
+
+INSERT INTO `ptl_agreement_dispatch_rules_attr` VALUES (1, '车牌号', 'LicenseNo', 'select', NULL, 'dispatch', 'all', NULL);
+INSERT INTO `ptl_agreement_dispatch_rules_attr` VALUES (2, '座位数', 'PassengerCarSeatingCapacity', 'inputNumber', NULL, 'dispatch', 'all', NULL);
+INSERT INTO `ptl_agreement_dispatch_rules_attr` VALUES (3, '排量', 'volume', 'inputNumber', NULL, 'dispatch', 'all', NULL);
+INSERT INTO `ptl_agreement_dispatch_rules_attr` VALUES (4, '车辆大类', 'CarType', 'checkbox', 4, 'dispatch', 'all', NULL);
+INSERT INTO `ptl_agreement_dispatch_rules_attr` VALUES (5, '使用性质', 'NatureOfUse', 'checkbox', 5, 'dispatch', 'all', NULL);
+INSERT INTO `ptl_agreement_dispatch_rules_attr` VALUES (6, '交强投保', 'yqInsureFlag', 'radio', 1, 'dispatch', 'all', NULL);
+INSERT INTO `ptl_agreement_dispatch_rules_attr` VALUES (7, '车损投保', 'cxInsureFlag', 'radio', 1, 'dispatch', 'all', NULL);
+INSERT INTO `ptl_agreement_dispatch_rules_attr` VALUES (8, '第三者责任险 ', 'ThirdPartyLiabilityInsurance', 'inputNumber', NULL, 'dispatch', 'all', NULL);
+
+-- 协议调度属性字典表   add by hxl  2024-05-29
+DROP TABLE IF EXISTS `ptl_agreement_dispatch_rules_dict`;
+CREATE TABLE `ptl_agreement_dispatch_rules_dict`  (
+                                                      `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键/自增',
+                                                      `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '字典名称',
+                                                      `code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '字典code',
+                                                      `remark` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
+                                                      PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '协议调度属性字典表' ROW_FORMAT = Dynamic;
+
+
+INSERT INTO `ptl_agreement_dispatch_rules_dict` VALUES (1, '交强投保', 'yqInsureFlag', '是与否');
+INSERT INTO `ptl_agreement_dispatch_rules_dict` VALUES (4, '车辆大类', 'carType', '客车和货车');
+INSERT INTO `ptl_agreement_dispatch_rules_dict` VALUES (5, '使用性质', 'useDesc', '营业 非营业');
+
+-- 协议调度字典详情   add by hxl  2024-05-29
+DROP TABLE IF EXISTS `ptl_agreement_dispatch_rules_dict_labal`;
+CREATE TABLE `ptl_agreement_dispatch_rules_dict_labal`  (
+                                                            `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键/自增',
+                                                            `parent_id` bigint NULL DEFAULT 0 COMMENT '父id',
+                                                            `dict_id` bigint NULL DEFAULT NULL COMMENT '字典id',
+                                                            `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性名称',
+                                                            `code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性code',
+                                                            `sort` int NULL DEFAULT NULL COMMENT '排序',
+                                                            PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '协议调度字典详情' ROW_FORMAT = Dynamic;
+
+
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (1, 0, 1, '是', '1', 1);
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (2, 0, 1, '否', '0', 2);
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (7, 0, 4, '客车', 'A0', 1);
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (8, 0, 4, '货车', 'A1', 2);
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (10, 0, 5, '家庭自用', '05', 1);
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (11, 0, 5, '非营业机关', '06', 2);
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (12, 0, 5, '非营业企业', '07', 3);
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (13, 0, 5, '非营业货运', '08', 4);
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (15, 0, 5, '营业出租租赁', '01', 1);
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (17, 0, 5, '营业城市公交', '02', 3);
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (18, 0, 5, '营业公路客运', '03', 4);
+INSERT INTO `ptl_agreement_dispatch_rules_dict_labal` VALUES (19, 0, 5, '营业货运', '04', 5);
+
+-- 协议调度匹配信息记录表   add by hxl  2024-05-29
+DROP TABLE IF EXISTS `ptl_tax_source_new_record`;
+CREATE TABLE `ptl_tax_source_new_record`  (
+                                              `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键/自增',
+                                              `orderno` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '主订单编号',
+                                              `ptl_tax_source_new_str` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '调度协议对象信息',
+                                              `dispatch_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '调度协议规则内容',
+                                              `quote_info_msg` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '报价信息内容',
+                                              `mate_msg` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '匹配信息',
+                                              `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+                                              `create_user` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建人',
+                                              PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '调度协议默认匹配信息记录表' ROW_FORMAT = Dynamic;

+ 51 - 0
src/main/java/com/ydtech/constants/enums/InsuranceRisk.java

@@ -6,6 +6,7 @@ import com.ydtech.modules.ins.model.vo.KindInfoVo;
 import com.ydtech.modules.ins.model.vo.RiskInfoVo;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
+import org.apache.commons.lang3.StringUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -83,4 +84,54 @@ public enum InsuranceRisk {
     }
 
 
+    /**
+     * 判断是否投保车损
+     *
+     * @param kinds 险种信息
+     * @return
+     */
+    public static Boolean getFlagByA(List<KindInfoVo> kinds) {
+        boolean haveCarDamageKind = false;//是否含车损
+        for (KindInfoVo kindInfoVo : kinds) {
+            String code = kindInfoVo.getKindCode();
+            // 车损
+            if (InsurKind.A.getCode().equalsIgnoreCase(code)) {
+                haveCarDamageKind = true;
+            }
+        }
+        return haveCarDamageKind;
+    }
+
+    /**
+     * 判断是否投保三者险
+     * @param kinds 险种信息
+     * @return
+     */
+    public static String getStringByB(List<KindInfoVo> kinds) {
+        String val=null;
+        for (KindInfoVo kindInfoVo : kinds) {
+            String code = kindInfoVo.getKindCode();
+            // 车损
+            if (InsurKind.B.getCode().equalsIgnoreCase(code) && StringUtils.isNotEmpty(kindInfoVo.getAmount()+"")) {
+                val= kindInfoVo.getAmount()+"";
+            }
+        }
+        return val;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/28 10:14
+     *  @Description: 判断是否投保交强
+     */
+    public static Boolean getFlagByTRAFFIC(List<RiskInfoVo> risks) {
+        boolean trafficFlag = false;//是否含交强
+        for (RiskInfoVo risk : risks) {
+            // 交强
+            if (InsuranceRisk.TRAFFIC.getCode().equals(risk.getRiskCode())) {
+                trafficFlag = true;
+            }
+        }
+        return trafficFlag;
+    }
 }

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

@@ -29,6 +29,7 @@ import com.ydtech.modules.order.service.InsAreaCompanyAccidentalDrivingService;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
+import com.ydtech.modules.protocol.service.PtlTaxSourceNewService;
 import com.ydtech.modules.protocol.service.impl.TaxSourceServiceImpl;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
@@ -78,6 +79,8 @@ public class QuoteVerificationAspect {
 
     private final SysUserService sysUserService;
 
+    private final PtlTaxSourceNewService ptlTaxSourceNewService;
+
     @AfterReturning(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "result")
     public void doAfter(HttpResult<QuoteRespVo> result) {
         //计算费用因子
@@ -147,20 +150,33 @@ public class QuoteVerificationAspect {
                 List<RiskInfoVo> risks = quoteInfo.getRiskList();
 
                 ProductsType insuranceRisk = InsuranceRisk.determineInsuranceInformation(kinds, risks);
-
+                //
+                //注释之前的的税源判断   add by hxl
+                /**
                 String taxAgreementId = taxSourceService.getAgreementId(deptId, userId, companyId, quoteInfo.getCarInfo().getLicenseNo(),
                         quoteInfo.getCarInfo().getEnginedesc(), insuranceRisk.getCode());
                 if (!"".equals(taxAgreementId)) {
                     ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
                 }
-
-
+                **/
+                String isTaxSource = ((BaseQuoteVo<?>) arg).getIsTaxSource();
+                //默认协议走逻辑判断
+                if(StringUtils.isNotBlank(isTaxSource) && "1".equals(isTaxSource)){
+                    String taxAgreementId = ptlTaxSourceNewService.getAgreementId(deptId, userId, companyId, quoteInfo,insuranceRisk.getCode(),orderno);
+                    ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
+                     log.info("======================订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId+"=======================");
+                    // throw new SystemException("订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId);
+               }
+                //else{
+                //    throw new SystemException("走正常协议逻辑!");
+               // }
                 SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
                 if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
                     return;
                 }
 
                 ptlAgreementDeptService.agreementIsAuthorized(deptId, agreementId);
+
             }
         }
     }

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

@@ -49,4 +49,7 @@ public class BaseQuoteVo<T> {
     @ApiModelProperty("用户id")
     private String  userId;
 
+    @ApiModelProperty("协议是否默认1.为是,其他为否")
+    private String isTaxSource;
+
 }

+ 62 - 0
src/main/java/com/ydtech/modules/protocol/constants/DispatchTypeConstants.java

@@ -0,0 +1,62 @@
+package com.ydtech.modules.protocol.constants;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/24 14:17
+ *  @Description:  协议调度的常量
+ */
+@Getter
+@AllArgsConstructor
+public enum DispatchTypeConstants {
+
+    DISPATCH_TYPE_CONSTANTS_1(1, "LicenseNo","车牌号"),
+    DISPATCH_TYPE_CONSTANTS_2(2,"PassengerCarSeatingCapacity","座位数"),
+    DISPATCH_TYPE_CONSTANTS_3(3, "volume","排量"),
+    DISPATCH_TYPE_CONSTANTS_4(4, "CarType","车辆大类"),
+    DISPATCH_TYPE_CONSTANTS_5(5, "NatureOfUse","使用性质"),
+    DISPATCH_TYPE_CONSTANTS_6(6, "yqInsureFlag","交强投保"),
+    DISPATCH_TYPE_CONSTANTS_7(7, "cxInsureFlag","车损投保"),
+    DISPATCH_TYPE_CONSTANTS_8(8, "ThirdPartyLiabilityInsurance","第三者责任险");
+
+    private final Integer num;
+
+    private final String code;
+
+    private final String desc;
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/28 8:52
+     *  @Description:  通过code获取值
+     */
+    public static String matchKey(String key) {
+        String result = "";
+        for (DispatchTypeConstants e : values()) {
+            if (Objects.equals(e.getCode(), key)) {
+                result = e.getDesc();
+                break;
+            }
+        }
+        return result;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/28 9:00
+     *  @Description:  排除的非空判断
+     */
+    public static List<String> removalOfCode() {
+        return Arrays.asList(DISPATCH_TYPE_CONSTANTS_6.getCode(), DISPATCH_TYPE_CONSTANTS_7.getCode(), DISPATCH_TYPE_CONSTANTS_8.getCode());
+    }
+}

+ 135 - 0
src/main/java/com/ydtech/modules/protocol/controller/PtlTaxSourceNewController.java

@@ -0,0 +1,135 @@
+package com.ydtech.modules.protocol.controller;
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.protocol.entity.dto.PtlTaxSourceNewDto;
+import com.ydtech.modules.protocol.entity.vo.*;
+import com.ydtech.modules.protocol.service.PtlTaxSourceNewService;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttr;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesAttrService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api(tags = "协议调度管理")
+@RequestMapping("/tax/source/new")
+@RestController
+public class PtlTaxSourceNewController extends BaseController {
+
+    @Autowired
+    private PtlTaxSourceNewService ptlTaxSourceNewService;
+
+    @Autowired
+    private PtlAgreementDispatchRulesAttrService  ptlAgreementDispatchRulesAttrService;
+
+
+    @PostMapping("queryPage")
+    @ApiOperation(value = "协议调度管理列表分页")
+    public HttpResult<BasePageResult<PtlTaxSourceNewVo>> queryPage(@Validated @RequestBody PtlTaxSourceNewDto ptlTaxSourceNewDto) {
+        try{
+            BasePageResult<PtlTaxSourceNewVo> result = ptlTaxSourceNewService.queryPage(ptlTaxSourceNewDto);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+
+    @PostMapping("addOrUpdate")
+    @ApiOperation("协议调度添加和修改")
+    public HttpResult<Object> addOrUpdate(@Validated @RequestBody  PtlTaxSourceNewAddVo ptlTaxSourceNewAddVo) {
+        try{
+            String msg="";
+            if(ptlTaxSourceNewAddVo.getId()!=null && !"".equals(ptlTaxSourceNewAddVo.getId())){
+                ptlTaxSourceNewService.update(ptlTaxSourceNewAddVo);
+                msg="修改成功";
+            }else{
+                ptlTaxSourceNewService.add(ptlTaxSourceNewAddVo);
+                msg="添加成功";
+            }
+            return HttpResult.ok(msg);
+        }catch (Exception e){
+            return HttpResult.error("操作失败"+e.getMessage());
+        }
+
+    }
+    @PostMapping("delete")
+    @ApiOperation("协议调度批量删除")
+    public HttpResult<Object> delete(@RequestBody PtlTaxSourceNewIdsVo idsVo) {
+        if(idsVo.getIds()==null || idsVo.getIds().size()==0){
+            return HttpResult.error("选择的ids不能为空");
+        }
+        try{
+            ptlTaxSourceNewService.deleteByIds(idsVo.getIds());
+            return HttpResult.ok("删除成功");
+        }catch (Exception e){
+            return HttpResult.error("删除失败"+e.getMessage());
+        }
+    }
+    @PostMapping("/saveOrUpdateExcludeDepts")
+    @ApiOperation("保存或修改排除部门")
+    public HttpResult saveOrUpdateExcludeDepts(@RequestBody PtlTaxSourceNewAddDeptIdsVo taxSourceVo) {
+        try{
+            if(taxSourceVo.getInsCompanyId()==null || "".equals(taxSourceVo.getInsCompanyId())){
+                return HttpResult.error("保险公司id不能为空insCompanyId");
+            }
+           // if(taxSourceVo.getAgreementTaxExcludeDeptList()==null || taxSourceVo.getAgreementTaxExcludeDeptList().size()==0){
+           //     return HttpResult.error("选择的排除部门ids不能为空");
+           // }
+            ptlTaxSourceNewService.saveDeptIds(taxSourceVo);
+            return HttpResult.ok("保存排除部门成功");
+        }catch (Exception e){
+            return HttpResult.error("保存排除部门失败"+e.getMessage());
+        }
+    }
+
+    @GetMapping("/getDeptIdsByCompanyId")
+    @ApiOperation("通过公司id查询排除公司的ids")
+    public HttpResult getDeptIdsByCompanyId(String insCompanyId) {
+        try{
+            if(insCompanyId==null || "".equals(insCompanyId)){
+                return HttpResult.error("保险公司id不能为空insCompanyId");
+            }
+            List<String> deptIdsByCompanyId = ptlTaxSourceNewService.getDeptIdsByCompanyId(insCompanyId);
+            return HttpResult.ok(deptIdsByCompanyId);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/23 12:18
+     *  @Description:   查询协议调度规则配置表的列表信息
+     */
+    @ApiOperation(value = "协议调度规则属性列表")
+    @GetMapping("/attr/list")
+    public HttpResult<List<PtlAgreementDispatchRulesAttr>> list() {
+        List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList = ptlAgreementDispatchRulesAttrService.getDispatchRulesAttrList();
+        return HttpResult.ok(dispatchRulesAttrList);
+    }
+
+    @ApiOperation(value = "通过保险公司协议调度规则属性列表暂时不用后续可能需要")
+    @GetMapping("/attr/listByCompanyId")
+    public HttpResult<List<PtlAgreementDispatchRulesAttr>> listByCompanyId(String companyId) {
+        List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList = ptlAgreementDispatchRulesAttrService.getDispatchRulesAttrList(companyId);
+        return HttpResult.ok(dispatchRulesAttrList);
+    }
+
+
+
+    @ApiOperation(value = "根据id查询协议调度对象")
+    @GetMapping("/getById")
+    public HttpResult getById(Long id){
+        if(id==null){
+            return HttpResult.error("id不能为空");
+        }
+        List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList = ptlAgreementDispatchRulesAttrService.getDispatchRulesAttrList();
+        PtlTaxSourceNewSaveVo ptlTaxSourceNewSaveVo = ptlTaxSourceNewService.rulesGet(id, dispatchRulesAttrList);
+        return HttpResult.ok(ptlTaxSourceNewSaveVo);
+    }
+}

+ 18 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlTaxSourceNewHistoryMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocol.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNewHistory;
+
+/**
+ * @author wenks
+ * @description 针对表【ptl_agreement(协议信息表)】的数据库操作Mapper
+ * @createDate 2023-06-05 17:59:52
+ * @Entity com.ydtech.modules.protocol.entity.po.PtlAgreement
+ */
+public interface PtlTaxSourceNewHistoryMapper extends BaseMapper<PtlTaxSourceNewHistory> {
+
+}
+
+
+
+

+ 60 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlTaxSourceNewMapper.java

@@ -0,0 +1,60 @@
+package com.ydtech.modules.protocol.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
+import com.ydtech.modules.protocol.entity.dto.PtlTaxSourceNewDto;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewAddVo;
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author wenks
+ * @description 针对表【ptl_agreement(协议信息表)】的数据库操作Mapper
+ * @createDate 2023-06-05 17:59:52
+ * @Entity com.ydtech.modules.protocol.entity.po.PtlAgreement
+ */
+public interface PtlTaxSourceNewMapper extends BaseMapper<PtlTaxSourceNew> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/22 15:51
+     *  @Description: 协议调度分页
+     */
+    Page<PtlTaxSourceNewVo> queryPage(@Param("page") Page<SysUserLinkPtlAgreementDto> page, @Param("vo")  PtlTaxSourceNewDto ptlTaxSourceNewDto);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/22 16:02
+     *  @Description:  通过协议id和车牌和id查询是否存在数据
+     */
+    int findListByParams(@Param("vo") PtlTaxSourceNewAddVo ptlTaxSourceNewAddVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/23 16:17
+     *  @Description: 通过ids批量查询数据
+     */
+    List<PtlTaxSourceNew> findListByIds(@Param("ids") List<Long> ids);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/24 17:03
+     *  @Description:  通过保险公司id查询默认的数据
+     */
+    PtlTaxSourceNew findDefaultAttrLinkByInsCompanyId(@Param("insCompanyId") String insCompanyId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/24 17:03
+     *  @Description:  通过所有保险保险的默认的数据
+     */
+    List<PtlTaxSourceNew> findDefaultAllAttrLink();
+}
+
+
+
+

+ 18 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlTaxSourceNewRecordMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocol.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNewRecord;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/29 17:14
+ *  @Description:  协议调度信息匹配表
+ */
+public interface PtlTaxSourceNewRecordMapper extends BaseMapper<PtlTaxSourceNewRecord> {
+
+}
+
+
+
+

+ 38 - 0
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlTaxSourceNewDto.java

@@ -0,0 +1,38 @@
+package com.ydtech.modules.protocol.entity.dto;
+
+import com.ydtech.core.page.PageRequest;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/22 14:30
+ *  @Description:  协议调度查询对象
+ */
+@Data
+@ApiModel("协议调度查询对象")
+public class PtlTaxSourceNewDto extends PageRequest {
+
+    /**
+     * 保险公司id
+     */
+    @NotBlank(message = "保险公司id不能为空")
+    @ApiModelProperty("保险公司id")
+    private String insCompanyId;
+
+    /**
+     * 协议Id
+     */
+    @ApiModelProperty("协议id")
+    private String agreementId;
+
+    /**
+     * 车牌号
+     */
+    @ApiModelProperty("车牌号")
+    private String license;
+}

+ 96 - 0
src/main/java/com/ydtech/modules/protocol/entity/po/PtlTaxSourceNew.java

@@ -0,0 +1,96 @@
+package com.ydtech.modules.protocol.entity.po;
+
+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.protocol.entity.vo.PtlTaxSourceNewAddVo;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/22 12:07
+ *  @Description: 协议调度管理
+ */
+@Data
+@TableName(value = "ptl_tax_source_new")
+public class PtlTaxSourceNew implements Serializable {
+    /**
+     * 主键/自增
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+    /**
+     * 保险公司id
+     */
+    @TableField(value = "ins_company_id")
+    private String insCompanyId;
+
+    /**
+     * 保险公司名称
+     */
+    @TableField(value = "ins_company_name")
+    private String insCompanyName;
+
+    /**
+     * 协议Id
+     */
+    @TableField(value = "agreement_id")
+    private String agreementId;
+    /**
+     * 调度内容
+     */
+    @TableField(value = "dispatch_content")
+    private String dispatchContent;
+    /**
+     * 优先级
+     */
+    @TableField(value = "priority")
+    private Integer priority;
+
+    /**
+     * 是否默认
+     */
+    @TableField(value = "default_flag")
+    private String defaultFlag;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    @TableField(value = "create_user")
+    private String createUser;
+
+    /**
+     * 修改时间
+     */
+    @TableField(value = "update_time")
+    private Date updateTime;
+
+    /**
+     * 修改人
+     */
+    @TableField(value = "update_user")
+    private String updateUser;
+
+    public PtlTaxSourceNew() {
+    }
+
+    public PtlTaxSourceNew getNewEntity(PtlTaxSourceNewAddVo ptlTaxSourceNewAddVo,PtlTaxSourceNew ptlTaxSourceNew) {
+        ptlTaxSourceNew.setInsCompanyId(ptlTaxSourceNewAddVo.getInsCompanyId());
+        ptlTaxSourceNew.setInsCompanyName(ptlTaxSourceNewAddVo.getInsCompanyName());
+        ptlTaxSourceNew.setAgreementId(ptlTaxSourceNewAddVo.getAgreementId());
+        ptlTaxSourceNew.setPriority(ptlTaxSourceNewAddVo.getPriority());
+        ptlTaxSourceNew.setDefaultFlag(ptlTaxSourceNewAddVo.getDefaultFlag());
+        return ptlTaxSourceNew;
+    }
+}

+ 89 - 0
src/main/java/com/ydtech/modules/protocol/entity/po/PtlTaxSourceNewHistory.java

@@ -0,0 +1,89 @@
+package com.ydtech.modules.protocol.entity.po;
+
+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;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/22 12:07
+ *  @Description: 协议调度历史记录表管理
+ */
+@Data
+@TableName(value = "ptl_tax_source_new_history")
+public class PtlTaxSourceNewHistory implements Serializable {
+    /**
+     * 主键/自增
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+    /**
+     *  协议调度表id
+     */
+    @TableField(value = "ptl_tax_source_new_id")
+    private Long ptlTaxSourceNewId;
+
+    /**
+     *  批次Id
+     */
+    @TableField(value = "batch_id")
+    private String batchId;
+
+    /**
+     *  批次类型
+     */
+    @TableField(value = "batch_type")
+    private String batchType;
+
+    /**
+     * 保险公司id
+     */
+    @TableField(value = "ins_company_id")
+    private String insCompanyId;
+
+    /**
+     * 保险公司名称
+     */
+    @TableField(value = "ins_company_name")
+    private String insCompanyName;
+
+    /**
+     * 协议Id
+     */
+    @TableField(value = "agreement_id")
+    private String agreementId;
+    /**
+     * 调度内容
+     */
+    @TableField(value = "dispatch_content")
+    private String dispatchContent;
+    /**
+     * 优先级
+     */
+    @TableField(value = "priority")
+    private Integer priority;
+
+    /**
+     * 是否默认
+     */
+    @TableField(value = "default_flag")
+    private String defaultFlag;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "operator_time")
+    private LocalDateTime operatorTime;
+
+    /**
+     * 创建人
+     */
+    @TableField(value = "modifier")
+    private String modifier;
+}

+ 76 - 0
src/main/java/com/ydtech/modules/protocol/entity/po/PtlTaxSourceNewRecord.java

@@ -0,0 +1,76 @@
+package com.ydtech.modules.protocol.entity.po;
+
+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.Date;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/22 12:07
+ *  @Description: 协议调度信息匹配记录表
+ */
+@Data
+@TableName(value = "ptl_tax_source_new_record")
+public class PtlTaxSourceNewRecord implements Serializable {
+    /**
+     * 主键/自增
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+    /**
+     * 主订单编号
+     */
+    @TableField(value = "orderno")
+    private String orderno;
+
+    /**
+     * 调度协议对象信息
+     */
+    @TableField(value = "ptl_tax_source_new_str")
+    private String ptlTaxSourceNewStr;
+
+    /**
+     * 调度协议规则内容
+     */
+    @TableField(value = "dispatch_content")
+    private String dispatchContent;
+    /**
+     * 报价信息内容
+     */
+    @TableField(value = "quote_info_msg")
+    private String quoteInfoMsg;
+    /**
+     * 匹配信息
+     */
+    @TableField(value = "mate_msg")
+    private String mateMsg;
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+    /**
+     * 创建人
+     */
+    @TableField(value = "create_user")
+    private String createUser;
+
+    public PtlTaxSourceNewRecord() {
+    }
+
+    public PtlTaxSourceNewRecord(String orderno, String ptlTaxSourceNewStr, String dispatchContent, String quoteInfoMsg, String mateMsg, Date createTime, String createUser) {
+        this.orderno = orderno;
+        this.ptlTaxSourceNewStr = ptlTaxSourceNewStr;
+        this.dispatchContent = dispatchContent;
+        this.quoteInfoMsg = quoteInfoMsg;
+        this.mateMsg = mateMsg;
+        this.createTime = createTime;
+        this.createUser = createUser;
+    }
+}

+ 26 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewAddDeptIdsVo.java

@@ -0,0 +1,26 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/22 14:30
+ *  @Description:  协议调度查询对象
+ */
+@Data
+@ApiModel("协议调度排除部门对象")
+public class PtlTaxSourceNewAddDeptIdsVo {
+
+    @ApiModelProperty("保险公司id")
+    private String insCompanyId;
+    /**
+     * 税源排除的部门
+     */
+    @ApiModelProperty("排除的部门ids")
+    private List<String> agreementTaxExcludeDeptList;
+}

+ 79 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewAddVo.java

@@ -0,0 +1,79 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLink;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/22 14:30
+ *  @Description:  协议调度查询对象
+ */
+@Data
+@ApiModel("协议调度保存对象")
+public class PtlTaxSourceNewAddVo {
+
+
+    /**
+     * 主键/自增
+     */
+    @ApiModelProperty("id")
+    private String id;
+    /**
+     * 保险公司id
+     */
+    @NotBlank(message = "[保险公司id]不能为空")
+    @ApiModelProperty("保险公司id")
+    private String insCompanyId;
+
+    /**
+     * 保险公司名称
+     */
+    @NotBlank(message = "[保险公司名称]不能为空")
+    @ApiModelProperty(value = "保险公司名称")
+    private String insCompanyName;
+
+    /**
+     * 协议Id
+     */
+    @NotBlank(message = "[协议id]不能为空")
+    @ApiModelProperty("协议id")
+    private String agreementId;
+    /**
+      *  优先级
+     */
+    @NotNull(message = "[优先级]不能为空")
+    @ApiModelProperty("优先级")
+    private Integer priority;
+
+    /**
+     * 是否默认
+     */
+    @NotBlank(message = "[是否默认]不能为空")
+    @ApiModelProperty("是否默认")
+    private String defaultFlag;
+    
+    /**
+     *   调度规则
+     */
+    @NotEmpty(message = "[调度规则列表]不能为空")
+    @ApiModelProperty("调度规则列表")
+    private List<PtlAgreementDispatchRulesAttrLink> attrLinks;
+
+
+    /**
+     * 根据code获取费用属性
+     * @param code
+     * @return
+     */
+    public PtlAgreementDispatchRulesAttrLink getAttrLinkByCode(String code) {
+        return this.getAttrLinks().stream().filter(attrLink -> code.equals(attrLink.getAttrCode())).findFirst().orElse(null);
+    }
+}

+ 23 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewIdsVo.java

@@ -0,0 +1,23 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/22 14:30
+ *  @Description:  协议调度查询对象
+ */
+@Data
+@ApiModel("协议调度删除对象")
+public class PtlTaxSourceNewIdsVo {
+    /***
+     * 用户ID
+     */
+    @ApiModelProperty("删除ids")
+    private List<Long> ids;
+}

+ 80 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewSaveVo.java

@@ -0,0 +1,80 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttr;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/22 14:30
+ *  @Description:  协议调度查询对象
+ */
+@Data
+@ApiModel("协议调度对象")
+public class PtlTaxSourceNewSaveVo {
+
+
+    /**
+     * 主键/自增
+     */
+    @ApiModelProperty("id")
+    private Long id;
+    /**
+     * 保险公司id
+     */
+    @ApiModelProperty("保险公司id")
+    private String insCompanyId;
+
+    /**
+     * 保险公司名称
+     */
+    @ApiModelProperty(value = "保险公司名称")
+    private String insCompanyName;
+
+    /**
+     * 协议Id
+     */
+    @ApiModelProperty("协议id")
+    private String agreementId;
+    /**
+      *  优先级
+     */
+    @ApiModelProperty("优先级")
+    private Integer priority;
+
+    /**
+     * 是否默认
+     */
+    @ApiModelProperty("是否默认")
+    private String defaultFlag;
+
+    /**
+     * 描述
+     */
+    @ApiModelProperty("描述")
+    private String dispatchContent;
+    /**
+     *   调度规则
+     */
+    @ApiModelProperty("调度规则列表")
+    private List<PtlAgreementDispatchRulesAttr> attrLinks;
+
+
+    public PtlTaxSourceNewSaveVo() {
+    }
+
+    public PtlTaxSourceNewSaveVo(PtlTaxSourceNew ptlTaxSourceNew) {
+        this.id=ptlTaxSourceNew.getId();
+        this.insCompanyId=ptlTaxSourceNew.getInsCompanyId();
+        this.insCompanyName=ptlTaxSourceNew.getInsCompanyName();
+        this.agreementId=ptlTaxSourceNew.getAgreementId();
+        this.priority=ptlTaxSourceNew.getPriority();
+        this.defaultFlag=ptlTaxSourceNew.getDefaultFlag();
+        this.dispatchContent=ptlTaxSourceNew.getDispatchContent();
+    }
+}

+ 68 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewVo.java

@@ -0,0 +1,68 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/22 14:30
+ *  @Description:  协议调度查询对象
+ */
+@Data
+@ApiModel("协议调度列表对象")
+public class PtlTaxSourceNewVo {
+
+
+    /**
+     * 主键/自增
+     */
+    @ApiModelProperty("id")
+    private String id;
+    /**
+     * 保险公司id
+     */
+    @ApiModelProperty("保险公司id")
+    private String insCompanyId;
+
+    /**
+     * 保险公司名称
+     */
+    @TableField(value = "保险公司名称")
+    private String insCompanyName;
+
+    /**
+     * 协议Id
+     */
+    @ApiModelProperty("协议id")
+    private String agreementId;
+
+    /**
+     * 协议Id
+     */
+    @ApiModelProperty("协议名称")
+    private String agreementName;
+    /**
+     *  协议编码
+     */
+    @ApiModelProperty("协议编码")
+    private String agreementCode;
+    /**
+     * 内容
+     */
+    @ApiModelProperty("描述")
+    private String dispatchContent;
+
+    /**
+     * 优先级
+     */
+    @ApiModelProperty("优先级")
+    private Integer  priority;
+    /**
+     * 是否默认
+     */
+    @ApiModelProperty("是否默认")
+    private Boolean defaultFlag;
+}

+ 8 - 0
src/main/java/com/ydtech/modules/protocol/service/PtlTaxSourceNewHistoryService.java

@@ -0,0 +1,8 @@
+package com.ydtech.modules.protocol.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNewHistory;
+
+public interface PtlTaxSourceNewHistoryService extends IService<PtlTaxSourceNewHistory> {
+
+}

+ 14 - 0
src/main/java/com/ydtech/modules/protocol/service/PtlTaxSourceNewRecordService.java

@@ -0,0 +1,14 @@
+package com.ydtech.modules.protocol.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNewRecord;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/29 17:15
+ *  @Description: 协议匹配信息记录表
+ */
+public interface PtlTaxSourceNewRecordService extends IService<PtlTaxSourceNewRecord> {
+
+}

+ 76 - 0
src/main/java/com/ydtech/modules/protocol/service/PtlTaxSourceNewService.java

@@ -0,0 +1,76 @@
+package com.ydtech.modules.protocol.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
+import com.ydtech.modules.protocol.entity.dto.PtlTaxSourceNewDto;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewAddDeptIdsVo;
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewAddVo;
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewSaveVo;
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewVo;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttr;
+
+import java.util.List;
+
+public interface PtlTaxSourceNewService extends IService<PtlTaxSourceNew> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/22 14:54
+     *  @Description: 分页查询
+     */
+    BasePageResult<PtlTaxSourceNewVo> queryPage(PtlTaxSourceNewDto ptlTaxSourceNewDto);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/22 15:10
+     *  @Description:修改
+     */
+    void update(PtlTaxSourceNewAddVo ptlTaxSourceNewAddVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/22 15:16
+     *  @Description:  批量删除数据
+     */
+    void deleteByIds(List<Long> ids);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/22 15:31
+     *  @Description: 保存排除的保险公司机构
+     */
+    void saveDeptIds(PtlTaxSourceNewAddDeptIdsVo taxSourceVo);
+
+     /**
+      *  @version
+      *  @author: hxl
+      *  @Date: 2024/5/22 15:42
+      *  @Description:  通过保险公司id查询排除部门ids
+      */
+    List<String>  getDeptIdsByCompanyId(String companyId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/23 14:37
+     *  @Description: 添加
+     */
+    void add(PtlTaxSourceNewAddVo ptlTaxSourceNewAddVo);
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/24 15:33
+     *  @Description:  校验车牌、排量、排除部门
+     */
+    public String getAgreementId(String deptId, String userId, String companyId, BaseQuoteInfoVo quoteInfo,String riskCode,String orderno);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/24 18:05
+     *  @Description: 通过id查询对象
+     */
+    PtlTaxSourceNewSaveVo rulesGet(Long id, List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList);
+}

+ 18 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceRecordServiceImpl.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocol.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.protocol.dao.PtlTaxSourceNewRecordMapper;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNewRecord;
+import com.ydtech.modules.protocol.service.PtlTaxSourceNewRecordService;
+import org.springframework.stereotype.Service;
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/29 17:19
+ *  @Description: 协议匹配信息记录表
+ */
+@Service
+public class PtlTaxSourceRecordServiceImpl extends ServiceImpl<PtlTaxSourceNewRecordMapper, PtlTaxSourceNewRecord> implements PtlTaxSourceNewRecordService {
+
+
+}

+ 13 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceServiceHistoryImpl.java

@@ -0,0 +1,13 @@
+package com.ydtech.modules.protocol.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.protocol.dao.PtlTaxSourceNewHistoryMapper;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNewHistory;
+import com.ydtech.modules.protocol.service.PtlTaxSourceNewHistoryService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PtlTaxSourceServiceHistoryImpl extends ServiceImpl<PtlTaxSourceNewHistoryMapper, PtlTaxSourceNewHistory> implements PtlTaxSourceNewHistoryService {
+
+
+}

+ 782 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceServiceImpl.java

@@ -0,0 +1,782 @@
+package com.ydtech.modules.protocol.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.constants.enums.InsuranceRisk;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
+import com.ydtech.modules.ins.model.vo.RiskInfoVo;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
+import com.ydtech.modules.protocol.constants.DispatchTypeConstants;
+import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
+import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
+import com.ydtech.modules.protocol.entity.dto.PtlTaxSourceNewDto;
+import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
+import com.ydtech.modules.protocol.entity.po.PtlAreaLicense;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNewHistory;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNewRecord;
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewAddDeptIdsVo;
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewAddVo;
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewSaveVo;
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewVo;
+import com.ydtech.modules.protocol.service.*;
+import com.ydtech.modules.protocol.utils.RulesMergeStrUtils;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttr;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLink;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLinkHistory;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDictLabal;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesAttrLinkHistoryService;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesAttrLinkService;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesAttrService;
+import com.ydtech.utils.idgen.IdGenerate;
+import org.apache.commons.lang3.StringUtils;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static com.ydtech.modules.order.utils.InsuranceLog.logger;
+
+@Service
+public class PtlTaxSourceServiceImpl extends ServiceImpl<PtlTaxSourceNewMapper, PtlTaxSourceNew> implements PtlTaxSourceNewService {
+
+    @Autowired
+    private ITaxSourceExcludeService taxSourceExcludeService;
+
+    @Autowired
+    private PtlTaxSourceNewMapper ptlTaxSourceNewMapper;
+
+
+    @Autowired
+    private PtlTaxSourceNewHistoryService ptlTaxSourceNewHistoryService;
+
+    @Autowired
+    private PtlAgreementDispatchRulesAttrService ptlAgreementDispatchRulesAttrService;
+
+
+    @Autowired
+    private PtlAgreementDispatchRulesAttrLinkService ptlAgreementDispatchRulesAttrLinkService;
+
+    @Autowired
+    private PtlAgreementDispatchRulesAttrLinkHistoryService ptlAgreementDispatchRulesAttrLinkHistoryService;
+
+
+    @Autowired
+    private PtlAreaLicenseService ptlAreaLicenseService;
+
+    @Autowired
+    private PtlTaxSourceNewRecordService ptlTaxSourceNewRecordService;
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/22 15:44
+     *  @Description: 协议调度分页
+     */
+    @Override
+    public BasePageResult<PtlTaxSourceNewVo> queryPage(PtlTaxSourceNewDto ptlTaxSourceNewDto) {
+        Page<SysUserLinkPtlAgreementDto> page = new Page<>(ptlTaxSourceNewDto.getPageNum(),
+                ptlTaxSourceNewDto.getPageSize());
+        Page<PtlTaxSourceNewVo> ptlTaxSourceNewVoBasePageResult = ptlTaxSourceNewMapper.queryPage(page, ptlTaxSourceNewDto);
+        return  new BasePageResult<>(ptlTaxSourceNewDto.getPageNum(), page.getSize(), ptlTaxSourceNewVoBasePageResult.getTotal(), page.getPages(),
+                ptlTaxSourceNewVoBasePageResult.getRecords());
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/22 15:44
+     *  @Description: 协议调度保存或修改
+     */
+    @Transactional
+    @Override
+    public void add(PtlTaxSourceNewAddVo ptlTaxSourceNewAddVo) {
+        //添加
+      //  int count= ptlTaxSourceNewMapper.findListByParams(ptlTaxSourceNewAddVo);
+       // if(count>0){
+       //     throw new SystemException("该协议已经存在,不允许再次添加!!");
+       // }
+        //查询定义的规则表
+        List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList = ptlAgreementDispatchRulesAttrService.getDispatchRulesAttrList();
+        List<PtlAgreementDispatchRulesAttrLink> attrLinks = ptlTaxSourceNewAddVo.getAttrLinks();
+        String content = RulesMergeStrUtils.getRulesMergeStr(attrLinks, dispatchRulesAttrList);
+        if(content==null || "".equals(content)){
+            throw new SystemException("规则列表未填写,请添加规则!!");
+        }
+        //判断有没有默认值
+        PtlTaxSourceNew ptlTaxSourceNewDefault= ptlTaxSourceNewMapper.findDefaultAttrLinkByInsCompanyId(ptlTaxSourceNewAddVo.getInsCompanyId());
+        //新增
+        PtlTaxSourceNew ptlTaxSourceNew=new PtlTaxSourceNew();
+        ptlTaxSourceNew =ptlTaxSourceNew.getNewEntity(ptlTaxSourceNewAddVo,ptlTaxSourceNew);
+        ptlTaxSourceNew.setDispatchContent(content);
+        ptlTaxSourceNew.setCreateTime(new Date());
+        ptlTaxSourceNew.setCreateUser(BaseController.getUser().getId());
+        if(ptlTaxSourceNewDefault==null){
+            if("0".equals(ptlTaxSourceNew.getDefaultFlag())){
+                //设置数据为默认
+                throw new SystemException("该保险公司不存在默认数据,请设置为默认");
+            }
+        }else{
+            //当前数据为默认的话,将之前的数据设置为非默认
+            if("1".equals(ptlTaxSourceNew.getDefaultFlag()) ){
+                //将旧数据设置数据为非默认
+                ptlTaxSourceNewDefault.setDefaultFlag("0");
+                ptlTaxSourceNewMapper.updateById(ptlTaxSourceNewDefault);
+            }
+        }
+
+        ptlTaxSourceNewMapper.insert(ptlTaxSourceNew);
+        //生成批次ID
+        String uuid = IdGenerate.nextId();
+        //插入规则表
+        List<PtlAgreementDispatchRulesAttrLink> allAttrLink = new ArrayList<>();
+        List<PtlAgreementDispatchRulesAttrLinkHistory> dispatchAttrLinkHistories = new ArrayList<>();
+        PtlTaxSourceNew finalPtlTaxSourceNew = ptlTaxSourceNew;
+        attrLinks.forEach(x -> {
+            PtlAgreementDispatchRulesAttrLinkHistory dispatchAttrLinkHistory = new PtlAgreementDispatchRulesAttrLinkHistory();
+            //处理中文逗号
+            if (x.getMin() != null && x.getMin().contains(",")) {
+                x.setMin(x.getMin().replace(",", ","));
+            }
+            PtlAgreementDispatchRulesAttrLink finalX = x;
+            PtlAgreementDispatchRulesAttr ptlAgreementDispatchRulesAttr = dispatchRulesAttrList.stream().filter(y -> y.getAttrCode().equals(finalX.getAttrCode())).findFirst().orElse(new PtlAgreementDispatchRulesAttr());
+
+            //单独处理车牌号
+            if ("LicenseNo".equals(x.getAttrCode()) && (x.getMin() != null && !x.getMin().equals(""))) {
+                x.setOperator("0");
+                x.setId("0");
+                x.setRulesId(finalPtlTaxSourceNew.getId()+"");
+                allAttrLink.add(x);
+                BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
+                //设置产品费用因子历史记录
+                dispatchAttrLinkHistory.setId(null);
+                dispatchAttrLinkHistory.setBatch(uuid);
+                dispatchAttrLinkHistory.setOperatorType("add");
+                dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
+                dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
+                dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
+            } else {
+
+                if (ptlAgreementDispatchRulesAttr.getAttrType().equals("radio")|| "checkbox".equals(ptlAgreementDispatchRulesAttr.getAttrType())) {
+                    if ( null != x.getMin() && !"".equals(x.getMin())) {
+                        x.setId("0");
+                        x.setRulesId(finalPtlTaxSourceNew.getId()+"");
+                        x=getAttrLink(x);
+                        allAttrLink.add(x);
+                        BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
+                        //设置产品费用因子历史记录
+                        dispatchAttrLinkHistory.setId(null);
+                        dispatchAttrLinkHistory.setBatch(uuid);
+
+                        dispatchAttrLinkHistory.setOperatorType("add");
+                        dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
+                        dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
+                        dispatchAttrLinkHistory=getAttrLinkHistory(dispatchAttrLinkHistory);
+                        dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
+                    }
+                }else if( ( null != x.getMin() && !"0".equals(x.getMin())  &&  null != x.getOperator() && !"".equals(x.getOperator() )) || ( null != x.getMax() && !"0".equals(x.getMax())  &&  null != x.getOperator() && !"".equals(x.getOperator()) ) ) {
+                    x.setId("0");
+                    x.setRulesId(finalPtlTaxSourceNew.getId()+"");
+                    x=getAttrLink(x);
+                    allAttrLink.add(x);
+                    BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
+                    //设置产品费用因子历史记录
+                    dispatchAttrLinkHistory.setId(null);
+                    dispatchAttrLinkHistory.setBatch(uuid);
+                    dispatchAttrLinkHistory.setOperatorType("add");
+                    dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
+                    dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
+                    dispatchAttrLinkHistory=getAttrLinkHistory(dispatchAttrLinkHistory);
+                    dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
+                }
+            }
+        });
+        //插入调度历史记录表
+        //历史记录表
+        PtlTaxSourceNewHistory ptlTaxSourceNewHistory=new PtlTaxSourceNewHistory();
+        BeanUtils.copyProperties(ptlTaxSourceNew, ptlTaxSourceNewHistory);
+        ptlTaxSourceNewHistory.setId(null);
+        ptlTaxSourceNewHistory.setBatchId(uuid);
+        ptlTaxSourceNewHistory.setBatchType("add");
+        ptlTaxSourceNewHistory.setModifier(BaseController.getUser().getId());
+        ptlTaxSourceNewHistory.setOperatorTime(LocalDateTime.now());
+        ptlTaxSourceNewHistory.setPtlTaxSourceNewId(ptlTaxSourceNew.getId());
+        //插入调度规则记录表
+        ptlTaxSourceNewHistoryService.save(ptlTaxSourceNewHistory);
+        //保存产品费用因子历史记录
+        ptlAgreementDispatchRulesAttrLinkHistoryService.saveBatch(dispatchAttrLinkHistories);
+        ptlAgreementDispatchRulesAttrLinkService.saveBatch(allAttrLink);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/29 10:37
+     *  @Description:  获取前台的值防止回显错误
+     */
+    private PtlAgreementDispatchRulesAttrLink  getAttrLink(PtlAgreementDispatchRulesAttrLink x) {
+        if ("1".equals(x.getOperator())) {
+            //不处理
+            //范围不处理
+        } else if ("2".equals(x.getOperator())) {
+            //将大于的值替换为null
+            x.setMax(null);
+        } else if ("3".equals(x.getOperator())) {
+            //将大于的值替换为null
+            x.setMax(null);
+        } else if ("4".equals(x.getOperator())) {
+            //将小于的值替换为null
+            x.setMin(null);
+        } else if ("5".equals(x.getOperator())) {
+            //将小于的值替换为null
+            x.setMin(null);
+        }
+        return x;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/29 10:37
+     *  @Description:  获取前台的值防止回显错误
+     */
+    private PtlAgreementDispatchRulesAttrLinkHistory  getAttrLinkHistory(PtlAgreementDispatchRulesAttrLinkHistory x) {
+        if ("1".equals(x.getOperator())) {
+            //不处理
+            //范围不处理
+        } else if ("2".equals(x.getOperator())) {
+            //将大于的值替换为null
+            x.setMax(null);
+        } else if ("3".equals(x.getOperator())) {
+            //将大于的值替换为null
+            x.setMax(null);
+        } else if ("4".equals(x.getOperator())) {
+            //将小于的值替换为null
+            x.setMin(null);
+        } else if ("5".equals(x.getOperator())) {
+            //将小于的值替换为null
+            x.setMin(null);
+        }
+        return x;
+    }
+
+    @Transactional
+    @Override
+    public void update(PtlTaxSourceNewAddVo ptlTaxSourceNewAddVo) {
+       // int count= ptlTaxSourceNewMapper.findListByParams(ptlTaxSourceNewAddVo);
+       // if(count>0){
+       //     throw new SystemException("该协议已经存在,不允许再次添加!!");
+       // }
+        //查询定义的规则表
+        List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList = ptlAgreementDispatchRulesAttrService.getDispatchRulesAttrList();
+        List<PtlAgreementDispatchRulesAttrLink> attrLinks = ptlTaxSourceNewAddVo.getAttrLinks();
+        String content = RulesMergeStrUtils.getRulesMergeStr(attrLinks, dispatchRulesAttrList);
+        if(content==null || "".equals(content)){
+            throw new SystemException("规则列表未填写,请添加规则!!");
+        }
+
+        PtlTaxSourceNew ptlTaxSourceNewDefault= ptlTaxSourceNewMapper.findDefaultAttrLinkByInsCompanyId(ptlTaxSourceNewAddVo.getInsCompanyId());
+        //修改
+        PtlTaxSourceNew ptlTaxSourceNew = ptlTaxSourceNewMapper.selectById(ptlTaxSourceNewAddVo.getId());
+        ptlTaxSourceNew =ptlTaxSourceNew.getNewEntity(ptlTaxSourceNewAddVo,ptlTaxSourceNew);
+        if(ptlTaxSourceNewDefault!=null){
+            //当前数据为默认的话,将之前的数据设置为非默认
+            if("1".equals(ptlTaxSourceNew.getDefaultFlag()) ){
+                //将旧数据设置数据为非默认
+                ptlTaxSourceNewDefault.setDefaultFlag("0");
+                ptlTaxSourceNewMapper.updateById(ptlTaxSourceNewDefault);
+            }
+        }
+        ptlTaxSourceNew.setDispatchContent(content);
+        ptlTaxSourceNew.setUpdateTime(new Date());
+        ptlTaxSourceNew.setUpdateUser(BaseController.getUser().getId());
+        ptlTaxSourceNewMapper.updateById(ptlTaxSourceNew);
+
+
+
+        //先删除调度规则表信息
+        ptlAgreementDispatchRulesAttrLinkService.remove(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttrLink>()
+                .eq(PtlAgreementDispatchRulesAttrLink::getRulesId, ptlTaxSourceNew.getId()));
+        //插入规则表
+        List<PtlAgreementDispatchRulesAttrLink> allAttrLink = new ArrayList<>();
+        List<PtlAgreementDispatchRulesAttrLinkHistory> dispatchAttrLinkHistories = new ArrayList<>();
+        PtlTaxSourceNew finalPtlTaxSourceNew = ptlTaxSourceNew;
+        //生成批次ID
+        String uuid = IdGenerate.nextId();
+        attrLinks.forEach(x -> {
+            //转换数组
+            if(x.getMinArray() != null && x.getMinArray().length > 0){
+                x.setMin(String.join(",",x.getMinArray()));
+            }
+            //处理中文逗号
+            if(x.getMin() != null && x.getMin().contains(",")) {
+                x.setMin(x.getMin().replace(",",","));
+            }
+            //单独处理车牌号
+            if ("LicenseNo".equals(x.getAttrCode()) && (x.getMin() != null && x.getMin() != "")) {
+                x.setRulesId(finalPtlTaxSourceNew.getId()+"");
+                x.setId("0");
+                allAttrLink.add(x);
+                //设置产品费用因子历史记录
+                PtlAgreementDispatchRulesAttrLinkHistory dispatchAttrLinkHistory = new PtlAgreementDispatchRulesAttrLinkHistory();
+                BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
+                dispatchAttrLinkHistory.setId(null);
+                dispatchAttrLinkHistory.setBatch(uuid);
+                dispatchAttrLinkHistory.setOperatorType("update");
+                dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
+                dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
+                dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
+            } else {
+                PtlAgreementDispatchRulesAttrLink finalX = x;
+                PtlAgreementDispatchRulesAttr ptlAgreementDispatchRulesAttr = dispatchRulesAttrList.stream().filter(y -> y.getAttrCode().equals(finalX.getAttrCode())).findFirst().orElse(new PtlAgreementDispatchRulesAttr());
+                //单独判断radio  radio中存在0的属性值
+                if ("radio".equals(ptlAgreementDispatchRulesAttr.getAttrType()) || "checkbox".equals(ptlAgreementDispatchRulesAttr.getAttrType())) {
+                    if (null != x.getMin() && !"".equals(x.getMin())) {
+                        x.setRulesId(finalPtlTaxSourceNew.getId()+"");
+                        x.setId("0");
+                        x=getAttrLink(x);
+                        allAttrLink.add(x);
+                        //设置产品费用因子历史记录
+                        PtlAgreementDispatchRulesAttrLinkHistory dispatchAttrLinkHistory = new PtlAgreementDispatchRulesAttrLinkHistory();
+                        BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
+                        dispatchAttrLinkHistory.setId(null);
+                        dispatchAttrLinkHistory.setBatch(uuid);
+                        dispatchAttrLinkHistory.setOperatorType("update");
+                        dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
+                        dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
+                        dispatchAttrLinkHistory=getAttrLinkHistory(dispatchAttrLinkHistory);
+                        dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
+                    }
+                } else {
+                    if ( ( null != x.getMin() && !"0".equals(x.getMin())  &&  null != x.getOperator() && !"".equals(x.getOperator() )) || ( null != x.getMax() && !"0".equals(x.getMax())  &&  null != x.getOperator() && !"".equals(x.getOperator()) ) ) {
+                        x.setRulesId(finalPtlTaxSourceNew.getId()+"");
+                        x.setId("0");
+                        x=getAttrLink(x);
+                        allAttrLink.add(x);
+                        //设置产品费用因子历史记录
+                        PtlAgreementDispatchRulesAttrLinkHistory dispatchAttrLinkHistory = new PtlAgreementDispatchRulesAttrLinkHistory();
+                        BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
+                        dispatchAttrLinkHistory.setId(null);
+                        dispatchAttrLinkHistory.setBatch(uuid);
+                        dispatchAttrLinkHistory.setOperatorType("update");
+                        dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
+                        dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
+                        dispatchAttrLinkHistory=getAttrLinkHistory(dispatchAttrLinkHistory);
+                        dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
+                    }
+                }
+            }
+        });
+        //插入调度历史记录表
+        //历史记录表
+        PtlTaxSourceNewHistory ptlTaxSourceNewHistory=new PtlTaxSourceNewHistory();
+        BeanUtils.copyProperties(ptlTaxSourceNew, ptlTaxSourceNewHistory);
+        ptlTaxSourceNewHistory.setId(null);
+        ptlTaxSourceNewHistory.setBatchId(uuid);
+        ptlTaxSourceNewHistory.setBatchType("update");
+        ptlTaxSourceNewHistory.setModifier(BaseController.getUser().getId());
+        ptlTaxSourceNewHistory.setOperatorTime(LocalDateTime.now());
+        ptlTaxSourceNewHistory.setPtlTaxSourceNewId(ptlTaxSourceNew.getId());
+        //插入调度规则记录表
+        ptlTaxSourceNewHistoryService.save(ptlTaxSourceNewHistory);
+        //保存产品费用因子历史记录
+        ptlAgreementDispatchRulesAttrLinkHistoryService.saveBatch(dispatchAttrLinkHistories);
+        ptlAgreementDispatchRulesAttrLinkService.saveBatch(allAttrLink);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/22 15:44
+     *  @Description: 协议调度的删除
+     */
+    @Transactional
+    @Override
+    public void deleteByIds(List<Long> ids) {
+        //通过ids查询到数据执行
+        List<String> allLinkIds =new ArrayList<>();
+        List<PtlAgreementDispatchRulesAttrLinkHistory> dispatchAttrLinkHistories =new ArrayList<>();
+        List<PtlTaxSourceNewHistory> ptlTaxSourceNewHistorys =new ArrayList<>();
+         if(ids!=null && ids.size()>0){
+             //通过ids查询数据
+             List<PtlTaxSourceNew> list= ptlTaxSourceNewMapper.findListByIds(ids);
+             if(list!=null && list.size()>0){
+                  for(PtlTaxSourceNew ptlTaxSourceNew :list){
+                      String uuid = IdGenerate.nextId();
+                      List<PtlAgreementDispatchRulesAttrLink> linkList = ptlAgreementDispatchRulesAttrLinkService.list(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttrLink>()
+                              .eq(PtlAgreementDispatchRulesAttrLink::getRulesId, ptlTaxSourceNew.getId()));
+                      if(linkList!=null && linkList.size()>0) {
+                          for (PtlAgreementDispatchRulesAttrLink ptlAgreementDispatchRulesAttrLink : linkList) {
+                              //放入删除的规则表ids
+                              allLinkIds.add(ptlAgreementDispatchRulesAttrLink.getId());
+                              //添加规则历史表
+                              PtlAgreementDispatchRulesAttrLinkHistory dispatchAttrLinkHistory = new PtlAgreementDispatchRulesAttrLinkHistory();
+                              BeanUtils.copyProperties(ptlAgreementDispatchRulesAttrLink, dispatchAttrLinkHistory);
+                              dispatchAttrLinkHistory.setId(null);
+                              dispatchAttrLinkHistory.setBatch(uuid);
+                              dispatchAttrLinkHistory.setOperatorType("delete");
+                              dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
+                              dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
+                              dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
+                          }
+                      }
+                      //主表历史记录表
+                      PtlTaxSourceNewHistory ptlTaxSourceNewHistory=new PtlTaxSourceNewHistory();
+                      BeanUtils.copyProperties(ptlTaxSourceNew, ptlTaxSourceNewHistory);
+                      ptlTaxSourceNewHistory.setId(null);
+                      ptlTaxSourceNewHistory.setBatchId(uuid);
+                      ptlTaxSourceNewHistory.setBatchType("delete");
+                      ptlTaxSourceNewHistory.setModifier(BaseController.getUser().getId());
+                      ptlTaxSourceNewHistory.setOperatorTime(LocalDateTime.now());
+                      ptlTaxSourceNewHistory.setPtlTaxSourceNewId(ptlTaxSourceNew.getId());
+                      ptlTaxSourceNewHistorys.add(ptlTaxSourceNewHistory);
+                  }
+             }
+
+         }
+         //插入历史记录表
+        ptlTaxSourceNewHistoryService.saveBatch(ptlTaxSourceNewHistorys);
+        ptlAgreementDispatchRulesAttrLinkHistoryService.saveBatch(dispatchAttrLinkHistories);
+        //删除主表
+        ptlTaxSourceNewMapper.deleteBatchIds(ids);
+        //删除规则表
+        ptlAgreementDispatchRulesAttrLinkService.removeByIds(allLinkIds);
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/22 15:37
+     *  @Description: 保存排除部门信息
+     */
+    @Override
+    @Transactional
+    public void saveDeptIds(PtlTaxSourceNewAddDeptIdsVo taxSourceVo) {
+        //删除排除的信息
+        taxSourceExcludeService.remove(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId, taxSourceVo.getInsCompanyId()));
+        List<TaxSourceExcludeDto> excludeDtos = new ArrayList<>();
+        //组装排除的部门信息
+        if(taxSourceVo.getAgreementTaxExcludeDeptList()!=null && taxSourceVo.getAgreementTaxExcludeDeptList().size()>0){
+            for (String agreementTaxExclude : taxSourceVo.getAgreementTaxExcludeDeptList()) {
+                TaxSourceExcludeDto dto = new TaxSourceExcludeDto();
+                dto.setType(Integer.parseInt(TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
+                dto.setInsCompanyId(taxSourceVo.getInsCompanyId());
+                dto.setExcludeInfo(agreementTaxExclude);
+                excludeDtos.add(dto);
+            }
+            taxSourceExcludeService.saveBatch(excludeDtos);
+        }
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/22 15:57
+     *  @Description: 通过保险公司id查询绑定的排除部门id
+     */
+    @Override
+    public List<String>  getDeptIdsByCompanyId(String companyId) {
+        //排除的部门信息
+        List<TaxSourceExcludeDto> taxSourceExcludeDepts =
+                taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
+        //部门信息转换
+        List<String> agreementTaxExcludeDepts = new ArrayList<>();
+        taxSourceExcludeDepts.forEach(item -> {
+            agreementTaxExcludeDepts.add(item.getExcludeInfo());
+        });
+        PtlTaxSourceNewAddDeptIdsVo  vo=new PtlTaxSourceNewAddDeptIdsVo();
+        vo.setAgreementTaxExcludeDeptList(agreementTaxExcludeDepts);
+        return agreementTaxExcludeDepts;
+    }
+
+
+    /**
+     * 根据税源获取协议id
+     * @param deptId
+     * @param userId
+     * @param companyId
+     * @param quoteInfo   报价信息
+     * @return
+     */
+    @Override
+    public String getAgreementId(String deptId, String userId, String companyId, BaseQuoteInfoVo quoteInfo, String riskCode,String orderno) {
+        List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList = ptlAgreementDispatchRulesAttrService.getDispatchRulesAttrList();
+        String resultId = "";
+        //查找配置的默认项,匹配不到赋值默认的协议Id
+        List<PtlTaxSourceNew> taxSourceDtoList = baseMapper.selectList(new LambdaQueryWrapper<PtlTaxSourceNew>()
+                        .eq(PtlTaxSourceNew::getInsCompanyId,companyId)
+                        .eq(PtlTaxSourceNew::getDefaultFlag,"1"));
+        if(taxSourceDtoList.isEmpty()){
+            throw new SystemException("没有匹配到默认协议,请添加!");
+        }
+        //默认协议
+        String agreeId = taxSourceDtoList.get(0).getAgreementId();
+        logger.info("======================默认协议为:"+agreeId+"==================================");
+        //通过公司id按优先级排序获取协议规则
+        List<PtlTaxSourceNew> prioritySortList = baseMapper.selectList(new LambdaQueryWrapper<PtlTaxSourceNew>()
+                .eq(PtlTaxSourceNew::getInsCompanyId,companyId)
+                .orderByAsc(PtlTaxSourceNew::getPriority));
+        boolean isExclude = true;
+        //排除的部门信息
+        List<TaxSourceExcludeDto> excludeDepts =
+                taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getExcludeInfo, deptId).eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
+
+        //部门排除
+        if (excludeDepts.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(deptId))) {
+            isExclude = false;
+        }
+        if(prioritySortList!=null && prioritySortList.size()>0){
+            int size = prioritySortList.size();
+            for (int i = 0; i < size; i++) {
+                //判断是否为空,如果不为空直接跳出
+                String checkAgreementId = getAgreementId(prioritySortList.get(i), quoteInfo, dispatchRulesAttrList, isExclude,orderno,userId);
+                if(!"".equals(checkAgreementId)){
+                    resultId=checkAgreementId;
+                    logger.info("匹配的协议为:"+resultId);
+                    break;
+                }
+            }
+        }
+        //如果没有匹配上协议,直接赋值默认协议
+        if("".equals(resultId)){
+            resultId= agreeId;
+        }
+        return resultId;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/28 14:27
+     *  @Description: 通过规则判断是否匹配
+     */
+    public  String getAgreementId(PtlTaxSourceNew ptlTaxSourceNew,BaseQuoteInfoVo quoteInfo, List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList,boolean isExclude,String orderno,String userId){
+        String quoteInfoErorMsg="";
+        String msg="";
+        String agreementId="";
+        //1.车牌号
+        String licenseNo = quoteInfo.getCarInfo().getLicenseNo();
+        //2	座位数
+        String seats = quoteInfo.getCarInfo().getSeatCount();
+        // 3.排量
+        String exhaustScale = quoteInfo.getCarInfo().getEnginedesc();
+        // 4.车辆大类
+        String cimodelclass = quoteInfo.getCarInfo().getCimodelclass();
+        //5.使用性质
+        String vehicleUse = quoteInfo.getCarInfo().getVehicleUse();
+        //code变为name
+        String cimodelclassVal = getPtlAgreementDispatchRulesAttr(dispatchRulesAttrList, DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_4.getCode(),cimodelclass);
+        String vehicleUseVal = getPtlAgreementDispatchRulesAttr(dispatchRulesAttrList, DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_5.getCode(),vehicleUse);
+
+        List<KindInfoVo> kinds = quoteInfo.getKindList();
+        List<RiskInfoVo> risks = quoteInfo.getRiskList();
+        //6.交强投保
+        String yqInsureFlag = !InsuranceRisk.getFlagByTRAFFIC(risks) ?"0":"1";
+        //7.车损投保
+        String cxInsureFlag = !InsuranceRisk.getFlagByA(kinds) ?"0":"1";
+        //8.第三者责任险
+        String thirdPartyLiabilityInsurance =InsuranceRisk.getStringByB(kinds);
+        //报价信息
+        msg = getString(msg, licenseNo,seats,exhaustScale,cimodelclassVal,vehicleUseVal,yqInsureFlag,cxInsureFlag,thirdPartyLiabilityInsurance);
+        //通过调度id查询调度规则是否包含车牌、排量
+        boolean isExcludeLicense = false;
+        boolean isExcludeSeats = false;
+        boolean isExcludeVolume= false;
+        boolean isExcludeCimodelclass= false;
+        boolean isExcludeVehicleUse= false;
+        boolean isExcludeYqInsureFlag= false;
+        boolean isExcludeCxInsureFlag= false;
+        boolean isExcludeThirdPartyLiabilityInsurance= false;
+        //通过默认公司id查询所有的协议按优先级排序
+        Long ptlTaxSourceNewId = ptlTaxSourceNew.getId();
+        List<PtlAgreementDispatchRulesAttrLink> list = ptlAgreementDispatchRulesAttrLinkService.list(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttrLink>()
+                .eq(PtlAgreementDispatchRulesAttrLink::getRulesId, ptlTaxSourceNewId));
+        //为匹配信息拼接
+        if(list!=null && list.size()>0  ){
+            isExcludeLicense = judgeIsExcludeFlag(licenseNo, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_1.getCode());
+            if(!isExcludeLicense){
+                quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_1.getCode())+"的值为"+licenseNo+"未匹配"+"\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";
+            }
+            isExcludeVolume =judgeIsExcludeFlag(exhaustScale, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_3.getCode());
+            if(!isExcludeVolume){
+                quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_3.getCode())+"的值为"+exhaustScale+"未匹配"+"\n";
+            }
+            isExcludeCimodelclass = judgeIsExcludeFlag(cimodelclassVal, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_4.getCode());
+            if(!isExcludeCimodelclass){
+                quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_4.getCode())+"的值为"+cimodelclassVal+"未匹配"+"\n";
+            }
+            isExcludeVehicleUse = judgeIsExcludeFlag(vehicleUseVal, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_5.getCode());
+            if(!isExcludeVehicleUse){
+                quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_5.getCode())+"的值为"+vehicleUseVal+"未匹配"+"\n";
+            }
+            isExcludeYqInsureFlag = judgeIsExcludeFlag(yqInsureFlag, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_6.getCode());
+            if(!isExcludeYqInsureFlag){
+                quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_6.getCode())+"的值为"+("1".equals(yqInsureFlag)?"是":"否")+"未匹配"+"\n";
+            }
+            isExcludeCxInsureFlag = judgeIsExcludeFlag(cxInsureFlag, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_7.getCode());
+            if(!isExcludeCxInsureFlag){
+                quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_7.getCode())+"的值为"+("1".equals(cxInsureFlag)?"是":"否")+"未匹配"+"\n";
+            }
+            isExcludeThirdPartyLiabilityInsurance = judgeIsExcludeFlag(thirdPartyLiabilityInsurance, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_8.getCode());
+            if(!isExcludeThirdPartyLiabilityInsurance){
+                quoteInfoErorMsg+= DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_8.getCode())+"的值为"+(thirdPartyLiabilityInsurance==null?"不投保":thirdPartyLiabilityInsurance)+"未匹配"+"\n";
+            }
+        }
+        logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"协议调度规则对象为:"+ptlTaxSourceNew.toString()+"=====================================");
+        logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"协议调度规则内容为:"+ptlTaxSourceNew.getDispatchContent()+"===============================");
+        logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"报价参数信息为:"+msg+"===============================");
+        logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"未匹配信息为:"+quoteInfoErorMsg+"===============================");
+        if (isExclude && isExcludeLicense && isExcludeSeats && isExcludeVolume && isExcludeCimodelclass && isExcludeVehicleUse  && isExcludeYqInsureFlag  && isExcludeCxInsureFlag && isExcludeThirdPartyLiabilityInsurance ) {
+            agreementId = ptlTaxSourceNew.getAgreementId();
+        }
+        PtlTaxSourceNewRecord  ptlTaxSourceNewRecord=new PtlTaxSourceNewRecord(orderno, ptlTaxSourceNew.toString(), ptlTaxSourceNew.getDispatchContent(), msg, quoteInfoErorMsg,new Date(), userId);
+        ptlTaxSourceNewRecordService.save(ptlTaxSourceNewRecord);
+        return agreementId;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/28 11:51
+     *  @Description: 根据code获取名称值
+     */
+    @NotNull
+    private static String getPtlAgreementDispatchRulesAttr(List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList, String code,String
+        val) {
+        String val_new="";
+        PtlAgreementDispatchRulesAttr ptlAgreementDispatchRulesAttr = dispatchRulesAttrList.stream().filter(y -> y.getAttrCode().equals(code)).findFirst().orElse(new PtlAgreementDispatchRulesAttr());
+        List<PtlAgreementDispatchRulesDictLabal> dictLabal = ptlAgreementDispatchRulesAttr.getDictLabal();
+        if(dictLabal!=null && dictLabal.size()>0){
+            for(PtlAgreementDispatchRulesDictLabal ptlAgreementDispatchRulesDictLabal: dictLabal){
+                if(val.equals(ptlAgreementDispatchRulesDictLabal.getCode())){
+                    val_new=ptlAgreementDispatchRulesDictLabal.getName();
+                }
+            }
+        }
+        return ptlAgreementDispatchRulesAttr.getDictLabal()==null?"":val_new;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/28 9:12
+     *  @Description: 前台信息拼接
+     */
+    @NotNull
+    private static String getString(String allMag, String val1,String val2,String val3,String val4,String val5,String val6,String val7,String val8) {
+        String msg="";
+        allMag += getAllString(msg, val1,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_1.getCode());
+        allMag +=getAllString(msg, val2,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_2.getCode());
+        allMag +=getAllString(msg, val3,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_3.getCode());
+        allMag +=getAllString(msg, val4,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_4.getCode());
+        allMag +=getAllString(msg, val5,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_5.getCode());
+        allMag +=getAllString(msg, "1".equals(val6)?"是":"否",DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_6.getCode());
+        allMag +=getAllString(msg, "1".equals(val7)?"是":"否",DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_7.getCode());
+        allMag +=getAllString(msg, val8,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_8.getCode());
+        return allMag;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/28 9:08
+     *  @Description: 信息拼接
+     */
+    private static String getAllString(String msg, String val,String code) {
+        if(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_8.getCode().equals(code)){
+           val= val==null?"不投保":val;
+        }else{
+            val= val==null?"空":val;
+        }
+        msg +=DispatchTypeConstants.matchKey(code)+"的值为" +val+"\n";
+        return msg;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/28 8:43
+     *  @Description:   判断值是否和规则匹配
+     */
+    private static boolean judgeIsExcludeFlag(String val, List<PtlAgreementDispatchRulesAttrLink> list, List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList,String code) {
+        boolean isExcludeFlag;
+        if(StringUtils.isBlank(val)){
+            if(!DispatchTypeConstants.removalOfCode().contains(code)){
+                throw new SystemException(DispatchTypeConstants.matchKey(code)+"不能为空");
+            }
+        }
+        isExcludeFlag = RulesMergeStrUtils.judgeVal(list, (DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_1.getCode().equals(code))?val.substring(0, 2):val, code, dispatchRulesAttrList);
+        return isExcludeFlag;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/24 18:06
+     *  @Description: 通过id查询对象
+     */
+    @Override
+    public PtlTaxSourceNewSaveVo rulesGet(Long id, List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList) {
+        //设置费用因子属性
+        List<PtlAgreementDispatchRulesAttr> ptlAgreementDispatchRulesAttrs = new ArrayList<>();
+        List<PtlAgreementDispatchRulesAttrLink> list = ptlAgreementDispatchRulesAttrLinkService.list(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttrLink>()
+                .eq(PtlAgreementDispatchRulesAttrLink::getRulesId, id));
+
+        dispatchRulesAttrList.stream().forEach(x -> {
+            //处理多选和下拉
+            if ("checkbox".equals(x.getAttrType()) || "select".equals(x.getAttrType())) {
+                //处理车牌
+                if ("select".equals(x.getAttrType()) && "LicenseNo".equals(x.getAttrCode())) {
+                    PtlAgreementDispatchRulesAttrLink licenseNo = list.stream().filter(l -> l.getAttrCode().equals("LicenseNo")).findFirst().orElse(new PtlAgreementDispatchRulesAttrLink());
+                    if (licenseNo != null) {
+                        //根据operator 获取车牌的地区id
+                        List<PtlAreaLicense> byParentNumber = ptlAreaLicenseService.getByParentNumber("14");
+                        //ptlAreaLicenseService.getByParentNumber()
+                        List<PtlAgreementDispatchRulesDictLabal> dictLabal = byParentNumber.stream().map(y -> {
+                            PtlAgreementDispatchRulesDictLabal ptlAgreementDispatchRulesDictLabal = new PtlAgreementDispatchRulesDictLabal();
+                            ptlAgreementDispatchRulesDictLabal.setDictId(y.getId());
+                            ptlAgreementDispatchRulesDictLabal.setCode(y.getAreaNumber());
+                            ptlAgreementDispatchRulesDictLabal.setName(y.getLicense());
+                            return ptlAgreementDispatchRulesDictLabal;
+                        }).collect(Collectors.toList());
+                        x.setDictLabal(dictLabal);
+                    }
+                }
+                x.setMinArray(new String[]{});
+                list.stream().filter(y -> y.getAttrCode().equals(x.getAttrCode())).findFirst().ifPresent(z -> {
+                    if (null != z.getMin()) {
+                        x.setId(z.getId());
+                        x.setMinArray(z.getMin().split(","));
+                        x.setMax(z.getMax());
+                        x.setOperator(z.getOperator());
+                    }
+                });
+            } else {
+                list.stream().filter(y -> y.getAttrCode().equals(x.getAttrCode())).findFirst().ifPresent(z -> {
+                    x.setId(z.getId());
+                    x.setMin(z.getMin());
+                    x.setMax(z.getMax());
+                    x.setOperator(z.getOperator());
+                });
+            }
+
+            ptlAgreementDispatchRulesAttrs.add(x);
+        });
+        PtlTaxSourceNew ptlTaxSourceNew = this.getById(id);
+        PtlTaxSourceNewSaveVo ptlTaxSourceNewSaveVo =new PtlTaxSourceNewSaveVo(ptlTaxSourceNew);
+        ptlTaxSourceNewSaveVo.setAttrLinks(ptlAgreementDispatchRulesAttrs);
+
+        return ptlTaxSourceNewSaveVo;
+    }
+}

+ 17 - 6
src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java

@@ -15,12 +15,14 @@ import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.esm.service.EsmInsCompanyService;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
+import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
 import com.ydtech.modules.protocol.dao.TaxSourceMapper;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementDto;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
 import com.ydtech.modules.protocol.entity.dto.TaxSourceDto;
 import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
 import com.ydtech.modules.protocol.entity.vo.TaxSourceVo;
 import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
 import com.ydtech.modules.protocol.service.ITaxSourceService;
@@ -58,6 +60,11 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
     @Autowired
     SysUserService sysUserService;
 
+    @Autowired
+    private PtlTaxSourceNewMapper ptlTaxSourceNewMapper;
+
+
+
 
     @Override
     public IPage<EsmInsCompany> getInsureCompany(Page page) {
@@ -300,9 +307,11 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
         //查出所有协议
         List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId);
 
-        //查找是否配置税源
-        List<TaxSourceDto> taxSourceDtos =
-                baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getIsTaxSource, "1"));
+        //查找是否配置税源    原逻辑注释掉
+        //List<TaxSourceDto> taxSourceDtos =
+        //        baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getIsTaxSource, "1"));
+        //修改协议的默认   add by hxl   2024-05-27
+        List<PtlTaxSourceNew> taxSourceDtos = ptlTaxSourceNewMapper.findDefaultAllAttrLink();
         //设置税源参数
         agreementInsCompany.forEach(item -> {
             if (!TaxSourceStatusConstants.TAX_SOURCE_START.equals(item.getIsExclude())) {
@@ -405,9 +414,11 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
         SysUser user = sysUserService.getById(userId);
         //查出当前用户管理所有协议
         List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(user.getDeptId(), userId);
-        //查找是否配置税源
-        List<TaxSourceDto> taxSourceDtos =
-                baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getIsTaxSource, "1"));
+        //查找是否配置税源   注释掉原先的逻辑
+       // List<TaxSourceDto> taxSourceDtos =
+           //     baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getIsTaxSource, "1"));
+        //修改协议的默认   add by hxl   2024-05-27
+        List<PtlTaxSourceNew> taxSourceDtos = ptlTaxSourceNewMapper.findDefaultAllAttrLink();
         //设置税源参数
         agreementInsCompany.forEach(item -> {
             if (!TaxSourceStatusConstants.TAX_SOURCE_START.equals(item.getIsExclude())) {

+ 178 - 0
src/main/java/com/ydtech/modules/protocol/utils/RulesMergeStrUtils.java

@@ -0,0 +1,178 @@
+package com.ydtech.modules.protocol.utils;
+
+import com.ydtech.modules.protocol.constants.DispatchTypeConstants;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttr;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLink;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDictLabal;
+import org.apache.commons.lang3.StringUtils;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/5/24 9:54
+ *  @Description:  将规则列表合并成一句话
+ */
+public class RulesMergeStrUtils {
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/24 10:41
+     *  @Description:  将规则合成一句描述
+     */
+    public static String getRulesMergeStr(List<PtlAgreementDispatchRulesAttrLink> v, List<PtlAgreementDispatchRulesAttr> attrList) {
+        String desc = "";
+        for (int i = 0; i < v.size(); i++) {
+            int finalI = i;
+            if(v.get(i).getMinArray() != null && v.get(i).getMinArray().length > 0){
+                v.get(i).setMin(String.join(",",v.get(i).getMinArray()));
+            }
+            //处理中文逗号
+            if(v.get(i).getMin() != null && v.get(i).getMin().contains(",")) {
+                v.get(i).setMin(v.get(i).getMin().replace(",",","));
+            }
+            PtlAgreementDispatchRulesAttr ptlAgreementDispatchRulesAttr = attrList.stream().filter(x -> x.getAttrCode().equals(v.get(finalI).getAttrCode())).findAny().orElse(new PtlAgreementDispatchRulesAttr());
+            //数值范围判断
+
+            if ("inputNumber".equals(ptlAgreementDispatchRulesAttr.getAttrType())) {
+                if((v.get(i).getMin()!=null && !"0".equals(v.get(i).getMin())) || (v.get(i).getMax()!=null && !"0".equals(v.get(i).getMax()))){
+                    desc += inputNumberIdentifying(ptlAgreementDispatchRulesAttr, v.get(i)) + "\n";
+                }
+            }
+            if ("radio".equals(ptlAgreementDispatchRulesAttr.getAttrType())) {
+                if(v.get(i).getMin()!=null && !"".equals(v.get(i).getMin())){
+                    desc += radioIdentifying(ptlAgreementDispatchRulesAttr, v.get(i)) + "\n";
+                }
+            }
+            if ("checkbox".equals(ptlAgreementDispatchRulesAttr.getAttrType()) || "select".equals(ptlAgreementDispatchRulesAttr.getAttrType())) {
+                if(v.get(i).getMin()!=null && !"".equals(v.get(i).getMin())) {
+                    desc += ptlAgreementDispatchRulesAttr.getAttrName() + "包含" + v.get(i).getMin() + "\n";
+                }
+            }
+        }
+        return desc;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/24 10:38
+     *  @Description: 单选框
+     */
+    private static String radioIdentifying(PtlAgreementDispatchRulesAttr ptlAgreementDispatchRulesAttr, PtlAgreementDispatchRulesAttrLink ptlAgreementDispatchRulesAttrLink) {
+        PtlAgreementDispatchRulesDictLabal ptlAgreementDispatchRulesDictLabal = ptlAgreementDispatchRulesAttr.getDictLabal().stream().filter(x ->
+                x.getCode().equals(ptlAgreementDispatchRulesAttrLink.getMin())).findAny().orElse(new PtlAgreementDispatchRulesDictLabal());
+        return ptlAgreementDispatchRulesAttr.getAttrName() + "为" + Objects.requireNonNull(ptlAgreementDispatchRulesDictLabal).getName();
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/24 10:38
+     *  @Description: 数值范围
+     */
+    private static String inputNumberIdentifying(PtlAgreementDispatchRulesAttr ptlAgreementDispatchRulesAttr, PtlAgreementDispatchRulesAttrLink ptlAgreementDispatchRulesAttrLink) {
+        if ("1".equals(ptlAgreementDispatchRulesAttrLink.getOperator())) {
+            return ptlAgreementDispatchRulesAttr.getAttrName() + "范围值" + ptlAgreementDispatchRulesAttrLink.getMin() + "到" + ptlAgreementDispatchRulesAttrLink.getMax();
+        } else if ("2".equals(ptlAgreementDispatchRulesAttrLink.getOperator())) {
+            return ptlAgreementDispatchRulesAttr.getAttrName() + "小于" + ptlAgreementDispatchRulesAttrLink.getMin();
+        } else if ("3".equals(ptlAgreementDispatchRulesAttrLink.getOperator())) {
+            return ptlAgreementDispatchRulesAttr.getAttrName() + "小于等于" + ptlAgreementDispatchRulesAttrLink.getMin();
+        } else if ("4".equals(ptlAgreementDispatchRulesAttrLink.getOperator())) {
+            return ptlAgreementDispatchRulesAttr.getAttrName() + "大于" + ptlAgreementDispatchRulesAttrLink.getMax();
+        } else if ("5".equals(ptlAgreementDispatchRulesAttrLink.getOperator())) {
+            return ptlAgreementDispatchRulesAttr.getAttrName() + "大于等于" + ptlAgreementDispatchRulesAttrLink.getMax();
+        }
+        return "";
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/24 15:08
+     *  @Description:  判断值知否在范围内
+     */
+    public static Boolean judgeVal(List<PtlAgreementDispatchRulesAttrLink> list, String val, String code, List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList) {
+        //查询定义的规则表
+        PtlAgreementDispatchRulesAttrLink ptlAgreementDispatchRulesAttrLink = list.stream().filter(y -> y.getAttrCode().equals(code)).findFirst().orElse(new PtlAgreementDispatchRulesAttrLink());
+        PtlAgreementDispatchRulesAttr ptlAgreementDispatchRulesAttr = dispatchRulesAttrList.stream().filter(y -> y.getAttrCode().equals(code)).findFirst().orElse(new PtlAgreementDispatchRulesAttr());
+        Boolean resultFlag=false;
+        if ("inputNumber".equals(ptlAgreementDispatchRulesAttr.getAttrType())) {
+            if(StringUtils.isNotBlank(ptlAgreementDispatchRulesAttrLink.getMin()) || StringUtils.isNotBlank(ptlAgreementDispatchRulesAttrLink.getMax()) ) {
+                //三者险为null为不投保情况直接返回false
+                if(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_8.getCode().equals(code) &&  val==null){
+                    resultFlag=false;
+                }else{
+                    //取符号做判断
+                    resultFlag = judgeValInputNumber(ptlAgreementDispatchRulesAttrLink.getOperator(), ptlAgreementDispatchRulesAttrLink.getMin(), ptlAgreementDispatchRulesAttrLink.getMax(), val);
+                }
+            }else{
+                //等于空 不验证
+                resultFlag=true;
+            }
+        }
+        if ("radio".equals(ptlAgreementDispatchRulesAttr.getAttrType())) {
+            //相等
+            if(StringUtils.isNotBlank(ptlAgreementDispatchRulesAttrLink.getMin())){
+               if(val.equals(ptlAgreementDispatchRulesAttrLink.getMin())) {
+                   resultFlag= true;
+                }
+                //等于空 不验证
+            }else{
+                resultFlag=true;
+            }
+        }
+        if ("checkbox".equals(ptlAgreementDispatchRulesAttr.getAttrType()) || "select".equals(ptlAgreementDispatchRulesAttr.getAttrType())) {
+            //包含
+            if(StringUtils.isNotBlank(ptlAgreementDispatchRulesAttrLink.getMin())){
+                if(ptlAgreementDispatchRulesAttrLink.getMin().contains(val)){
+                    resultFlag= true;
+                }
+                //等于空 不验证
+            }else{
+                resultFlag=true;
+            }
+        }
+        return resultFlag;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/24 15:09
+     *  @Description:  判断运算符号
+     */
+    private static Boolean judgeValInputNumber(String operatorType,String min,String max,String val) {
+
+        BigDecimal bigMin=new BigDecimal(min==null?"0":min);
+        BigDecimal bigMax=new BigDecimal(max==null?"0":max);
+
+        BigDecimal bigVal=new BigDecimal(val==null?"0":val);
+        if ("1".equals(operatorType)) {
+            //范围值
+           return isInRange(bigVal,bigMin,bigMax);
+        } else if ("2".equals(operatorType)) {
+            //小于
+            return bigVal.compareTo(bigMin) < 0;
+        } else if ("3".equals(operatorType)) {
+            //小于等于
+            return bigVal.compareTo(bigMin) <= 0;
+        } else if ("4".equals(operatorType)) {
+            //大于
+            return bigVal.compareTo(bigMax) > 0;
+        } else if ("5".equals(operatorType)) {
+            //大于等于
+            return bigVal.compareTo(bigMax) >= 0;
+        }
+        return null;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/24 15:15
+     *  @Description:  判断是否在范围值之内
+     */
+    public static boolean isInRange(BigDecimal value, BigDecimal min, BigDecimal max) {
+        return min.compareTo(value) <= 0 && max.compareTo(value) >= 0;
+    }
+}

+ 18 - 0
src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesAttrLinkHistoryMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocols.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLinkHistory;
+
+
+/**
+ * @author
+ * @description
+ * @createDate
+ */
+public interface PtlAgreementDispatchRulesAttrLinkHistoryMapper extends BaseMapper<PtlAgreementDispatchRulesAttrLinkHistory> {
+
+}
+
+
+
+

+ 18 - 0
src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesAttrLinkMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocols.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLink;
+
+
+/**
+ * @author tz
+ * @description 协议承保规则属性关联的数据库操作Mapper
+ * @createDate 2024-2-22 15:44:29
+ */
+public interface PtlAgreementDispatchRulesAttrLinkMapper extends BaseMapper<PtlAgreementDispatchRulesAttrLink> {
+
+}
+
+
+
+

+ 18 - 0
src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesAttrMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocols.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttr;
+
+
+/**
+ * @author tz
+ * @description 协议调度规则属性的数据库操作Mapper
+ * @createDate 2024-2-22 15:44:29
+ */
+public interface PtlAgreementDispatchRulesAttrMapper extends BaseMapper<PtlAgreementDispatchRulesAttr> {
+
+}
+
+
+
+

+ 19 - 0
src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesDictLabalMapper.java

@@ -0,0 +1,19 @@
+package com.ydtech.modules.protocols.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDictLabal;
+
+
+/**
+ * @author tz
+ * @description 协议承保规则字典的数据库操作Mapper
+ * @createDate 2024-2-22 15:44:29
+ */
+public interface PtlAgreementDispatchRulesDictLabalMapper extends BaseMapper<PtlAgreementDispatchRulesDictLabal> {
+
+
+}
+
+
+
+

+ 17 - 0
src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesDictMapper.java

@@ -0,0 +1,17 @@
+package com.ydtech.modules.protocols.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDict;
+
+/**
+ * @author tz
+ * @description 协议承保规则字典的数据库操作Mapper
+ * @createDate 2024-2-22 15:44:29
+ */
+public interface PtlAgreementDispatchRulesDictMapper extends BaseMapper<PtlAgreementDispatchRulesDict> {
+
+}
+
+
+
+

+ 67 - 0
src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesAttr.java

@@ -0,0 +1,67 @@
+package com.ydtech.modules.protocols.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.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 协议调度规则属性
+ */
+@TableName(value = "ptl_agreement_dispatch_rules_attr", autoResultMap = true)
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PtlAgreementDispatchRulesAttr {
+
+    @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 = "company_ids")
+    private String companyIds;
+
+    @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<PtlAgreementDispatchRulesDictLabal> dictLabal;
+}

+ 58 - 0
src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesAttrLink.java

@@ -0,0 +1,58 @@
+package com.ydtech.modules.protocols.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 io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 协议调度规则与规则属性关联表
+ */
+@TableName(value = "ptl_agreement_dispatch_rules_attr_link", autoResultMap = true)
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PtlAgreementDispatchRulesAttrLink {
+
+    @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 PtlAgreementDispatchRulesAttrLink children;
+}

+ 77 - 0
src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesAttrLinkHistory.java

@@ -0,0 +1,77 @@
+package com.ydtech.modules.protocols.entity.po;
+
+import com.alibaba.fastjson.JSONArray;
+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 io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDateTime;
+
+/**
+ *
+ */
+@TableName(value = "ptl_agreement_dispatch_rules_attr_link_history", autoResultMap = true)
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PtlAgreementDispatchRulesAttrLinkHistory {
+
+    @TableId(value = "id", type = 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;
+
+    @ApiModelProperty(value = "批次")
+    @TableField(value = "batch")
+    private String batch;
+
+    @ApiModelProperty(value = "操作类型")
+    @TableField(value = "operator_type")
+    private String operatorType;
+
+    @ApiModelProperty(value = "操作人")
+    @TableField(value = "modifier")
+    private String modifier;
+
+    @ApiModelProperty(value = "操作时间")
+    @TableField(value = "operator_time")
+    private LocalDateTime operatorTime;
+
+    @TableField(exist = false)
+    private JSONArray dictLabal;
+
+    @ApiModelProperty(value = "关联属性使用")
+    @TableField(exist = false)
+    private PtlAgreementDispatchRulesAttrLinkHistory children;
+}

+ 41 - 0
src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesDict.java

@@ -0,0 +1,41 @@
+package com.ydtech.modules.protocols.entity.po;
+
+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 io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 协议调度规则属性字典表
+ */
+@TableName(value = "ptl_agreement_dispatch_rules_dict", autoResultMap = true)
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PtlAgreementDispatchRulesDict {
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "字典名称")
+    @TableField(value = "name")
+    private String name;
+
+    @ApiModelProperty(value = "字典编码")
+    @TableField(value = "code")
+    private String code;
+
+    @ApiModelProperty(value = "字典备注")
+    @TableField(value = "remark")
+    private String remark;
+
+    @TableField(exist = false)
+    private List<PtlAgreementDispatchRulesDictLabal> labalList;
+
+}

+ 49 - 0
src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesDictLabal.java

@@ -0,0 +1,49 @@
+package com.ydtech.modules.protocols.entity.po;
+
+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 io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 协议调度规则属性字典表
+ */
+@TableName(value = "ptl_agreement_dispatch_rules_dict_labal", autoResultMap = true)
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PtlAgreementDispatchRulesDictLabal {
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "父级id")
+    @TableField(value = "parent_id")
+    private Integer parentId;
+
+    @ApiModelProperty(value = "字典id")
+    @TableField(value = "dict_id")
+    private Integer dictId;
+
+    @ApiModelProperty(value = "标签名称")
+    @TableField(value = "name")
+    private String name;
+
+    @ApiModelProperty(value = "标签编码")
+    @TableField(value = "code")
+    private String code;
+
+    @ApiModelProperty(value = "排序")
+    @TableField(value = "sort")
+    private String sort;
+
+    @TableField(exist = false)
+    private List<PtlAgreementDispatchRulesDictLabal> children;
+
+}

+ 13 - 0
src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesAttrLinkHistoryService.java

@@ -0,0 +1,13 @@
+package com.ydtech.modules.protocols.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLinkHistory;
+
+/**
+*@author:
+*@description:
+*@create:
+*/
+public interface PtlAgreementDispatchRulesAttrLinkHistoryService extends IService<PtlAgreementDispatchRulesAttrLinkHistory> {
+
+}

+ 13 - 0
src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesAttrLinkService.java

@@ -0,0 +1,13 @@
+package com.ydtech.modules.protocols.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLink;
+
+/**
+*@author: tz
+*@description: 协议承保规则属性 service
+*@create: 2024-2-22 15:44:29
+*/
+public interface PtlAgreementDispatchRulesAttrLinkService extends IService<PtlAgreementDispatchRulesAttrLink> {
+
+}

+ 35 - 0
src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesAttrService.java

@@ -0,0 +1,35 @@
+package com.ydtech.modules.protocols.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttr;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+*@author: tz
+*@description: 协议承保规则属性 service
+*@create: 2024-2-22 15:44:29
+*/
+public interface PtlAgreementDispatchRulesAttrService extends IService<PtlAgreementDispatchRulesAttr> {
+
+    /**
+     * 协议承保规则属性列表
+     * @return
+     */
+    List<PtlAgreementDispatchRulesAttr> getDispatchRulesAttrList();
+
+    /**
+     * 协议承保规则属性列表
+     * @return
+     */
+    List<PtlAgreementDispatchRulesAttr> getDispatchRulesAttrList(String companyId);
+
+    /**
+     * 协议承保规则属性列表进行分类
+     * @return
+     */
+    Map<String,List<PtlAgreementDispatchRulesAttr>> getDispatchRulesAttrListType(List<PtlAgreementDispatchRulesAttr> DispatchRulesAttrList);
+
+
+}

+ 14 - 0
src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesDictLabalService.java

@@ -0,0 +1,14 @@
+package com.ydtech.modules.protocols.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDictLabal;
+
+/**
+*@author: tz
+*@description: 协议承保规则字典 service
+*@create: 2024-2-22 15:44:29
+*/
+public interface PtlAgreementDispatchRulesDictLabalService extends IService<PtlAgreementDispatchRulesDictLabal> {
+
+
+}

+ 22 - 0
src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesDictService.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.protocols.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDict;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDictLabal;
+
+import java.util.List;
+
+/**
+*@author: tz
+*@description: 协议承保规则字典 service
+*@create: 2024-2-22 15:44:29
+*/
+public interface PtlAgreementDispatchRulesDictService extends IService<PtlAgreementDispatchRulesDict> {
+
+    /**
+     *
+     * @return
+     */
+    List<PtlAgreementDispatchRulesDictLabal> getDispatchRulesDictList();
+
+}

+ 18 - 0
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesAttrLinkHistoryServiceImpl.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocols.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.protocols.dao.PtlAgreementDispatchRulesAttrLinkHistoryMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLinkHistory;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesAttrLinkHistoryService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @description
+ * @createDate
+ * @Entity
+ */
+@Service
+public class PtlAgreementDispatchRulesAttrLinkHistoryServiceImpl extends ServiceImpl<PtlAgreementDispatchRulesAttrLinkHistoryMapper, PtlAgreementDispatchRulesAttrLinkHistory>
+        implements PtlAgreementDispatchRulesAttrLinkHistoryService {
+
+}

+ 18 - 0
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesAttrLinkServiceImpl.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocols.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.protocols.dao.PtlAgreementDispatchRulesAttrLinkMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLink;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesAttrLinkService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @description 协议承保规则属性 service实现类
+ * @createDate 2024-2-22 15:44:29
+ * @Entity com.ydtech.modules.protocol.entity.po.PtlAgreementUndwrtRulesAttrMapper
+ */
+@Service
+public class PtlAgreementDispatchRulesAttrLinkServiceImpl extends ServiceImpl<PtlAgreementDispatchRulesAttrLinkMapper, PtlAgreementDispatchRulesAttrLink>
+        implements PtlAgreementDispatchRulesAttrLinkService {
+
+}

+ 92 - 0
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesAttrServiceImpl.java

@@ -0,0 +1,92 @@
+package com.ydtech.modules.protocols.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.protocols.dao.PtlAgreementDispatchRulesAttrMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttr;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDictLabal;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesAttrService;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesDictLabalService;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesDictService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @description 协议承保规则属性 service实现类
+ * @createDate 2024-2-22 15:44:29
+ * @Entity com.ydtech.modules.protocol.entity.po.PtlAgreementDispatchRulesAttrMapper
+ */
+@Service
+public class PtlAgreementDispatchRulesAttrServiceImpl extends ServiceImpl<PtlAgreementDispatchRulesAttrMapper, PtlAgreementDispatchRulesAttr>
+        implements PtlAgreementDispatchRulesAttrService {
+
+    @Autowired
+    PtlAgreementDispatchRulesDictService ptlAgreementDispatchRulesDictService;
+
+    @Autowired
+    PtlAgreementDispatchRulesDictLabalService ptlAgreementDispatchRulesDictLabalService;
+
+    /**
+     * 获取所有规则字典列表 根据保险公司查询
+     *
+     * @return
+     */
+    @Override
+    public List<PtlAgreementDispatchRulesAttr> getDispatchRulesAttrList(String companyId){
+        List<PtlAgreementDispatchRulesDictLabal> DispatchRulesDictList = ptlAgreementDispatchRulesDictService.getDispatchRulesDictList();
+        List<PtlAgreementDispatchRulesAttr> list = this.list(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttr>().eq(PtlAgreementDispatchRulesAttr::getCompanyIds, "all"));
+        List<PtlAgreementDispatchRulesAttr> companyList = this.list(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttr>().like(PtlAgreementDispatchRulesAttr::getCompanyIds, companyId));
+        list.addAll(companyList);
+        list.forEach(attr -> {
+            List<PtlAgreementDispatchRulesDictLabal> listTmp = DispatchRulesDictList.stream().filter(dict -> attr.getDictId() == dict.getDictId()).collect(Collectors.toList());
+            if(attr.getMinArray() == null)
+                attr.setMinArray(new String[]{});
+            if (attr.getDictLabal() == null)
+                attr.setDictLabal(new ArrayList<>());
+            attr.setDictLabal(listTmp);
+        });
+        return list;
+    }
+
+    /**
+     * 获取所有规则字典列表
+     *
+     * @return
+     */
+    @Override
+    public List<PtlAgreementDispatchRulesAttr> getDispatchRulesAttrList(){
+        List<PtlAgreementDispatchRulesDictLabal> DispatchRulesDictList = ptlAgreementDispatchRulesDictService.getDispatchRulesDictList();
+        List<PtlAgreementDispatchRulesAttr> list = this.list();
+        list.forEach(attr -> {
+            List<PtlAgreementDispatchRulesDictLabal> listTmp = DispatchRulesDictList.stream().filter(dict -> attr.getDictId() == dict.getDictId()).collect(Collectors.toList());
+            if(attr.getMinArray() == null)
+                attr.setMinArray(new String[]{});
+            if (attr.getDictLabal() == null)
+                attr.setDictLabal(new ArrayList<>());
+            attr.setDictLabal(listTmp);
+        });
+        return list;
+    }
+
+    @Override
+    public Map<String, List<PtlAgreementDispatchRulesAttr>> getDispatchRulesAttrListType(List<PtlAgreementDispatchRulesAttr> DispatchRulesAttrList) {
+        Map<String, List<PtlAgreementDispatchRulesAttr>> collect = new HashMap<>();
+        for (PtlAgreementDispatchRulesAttr attr : DispatchRulesAttrList) {
+            if (collect.containsKey(attr.getAttrGroup())) {
+                collect.get(attr.getAttrGroup()).add(attr);
+            } else {
+                List<PtlAgreementDispatchRulesAttr> list = new ArrayList<>();
+                list.add(attr);
+                collect.put(attr.getAttrGroup(), list);
+            }
+        }
+        return collect;
+    }
+
+}

+ 24 - 0
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesDictLabalServiceImpl.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.protocols.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.protocols.dao.PtlAgreementDispatchRulesDictLabalMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDictLabal;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesDictLabalService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author: tz
+ * @description 协议承保规则属性字典 service实现类
+ * @createDate 2024-2-22 15:44:29
+ * @Entity com.ydtech.modules.protocol.entity.po.PtlAgreementDispatchRulesdictMapper
+ */
+@Service
+public class PtlAgreementDispatchRulesDictLabalServiceImpl extends ServiceImpl<PtlAgreementDispatchRulesDictLabalMapper, PtlAgreementDispatchRulesDictLabal>
+        implements PtlAgreementDispatchRulesDictLabalService {
+
+
+}
+
+
+
+

+ 53 - 0
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesDictServiceImpl.java

@@ -0,0 +1,53 @@
+package com.ydtech.modules.protocols.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.protocols.dao.PtlAgreementDispatchRulesDictMapper;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDict;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDictLabal;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesDictLabalService;
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesDictService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Author: tz
+ * @description 协议承保规则属性字典 service实现类
+ * @createDate 2024-2-22 15:44:29
+ * @Entity com.ydtech.modules.protocol.entity.po.PtlAgreementDispatchRulesdictMapper
+ */
+@Service
+public class PtlAgreementDispatchRulesDictServiceImpl extends ServiceImpl<PtlAgreementDispatchRulesDictMapper, PtlAgreementDispatchRulesDict>
+        implements PtlAgreementDispatchRulesDictService {
+
+    @Autowired
+    PtlAgreementDispatchRulesDictLabalService ptlAgreementDispatchRulesDictLabalService;
+
+
+    /**
+     * 获取所有规则字典列表
+     * @return
+     */
+    @Override
+    public List<PtlAgreementDispatchRulesDictLabal> getDispatchRulesDictList() {
+        List<PtlAgreementDispatchRulesDict> ptlAgreementDispatchRulesDicts = baseMapper.selectList(new QueryWrapper<>(new PtlAgreementDispatchRulesDict()));
+        List<PtlAgreementDispatchRulesDictLabal> list = ptlAgreementDispatchRulesDictLabalService.list();
+
+        Map<Integer,List<PtlAgreementDispatchRulesDictLabal>> collect = list.stream().collect(Collectors.groupingBy(PtlAgreementDispatchRulesDictLabal::getParentId));
+        list = collect.get(0);
+        for(Map.Entry<Integer, List<PtlAgreementDispatchRulesDictLabal>> map : collect.entrySet()){
+            Integer key = map.getKey();
+            List<PtlAgreementDispatchRulesDictLabal> value = map.getValue();
+            list.stream().filter(x -> x.getId() == key).forEach(x -> x.setChildren(value));
+        }
+        return list;
+    }
+}
+
+
+
+

+ 108 - 0
src/main/resources/mapper/modules/protocol/PtlTaxSourceNewMapper.xml

@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper">
+
+
+    <sql id="all_Column_List">
+         ptsn.id as id,
+         ptsn.ins_company_id as insCompanyId,
+         ptsn.ins_company_name as  insCompanyName,
+         ptsn.agreement_id as  agreementId,
+         ptsn.priority as  priority,
+         ptsn.default_flag as defaultFlag,
+         ptsn.create_time as createTime,
+         ptsn.create_user as createUser,
+         ptsn.update_time as updateTime,
+         ptsn.update_user as updateUser,
+         ptsn.dispatch_content as dispatchContent,
+         agree.agreement_code as  agreementCode,
+         agree.agreement_name as  agreementName
+    </sql>
+
+    <sql id="Base_Column_List">
+         ptsn.id as id,
+         ptsn.ins_company_id as insCompanyId,
+         ptsn.ins_company_name as  insCompanyName,
+         ptsn.agreement_id as  agreementId,
+         ptsn.priority as  priority,
+         ptsn.default_flag as defaultFlag,
+         ptsn.create_time as createTime,
+         ptsn.create_user as createUser,
+         ptsn.update_time as updateTime,
+         ptsn.update_user as updateUser,
+         ptsn.dispatch_content as dispatchContent
+    </sql>
+
+    <select id="queryPage"  resultType="com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewVo">
+        SELECT
+        <include refid="all_Column_List"/>
+        FROM
+        ptl_tax_source_new  ptsn
+        LEFT JOIN ptl_agreement agree ON ptsn.agreement_id = agree.id
+        <where>
+            <if test="vo.agreementId != null and vo.agreementId != ''">
+                and   ptsn.agreement_id  =  #{vo.agreementId}
+            </if>
+            <if test="vo.insCompanyId != null and vo.insCompanyId != ''">
+                and   ptsn.ins_company_id  =  #{vo.insCompanyId}
+            </if>
+        </where>
+        order by ptsn.priority
+    </select>
+
+
+    <select id="findListByParams"  resultType="Integer">
+        SELECT
+          count(0)
+        FROM
+        ptl_tax_source_new  ptsn
+        <where>
+            <if test="vo.agreementId != null and vo.agreementId != ''">
+                and   ptsn.agreement_id  =  #{vo.agreementId}
+            </if>
+            <if test="vo.insCompanyId != null and vo.insCompanyId != ''">
+                and   ptsn.ins_company_id  =  #{vo.insCompanyId}
+            </if>
+            <if test="vo.id != null">
+                and  ptsn.id !=#{vo.id}
+            </if>
+        </where>
+    </select>
+
+    <select id="findListByIds"  resultType="com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM
+        ptl_tax_source_new  ptsn
+        <where>
+            ptsn.id IN
+            <foreach item="id" collection="ids" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </where>
+
+    </select>
+
+    <select id="findDefaultAttrLinkByInsCompanyId"  resultType="com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM
+        ptl_tax_source_new  ptsn
+        <where>
+             and  ptsn.default_flag=1
+            <if test="insCompanyId != null and insCompanyId != ''">
+                and   ptsn.ins_company_id  =  #{insCompanyId}
+            </if>
+        </where>
+
+    </select>
+
+    <select id="findDefaultAllAttrLink"  resultType="com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM
+        ptl_tax_source_new  ptsn  where ptsn.default_flag=1
+    </select>
+</mapper>