Преглед на файлове

Merge branch 'refs/heads/test' into master-20240326

wks преди 2 години
родител
ревизия
c9330f8307
променени са 62 файла, в които са добавени 3187 реда и са изтрити 95 реда
  1. 143 0
      sql/Online.sql
  2. 51 0
      src/main/java/com/ydtech/constants/enums/InsuranceRisk.java
  3. 2 1
      src/main/java/com/ydtech/modules/fee/service/FeeRuleSchemeService.java
  4. 20 31
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceImpl.java
  5. 50 45
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java
  6. 1 0
      src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java
  7. 2 0
      src/main/java/com/ydtech/modules/fnc/dao/SettlementDocumentaryFeesMapper.java
  8. 1 0
      src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryFeesService.java
  9. 52 1
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  10. 6 0
      src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java
  11. 6 0
      src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java
  12. 19 3
      src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java
  13. 3 0
      src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteVo.java
  14. 2 0
      src/main/java/com/ydtech/modules/order/entity/vo/FeeOrderNewVo.java
  15. 62 0
      src/main/java/com/ydtech/modules/protocol/constants/DispatchTypeConstants.java
  16. 135 0
      src/main/java/com/ydtech/modules/protocol/controller/PtlTaxSourceNewController.java
  17. 18 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlTaxSourceNewHistoryMapper.java
  18. 60 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlTaxSourceNewMapper.java
  19. 18 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlTaxSourceNewRecordMapper.java
  20. 38 0
      src/main/java/com/ydtech/modules/protocol/entity/dto/PtlTaxSourceNewDto.java
  21. 96 0
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlTaxSourceNew.java
  22. 89 0
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlTaxSourceNewHistory.java
  23. 76 0
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlTaxSourceNewRecord.java
  24. 26 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewAddDeptIdsVo.java
  25. 79 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewAddVo.java
  26. 23 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewIdsVo.java
  27. 80 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewSaveVo.java
  28. 68 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlTaxSourceNewVo.java
  29. 8 0
      src/main/java/com/ydtech/modules/protocol/service/PtlTaxSourceNewHistoryService.java
  30. 14 0
      src/main/java/com/ydtech/modules/protocol/service/PtlTaxSourceNewRecordService.java
  31. 76 0
      src/main/java/com/ydtech/modules/protocol/service/PtlTaxSourceNewService.java
  32. 18 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceRecordServiceImpl.java
  33. 13 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceServiceHistoryImpl.java
  34. 779 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceServiceImpl.java
  35. 17 6
      src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java
  36. 178 0
      src/main/java/com/ydtech/modules/protocol/utils/RulesMergeStrUtils.java
  37. 18 0
      src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesAttrLinkHistoryMapper.java
  38. 18 0
      src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesAttrLinkMapper.java
  39. 18 0
      src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesAttrMapper.java
  40. 19 0
      src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesDictLabalMapper.java
  41. 17 0
      src/main/java/com/ydtech/modules/protocols/dao/PtlAgreementDispatchRulesDictMapper.java
  42. 12 0
      src/main/java/com/ydtech/modules/protocols/entity/po/InsFeeOrderNew.java
  43. 67 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesAttr.java
  44. 58 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesAttrLink.java
  45. 77 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesAttrLinkHistory.java
  46. 41 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesDict.java
  47. 49 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementDispatchRulesDictLabal.java
  48. 13 0
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesAttrLinkHistoryService.java
  49. 13 0
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesAttrLinkService.java
  50. 35 0
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesAttrService.java
  51. 14 0
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesDictLabalService.java
  52. 22 0
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementDispatchRulesDictService.java
  53. 18 0
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesAttrLinkHistoryServiceImpl.java
  54. 18 0
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesAttrLinkServiceImpl.java
  55. 92 0
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesAttrServiceImpl.java
  56. 24 0
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesDictLabalServiceImpl.java
  57. 53 0
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementDispatchRulesDictServiceImpl.java
  58. 9 2
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java
  59. 17 0
      src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml
  60. 24 2
      src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml
  61. 4 4
      src/main/resources/mapper/modules/ins/InsFeeOrderNewMapper.xml
  62. 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;
+    }
 }

+ 2 - 1
src/main/java/com/ydtech/modules/fee/service/FeeRuleSchemeService.java

@@ -90,7 +90,8 @@ public interface FeeRuleSchemeService {
                                                BigDecimal level2Proportion,BigDecimal level2Premium,
                                                BigDecimal level3Proportion,BigDecimal level3Premium,
                                                BigDecimal level4Proportion,BigDecimal level4Premium,
-                                               BigDecimal level5Proportion,BigDecimal level5Premium);
+                                               BigDecimal level5Proportion,BigDecimal level5Premium,
+                                               BigDecimal profitMarginPremiums);
 
     FeeOrderNewVo.ExportFee assignExportFee(String title,BigDecimal premium,BigDecimal superviseCostsProportion,BigDecimal otherCostsProportion,
                                             BigDecimal superviseCostsPremiums,BigDecimal otherCostsPremiums);

+ 20 - 31
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceImpl.java

@@ -2653,7 +2653,8 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
                 insFeeOrderNew.getJqDeptProportionLevel2(), insFeeOrderNew.getJqDeptPremiumsLevel2(),
                 insFeeOrderNew.getJqDeptProportionLevel3(), insFeeOrderNew.getJqDeptPremiumsLevel3(),
                 insFeeOrderNew.getJqDeptProportionLevel4(), insFeeOrderNew.getJqDeptPremiumsLevel4(),
-                insFeeOrderNew.getJqDeptProportionLevel5(), insFeeOrderNew.getJqDeptPremiumsLevel5());
+                insFeeOrderNew.getJqDeptProportionLevel5(), insFeeOrderNew.getJqDeptPremiumsLevel5(),
+                insFeeOrderNew.getJqProfitMarginPremiums());
         deptManagerFeeList.add(jqDeptManagerFee);
 
         //商业
