Explorar o código

Merge remote-tracking branch 'origin/test' into test

Qchen %!s(int64=2) %!d(string=hai) anos
pai
achega
a30bc389dc
Modificáronse 40 ficheiros con 1286 adicións e 354 borrados
  1. 0 159
      sql/Online.sql
  2. 45 0
      src/main/java/com/ydtech/constants/enums/dict/InsInsuranceKind.java
  3. 14 1
      src/main/java/com/ydtech/modules/admin/controller/SysDeptController.java
  4. 16 0
      src/main/java/com/ydtech/modules/admin/controller/SysUserAccountController.java
  5. 17 0
      src/main/java/com/ydtech/modules/admin/controller/SysUserLinkPtlAgreementController.java
  6. 3 0
      src/main/java/com/ydtech/modules/admin/dao/SysAmountAuditingMapper.java
  7. 5 0
      src/main/java/com/ydtech/modules/admin/dao/SysUserAccountMapper.java
  8. 14 0
      src/main/java/com/ydtech/modules/admin/dao/SysUserMapper.java
  9. 3 0
      src/main/java/com/ydtech/modules/admin/model/dto/SysUserDto.java
  10. 8 1
      src/main/java/com/ydtech/modules/admin/model/vo/SysAmountAuditingVo.java
  11. 32 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysUserAccountVo.java
  12. 5 0
      src/main/java/com/ydtech/modules/admin/service/SysAmountAuditingService.java
  13. 6 0
      src/main/java/com/ydtech/modules/admin/service/SysUserAccountService.java
  14. 8 0
      src/main/java/com/ydtech/modules/admin/service/SysUserLinkPtlAgreementService.java
  15. 7 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysAmountAuditingServiceImpl.java
  16. 311 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java
  17. 15 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserLinkPtlAgreementServiceImpl.java
  18. 0 1
      src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java
  19. 23 20
      src/main/java/com/ydtech/modules/order/components/pingan/PinganRequestApiComponents.java
  20. 7 1
      src/main/java/com/ydtech/modules/order/components/zijin/ZijinDuplicateInsuranceComponents.java
  21. 10 0
      src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java
  22. 2 2
      src/main/java/com/ydtech/modules/order/dao/InsOrdersMapper.java
  23. 7 0
      src/main/java/com/ydtech/modules/order/entity/InsOrders.java
  24. 8 0
      src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java
  25. 72 0
      src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java
  26. 7 2
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  27. 8 1
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementHistoryServiceImpl.java
  28. 96 129
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java
  29. 1 0
      src/main/java/com/ydtech/modules/protocols/dao/InsFeeOrderNewMapper.java
  30. 20 0
      src/main/java/com/ydtech/modules/protocols/entity/po/InsFeeOrderNew.java
  31. 1 0
      src/main/java/com/ydtech/modules/protocols/service/InsFeeOrderNewService.java
  32. 5 0
      src/main/java/com/ydtech/modules/protocols/service/impl/InsFeeOrderNewServiceImpl.java
  33. 14 6
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java
  34. 37 0
      src/main/resources/mapper/modules/admin/SysAmountAuditingMapper.xml
  35. 5 0
      src/main/resources/mapper/modules/admin/SysUserAccountMapper.xml
  36. 2 0
      src/main/resources/mapper/modules/admin/SysUserLinkPtlAgreementMapper.xml
  37. 71 5
      src/main/resources/mapper/modules/admin/SysUserMapper.xml
  38. 191 0
      src/main/resources/mapper/modules/ins/InsFeeOrderNewMapper.xml
  39. 129 0
      src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml
  40. 61 26
      src/main/resources/mapper/modules/order/InsOrdersMapper.xml

+ 0 - 159
sql/Online.sql