@@ -2662,7 +2663,8 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
                 insFeeOrderNew.getSyDeptProportionLevel2(), insFeeOrderNew.getSyDeptPremiumsLevel2(),
                 insFeeOrderNew.getSyDeptProportionLevel3(), insFeeOrderNew.getSyDeptPremiumsLevel3(),
                 insFeeOrderNew.getSyDeptProportionLevel4(), insFeeOrderNew.getSyDeptPremiumsLevel4(),
-                insFeeOrderNew.getSyDeptProportionLevel5(), insFeeOrderNew.getSyDeptPremiumsLevel5());
+                insFeeOrderNew.getSyDeptProportionLevel5(), insFeeOrderNew.getSyDeptPremiumsLevel5(),
+                insFeeOrderNew.getSyProfitMarginPremiums());
         deptManagerFeeList.add(syDeptManagerFee);
 
         //非车
@@ -2671,27 +2673,12 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
                 insFeeOrderNew.getNoDeptProportionLevel2(), insFeeOrderNew.getNoDeptPremiumsLevel2(),
                 insFeeOrderNew.getNoDeptProportionLevel3(), insFeeOrderNew.getNoDeptPremiumsLevel3(),
                 insFeeOrderNew.getNoDeptProportionLevel4(), insFeeOrderNew.getNoDeptPremiumsLevel4(),
-                insFeeOrderNew.getNoDeptProportionLevel5(), insFeeOrderNew.getNoDeptPremiumsLevel5());
+                insFeeOrderNew.getNoDeptProportionLevel5(), insFeeOrderNew.getNoDeptPremiumsLevel5(),
+                insFeeOrderNew.getNoProfitMarginPremiums());
         deptManagerFeeList.add(noDeptManagerFee);
 
         //endregion
 
-        //region 机构管理对象 费用总比例计算
-        //交强机构管理费总比例
-        BigDecimal jqDeptManagerRadio = jqDeptManagerFee.getDeptProportionLevelOne().add(jqDeptManagerFee.getDeptProportionLevelTwo())
-                .add(jqDeptManagerFee.getDeptProportionLevelThree()).add(jqDeptManagerFee.getDeptProportionLevelFoure())
-                .add(jqDeptManagerFee.getDeptProportionLevelFive());
-
-        //商业机构管理费总比例
-        BigDecimal syDeptManagerRadio = syDeptManagerFee.getDeptProportionLevelOne().add(syDeptManagerFee.getDeptProportionLevelTwo())
-                .add(syDeptManagerFee.getDeptProportionLevelThree()).add(syDeptManagerFee.getDeptProportionLevelFoure())
-                .add(syDeptManagerFee.getDeptProportionLevelFive());
-
-        //非车机构管理费总比例
-        BigDecimal noDeptManagerRadio = noDeptManagerFee.getDeptProportionLevelOne().add(noDeptManagerFee.getDeptProportionLevelTwo())
-                .add(noDeptManagerFee.getDeptProportionLevelThree()).add(noDeptManagerFee.getDeptProportionLevelFoure())
-                .add(noDeptManagerFee.getDeptProportionLevelFive());
-        //endregion
 
 
         //region 出口费用
@@ -2734,14 +2721,14 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         entranceFee.setPremium(premium);
         premium = premium.divide(taxRate,5,RoundingMode.HALF_UP);
         //手续费
-        entranceFee.setSuperviseCostsPremiums(premium.multiply(superviseCostsProportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
+        entranceFee.setSuperviseCostsPremiums(premium.multiply(superviseCostsProportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_DOWN));
         entranceFee.setSuperviseCosts(superviseCostsProportion);
         //跟单费
-        entranceFee.setOtherCostsPremiums(premium.multiply(otherCostsProportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
+        entranceFee.setOtherCostsPremiums(premium.multiply(otherCostsProportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_DOWN));
         entranceFee.setOtherCostsProportion(otherCostsProportion);
         //总费用比例
         BigDecimal totalCostsProportion = superviseCostsProportion.add(otherCostsProportion);
-        entranceFee.setTotalAmount(premium.multiply(totalCostsProportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
+        entranceFee.setTotalAmount(premium.multiply(totalCostsProportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_DOWN));
         entranceFee.setTotalProportion(totalCostsProportion);
         return entranceFee;
     }
@@ -2760,19 +2747,19 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
                                                            BigDecimal level3Proportion,BigDecimal level4Proportion,BigDecimal level5Proportion){
         FeeOrderNewVo.DeptManagerFee deptManagerFee = new FeeOrderNewVo.DeptManagerFee();
         //一级管理费
-        deptManagerFee.setDeptPremiumsLevelOne(premium.multiply(level1Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
+        deptManagerFee.setDeptPremiumsLevelOne(premium.multiply(level1Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_DOWN));
         deptManagerFee.setDeptProportionLevelOne(level1Proportion);
         //二级管理费
-        deptManagerFee.setDeptPremiumsLevelTwo(premium.multiply(level2Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
+        deptManagerFee.setDeptPremiumsLevelTwo(premium.multiply(level2Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_DOWN));
         deptManagerFee.setDeptProportionLevelTwo(level2Proportion);
         //三级管理费
-        deptManagerFee.setDeptPremiumsLevelThree(premium.multiply(level3Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
+        deptManagerFee.setDeptPremiumsLevelThree(premium.multiply(level3Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_DOWN));
         deptManagerFee.setDeptProportionLevelThree(level3Proportion);
         //四级管理费
-        deptManagerFee.setDeptPremiumsLevelFoure(premium.multiply(level4Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
+        deptManagerFee.setDeptPremiumsLevelFoure(premium.multiply(level4Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_DOWN));
         deptManagerFee.setDeptProportionLevelFoure(level4Proportion);
         //五级管理费
-        deptManagerFee.setDeptPremiumsLevelFive(premium.multiply(level5Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
+        deptManagerFee.setDeptPremiumsLevelFive(premium.multiply(level5Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_DOWN));
         deptManagerFee.setDeptProportionLevelFive(level5Proportion);
         return deptManagerFee;
     }
@@ -2810,9 +2797,9 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
             exportFee.setOtherCostsProportion(exportTotalProportion.subtract(superviseCostsProportion));
             exportFee.setSuperviseCosts(superviseCostsProportion);
         }
-        exportFee.setSuperviseCostsPremiums(premium.multiply(exportFee.getSuperviseCosts().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_HALF_UP));
-        exportFee.setOtherCostsPremiums(premium.multiply(exportFee.getOtherCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_HALF_UP));
-        exportFee.setTotalAmount(premium.multiply(exportFee.getTotalProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_HALF_UP));
+        exportFee.setSuperviseCostsPremiums(premium.multiply(exportFee.getSuperviseCosts().divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_DOWN));
+        exportFee.setOtherCostsPremiums(premium.multiply(exportFee.getOtherCostsProportion().divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_DOWN));
+        exportFee.setTotalAmount(premium.multiply(exportFee.getTotalProportion().divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_DOWN));
 
         return exportFee;
     }
@@ -2910,7 +2897,8 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
                                                    BigDecimal level2Proportion,BigDecimal level2Premium,
                                                    BigDecimal level3Proportion,BigDecimal level3Premium,
                                                    BigDecimal level4Proportion,BigDecimal level4Premium,
-                                                   BigDecimal level5Proportion,BigDecimal level5Premium){
+                                                   BigDecimal level5Proportion,BigDecimal level5Premium,
+                                                  BigDecimal profitMarginPremiums){
         FeeOrderNewVo.DeptManagerFee deptManagerFee = new FeeOrderNewVo.DeptManagerFee();
         deptManagerFee.setInsuranceType(title);
         deptManagerFee.setDeptProportionLevelOne(level1Proportion);
@@ -2923,6 +2911,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         deptManagerFee.setDeptPremiumsLevelFoure(level4Premium);
         deptManagerFee.setDeptProportionLevelFive(level5Proportion);
         deptManagerFee.setDeptPremiumsLevelFive(level5Premium);
+        deptManagerFee.setProfitMarginPremiums(profitMarginPremiums);
         return deptManagerFee;
     }
 

+ 50 - 45
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -150,6 +150,11 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
         verificationRules(ptlAgreementUndwrtRules, insAreaCompany, insOrders);
     }
 
+    //BigDecimal取两位
+    private BigDecimal twoPeople(BigDecimal number){
+        return number.setScale(2, BigDecimal.ROUND_HALF_DOWN);
+    }
+
     /**
      * 计算费用
      *
@@ -204,33 +209,33 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                 new BigDecimal(ptlAgreementProductCostsNew.getJqCarCostsProportion()),
                 new BigDecimal(ptlAgreementProductCostsNew.getJqCarOtherCostsProportion()), taxRadio);
         insFeeOrderNew.setJqCostsProportion(jqEntranceFee.getTotalProportion());
-        insFeeOrderNew.setJqCostsPremiums(jqEntranceFee.getTotalAmount());
+        insFeeOrderNew.setJqCostsPremiums(twoPeople(jqEntranceFee.getTotalAmount()));
         insFeeOrderNew.setJqSuperviseCostsProportion(jqEntranceFee.getSuperviseCosts());
-        insFeeOrderNew.setJqSuperviseCostsPremiums(jqEntranceFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setJqSuperviseCostsPremiums(twoPeople(jqEntranceFee.getSuperviseCostsPremiums()));
         insFeeOrderNew.setJqOtherCostsProportion(jqEntranceFee.getOtherCostsProportion());
-        insFeeOrderNew.setJqOtherCostsPremiums(jqEntranceFee.getOtherCostsPremiums());
+        insFeeOrderNew.setJqOtherCostsPremiums(twoPeople(jqEntranceFee.getOtherCostsPremiums()));
 
         //商业入口信息
         FeeOrderNewVo.EntranceFee syEntranceFee = feeRuleSchemeService.calcEntranceFee(insFeeOrderNew.getSyPremium(),
                 new BigDecimal(ptlAgreementProductCostsNew.getSyCarCostsProportion()),
                 new BigDecimal(ptlAgreementProductCostsNew.getSyCarOtherCostsProportion()), taxRadio);
         insFeeOrderNew.setSyCostsProportion(syEntranceFee.getTotalProportion());
-        insFeeOrderNew.setSyCostsPremiums(syEntranceFee.getTotalAmount());
+        insFeeOrderNew.setSyCostsPremiums(twoPeople(syEntranceFee.getTotalAmount()));
         insFeeOrderNew.setSySuperviseCostsProportion(syEntranceFee.getSuperviseCosts());
-        insFeeOrderNew.setSySuperviseCostsPremiums(syEntranceFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setSySuperviseCostsPremiums(twoPeople(syEntranceFee.getSuperviseCostsPremiums()));
         insFeeOrderNew.setSyOtherCostsProportion(syEntranceFee.getOtherCostsProportion());
-        insFeeOrderNew.setSyOtherCostsPremiums(syEntranceFee.getOtherCostsPremiums());
+        insFeeOrderNew.setSyOtherCostsPremiums(twoPeople(syEntranceFee.getOtherCostsPremiums()));
 
         //非车入口信息
         FeeOrderNewVo.EntranceFee noEntranceFee = feeRuleSchemeService.calcEntranceFee(insFeeOrderNew.getNoPremium(),
                 new BigDecimal(ptlAgreementProductCostsNew.getNoCarCostsProportion()),
                 new BigDecimal(ptlAgreementProductCostsNew.getNoCarOtherCostsProportion()), taxRadio);
         insFeeOrderNew.setNoCostsProportion(noEntranceFee.getTotalProportion());
-        insFeeOrderNew.setNoCostsPremiums(noEntranceFee.getTotalAmount());
+        insFeeOrderNew.setNoCostsPremiums(twoPeople(noEntranceFee.getTotalAmount()));
         insFeeOrderNew.setNoSuperviseCostsProportion(noEntranceFee.getSuperviseCosts());
-        insFeeOrderNew.setNoSuperviseCostsPremiums(noEntranceFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setNoSuperviseCostsPremiums(twoPeople(noEntranceFee.getSuperviseCostsPremiums()));
         insFeeOrderNew.setNoOtherCostsProportion(noEntranceFee.getOtherCostsProportion());
-        insFeeOrderNew.setNoOtherCostsPremiums(noEntranceFee.getOtherCostsPremiums());
+        insFeeOrderNew.setNoOtherCostsPremiums(twoPeople(noEntranceFee.getOtherCostsPremiums()));
 
         //endregion
 
@@ -297,15 +302,15 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                 ptlAgreementProductCostsExport.getJqExportRadioLevel3(), ptlAgreementProductCostsExport.getJqExportRadioLevel4(),
                 ptlAgreementProductCostsExport.getJqExportRadioLevel5());
         insFeeOrderNew.setJqDeptProportionLevel1(jqDeptManagerFee.getDeptProportionLevelOne());
-        insFeeOrderNew.setJqDeptPremiumsLevel1(jqDeptManagerFee.getDeptPremiumsLevelOne());
+        insFeeOrderNew.setJqDeptPremiumsLevel1(twoPeople(jqDeptManagerFee.getDeptPremiumsLevelOne()));
         insFeeOrderNew.setJqDeptProportionLevel2(jqDeptManagerFee.getDeptProportionLevelTwo());
-        insFeeOrderNew.setJqDeptPremiumsLevel2(jqDeptManagerFee.getDeptPremiumsLevelTwo());
+        insFeeOrderNew.setJqDeptPremiumsLevel2(twoPeople(jqDeptManagerFee.getDeptPremiumsLevelTwo()));
         insFeeOrderNew.setJqDeptProportionLevel3(jqDeptManagerFee.getDeptProportionLevelThree());
-        insFeeOrderNew.setJqDeptPremiumsLevel3(jqDeptManagerFee.getDeptPremiumsLevelThree());
+        insFeeOrderNew.setJqDeptPremiumsLevel3(twoPeople(jqDeptManagerFee.getDeptPremiumsLevelThree()));
         insFeeOrderNew.setJqDeptProportionLevel4(jqDeptManagerFee.getDeptProportionLevelFoure());
-        insFeeOrderNew.setJqDeptPremiumsLevel4(jqDeptManagerFee.getDeptPremiumsLevelFoure());
+        insFeeOrderNew.setJqDeptPremiumsLevel4(twoPeople(jqDeptManagerFee.getDeptPremiumsLevelFoure()));
         insFeeOrderNew.setJqDeptProportionLevel5(jqDeptManagerFee.getDeptProportionLevelFive());
-        insFeeOrderNew.setJqDeptPremiumsLevel5(jqDeptManagerFee.getDeptPremiumsLevelFive());
+        insFeeOrderNew.setJqDeptPremiumsLevel5(twoPeople(jqDeptManagerFee.getDeptPremiumsLevelFive()));
 
         BigDecimal syDeptRadio =
                 ptlAgreementProductCostsExport.getSyExportRadioLevel1().add(ptlAgreementProductCostsExport.getSyExportRadioLevel2()).add(ptlAgreementProductCostsExport.getSyExportRadioLevel3()).add(ptlAgreementProductCostsExport.getSyExportRadioLevel4()).add(ptlAgreementProductCostsExport.getSyExportRadioLevel5());
@@ -314,15 +319,15 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                 ptlAgreementProductCostsExport.getSyExportRadioLevel3(), ptlAgreementProductCostsExport.getSyExportRadioLevel4(),
                 ptlAgreementProductCostsExport.getSyExportRadioLevel5());
         insFeeOrderNew.setSyDeptProportionLevel1(syDeptManagerFee.getDeptProportionLevelOne());
-        insFeeOrderNew.setSyDeptPremiumsLevel1(syDeptManagerFee.getDeptPremiumsLevelOne());
+        insFeeOrderNew.setSyDeptPremiumsLevel1(twoPeople(syDeptManagerFee.getDeptPremiumsLevelOne()));
         insFeeOrderNew.setSyDeptProportionLevel2(syDeptManagerFee.getDeptProportionLevelTwo());
-        insFeeOrderNew.setSyDeptPremiumsLevel2(syDeptManagerFee.getDeptPremiumsLevelTwo());
+        insFeeOrderNew.setSyDeptPremiumsLevel2(twoPeople(syDeptManagerFee.getDeptPremiumsLevelTwo()));
         insFeeOrderNew.setSyDeptProportionLevel3(syDeptManagerFee.getDeptProportionLevelThree());
-        insFeeOrderNew.setSyDeptPremiumsLevel3(syDeptManagerFee.getDeptPremiumsLevelThree());
+        insFeeOrderNew.setSyDeptPremiumsLevel3(twoPeople(syDeptManagerFee.getDeptPremiumsLevelThree()));
         insFeeOrderNew.setSyDeptProportionLevel4(syDeptManagerFee.getDeptProportionLevelFoure());
-        insFeeOrderNew.setSyDeptPremiumsLevel4(syDeptManagerFee.getDeptPremiumsLevelFoure());
+        insFeeOrderNew.setSyDeptPremiumsLevel4(twoPeople(syDeptManagerFee.getDeptPremiumsLevelFoure()));
         insFeeOrderNew.setSyDeptProportionLevel5(syDeptManagerFee.getDeptProportionLevelFive());
-        insFeeOrderNew.setSyDeptPremiumsLevel5(syDeptManagerFee.getDeptPremiumsLevelFive());
+        insFeeOrderNew.setSyDeptPremiumsLevel5(twoPeople(syDeptManagerFee.getDeptPremiumsLevelFive()));
 
         BigDecimal noDeptRadio =
                 ptlAgreementProductCostsExport.getNoCarExportRadioLevel1().add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel2()).add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel3()).add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel4()).add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel5());
@@ -331,15 +336,15 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                 ptlAgreementProductCostsExport.getNoCarExportRadioLevel3(), ptlAgreementProductCostsExport.getNoCarExportRadioLevel4(),
                 ptlAgreementProductCostsExport.getNoCarExportRadioLevel5());
         insFeeOrderNew.setNoDeptProportionLevel1(noDeptManagerFee.getDeptProportionLevelOne());
-        insFeeOrderNew.setNoDeptPremiumsLevel1(noDeptManagerFee.getDeptPremiumsLevelOne());
+        insFeeOrderNew.setNoDeptPremiumsLevel1(twoPeople(noDeptManagerFee.getDeptPremiumsLevelOne()));
         insFeeOrderNew.setNoDeptProportionLevel2(noDeptManagerFee.getDeptProportionLevelTwo());
-        insFeeOrderNew.setNoDeptPremiumsLevel2(noDeptManagerFee.getDeptPremiumsLevelTwo());
+        insFeeOrderNew.setNoDeptPremiumsLevel2(twoPeople(noDeptManagerFee.getDeptPremiumsLevelTwo()));
         insFeeOrderNew.setNoDeptProportionLevel3(noDeptManagerFee.getDeptProportionLevelThree());
-        insFeeOrderNew.setNoDeptPremiumsLevel3(noDeptManagerFee.getDeptPremiumsLevelThree());
+        insFeeOrderNew.setNoDeptPremiumsLevel3(twoPeople(noDeptManagerFee.getDeptPremiumsLevelThree()));
         insFeeOrderNew.setNoDeptProportionLevel4(noDeptManagerFee.getDeptProportionLevelFoure());
-        insFeeOrderNew.setNoDeptPremiumsLevel4(noDeptManagerFee.getDeptPremiumsLevelFoure());
+        insFeeOrderNew.setNoDeptPremiumsLevel4(twoPeople(noDeptManagerFee.getDeptPremiumsLevelFoure()));
         insFeeOrderNew.setNoDeptProportionLevel5(noDeptManagerFee.getDeptProportionLevelFive());
-        insFeeOrderNew.setNoDeptPremiumsLevel5(noDeptManagerFee.getDeptPremiumsLevelFive());
+        insFeeOrderNew.setNoDeptPremiumsLevel5(twoPeople(noDeptManagerFee.getDeptPremiumsLevelFive()));
 
         //endregion
 
@@ -358,19 +363,19 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                 insFeeOrderNew.getNoCostsProportion(), noDeptRadio, retailRadio, taxRadio);
 
         //出口手续费用
-        insFeeOrderNew.setJqExportSuperviseCostsPremiums(jqExportFee.getSuperviseCostsPremiums());
-        insFeeOrderNew.setSyExportSuperviseCostsPremiums(syExportFee.getSuperviseCostsPremiums());
-        insFeeOrderNew.setNoExportSuperviseCostsPremiums(noExportFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setJqExportSuperviseCostsPremiums(twoPeople(jqExportFee.getSuperviseCostsPremiums()));
+        insFeeOrderNew.setSyExportSuperviseCostsPremiums(twoPeople(syExportFee.getSuperviseCostsPremiums()));
+        insFeeOrderNew.setNoExportSuperviseCostsPremiums(twoPeople(noExportFee.getSuperviseCostsPremiums()));
 
         //出口其他费用比例
-        insFeeOrderNew.setJqExportOtherCostsProportion(jqExportFee.getOtherCostsProportion());
-        insFeeOrderNew.setSyExportOtherCostsProportion(syExportFee.getOtherCostsProportion());
-        insFeeOrderNew.setNoExportOtherCostsProportion(noExportFee.getOtherCostsProportion());
+        insFeeOrderNew.setJqExportOtherCostsProportion(twoPeople(jqExportFee.getOtherCostsProportion()));
+        insFeeOrderNew.setSyExportOtherCostsProportion(twoPeople(syExportFee.getOtherCostsProportion()));
+        insFeeOrderNew.setNoExportOtherCostsProportion(twoPeople(noExportFee.getOtherCostsProportion()));
 
         //出口其他费用
-        insFeeOrderNew.setJqExportOtherCostsPremiums(jqExportFee.getOtherCostsPremiums());
-        insFeeOrderNew.setSyExportOtherCostsPremiums(syExportFee.getOtherCostsPremiums());
-        insFeeOrderNew.setNoExportOtherCostsPremiums(noExportFee.getOtherCostsPremiums());
+        insFeeOrderNew.setJqExportOtherCostsPremiums(twoPeople(jqExportFee.getOtherCostsPremiums()));
+        insFeeOrderNew.setSyExportOtherCostsPremiums(twoPeople(syExportFee.getOtherCostsPremiums()));
+        insFeeOrderNew.setNoExportOtherCostsPremiums(twoPeople(noExportFee.getOtherCostsPremiums()));
 
         //endregion
 
@@ -385,30 +390,30 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
         BigDecimal noFenXiao = insFeeOrderNew.getNoPremium().multiply(retailRadio.divide(new BigDecimal(100)));
 
         BigDecimal jqDifference = insFeeOrderNew.getJqCostsPremiums().subtract(
-                (insFeeOrderNew.getJqExportSuperviseCostsPremiums().add(insFeeOrderNew.getJqExportOtherCostsPremiums())))
+                (jqExportFee.getSuperviseCostsPremiums().add(jqExportFee.getOtherCostsPremiums())))
                 .subtract(
-                (insFeeOrderNew.getJqDeptPremiumsLevel2().add(insFeeOrderNew.getJqDeptPremiumsLevel3()).add(insFeeOrderNew.getJqDeptPremiumsLevel4()).add(insFeeOrderNew.getJqDeptPremiumsLevel5()))
+                (jqDeptManagerFee.getDeptPremiumsLevelOne().add(jqDeptManagerFee.getDeptPremiumsLevelTwo().add(jqDeptManagerFee.getDeptPremiumsLevelThree()).add(jqDeptManagerFee.getDeptPremiumsLevelFoure()).add(jqDeptManagerFee.getDeptPremiumsLevelFive())))
                 )
-                .subtract(jqFenXiao);
-        insFeeOrderNew.setJqDeptPremiumsLevel1(jqDifference);
+                .subtract(jqFenXiao).setScale(5, BigDecimal.ROUND_HALF_DOWN);
+        insFeeOrderNew.setJqProfitMarginPremiums(jqDifference);
 
         BigDecimal syDifference = insFeeOrderNew.getSyCostsPremiums().subtract(
-                (insFeeOrderNew.getSyExportSuperviseCostsPremiums().add(insFeeOrderNew.getSyExportOtherCostsPremiums())))
+                (syExportFee.getSuperviseCostsPremiums().add(syExportFee.getOtherCostsPremiums())))
                 .subtract(
-                (insFeeOrderNew.getSyDeptPremiumsLevel2().add(insFeeOrderNew.getSyDeptPremiumsLevel3()).add(insFeeOrderNew.getSyDeptPremiumsLevel4()).add(insFeeOrderNew.getSyDeptPremiumsLevel5()))
+                (syDeptManagerFee.getDeptPremiumsLevelOne().add(syDeptManagerFee.getDeptPremiumsLevelTwo().add(syDeptManagerFee.getDeptPremiumsLevelThree()).add(syDeptManagerFee.getDeptPremiumsLevelFoure()).add(syDeptManagerFee.getDeptPremiumsLevelFive())))
                 )
-                .subtract(syFenXiao);
-        insFeeOrderNew.setSyDeptPremiumsLevel1(syDifference);
+                .subtract(syFenXiao).setScale(5, BigDecimal.ROUND_HALF_DOWN);
+        insFeeOrderNew.setSyProfitMarginPremiums(syDifference);
 
 
         BigDecimal noDifference = insFeeOrderNew.getNoCostsPremiums().subtract(
-                (insFeeOrderNew.getNoExportSuperviseCostsPremiums().add(insFeeOrderNew.getNoExportOtherCostsPremiums())))
+                (noExportFee.getSuperviseCostsPremiums().add(noExportFee.getOtherCostsPremiums())))
                 .subtract(
-                (insFeeOrderNew.getNoDeptPremiumsLevel2().add(insFeeOrderNew.getNoDeptPremiumsLevel3()).add(insFeeOrderNew.getNoDeptPremiumsLevel4()).add(insFeeOrderNew.getNoDeptPremiumsLevel5()))
+                (noDeptManagerFee.getDeptPremiumsLevelOne().add(noDeptManagerFee.getDeptPremiumsLevelTwo().add(noDeptManagerFee.getDeptPremiumsLevelThree()).add(noDeptManagerFee.getDeptPremiumsLevelFoure()).add(noDeptManagerFee.getDeptPremiumsLevelFive())))
                 )
-                .subtract(noFenXiao);
+                .subtract(noFenXiao).setScale(5, BigDecimal.ROUND_HALF_DOWN);
 
-        insFeeOrderNew.setNoDeptPremiumsLevel1(noDifference);
+        insFeeOrderNew.setNoProfitMarginPremiums(noDifference);
 
         //endregion
 

+ 1 - 0
src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java

@@ -119,4 +119,5 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
 
     InsPlyIncome getEntityById(@Param("id") String id);
 
+    void updateByIds(String[] split);
 }

+ 2 - 0
src/main/java/com/ydtech/modules/fnc/dao/SettlementDocumentaryFeesMapper.java

@@ -26,4 +26,6 @@ public interface SettlementDocumentaryFeesMapper  extends BaseMapper<SettlementD
     void batchByInvoice( HashMap<String,Object> ids);
 
     List<HashMap<String, Object>> getInvoicIds(HashMap<String, Object> params);
+
+    SettlementDocumentaryFeesEntity getByParentSettlementAmount(String id);
 }

+ 1 - 0
src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryFeesService.java

@@ -26,4 +26,5 @@ public interface SettlementDocumentaryFeesService extends IService<SettlementDoc
 
     List<HashMap<String, Object>> getInvoicIds(HashMap<String, Object> params);
 
+    SettlementDocumentaryFeesEntity getByParentSettlementAmount(String id);
 }

+ 52 - 1
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -688,6 +688,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         HashMap<String, Object> params = new HashMap<>();
         ArrayList<HashMap<String, Object>> resultList = new ArrayList<>();
         HashMap<String, Object> resultMap = new HashMap<>();
+        StringBuffer strBuilder = new StringBuffer();
+        String ids="";
         try {
             List<InsBxPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxPlyIncomeExcelDto.class, 0, 1, 1);
             Integer i=0;
@@ -718,6 +720,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                         resultMap.put("agreementId",insPlyIncome.getAgreementId());  //协议id
                     }
                     if(ObjectUtils.isNotEmpty(insPlyIncome)){  // 比配上汇总金额 未匹配则返回到数据当中
+                        strBuilder.append(insPlyIncome.getId()).append(",");
                         if(  insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
                             totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
                         }
@@ -736,6 +739,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                     }
                 }
             }
+            if(strBuilder.length() >0){
+                ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
+            }
+            resultMap.put("ids",ids);
             resultMap.put("totalAmount",totalAmount);
             resultMap.put("resultList",resultList);
             return resultMap;
@@ -751,6 +758,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         HashMap<String, Object> params = new HashMap<>();
         HashMap<String, Object> resultMap = new HashMap<>();
         ArrayList<HashMap<String, Object>> resultList = new ArrayList<>();
+        StringBuffer strBuilder = new StringBuffer();
         String ids="";
         try {
             Integer i=0;
@@ -777,6 +785,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                         resultMap.put("agreementId",insPlyIncome.getAgreementId());  //协议id
                     }
                     if(ObjectUtils.isNotEmpty(insPlyIncome)){  // 比配上汇总金额 未匹配则返回到数据当中
+                        strBuilder.append(insPlyIncome.getId()).append(",");
                         if(  insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
                             totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
                         }
@@ -791,7 +800,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                         resultList.add(noMatching);
                     }
                 }
-
+                if(strBuilder.length() >0){
+                    ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
+                }
+                resultMap.put("ids",ids);
                 resultMap.put("totalAmount",totalAmount);
                 resultMap.put("resultList",resultList);
             }
@@ -839,6 +851,12 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     public HttpResult<List<HashMap<String,Object>>> invicdetail(InsPlyIncomeVo insPlyIncomeVo) {
         HashMap<String, Object> params = new HashMap<>();
         params =this.saveParams(insPlyIncomeVo,params);
+        if (StringUtils.isEmpty(insPlyIncomeVo.getIsSettlement())){
+            params.put("isSettlement","1");
+        }
+        if(StringUtils.isNotEmpty(insPlyIncomeVo.getSettlementStatus())){
+            params.put("settlementStatus",insPlyIncomeVo.getSettlementStatus());
+        }
         List<HashMap<String, Object>> resultList = settlementDocumentaryFeesService.getOtherSettldetail(params);
         if (resultList.size() > 0) {
             return HttpResult.ok(resultList);
@@ -1273,10 +1291,23 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Override
     @Transactional
     public HttpResult<Object> batchInvoicing(InsPlyIncomeVo insPlyIncomeVo) {
+        //      开票时生成  记录 用来合计已经开票数据
+        String ids = insPlyIncomeVo.getIds();
+        if(StringUtils.isNotEmpty(ids)){
+            String[] split = ids.split(",");
+            for (String id :  split){
+                InsPlyIncome insPlyIncome = baseMapper.selectById(id);
+                insPlyIncome.setInvoicTime(LocalDate.now());  //开票时间
+                insPlyIncome.setInvoicId(insPlyIncomeVo.getInvoicId()); //开票号
+                insPlyIncome.setHandlingFeesStatus("2");   //2为开票
+                baseMapper.updateById(insPlyIncome);
+            }
+        }
         insPlyIncomeVo.setNoInvoicCommissionFeevalue(insPlyIncomeVo.getTotalAmount());
         insPlyIncomeVo.setOtherFeevalue(insPlyIncomeVo.getTotalAmount());
         insPlyIncomeVo.setHandlingFeesStatus("0");  // 0手续费 1  跟单费
         insPlyIncomeVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
+        insPlyIncomeVo.setAgreementId(insPlyIncomeVo.getAgreementId());
         insPlyIncomeVo.setSettlementAmount(insPlyIncomeVo.getTotalAmount());
         insPlyIncomeVo.setContractId(insPlyIncomeVo.getInvoicId());
         this.batchInvoic(insPlyIncomeVo);
@@ -1296,6 +1327,9 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 
     @Override
     public HttpResult<Object> batchBxBalance(InsPlyIncomeVo insPlyIncomeVo) {
+        if(StringUtils.isNotEmpty(insPlyIncomeVo.getIds())){// 判断 ins_ply_income  是否完全结算完 如果结算完则改为已结算状态
+            this.changeHandStatus(insPlyIncomeVo.getIds(),insPlyIncomeVo);
+        }
 //            分批结算
         SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo();
 
@@ -1323,6 +1357,22 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         return HttpResult.ok();
     }
 
+    private void changeHandStatus(String ids, InsPlyIncomeVo insPlyIncomeVo) {
+        String[] split = ids.split(",");
+
+        SettlementDocumentaryFeesEntity byId = settlementDocumentaryFeesService.getById(insPlyIncomeVo.getId());
+        BigDecimal totalAmount = byId.getTotalAmount();  //开票总金额
+        BigDecimal settlementAmount = insPlyIncomeVo.getSettlementAmount();   //本次结算金额
+        //多次结算 表中已经结算的金额
+        SettlementDocumentaryFeesEntity    settlementAmountEntity = settlementDocumentaryFeesService.getByParentSettlementAmount(insPlyIncomeVo.getId());
+        if(ObjectUtils.isNotEmpty(settlementAmountEntity)){
+            BigDecimal all = settlementAmount.add(settlementAmountEntity.getTotalAmount());
+            if(all.equals(totalAmount)){
+                baseMapper.updateByIds(split);
+            }
+        }
+    }
+
     @Override
     public HttpResult<InsPlyIncome> querySettInvoicing(InsPlyIncomeVo insPlyIncomeVo) {
         HashMap<String, Object> params = new HashMap<>();
@@ -1436,6 +1486,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         settlementDocumentaryFeesVo.setHandlingFeesStatus(insPlyIncomeVo.getHandlingFeesStatus());
         settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod()); //开票方式
         settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints()); //税点
+        settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIds());
         //  税点支出
         if(BigDecimalUtils.nullToZero(insPlyIncomeVo.getTaxPoints()) !=null   && BigDecimalUtils.nullToZero(insPlyIncomeVo.getSettlementAmount()) !=null){
             BigDecimal settlementAmount = insPlyIncomeVo.getSettlementAmount();

+ 6 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java

@@ -163,6 +163,12 @@ public class SettlementDocumentaryFeesServiceImpl extends ServiceImpl<Settlement
         return  baseMapper.getInvoicIds(params);
     }
 
+    @Override
+    public SettlementDocumentaryFeesEntity getByParentSettlementAmount(String id) {
+
+        return baseMapper.getByParentSettlementAmount(id);
+    }
+
     private int compareAmount(BigDecimal settlementAmount, BigDecimal settlementAmount1) {
 
         return settlementAmount.compareTo(settlementAmount1);

+ 6 - 0
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java

@@ -276,4 +276,10 @@ public class InsPlyIncomeVo implements Serializable {
     @ApiModelProperty("税点金额")
     private BigDecimal expendAmount;
 
+    @ApiModelProperty("是否已结算")
+    private String isSettlement;
+
+    @ApiModelProperty("结算状态")
+    private String settlementStatus;
+
 }

+ 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;
+
 }

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

@@ -106,5 +106,7 @@ public class FeeOrderNewVo implements Serializable {
         private BigDecimal deptProportionLevelFive;
         @ApiModelProperty("五级管理费")
         private BigDecimal deptPremiumsLevelFive;
+        @ApiModelProperty("利润差值")
+        private BigDecimal profitMarginPremiums;
     }
 }

+ 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 {
+
+
+}

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

@@ -0,0 +1,779 @@
+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.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获取名称值
+     */
+    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: 前台信息拼接
+     */
+    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> {
+
+}
+
+
+
+

+ 12 - 0
src/main/java/com/ydtech/modules/protocols/entity/po/InsFeeOrderNew.java

@@ -401,6 +401,18 @@ public class InsFeeOrderNew {
     @TableField(value = "no_export_other_costs_premiums")
     private BigDecimal noExportOtherCostsPremiums;
 
+    @ApiModelProperty(value = "交强利润差值")
+    @TableField(value = "jq_profit_margin_premiums")
+    private BigDecimal jqProfitMarginPremiums;
+
+    @ApiModelProperty(value = "商业利润差值")
+    @TableField(value = "sy_profit_margin_premiums")
+    private BigDecimal syProfitMarginPremiums;
+
+    @ApiModelProperty(value = "非车利润差值")
+    @TableField(value = "no_profit_margin_premiums")
+    private BigDecimal noProfitMarginPremiums;
+
 
     @ApiModelProperty(value = "签单日期")
     @TableField(exist = false)

+ 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;
+    }
+}
+
+
+
+

+ 9 - 2
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java

@@ -108,8 +108,13 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
         //是否有效  1失效  2 有效
         if (agreementProductQueryVo.getIsEffective() != null) {
             if (agreementProductQueryVo.getIsEffective().equals("1")) {
-                ptlAgreementProductCostsNewLambdaQueryWrapper.gt(PtlAgreementProductCostsNew::getCostsStartDate, LocalDateTime.now())
-                        .lt(PtlAgreementProductCostsNew::getCostsEndDate, LocalDateTime.now());
+                ptlAgreementProductCostsNewLambdaQueryWrapper.and(
+                        query -> query.gt(PtlAgreementProductCostsNew::getCostsStartDate, LocalDateTime.now())
+                                .or()
+                                .lt(PtlAgreementProductCostsNew::getCostsEndDate, LocalDateTime.now())
+                );
+//                ptlAgreementProductCostsNewLambdaQueryWrapper.gt(PtlAgreementProductCostsNew::getCostsStartDate, LocalDateTime.now())
+//                        .lt(PtlAgreementProductCostsNew::getCostsEndDate, LocalDateTime.now());
             } else if (agreementProductQueryVo.getIsEffective().equals("2")) {
                 ptlAgreementProductCostsNewLambdaQueryWrapper.lt(PtlAgreementProductCostsNew::getCostsStartDate, LocalDateTime.now())
                         .gt(PtlAgreementProductCostsNew::getCostsEndDate, LocalDateTime.now());
@@ -125,6 +130,8 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
         if (agreementProductQueryVo.getCostsDescription() != null) {
             ptlAgreementProductCostsNewLambdaQueryWrapper.like(PtlAgreementProductCostsNew::getCostsDescription, agreementProductQueryVo.getCostsDescription());
         }
+        //降序排列
+        ptlAgreementProductCostsNewLambdaQueryWrapper.orderByDesc(PtlAgreementProductCostsNew::getId);
 
         Page<PtlAgreementProductCostsNew> pages = baseMapper.selectPage(page, ptlAgreementProductCostsNewLambdaQueryWrapper);
 

+ 17 - 0
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -239,6 +239,8 @@
                   AND  a.insured_name =#{insuredName}
                 </if>
             </where>
+            ORDER  BY  a.create_time  desc
+
     </select>
     <select id="getEntityById"  resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
             select
@@ -1060,4 +1062,19 @@
         group  by  a.invoic_id
     </select>
 
+    <update id="updateByIds"  parameterType="com.ydtech.modules.fnc.entity.InsPlyIncome">
+        update ins_ply_income
+            set  handling_fees_status ='1',
+                 settlement_time =NOW()
+        <where>
+                 1=1
+            <if test="split != null and split != '' and split.length > 0">
+                and  id in
+                <foreach collection="split" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </update>
+
 </mapper>

+ 24 - 2
src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml

@@ -77,6 +77,7 @@
         a.tax_points AS  "taxPoints",
         a.settlement_amount - COALESCE(b.settlementAmount, 0) AS "invoicCommissionFeevalue",
         a.agreement_type as "agreementType",
+        a.ids  as "ids",
         a.invoicing_method AS  "invoicingMethod"
         FROM
         settlement_documentary_fees a
@@ -88,8 +89,17 @@
         ) b  on a.id=b.parentId
         <where>
             1=1
-            and  a.settlement_status  ='1'
-            and a.settlement_amount - COALESCE(b.settlementAmount, 0) &lt;&gt; 0
+            <choose>
+                <when test="settlementStatus != null  and  settlementStatus!=''">
+                    and  a.settlement_status  =#{settlementStatus}
+                </when>
+                <otherwise>
+                    and  a.settlement_status  ='1'
+                </otherwise>
+            </choose>
+            <if test="isSettlement !=null and  isSettlement  !=''">
+                and a.settlement_amount - COALESCE(b.settlementAmount, 0) &lt;&gt; 0
+            </if>
             <if test="partnerCompaniesId !=null  and  partnerCompaniesId  !=''">
                 and a.partner_companies_id =#{partnerCompaniesId}
             </if>
@@ -146,6 +156,18 @@
     </select>
 
 
+    <select id="getByParentSettlementAmount" resultType="com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity">
+        SELECT
+             sum(a.settlement_amount) as "totalAmount"
+        FROM settlement_documentary_fees a
+        <where>
+                <if test="id !=null and  id  !=''">
+                    a.parent_id =#{id}
+                </if>
+        </where>
+    </select>
+
+
 
 
 

+ 4 - 4
src/main/resources/mapper/modules/ins/InsFeeOrderNewMapper.xml

@@ -207,7 +207,7 @@
 
     <select id="getSumWillAmount"  resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
         select
-        a.id as "id",
+        a.ins_order_no as "id",
         a.user_id as "userId",
         ins.signing_time as "signingTime",
         o.licenseno as "licenseno",
@@ -252,7 +252,7 @@
         FROM
         (
         SELECT
-        a.id as "id",
+        a.ins_order_no as "id",
         a.user_id as "userId",
         iac.signing_time as "signingTime",
         o.licenseno as "licenseno",
@@ -276,7 +276,7 @@
         </where>
         UNION
         SELECT
-        a.id as "id",
+        a.ins_order_no as "id",
         a.user_id as "userId",
         iac.signing_time as "signingTime",
         o.licenseno as "licenseno",
@@ -300,7 +300,7 @@
         </where>
         UNION
         SELECT
-        a.id as "id",
+        a.ins_order_no as "id",
         a.user_id as "userId",
         iac.signing_time as "signingTime",
         o.licenseno as "licenseno",

+ 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>