@@ -1,159 +0,0 @@
---  2024-04-15    武鸿鹏  结算需求
-ALTER TABLE `ins_ply_income`  ADD COLUMN `voucher_number` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '凭证号' AFTER `create_time`;
-ALTER TABLE `ins_ply_income`  ADD COLUMN `contract_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '合同号' AFTER `voucher_number`;
-ALTER TABLE `ins_ply_income`  ADD COLUMN `contract_file_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '合同附件id' AFTER `contract_id`;
-ALTER TABLE `ins_ply_income`  ADD COLUMN `handling_fees_status` varchar(5) NULL COMMENT '手续费结算状态  1 为已结算' AFTER `contract_file_id`;
-ALTER TABLE `ins_ply_income` ADD COLUMN `documentary_fees_status` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '跟单费结算状态  1 为已结算' AFTER `handling_fees_status`;
-ALTER TABLE `ins_ply_income` ADD COLUMN `is_not_car` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '跟单费结算状态  1 为已结算' AFTER `documentary_fees_status`;
-ALTER TABLE `ins_ply_income` ADD COLUMN `no_policyno` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '非车保单号' AFTER `is_not_car`;
-ALTER TABLE `ins_ply_income` ADD COLUMN `sy_policyno` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '商业保单号' AFTER `no_policyno`;
-
-
-DROP TABLE IF EXISTS `settlement_documentary_fees`;
-CREATE TABLE `settlement_documentary_fees`  (
-                                                `id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'id',
-                                                `total_orders` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '结算单数',
-                                                `time_frame` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '时间范围',
-                                                `total_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '结算总金额',
-                                                `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
-                                                `start_time` datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
-                                                `end_time` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
-                                                `settlement_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '结算金额',
-                                                `unsettled_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '未结算金额',
-                                                `company_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '保险公司id',
-                                                `signing_time` datetime(0) NULL DEFAULT NULL COMMENT '签单日期',
-                                                PRIMARY KEY (`id`) USING BTREE,
-                                                UNIQUE INDEX `id`(`id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '跟单费结算' ROW_FORMAT = Dynamic;
-
-SET FOREIGN_KEY_CHECKS = 1;
-
-
-DROP TABLE IF EXISTS `settlement_documentary_log`;
-CREATE TABLE `settlement_documentary_log`  (
-                                               `id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'id',
-                                               `amount_type` varchar(5) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '金额类型 1 手续费结算 2 跟单费结算',
-                                               `amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '金额',
-                                               `settlement_documentary_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联跟单费id',
-                                               `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
-                                               `handing_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '手续费结算金额',
-                                               PRIMARY KEY (`id`) USING BTREE,
-                                               UNIQUE INDEX `id`(`id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '跟单费结算' ROW_FORMAT = Dynamic;
-
-SET FOREIGN_KEY_CHECKS = 1;
-
---     菜单sql   结算菜单   提现菜单
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (643, '手续费待提现', '663', '/financialManagement/withdrawalManagement/withdrawalProceduresPending', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (645, '非跟单待提现', '665', '/financialManagement/withdrawalManagement/nonDocumentaryPending', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (646, '推广待提现', '664', '/financialManagement/withdrawalManagement/generalizationPending', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (647, '手续费已提现', '663', '/financialManagement/withdrawalManagement/withdrawalProceduresEnd', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (648, '非跟单已提现', '665', '/financialManagement/withdrawalManagement/nonDocumentaryEnd', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (649, '推广已提现', '664', '/financialManagement/withdrawalManagement/generalizationEnd', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (650, '审核并支付', '643', NULL, 'sys:withdrawalProceduresPending:examine', 2, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (651, '审核提现', '643', NULL, 'sys:withdrawalProceduresPending:examinepay', 2, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (652, '审核并支付', '645', NULL, 'sys:nonDocumentaryPending:examine', 2, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (653, '审核提现', '645', NULL, 'sys:nonDocumentaryPending:examinepay', 2, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (654, '审核提现', '646', NULL, 'sys:generalizationPending:examinepay', 2, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (663, '手续费提现', '201', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (664, '推广费提现', '201', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (665, '非跟单费提现', '201', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0);
-
-
-
---  inv_source表 新增修改人名字 修改人id  前端还没联调  正式库先不加字段
-ALTER TABLE `inv_source` ADD COLUMN `update_name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '修改人名字' AFTER `revenue_userid`;
-ALTER TABLE `inv_source` ADD COLUMN `update_userid` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '修改人id' AFTER `update_name`;
-
-
-
---  add by hxl   2024-04-18 添加后线人员关联协议表
-DROP TABLE IF EXISTS `sys_user_link_pl_agreement`;
-CREATE TABLE `sys_user_link_pl_agreement`  (
-                                               `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键/自增',
-                                               `user_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '前线用户ID',
-                                               `ptl_agreement_id` bigint(20) NULL DEFAULT NULL COMMENT '协议ID',
-                                               `create_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人ID',
-                                               `create_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人名称',
-                                               `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
-                                               `update_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '修改人ID',
-                                               `update_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '修改人名称',
-                                               `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
-                                               `type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '协议类型  0 车险 1 非车',
-                                               PRIMARY KEY (`id`) USING BTREE,
-                                               INDEX `user_id_index`(`user_id`) USING BTREE,
-                                               INDEX `ptl_agreement_id_index`(`ptl_agreement_id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '后线人员关联协议表' ROW_FORMAT = DYNAMIC;
-
---  add by hxl   2024-04-18 添加子订单表操作人和操作时间和操作人名称
-ALTER TABLE ins_area_company ADD COLUMN operator_id VARCHAR(30) COMMENT '操作人';
-ALTER TABLE ins_area_company ADD COLUMN operator_name VARCHAR(100) COMMENT '操作人名称';
-ALTER TABLE ins_area_company ADD COLUMN operator_time datetime COMMENT '操作时间';
-
---  add  by  hxl  2024-04-18 添加子订单转发收回记录表
-DROP TABLE IF EXISTS `ins_order_set_user_his`;
-CREATE TABLE `ins_order_set_user_his`  (
-                                           `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键/自增',
-                                           `orderno` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '订单号',
-                                           `quoteno` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '报价单号',
-                                           `old_operator_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '原操作人',
-                                           `new_operator_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '现操作人',
-                                           `create_time` datetime NULL DEFAULT NULL COMMENT '操作时间',
-                                           `create_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
-                                           `suborder_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '子订单id',
-                                           `old_operator_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '原操作人名称',
-                                           `new_operator_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '现操作人名称',
-                                           `remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
-                                           PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '子订单转发收回记录表' ROW_FORMAT = DYNAMIC;
-
-
---  add  by  hy  2024-04-19 添加协议授权表
-DROP TABLE IF EXISTS `ptl_agreement_dept_history`;
-CREATE TABLE `ptl_agreement_dept_history`  (
-                                               `agreement_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '协议ID',
-                                               `dept_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '部门ID',
-                                               `batch` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '批次'
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-
---  add by hy   2024-04-19 添加协议表产品类型字段
-ALTER TABLE ptl_agreement ADD COLUMN products_code VARCHAR(30) COMMENT '产品类型';
-
--- add by hxl  2024-04-19  添加后线人员协议配置菜单
-INSERT INTO `sys_menu` (`name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES ('后线人员协议配置', '232', '/agreementManage/carInsurance/backlineAllocation', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-
---  add by hxl   2024-04-18 添加子订单表新操作人和新操作人名称
-ALTER TABLE ins_area_company ADD COLUMN new_operator_id VARCHAR(30) COMMENT '新操作人';
-ALTER TABLE ins_area_company ADD COLUMN new_operator_name VARCHAR(100) COMMENT '新操作人名称';
-
-
--- 2024-0419  武鸿鹏
-ALTER TABLE `settlement_documentary_log` ADD COLUMN `company_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '保险公司id' AFTER `handing_amount`;
-ALTER TABLE `settlement_documentary_log` ADD COLUMN `year` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '年度' AFTER `company_id`;
-ALTER TABLE `ins_ply_income` ADD COLUMN `is_not_documentary` varchar(5) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '是否是跟单' AFTER `is_not_car`;
-
-
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (663, '手续费提现', '201', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (664, '推广费提现', '201', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (665, '非跟单费提现', '201', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (667, '车险结算', '200', '/financialManagement/carInsurance/platformSettlement/carInsuranceBalance', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (668, '非车结算', '200', '/financialManagement/carInsurance/platformSettlement/nonVehicleBalance', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (669, '车险', '199', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (670, '非车', '199', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (671, '手续费结算', '669', '/financialManagement/carInsurance/companySettlement/carInsurance/handlingFees', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (672, '手续费结算', '670', '/financialManagement/carInsurance/companySettlement/noCarInsurance/handlingFees', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (673, '跟单费结算', '669', '/financialManagement/carInsurance/companySettlement/carInsurance/documentaryFees', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (674, '跟单费结算', '670', '/financialManagement/carInsurance/companySettlement/noCarInsurance/documentaryFees', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (675, '结算', '673', NULL, 'sys:', 2, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (676, '结算', '674', NULL, NULL, 2, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (677, '结算', '673', NULL, 'sys:documentaryFees1:balance', 2, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu`(`id`, `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES (678, '结算', '674', NULL, 'sys:documentaryFees2:balance', 2, NULL, 0, NULL, NULL, NULL, NULL, 0);
-
-
---  2024-0422   武鸿鹏
-ALTER TABLE `settlement_documentary_log` ADD COLUMN `crud_status` varchar(5) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '操作表示 1.新增 2 修改  3 删除' AFTER `handing_amount`;
-
--- add by hxl  2024-04-22 添加渠道、保险公司、代理人任务池菜单
-INSERT INTO `sys_menu` ( `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES ('任务池(渠道)', '64', '/task/taskPoolChannel', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu` (`name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES ('任务池(保险公司)', '64', '/task/companyPoolChannel', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);
-INSERT INTO `sys_menu` ( `name`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `create_by`, `create_time`, `last_update_by`, `last_update_time`, `del_flag`) VALUES ( '任务池(代理人)', '64', '/task/agentPoolChannel', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, 0);

+ 45 - 0
src/main/java/com/ydtech/constants/enums/dict/InsInsuranceKind.java

@@ -0,0 +1,45 @@
+package com.ydtech.constants.enums.dict;
+
+
+import com.ydtech.aop.request.DictEnum;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
+@DictEnum(key = "InsInsuranceKind", desc = "险种类型")
+public enum InsInsuranceKind implements IBaseEnum{
+
+
+    A("A", "车损","机动车损失险"),
+
+    TRAFFIC("0507", "交强", "机动车交通事故责任强制保险"),
+
+    BUSINESS("0510", "商业", "机动车商业保险");
+
+
+    private final String code;
+
+    private final String desc;
+
+    private final String shortName;
+
+    public static InsInsuranceKind getInsInsuranceKind(String code) {
+        for (InsInsuranceKind insInsuranceKind : InsInsuranceKind.values()) {
+            if (insInsuranceKind.getCode().equals(code)) {
+                return insInsuranceKind;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public Integer getSort() {
+        return null;
+    }
+
+    @Override
+    public Integer getStatus() {
+        return null;
+    }
+}

+ 14 - 1
src/main/java/com/ydtech/modules/admin/controller/SysDeptController.java

@@ -8,7 +8,6 @@ import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.vo.SysDeptVo;
 import com.ydtech.modules.admin.service.SysDeptService;
 import com.ydtech.modules.base.controller.BaseController;
-import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
@@ -125,4 +124,18 @@ public class SysDeptController extends BaseController {
     public HttpResult findTeamList(String deptId) {
         return HttpResult.ok(sysDeptService.findTeamList(deptId));
     }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/4/23 14:59
+     *  @Description: 获取所有的树结构
+     */
+    @ApiOperation(value = "获取所有的树结构")
+    @GetMapping(value = "/findAllTree")
+    public HttpResult<List<SysDept>> findAllTree() {
+        LambdaQueryWrapper<SysDept> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(SysDept::getDelFlag, 0);
+        return HttpResult.ok(sysDeptService.findTree("9",null));
+    }
 }

+ 16 - 0
src/main/java/com/ydtech/modules/admin/controller/SysUserAccountController.java

@@ -12,12 +12,14 @@ import com.ydtech.modules.esm.model.vo.EsmInsAttributionTemplateSaveVo;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
 import java.math.BigDecimal;
+import java.util.List;
 
 @Api(tags = "账户余额")
 @RequestMapping("/sysUserAccount")
@@ -47,6 +49,20 @@ public class SysUserAccountController extends BaseController {
         return HttpResult.ok(sysUserAccountService.getSysUserAmount(userid));
     }
 
+    @GetMapping(value = "/getSysAllAmount")
+    @ApiModelProperty("用户余额new")
+    public HttpResult<SysUserAccountVo>  getSysAllAmount (){
+        String userId = BaseController.getUser().getId();
+        SysUserAccountVo result = sysUserAccountService.getSysAllAmount(userId);
+        return  HttpResult.ok("success", result);
+    }
+    @PostMapping("getInsOrders")
+    @ApiOperation("获取子订单号")
+    public HttpResult<SysUserAccountVo>  getInsOrders(@RequestBody SysUserAccountVo sysUserAccountVo){
+        SysUserAccountVo result =sysUserAccountService.getInsOrders(sysUserAccountVo);
+        return  HttpResult.ok("success", result);
+    }
+
 
 
 

+ 17 - 0
src/main/java/com/ydtech/modules/admin/controller/SysUserLinkPtlAgreementController.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.admin.controller;
 
 
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.dto.SysUserDto;
 import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
 import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.model.vo.SysUserLinkPtlAgreementAddVo;
@@ -116,4 +117,20 @@ public class SysUserLinkPtlAgreementController extends BaseController {
         }
 
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/4/23 11:44
+     *  @Description: 查询所有的后线人员列表+分页
+     */
+    @PostMapping("findAllUserList")
+    @ApiOperation("查询所有的后线人员列表+分页")
+    public HttpResult<BasePageResult<SysUserBaseVO>> findUserList(@RequestBody SysUserDto sysUserDto) {
+        try{
+            BasePageResult<SysUserBaseVO> result = sysUserLinkPtlAgreementService.findUserListByPage(sysUserDto);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
 }

+ 3 - 0
src/main/java/com/ydtech/modules/admin/dao/SysAmountAuditingMapper.java

@@ -17,4 +17,7 @@ public interface SysAmountAuditingMapper extends BaseMapper<SysAmountAuditingEnt
     Page<SysAmountAuditingEntity> queryPageOrder(@Param("sysAmountAuditingVo") SysAmountAuditingVo sysAmountAuditingVo, Page<SysAmountAuditingEntity> page);
 
     List<SysAmountAuditingEntity> queryPageOrderNew(HashMap<String, Object> params);
+
+    List<SysAmountAuditingEntity> getProgressIng(HashMap<String, Object> params);
+
 }

+ 5 - 0
src/main/java/com/ydtech/modules/admin/dao/SysUserAccountMapper.java

@@ -4,8 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.admin.model.po.SysUserAccount;
 import com.ydtech.modules.admin.model.vo.SysUserAccountVo;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
 * @author Administrator
 * @description 针对表【sys_user_account(用户账户表)】的数据库操作Mapper
@@ -17,6 +21,7 @@ public interface SysUserAccountMapper extends BaseMapper<SysUserAccount> {
     Page<SysUserAccount> queryPageOrder(SysUserAccountVo sysUserAccountVo,@Param("page") Page page);
 
     SysUserAccount getById(String userId);
+
 }
 
 

+ 14 - 0
src/main/java/com/ydtech/modules/admin/dao/SysUserMapper.java

@@ -220,6 +220,20 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
      *  @Description: 获取客服人员数据
      */
     List<SysUserBaseVO> getCustomerUsers(@Param("user") SysUserVOExt sysUserVOExt);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/4/23 10:49
+     *  @Description: 通过用户id和角色ids查询机构ids
+     */
+    List<String> getDeptIdsByRoleIdsAndUserIds(@Param("userIds") List<String> agentUserIds, @Param("roleIds") List<String> roleIds);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/4/23 11:39
+     *  @Description: 查询后线人员+分页
+     */
+    Page<SysUserBaseVO> findUserListByPage(@Param("page") Page<SysUserBaseVO> page, @Param("user") SysUserDto sysUserDto);
 }
 
 

+ 3 - 0
src/main/java/com/ydtech/modules/admin/model/dto/SysUserDto.java

@@ -34,6 +34,9 @@ public class SysUserDto extends PageRequest {
     @ApiModelProperty("状态")
     private String status;
 
+    @ApiModelProperty("领导人")
+    private String leaderName;
+
     @ApiModelProperty("代理个代标识")
     private Integer agentFlag;
 }

+ 8 - 1
src/main/java/com/ydtech/modules/admin/model/vo/SysAmountAuditingVo.java

@@ -86,7 +86,7 @@ public class SysAmountAuditingVo {
     private LocalDate endTime;
 
     @ApiModelProperty("审批时间")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM")
     private Date auditingTime;
 
     @ApiModelProperty("审核人")
@@ -96,4 +96,11 @@ public class SysAmountAuditingVo {
     private String auditingUserName;
 
 
+    @ApiModelProperty("时间条件")
+    private String  timeFiltering;
+
+
+
+
+
 }

+ 32 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysUserAccountVo.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -13,6 +14,7 @@ import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 @Data
 @ApiModel("查询Vo")
@@ -100,4 +102,34 @@ public class SysUserAccountVo {
 
     @ApiModelProperty(value = "银行卡Id")
     private Long fromBankCardId;
+
+
+    @ApiModelProperty(value = "预收手续费佣金")
+    private BigDecimal willHalding;
+    @ApiModelProperty(value = "预收非跟单佣金")
+    private BigDecimal willDocumentary;
+    @ApiModelProperty(value = "预收推广费")
+    private BigDecimal willPromotion;
+
+
+    @ApiModelProperty(value = "提现中手续费佣金")
+    private BigDecimal withdrawalHalding;
+    @ApiModelProperty(value = "提现中非跟单佣金")
+    private BigDecimal withdrawalDocumentary;
+    @ApiModelProperty(value = "提现中推广费")
+    private BigDecimal withdrawalPromotion;
+
+    @ApiModelProperty(value = "已提现手续费佣金")
+    private BigDecimal approvedHalding;
+    @ApiModelProperty(value = "已提现中非跟单佣金")
+    private BigDecimal approvedDocumentary;
+    @ApiModelProperty(value = "已提现中推广费")
+    private BigDecimal approvedPromotion;
+    @ApiModelProperty(value = "报价id")
+    private String ids;
+    @ApiModelProperty("时间条件")
+    private String  timeFiltering;
+    @ApiModelProperty("子订单数组")
+    private List<InsFeeOrderNew> insFeeOrderNewList;
+
 }

+ 5 - 0
src/main/java/com/ydtech/modules/admin/service/SysAmountAuditingService.java

@@ -6,6 +6,9 @@ import com.ydtech.modules.admin.model.po.SysAmountAuditingEntity;
 import com.ydtech.modules.admin.model.vo.SysAmountAuditingVo;
 import com.ydtech.modules.order.entity.BasePageResult;
 
+import java.util.HashMap;
+import java.util.List;
+
 public interface SysAmountAuditingService extends IService<SysAmountAuditingEntity> {
     void AmountReview(SysAmountAuditingVo sysUserAccountVo);
 
@@ -15,4 +18,6 @@ public interface SysAmountAuditingService extends IService<SysAmountAuditingEnti
 
     BasePageResult<SysAmountAuditingEntity> queryAppPage(SysAmountAuditingVo sysAmountAuditingVo);
 
+    List<SysAmountAuditingEntity> getProgressIng(HashMap<String, Object> params);
+
 }

+ 6 - 0
src/main/java/com/ydtech/modules/admin/service/SysUserAccountService.java

@@ -6,6 +6,8 @@ import com.ydtech.modules.admin.model.po.SysUserAccount;
 import com.ydtech.modules.admin.model.vo.SysUserAccountVo;
 import com.ydtech.modules.order.entity.BasePageResult;
 
+import java.util.List;
+
 /**
 * @author Administrator
 * @description 针对表【sys_user_account(用户账户表)】的数据库操作Service
@@ -22,4 +24,8 @@ public interface SysUserAccountService extends IService<SysUserAccount> {
 
     SysUserAccount getSysUserAmount(String userid);
 
+    SysUserAccountVo getSysAllAmount(String userId);
+
+    SysUserAccountVo getInsOrders(SysUserAccountVo sysUserAccountVo);
+
 }

+ 8 - 0
src/main/java/com/ydtech/modules/admin/service/SysUserLinkPtlAgreementService.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.admin.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.admin.model.dto.SysUserDto;
 import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
 import com.ydtech.modules.admin.model.po.SysUserLinkPtlAgreement;
 import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
@@ -63,4 +64,11 @@ public interface SysUserLinkPtlAgreementService extends IService<SysUserLinkPtlA
      *  @Description: 创建后线人员绑定的协议数据
      */
     List<PtlAgreement> findAllPtlAgreementListByUserId(String userId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/4/23 11:36
+     *  @Description: 查询后线人员+分页
+     */
+    BasePageResult<SysUserBaseVO> findUserListByPage(SysUserDto sysUserDto);
 }

+ 7 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysAmountAuditingServiceImpl.java

@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -126,4 +127,10 @@ public class SysAmountAuditingServiceImpl extends ServiceImpl<SysAmountAuditingM
         return new BasePageResult<>(sysAmountAuditingVo.getPageNum(), page.getSize(), sysUserAccountHistoryPage.getTotal(), page.getPages(),
                 sysUserAccountHistoryPage.getRecords());
     }
+
+    @Override
+    public  List<SysAmountAuditingEntity> getProgressIng(HashMap<String, Object> params) {
+        return  baseMapper.getProgressIng(params);
+
+    }
 }

+ 311 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java

@@ -18,15 +18,26 @@ import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.esm.model.EsmUserReferrer;
 import com.ydtech.modules.esm.service.EsmUserReferrerService;
 import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.service.InsAreaCompanyService;
+import com.ydtech.modules.order.service.InsOrdersService;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import org.apache.commons.lang3.ObjectUtils;
 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 org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
 
 /**
  * @author Administrator
@@ -45,6 +56,10 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
 
     @Autowired
     private SysUserBankCardService sysUserBankCardService;
+    @Autowired
+    private InsAreaCompanyService insAreaCompanyService;
+    @Autowired
+    private InsFeeOrderNewService  insFeeOrderNewService;
 
     @Override
     @Transactional
@@ -228,6 +243,302 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
         return sysUserAccount;
     }
 
+    @Override
+    public SysUserAccountVo getSysAllAmount(String userId) {
+        SysUserAccountVo sysUserAccountVo = new SysUserAccountVo();
+        SysUserAccount sysUserAccount = baseMapper.getById(userId);
+        BeanUtils.copyProperties(sysUserAccount, sysUserAccountVo);
+
+        BigDecimal  willHalding=BigDecimal.ZERO;        //预收手续费佣金
+        BigDecimal  willDocumentary =BigDecimal.ZERO;   //预收 非跟单佣金
+        BigDecimal  willPromotion =BigDecimal.ZERO;   //预收 推广
+        StringBuffer stringBuffer = new StringBuffer();
+
+        willPromotion =   this.willPromotion(willPromotion,userId);  // 佣金
+        List<InsOrders> willList = insAreaCompanyService.getByUserId(userId);
+        if(!CollectionUtils.isEmpty(willList)){
+           for (InsOrders item : willList){
+               String quoteno = item.getQuoteno();
+               stringBuffer.append(quoteno).append(",");
+               if(StringUtils.isNotEmpty(quoteno)){
+                  this.willAmount(quoteno,willHalding,willDocumentary,sysUserAccountVo);  // 推广 非跟单
+               }
+           }
+
+        }
+//        体现中
+        HashMap<String, Object> params = new HashMap<>();
+        params.put("auditingStatus","2");  // 待审核
+        params.put("userId",userId);
+        List<SysAmountAuditingEntity>  sysAmountAuditingProgressIng=  sysAmountAuditingService.getProgressIng(params);
+        this.judge(sysAmountAuditingProgressIng,sysUserAccountVo);
+        params.clear();
+        params.put("auditingStatus","3");  // 已审核审核
+        params.put("userId",userId);
+        List<SysAmountAuditingEntity>  sysAmountAuditingApproved=  sysAmountAuditingService.getProgressIng(params);
+        this.judgeSysAmountAuditing(sysAmountAuditingApproved,sysUserAccountVo);
+        sysUserAccountVo.setWillPromotion(willPromotion);
+        String ids = stringBuffer.toString();
+        if (ids.endsWith(",")) {
+            ids = ids.substring(0, ids.length() - 1);  // 去掉末尾的逗号
+        }
+        sysUserAccountVo.setIds(ids);
+        return sysUserAccountVo;
+    }
+
+    @Override
+    public SysUserAccountVo getInsOrders(SysUserAccountVo sysUserAccountVo) {
+        ArrayList<InsFeeOrderNew> resultList = new ArrayList<>();
+        BigDecimal willPromotion = BigDecimal.ZERO;
+        if(StringUtils.isNotEmpty(sysUserAccountVo.getIds())){
+            for (String insOrderNo : sysUserAccountVo.getIds().split(",")) {
+                InsAreaCompany byInsOrderNo = insAreaCompanyService.getByInsOrderNoNew(insOrderNo,sysUserAccountVo.getTimeFiltering());
+                if(ObjectUtils.isNotEmpty(byInsOrderNo)){
+                    String id = byInsOrderNo.getId();
+                    InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getInsFeeOrderEntity(id);
+                    //预收推广
+                    willPromotion =this.getWillPromotion(insFeeOrderNew,willPromotion);
+                    this.getWillAmount(insFeeOrderNew);  // 推广 非跟单
+                    insFeeOrderNew.setWillPromotion(willPromotion);
+                    resultList.add(insFeeOrderNew);
+                }
+            }
+        }
+        sysUserAccountVo.setInsFeeOrderNewList(resultList);
+        return sysUserAccountVo;
+    }
+
+    private void getWillAmount(InsFeeOrderNew insFeeOrderNew) {
+        if(ObjectUtils.isNotEmpty(insFeeOrderNew)){
+            //交强手续费出口比例
+            BigDecimal jqExportProceduresFee = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getJqSuperviseCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+            //商业手续费出口比例
+            BigDecimal syExportProceduresFee = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getSySuperviseCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+            //非车手续费出口比例
+            BigDecimal noExportProceduresFee = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getNoSuperviseCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+            //用户出口手续费
+
+            insFeeOrderNew.setWillHalding(jqExportProceduresFee.add(syExportProceduresFee).add(noExportProceduresFee));
+
+            //非车出口比例
+            //总机构 交强管理比例
+            BigDecimal sumJqDeptProportion = insFeeOrderNew.getJqDeptProportionLevel1()
+                    .add(insFeeOrderNew.getJqDeptProportionLevel2())
+                    .add(insFeeOrderNew.getJqDeptProportionLevel3())
+                    .add(insFeeOrderNew.getJqDeptProportionLevel4())
+                    .add(insFeeOrderNew.getJqDeptProportionLevel5());
+
+            //总机构 商业管理比例
+            BigDecimal sumSyDeptProportion = insFeeOrderNew.getSyDeptProportionLevel1()
+                    .add(insFeeOrderNew.getSyDeptProportionLevel2())
+                    .add(insFeeOrderNew.getSyDeptProportionLevel3())
+                    .add(insFeeOrderNew.getSyDeptProportionLevel4())
+                    .add(insFeeOrderNew.getSyDeptProportionLevel5());
+
+            //总机构 非车管理比例
+            BigDecimal sumNoDeptProportion = insFeeOrderNew.getNoDeptProportionLevel1()
+                    .add(insFeeOrderNew.getNoDeptProportionLevel2())
+                    .add(insFeeOrderNew.getNoDeptProportionLevel3())
+                    .add(insFeeOrderNew.getNoDeptProportionLevel4())
+                    .add(insFeeOrderNew.getNoDeptProportionLevel5());
+            BigDecimal noExportProceduresProportion = new BigDecimal(0);
+            //总分销比例
+            BigDecimal sumRetail = insFeeOrderNew.getFirstDetailProportion().add(insFeeOrderNew.getSecondDetailProportion()).add(insFeeOrderNew.getThirdDetailProportion());
+            if(insFeeOrderNew.getNoCostsProportion().compareTo(sumNoDeptProportion.add(sumRetail))>0){
+                noExportProceduresProportion = insFeeOrderNew.getNoCostsProportion().subtract(sumNoDeptProportion).subtract(sumRetail);
+            }
+            //商业出口比例
+            BigDecimal syExportProceduresProportion = new BigDecimal(0);
+            if(insFeeOrderNew.getSyCostsProportion().compareTo(sumSyDeptProportion.add(sumRetail))>0){
+                syExportProceduresProportion = insFeeOrderNew.getSyCostsProportion().subtract(sumSyDeptProportion).subtract(sumRetail);
+            }
+            //交强出口比例
+            BigDecimal jqExportProceduresProportion = new BigDecimal(0);
+            if(insFeeOrderNew.getJqCostsProportion().compareTo(sumJqDeptProportion.add(sumRetail))>0){
+                jqExportProceduresProportion = insFeeOrderNew.getJqCostsProportion().subtract(sumJqDeptProportion).subtract(sumRetail);
+            }
+            //交强跟单出口费用
+            BigDecimal jqExportOtherFee = insFeeOrderNew.getJqPremium()
+                    .multiply(jqExportProceduresProportion
+                            .subtract(insFeeOrderNew.getJqSuperviseCostsProportion()).divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+
+            //商业跟单出口比例
+            BigDecimal syExportOtherFee = insFeeOrderNew.getSyPremium()
+                    .multiply(syExportProceduresProportion
+                            .subtract(insFeeOrderNew.getSySuperviseCostsProportion()).divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+            //非车跟单出口比例
+            BigDecimal noExportOtherFee = insFeeOrderNew.getNoPremium()
+                    .multiply(noExportProceduresProportion
+                            .subtract(insFeeOrderNew.getNoSuperviseCostsProportion()).divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+            //用户出口跟单费
+            insFeeOrderNew.setWillDocumentary(jqExportOtherFee.add(syExportOtherFee).add(noExportOtherFee));
+        }
+    }
+
+    private BigDecimal getWillPromotion(InsFeeOrderNew insFeeOrderNew,BigDecimal  willPromotion) {
+        for (int i = 1; i <4 ; i++) {
+            InsOrders   InsOrders = insAreaCompanyService.selectByInFeeOrderNew(insFeeOrderNew,i);
+            if(ObjectUtils.isNotEmpty(InsOrders)){
+                BigDecimal willFirstPremiums = InsOrders.getWillFirstPremiums();
+                BigDecimal willSecondPremiums = InsOrders.getWillSecondPremiums();
+                BigDecimal willThreePremiums = InsOrders.getWillThreePremiums();
+                if(ObjectUtils.isNotEmpty(InsOrders)){
+                    if(willFirstPremiums==null){
+                        willFirstPremiums=BigDecimal.ZERO;
+                    }
+                    if(willSecondPremiums==null){
+                        willSecondPremiums=BigDecimal.ZERO;
+                    }
+                    if(willThreePremiums==null){
+                        willThreePremiums=BigDecimal.ZERO;
+                    }
+                    return   willPromotion.add(willFirstPremiums).add(willThreePremiums).add(willSecondPremiums);
+                }
+            }
+        }
+        return null;
+    }
+
+
+    private void judgeSysAmountAuditing(List<SysAmountAuditingEntity> sysAmountAuditingApproved, SysUserAccountVo sysUserAccountVo) {
+        if(!CollectionUtils.isEmpty(sysAmountAuditingApproved)){
+            for (SysAmountAuditingEntity  item:   sysAmountAuditingApproved){
+                if("1".equals(item.getAmountStatus())){  //手续费
+                    BigDecimal amount = item.getAmount();
+                    sysUserAccountVo.setApprovedHalding(amount);
+                }
+                if("2".equals(item.getAmountStatus())){  //非跟单
+                    BigDecimal amount = item.getAmount();
+                    sysUserAccountVo.setApprovedDocumentary(amount);
+                }
+                if("3".equals(item.getAmountStatus())){  //推广费
+                    BigDecimal amount = item.getAmount();
+                    sysUserAccountVo.setApprovedPromotion(amount);
+                }
+
+            }
+        }
+    }
+
+    private void judge(List<SysAmountAuditingEntity> sysAmountAuditingProgressIng,SysUserAccountVo sysUserAccountVo) {
+        if(!CollectionUtils.isEmpty(sysAmountAuditingProgressIng)){
+            for (SysAmountAuditingEntity  item:   sysAmountAuditingProgressIng){
+                if("1".equals(item.getAmountStatus())){  //手续费
+                    BigDecimal amount = item.getAmount();
+                    sysUserAccountVo.setWithdrawalHalding(amount);
+                }
+                if("2".equals(item.getAmountStatus())){  //非跟单
+                    BigDecimal amount = item.getAmount();
+                    sysUserAccountVo.setWithdrawalDocumentary(amount);
+                }
+                if("3".equals(item.getAmountStatus())){  //推广费
+                    BigDecimal amount = item.getAmount();
+                    sysUserAccountVo.setWithdrawalPromotion(amount);
+                }
+
+            }
+        }
+
+    }
+
+    private BigDecimal willPromotion(BigDecimal willPromotion, String userId) {
+        for (int i = 1; i <4 ; i++) {
+            InsOrders   InsOrders = insAreaCompanyService.selectPromotionBy(userId,i);
+            if(ObjectUtils.isNotEmpty(InsOrders)){
+                BigDecimal willFirstPremiums = InsOrders.getWillFirstPremiums();
+                BigDecimal willSecondPremiums = InsOrders.getWillSecondPremiums();
+                BigDecimal willThreePremiums = InsOrders.getWillThreePremiums();
+                if(ObjectUtils.isNotEmpty(InsOrders)){
+                    if(willFirstPremiums==null){
+                        willFirstPremiums=BigDecimal.ZERO;
+                    }
+                    if(willSecondPremiums==null){
+                        willSecondPremiums=BigDecimal.ZERO;
+                    }
+                    if(willThreePremiums==null){
+                        willThreePremiums=BigDecimal.ZERO;
+                    }
+                 return   willPromotion.add(willFirstPremiums).add(willThreePremiums).add(willSecondPremiums);
+                }
+            }
+        }
+        return null;
+    }
+
+    private void willAmount(String quoteno, BigDecimal willHalding, BigDecimal willDocumentary,SysUserAccountVo sysUserAccountVo) {
+        InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getInsFeeOrderNewByCompanyId(quoteno);
+        //交强手续费出口比例
+        BigDecimal jqExportProceduresFee = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getJqSuperviseCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+        //商业手续费出口比例
+        BigDecimal syExportProceduresFee = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getSySuperviseCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+        //非车手续费出口比例
+        BigDecimal noExportProceduresFee = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getNoSuperviseCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+        //用户出口手续费
+        willHalding = willHalding.add(jqExportProceduresFee).add(syExportProceduresFee).add(noExportProceduresFee);
+        if(sysUserAccountVo.getWillHalding()==null){
+            sysUserAccountVo.setWillHalding(willHalding);
+        }
+        sysUserAccountVo.setWillHalding(sysUserAccountVo.getWillHalding().add(willHalding));
+
+        //非车出口比例
+        //总机构 交强管理比例
+        BigDecimal sumJqDeptProportion = insFeeOrderNew.getJqDeptProportionLevel1()
+                .add(insFeeOrderNew.getJqDeptProportionLevel2())
+                .add(insFeeOrderNew.getJqDeptProportionLevel3())
+                .add(insFeeOrderNew.getJqDeptProportionLevel4())
+                .add(insFeeOrderNew.getJqDeptProportionLevel5());
+
+        //总机构 商业管理比例
+        BigDecimal sumSyDeptProportion = insFeeOrderNew.getSyDeptProportionLevel1()
+                .add(insFeeOrderNew.getSyDeptProportionLevel2())
+                .add(insFeeOrderNew.getSyDeptProportionLevel3())
+                .add(insFeeOrderNew.getSyDeptProportionLevel4())
+                .add(insFeeOrderNew.getSyDeptProportionLevel5());
+
+        //总机构 非车管理比例
+        BigDecimal sumNoDeptProportion = insFeeOrderNew.getNoDeptProportionLevel1()
+                .add(insFeeOrderNew.getNoDeptProportionLevel2())
+                .add(insFeeOrderNew.getNoDeptProportionLevel3())
+                .add(insFeeOrderNew.getNoDeptProportionLevel4())
+                .add(insFeeOrderNew.getNoDeptProportionLevel5());
+        BigDecimal noExportProceduresProportion = new BigDecimal(0);
+        //总分销比例
+        BigDecimal sumRetail = insFeeOrderNew.getFirstDetailProportion().add(insFeeOrderNew.getSecondDetailProportion()).add(insFeeOrderNew.getThirdDetailProportion());
+        if(insFeeOrderNew.getNoCostsProportion().compareTo(sumNoDeptProportion.add(sumRetail))>0){
+            noExportProceduresProportion = insFeeOrderNew.getNoCostsProportion().subtract(sumNoDeptProportion).subtract(sumRetail);
+        }
+        //商业出口比例
+        BigDecimal syExportProceduresProportion = new BigDecimal(0);
+        if(insFeeOrderNew.getSyCostsProportion().compareTo(sumSyDeptProportion.add(sumRetail))>0){
+            syExportProceduresProportion = insFeeOrderNew.getSyCostsProportion().subtract(sumSyDeptProportion).subtract(sumRetail);
+        }
+        //交强出口比例
+        BigDecimal jqExportProceduresProportion = new BigDecimal(0);
+        if(insFeeOrderNew.getJqCostsProportion().compareTo(sumJqDeptProportion.add(sumRetail))>0){
+            jqExportProceduresProportion = insFeeOrderNew.getJqCostsProportion().subtract(sumJqDeptProportion).subtract(sumRetail);
+        }
+        //交强跟单出口费用
+        BigDecimal jqExportOtherFee = insFeeOrderNew.getJqPremium()
+                .multiply(jqExportProceduresProportion
+                        .subtract(insFeeOrderNew.getJqSuperviseCostsProportion()).divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+
+        //商业跟单出口比例
+        BigDecimal syExportOtherFee = insFeeOrderNew.getSyPremium()
+                .multiply(syExportProceduresProportion
+                        .subtract(insFeeOrderNew.getSySuperviseCostsProportion()).divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+        //非车跟单出口比例
+        BigDecimal noExportOtherFee = insFeeOrderNew.getNoPremium()
+                .multiply(noExportProceduresProportion
+                        .subtract(insFeeOrderNew.getNoSuperviseCostsProportion()).divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+        //用户出口跟单费
+        willDocumentary = willDocumentary.add(jqExportOtherFee).add(syExportOtherFee).add(noExportOtherFee);
+        if(sysUserAccountVo.getWillDocumentary()==null){
+            sysUserAccountVo.setWillDocumentary(willDocumentary);
+        }
+        sysUserAccountVo.setWillDocumentary(sysUserAccountVo.getWillDocumentary().add(willDocumentary));
+
+    }
+
 
 }
 

+ 15 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysUserLinkPtlAgreementServiceImpl.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.modules.admin.dao.SysUserLinkPtlAgreementMapper;
 import com.ydtech.modules.admin.dao.SysUserMapper;
 import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.admin.model.dto.SysUserDto;
 import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
 import com.ydtech.modules.admin.model.po.SysUserLinkPtlAgreement;
 import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
@@ -135,4 +136,18 @@ public class SysUserLinkPtlAgreementServiceImpl extends ServiceImpl<SysUserLinkP
         }
         return  list;
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/4/23 11:43
+     *  @Description: 查询后线人员+分页
+     */
+    @Override
+    public BasePageResult<SysUserBaseVO> findUserListByPage(SysUserDto sysUserDto) {
+        Page<SysUserBaseVO> page = new Page<>(sysUserDto.getPageNum(),
+                sysUserDto.getPageSize());
+        Page<SysUserBaseVO> userPageResult = sysUserMapper.findUserListByPage(page, sysUserDto);
+        return  new BasePageResult<>(sysUserDto.getPageNum(), page.getSize(), userPageResult.getTotal(), page.getPages(),
+                userPageResult.getRecords());
+    }
 }

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

@@ -640,7 +640,6 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                 }
             }else {
 //                    一级分销
-
                 if(StringUtils.isNotEmpty(insFeeOrderNew.getFirstLevelUserId())){
                     String firstLevelUserId = insFeeOrderNew.getFirstLevelUserId();
                     BigDecimal firstDetailPremiums = insFeeOrderNew.getFirstDetailPremiums();

+ 23 - 20
src/main/java/com/ydtech/modules/order/components/pingan/PinganRequestApiComponents.java

@@ -33,6 +33,7 @@ import com.ydtech.modules.order.entity.api.pingan.utils.checkNull.FieldEmptyExce
 import com.ydtech.modules.order.entity.filter.CarModelsFilterUtils;
 import com.ydtech.modules.order.utils.InsuranceLog;
 import com.ydtech.utils.RequestIdUtils;
+import com.ydtech.utils.StringUtils;
 import lombok.RequiredArgsConstructor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -115,27 +116,29 @@ public class PinganRequestApiComponents {
         String clientSecret = properties.getClientSecret();
         logger.info("客户端id==========" + clientId);
         logger.info("客户端密钥==========" + clientSecret);
-        if ((clientId != null && !"".equals(clientId)) && (clientSecret == null && !"".equals(clientSecret))) {
-            url = url + "?client_id=" + clientId + "&grant_type=client_credentials&client_secret=" + clientSecret;
-            try {
-                ResponseEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.GET, entity, JSONObject.class);
-                JSONObject body = response.getBody();
-                TokenResponse token = JSON.toJavaObject(body, TokenResponse.class);
-                if (token != null) {
-                    String expiresIn = token.getData().getExpires_in();
-                    if (expiresIn != null && Integer.parseInt(expiresIn) > 0) {
-                        return token.getData().getAccess_token();
-                    } else {
-                        throw new SystemException("令牌已过期");
-                    }
+        if(StringUtils.isEmpty(clientId)){
+            throw new SystemException("客户端id为空,请检查配置!!!");
+        }
+        if(StringUtils.isEmpty(clientId)){
+            throw new SystemException("客户端密钥,请检查配置!!!");
+        }
+        url = url + "?client_id=" + clientId + "&grant_type=client_credentials&client_secret=" + clientSecret;
+        try {
+            ResponseEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.GET, entity, JSONObject.class);
+            JSONObject body = response.getBody();
+            TokenResponse token = JSON.toJavaObject(body, TokenResponse.class);
+            if (token != null) {
+                String expiresIn = token.getData().getExpires_in();
+                if (expiresIn != null && Integer.parseInt(expiresIn) > 0) {
+                    return token.getData().getAccess_token();
                 } else {
-                    throw new SystemException("返回值为空,请检查访问路径以及参数!!!");
+                    throw new SystemException("令牌已过期");
                 }
-            }catch (Exception e) {
-                throw new SystemException("接口请求异常,请检查请求路径以及参数");
+            } else {
+                throw new SystemException("返回值为空,请检查访问路径以及参数!!!");
             }
-        } else {
-            throw new SystemException("clientId或clientSecret值为空,请检查配置!!!");
+        }catch (Exception e) {
+            throw new SystemException("接口请求异常,请检查请求路径以及参数");
         }
     }
 
@@ -165,7 +168,7 @@ public class PinganRequestApiComponents {
             //获取令牌token
             token = getToken(properties.getAccessUrl());
         }catch (Exception e){
-            throw new SystemException("接口请求异常,请检查请求路径以及参数");
+            throw new SystemException(e.getMessage());
         }
 
         if (token == null) {
@@ -241,7 +244,7 @@ public class PinganRequestApiComponents {
                 throw new SystemException(requestUrl.getCode()+"-"+requestUrl.getDesc()+"-"+requestUrl.getUrl()+"接口返回信息"+PinAnEnumUtils.getEnumValueByCode(enumCodeClass,response.getResultCode()));
             }
         } catch (Exception e) {
-            throw new SystemException(requestUrl.getCode()+"-"+requestUrl.getDesc()+"-"+requestUrl.getUrl()+"接口报错,请检查请求路径及参数");
+            throw new SystemException(requestUrl.getCode()+"-"+requestUrl.getDesc()+"-"+requestUrl.getUrl()+"接口报错:"+e.getMessage());
         }
         return response;
     }

+ 7 - 1
src/main/java/com/ydtech/modules/order/components/zijin/ZijinDuplicateInsuranceComponents.java

@@ -35,7 +35,7 @@ public class ZijinDuplicateInsuranceComponents extends ResponseMessageAbstractHa
 
     public static final String JQ = "交强险";
 
-    public static final String SY_REGEX = "商业险.+?终保日期:(\\d+)";
+    public static final String SY_REGEX = "商业险.+?终保日期(?)(\\d+)";
 
     public static final String SY = "商业险";
 
@@ -122,6 +122,12 @@ public class ZijinDuplicateInsuranceComponents extends ResponseMessageAbstractHa
             syEndDate = getEndDate(rtnMsg, SY_REGEX);
         }
 
+        // 商业险
+        if (rtnMsg.contains(SY)) {
+            syEndDate = getEndDate(rtnMsg, SY_REGEX);
+        }
+
+
         if (jqEndDate.isEmpty() && syEndDate.isEmpty()) {
             throw new SystemException(rtnMsg);
         }

+ 10 - 0
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java

@@ -8,6 +8,7 @@ import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
 import com.ydtech.modules.order.entity.vo.OrderQueryVo;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -52,6 +53,15 @@ public interface InsAreaCompanyMapper extends BaseMapper<InsAreaCompany> {
     Page<InsOrders> getPendingAuditOrders(Page page, @Param("params") OrderQueryVo orderQueryVo);
 
     Page<InsOrders> getAlreadyAuditOrders(Page page, @Param("params") OrderQueryVo orderQueryVo);
+
+    List<InsOrders> getByUserId(HashMap<String, Object> params);
+
+
+    InsOrders selectFirstPromotionBy(HashMap<String, Object> params);
+
+    InsOrders selectSecondPromotionBy(HashMap<String, Object> params);
+
+    InsOrders selectThirdPromotionBy(HashMap<String, Object> params);
 }
 
 

+ 2 - 2
src/main/java/com/ydtech/modules/order/dao/InsOrdersMapper.java

@@ -56,14 +56,14 @@ public interface InsOrdersMapper extends BaseMapper<InsOrders> {
      *  @Date: 2024/4/17 18:01
      *  @Description:  通过用户id查询订单、渠道、代理人、保险公司
      */
-    Page<InsOrders> queryPageOrderByLinkType(@Param("page") Page<InsOrders> page,@Param("orderQueryVo") OrderQueryVo orderQueryVo, List<String> agentUserIds, List<String> agreeIds);
+    Page<InsOrders> queryPageOrderByLinkType(@Param("page") Page<InsOrders> page,@Param("orderQueryVo") OrderQueryVo orderQueryVo, @Param("agentUserIds") List<String> agentUserIds,  @Param("agreeIds") List<String> agreeIds,@Param("deptIds") List<String> deptIds);
     /**
      *  @version
      *  @author: hxl
      *  @Date: 2024/4/17 18:36
      *  @Description: 通过用户id查询订单、渠道、代理人、保险公司条数
      */
-    Long queryPageOrderByLinkTypeCount(@Param("orderQueryVo") OrderQueryVo orderQueryVo, @Param("agentUserIds")  List<String> agentUserIds, @Param("agreeIds")  List<String> agreeIds);
+    Long queryPageOrderByLinkTypeCount(@Param("orderQueryVo") OrderQueryVo orderQueryVo, @Param("agentUserIds")  List<String> agentUserIds, @Param("agreeIds")  List<String> agreeIds,@Param("deptIds") List<String> deptIds);
     /**
      *  @version
      *  @author: hxl

+ 7 - 0
src/main/java/com/ydtech/modules/order/entity/InsOrders.java

@@ -21,6 +21,7 @@ import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import lombok.*;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.List;
 
@@ -215,6 +216,12 @@ public class InsOrders implements Serializable {
 
     @TableField(exist = false)
     private String subOrderId; //子订单id
+    @TableField(exist = false)
+    private BigDecimal willFirstPremiums; //一级预收金额
+    @TableField(exist = false)
+    private BigDecimal willSecondPremiums; //二级预收金额
+    @TableField(exist = false)
+    private BigDecimal willThreePremiums; //三级预收金额
 
 
     public InsOrders(SysUser user, SysDept dept, BaseQuoteInfoVo quoteInfoVo) {

+ 8 - 0
src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java

@@ -6,6 +6,7 @@ import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
 import com.ydtech.modules.order.entity.vo.OrderQueryVo;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 
 import java.util.List;
 
@@ -86,4 +87,11 @@ public interface InsAreaCompanyService extends IService<InsAreaCompany> {
      */
     Page<InsOrders> getAlreadyAuditOrders(Page page, OrderQueryVo orderQueryVo);
 
+    List<InsOrders> getByUserId(String userId);
+
+    InsOrders selectPromotionBy(String userId, int i);
+
+    InsAreaCompany getByInsOrderNoNew(String insOrderNo, String timeFiltering);
+
+    InsOrders selectByInFeeOrderNew(InsFeeOrderNew insFeeOrderNew, int i);
 }

+ 72 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java

@@ -12,11 +12,16 @@ import com.ydtech.modules.order.entity.vo.OrderQueryVo;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.order.service.InsOrdersTrackService;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.utils.StringUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
 
+import java.time.LocalDate;
+import java.time.YearMonth;
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -120,6 +125,73 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
         return baseMapper.getAlreadyAuditOrders(page,orderQueryVo);
     }
 
+    @Override
+    public List<InsOrders> getByUserId(String userId) {
+        HashMap<String, Object> params = new HashMap<>();
+        params.put("orderStatus","3");
+        params.put("userId",userId);
+        return baseMapper.getByUserId(params);
+    }
+
+    @Override
+    public InsOrders selectPromotionBy(String userId, int i) {
+        HashMap<String, Object> params = new HashMap<>();
+        if(i==1){
+            params.put("firstUserId",userId);
+            return baseMapper.selectFirstPromotionBy(params);
+
+        }
+        if(i==2){
+            params.put("secondUserId",userId);
+            return baseMapper.selectSecondPromotionBy(params);
+
+        }
+        if(i==3){
+            params.put("thirdUserId",userId);
+            return baseMapper.selectThirdPromotionBy(params);
+
+        }
+        return null;
+    }
+
+    @Override
+    public InsAreaCompany getByInsOrderNoNew(String insOrderNo, String timeFiltering) {
+        LambdaQueryWrapper<InsAreaCompany> queryWrapper = new LambdaQueryWrapper<>();
+        if(StringUtils.isNotEmpty(timeFiltering)){
+            YearMonth targetYearMonth = YearMonth.parse(timeFiltering); // 假设timeFiltering是形如"2024-04"的字符串
+            LocalDate startOfMonth = targetYearMonth.atDay(1); // 当月第一天
+            LocalDate endOfMonth = targetYearMonth.atEndOfMonth(); // 当月最后一天
+            queryWrapper.between(InsAreaCompany::getSigningTime, startOfMonth, endOfMonth);
+        }
+        queryWrapper.eq(InsAreaCompany::getId, insOrderNo);
+        return baseMapper.selectOne(queryWrapper);
+    }
+
+    @Override
+    public InsOrders selectByInFeeOrderNew(InsFeeOrderNew insFeeOrderNew, int i) {
+        HashMap<String, Object> params = new HashMap<>();
+        if(!ObjectUtils.isEmpty(insFeeOrderNew)){
+            String userId = insFeeOrderNew.getUserId();
+            params.put("id",insFeeOrderNew.getId());
+            if(i==1){
+                params.put("firstUserId",userId);
+                return baseMapper.selectFirstPromotionBy(params);
+
+            }
+            if(i==2){
+                params.put("secondUserId",userId);
+                return baseMapper.selectSecondPromotionBy(params);
+
+            }
+            if(i==3){
+                params.put("thirdUserId",userId);
+                return baseMapper.selectThirdPromotionBy(params);
+            }
+        }
+        return null;
+    }
+
+
 }
 
 

+ 7 - 2
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -794,10 +794,14 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         page.setSearchCount(false).setOptimizeCountSql(false);//关闭count查询
         List<String> agentUserIds = new ArrayList<>();
         List<String> agreeIds = new ArrayList<>();
+        //角色为需要查询下级的用户
+        List<String> roleIds = Arrays.asList(SystemConstant.getSysRoleTeamLeader());
         if (type == 1) {
             //渠道
             //查询用户表中的信息为领带id为用户id的数据
             List<SysUserBaseVO> allUsersByLeaderId = sysUserMapper.getAllUsersByLeaderId(orderQueryVo.getUserId());
+
+            //查询下级
             if (allUsersByLeaderId != null && allUsersByLeaderId.size() > 0) {
                 for (SysUserBaseVO sysUserBaseVO : allUsersByLeaderId) {
                     agentUserIds.add(sysUserBaseVO.getUserId());
@@ -821,8 +825,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         Page<InsOrders> orderVoPage = new Page<>();
         //注释逻辑给前台返回数据
         if((agentUserIds!=null && agentUserIds.size()>0) || (agreeIds!=null && agreeIds.size()>0)){
-        orderVoPage = baseMapper.queryPageOrderByLinkType(page, orderQueryVo, agentUserIds, agreeIds);
-        total = baseMapper.queryPageOrderByLinkTypeCount(orderQueryVo, agentUserIds, agreeIds);
+            List<String> deptIds= sysUserMapper.getDeptIdsByRoleIdsAndUserIds(agentUserIds,roleIds);
+            orderVoPage = baseMapper.queryPageOrderByLinkType(page, orderQueryVo, agentUserIds, agreeIds,deptIds);
+            total = baseMapper.queryPageOrderByLinkTypeCount(orderQueryVo, agentUserIds, agreeIds,deptIds);
         }
         orderVoPage.setTotal(total);
         return new BasePageResult<>(orderQueryVo.getPageNum(), orderQueryVo.getPageSize(), orderVoPage.getTotal(),

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

@@ -13,6 +13,8 @@ import com.ydtech.modules.protocol.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -82,7 +84,12 @@ public class PtlAgreementHistoryServiceImpl extends ServiceImpl<PtlAgreementHist
             ptlAgreementHistoryConvertQueryVo.setUnderwritingDescription(hashJson.getString("underwriting_description"));
             ptlAgreementHistoryConvertQueryVo.setOperatorType(hashJson.getString("operator_type"));
             ptlAgreementHistoryConvertQueryVo.setOperator(hashJson.getString("operator"));
-            ptlAgreementHistoryConvertQueryVo.setOperatorTime(hashJson.getString("operator_time"));
+
+            String operatorTimeStr = hashJson.getString("operator_time");
+            LocalDateTime operatorTime = LocalDateTime.parse(operatorTimeStr);
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            String formattedTime = operatorTime.format(formatter);
+            ptlAgreementHistoryConvertQueryVo.setOperatorTime(formattedTime);
 
             PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory();
             ptlAgreementAttributionHistory.setInsCompanyId(hashJson.getString("ins_company_id"));

+ 96 - 129
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -77,15 +77,15 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     private final PtlAgreementAttributionHistoryService ptlAgreementAttributionHistoryService;
 
     @Autowired
-    private  PtlAgreementDeptHistoryService ptlAgreementDeptHistoryService;
+    private PtlAgreementDeptHistoryService ptlAgreementDeptHistoryService;
 
 
     public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService,
                                    PtlAgreementAttributionService ptlAgreementAttributionService, PtlAgreementDeptService ptlAgreementDeptService,
                                    EsmInsCompanyService esmInsCompanyService, PtlAgreementNonCarProductCostsService ptlAgreementNonCarProductCostsService,
-                                   @Lazy InsCrawlerOrderService insCrawlerOrderController, @Lazy PtlAgreementService proxyObject,PtlNonCarInsuranceProductService ptlNonCarInsuranceProductService,@Lazy PtlAgreementUndwrtRulesService ptlAgreementUndwrtRulesService,
-                                   PtlAgreementHistoryService ptlAgreementHistoryService,PtlAgreementProductCostsHistoryService ptlAgreementProductCostsHistoryService,
-                                   PtlAgreementUndwrtRulesHistoryService ptlAgreementUndwrtRulesHistoryService,PtlAgreementAttributionHistoryService ptlAgreementAttributionHistoryService) {
+                                   @Lazy InsCrawlerOrderService insCrawlerOrderController, @Lazy PtlAgreementService proxyObject, PtlNonCarInsuranceProductService ptlNonCarInsuranceProductService, @Lazy PtlAgreementUndwrtRulesService ptlAgreementUndwrtRulesService,
+                                   PtlAgreementHistoryService ptlAgreementHistoryService, PtlAgreementProductCostsHistoryService ptlAgreementProductCostsHistoryService,
+                                   PtlAgreementUndwrtRulesHistoryService ptlAgreementUndwrtRulesHistoryService, PtlAgreementAttributionHistoryService ptlAgreementAttributionHistoryService) {
         this.ptlAgreementProductCostsService = ptlAgreementProductCostsService;
         this.ptlAgreementAttributionService = ptlAgreementAttributionService;
         this.ptlAgreementDeptService = ptlAgreementDeptService;
@@ -93,12 +93,12 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         this.ptlAgreementNonCarProductCostsService = ptlAgreementNonCarProductCostsService;
         this.insCrawlerOrderController = insCrawlerOrderController;
         this.proxyObject = proxyObject;
-        this.ptlNonCarInsuranceProductService=ptlNonCarInsuranceProductService;
-        this.ptlAgreementUndwrtRulesService=ptlAgreementUndwrtRulesService;
+        this.ptlNonCarInsuranceProductService = ptlNonCarInsuranceProductService;
+        this.ptlAgreementUndwrtRulesService = ptlAgreementUndwrtRulesService;
         this.ptlAgreementHistoryService = ptlAgreementHistoryService;
         this.ptlAgreementProductCostsHistoryService = ptlAgreementProductCostsHistoryService;
         this.ptlAgreementUndwrtRulesHistoryService = ptlAgreementUndwrtRulesHistoryService;
-        this.ptlAgreementAttributionHistoryService=ptlAgreementAttributionHistoryService;
+        this.ptlAgreementAttributionHistoryService = ptlAgreementAttributionHistoryService;
     }
 
 
@@ -131,9 +131,9 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     }
 
     @Override
-    public PtlAgreementInsCompanyDto getAgreementCompany(String deptId,String companyId) {
+    public PtlAgreementInsCompanyDto getAgreementCompany(String deptId, String companyId) {
         LocalDate localDate = LocalDate.now();
-        PtlAgreementInsCompanyDto agreementCompany = baseMapper.getAgreementCompanyByCompanyId(localDate, deptId,companyId);
+        PtlAgreementInsCompanyDto agreementCompany = baseMapper.getAgreementCompanyByCompanyId(localDate, deptId, companyId);
         return agreementCompany;
     }
 
@@ -161,7 +161,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         ptlAgreement.setCreateTime(LocalDateTime.now());
         save(ptlAgreement);
         // 提交  账号信息 授权部门
-        proxyObject.saveAssociationInformation(ptlAgreement.getId(), esmInsCompany,agreement);
+        proxyObject.saveAssociationInformation(ptlAgreement.getId(), esmInsCompany, agreement);
         // 添加 历史记录表
         //生成批次号
         String batchNo = IdGenerate.nextId();
@@ -176,7 +176,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         ptlAgreementHistory.setId(IdGenerate.nextId());
         ptlAgreementHistory.setOperatorType("add");
         ptlAgreementHistoryService.saveAgreementHistory(ptlAgreementHistory);
-        PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory(batchNo,ptlAgreement.getId(),esmInsCompany.getId(),esmInsCompany.getName(),agreement.getAttribution());
+        PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory(batchNo, ptlAgreement.getId(), esmInsCompany.getId(), esmInsCompany.getName(), agreement.getAttribution());
         ptlAgreementAttributionHistory.setId(IdGenerate.nextId());
         if (StringUtils.isNotEmpty(attribution.getTemplateId())) {
             ptlAgreementAttributionHistoryService.save(ptlAgreementAttributionHistory);
@@ -190,7 +190,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     public HttpResult<Object> saveAgreementProduct(PtlAgreementProductCosts ptlAgreementProductCosts, String userName) {
 
         PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, ptlAgreementProductCosts.getAgreementId()));
-        if(ptlAgreement==null){
+        if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
         ptlAgreement.setModifiedBy(userName);
@@ -201,7 +201,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         ptlAgreementProductCostsService.save(ptlAgreementProductCosts);
         // 添加 历史记录表
         PtlAgreementProductCostsHistory history = new PtlAgreementProductCostsHistory(userName, DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"),
-                HistoryStatusConstants.HISTORY_TYPE_UPDATE,ptlAgreementProductCosts);
+                HistoryStatusConstants.HISTORY_TYPE_UPDATE, ptlAgreementProductCosts);
         ptlAgreementProductCostsHistoryService.save(history);
         return HttpResult.ok("添加成功");
     }
@@ -209,7 +209,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Override
     public HttpResult<Object> updateAgreementProduct(PtlAgreementProductCosts agreement, String userName) {
         PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, agreement.getAgreementId()));
-        if(ptlAgreement==null){
+        if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
         ptlAgreement.setModifiedBy(userName);
@@ -220,20 +220,20 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         ptlAgreementProductCostsService.updateById(agreement);
         // 添加 历史记录表
         PtlAgreementProductCostsHistory history = new PtlAgreementProductCostsHistory(userName, DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"),
-                HistoryStatusConstants.HISTORY_TYPE_UPDATE,agreement);
+                HistoryStatusConstants.HISTORY_TYPE_UPDATE, agreement);
         ptlAgreementProductCostsHistoryService.save(history);
         return HttpResult.ok("修改成功");
     }
 
     @Override
     @Transactional
-    public HttpResult<Object> deleteAgreementProduct(String id,String userName) {
-        PtlAgreementProductCosts ptlAg=ptlAgreementProductCostsService.getById(id);
-        if(ptlAg==null){
+    public HttpResult<Object> deleteAgreementProduct(String id, String userName) {
+        PtlAgreementProductCosts ptlAg = ptlAgreementProductCostsService.getById(id);
+        if (ptlAg == null) {
             throw new SystemException("协议产品费用不存在");
         }
         PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, ptlAg.getAgreementId()));
-        if(ptlAgreement==null){
+        if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
         ptlAgreement.setModifiedBy(userName);
@@ -243,7 +243,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         //删除协议
         ptlAgreementProductCostsService.removeById(id);
         PtlAgreementProductCostsHistory history = new PtlAgreementProductCostsHistory(userName, DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"),
-                HistoryStatusConstants.HISTORY_TYPE_DELETE,ptlAg);
+                HistoryStatusConstants.HISTORY_TYPE_DELETE, ptlAg);
         ptlAgreementProductCostsHistoryService.save(history);
         return HttpResult.ok("删除成功");
     }
@@ -252,29 +252,29 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Transactional
     public HttpResult<Object> saveAgreementNonCarProductCosts(PtlAgreementNonVehicleProductCostsVo agreement, String userName) {
         //同步刷新其他协议非车产品费用信息(有待同步协议时,进行同步)
-        if(agreement.getSyncAgreementIds()!=null&&agreement.getSyncAgreementIds().size()>0){
-            for(int i=0;i<agreement.getSyncAgreementIds().size();i++){
-                String tempAgreementId=agreement.getSyncAgreementIds().get(i);
-                PtlAgreement destAgreement= getById(tempAgreementId);
+        if (agreement.getSyncAgreementIds() != null && agreement.getSyncAgreementIds().size() > 0) {
+            for (int i = 0; i < agreement.getSyncAgreementIds().size(); i++) {
+                String tempAgreementId = agreement.getSyncAgreementIds().get(i);
+                PtlAgreement destAgreement = getById(tempAgreementId);
                 //根据归属保司,找出本级和上级 所有产品代码
                 //先获取相关保险公司列表
-                String companyId=destAgreement.getPartnerCompaniesId();
-                if(destAgreement.getAssociationCompaniesId()!=null&&!"".equals(destAgreement.getAssociationCompaniesId())){
-                    companyId=destAgreement.getAssociationCompaniesId();
+                String companyId = destAgreement.getPartnerCompaniesId();
+                if (destAgreement.getAssociationCompaniesId() != null && !"".equals(destAgreement.getAssociationCompaniesId())) {
+                    companyId = destAgreement.getAssociationCompaniesId();
                 }
-                List<String> companyIdList=esmInsCompanyService.getAllRelationCompanyId(companyId);
+                List<String> companyIdList = esmInsCompanyService.getAllRelationCompanyId(companyId);
                 //再根据保险公司列表获取所有非车产品列表
-                List<PtlNonCarInsuranceProduct> productList=ptlNonCarInsuranceProductService.findProductListByCompangIds(companyIdList);
-                List<PtlAgreementNonCarProductCostsSaveVo> finalList=new ArrayList<>();
+                List<PtlNonCarInsuranceProduct> productList = ptlNonCarInsuranceProductService.findProductListByCompangIds(companyIdList);
+                List<PtlAgreementNonCarProductCostsSaveVo> finalList = new ArrayList<>();
                 //按找出的产品过滤传进来的 费用方案列表
-                for(PtlNonCarInsuranceProduct tempProductDto:productList){
-                    for(PtlAgreementNonCarProductCostsSaveVo productCostDto:agreement.getNonCarProductCosts()){
-                        if(productCostDto.getProductId().equals(tempProductDto.getProductCode())){
+                for (PtlNonCarInsuranceProduct tempProductDto : productList) {
+                    for (PtlAgreementNonCarProductCostsSaveVo productCostDto : agreement.getNonCarProductCosts()) {
+                        if (productCostDto.getProductId().equals(tempProductDto.getProductCode())) {
                             finalList.add(productCostDto);
                         }
                     }
                 }
-                ptlAgreementNonCarProductCostsService.synNonCarProductCosts(destAgreement,finalList);
+                ptlAgreementNonCarProductCostsService.synNonCarProductCosts(destAgreement, finalList);
             }
         }
 
@@ -285,7 +285,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Transactional
     public HttpResult<Object> saveAgreementUndwrtRules(PtlAgreementUndwrtRules ptlAgreementUndwrtRules, String userName) {
         PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, ptlAgreementUndwrtRules.getAgreementId()));
-        if(ptlAgreement==null){
+        if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
         ptlAgreement.setModifiedBy(userName);
@@ -295,7 +295,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         //添加承保规则
         ptlAgreementUndwrtRulesService.save(ptlAgreementUndwrtRules);
         //添加历史记录
-        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory=new PtlAgreementUndwrtRulesHistory(userName,HistoryStatusConstants.HISTORY_TYPE_ADD,ptlAgreementUndwrtRules);
+        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory = new PtlAgreementUndwrtRulesHistory(userName, HistoryStatusConstants.HISTORY_TYPE_ADD, ptlAgreementUndwrtRules);
         ptlAgreementUndwrtRulesHistoryService.save(ptlAgreementUndwrtRulesHistory);
         return HttpResult.ok("添加成功");
     }
@@ -304,7 +304,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Transactional
     public HttpResult<Object> updateAgreementUndwrtRules(PtlAgreementUndwrtRules ptlAgreementUndwrtRules, String userName) {
         PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, ptlAgreementUndwrtRules.getAgreementId()));
-        if(ptlAgreement==null){
+        if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
         ptlAgreement.setModifiedBy(userName);
@@ -314,7 +314,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         //添加承保规则
         ptlAgreementUndwrtRulesService.updateById(ptlAgreementUndwrtRules);
         //添加历史记录
-        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory=new PtlAgreementUndwrtRulesHistory(userName,HistoryStatusConstants.HISTORY_TYPE_UPDATE,ptlAgreementUndwrtRules);
+        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory = new PtlAgreementUndwrtRulesHistory(userName, HistoryStatusConstants.HISTORY_TYPE_UPDATE, ptlAgreementUndwrtRules);
         ptlAgreementUndwrtRulesHistoryService.save(ptlAgreementUndwrtRulesHistory);
         return HttpResult.ok("修改成功");
     }
@@ -323,11 +323,11 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Transactional
     public HttpResult<Object> deleteAgreementUndwrtRules(String id, String userName) {
         PtlAgreementUndwrtRules ptlAgreementUndwrtRules = ptlAgreementUndwrtRulesService.getOne(new LambdaQueryWrapper<PtlAgreementUndwrtRules>().eq(PtlAgreementUndwrtRules::getId, id));
-        if(ptlAgreementUndwrtRules==null){
+        if (ptlAgreementUndwrtRules == null) {
             throw new SystemException("协议承保规则不存在");
         }
         PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, ptlAgreementUndwrtRules.getAgreementId()));
-        if(ptlAgreement==null){
+        if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
         ptlAgreement.setModifiedBy(userName);
@@ -337,7 +337,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         //删除承保规则
         ptlAgreementUndwrtRulesService.removeById(id);
         //添加历史记录
-        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory=new PtlAgreementUndwrtRulesHistory(userName,HistoryStatusConstants.HISTORY_TYPE_DELETE,ptlAgreementUndwrtRules);
+        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory = new PtlAgreementUndwrtRulesHistory(userName, HistoryStatusConstants.HISTORY_TYPE_DELETE, ptlAgreementUndwrtRules);
         ptlAgreementUndwrtRulesHistoryService.save(ptlAgreementUndwrtRulesHistory);
         return HttpResult.ok("删除成功");
     }
@@ -368,56 +368,40 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
                 // 修改时间
                 .between(!ObjectUtils.isEmpty(ptlAgreementPageVo.getUpdateStarTime()) && !ObjectUtils.isEmpty(ptlAgreementPageVo.getUpdateEndTime()), PtlAgreement::getUpdateTime, ptlAgreementPageVo.getUpdateStarTime(), ptlAgreementPageVo.getUpdateEndTime())
                 // 协议起期
-                .ge(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAgreementStartDate()), PtlAgreement::getStartDate, ptlAgreementPageVo.getAgreementStartDate())
+                .le(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAgreementStartDate()), PtlAgreement::getStartDate, ptlAgreementPageVo.getAgreementStartDate())
                 // 协议止期
-                .le(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAgreementEndDate()), PtlAgreement::getEndDate, ptlAgreementPageVo.getAgreementEndDate());
-
-//        Page<PtlAgreement> ptlAgreementPage = new Page<>(pageNum, pageSize);
-        List<PtlAgreement> records = list(wrapper);
-//        Page<PtlAgreement> agreementPage = page(ptlAgreementPage, wrapper);
-//        List<PtlAgreement> records = agreementPage.getRecords();
+                .ge(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAgreementEndDate()), PtlAgreement::getEndDate, ptlAgreementPageVo.getAgreementEndDate());
+        // 省市县
         if (ptlAgreementPageVo.getAreaCode() != null && !"".equals(ptlAgreementPageVo.getAreaCode()) && ptlAgreementPageVo.getLevel() != null) {
             String area = ptlAgreementPageVo.getAreaCode();
             String prefix = null;
             Integer sign = 0;
             switch (ptlAgreementPageVo.getLevel()) {
                 case "1": { // 省级查询逻辑
-                    sign = 7;
+                    sign = 2;
                     prefix = area.substring(0, 2);
                     break;
                 }
                 case "2": {  // 市级查询逻辑
-                    sign = 9;
+                    sign = 4;
                     prefix = area.substring(0, 4);
                     break;
                 }
                 case "3": {  // 区县级查询逻辑
-                    sign = 11;
+                    sign = 6;
                     prefix = area.substring(0, 6);
                     break;
                 }
             }
-
-            if (records.size() != 0) {
-                List<PtlAgreement> ptlAgreements = new ArrayList<>();
-                for (PtlAgreement record : records) {
-                    String substring = record.getPartnerCompaniesId().substring(5, sign);
-                    if (substring.equals(prefix)) {
-                        ptlAgreements.add(record);
-                    }
-                }
-                records.clear();
-                records.addAll(ptlAgreements);
-            }
+            wrapper.apply("SUBSTRING(partner_companies_id, 6, " + sign + ") =" + prefix);
         }
-        List<PtlAgreement> paginate = paginate(records, pageNum, pageSize);
-
-        PageResult<PtlAgreement> ptlAgreementPageResult = new PageResult<>(pageNum, pageSize, records.size(), paginate);
+        List<PtlAgreement> records = list(wrapper);
+        PageResult<PtlAgreement> ptlAgreementPageResult = new PageResult<>(pageNum, pageSize, records.size(), records);
         return HttpResult.ok(ptlAgreementPageResult);
     }
 
     @Override
-    public HttpResult<List<PtlAgreement>> listAgreement(PtlAgreementPageVo ptlAgreementPageVo){
+    public HttpResult<List<PtlAgreement>> listAgreement(PtlAgreementPageVo ptlAgreementPageVo) {
         LambdaQueryWrapper<PtlAgreement> wrapper = new LambdaQueryWrapper<>();
         // 获取供应商本级id 及其 下级id
         List<String> lowerId = esmInsCompanyService.getByLowerId(ptlAgreementPageVo.getPartnerCompaniesId());
@@ -462,13 +446,13 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         }
         // 授权查询
         List<PtlAgreementDept> deptList = ptlAgreementDeptService.getByAgreementId(agreementId);
-        PtlAgreementQueryVo ptlAgreementQueryVo = new PtlAgreementQueryVo(ptlAgreement,ptlAgreementAttribution, deptList);
+        PtlAgreementQueryVo ptlAgreementQueryVo = new PtlAgreementQueryVo(ptlAgreement, ptlAgreementAttribution, deptList);
         return HttpResult.ok(ptlAgreementQueryVo);
     }
 
     @Override
     @Transactional
-    public HttpResult<Object> deleteAgreement(String agreementId,String userName) {
+    public HttpResult<Object> deleteAgreement(String agreementId, String userName) {
         proxyObject.ifExistsById(agreementId);
         HttpResult<PtlAgreementQueryVo> byAgreementId = getByAgreementId(agreementId);
 
@@ -495,7 +479,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         ptlAgreementHistory.setId(IdGenerate.nextId());
         ptlAgreementHistory.setOperatorType("delete");
         ptlAgreementHistoryService.saveAgreementHistory(ptlAgreementHistory);
-        PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory(batchNo,agreementId,
+        PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory(batchNo, agreementId,
                 byAgreementId.getData().getAgreement().getInsuranceCompanyId(),
                 byAgreementId.getData().getAgreement().getInsuranceCompany(),
                 byAgreementId.getData().getPtlAgreementAttribution()
@@ -543,7 +527,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         ptlAgreementHistory.setId(IdGenerate.nextId());
         ptlAgreementHistory.setOperatorType("update");
         ptlAgreementHistoryService.saveAgreementHistory(ptlAgreementHistory);
-        PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory(batchNo,ptlAgreement.getId(),esmInsCompany.getId(),esmInsCompany.getName(),agreement.getAttribution());
+        PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory(batchNo, ptlAgreement.getId(), esmInsCompany.getId(), esmInsCompany.getName(), agreement.getAttribution());
         ptlAgreementAttributionHistory.setId(IdGenerate.nextId());
         if (StringUtils.isNotEmpty(attribution.getTemplateId())) {
             ptlAgreementAttributionHistoryService.save(ptlAgreementAttributionHistory);
@@ -624,69 +608,69 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     }
 
     @Override
-    public HttpResult<List<PtlAgreementNonCarProductCostsVo>> getNonCarCostsInfo(String agreementId, String companyId){
-        List<PtlAgreementNonCarProductCostsVo> result=new ArrayList<>();
+    public HttpResult<List<PtlAgreementNonCarProductCostsVo>> getNonCarCostsInfo(String agreementId, String companyId) {
+        List<PtlAgreementNonCarProductCostsVo> result = new ArrayList<>();
         //先根据传过来的保险公司代码,找上下级所有机构层级对应的非车产品列表
-        if(companyId!=null&&!"".equals(companyId)){
+        if (companyId != null && !"".equals(companyId)) {
             //先获取相关保险公司列表
-            List<String> companyIdList=esmInsCompanyService.getAllRelationCompanyId(companyId);
+            List<String> companyIdList = esmInsCompanyService.getAllRelationCompanyId(companyId);
             //再根据保险公司列表获取所有非车产品列表
-            List<PtlNonCarInsuranceProduct> productList=ptlNonCarInsuranceProductService.findProductListByCompangIds(companyIdList);
-            if(productList!=null&&productList.size()>0){
-                for(int i=0;i<productList.size();i++){
-                    PtlNonCarInsuranceProduct tempProductDto=productList.get(i);
-                    PtlAgreementNonCarProductCostsVo costsVo=new PtlAgreementNonCarProductCostsVo();
+            List<PtlNonCarInsuranceProduct> productList = ptlNonCarInsuranceProductService.findProductListByCompangIds(companyIdList);
+            if (productList != null && productList.size() > 0) {
+                for (int i = 0; i < productList.size(); i++) {
+                    PtlNonCarInsuranceProduct tempProductDto = productList.get(i);
+                    PtlAgreementNonCarProductCostsVo costsVo = new PtlAgreementNonCarProductCostsVo();
                     costsVo.setProductId(tempProductDto.getProductCode());
                     costsVo.setProductName(tempProductDto.getProductName());
                     costsVo.setCompanyId(tempProductDto.getCompanyId());
-                    EsmInsCompany tempInsCompany=esmInsCompanyService.getById(tempProductDto.getCompanyId());
+                    EsmInsCompany tempInsCompany = esmInsCompanyService.getById(tempProductDto.getCompanyId());
                     costsVo.setCompanyName(tempInsCompany.getName());
                     costsVo.setRiskCode(tempProductDto.getInsuranceCode());
                     Map<String, DictionaryManagement> m = DictEnumConfig.getDmMap();
-                    DictionaryManagement dictionaryManagement=m.get("nonCarInsuranceCode");
-                    String riskName="";
-                    for(DictionaryData data: dictionaryManagement.getDdList()){
-                        if(tempProductDto.getInsuranceCode().equals(data.getDictValue())){
-                            riskName=data.getDictTag();
+                    DictionaryManagement dictionaryManagement = m.get("nonCarInsuranceCode");
+                    String riskName = "";
+                    for (DictionaryData data : dictionaryManagement.getDdList()) {
+                        if (tempProductDto.getInsuranceCode().equals(data.getDictValue())) {
+                            riskName = data.getDictTag();
                         }
                     }
                     costsVo.setRiskName(riskName);
                     //然后根据协议ID 查询所有已配置费用的产品进行赋值
-                    if(agreementId!=null&&!"".equals(agreementId)){
+                    if (agreementId != null && !"".equals(agreementId)) {
                         //使用协议ID  产品ID  获取已经配置好的信息
-                        PtlAgreementNonCarProductCosts agreementNonCarProductCosts=ptlAgreementNonCarProductCostsService.getNonCarProductCostsInfo(agreementId,tempProductDto.getProductCode());
+                        PtlAgreementNonCarProductCosts agreementNonCarProductCosts = ptlAgreementNonCarProductCostsService.getNonCarProductCostsInfo(agreementId, tempProductDto.getProductCode());
                         //赋值已配置的费用比例
-                        if(agreementNonCarProductCosts!=null){
+                        if (agreementNonCarProductCosts != null) {
                             costsVo.setCostsProportion(agreementNonCarProductCosts.getCostsProportion());
                         }
                     }
                     result.add(costsVo);
                 }
             }
-        }else{
+        } else {
             //如果归属保司没选,则直接返回空列表,相当于没查到对应非车产品信息
         }
         return HttpResult.ok(result);
     }
 
     @Override
-    public HttpResult<List<PtlAgreement>> findRelationAgreement(String companyId){
-        List<PtlAgreement> resultList=new ArrayList<>();
-        if(companyId!=null&&!"".equals(companyId)) {
+    public HttpResult<List<PtlAgreement>> findRelationAgreement(String companyId) {
+        List<PtlAgreement> resultList = new ArrayList<>();
+        if (companyId != null && !"".equals(companyId)) {
             //先获取相关保险公司列表
             List<String> companyIdList = esmInsCompanyService.getAllRelationCompanyId(companyId);
-            if(companyIdList!=null&&companyIdList.size()>0){
-                for(int i=0;i<companyIdList.size();i++){
-                    String tempCom=companyIdList.get(i);
+            if (companyIdList != null && companyIdList.size() > 0) {
+                for (int i = 0; i < companyIdList.size(); i++) {
+                    String tempCom = companyIdList.get(i);
                     LambdaQueryWrapper<PtlAgreement> wrapper = new LambdaQueryWrapper<>();
-                    wrapper.eq(PtlAgreement::getValidStatus,"1");
-                    wrapper.and(wq1->wq1.eq(PtlAgreement::getPartnerCompaniesId,tempCom).or(wq2->wq2.eq(PtlAgreement::getAssociationCompaniesId,tempCom)));
+                    wrapper.eq(PtlAgreement::getValidStatus, "1");
+                    wrapper.and(wq1 -> wq1.eq(PtlAgreement::getPartnerCompaniesId, tempCom).or(wq2 -> wq2.eq(PtlAgreement::getAssociationCompaniesId, tempCom)));
                     resultList.addAll(list(wrapper));
                 }
-                for(int j=0;j<resultList.size();j++){
-                    PtlAgreement agreement=resultList.get(j);
-                    String tempCompanyId=agreement.getAssociationCompaniesId()!=null&&!"".equals(agreement.getAssociationCompaniesId())?agreement.getAssociationCompaniesId():agreement.getPartnerCompaniesId();
-                    EsmInsCompany tempCompany= esmInsCompanyService.getById(tempCompanyId);
+                for (int j = 0; j < resultList.size(); j++) {
+                    PtlAgreement agreement = resultList.get(j);
+                    String tempCompanyId = agreement.getAssociationCompaniesId() != null && !"".equals(agreement.getAssociationCompaniesId()) ? agreement.getAssociationCompaniesId() : agreement.getPartnerCompaniesId();
+                    EsmInsCompany tempCompany = esmInsCompanyService.getById(tempCompanyId);
                     agreement.setInsuranceCompany(tempCompany.getName());
                 }
             }
@@ -694,44 +678,27 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         return HttpResult.ok(resultList);
     }
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/4/15 18:02
-     *  @Description: 查询审核的协议
+     * @version
+     * @author: hxl
+     * @Date: 2024/4/15 18:02
+     * @Description: 查询审核的协议
      */
-    public List<PtlAgreement> findCheckAgreementList(PtlAgreement ptlAgreement){
+    public List<PtlAgreement> findCheckAgreementList(PtlAgreement ptlAgreement) {
         LambdaQueryWrapper<PtlAgreement> wrapper = new LambdaQueryWrapper<>();
-       // wrapper.eq(PtlAgreement::getAuditStatus,"1");
+        // wrapper.eq(PtlAgreement::getAuditStatus,"1");
+        //添加协议编码排序
+        wrapper.orderByAsc(PtlAgreement::getAgreementCode);
         List<PtlAgreement> list = proxyObject.list(wrapper);
         return list;
     }
 
-//    @Autowired
+    //    @Autowired
 //    private PtlAgreementProductCostsNewService ptlAgreementProductCostsNewService;
-    public List<PtlAgreement> getCurrentAgreementList(String agreementId){
+    public List<PtlAgreement> getCurrentAgreementList(String agreementId) {
         PtlAgreement ptlAgreement = this.getById(agreementId);
         String insuranceCompanyId = ptlAgreement.getInsuranceCompanyId();
         List<PtlAgreement> ptlAgreements = baseMapper.selectList(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getInsuranceCompanyId, insuranceCompanyId));
         return ptlAgreements;
     }
 
-    /**
-     * 手动对 QuUserNum 列表进行分页
-     *
-     * @param ptlAgreements 原始 QuUserNum 数据列表
-     * @param pageNum       期望获取的页码(从 1 开始)
-     * @param pageSize      每页包含的 QuUserNum 数量
-     * @return 对应页码的 QuUserNum 子列表,若输入参数无效则返回空列表
-     */
-    public List<PtlAgreement> paginate(List<PtlAgreement> ptlAgreements, int pageNum, int pageSize) {
-        if (ptlAgreements == null || ptlAgreements.isEmpty() || pageNum < 1 || pageSize < 1) {
-            return Collections.emptyList();
-        }
-
-        int startIndex = (pageNum - 1) * pageSize;
-        int endIndex = Math.min(startIndex + pageSize, ptlAgreements.size());
-
-        return ptlAgreements.subList(startIndex, endIndex);
-    }
-
 }

+ 1 - 0
src/main/java/com/ydtech/modules/protocols/dao/InsFeeOrderNewMapper.java

@@ -12,6 +12,7 @@ import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsAttrLink;
  */
 public interface InsFeeOrderNewMapper extends BaseMapper<InsFeeOrderNew> {
 
+    InsFeeOrderNew getInsFeeOrderEntity(String id);
 }
 
 

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

@@ -12,6 +12,7 @@ import org.apache.poi.hpsf.Decimal;
 
 import javax.persistence.Table;
 import java.math.BigDecimal;
+import java.time.LocalDate;
 
 /**
 *@author: tz
@@ -365,7 +366,26 @@ public class InsFeeOrderNew {
     @TableField(value = "dept_distribution")
     private BigDecimal deptDistribution;
 
+    @ApiModelProperty(value = "签单日期")
+    @TableField(exist = false)
+    private LocalDate signingTime;
+
+    @ApiModelProperty(value = "车牌号")
+    @TableField(exist = false)
+    private String licenseno;
 
 
+    @ApiModelProperty(value = "预收推广")
+    @TableField(exist = false)
+    private BigDecimal willPromotion;
+
+    @ApiModelProperty(value = "预收手续费")
+    @TableField(exist = false)
+    private BigDecimal willHalding;
+
+    @ApiModelProperty(value = "预收跟单费")
+    @TableField(exist = false)
+    private BigDecimal willDocumentary;
+
 
 }

+ 1 - 0
src/main/java/com/ydtech/modules/protocols/service/InsFeeOrderNewService.java

@@ -13,4 +13,5 @@ public interface InsFeeOrderNewService extends IService<InsFeeOrderNew> {
 
     InsFeeOrderNew getInsFeeOrderNewByCompanyId(String companyId);
 
+    InsFeeOrderNew getInsFeeOrderEntity(String id);
 }

+ 5 - 0
src/main/java/com/ydtech/modules/protocols/service/impl/InsFeeOrderNewServiceImpl.java

@@ -25,4 +25,9 @@ public class InsFeeOrderNewServiceImpl extends ServiceImpl<InsFeeOrderNewMapper,
         return baseMapper.selectOne(new LambdaQueryWrapper<InsFeeOrderNew>()
                 .eq(InsFeeOrderNew::getInsOrderNo, companyId));
     }
+
+    @Override
+    public InsFeeOrderNew getInsFeeOrderEntity(String id) {
+        return baseMapper.getInsFeeOrderEntity(id);
+    }
 }

+ 14 - 6
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java

@@ -90,8 +90,8 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
         //费用时间
         if(agreementProductQueryVo.getCostStartDate() != null)
         {
-            ptlAgreementProductCostsNewLambdaQueryWrapper.or().gt(PtlAgreementProductCostsNew::getCostsStartDate, agreementProductQueryVo.getCostStartDate())
-                    .lt(PtlAgreementProductCostsNew::getCostsEndDate, agreementProductQueryVo.getCostsEndDate());
+            ptlAgreementProductCostsNewLambdaQueryWrapper.gt(PtlAgreementProductCostsNew::getCostsStartDate, agreementProductQueryVo.getCostStartDate())
+                    .or().lt(PtlAgreementProductCostsNew::getCostsEndDate, agreementProductQueryVo.getCostsEndDate());
         }
 
         Page<PtlAgreementProductCostsNew> pages = baseMapper.selectPage(page, ptlAgreementProductCostsNewLambdaQueryWrapper);
@@ -255,9 +255,12 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
     }
 
     private String radioIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementProductCostsAttrLink ptlAgreementProductCostsAttrLink) {
-        PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = ptlAgreementUndwrtRulesAttr.getDictLabal().stream().filter(x ->
-                x.getCode().equals(ptlAgreementProductCostsAttrLink.getMin())).findAny().get();
-        return ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + ptlAgreementUndwrtRulesDictLabal.getName();
+        if(ptlAgreementProductCostsAttrLink.getMin() != null) {
+            PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = ptlAgreementUndwrtRulesAttr.getDictLabal().stream().filter(x ->
+                    x.getCode().equals(ptlAgreementProductCostsAttrLink.getMin())).findAny().get();
+            return ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + ptlAgreementUndwrtRulesDictLabal.getName();
+        }
+        return "";
     }
 
     private String inputNumberIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementProductCostsAttrLink ptlAgreementProductCostsAttrLink) {
@@ -385,6 +388,7 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
                 .eq(PtlAgreementProductCostsNew::getProductId, productId)
                 .lt(PtlAgreementProductCostsNew::getCostsStartDate, formattedDateTime)
                 .gt(PtlAgreementProductCostsNew::getCostsEndDate, formattedDateTime)
+                .eq(PtlAgreementProductCostsNew::getIsAudit, "1")//查找审核已通过的
                 .orderBy(true, true, PtlAgreementProductCostsNew::getPriorityLevel));
 
         List<AgreementProductCosts> agreementProductCosts = new ArrayList<>();
@@ -463,6 +467,7 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
         //遍历费用属性
         List<PtlAgreementProductCostsAttrLink> costsAttrLinks = agreementProductCosts.getCostsAttrLinks();
         List<PtlAgreementProductCostsAttrLink> costsAttrLink = new ArrayList<>();
+        List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList();
         costsAttrLinks.forEach(x -> {
             PtlAgreementProductCostsAttrLinkHistory costsAttrLinkHistory = new PtlAgreementProductCostsAttrLinkHistory();
             //处理中文逗号
@@ -470,6 +475,7 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
             {
                 x.setMin(x.getMin().replace(",",","));
             }
+            PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = undwrtRulesAttrList.stream().filter(y -> y.getAttrCode().equals(x.getAttrCode())).findFirst().get();
 
             //单独处理车牌号
             if ("LicenseNo".equals(x.getAttrCode()) && (x.getMin() != null && !x.getMin().equals(""))) {
@@ -487,7 +493,7 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
                 costsAttrLinkHistory.setOperatorTime(LocalDateTime.now());
                 costsAttrLinkHistories.add(costsAttrLinkHistory);
             } else {
-                if ((!"0".equals(x.getMin()) && null != x.getMin()) || (!"0".equals(x.getMax()) && null != x.getMax())) {
+                if (ptlAgreementUndwrtRulesAttr.getAttrType().equals("radio") || (!"0".equals(x.getMin()) && null != x.getMin()) || (!"0".equals(x.getMax()) && null != x.getMax())) {
 
                     x.setCostsId(ptlAgreementProductCostsNew.getId());
                     x.setId(0);
@@ -528,6 +534,8 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
         //更新费用主表信息
         PtlAgreementProductCostsNew ptlAgreementProductCostsNew = new PtlAgreementProductCostsNew();
         BeanUtils.copyProperties(agreementProductCosts, ptlAgreementProductCostsNew);
+        //修改审核状态为未审核
+        ptlAgreementProductCostsNew.setIsAudit(0);
         int update = baseMapper.updateById(ptlAgreementProductCostsNew);
 
         //更新费用出口表信息

+ 37 - 0
src/main/resources/mapper/modules/admin/SysAmountAuditingMapper.xml

@@ -127,9 +127,46 @@
             <if test="startDate !=null and startDate != ''  and  endDate !=null  and  endDate!= '' ">
                 and DATE_FORMAT( a.auditing_time, '%Y-%m-%d')  between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
             </if>
+            <if test="timeFiltering !=null and timeFiltering != '' ">
+             AND   DATE_FORMAT(a.auditing_time, '%Y-%m') = #{timeFiltering}
+            </if>
         </where>
 
     </select>
 
+    <select id="getProgressIng" resultType="com.ydtech.modules.admin.model.po.SysAmountAuditingEntity">
+        SELECT
+        a.user_id as "userId",
+        sum( a.amount ) as "amount",
+        a.amount_status as "amountStatus"
+        FROM
+        sys_amount_auditing a
+
+        <where>
+            <if test="auditingStatus !=null  and auditingStatus != ''">
+                a.auditing_status=#{auditingStatus}
+            </if>
+            <if test="amountStatus !=null  and amountStatus != ''">
+                and a.amount_status=#{amountStatus}
+            </if>
+
+            <if test="id !=null  and id != ''">
+                and a.id=#{id}
+            </if>
+
+
+            <if test="userId !=null  and userId != ''">
+                and a.user_id=#{userId}
+            </if>
+
+            <if test="startDate !=null and startDate != ''  and  endDate !=null  and  endDate!= '' ">
+                and DATE_FORMAT( a.auditing_time, '%Y-%m-%d')  between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
+            </if>
+        </where>
+        GROUP BY
+        user_id,
+        amount_status
+    </select>
+
 
 </mapper>

+ 5 - 0
src/main/resources/mapper/modules/admin/SysUserAccountMapper.xml

@@ -80,5 +80,10 @@
         </where>
     </select>
 
+    <select id="selectPromotionBy" resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
+        select 
+
+    </select>
+
 
 </mapper>

+ 2 - 0
src/main/resources/mapper/modules/admin/SysUserLinkPtlAgreementMapper.xml

@@ -67,6 +67,7 @@
                 and  link.user_id =  #{userId}
             </if>
         </where>
+        order by agree.agreement_code
     </select>
 
     <select id="findAllPtlAgreementListByUserId"  resultType="com.ydtech.modules.protocol.entity.po.PtlAgreement">
@@ -83,5 +84,6 @@
             )  as flag
         FROM
             ptl_agreement pl
+        order by agreement_code
     </select>
 </mapper>

+ 71 - 5
src/main/resources/mapper/modules/admin/SysUserMapper.xml

@@ -159,6 +159,9 @@
             <if test='user.deptId !=null and user.deptId!=""  '>
                 and su.dept_id like concat('%',#{user.deptId},'%')
             </if>
+            <if test='user.leaderName !=null and user.leaderName!=""  '>
+                and su.leader_name like concat('%',#{user.leaderName},'%')
+            </if>
             <if test='user.roleId !=null and user.roleId!=""  '>
                 and t3.role_id in (${user.roleId})
             </if>
@@ -212,6 +215,9 @@
             <if test='user.deptId !=null and user.deptId!=""  '>
                 and su.dept_id like concat('%',#{user.deptId},'%')
             </if>
+            <if test='user.leaderName !=null and user.leaderName!=""  '>
+                and su.leader_name like concat('%',#{user.leaderName},'%')
+            </if>
             <if test="user.agentFlag !=null and user.agentFlag != 0 ">
                 and sd.management_source = #{user.agentFlag}
             </if>
@@ -391,11 +397,8 @@
         RIGHT JOIN ins_area_company iac ON iac.orderno = io.orderno
         WHERE
         iac.orderstatus IN ( 1, 2, 3 )
-        <if test="quUserNumDto.createTimeStart != null">
-            and io.createtime &gt;= #{quUserNumDto.createTimeStart}
-        </if>
-        <if test="quUserNumDto.createTimeEnd != null">
-            and io.createtime &lt;= #{quUserNumDto.createTimeEnd}
+        <if test="quUserNumDto.createTimeStart != null and quUserNumDto.createTimeEnd != null">
+            and io.createtime BETWEEN #{quUserNumDto.createTimeStart} AND #{quUserNumDto.createTimeEnd}
         </if>
         <if test="quUserNumDto.userIds != null">
             and io.userid IN
@@ -423,6 +426,9 @@
         RIGHT JOIN ins_area_company iac ON iac.orderno = io.orderno
         WHERE
         iac.orderstatus IN ( 1, 2, 3 )
+        <if test="quUserNumDto.createTimeStart != null and quUserNumDto.createTimeEnd != null">
+            and io.createtime BETWEEN #{quUserNumDto.createTimeStart} AND #{quUserNumDto.createTimeEnd}
+        </if>
         <if test="quUserNumDto.userIds != null">
             and io.userid IN
             <foreach collection="quUserNumDto.userIds" item="id" index="index" open="(" close=")" separator=",">
@@ -508,4 +514,64 @@
             </if>
         </if>
     </select>
+
+    <select id="getDeptIdsByRoleIdsAndUserIds" resultType="String">
+        SELECT
+            sd2.id
+        FROM
+            sys_user t1
+                LEFT JOIN sys_dept t2 ON t1.dept_id = t2.id
+                LEFT JOIN sys_dept sd2 ON sd2.id = t2.parent_id
+                LEFT JOIN sys_user_role sur ON sur.user_id = t1.id
+        WHERE
+            t1.`status` = 1
+            <if test="userIds != null and userIds.size>0" >
+                AND
+                t1.id IN
+                <foreach collection="userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        <if test="roleIds != null and roleIds.size>0" >
+            AND
+            sur.role_id IN
+            <foreach collection="roleIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY sd2.id
+    </select>
+
+    <select id="findUserListByPage" resultType="com.ydtech.modules.admin.model.vo.SysUserBaseVO">
+        SELECT
+            t1.id AS userId,
+            t1.NAME AS NAME,
+            t1.mobile AS mobile,
+            t1.`status` AS `status`,
+            t2.id AS deptId,
+            t2.`name` AS deptName,
+            sd2.id AS pDeptId,
+            sd2.`name` AS pDeptName
+        FROM
+            sys_user t1
+                LEFT JOIN sys_dept t2 ON t1.dept_id = t2.id
+                LEFT JOIN sys_dept sd2 ON sd2.id = t2.parent_id
+        WHERE
+            t1.`status` = 1
+          AND t1.id NOT LIKE '%M%'
+        <if test='user !=null  '>
+            <if test='user.name !=null and user.name!="" '>
+                and t1.name like CONCAT('%', #{user.name}, '%')
+            </if>
+            <if test='user.userId !=null and user.userId!="" '>
+                and t1.id = #{user.userId}
+            </if>
+            <if test='user.mobile !=null and user.mobile!=""  '>
+                and t1.mobile = #{user.mobile}
+            </if>
+            <if test='user.deptId !=null and user.deptId!=""  '>
+                and t2.id = #{user.deptId}
+            </if>
+        </if>
+    </select>
 </mapper>

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

@@ -0,0 +1,191 @@
+<?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.protocols.dao.InsFeeOrderNewMapper">
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
+        <id column="id" property="id"/>
+        <result column="ins_order_no" property="insOrderNo"/>
+        <result column="agreement_id" property="agreementId"/>
+        <result column="costs_id" property="costsId"/>
+        <result column="dept_id" property="deptId"/>
+        <result column="user_id" property="userId"/>
+        <result column="jq_premium" property="jqPremium"/>
+        <result column="sy_premium" property="syPremium"/>
+        <result column="no_premium" property="noPremium"/>
+        <result column="jq_no_tax_premium" property="jqNoTaxPremium"/>
+        <result column="sy_no_tax_premium" property="syNoTaxPremium"/>
+        <result column="no_no_tax_premium" property="noNoTaxPremium"/>
+        <result column="jq_costs_proportion" property="jqCostsProportion"/>
+        <result column="jq_costs_premiums" property="jqCostsPremiums"/>
+        <result column="sy_costs_proportion" property="syCostsProportion"/>
+        <result column="sy_costs_premiums" property="syCostsPremiums"/>
+        <result column="no_costs_proportion" property="noCostsProportion"/>
+        <result column="no_costs_premiums" property="noCostsPremiums"/>
+        <result column="jq_supervise_costs_proportion" property="jqSuperviseCostsProportion"/>
+        <result column="jq_supervise_costs_premiums" property="jqSuperviseCostsPremiums"/>
+        <result column="sy_supervise_costs_proportion" property="sySuperviseCostsProportion"/>
+        <result column="sy_supervise_costs_premiums" property="sySuperviseCostsPremiums"/>
+        <result column="no_supervise_costs_proportion" property="noSuperviseCostsProportion"/>
+        <result column="no_supervise_costs_premiums" property="noSuperviseCostsPremiums"/>
+        <result column="jq_other_costs_proportion" property="jqOtherCostsProportion"/>
+        <result column="jq_other_costs_premiums" property="jqOtherCostsPremiums"/>
+        <result column="sy_other_costs_proportion" property="syOtherCostsProportion"/>
+        <result column="sy_other_costs_premiums" property="syOtherCostsPremiums"/>
+        <result column="no_other_costs_proportion" property="noOtherCostsProportion"/>
+        <result column="no_other_costs_premiums" property="noOtherCostsPremiums"/>
+        <result column="jq_investment_costs_proportion" property="jqInvestmentCostsProportion"/>
+        <result column="jq_investment_costs_premiums" property="jqInvestmentCostsPremiums"/>
+        <result column="sy_investment_costs_proportion" property="syInvestmentCostsProportion"/>
+        <result column="sy_investment_costs_premiums" property="syInvestmentCostsPremiums"/>
+        <result column="jq_dept_proportion_level_1" property="jqDeptProportionLevel1"/>
+        <result column="jq_dept_premiums_level_1" property="jqDeptPremiumsLevel1"/>
+        <result column="sy_dept_proportion_level_1" property="syDeptProportionLevel1"/>
+        <result column="sy_dept_premiums_level_1" property="syDeptPremiumsLevel1"/>
+        <result column="no_dept_proportion_level_1" property="noDeptProportionLevel1"/>
+        <result column="no_dept_premiums_level_1" property="noDeptPremiumsLevel1"/>
+        <result column="jq_dept_proportion_level_2" property="jqDeptProportionLevel2"/>
+        <result column="jq_dept_premiums_level_2" property="jqDeptPremiumsLevel2"/>
+        <result column="sy_dept_proportion_level_2" property="syDeptProportionLevel2"/>
+        <result column="sy_dept_premiums_level_2" property="syDeptPremiumsLevel2"/>
+        <result column="no_dept_proportion_level_2" property="noDeptProportionLevel2"/>
+        <result column="no_dept_premiums_level_2" property="noDeptPremiumsLevel2"/>
+        <result column="jq_dept_proportion_level_3" property="jqDeptProportionLevel3"/>
+        <result column="jq_dept_premiums_level_3" property="jqDeptPremiumsLevel3"/>
+        <result column="sy_dept_proportion_level_3" property="syDeptProportionLevel3"/>
+        <result column="sy_dept_premiums_level_3" property="syDeptPremiumsLevel3"/>
+        <result column="no_dept_proportion_level_3" property="noDeptProportionLevel3"/>
+        <result column="no_dept_premiums_level_3" property="noDeptPremiumsLevel3"/>
+        <result column="jq_dept_proportion_level_4" property="jqDeptProportionLevel4"/>
+        <result column="jq_dept_premiums_level_4" property="jqDeptPremiumsLevel4"/>
+        <result column="sy_dept_proportion_level_4" property="syDeptProportionLevel4"/>
+        <result column="sy_dept_premiums_level_4" property="syDeptPremiumsLevel4"/>
+        <result column="no_dept_proportion_level_4" property="noDeptProportionLevel4"/>
+        <result column="no_dept_premiums_level_4" property="noDeptPremiumsLevel4"/>
+        <result column="jq_dept_proportion_level_5" property="jqDeptProportionLevel5"/>
+        <result column="jq_dept_premiums_level_5" property="jqDeptPremiumsLevel5"/>
+        <result column="sy_dept_proportion_level_5" property="syDeptProportionLevel5"/>
+        <result column="sy_dept_premiums_level_5" property="syDeptPremiumsLevel5"/>
+        <result column="no_dept_proportion_level_5" property="noDeptProportionLevel5"/>
+        <result column="no_dept_premiums_level_5" property="noDeptPremiumsLevel5"/>
+        <result column="jq_costs_export_proportion" property="jqCostsExportProportion"/>
+        <result column="sy_costs_export_proportion" property="syCostsExportProportion"/>
+        <result column="no_costs_export_proportion" property="noCostsExportProportion"/>
+        <result column="jq_export_investment_proportion" property="jqExportInvestmentProportion"/>
+        <result column="jq_export_investment_premiums" property="jqExportInvestmentPremiums"/>
+        <result column="sy_export_investment_proportion" property="syExportInvestmentProportion"/>
+        <result column="sy_export_investment_premiums" property="syExportInvestmentPremiums"/>
+        <result column="first_detail_proportion" property="firstDetailProportion"/>
+        <result column="first_detail_premiums" property="firstDetailPremiums"/>
+        <result column="second_detail_proportion" property="secondDetailProportion"/>
+        <result column="second_detail_premiums" property="secondDetailPremiums"/>
+        <result column="third_detail_proportion" property="thirdDetailProportion"/>
+        <result column="third_detail_premiums" property="thirdDetailPremiums"/>
+        <result column="create_time" property="createTime"/>
+        <result column="first_level_user_id" property="firstLevelUserId"/>
+        <result column="two_level_user_id" property="twoLevelUserId"/>
+        <result column="three_level_user_id" property="threeLevelUserId"/>
+        <result column="distribution_status" property="distributionStatus"/>
+        <result column="dept_distribution" property="deptDistribution"/>
+    </resultMap>
+
+
+    <select id="getInsFeeOrderEntity" resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
+        select
+            a.id  as "id",
+            a.ins_order_no  as "insOrderNo",
+            a.agreement_id  as "agreementId",
+            a.costs_id  as "costsId",
+            a.dept_id  as "deptId",
+            a.user_id  as "userId",
+            a.jq_premium  as "jqPremium",
+            a.sy_premium  as "syPremium",
+            a.no_premium  as "noPremium",
+            a.jq_no_tax_premium  as "jqNoTaxPremium",
+            a.sy_no_tax_premium  as "syNoTaxPremium",
+            a.no_no_tax_premium  as "noNoTaxPremium",
+            a.jq_costs_proportion  as "jqCostsProportion",
+            a.jq_costs_premiums  as "jqCostsPremiums",
+            a.sy_costs_proportion  as "syCostsProportion",
+            a.sy_costs_premiums  as "syCostsPremiums",
+            a.no_costs_proportion  as "noCostsProportion",
+            a.no_costs_premiums  as "noCostsPremiums",
+            a.jq_supervise_costs_proportion  as "jqSuperviseCostsProportion",
+            a.jq_supervise_costs_premiums  as "jqSuperviseCostsPremiums",
+            a.sy_supervise_costs_proportion  as "sySuperviseCostsProportion",
+            a.sy_supervise_costs_premiums  as "sySuperviseCostsPremiums",
+            a.no_supervise_costs_proportion  as "noSuperviseCostsProportion",
+            a.no_supervise_costs_premiums  as "noSuperviseCostsPremiums",
+            a.jq_other_costs_proportion  as "jqOtherCostsProportion",
+            a.jq_other_costs_premiums  as "jqOtherCostsPremiums",
+            a.sy_other_costs_proportion  as "syOtherCostsProportion",
+            a.sy_other_costs_premiums  as "syOtherCostsPremiums",
+            a.no_other_costs_proportion  as "noOtherCostsProportion",
+            a.no_other_costs_premiums  as "noOtherCostsPremiums",
+            a.jq_investment_costs_proportion  as "jqInvestmentCostsProportion",
+            a.jq_investment_costs_premiums  as "jqInvestmentCostsPremiums",
+            a.sy_investment_costs_proportion  as "syInvestmentCostsProportion",
+            a.sy_investment_costs_premiums  as "syInvestmentCostsPremiums",
+            a.jq_dept_proportion_level_1  as "jqDeptProportionLevel1",
+            a.jq_dept_premiums_level_1  as "jqDeptPremiumsLevel1",
+            a.sy_dept_proportion_level_1  as "syDeptProportionLevel1",
+            a.sy_dept_premiums_level_1  as "syDeptPremiumsLevel1",
+            a.no_dept_proportion_level_1  as "noDeptProportionLevel1",
+            a.no_dept_premiums_level_1  as "noDeptPremiumsLevel1",
+            a.jq_dept_proportion_level_2  as "jqDeptProportionLevel2",
+            a.jq_dept_premiums_level_2  as "jqDeptPremiumsLevel2",
+            a.sy_dept_proportion_level_2  as "syDeptProportionLevel2",
+            a.sy_dept_premiums_level_2  as "syDeptPremiumsLevel2",
+            a.no_dept_proportion_level_2  as "noDeptProportionLevel2",
+            a.no_dept_premiums_level_2  as "noDeptPremiumsLevel2",
+            a.jq_dept_proportion_level_3  as "jqDeptProportionLevel3",
+            a.jq_dept_premiums_level_3  as "jqDeptPremiumsLevel3",
+            a.sy_dept_proportion_level_3  as "syDeptProportionLevel3",
+            a.sy_dept_premiums_level_3  as "syDeptPremiumsLevel3",
+            a.no_dept_proportion_level_3  as "noDeptProportionLevel3",
+            a.no_dept_premiums_level_3  as "noDeptPremiumsLevel3",
+            a.jq_dept_proportion_level_4  as "jqDeptProportionLevel4",
+            a.jq_dept_premiums_level_4  as "jqDeptPremiumsLevel4",
+            a.sy_dept_proportion_level_4  as "syDeptProportionLevel4",
+            a.sy_dept_premiums_level_4  as "syDeptPremiumsLevel4",
+            a.no_dept_proportion_level_4  as "noDeptProportionLevel4",
+            a.no_dept_premiums_level_4  as "noDeptPremiumsLevel4",
+            a.jq_dept_proportion_level_5  as "jqDeptProportionLevel5",
+            a.jq_dept_premiums_level_5  as "jqDeptPremiumsLevel5",
+            a.sy_dept_proportion_level_5  as "syDeptProportionLevel5",
+            a.sy_dept_premiums_level_5  as "syDeptPremiumsLevel5",
+            a.no_dept_proportion_level_5  as "noDeptProportionLevel5",
+            a.no_dept_premiums_level_5  as "noDeptPremiumsLevel5",
+            a.jq_costs_export_proportion  as "jqCostsExportProportion",
+            a.sy_costs_export_proportion  as "syCostsExportProportion",
+            a.no_costs_export_proportion  as "noCostsExportProportion",
+            a.jq_export_investment_proportion  as "jqExportInvestmentProportion",
+            a.jq_export_investment_premiums  as "jqExportInvestmentPremiums",
+            a.sy_export_investment_proportion  as "syExportInvestmentProportion",
+            a.sy_export_investment_premiums  as "syExportInvestmentPremiums",
+            a.first_detail_proportion  as "firstDetailProportion",
+            a.first_detail_premiums  as "firstDetailPremiums",
+            a.second_detail_proportion  as "secondDetailProportion",
+            a.second_detail_premiums  as "secondDetailPremiums",
+            a.third_detail_proportion  as "thirdDetailProportion",
+            a.third_detail_premiums  as "thirdDetailPremiums",
+            a.create_time  as "createTime",
+            a.first_level_user_id  as "firstLevelUserId",
+            a.two_level_user_id  as "twoLevelUserId",
+            a.three_level_user_id  as "threeLevelUserId",
+            a.distribution_status  as "distributionStatus",
+            a.dept_distribution  as "deptDistribution",
+            iac.signing_time  as  "signingTime",
+            io.licenseno  as  "licenseno"
+            from   ins_fee_order_new  a
+            LEFT JOIN   ins_area_company iac on iac.id=a.ins_order_no
+            LEFT JOIN   ins_orders  io on io.quoteno =iac.id
+            <where>
+                1=1
+                <if test="id !=null and id !=''">
+                 AND     a.ins_order_no=#{id}
+                </if>
+            </where>
+
+    </select>
+
+
+</mapper>

+ 129 - 0
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -166,6 +166,135 @@
         </if>
     </select>
 
+    <select id="getByUserId" resultType="com.ydtech.modules.order.entity.InsOrders">
+        SELECT
+        *
+        FROM
+        ins_orders
+        WHERE
+        orderno IN (
+        SELECT
+        orderno
+        FROM
+        ins_area_company
+        WHERE
+        id IN ( SELECT ins_order_no FROM ins_fee_order_new WHERE id NOT IN ( SELECT ins_order_no FROM ins_fee_audit ) )
+        AND orderstatus = 3
+        )
+        AND
+        orderstatus= 3
+        <if test="orderNo != null and orderNo != ''">
+            AND orderno = #{orderNo}
+        </if>
+        <if test="licenseNo != null and licenseNo != ''">
+            AND licenseno = #{licenseNo}
+        </if>
+        <if test="frameNo != null and frameNo != ''">
+            AND frameno = #{frameNo}
+        </if>
+
+        <if test="userId != null and userId != ''">
+            AND userid = #{userId}
+        </if>
+
+        <if test="insuredname != null and insuredname != ''">
+            AND insuredname = #{insuredname}
+        </if>
+        <if test="startDateStr != null and startDateStr != ''">
+            AND createtime BETWEEN #{startDateStr} and #{endDateStr}
+        </if>
+    </select>
+
+
+    <select id="selectFirstPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
+        SELECT
+        sum(a.first_detail_premiums) as  "willFirstPremiums"
+        FROM
+        ins_fee_order_new  a
+        LEFT JOIN  ins_area_company  iac  on  iac.id=a.ins_order_no
+        WHERE
+        a.id NOT IN (
+        SELECT
+        ins_order_no
+        FROM
+        ins_fee_audit
+        )
+        AND   iac.orderstatus =3
+        <if test="firstUserId != null and firstUserId != ''">
+             AND  a.first_level_user_id = #{firstUserId}
+        </if>
+        <if test="secondUserId != null and secondUserId != ''">
+             AND  a.two_level_user_id = #{secondUserId}
+        </if>
+
+        <if test="thirdUserId != null and thirdUserId != ''">
+             AND  a.three_level_user_id = #{thirdUserId}
+        </if>
+
+         <if test="id != null and id != ''">
+             AND  a.id = #{id}
+        </if>
+    </select>
+    <select id="selectSecondPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
+        SELECT
+        sum(a.second_detail_premiums) as  "willSecondPremiums"
+        FROM
+        ins_fee_order_new  a
+        LEFT JOIN  ins_area_company  iac  on  iac.id=a.ins_order_no
+        WHERE
+        a.id NOT IN (
+        SELECT
+        ins_order_no
+        FROM
+        ins_fee_audit
+        )
+        AND   iac.orderstatus =3
+        <if test="firstUserId != null and firstUserId != ''">
+             AND  a.first_level_user_id = #{firstUserId}
+        </if>
+        <if test="secondUserId != null and secondUserId != ''">
+             AND  a.two_level_user_id = #{secondUserId}
+        </if>
+
+        <if test="thirdUserId != null and thirdUserId != ''">
+             AND  a.three_level_user_id = #{thirdUserId}
+        </if>
+        <if test="id != null and id != ''">
+            AND  a.id = #{id}
+        </if>
+
+    </select>
+    <select id="selectThirdPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
+        SELECT
+        sum(a.third_detail_premiums) as  "willThreePremiums"
+
+        FROM
+        ins_fee_order_new  a
+        LEFT JOIN  ins_area_company  iac  on  iac.id=a.ins_order_no
+        WHERE
+        a.id NOT IN (
+        SELECT
+        ins_order_no
+        FROM
+        ins_fee_audit
+        )
+        AND   iac.orderstatus =3
+        <if test="firstUserId != null and firstUserId != ''">
+             AND  a.first_level_user_id = #{firstUserId}
+        </if>
+        <if test="secondUserId != null and secondUserId != ''">
+             AND  a.two_level_user_id = #{secondUserId}
+        </if>
+
+        <if test="thirdUserId != null and thirdUserId != ''">
+             AND  a.three_level_user_id = #{thirdUserId}
+        </if>
+        <if test="id != null and id != ''">
+            AND  a.id = #{id}
+        </if>
+
+    </select>
+
 
     <select id="getAlreadyAuditOrders" resultType="com.ydtech.modules.order.entity.InsOrders">
         SELECT

+ 61 - 26
src/main/resources/mapper/modules/order/InsOrdersMapper.xml

@@ -811,7 +811,36 @@
         left JOIN
              ins_orders io  on iac.orderno = io.orderno
         <where>
-             ( (iac.new_operator_id is null or iac.new_operator_id ='') or iac.new_operator_id =#{orderQueryVo.userId} or   iac.operator_id =#{orderQueryVo.userId})
+            <if test="agentUserIds != null and agentUserIds.size>0" >
+                AND (
+                (io.userid in
+                <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+                AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = '' )
+                <if test="deptIds != null and deptIds.size>0" >
+                    AND (
+                    <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
+                        io.deptid like CONCAT('%', #{item}, '%')
+                    </foreach>
+                    )
+                </if>
+                )
+                OR iac.new_operator_id = #{orderQueryVo.userId}
+                OR iac.operator_id = #{orderQueryVo.userId}
+                )
+            </if>
+            <if test="agreeIds != null and agreeIds.size>0">
+                AND (
+                (iac.agreement_id in
+                <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+                AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = '' ) )
+                OR iac.new_operator_id = #{orderQueryVo.userId}
+                OR iac.operator_id = #{orderQueryVo.userId}
+                )
+            </if>
             <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
                 and io.orderno = #{orderQueryVo.orderNo}
             </if>
@@ -836,18 +865,7 @@
             <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
                 and iac.company_id = #{orderQueryVo.companyId}
             </if>
-            <if test="agentUserIds != null and agentUserIds.size>0" >
-                and io.userid in
-                <foreach collection="agentUserIds" item="item"  open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="agreeIds != null and agreeIds.size>0" >
-                and iac.agreement_id in
-                <foreach collection="agreeIds" item="item"  open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
+
         </where>
         order by io.createtime desc
     </select>
@@ -863,7 +881,36 @@
             left JOIN
         ins_orders io  on iac.orderno = io.orderno
         <where>
-            ( (iac.new_operator_id is null or iac.new_operator_id ='') or iac.new_operator_id =#{orderQueryVo.userId} or   iac.operator_id =#{orderQueryVo.userId})
+            <if test="agentUserIds != null and agentUserIds.size>0" >
+                AND (
+                (io.userid in
+                <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+                AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = '' )
+                <if test="deptIds != null and deptIds.size>0" >
+                    AND (
+                    <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
+                        io.deptid like CONCAT('%', #{item}, '%')
+                    </foreach>
+                    )
+                </if>
+                )
+                OR iac.new_operator_id = #{orderQueryVo.userId}
+                OR iac.operator_id = #{orderQueryVo.userId}
+                )
+            </if>
+            <if test="agreeIds != null and agreeIds.size>0">
+                AND (
+                (iac.agreement_id in
+                <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+                AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = '' ) )
+                OR iac.new_operator_id = #{orderQueryVo.userId}
+                OR iac.operator_id = #{orderQueryVo.userId}
+                )
+            </if>
             <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
                 and io.orderno = #{orderQueryVo.orderNo}
             </if>
@@ -888,18 +935,6 @@
             <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
                 and iac.company_id = #{orderQueryVo.companyId}
             </if>
-            <if test="agentUserIds != null and agentUserIds.size>0" >
-                and io.userid in
-                <foreach collection="agentUserIds" item="item"  open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="agreeIds != null and agreeIds.size>0" >
-                and iac.agreement_id in
-                <foreach collection="agreeIds" item="item"  open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
         </where>
         ) as s
     </select>