Sfoglia il codice sorgente

Merge branch 'test' into test-qc

dongxin 1 anno fa
parent
commit
8670ec9072
100 ha cambiato i file con 3772 aggiunte e 500 eliminazioni
  1. 5 0
      pom.xml
  2. 20 0
      sql/Online.sql
  3. 4 1
      src/main/java/com/ydtech/SpringInsApplication.java
  4. 3 0
      src/main/java/com/ydtech/components/TokenInterceptor.java
  5. 125 0
      src/main/java/com/ydtech/config/RabbitMQConfig.java
  6. 1 1
      src/main/java/com/ydtech/config/resttemplate/RestTemplateConfig.java
  7. 14 1
      src/main/java/com/ydtech/constants/RabbitMqEnum.java
  8. 9 0
      src/main/java/com/ydtech/constants/enums/dict/organization/OrganizationSource.java
  9. 32 0
      src/main/java/com/ydtech/modules/admin/constants/BusinessTypeEnum.java
  10. 39 0
      src/main/java/com/ydtech/modules/admin/constants/MessageConstants.java
  11. 30 0
      src/main/java/com/ydtech/modules/admin/constants/MessageModelConstants.java
  12. 2 2
      src/main/java/com/ydtech/modules/admin/controller/PushOrder.java
  13. 6 2
      src/main/java/com/ydtech/modules/admin/controller/SysQyWeChatController.java
  14. 26 1
      src/main/java/com/ydtech/modules/admin/controller/SysUserAccountController.java
  15. 66 0
      src/main/java/com/ydtech/modules/admin/controller/deptBalance/DeptBalanceController.java
  16. 25 0
      src/main/java/com/ydtech/modules/admin/controller/profitAnalysis/ProfitAnalysisController.java
  17. 194 0
      src/main/java/com/ydtech/modules/admin/controller/websocket/SendMessageServer.java
  18. 7 0
      src/main/java/com/ydtech/modules/admin/dao/DeptBalanceMapper.java
  19. 3 0
      src/main/java/com/ydtech/modules/admin/dao/SysPartnerAccountMapper.java
  20. 6 0
      src/main/java/com/ydtech/modules/admin/dao/SysPremiumDetailsMapper.java
  21. 17 3
      src/main/java/com/ydtech/modules/admin/dao/SysUserAccountMapper.java
  22. 4 0
      src/main/java/com/ydtech/modules/admin/dao/SysUserRoleMapper.java
  23. 6 0
      src/main/java/com/ydtech/modules/admin/model/dto/DeptBalanceDto.java
  24. 34 0
      src/main/java/com/ydtech/modules/admin/model/dto/PayAmountExcel.java
  25. 65 0
      src/main/java/com/ydtech/modules/admin/model/dto/ReceivableExcel.java
  26. 67 0
      src/main/java/com/ydtech/modules/admin/model/dto/SysPartnerConsoleDto.java
  27. 34 0
      src/main/java/com/ydtech/modules/admin/model/dto/SysPartnerInfoConsoleDto.java
  28. 7 0
      src/main/java/com/ydtech/modules/admin/model/po/SysQyWeChat.java
  29. 6 1
      src/main/java/com/ydtech/modules/admin/model/po/SysUserAccount.java
  30. 23 0
      src/main/java/com/ydtech/modules/admin/model/vo/DeptBalanceVo.java
  31. 3 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysUserAccountVo.java
  32. 27 0
      src/main/java/com/ydtech/modules/admin/service/DeptBalanceService.java
  33. 13 0
      src/main/java/com/ydtech/modules/admin/service/ProfitAnalysisService.java
  34. 18 1
      src/main/java/com/ydtech/modules/admin/service/SysUserAccountService.java
  35. 812 84
      src/main/java/com/ydtech/modules/admin/service/impl/DeptBalanceServiceImpl.java
  36. 64 3
      src/main/java/com/ydtech/modules/admin/service/impl/ProfitAnalysisServiceImpl.java
  37. 36 1
      src/main/java/com/ydtech/modules/admin/service/impl/SysDeptServiceImpl.java
  38. 115 196
      src/main/java/com/ydtech/modules/admin/service/impl/SysPartnerServiceImpl.java
  39. 41 3
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java
  40. 112 4
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java
  41. 4 1
      src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java
  42. 4 1
      src/main/java/com/ydtech/modules/admin/utils/SliceUpDateUtil.java
  43. 12 1
      src/main/java/com/ydtech/modules/console/dao/ProfitAnalysisMapper.java
  44. 4 4
      src/main/java/com/ydtech/modules/fnc/controller/CarSettleController.java
  45. 7 1
      src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java
  46. 7 1
      src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java
  47. 5 11
      src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java
  48. 10 0
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  49. 2 1
      src/main/java/com/ydtech/modules/inv/controller/InvAccountIncoiceController.java
  50. 6 0
      src/main/java/com/ydtech/modules/inv/model/InvAccountIncoice.java
  51. 35 1
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountIncoiceServiceImpl.java
  52. 2 0
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountServiceImpl.java
  53. 27 0
      src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java
  54. 14 0
      src/main/java/com/ydtech/modules/largescreen/controller/DataController.java
  55. 12 0
      src/main/java/com/ydtech/modules/largescreen/model/query/DataQuery.java
  56. 57 0
      src/main/java/com/ydtech/modules/lg/LgDataServer.java
  57. 60 1
      src/main/java/com/ydtech/modules/lg/PushLgLogUtils.java
  58. 1 1
      src/main/java/com/ydtech/modules/lg/PushRetry.java
  59. 42 5
      src/main/java/com/ydtech/modules/lg/SendUtils.java
  60. 7 0
      src/main/java/com/ydtech/modules/lg/dao/PushLgDataServerMapper.java
  61. 46 0
      src/main/java/com/ydtech/modules/lg/model/PushLgDataServer.java
  62. 9 0
      src/main/java/com/ydtech/modules/lg/service/PushLgDataServerService.java
  63. 30 0
      src/main/java/com/ydtech/modules/lg/service/impl/PushLgDataServerServiceImpl.java
  64. 52 0
      src/main/java/com/ydtech/modules/message/controller/SystemMessageController.java
  65. 13 0
      src/main/java/com/ydtech/modules/message/dao/SystemMessageMapper.java
  66. 69 0
      src/main/java/com/ydtech/modules/message/entity/SystemMessage.java
  67. 34 0
      src/main/java/com/ydtech/modules/message/entity/SystemMessageVo.java
  68. 42 0
      src/main/java/com/ydtech/modules/message/entity/dto/SystemMessageDTO.java
  69. 22 0
      src/main/java/com/ydtech/modules/message/service/SystemMessageService.java
  70. 119 0
      src/main/java/com/ydtech/modules/message/service/impl/SystemMessageServiceImpl.java
  71. 2 1
      src/main/java/com/ydtech/modules/order/components/zijin/ZijinDuplicateInsuranceComponents.java
  72. 17 7
      src/main/java/com/ydtech/modules/order/controller/InsOrderReadPdfController.java
  73. 25 0
      src/main/java/com/ydtech/modules/order/controller/QrCodeController.java
  74. 4 2
      src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java
  75. 72 0
      src/main/java/com/ydtech/modules/order/orderThread/OrderFailRunnableThread.java
  76. 20 12
      src/main/java/com/ydtech/modules/order/orderThread/OrderRunnableThread.java
  77. 72 0
      src/main/java/com/ydtech/modules/order/orderThread/OrderSignRunnableThread.java
  78. 7 0
      src/main/java/com/ydtech/modules/order/service/InsOrderPayDateRecordService.java
  79. 1 1
      src/main/java/com/ydtech/modules/order/service/InsOrderPushMsgService.java
  80. 7 0
      src/main/java/com/ydtech/modules/order/service/InsOrderReadPdfService.java
  81. 1 1
      src/main/java/com/ydtech/modules/order/service/impl/IdentifyServiceImpl.java
  82. 15 0
      src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java
  83. 132 70
      src/main/java/com/ydtech/modules/order/service/impl/InsOrderPayDateRecordServiceImpl.java
  84. 92 30
      src/main/java/com/ydtech/modules/order/service/impl/InsOrderPushMsgServiceImpl.java
  85. 45 0
      src/main/java/com/ydtech/modules/order/service/impl/InsOrderReadPdfServiceImpl.java
  86. 8 3
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  87. 3 0
      src/main/java/com/ydtech/modules/order/service/impl/SysQuoteConfigServiceImpl.java
  88. 42 0
      src/main/java/com/ydtech/modules/order/timer/UpdateOrderMQTimer.java
  89. 85 13
      src/main/java/com/ydtech/modules/order/timer/UpdateOrderTimer.java
  90. 1 1
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java
  91. 5 3
      src/main/java/com/ydtech/modules/ttqf/service/impl/TtqfServiceImpl.java
  92. 30 3
      src/main/resources/application-pre.yml
  93. 31 3
      src/main/resources/application-prod.yml
  94. 31 2
      src/main/resources/application-test.yml
  95. 33 1
      src/main/resources/mapper/modules/admin/DeptBalanceMapper.xml
  96. 21 0
      src/main/resources/mapper/modules/admin/SysPartnerAccountMapper.xml
  97. 5 3
      src/main/resources/mapper/modules/admin/SysPartnerMapper.xml
  98. 21 0
      src/main/resources/mapper/modules/admin/SysPremiumDetailsMapper.xml
  99. 66 11
      src/main/resources/mapper/modules/admin/SysUserAccountMapper.xml
  100. 3 0
      src/main/resources/mapper/modules/admin/SysUserMapper.xml

+ 5 - 0
pom.xml

@@ -678,6 +678,11 @@
             <artifactId>sunecm-url-encode-1</artifactId>
             <version>1.0.0</version>
         </dependency>
+        <!--add  by hxl  2024-11-22  mq-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-amqp</artifactId>
+        </dependency>
 
     </dependencies>
 

+ 20 - 0
sql/Online.sql

@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS `sys_message`;
+CREATE TABLE `sys_message`  (
+                                `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+                                `classify` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息分类 1-公告 2-系统通知 3-事件触发',
+                                `type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息类型 1-增员消息 2-审批消息 3-待办消息',
+                                `title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息标题',
+                                `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息内容',
+                                `jump` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否支持跳转 0-不支持 1-支持',
+                                `jump_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '跳转目标路径',
+                                `receiver_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息接收方',
+                                `sender_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息发送方',
+                                `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+                                `send_time` datetime(0) NULL DEFAULT NULL COMMENT '发送时间',
+                                `state` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态 0-未读  1-已读',
+                                `high_light` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '高亮字段',
+                                `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
+                                `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改者',
+                                `update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+                                PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '核心系统消息列表' ROW_FORMAT = Dynamic;

+ 4 - 1
src/main/java/com/ydtech/SpringInsApplication.java

@@ -1,9 +1,11 @@
 package com.ydtech;
 
+import com.ydtech.modules.admin.controller.websocket.SendMessageServer;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
@@ -37,7 +39,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 public class SpringInsApplication {
 
     public static void main(String[] args) {
-        SpringApplication.run(SpringInsApplication.class, args);
+        ConfigurableApplicationContext run = SpringApplication.run(SpringInsApplication.class, args);
+        SendMessageServer.setApplicationContext(run);
     }
 
 }

+ 3 - 0
src/main/java/com/ydtech/components/TokenInterceptor.java

@@ -88,6 +88,7 @@ public class TokenInterceptor {
 
         // 平安相关屏蔽地址
         notMatchList.add("/order/pingAnApi/getApplyVerifyCodeAndRecoverApplyVerifyCode");
+        notMatchList.add("/sysUserAccount/queryCount");
         notMatchList.add("/order/pingAnApi/recoverApplyVerifyCode");
         notMatchList.add("/order/pingAnApi/payReturn");
 
@@ -111,6 +112,8 @@ public class TokenInterceptor {
         notMatchList.add("/ttqf/aa/*");
         notMatchList.add("/ttqf/**");
 
+        notMatchList.add("/push/**");
+
         return new SaInterceptor(handler -> {
             // 指定一条 match 规则
             SaRouter

+ 125 - 0
src/main/java/com/ydtech/config/RabbitMQConfig.java

@@ -0,0 +1,125 @@
+package com.ydtech.config;
+
+import com.ydtech.constants.RabbitMqEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.amqp.core.*;
+import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
+import org.springframework.amqp.rabbit.connection.ConnectionFactory;
+import org.springframework.amqp.rabbit.connection.CorrelationData;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class RabbitMQConfig {
+
+    /**
+     * 消费者数量,默认10
+     */
+    public static final int DEFAULT_CONCURRENT = 10;
+
+    /**
+     * 每个消费者获取最大投递数量 默认50
+     */
+    public static final int DEFAULT_PREFETCH_COUNT = 50;
+
+    private final static Logger log = LoggerFactory.getLogger(RabbitMQConfig.class);
+
+    @Bean
+        //设置队列持久化 第二个参数  保证数据不丢失
+    Queue queue() {
+        return new Queue(RabbitMqEnum.ORDER_QUEUE.getCode(), true);
+    }
+
+    @Bean
+        //设置队列持久化 第二个参数  保证数据不丢失
+    Queue queueFail() {
+        return new Queue(RabbitMqEnum.ORDER_QUEUE_FAIL.getCode(), true);
+    }
+
+    @Bean
+        //设置队列持久化 第二个参数  保证数据不丢失
+    Queue queueSign() {
+        return new Queue(RabbitMqEnum.ORDER_QUEUE_SIGN.getCode(), true);
+    }
+
+    @Bean
+        //设置队列持久化 第二个参数  保证数据不丢失
+    DirectExchange exchange() {
+        return new DirectExchange(RabbitMqEnum.ORDER_EXCHANGE.getCode(),true,false);
+    }
+
+
+    @Bean
+        //设置队列持久化 第二个参数  保证数据不丢失
+    DirectExchange exchangeFail() {
+        return new DirectExchange(RabbitMqEnum.ORDER_EXCHANGE_FAIL.getCode(),true,false);
+    }
+
+    @Bean
+        //设置队列持久化 第二个参数  保证数据不丢失
+    DirectExchange exchangeSign() {
+        return new DirectExchange(RabbitMqEnum.ORDER_EXCHANGE_SIGN.getCode(),true,false);
+    }
+
+    @Bean
+    Binding binding(Queue queue, DirectExchange exchange) {
+        return BindingBuilder.bind(queue).to(exchange).with(RabbitMqEnum.ORDER_ROUTINGKEY.getCode());
+    }
+
+
+    @Bean
+    Binding bindingFail(Queue queueFail, DirectExchange exchangeFail) {
+        return BindingBuilder.bind(queueFail).to(exchangeFail).with(RabbitMqEnum.ORDER_ROUTINGKEY_FAIL.getCode());
+    }
+    @Bean
+    Binding bindingSign(Queue queueSign, DirectExchange exchangeSign) {
+        return BindingBuilder.bind(queueSign).to(exchangeSign).with(RabbitMqEnum.ORDER_ROUTINGKEY_SIGN.getCode());
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/11/5 10:27
+     *  @Description:  手动确认保证消息消费成功
+     */
+    @Bean
+    public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory) {
+        RabbitTemplate rabbitTemplate = new RabbitTemplate();
+        rabbitTemplate.setConnectionFactory(connectionFactory);
+        rabbitTemplate.setMandatory(true);
+        // 设置配置回调函数
+        rabbitTemplate.setConfirmCallback(new RabbitTemplate.ConfirmCallback() {
+            @Override
+            public void confirm(CorrelationData correlationData, boolean ack, String cause) {
+                log.info("ConfirmCallback:     " + "相关数据:" + correlationData);
+                log.info("ConfirmCallback:     " + "确认情况:" + ack);
+                log.info("ConfirmCallback:     " + "原因:" + cause);
+            }
+        });
+        rabbitTemplate.setReturnCallback(new RabbitTemplate.ReturnCallback() {
+            @Override
+            public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
+                log.info("ReturnCallback:     " + "消息:" + message);
+                log.info("ReturnCallback:     " + "回应码:" + replyCode);
+                log.info("ReturnCallback:     " + "回应信息:" + replyText);
+                log.info("ReturnCallback:     " + "交换机:" + exchange);
+                log.info("ReturnCallback:     " + "路由键:" + routingKey);
+            }
+        });
+        return rabbitTemplate;
+    }
+
+
+
+    @Bean
+    public SimpleRabbitListenerContainerFactory pointTaskContainerFactory(SimpleRabbitListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory) {
+        SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
+        factory.setPrefetchCount(DEFAULT_PREFETCH_COUNT);
+        factory.setConcurrentConsumers(DEFAULT_CONCURRENT);
+        factory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
+        configurer.configure(factory, connectionFactory);
+        return factory;
+    }
+}

+ 1 - 1
src/main/java/com/ydtech/config/resttemplate/RestTemplateConfig.java

@@ -41,7 +41,7 @@ public class RestTemplateConfig {
     private static final int IDLE_CONNECTIONS = 30;
 
     // 返回数据的超时时间
-    private static final int SOCKET_TIMEOUT = 60 * 1000;
+    private static final int SOCKET_TIMEOUT = 90 * 1000;
 
     // 连接上服务器的超时时间
     private static final int CONNECT_TIMEOUT = 3 * 1000;

+ 14 - 1
src/main/java/com/ydtech/constants/RabbitMqEnum.java

@@ -11,7 +11,20 @@ public enum RabbitMqEnum {
     ORDER_QUEUE("order_push_queue", "队列"),
     ORDER_EXCHANGE("order_push_exchange", "交换机"),
 
-    ORDER_ROUTINGKEY("order_push_routingKey", "关键字");
+    ORDER_ROUTINGKEY("order_push_routingKey", "关键字"),
+
+    ORDER_QUEUE_FAIL("order_push_fail_queue", "消息失败队列"),
+
+    ORDER_EXCHANGE_FAIL("order_push_fail_exchange", "失败交换机"),
+
+    ORDER_ROUTINGKEY_FAIL("order_push_fail_routingKey", "消息失败关键字"),
+
+    ORDER_QUEUE_SIGN("order_push_sign_queue", "承保订单队列"),
+
+    ORDER_EXCHANGE_SIGN("order_push_fail_exchange", "承保交换机"),
+
+
+    ORDER_ROUTINGKEY_SIGN("order_push_sign_routingKey", "承保订单关键字");
 
     private final String code;
     private final String desc;

+ 9 - 0
src/main/java/com/ydtech/constants/enums/dict/organization/OrganizationSource.java

@@ -29,6 +29,15 @@ public enum OrganizationSource implements IBaseEnum {
     // 状态  0 启用  1 不启用
     private final Integer status;
 
+    public static String getDescByCode(String code) {
+        for (OrganizationSource value : OrganizationSource.values()) {
+            if (value.code.equals(code)) {
+                return value.desc;
+            }
+        }
+        return null;
+    }
+
     @AllArgsConstructor
     @Getter
     public enum Source {

+ 32 - 0
src/main/java/com/ydtech/modules/admin/constants/BusinessTypeEnum.java

@@ -0,0 +1,32 @@
+package com.ydtech.modules.admin.constants;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+
+/**
+ * 开关
+ */
+@AllArgsConstructor
+@Getter
+public enum BusinessTypeEnum {
+
+    BUSINESS_TYPE_1("1", "个体户"),
+    BUSINESS_TYPE_2("2", "小规模"),
+    BUSINESS_TYPE_3("3", "一般纳税");
+
+    private final String code;
+
+    private final String type;
+
+    public static String getBusinessType(String code) {
+        for (BusinessTypeEnum roleConstants : BusinessTypeEnum.values()) {
+            if (roleConstants.getCode().equals(code)) {
+                return roleConstants.type;
+            }
+        }
+        return null;
+    }
+
+}

+ 39 - 0
src/main/java/com/ydtech/modules/admin/constants/MessageConstants.java

@@ -0,0 +1,39 @@
+package com.ydtech.modules.admin.constants;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+@Getter
+public enum MessageConstants {
+
+
+    CLASSIFY_1("1","公告", "CLASSIFY"),
+    CLASSIFY_2("2","系统通知", "CLASSIFY"),
+    CLASSIFY_3("3","事件触发", "CLASSIFY"),
+    TYPE_1("1","增员消息", "TYPE"),
+    TYPE_2("2","审批消息", "TYPE"),
+    TYPE_3("3","待办消息", "TYPE");
+
+    private final String code;
+    private final String name;
+    private final String type;
+
+    public static String getMessageConstants(String code) {
+        for (MessageConstants roleConstants : MessageConstants.values()) {
+            if (roleConstants.getCode().equals(code)) {
+                return roleConstants.name;
+            }
+        }
+        return null;
+    }
+
+    public static String getMessageByTypeAndCode(String code, String type) {
+        for (MessageConstants roleConstants : MessageConstants.values()) {
+            if (roleConstants.getCode().equals(code) && roleConstants.getType().equals(type)) {
+                return roleConstants.name;
+            }
+        }
+        return null;
+    }
+}

+ 30 - 0
src/main/java/com/ydtech/modules/admin/constants/MessageModelConstants.java

@@ -0,0 +1,30 @@
+package com.ydtech.modules.admin.constants;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+@Getter
+public enum MessageModelConstants {
+
+    //渠道管理/出单员管理
+    //%添加人员账号姓名%于%创建时间%新增了出单员,%出单员姓名%,%出单员工号%,请及时查看。
+    MODEL_1("1", "有新增的出单员", "${添加人员账号姓名}于${创建时间}新增了出单员,${出单员姓名},${出单员工号},请及时查看。", "/peopleManage/player/playerManage"),
+    //代理人管理/代理人审核
+    //%人员类型% %待审核人员姓名%,%待审核人员工号%,于%审核数据生成时间%申请入司,请及时审批。
+    MODEL_2("2", "有新的入司人员,请注意查收", "${人员类型} ${待审核人员姓名},${待审核人员工号}于${审核数据生成时间}申请入司,请及时审批。", "/peopleManage/agent/agentExamine");
+
+    private final String code;
+    private final String title;
+    private final String content;
+    private final String url;
+
+    public static String getMessageContent(String code) {
+        for (MessageModelConstants roleConstants : MessageModelConstants.values()) {
+            if (roleConstants.getCode().equals(code)) {
+                return roleConstants.content;
+            }
+        }
+        return null;
+    }
+}

+ 2 - 2
src/main/java/com/ydtech/modules/admin/controller/PushOrder.java

@@ -27,8 +27,8 @@ public class PushOrder {
 
     @GetMapping("pushHistoryOrders")
     @ApiOperation(value = "测试推送历史订单数据消息")
-    public HttpResult pushHistoryOrders() {
-        insOrderPushMsgService.getPushInsAreaCompanyList();
+    public HttpResult pushHistoryOrders(String month) {
+        insOrderPushMsgService.getPushInsAreaCompanyList(month);
         return HttpResult.ok();
     }
 

+ 6 - 2
src/main/java/com/ydtech/modules/admin/controller/SysQyWeChatController.java

@@ -11,6 +11,7 @@ import com.ydtech.modules.admin.service.SysUserService;
 import com.ydtech.modules.admin.service.WechatCustomerService;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
+import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
@@ -87,8 +88,11 @@ public class SysQyWeChatController {
             sysQyWeChat = list.get(new Random().nextInt(list.size()));
         }
         String s = wechatCustomerService.addContactWay(sysQyWeChat.getOpenKfId());
-        String url = s + "&scene_param=" + userId;
-        return HttpResult.ok(url);
+        if(StringUtils.isNotEmpty(s)){
+            String url = s + "&scene_param=" + userId;
+            return HttpResult.ok(url);
+        }
+        return HttpResult.ok(sysQyWeChat.getSupportStaffUrl());
     }
 
 }

+ 26 - 1
src/main/java/com/ydtech/modules/admin/controller/SysUserAccountController.java

@@ -1,10 +1,10 @@
 package com.ydtech.modules.admin.controller;
 
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.dto.*;
 import com.ydtech.modules.admin.model.po.SysUserAccount;
+import com.ydtech.modules.admin.model.po.SysUserBankCard;
 import com.ydtech.modules.admin.model.vo.MyIncomeAndExpensesNewPageVo;
 import com.ydtech.modules.admin.model.vo.SubOrder;
 import com.ydtech.modules.admin.model.vo.SysUserAccountVo;
@@ -312,4 +312,29 @@ public class SysUserAccountController extends BaseController {
         MySumAmountDto amountDto = sysUserAccountService.findMyAmount(mySumAmountQueryDto);
         return HttpResult.ok(amountDto);
     }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/1/6 18:14
+     *  @Description: 查询用户的提现总金额去除电销组员的金额(电销组员通过逻辑累加到组长上了)
+     */
+    @GetMapping("/queryCount")
+    @ApiOperation(value = "查询所有的账户的数据金额")
+    public HttpResult<BigDecimal> queryCount() {
+         BigDecimal bigDecimal = sysUserAccountService.queryCount();
+        return HttpResult.ok("success", bigDecimal);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/1/6 18:15
+     *  @Description:  查询用户的银行卡信息
+     */
+    @GetMapping("/queryCardListByUserId")
+    @ApiOperation(value = "查询用户的银行卡信息")
+    public HttpResult<List> queryCardListByUserId(String userId) {
+        List<SysUserBankCard> cardList = sysUserAccountService.queryCardListByUserId(userId);
+        return HttpResult.ok("success", cardList);
+    }
 }

+ 66 - 0
src/main/java/com/ydtech/modules/admin/controller/deptBalance/DeptBalanceController.java

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
 import com.ydtech.modules.admin.model.dto.SysPartnerConsoleDto;
+import com.ydtech.modules.admin.model.dto.SysPartnerInfoConsoleDto;
+import com.ydtech.modules.admin.model.vo.AppSysPartnerVo;
 import com.ydtech.modules.admin.model.vo.DeptBalanceVo;
 import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
 import com.ydtech.modules.admin.model.vo.PartnerBalanceVo;
@@ -82,6 +84,70 @@ public class DeptBalanceController {
     }
 
 
+    /**
+     * @version
+     * @author: whp
+     * @Description: 合伙人详情
+     */
+    @PostMapping("queryPartnerInfo")
+    @ApiOperation(value = "合伙人详情")
+    public HttpResult<List<SysPartnerConsoleDto>> queryPartnerInfo(@RequestBody DeptBalanceVo deptBalanceVo) {
+        List<SysPartnerConsoleDto> result = deptBalanceService.queryPartnerInfo(deptBalanceVo);
+        return HttpResult.ok(result);
+    }
+
+    /**
+     * @version
+     * @author: whp
+     * @Description: 工作室详情
+     */
+    @PostMapping("queryStudioInfo")
+    @ApiOperation(value = "工作室详情")
+    public HttpResult<List<SysPartnerConsoleDto>> queryStudioInfo(@RequestBody DeptBalanceVo deptBalanceVo) {
+        List<SysPartnerConsoleDto> result = deptBalanceService.queryPartnerInfo(deptBalanceVo);
+        return HttpResult.ok(result);
+    }
+
+
+
+    /**
+     * @version
+     * @author: whp
+     * @Description: 合伙人详情
+     */
+    @PostMapping("info")
+    @ApiOperation(value = "合伙人详情")
+    public HttpResult<SysPartnerInfoConsoleDto> queryInfo(@RequestBody DeptBalanceVo deptBalanceVo) {
+        SysPartnerInfoConsoleDto result = deptBalanceService.queryInfo(deptBalanceVo);
+        return HttpResult.ok(result);
+    }
+
+
+    /**
+     * @version
+     * @author: whp
+     * @Description: 查看机构下团队信息
+     */
+    @PostMapping("/getTeamInfo")
+    @ApiOperation(value = "查看机构下团队信息")
+    public HttpResult<SysPartnerInfoConsoleDto> getTeamInfo(@RequestBody DeptBalanceVo deptBalanceVo) {
+        SysPartnerInfoConsoleDto result = deptBalanceService.getTeamInfo(deptBalanceVo);
+        return HttpResult.ok(result);
+    }
+
+
+    /**
+     * @version
+     * @author: whp
+     * @Description: 查看团队下人员信息
+     */
+    @PostMapping("/getTeamUserInfo")
+    @ApiOperation(value = "查看团队下人员信息")
+    public HttpResult<SysPartnerInfoConsoleDto> getTeamUserInfo(@RequestBody DeptBalanceVo deptBalanceVo) {
+        SysPartnerInfoConsoleDto result = deptBalanceService.getTeamUserInfo(deptBalanceVo);
+        return HttpResult.ok(result);
+    }
+
     /**
      * @version
      * @author: whp

+ 25 - 0
src/main/java/com/ydtech/modules/admin/controller/profitAnalysis/ProfitAnalysisController.java

@@ -3,6 +3,7 @@ package com.ydtech.modules.admin.controller.profitAnalysis;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto;
 import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisQueryDto;
+import com.ydtech.modules.admin.model.vo.TaskStatisticsVo;
 import com.ydtech.modules.admin.service.ProfitAnalysisService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -80,4 +81,28 @@ public class ProfitAnalysisController {
     }
 
 
+    /**
+     * @description:   控制台-利润分析应收金额导出明细
+     * @author: whp
+     **/
+    @PostMapping("/receivableExcel")
+    @ApiOperation(value = "控制台-利润分析应收金额导出明细")
+    public HttpResult receivableExcel(@RequestBody ProfitAnalysisQueryDto profitAnalysisQueryDto) {
+        return this.profitAnalysisService.receivableExcel(profitAnalysisQueryDto);
+    }
+
+    /**
+     * @description:   控制台-利润分析实付金额导出明细
+     * @author: whp
+     **/
+    @PostMapping("/payAmountExcel")
+    @ApiOperation(value = "控制台-利润分析实付金额导出明细")
+    public HttpResult payAmountExcel(@RequestBody ProfitAnalysisQueryDto profitAnalysisQueryDto) {
+        return this.profitAnalysisService.payAmountExcel(profitAnalysisQueryDto);
+    }
+
+
+
+
+
 }

+ 194 - 0
src/main/java/com/ydtech/modules/admin/controller/websocket/SendMessageServer.java

@@ -0,0 +1,194 @@
+package com.ydtech.modules.admin.controller.websocket;
+
+import com.github.pagehelper.PageInfo;
+import com.google.gson.Gson;
+import com.google.gson.JsonParser;
+import com.ydtech.modules.message.entity.SystemMessage;
+import com.ydtech.modules.message.entity.SystemMessageVo;
+import com.ydtech.modules.message.entity.dto.SystemMessageDTO;
+import com.ydtech.modules.message.service.SystemMessageService;
+import com.ydtech.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.websocket.*;
+import javax.websocket.server.PathParam;
+import javax.websocket.server.ServerEndpoint;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import cn.hutool.log.Log;
+import cn.hutool.log.LogFactory;
+
+
+@ServerEndpoint(value = "/getMessage/{userId}")
+@Component
+public class SendMessageServer {
+
+
+    private static ApplicationContext applicationContext;
+
+    public static void setApplicationContext(ApplicationContext context) {
+        applicationContext = context;
+    }
+
+    static Log log = LogFactory.get(SendMessageServer.class);
+    /**静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。*/
+    private static int onlineCount = 0;
+    /**concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。*/
+    private static ConcurrentHashMap<String,SendMessageServer> webSocketMap = new ConcurrentHashMap<>();
+    /**与某个客户端的连接会话,需要通过它来给客户端发送数据*/
+    private Session session;
+    /**接收userId*/
+    private String userId="";
+
+    /**
+     * 连接建立成功调用的方法*/
+    @OnOpen
+    public void onOpen(Session session, @PathParam("userId") String userId) {
+        this.session = session;
+        this.userId=userId;
+        if(webSocketMap.containsKey(userId)){
+            webSocketMap.remove(userId);
+            webSocketMap.put(userId, this);
+            //加入set中
+        }else{
+            webSocketMap.put(userId, this);
+            //加入set中
+            addOnlineCount();
+            //在线数加1
+        }
+
+        log.info("用户连接:"+userId+",当前在线人数为:" + getOnlineCount());
+
+        try {
+            PageInfo<SystemMessageDTO> message = getMessage(userId);
+            log.info("为用户" + userId + "连接建立成功发送站内信" + new Gson().toJson(message));
+            sendMessage(new Gson().toJson(message));
+        } catch (Exception e) {
+            log.error("用户:"+userId+",网络异常!!!!!!");
+        }
+    }
+
+    /**
+     * 连接关闭调用的方法
+     */
+    @OnClose
+    public void onClose() {
+        if(webSocketMap.containsKey(userId)){
+            webSocketMap.remove(userId);
+            //从set中删除
+            subOnlineCount();
+        }
+        log.info("用户退出:"+userId+",当前在线人数为:" + getOnlineCount());
+    }
+
+    /**
+     * 收到客户端消息后调用的方法
+     *
+     * @param message 客户端发送过来的消息*/
+    @OnMessage
+    public void onMessage(String message, Session session) {
+        log.info("用户消息:"+userId+",报文:"+message);
+        //可以群发消息
+        //消息保存到数据库、redis
+        if (StringUtils.isNotBlank(message)) {
+            try {
+                //解析发送的报文
+                JSONObject jsonObject = JSON.parseObject(message);
+                //追加发送人(防止串改)
+                jsonObject.put("fromUserId",this.userId);
+                String toUserId=jsonObject.getString("userId");
+
+                //传送给对应toUserId用户的websocket
+                if (StringUtils.isNotBlank(toUserId) && webSocketMap.containsKey(toUserId)) {
+                    PageInfo<SystemMessageDTO> getMessage = getMessage(toUserId);
+                    log.info("为用户" + toUserId + "登录或刷新发送站内信" + new Gson().toJson(getMessage));
+                    webSocketMap.get(toUserId).sendMessage(new Gson().toJson(getMessage));
+                } else {
+                    log.error("请求的userId:"+toUserId+"不在该服务器上");
+                    //否则不在这个服务器上,发送到mysql或者redis
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     *
+     * @param session
+     * @param error
+     */
+    @OnError
+    public void onError(Session session, Throwable error) {
+        log.error("用户错误:"+this.userId+",原因:"+error.getMessage());
+        error.printStackTrace();
+    }
+    /**
+     * 实现服务器主动推送
+     */
+    public void sendMessage(String message) throws Exception {
+        this.session.getBasicRemote().sendText(message);
+    }
+
+
+    /**
+     * 每小时发送站内信消息
+     * */
+//    @Scheduled(cron = "0 * * * * *")
+//    public void fixedTime() throws Exception {
+//        log.info("定时任务发送站内信消息到:" + JSONObject.toJSONString(webSocketMap.keySet()));
+//        if (webSocketMap.size() > 0) {
+//            for (String userId : webSocketMap.keySet()) {
+//                PageInfo<SystemMessageDTO> message = getMessage(userId);
+//                log.info("定时任务发送站内信消息内容:" + JSONObject.toJSONString(message));
+//                webSocketMap.get(userId).sendMessage(new Gson().toJson(message));
+//            }
+//        }
+//    }
+
+
+    public void realTime(List<SystemMessage> systemMessageList) throws Exception {
+        log.info("实时发送站内信消息到:" + JSONObject.toJSONString(webSocketMap.keySet()));
+        if (webSocketMap.size() > 0) {
+            for (String userId : webSocketMap.keySet()) {
+                for (SystemMessage systemMessage : systemMessageList) {
+                    if (userId.equals(systemMessage.getReceiverId())) {
+                        log.info("实时发送站内信消息内容:" + JSONObject.toJSONString(systemMessage));
+                        webSocketMap.get(userId).sendMessage(new Gson().toJson(systemMessage));
+                    }
+                }
+            }
+        }
+    }
+
+
+    public static synchronized int getOnlineCount() {
+        return onlineCount;
+    }
+
+    public static synchronized void addOnlineCount() {
+        SendMessageServer.onlineCount++;
+    }
+
+    public static synchronized void subOnlineCount() {
+        SendMessageServer.onlineCount--;
+    }
+
+    public PageInfo<SystemMessageDTO> getMessage(String userId) {
+        SystemMessageVo systemMessageVo = new SystemMessageVo();
+        systemMessageVo.setUserId(userId);
+        systemMessageVo.setPageNum(1);
+        systemMessageVo.setPageSize(10);
+        SystemMessageService socketTableConnService = applicationContext.getBean(SystemMessageService.class);
+        PageInfo<SystemMessageDTO> systemMessageByUser = socketTableConnService.getSystemMessageByUser(systemMessageVo);
+        return systemMessageByUser;
+    }
+
+
+}

+ 7 - 0
src/main/java/com/ydtech/modules/admin/dao/DeptBalanceMapper.java

@@ -51,4 +51,11 @@ public interface DeptBalanceMapper {
      *  @Description: 查询电销组长的收入
      */
     BigDecimal getDxWalletAgentAmount(@Param("ids") List<String> userList, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
+
+    /**
+     *
+     * @param deptBalanceVo
+     * @return  获取钱包总收入
+     */
+    HashMap<String, BigDecimal> getIncomeIndication(DeptBalanceVo deptBalanceVo);
 }

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

@@ -2,9 +2,12 @@ package com.ydtech.modules.admin.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ydtech.modules.admin.model.SysPartnerAccount;
+import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
 import org.apache.ibatis.annotations.Mapper;
 
 @Mapper
 public interface SysPartnerAccountMapper extends BaseMapper<SysPartnerAccount> {
 
+    SysPartnerAccount getByDeptBalanceDto(DeptBalanceDto itemLeader);
+
 }

+ 6 - 0
src/main/java/com/ydtech/modules/admin/dao/SysPremiumDetailsMapper.java

@@ -6,10 +6,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.admin.model.SysPremiumDetails;
 import com.ydtech.modules.admin.model.dto.AgencyUserInsAreaDto;
 import com.ydtech.modules.admin.model.dto.CommissionInfoDto;
+import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
 import com.ydtech.modules.admin.model.vo.AgencyUserInsAreaVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -23,4 +26,7 @@ public interface SysPremiumDetailsMapper extends BaseMapper<SysPremiumDetails> {
     List<Map<String, Object>> queryInfoPage(@Param("userId") String userId,  @Param("dto") CommissionInfoDto commissionInfoDto);
 
     Page<Map<String, Object>> queryInfoPages(Page page,  @Param("dto") CommissionInfoDto commissionInfoDto);
+
+    HashMap<String, BigDecimal> getTotalAmount(DeptBalanceDto itemLeader);
+
 }

+ 17 - 3
src/main/java/com/ydtech/modules/admin/dao/SysUserAccountMapper.java

@@ -3,9 +3,8 @@ package com.ydtech.modules.admin.dao;
 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.po.SysUserBankCard;
 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.math.BigDecimal;
@@ -21,7 +20,7 @@ public interface SysUserAccountMapper extends BaseMapper<SysUserAccount> {
 
     Page<SysUserAccount> queryPageOrder(SysUserAccountVo sysUserAccountVo,@Param("page") Page page);
 
-    Page<SysUserAccount> queryPageOrder1(@Param("sysUserAccountVo") SysUserAccountVo sysUserAccountVo,@Param("page") Page page);
+    Page<SysUserAccount> queryPageOrder1(@Param("page") Page page,@Param("sysUserAccountVo") SysUserAccountVo sysUserAccountVo);
 
     SysUserAccount getById(String userId);
     /**
@@ -31,6 +30,21 @@ public interface SysUserAccountMapper extends BaseMapper<SysUserAccount> {
      *  @Description: 查询组长下的组员信息账户总金额
      */
     BigDecimal getGroupById(@Param("userId") String userId);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/1/6 18:19
+     *  @Description:  查询账户列表
+     */
+    List<SysUserAccount> queryCount();
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/1/6 18:28
+     *  @Description:  通过用户id查询银行卡信息
+     */
+    List<SysUserBankCard> queryCardListByUserId(@Param("userId") String userId);
 }
 
 

+ 4 - 0
src/main/java/com/ydtech/modules/admin/dao/SysUserRoleMapper.java

@@ -2,8 +2,11 @@ package com.ydtech.modules.admin.dao;
 
 import com.ydtech.modules.admin.model.SysUserRole;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * @author Administrator
  * @description 针对表【sys_user_role(用户角色)】的数据库操作Mapper
@@ -13,6 +16,7 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
 
+    List<SysUserRole> selectBymenuId(@Param("menuId") int menuId);
 }
 
 

+ 6 - 0
src/main/java/com/ydtech/modules/admin/model/dto/DeptBalanceDto.java

@@ -68,4 +68,10 @@ public class DeptBalanceDto implements Serializable {
         this.notWithdrawn = notWithdrawn;
         this.comLevel = comLevel;
     }
+
+
+
+    private String  beginDate;
+
+    private String  endDate;
 }

+ 34 - 0
src/main/java/com/ydtech/modules/admin/model/dto/PayAmountExcel.java

@@ -0,0 +1,34 @@
+package com.ydtech.modules.admin.model.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+@Data
+public class PayAmountExcel {
+
+    @ExcelProperty(value = "银行卡号",index = 0)
+    private String bankNumber;
+
+    @ExcelProperty(value = "提现金额",index = 1)
+    private String amount;
+
+    @ExcelProperty(value = "用户名称",index = 2)
+    private String userName;
+
+    @ExcelProperty(value = "提现时间",index = 3)
+    private String createTime;
+
+    @ExcelProperty(value = "审核状态",index = 4)
+    private String auditingStatus;
+
+    @ExcelProperty(value = "审核时间",index = 5)
+    private String auditingTime;
+
+    @ExcelProperty(value = "审核人",index = 6)
+    private String auditingUserName;
+
+    @ExcelProperty(value = "账户名称",index = 7)
+    private String accountName;
+
+
+}

+ 65 - 0
src/main/java/com/ydtech/modules/admin/model/dto/ReceivableExcel.java

@@ -0,0 +1,65 @@
+package com.ydtech.modules.admin.model.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+@Data
+public class ReceivableExcel {
+
+    @ExcelProperty(value = "订单号",index = 0)
+    private String orderno;
+
+    @ExcelProperty(value = "交强保单号",index = 1)
+    private String policyno;
+
+    @ExcelProperty(value = "商业保单号",index = 2)
+    private String syPolicyno;
+
+    @ExcelProperty(value = "非车保单号",index = 3)
+    private String noNolicyno;
+
+    @ExcelProperty(value = "机构编码",index = 4)
+    private String deptId;
+
+    @ExcelProperty(value = "签单日期",index = 5)
+    private String signdate;
+
+    @ExcelProperty(value = "保险公司编码",index = 6)
+    private String companId;
+
+    @ExcelProperty(value = "合作公司名称",index = 7)
+    private String partnerCompaniesName;
+
+    @ExcelProperty(value = "协议编码",index = 8)
+    private String agreementId;
+
+    @ExcelProperty(value = "车牌号",index = 9)
+    private String licenseno;
+
+    @ExcelProperty(value = "交强险含税保费",index = 10)
+    private String jqPremium;
+
+    @ExcelProperty(value = "商业险含保费",index = 11)
+    private String syPremium;
+
+    @ExcelProperty(value = "非车险含保费",index = 12)
+    private String noPremium;
+
+    @ExcelProperty(value = "手续费比例",index = 13)
+    private String commissionFeerate;
+
+    @ExcelProperty(value = "跟单费用比例",index = 14)
+    private String otherFeerate;
+
+    @ExcelProperty(value = "手续费金额",index = 15)
+    private String commissionFeevalue;
+
+    @ExcelProperty(value = "跟单费用金额",index = 16)
+    private String otherFeevalue;
+
+
+
+
+
+
+}

+ 67 - 0
src/main/java/com/ydtech/modules/admin/model/dto/SysPartnerConsoleDto.java

@@ -1,7 +1,9 @@
 package com.ydtech.modules.admin.model.dto;
 
+import com.ydtech.modules.admin.model.PartnerInfoVo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -37,6 +39,9 @@ public class SysPartnerConsoleDto implements Serializable {
     @ApiModelProperty(value = "部门名称")
     private String deptName;
 
+    @ApiModelProperty(value = "部门id")
+    private String deptId;
+
 
     @ApiModelProperty(value = "机构管理费")
     private BigDecimal deptManagementFee;
@@ -53,6 +58,9 @@ public class SysPartnerConsoleDto implements Serializable {
     @ApiModelProperty(value = "是否合伙人 0 是  1 否")
     private String type;
 
+    @ApiModelProperty(value = "合伙人等级")
+    private Integer patnerLevel;
+
     @ApiModelProperty(value = "子级list")
     private List<SysPartnerConsoleDto> childrenList;
 
@@ -65,12 +73,62 @@ public class SysPartnerConsoleDto implements Serializable {
     @ApiModelProperty(value = "性别")
     private String sex;
 
+    @ApiModelProperty(value = "手机号")
+    private String mobile;
+
+
+    @ApiModelProperty(value = "会员人数")
+    private Integer memberShip;
+
+
+    @ApiModelProperty(value = "总佣金")
+    private BigDecimal commission;
+
+
+    @ApiModelProperty(value = "直接合伙人")
+    private Integer numberPartners;
+
+
+    @ApiModelProperty(value = "直接工作室")
+    private Integer directStudio;
+
+
+    @ApiModelProperty(value = "间接工作室")
+    private Integer indirectStudio;
+
+    @ApiModelProperty(value = "间接工作室")
+    private Integer level;
+
+
+    @ApiModelProperty(value = "管理员ids")
+    private List<String> leaderIds;
+
+
+    @ApiModelProperty(value = "管理员")
+    private String LeaderId;
+
+    @ApiModelProperty(value = "管理员名称")
+    private String leaderName;
+
+
+    @ApiModelProperty(value = "合伙人ids")
+    private List<String> partnerIds;
+
+    @ApiModelProperty(value = "部门id集合")
+    private List<String> deptIds;
+
+
+    @ApiModelProperty(value = "用户ids")
+    private List<String> userIds;
+
     //用户创建时间
     private String createTime;
 
     @ApiModelProperty(value = "提现中")
     private BigDecimal withdrawingAmount;
 
+    List<PartnerInfoVo> partnerInfoVoList;
+
     /***
      * 角色id
      */
@@ -79,4 +137,13 @@ public class SysPartnerConsoleDto implements Serializable {
      * 机构来源
      */
     private String managementSource;
+
+    @ApiModelProperty(value = "工作室下级团队个数")
+    private Integer deptNum;
+
+    /**
+     * 存入以及合伙人id
+     */
+    @ApiModelProperty(value = "存入以及合伙人id")
+    private String loginUserId;
 }

+ 34 - 0
src/main/java/com/ydtech/modules/admin/model/dto/SysPartnerInfoConsoleDto.java

@@ -0,0 +1,34 @@
+package com.ydtech.modules.admin.model.dto;
+
+import com.ydtech.modules.admin.model.PartnerInfoVo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class SysPartnerInfoConsoleDto {
+
+
+    @ApiModelProperty(value = "总保费")
+    private BigDecimal totalIncome;
+
+    @ApiModelProperty(value = "总佣金")
+    private BigDecimal commission;
+
+    @ApiModelProperty(value = "会员人数")
+    private Integer memberShip;
+
+    @ApiModelProperty(value = "推荐人")
+    private String suggestName;
+
+    @ApiModelProperty(value = "下级团队")
+    private Integer deptNum;
+
+
+    List<SysPartnerConsoleDto> partnerInfoVoList;
+
+
+    List<String> userIds;
+}

+ 7 - 0
src/main/java/com/ydtech/modules/admin/model/po/SysQyWeChat.java

@@ -48,6 +48,13 @@ public class SysQyWeChat {
     @TableField( "wechat_picture_url")
     private String wechatPictureUrl;
 
+    /**
+     * 企业微信客服Url
+     */
+    @TableField("support_staff_url")
+    private String supportStaffUrl;
+
+
     @ApiModelProperty("企业微信客服id")
     @TableField("open_kf_id")
     private String openKfId;

+ 6 - 1
src/main/java/com/ydtech/modules/admin/model/po/SysUserAccount.java

@@ -8,6 +8,7 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -118,7 +119,7 @@ public class SysUserAccount implements Serializable {
 
     @ApiModelProperty(value = "所属账户下的卡")
     @TableField(exist = false)
-    List<SysUserBankCard> sysUserAccountCardList;
+    List<SysUserBankCard> sysUserAccountCardList =new ArrayList<SysUserBankCard>();
 
     // add by  hxl   2024-06-18  添加账号总金额
     /**
@@ -149,4 +150,8 @@ public class SysUserAccount implements Serializable {
     private  String  managementSource;
     @TableField(exist = false)
     private  String  roleId;
+
+    @TableField(exist = false)
+    private  String  id;
+
 }

+ 23 - 0
src/main/java/com/ydtech/modules/admin/model/vo/DeptBalanceVo.java

@@ -67,5 +67,28 @@ public class DeptBalanceVo implements Serializable {
     private List<String> userIds;
 
 
+    @ApiModelProperty(value = "用户ids")
+    private Integer level;
+
+
+    @ApiModelProperty(value = "用户id")
+    private String userId;
+
+    @ApiModelProperty(value = "行业领域 1:汽车-车险")
+    private Integer industrySector;
+
+    @ApiModelProperty(value = "合伙人:1;工作室:2")
+    private Integer type;
+
+    @ApiModelProperty(value = "合伙人ids")
+    private List<String> partnerIds;
+
+    @ApiModelProperty(value = "工作室ids")
+    private List<String> leaderIds;
+
+
+    @ApiModelProperty(value = "存入以及合伙人id")
+    private String loginUserId;
+
 
 }

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

@@ -18,6 +18,9 @@ import java.util.List;
 @ApiModel("查询Vo")
 public class SysUserAccountVo {
 
+    @ApiModelProperty(value = "前端唯一key")
+    private String id;
+
     @ApiModelProperty(value = "用户id")
     private String userId;
 

+ 27 - 0
src/main/java/com/ydtech/modules/admin/service/DeptBalanceService.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
 import com.ydtech.modules.admin.model.dto.SysPartnerConsoleDto;
+import com.ydtech.modules.admin.model.dto.SysPartnerInfoConsoleDto;
+import com.ydtech.modules.admin.model.vo.AppSysPartnerVo;
 import com.ydtech.modules.admin.model.vo.DeptBalanceVo;
 import com.ydtech.modules.admin.model.vo.PartnerBalanceVo;
 
@@ -46,4 +48,29 @@ public interface DeptBalanceService {
      */
     IPage<SysPartnerConsoleDto> getWalletAgent(DeptBalanceVo deptBalanceVo);
 
+    /**
+     *
+     * @param deptBalanceVo
+     * @return   合伙人详情
+     */
+    List<SysPartnerConsoleDto> queryPartnerInfo(DeptBalanceVo deptBalanceVo);
+
+    /**
+     *
+     * @param deptBalanceVo
+     * @return  合伙人 工作室 详情
+     */
+    SysPartnerInfoConsoleDto queryInfo(DeptBalanceVo deptBalanceVo);
+    /**
+     * @version
+     * @author: whp
+     * @Description: 查看机构下团队信息
+     */
+    SysPartnerInfoConsoleDto getTeamInfo(DeptBalanceVo deptBalanceVo);
+    /**
+     * @version
+     * @author: whp
+     * @Description: 查看团队下人员信息
+     */
+    SysPartnerInfoConsoleDto getTeamUserInfo(DeptBalanceVo deptBalanceVo);
 }

+ 13 - 0
src/main/java/com/ydtech/modules/admin/service/ProfitAnalysisService.java

@@ -1,8 +1,10 @@
 package com.ydtech.modules.admin.service;
 
 
+import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto;
 import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisQueryDto;
+import com.ydtech.modules.admin.model.vo.TaskStatisticsVo;
 
 import java.util.List;
 
@@ -29,6 +31,17 @@ public interface ProfitAnalysisService {
      *  @Description:  查询利润分析统计明细
      */
     List<ProfitAnalysisDto> getProfitAnalysisQueryDetailsList(ProfitAnalysisQueryDto profitAnalysisQueryDto);
+    /**
+     * @description:   控制台-利润分析应收金额导出明细
+     * @author: whp
+     **/
+    HttpResult receivableExcel(ProfitAnalysisQueryDto profitAnalysisQueryDto);
+
+    /**
+     * @description:   控制台-利润分析实付金额导出明细
+     * @author: whp
+     **/
+    HttpResult payAmountExcel(ProfitAnalysisQueryDto profitAnalysisQueryDto);
 
 }
 

+ 18 - 1
src/main/java/com/ydtech/modules/admin/service/SysUserAccountService.java

@@ -1,10 +1,10 @@
 package com.ydtech.modules.admin.service;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.dto.*;
 import com.ydtech.modules.admin.model.po.SysUserAccount;
+import com.ydtech.modules.admin.model.po.SysUserBankCard;
 import com.ydtech.modules.admin.model.vo.MyIncomeAndExpensesNewPageVo;
 import com.ydtech.modules.admin.model.vo.SubOrder;
 import com.ydtech.modules.admin.model.vo.SysUserAccountVo;
@@ -133,4 +133,21 @@ public interface SysUserAccountService extends IService<SysUserAccount> {
      *  @Description: 查询我的账户页面总金额
      */
     MySumAmountDto findMyAmount(MySumAmountQueryDto mySumAmountQueryDto);
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/1/6 18:18
+     *  @Description:  查询提现总金额
+     */
+    public BigDecimal queryCount();
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/1/6 18:17
+     *  @Description:  通过用户id查询银行卡信息
+     */
+    List<SysUserBankCard> queryCardListByUserId(String userId);
 }

+ 812 - 84
src/main/java/com/ydtech/modules/admin/service/impl/DeptBalanceServiceImpl.java

@@ -1,25 +1,29 @@
 package com.ydtech.modules.admin.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.dao.*;
-import com.ydtech.modules.admin.model.SysAgencyFeeApproval;
-import com.ydtech.modules.admin.model.SysAgencyLeader;
-import com.ydtech.modules.admin.model.SysRelationPerson;
+import com.ydtech.modules.admin.model.*;
 import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
 import com.ydtech.modules.admin.model.dto.MySumAmountQueryDto;
 import com.ydtech.modules.admin.model.dto.SysPartnerConsoleDto;
+import com.ydtech.modules.admin.model.dto.SysPartnerInfoConsoleDto;
 import com.ydtech.modules.admin.model.po.SysUserAccount;
-import com.ydtech.modules.admin.model.vo.DeptBalanceVo;
-import com.ydtech.modules.admin.model.vo.PartnerBalanceVo;
+import com.ydtech.modules.admin.model.vo.*;
 import com.ydtech.modules.admin.service.*;
+import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.base.model.vo.PageVo;
+import com.ydtech.modules.esm.dao.EsmUserReferrerMapper;
+import com.ydtech.modules.esm.model.EsmUserReferrer;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
+import com.ydtech.utils.BigDecimalUtils;
 import com.ydtech.utils.StringUtils;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -27,10 +31,7 @@ import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -61,6 +62,24 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
 
     @Autowired
     private SysAgencyFeeApprovalMapper sysAgencyFeeApprovalMapper;
+
+    @Resource
+    private SysPartnerAccountMapper sysPartnerAccountMapper;
+
+
+    @Resource
+    private SysDeptMapper sysDeptMapper;
+
+    @Resource
+    private SysUserMapper sysUserMapper;
+
+
+    @Resource
+    private SysPremiumDetailsMapper sysPremiumDetailsMapper;
+
+
+    @Resource
+    private EsmUserReferrerMapper esmUserReferrerMapper;
     /**
      * @version
      * @author: whp
@@ -80,42 +99,41 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
             List<DeptBalanceDto>  newList =new ArrayList<>();
             if (records !=null && records.size()>0) {
                 for (DeptBalanceDto itemLeader : records) {
-                    BigDecimal allTotalIncome = BigDecimal.ZERO;  // 总保费
-                    BigDecimal allDeptManagementFee = BigDecimal.ZERO;//机构管理费
-                    BigDecimal allWithdrawn = BigDecimal.ZERO;//已体现
-                    BigDecimal allNotWithdrawn = BigDecimal.ZERO;//未提现
-                    String deptId = itemLeader.getDeptId();
-                    String proportional = itemLeader.getProportional();
-                    Date updateTime = itemLeader.getUpdateTime();
-                    Date createTime = itemLeader.getCreateTime();
-                    String dateStr = "";
-                    if (updateTime != null) {
-                        dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(updateTime);
-                    } else {
-                        dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTime);
-                    }
-                    HashMap<String, BigDecimal> orderAmount = deptBalanceMapper.getByDeptId(deptId, dateStr,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
-                    if (orderAmount != null && !orderAmount.isEmpty()) {
-                        BigDecimal totalIncome = orderAmount.get("totalIncome")==null ? BigDecimal.ZERO : orderAmount.get("totalIncome");
-                        allTotalIncome = totalIncome.multiply(new BigDecimal(proportional))
-                                .divide(new BigDecimal("100")).setScale(2, RoundingMode.DOWN);
-                        allDeptManagementFee = this.calculateTotal(orderAmount.get("deptManagementFee"), allDeptManagementFee, null);
-                    }
-                    // 填充 已提现抽成费用和可提现抽成费用
-                    List<SysAgencyFeeApproval> sysAgencyFeeApprovals = sysAgencyFeeApprovalMapper.selectList(new LambdaQueryWrapper<SysAgencyFeeApproval>()
-                            .eq(SysAgencyFeeApproval::getUserId, itemLeader.getUserId())
-                            .eq(SysAgencyFeeApproval::getStatus, 1));
-                    if (sysAgencyFeeApprovals.size() > 0) {
-                        for (SysAgencyFeeApproval sysAgencyFeeApproval : sysAgencyFeeApprovals) {
-                            allWithdrawn = allWithdrawn.add(sysAgencyFeeApproval.getHistoryFee());
+                    String userId = itemLeader.getUserId();
+                    //已提现抽成费用
+                    BigDecimal historyFee = BigDecimal.ZERO;
+//                    SysPartnerAccount sysPartnerAccount = sysPartnerAccountMapper.selectOne(new LambdaQueryWrapper<SysPartnerAccount>().eq(SysPartnerAccount::getUserId, userId));
+                    itemLeader.setBeginDate(deptBalanceVo.getBeginDate());
+                    itemLeader.setEndDate(deptBalanceVo.getEndDate());
+
+                    HashMap<String,BigDecimal>totalAmountMap =sysPremiumDetailsMapper.getTotalAmount(itemLeader);
+//                    SysPartnerAccount sysPartnerAccount =sysPartnerAccountMapper.getByDeptBalanceDto(itemLeader);
+                    if (totalAmountMap != null) {
+                        BigDecimal sumPremium = totalAmountMap.get("totalAmount");
+                        BigDecimal extractFee = totalAmountMap.get("extractFeeAmount");
+                        itemLeader.setTotalIncome(sumPremium);
+                        itemLeader.setDeptManagementFee(extractFee);
+
+
+                        // 填充 已提现抽成费用和可提现抽成费用
+                        List<SysAgencyFeeApproval> sysAgencyFeeApprovals = sysAgencyFeeApprovalMapper.selectList(new LambdaQueryWrapper<SysAgencyFeeApproval>()
+                                .eq(SysAgencyFeeApproval::getUserId, itemLeader.getUserId())
+                                .eq(SysAgencyFeeApproval::getStatus, 1));
+                        if (sysAgencyFeeApprovals.size() > 0) {
+                            for (SysAgencyFeeApproval sysAgencyFeeApproval : sysAgencyFeeApprovals) {
+                                historyFee = historyFee.add(sysAgencyFeeApproval.getHistoryFee());
+                            }
                         }
+                        //已提现
+                        itemLeader.setWithdrawn(historyFee);
+                        //可提现 = 总抽成-已提现
+                        itemLeader.setNotWithdrawn(extractFee.subtract(historyFee));
+                    }else {
+                        itemLeader.setDeptManagementFee(BigDecimal.ZERO);
+                        itemLeader.setTotalIncome(BigDecimal.ZERO);
+                        itemLeader.setWithdrawn(BigDecimal.ZERO);
+                        itemLeader.setNotWithdrawn(BigDecimal.ZERO);
                     }
-                    //可提现 = 总抽成-已提现
-                    allNotWithdrawn = allTotalIncome.subtract(allWithdrawn);
-                    itemLeader.setDeptManagementFee(allTotalIncome);
-                    itemLeader.setTotalIncome(allDeptManagementFee);
-                    itemLeader.setWithdrawn(allWithdrawn);
-                    itemLeader.setNotWithdrawn(allNotWithdrawn);
                     newList.add(itemLeader);
                 }
             }
@@ -145,50 +163,85 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
 
             List<SysPartnerConsoleDto> sysPartners = sysPartnersPage.getRecords();
             for (SysPartnerConsoleDto item : sysPartners) {
-                BigDecimal allTotalIncome = BigDecimal.ZERO;  // 总保费
-                BigDecimal allDeptManagementFee = BigDecimal.ZERO;//机构管理费
-                BigDecimal allWithdrawn = BigDecimal.ZERO;//已体现
-                BigDecimal allNotWithdrawn = BigDecimal.ZERO;//未提现
-
-                List<SysAgencyLeader> deptLeader = sysRelationPersonMapper.selectListByLeaderId(item.getUserId(),1);
-//                  机构负责人
-                for (SysAgencyLeader itemLeader : deptLeader) {
-                    String deptId = itemLeader.getDeptId();
-                    if (StringUtils.isNotEmpty(deptId)) {
-                        String proportional = item.getProportional();
-                        Date updateTime = itemLeader.getUpdateTime();
-                        Date createTime = itemLeader.getCreateTime();
-                        String dateStr="";
-                        if(updateTime!=null){
-                            dateStr=  new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(updateTime);
-                        }else{
-                            dateStr=  new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTime);
-                        }
-                        HashMap<String, BigDecimal> orderAmount = deptBalanceMapper.getByDeptId(deptId,dateStr,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
+                String userId = item.getUserId();
+                item.setLoginUserId(userId);
+                SysPartnerAccount sysPartnerAccount = sysPartnerAccountMapper.selectOne(new LambdaQueryWrapper<SysPartnerAccount>()
+                        .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
+                                SysPartnerAccount::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
+                        .eq(SysPartnerAccount::getUserId, item.getUserId()));
+                if(ObjectUtils.isNotEmpty(sysPartnerAccount)){
+                    if(sysPartnerAccount.getSumPremium() !=null ){
+                        item.setTotalIncome(sysPartnerAccount.getSumPremium());
+                    }
+                    if(sysPartnerAccount.getExtractFee()!=null){
+                        item.setCommission(sysPartnerAccount.getExtractFee());
+                    }
+                    if(sysPartnerAccount.getHistoryFee()!=null){
+                        item.setWithdrawn(sysPartnerAccount.getHistoryFee());
+                    }
+                    if(sysPartnerAccount.getCashFee() !=null){
+                        item.setNotWithdrawn(sysPartnerAccount.getCashFee());
+                    }
+                }
+                //下面合伙人(直接)数量
+                List<SysRelationPerson> sysRelationPersonList1 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                        .eq(SysRelationPerson::getSuggestId, userId)
+                        .eq(SysRelationPerson::getDelFlag, 1)
+                        .eq(SysRelationPerson::getSource, 0)
+                        .eq(SysRelationPerson::getType, 0));
 
-                        if (orderAmount != null && !orderAmount.isEmpty()) {
-                            BigDecimal totalIncome = orderAmount.get("totalIncome")==null ? BigDecimal.ZERO : orderAmount.get("totalIncome");
-                            allTotalIncome = totalIncome.multiply(new BigDecimal(proportional))
-                                    .divide(new BigDecimal("100")).setScale(2, RoundingMode.DOWN);
-                            allDeptManagementFee = this.calculateTotal(orderAmount.get("deptManagementFee"), allDeptManagementFee, null);
-                        }
-                        // 填充 已提现抽成费用和可提现抽成费用
-                        List<SysAgencyFeeApproval> sysAgencyFeeApprovals = sysAgencyFeeApprovalMapper.selectList(new LambdaQueryWrapper<SysAgencyFeeApproval>()
-                                .eq(SysAgencyFeeApproval::getUserId, item.getUserId())
-                                .eq(SysAgencyFeeApproval::getStatus, 1));
-                        if (!sysAgencyFeeApprovals.isEmpty()) {
-                            for (SysAgencyFeeApproval sysAgencyFeeApproval : sysAgencyFeeApprovals) {
-                                allWithdrawn = allWithdrawn.add(sysAgencyFeeApproval.getHistoryFee());
+                item.setNumberPartners(sysRelationPersonList1.size());
+
+
+                //直接工作室数量
+                List<SysRelationPerson> sysRelationPersonList = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                        .eq(SysRelationPerson::getSuggestId, userId)
+                        .eq(SysRelationPerson::getDelFlag, 1)
+                        .eq(SysRelationPerson::getSource, 0)
+                        .eq(SysRelationPerson::getType, 1));
+                item.setDirectStudio(sysRelationPersonList.size());
+                List<String> collect = sysRelationPersonList.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
+                item.setLeaderIds(collect);
+                //登录人下面的所有团队人数
+                List<SysRelationPerson> sysRelationPersonList2 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                        .eq(SysRelationPerson::getSuggestId, userId)
+                        .eq(SysRelationPerson::getDelFlag, 1)
+                        .eq(SysRelationPerson::getType, 1));
+
+
+                //间接工作室
+                List<SysRelationPerson> indirectStudioList = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                        .eq(SysRelationPerson::getSuggestId, userId)
+                        .eq(SysRelationPerson::getDelFlag, 1)
+                        .eq(SysRelationPerson::getSource, 1)
+                        .eq(SysRelationPerson::getType, 1));
+                item.setIndirectStudio(indirectStudioList.size());
+
+                if (sysRelationPersonList2.size() > 0) {
+                    List<String> ids = sysRelationPersonList2.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
+                    List<SysAgencyLeader> leaderList = sysAgencyLeaderMapper.selectList(new LambdaQueryWrapper<SysAgencyLeader>()
+                            .in(CollectionUtil.isNotEmpty(ids), SysAgencyLeader::getUserId, ids).eq(SysAgencyLeader::getDelFlag, 1));
+                    int deptManNum = 0;
+                    if (leaderList.size() > 0) {
+                        for (SysAgencyLeader sysAgencyLeader : leaderList) {
+                            //获取机构下的团队
+                            List<SysDept> sysDeptList = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
+                                    .likeRight(SysDept::getId, sysAgencyLeader.getDeptId())
+                                    .isNull(SysDept::getComlevel).eq(SysDept::getDelFlag, 0)
+                                    .eq(SysDept::getManagementSource, sysAgencyLeader.getSource()));
+                            if (sysDeptList.size() > 0) {
+                                for (SysDept sysDept : sysDeptList) {
+                                    List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
+                                            .likeRight(SysUser::getId, sysDept.getId()).ne(SysUser::getStatus, 0));
+                                    deptManNum = deptManNum + sysUsers.size();
+
+                                }
                             }
                         }
-                        //可提现 = 总抽成-已提现
-                        allNotWithdrawn = allTotalIncome.subtract(allWithdrawn);
+                        item.setMemberShip(deptManNum);
                     }
+
                 }
-                item.setTotalIncome(allDeptManagementFee);
-                item.setDeptManagementFee(allTotalIncome);
-                item.setWithdrawn(allWithdrawn);
-                item.setNotWithdrawn(allNotWithdrawn);
             }
             return HttpResult.ok(sysPartnersPage);
         } catch (Exception e) {
@@ -294,10 +347,19 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
                     BigDecimal sxAmount =BigDecimal.ZERO;
                     //未提现
                     BigDecimal wtxAmount =BigDecimal.ZERO;
+
                     MySumAmountQueryDto mySumAmountQueryDto = new MySumAmountQueryDto();
+
+                    if ("21".equals(record.getRoleId()) && "1".equals(record.getManagementSource())) {
+                        mySumAmountQueryDto.setDeptId(record.getDeptId());
+                    }
                     //如果是电销组长,将组员的数据算进来
                     if ("72".equals(record.getRoleId()) && "3".equals(record.getManagementSource())) {
                         mySumAmountQueryDto.setGroupFlag(true);
+                    }
+
+                    //如果是电销组长,将组员的数据算进来
+                        mySumAmountQueryDto.setGroupFlag(true);
                         List<String> userList = sysUserService.getGroupByUserId(userId);
                         //sumAmount= deptBalanceMapper.getDxWalletAgentAmount(userList,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
                         SysUserAccount sysUserAccountEntity = sysUserAccountService.getById(record.getUserId());
@@ -309,7 +371,6 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
                         wtxAmount= (sysUserAccountEntity==null || sysUserAccountEntity.getSumAmount()==null)?BigDecimal.ZERO:sysUserAccountEntity.getSumAmount();
                         //总的 =  已提现金额+  可提现金额 +  提现中
                         sumAmount = wtxAmount.add(sxAmount).add(ytxAmount);
-                    }
                     record.setWithdrawn(ytxAmount);
                     record.setNotWithdrawn(wtxAmount);
                     record.setTotalIncome(sumAmount);
@@ -337,15 +398,682 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
                     ssKTAmount = sysUserAccountEntity.getSumAmount()==null?BigDecimal.ZERO: sysUserAccountEntity.getSumAmount();
                 }
                 BigDecimal sumAmount=ysTXAmount.add(ssKTAmount).add(txzTXAmount);
+
+                //2025-1-8  需求 总收入 = 当天审核订单收入   收支明细
+                deptBalanceVo.setUserId(record.getUserId());
+                HashMap<String, BigDecimal> incomeIndication = deptBalanceMapper.getIncomeIndication(deptBalanceVo);
                 record.setWithdrawn(ysTXAmount);
                 record.setNotWithdrawn(ssKTAmount);
-                record.setTotalIncome(sumAmount);
+                if(incomeIndication!=null){
+                    if(deptBalanceVo.getManagementSource().equals("2")){
+                        record.setTotalIncome(incomeIndication.get("totalAmount"));
+                    }else {
+                        record.setTotalIncome(BigDecimalUtils.nullToZero(incomeIndication.get("totalAmount")).divide(new BigDecimal(10)));
+
+                    }
+                }else {
+                    record.setTotalIncome(BigDecimal.ZERO);
+                }
                 record.setWithdrawingAmount(txzTXAmount);
             }
         }
 
         return sysUserListPage;
     }
+    @Override
+    public List<SysPartnerConsoleDto> queryPartnerInfo(DeptBalanceVo deptBalanceVo) {
+        List<SysPartnerConsoleDto> appSysPartnerVos = new ArrayList<>();
+        String userId = deptBalanceVo.getUserId();
+        if (StringUtils.isEmpty(userId)) {
+            userId = BaseController.getUserId();
+        }
+        SysPartner sysPartner = sysPartnerMapper.selectOne(new LambdaQueryWrapper<SysPartner>()
+                .eq(SysPartner::getUserId, userId).eq(SysPartner::getDelFlag, 1));
+
+        //查询登陆人下所有直接合伙人
+        List<SysPartner> sysPartnerList = sysPartnerMapper.queryByLoginId(userId);
+
+        Map<Integer, List<SysPartner>> listMap = sysPartnerList.stream().sorted(Comparator.comparing(SysPartner::getId))
+                .collect(Collectors.groupingBy(SysPartner::getType));
+        //按等级查询
+        int start = 0;
+        int type = sysPartner.getType();
+        if (type == 1) {
+            start = start + 2;
+        } else if (type == 2) {
+            start = start + 3;
+        } else if (type == 3) {
+            start = start + 4;
+        } else if (type == 4) {
+            start = start + 5;
+        }
+
+        for (int i = start; i < 6; i++) {
+            //二级
+            List<SysPartner> sysPartnerList1 = listMap.get(i);
+            if (CollectionUtil.isNotEmpty(sysPartnerList1)) {
+                SysPartnerConsoleDto appSysPartnerVo = new SysPartnerConsoleDto();
+                appSysPartnerVo.setPatnerLevel(i);
+                //下级合伙人数
+                appSysPartnerVo.setNumberPartners(sysPartnerList1.size());
+                List<String> ids = sysPartnerList1.stream().map(SysPartner::getUserId).collect(Collectors.toList());
+
+                appSysPartnerVo.setPartnerIds(ids);
+
+                //所有创造利益总人数
+                List<SysRelationPerson> sysRelationPersonList = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                        .in(CollectionUtil.isNotEmpty(ids), SysRelationPerson::getSuggestId, ids)
+                        .eq(SysRelationPerson::getDelFlag, 1)
+                        .eq(SysRelationPerson::getType, 1));
+                int deptManNum = 0;
+                if (sysRelationPersonList.size() > 0) {
+                    List<String> idList = sysRelationPersonList.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
+                    List<SysAgencyLeader> leaderList = sysAgencyLeaderMapper.selectList(new LambdaQueryWrapper<SysAgencyLeader>()
+                            .in(SysAgencyLeader::getUserId, idList).eq(SysAgencyLeader::getDelFlag, 1));
+                    if (leaderList.size() > 0) {
+                        for (SysAgencyLeader sysAgencyLeader : leaderList) {
+                            //获取机构下的团队
+                            List<SysDept> sysDeptList = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
+                                    .likeRight(SysDept::getId, sysAgencyLeader.getDeptId())
+                                    .isNull(SysDept::getComlevel).eq(SysDept::getDelFlag, 0)
+                                    .eq(SysDept::getManagementSource, sysAgencyLeader.getSource()));
+                            if (sysDeptList.size() > 0) {
+                                for (SysDept sysDept : sysDeptList) {
+                                    List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
+                                            .likeRight(SysUser::getId, sysDept.getId()).ne(SysUser::getStatus, 0));
+                                    deptManNum = deptManNum + sysUsers.size();
+                                }
+                            }
+                        }
+                    }
+
+                }
+                appSysPartnerVo.setMemberShip(deptManNum);
+                //直接工作室
+                List<SysRelationPerson> sysRelationPersons = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                        .in(CollectionUtil.isNotEmpty(ids), SysRelationPerson::getSuggestId, ids)
+                        .eq(SysRelationPerson::getDelFlag, 1)
+                        .eq(SysRelationPerson::getSource, 0)
+                        .eq(SysRelationPerson::getType, 1));
+                appSysPartnerVo.setDirectStudio(sysRelationPersons.size());
+
+                if (sysRelationPersons.size() > 0) {
+                    List<String> list1 = sysRelationPersons.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
+                    appSysPartnerVo.setLeaderIds(list1);
+                }
+                //所有工作室
+                List<SysRelationPerson> sysRelationPersons1 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                        .in(CollectionUtil.isNotEmpty(ids), SysRelationPerson::getSuggestId, ids)
+                        .eq(SysRelationPerson::getDelFlag, 1)
+                        .eq(SysRelationPerson::getType, 1));
+
+                //直接工作室下所有的人
+                List<String> userIds = getUserIds(sysRelationPersons1);
+
+                BigDecimal sumPremium = BigDecimal.ZERO;
+                BigDecimal extractFee = BigDecimal.ZERO;
+                if (CollectionUtil.isNotEmpty(userIds)) {
+                    for (String id : userIds) {
+                        List<SysPremiumDetails> sysPremiumDetails = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
+                                .eq(SysPremiumDetails::getUserId, userId)
+                                .eq(SysPremiumDetails::getIssuerId,id)
+                                .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
+                                        SysPremiumDetails::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
+//                                .eq(partnerInfoDto.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, partnerInfoDto.getIndustrySector())
+                                .eq(SysPremiumDetails::getStatus, 1));
+                        if (CollectionUtil.isNotEmpty(sysPremiumDetails)) {
+                            Map<String, List<SysPremiumDetails>> map = sysPremiumDetails.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
+                                    .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
+                            for (String s : map.keySet()) {
+                                List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
+                                sumPremium = sumPremium.add(sysPremiumDetails1.get(0).getSumpremium());
+                            }
+                            BigDecimal reduce = sysPremiumDetails.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
+                            extractFee = extractFee.add(reduce);
+                        }
+
+                    }
+                }
+                appSysPartnerVo.setTotalIncome(sumPremium);
+                appSysPartnerVo.setCommission(extractFee);
+                appSysPartnerVo.setUserId(deptBalanceVo.getUserId());
+                //每一级存入map
+                appSysPartnerVos.add(appSysPartnerVo);
+            }
+        }
+        return appSysPartnerVos;
+    }
+    @Override
+    public SysPartnerInfoConsoleDto queryInfo(DeptBalanceVo deptBalanceVo) {
+        SysPartnerInfoConsoleDto partnerInfoFreeVo = new SysPartnerInfoConsoleDto();
+        List<SysPartnerConsoleDto> partnerInfoVoList = new ArrayList<>();
+        String loginId = deptBalanceVo.getUserId();
+        //合伙人:1;工作室:2
+        Integer type = deptBalanceVo.getType();
+        if(type == 1){
+            List<String> partnerIds = deptBalanceVo.getPartnerIds();
+            if (CollectionUtil.isEmpty(partnerIds)) {
+                return partnerInfoFreeVo;
+            }
+
+            //工作室下所有的人
+            List<SysRelationPerson> sysRelationPersons1 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                    .in(SysRelationPerson::getSuggestId, partnerIds)
+                    .eq(SysRelationPerson::getDelFlag, 1)
+                    .eq(SysRelationPerson::getType, 1));
+
+            List<String> userIds = getUserIds(sysRelationPersons1);
+            BigDecimal sumPremium = BigDecimal.ZERO;
+            BigDecimal extractFee = BigDecimal.ZERO;
+
+            if (CollectionUtil.isNotEmpty(userIds)) {
+                for (String userId : userIds) {
+
+                    //费用
+                    List<SysPremiumDetails> sysPremiumDetails = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
+                            .eq(SysPremiumDetails::getUserId, loginId)
+                            .eq(SysPremiumDetails::getIssuerId,userId)
+                            .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
+                                    SysPremiumDetails::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
+                            .eq(deptBalanceVo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, deptBalanceVo.getIndustrySector())
+                            .eq(SysPremiumDetails::getStatus, 1));
+                    if (CollectionUtil.isNotEmpty(sysPremiumDetails)) {
+                        Map<String, List<SysPremiumDetails>> map = sysPremiumDetails.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
+                                .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
+                        for (String s : map.keySet()) {
+                            List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
+                            sumPremium = sumPremium.add(sysPremiumDetails1.get(0).getSumpremium());
+                        }
+
+//                        sumPremium = sumPremium.add(sysPremiumDetails.get(0).getSumpremium());
+                        BigDecimal reduce = sysPremiumDetails.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
+                        extractFee = extractFee.add(reduce);
+                    }
+
+                }
+            }
+            partnerInfoFreeVo.setTotalIncome(sumPremium);
+            partnerInfoFreeVo.setCommission(extractFee);
+            //合伙人
+            List<SysPartner> sysPartnerList = sysPartnerMapper.selectList(new LambdaQueryWrapper<SysPartner>()
+                    .in(SysPartner::getUserId, deptBalanceVo.getPartnerIds()).eq(SysPartner::getDelFlag, 1));
+
+            if (sysPartnerList.size() > 0) {
+                for (SysPartner sysPartner : sysPartnerList) {
+                    SysPartnerConsoleDto partnerInfoVo = new SysPartnerConsoleDto();
+                    partnerInfoVo.setLevel(sysPartner.getType());
+                    String userId = sysPartner.getUserId();
+                    partnerInfoVo.setUserId(userId);
+                    SysUser sysUser = sysUserMapper.selectById(userId);
+                    partnerInfoVo.setUserName(sysUser.getName());
+                    SysUser sysUser1 = sysUserMapper.selectById(sysPartner.getSuggestId());
+                    partnerInfoVo.setSuggestName(sysUser1.getName());
+                    //直接合伙人
+                    List<SysRelationPerson> sysRelationPersonList = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                            .eq(SysRelationPerson::getSuggestId, userId)
+                            .eq(SysRelationPerson::getDelFlag, 1)
+                            .eq(SysRelationPerson::getType, 0)
+                            .eq(SysRelationPerson::getSource, 0));
+                    List<String> collect = sysRelationPersonList.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
+                    partnerInfoVo.setPartnerIds(collect);
+                    partnerInfoVo.setNumberPartners(collect.size());
+
+                    //直接管理员
+                    List<SysRelationPerson> sysRelationPersonList1 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                            .eq(SysRelationPerson::getSuggestId, userId)
+                            .eq(SysRelationPerson::getDelFlag, 1)
+                            .eq(SysRelationPerson::getType, 1)
+                            .eq(SysRelationPerson::getSource, 0));
+
+                    List<String> collects = sysRelationPersonList1.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
+                    partnerInfoVo.setLeaderIds(collects);
+                    partnerInfoVo.setDirectStudio(collects.size());
+                    //所有贡献费用
+                    //合伙人下所有工作室数 核算总代理人数
+                    List<SysRelationPerson> sysRelationPersonList2 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                            .eq(SysRelationPerson::getSuggestId, userId)
+                            .eq(SysRelationPerson::getDelFlag, 1)
+                            .eq(SysRelationPerson::getType, 1));
+
+                    List<String> userIds1 = getUserIds(sysRelationPersonList2);
+                    BigDecimal sumPremium1 = BigDecimal.ZERO;
+                    BigDecimal extractFee1 = BigDecimal.ZERO;
+                    if (CollectionUtil.isNotEmpty(userIds1)) {
+                        for (String id : userIds1) {
+                            //费用
+                            List<SysPremiumDetails> sysPremiumDetail = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
+                                    .eq(SysPremiumDetails::getUserId, loginId)
+                                    .eq(SysPremiumDetails::getIssuerId,id)
+                                    .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
+                                            SysPremiumDetails::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
+                                    .eq(SysPremiumDetails::getStatus, 1)
+                                    .eq(deptBalanceVo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, deptBalanceVo.getIndustrySector()));
+
+                            if (CollectionUtil.isNotEmpty(sysPremiumDetail)) {
+                                Map<String, List<SysPremiumDetails>> map = sysPremiumDetail.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
+                                        .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
+                                for (String s : map.keySet()) {
+                                    List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
+                                    sumPremium1 = sumPremium1.add(sysPremiumDetails1.get(0).getSumpremium());
+                                }
+
+//                                sumPremium1 = sumPremium1.add(sysPremiumDetail.get(0).getSumpremium());
+                                BigDecimal reduce = sysPremiumDetail.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
+                                extractFee1 = extractFee1.add(reduce);
+                            }
+                        }
+
+                    }
+                    partnerInfoVo.setTotalIncome(sumPremium1);
+                    partnerInfoVo.setCommission(extractFee1);
+
+                    int deptManNum = 0;
+                    if (sysRelationPersonList2.size() > 0) {
+                        List<String> idList = sysRelationPersonList2.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
+                        List<SysAgencyLeader> leaderList = sysAgencyLeaderMapper.selectList(new LambdaQueryWrapper<SysAgencyLeader>()
+                                .in(SysAgencyLeader::getUserId, idList).eq(SysAgencyLeader::getDelFlag, 1));
+                        if (leaderList.size() > 0) {
+                            for (SysAgencyLeader sysAgencyLeader : leaderList) {
+                                //获取机构下的团队
+                                List<SysDept> sysDeptList = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
+                                        .likeRight(SysDept::getId, sysAgencyLeader.getDeptId())
+                                        .isNull(SysDept::getComlevel).eq(SysDept::getDelFlag, 0)
+                                        .eq(SysDept::getManagementSource, sysAgencyLeader.getSource()));
+                                if (sysDeptList.size() > 0) {
+                                    for (SysDept sysDept : sysDeptList) {
+                                        List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
+                                                .likeRight(SysUser::getId, sysDept.getId()).ne(SysUser::getStatus, 0));
+                                        deptManNum = deptManNum + sysUsers.size();
+
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    partnerInfoVo.setMemberShip(deptManNum);
+
+                    partnerInfoVoList.add(partnerInfoVo);
+                }
+
+                partnerInfoFreeVo.setPartnerInfoVoList(partnerInfoVoList);
+            }
+        }else {
+            //工作室
+            List<String> leaderIds = deptBalanceVo.getLeaderIds();
+            if (CollectionUtil.isEmpty(leaderIds)) {
+                return partnerInfoFreeVo;
+            }
+            List<SysAgencyLeader> leaderList = sysAgencyLeaderMapper.selectList(new LambdaQueryWrapper<SysAgencyLeader>()
+                    .in(SysAgencyLeader::getUserId, leaderIds).eq(SysAgencyLeader::getDelFlag, 1));
+
+
+            List<String> userIdByLeader = getUserIdByLeader(leaderList);
+            for (SysAgencyLeader sysAgencyLeader : leaderList) {
+                BigDecimal sumPremium1 = BigDecimal.ZERO;
+                BigDecimal extractFee1 = BigDecimal.ZERO;
+                SysPartnerConsoleDto partnerInfoVo = new SysPartnerConsoleDto();
+
+                String userId = sysAgencyLeader.getUserId();
+                partnerInfoVo.setUserId(userId);
+                partnerInfoVo.setLoginUserId(deptBalanceVo.getUserId());
+
+                SysUser sysUser = sysUserMapper.selectById(userId);
+                partnerInfoVo.setUserName(sysUser.getName());
+                SysUser sysUser1 = sysUserMapper.selectById(sysAgencyLeader.getSuggestId());
+                partnerInfoVo.setSuggestName(sysUser1.getName());
+                partnerInfoVo.setDeptId(sysAgencyLeader.getDeptId());
+                SysDept sysDept1 = sysDeptMapper.selectById(sysAgencyLeader.getDeptId());
+                partnerInfoVo.setDeptName(sysDept1.getName());
+                //团队总人数
+                int deptManNum = 0;
+                //获取机构下的团队
+                List<SysDept> sysDeptList = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
+                        .likeRight(SysDept::getId, sysAgencyLeader.getDeptId())
+                        .isNull(SysDept::getComlevel).eq(SysDept::getDelFlag, 0)
+                        .eq(SysDept::getManagementSource, sysAgencyLeader.getSource()));
+                partnerInfoVo.setDeptNum(sysDeptList.size());
+                List<String> collect = sysDeptList.stream().map(SysDept::getId).collect(Collectors.toList());
+
+                partnerInfoVo.setDeptIds(collect);
+                partnerInfoVo.setDeptNum(sysDeptList.size());
+                if (sysDeptList.size() > 0) {
+                    for (SysDept sysDept : sysDeptList) {
+                        List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
+                                .likeRight(SysUser::getId, sysDept.getId()).ne(SysUser::getStatus, 0));
+                        deptManNum = deptManNum + sysUsers.size();
+                        if (CollectionUtil.isNotEmpty(sysUsers)) {
+                            for (SysUser user : sysUsers) {
+                                //费用
+                                List<SysPremiumDetails> sysPremiumDetail = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
+                                        .eq(SysPremiumDetails::getUserId, loginId)
+                                        .eq(SysPremiumDetails::getIssuerId, user.getId())
+                                        .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
+                                                SysPremiumDetails::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
+                                        .eq(SysPremiumDetails::getStatus, 1)
+                                        .eq(deptBalanceVo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, deptBalanceVo.getIndustrySector()));
+                                if (sysPremiumDetail.size() >0) {
+                                    Map<String, List<SysPremiumDetails>> map = sysPremiumDetail.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
+                                            .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
+                                    for (String s : map.keySet()) {
+                                        List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
+                                        sumPremium1= sumPremium1.add(sysPremiumDetails1.get(0).getSumpremium());
+                                    }
+//                                SysPremiumDetails sysPremiumDetails = sysPremiumDetail.get(0);
+//                                sumPremium1= sumPremium1.add(sysPremiumDetail.stream().map(SysPremiumDetails::getSumpremium).reduce(BigDecimal.ZERO, BigDecimal::add));
+
+                                    extractFee1 = extractFee1.add(sysPremiumDetail.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add));
+                                }
+                            }
+                        }
+                    }
+                }
+                partnerInfoVo.setTotalIncome(sumPremium1);
+                partnerInfoVo.setCommission(extractFee1);
+                partnerInfoVo.setMemberShip(deptManNum);
+                partnerInfoVo.setLevel(deptBalanceVo.getLevel());
+                partnerInfoVoList.add(partnerInfoVo);
+            }
+            //top总费用
+            BigDecimal sumPremium = BigDecimal.ZERO;
+            BigDecimal extractFee = BigDecimal.ZERO;
+            if (userIdByLeader.size()>0) {
+                for (String id : userIdByLeader) {
+                    //总费用
+                    List<SysPremiumDetails> sysPremiumDetails = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
+                            .eq(SysPremiumDetails::getUserId, loginId)
+                            .eq(SysPremiumDetails::getIssuerId, id)
+                            .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
+                                    SysPremiumDetails::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
+                            .eq(SysPremiumDetails::getStatus, 1)
+                            .eq(deptBalanceVo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, deptBalanceVo.getIndustrySector()));
+
+                    if (sysPremiumDetails.size() >0) {
+                        Map<String, List<SysPremiumDetails>> map = sysPremiumDetails.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
+                                .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
+                        for (String s : map.keySet()) {
+                            List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
+                            sumPremium= sumPremium.add(sysPremiumDetails1.get(0).getSumpremium());
+                        }
+
+                        extractFee = extractFee.add(sysPremiumDetails.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add));
+                    }
+
+                }
+            }
+
+            partnerInfoFreeVo.setTotalIncome(sumPremium);
+            partnerInfoFreeVo.setCommission(extractFee);
+
+            int sum = partnerInfoVoList.stream().mapToInt(SysPartnerConsoleDto::getMemberShip).sum();
+            partnerInfoFreeVo.setUserIds(userIdByLeader);
+            partnerInfoFreeVo.setMemberShip(sum);
+            partnerInfoFreeVo.setPartnerInfoVoList(partnerInfoVoList);
+        }
+        int sum = partnerInfoVoList.stream().mapToInt(SysPartnerConsoleDto::getMemberShip).sum();
+        partnerInfoFreeVo.setMemberShip(sum);
+        partnerInfoFreeVo.setPartnerInfoVoList(partnerInfoVoList);
+
+        return partnerInfoFreeVo;
+    }
+
+
+    @Override
+    public SysPartnerInfoConsoleDto getTeamInfo(DeptBalanceVo deptBalanceVo) {
+        SysPartnerInfoConsoleDto appPartnerInfoFreeVo = new SysPartnerInfoConsoleDto();
+        String loginId = deptBalanceVo.getLoginUserId();
+        List<SysPartnerConsoleDto> appPartnerInfoList = new ArrayList<>();
+
+
+        List<String> deptIds = deptBalanceVo.getDeptIds();
+        if (CollectionUtil.isEmpty(deptIds)) {
+            return appPartnerInfoFreeVo;
+        }
+
+        List<SysDept> sysDeptList = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
+                .in(SysDept::getId, deptIds).eq(SysDept::getDelFlag, 0));
+        if (sysDeptList.size() == 0) {
+            return appPartnerInfoFreeVo;
+        }
+        SysUser byUserId = sysUserMapper.getByUserId(deptBalanceVo.getUserId());
+        appPartnerInfoFreeVo.setSuggestName(byUserId.getName());
+
+        for (SysDept sysDept : sysDeptList) {
+            SysPartnerConsoleDto appPartnerInfo = new SysPartnerConsoleDto();
+            appPartnerInfo.setDeptId(sysDept.getId());
+            appPartnerInfo.setDeptName(sysDept.getName());
+            String leaderId = sysDept.getLeaderId();
+            if (StringUtils.isNotEmpty(leaderId)) {
+                appPartnerInfo.setLeaderId(leaderId);
+                SysUser sysUser = sysUserMapper.selectById(leaderId);
+                appPartnerInfo.setLeaderName(sysUser.getName());
+            }
+
+            //获取机构下的团队
+            List<SysDept> sysDepTeam = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
+                    .likeRight(SysDept::getId, sysDept.getId())
+                    .isNull(SysDept::getComlevel).eq(SysDept::getDelFlag, 0)
+                    .eq(SysDept::getManagementSource, sysDept.getManagementSource()));
+            //机构下每个团队人数id集合
+            List<String> userIdList = new ArrayList<>();
+            int deptManNum = 0;
+            if (sysDepTeam.size() > 0) {
+                for (SysDept sysDept1 : sysDepTeam) {
+                    List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
+                            .likeRight(SysUser::getId, sysDept1.getId()).ne(SysUser::getStatus, 0));
+                    deptManNum = deptManNum + sysUsers.size();
+                    if (sysUsers.size() > 0) {
+                        List<String> collect = sysUsers.stream().map(SysUser::getId).collect(Collectors.toList());
+                        userIdList.addAll(collect);
+                    }
+
+                }
+            }
+            appPartnerInfo.setMemberShip(deptManNum);
+            appPartnerInfo.setUserIds(userIdList);
+            BigDecimal sumPremium = BigDecimal.ZERO;
+            BigDecimal extractFee = BigDecimal.ZERO;
+            if (CollectionUtil.isEmpty(userIdList)) continue;
+            for (String userId : userIdList) {
+                //查团队的保费
+                List<SysPremiumDetails> sysPremiumDetails = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
+                        .eq(SysPremiumDetails::getIssuerId, userId)
+                        .eq(SysPremiumDetails::getUserId, loginId)
+                        .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
+                                SysPremiumDetails::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
+                        .eq(SysPremiumDetails::getStatus, 1)
+                        .eq(deptBalanceVo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, deptBalanceVo.getIndustrySector()));
+                if (sysPremiumDetails.size() > 0) {
+                    Map<String, List<SysPremiumDetails>> map = sysPremiumDetails.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
+                            .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
+                    for (String s : map.keySet()) {
+                        List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
+                        sumPremium = sumPremium.add(sysPremiumDetails1.get(0).getSumpremium());
+                    }
+
+                    BigDecimal reduce = sysPremiumDetails.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
+                    extractFee = extractFee.add(reduce);
+                }
+
+            }
+
+            appPartnerInfo.setTotalIncome(sumPremium);
+            appPartnerInfo.setCommission(extractFee);
+            appPartnerInfo.setLoginUserId(loginId);
+            appPartnerInfoList.add(appPartnerInfo);
+        }
+
+
+
+        List<String> ids = new ArrayList<>();
+        List<List<String>> collect = appPartnerInfoList.stream().map(SysPartnerConsoleDto::getUserIds).collect(Collectors.toList());
+        if (collect.size() > 0) {
+            for (List<String> list : collect) {
+                ids.addAll(list);
+            }
+        }
+        if (CollectionUtil.isEmpty(ids)) return appPartnerInfoFreeVo;
+        BigDecimal sumPremium1 = BigDecimal.ZERO;
+        BigDecimal extractFee1 = BigDecimal.ZERO;
+        for (String id : ids) {
+
+            List<SysPremiumDetails> sysPremiumDetails = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
+                    .eq(SysPremiumDetails::getIssuerId, id)
+                    .eq(SysPremiumDetails::getUserId, loginId)
+                    .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
+                            SysPremiumDetails::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
+                    .eq(SysPremiumDetails::getStatus, 1)
+                    .eq(deptBalanceVo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, deptBalanceVo.getIndustrySector()));
+            if (sysPremiumDetails.size() > 0) {
+                Map<String, List<SysPremiumDetails>> map = sysPremiumDetails.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
+                        .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
+                for (String s : map.keySet()) {
+                    List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
+                    sumPremium1 = sumPremium1.add(sysPremiumDetails1.get(0).getSumpremium());
+                }
+//                SysPremiumDetails sysPremiumDetails1 = sysPremiumDetails.get(0);
+//                sumPremium1 = sumPremium1.add(sysPremiumDetails1.getSumpremium());
+
+                BigDecimal reduce = sysPremiumDetails.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
+                extractFee1 = extractFee1.add(reduce);
+            }
+
+        }
+        appPartnerInfoFreeVo.setTotalIncome(sumPremium1);
+        appPartnerInfoFreeVo.setCommission(extractFee1);
+        int sum = appPartnerInfoList.stream().mapToInt(SysPartnerConsoleDto::getMemberShip).sum();
+        appPartnerInfoFreeVo.setMemberShip(sum);
+        appPartnerInfoFreeVo.setPartnerInfoVoList(appPartnerInfoList);
+        appPartnerInfoFreeVo.setDeptNum(appPartnerInfoList.size());
+        return appPartnerInfoFreeVo;
+    }
+
+    @Override
+    public SysPartnerInfoConsoleDto getTeamUserInfo(DeptBalanceVo deptBalanceVo) {
+        SysPartnerInfoConsoleDto teamUserInfosFreeVo = new SysPartnerInfoConsoleDto();
+        String loginId = deptBalanceVo.getLoginUserId();
+        List<SysPartnerConsoleDto> userInfosVoList = new ArrayList<>();
+        List<String> userIds = deptBalanceVo.getUserIds();
+        if (CollectionUtil.isEmpty(userIds)) {
+            return teamUserInfosFreeVo;
+        }
+
+        BigDecimal sumPremium = BigDecimal.ZERO;
+        BigDecimal extractFee = BigDecimal.ZERO;
+        for (String userId : userIds) {
+            //费用
+            List<SysPremiumDetails> sysPremiumDetails = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
+                    .eq(SysPremiumDetails::getUserId, loginId)
+                    .eq(SysPremiumDetails::getIssuerId, userId)
+                    .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
+                            SysPremiumDetails::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
+                    .eq(SysPremiumDetails::getStatus, 1)
+                    .eq(deptBalanceVo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, deptBalanceVo.getIndustrySector()));
+            if (sysPremiumDetails.size()>0) {
+                Map<String, List<SysPremiumDetails>> map = sysPremiumDetails.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
+                        .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
+                for (String s : map.keySet()) {
+                    List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
+                    sumPremium = sumPremium.add(sysPremiumDetails1.get(0).getSumpremium());
+                }
+                BigDecimal reduce = sysPremiumDetails.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
+                extractFee = extractFee.add(reduce);
+            }
+        }
+        teamUserInfosFreeVo.setTotalIncome(sumPremium);
+        teamUserInfosFreeVo.setCommission(extractFee);
+        List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
+                .ne(SysUser::getStatus, 0).in(SysUser::getId, deptBalanceVo.getUserIds()));
+        for (SysUser sysUser : sysUsers) {
+            SysPartnerConsoleDto teamUserInfosVo = new SysPartnerConsoleDto();
+            teamUserInfosVo.setUserId(sysUser.getId());
+            teamUserInfosVo.setUserName(sysUser.getName());
+            EsmUserReferrer esmUserReferrer = esmUserReferrerMapper.selectById(sysUser.getId());
+            if (esmUserReferrer != null) {
+                teamUserInfosVo.setLeaderId(esmUserReferrer.getReferrerId());
+                SysUser sysUser1 = sysUserMapper.selectById(esmUserReferrer.getReferrerId());
+                teamUserInfosVo.setSuggestName(sysUser1.getName());
+            }
+            BigDecimal sumPremium1 =BigDecimal.ZERO;
+            BigDecimal extractFee1 =BigDecimal.ZERO;
+            //费用
+            List<SysPremiumDetails> sysPremiumDetail = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
+                    .eq(SysPremiumDetails::getIssuerId, sysUser.getId())
+                    .eq(SysPremiumDetails::getUserId, loginId)
+                    .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
+                            SysPremiumDetails::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
+                    .eq(SysPremiumDetails::getStatus, 1)
+                    .eq(deptBalanceVo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, deptBalanceVo.getIndustrySector()));
+            if (sysPremiumDetail.size()>0) {
+                Map<String, List<SysPremiumDetails>> map = sysPremiumDetail.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
+                        .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
+                for (String s : map.keySet()) {
+                    List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
+                    sumPremium1 = sumPremium1.add(sysPremiumDetails1.get(0).getSumpremium());
+                }
+                extractFee1 =extractFee1.add(sysPremiumDetail.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add)) ;
+            }
+
+            teamUserInfosVo.setTotalIncome(sumPremium1);
+            teamUserInfosVo.setCommission(extractFee1);
+            userInfosVoList.add(teamUserInfosVo);
+        }
+        teamUserInfosFreeVo.setMemberShip(userIds.size());
+        teamUserInfosFreeVo.setPartnerInfoVoList(userInfosVoList);
+        return teamUserInfosFreeVo;
+    }
+
+
+    private List<String> getUserIds(List<SysRelationPerson> sysRelationPersons) {
+        List<String> userIds = new ArrayList<>();
+        if (sysRelationPersons.size() > 0) {
+            List<String> idList = sysRelationPersons.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
+            List<SysAgencyLeader> leaderList = sysAgencyLeaderMapper.selectList(new LambdaQueryWrapper<SysAgencyLeader>()
+                    .in(CollectionUtil.isNotEmpty(idList), SysAgencyLeader::getUserId, idList).eq(SysAgencyLeader::getDelFlag, 1));
+            if (leaderList.size() > 0) {
+                for (SysAgencyLeader sysAgencyLeader : leaderList) {
+                    //获取机构下的团队
+                    List<SysDept> sysDeptList = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
+                            .likeRight(SysDept::getId, sysAgencyLeader.getDeptId())
+                            .isNull(SysDept::getComlevel).eq(SysDept::getDelFlag, 0)
+                            .eq(SysDept::getManagementSource, sysAgencyLeader.getSource()));
+                    if (sysDeptList.size() > 0) {
+                        for (SysDept sysDept : sysDeptList) {
+                            List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
+                                    .likeRight(SysUser::getId, sysDept.getId()).ne(SysUser::getStatus, 0));
+                            if (sysUsers.size()>0) {
+                                userIds.addAll(sysUsers.stream().map(SysUser::getId).collect(Collectors.toList()));
+                            }
+                        }
+                    }
+                }
+            }
+
+        }
+        return userIds;
+    }
+
+    private List<String> getUserIdByLeader(List<SysAgencyLeader> leaderList) {
+        List<String> userIds = new ArrayList<>();
+        if (leaderList.size() > 0) {
+            for (SysAgencyLeader sysAgencyLeader : leaderList) {
+                //获取机构下的团队
+                List<SysDept> sysDeptList = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
+                        .likeRight(SysDept::getId, sysAgencyLeader.getDeptId())
+                        .isNull(SysDept::getComlevel).eq(SysDept::getDelFlag, 0)
+                        .eq(SysDept::getManagementSource, sysAgencyLeader.getSource()));
+                if (sysDeptList.size() > 0) {
+                    for (SysDept sysDept : sysDeptList) {
+                        List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
+                                .likeRight(SysUser::getId, sysDept.getId()).ne(SysUser::getStatus, 0));
+                        if (sysUsers.size()>0) {
+                            userIds.addAll(sysUsers.stream().map(SysUser::getId).collect(Collectors.toList()));
+                        }
+                    }
+                }
+            }
+        }
+        return userIds;
+    }
 }
 
 

+ 64 - 3
src/main/java/com/ydtech/modules/admin/service/impl/ProfitAnalysisServiceImpl.java

@@ -1,6 +1,9 @@
 package com.ydtech.modules.admin.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.dto.PayAmountExcel;
+import com.ydtech.modules.admin.model.dto.ReceivableExcel;
 import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto;
 import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisQueryDto;
 import com.ydtech.modules.admin.service.ProfitAnalysisService;
@@ -12,14 +15,20 @@ import com.ydtech.modules.inv.dao.InvAccountMapper;
 import com.ydtech.modules.inv.model.InvAccount;
 import com.ydtech.modules.inv.model.InvAccountCardVo;
 import com.ydtech.modules.inv.model.InvAccountExpenses;
+import com.ydtech.modules.inv.utils.EasyExcelUtils;
 import com.ydtech.utils.BigDecimalUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -44,6 +53,14 @@ public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
     @Autowired
     private InvAccountExpensesMapper invAccountExpensesMapper;
 
+
+    @Value("${upload.file.path}")
+    private String uploadPath;
+
+
+    @Value("${upload.file.url}")
+    private String uploadUrl;
+
     /**
      *  @version
      *  @author: hxl
@@ -66,9 +83,12 @@ public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
      */
     @Override
     public List<ProfitAnalysisDto> getProfitAnalysisQueryList(ProfitAnalysisQueryDto profitAnalysisQueryDto) {
-        HashMap<String, String> dateMapByType = getDateMapByType(profitAnalysisQueryDto.getDateType(), profitAnalysisQueryDto.getYear());
-        profitAnalysisQueryDto.setBeginDate(dateMapByType.get("startDate"));
-        profitAnalysisQueryDto.setEndDate(dateMapByType.get("endDate"));
+        if(StringUtils.isNotEmpty(profitAnalysisQueryDto.getDateType())){
+            profitAnalysisQueryDto.setYear(null);
+            HashMap<String, String> dateMapByType = getDateMapByType(profitAnalysisQueryDto.getDateType(), profitAnalysisQueryDto.getYear());
+            profitAnalysisQueryDto.setBeginDate(dateMapByType.get("startDate"));
+            profitAnalysisQueryDto.setEndDate(dateMapByType.get("endDate"));
+        }
         List<ProfitAnalysisDto> profitAnalysisQueryList = insPlyIncomeMapper.getProfitAnalysisQueryList(profitAnalysisQueryDto);
         if(!profitAnalysisQueryList.isEmpty()){
             for (ProfitAnalysisDto profitAnalysisDto : profitAnalysisQueryList) {
@@ -380,6 +400,47 @@ public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
         map.put("endDate",endDateStr);
         return map;
     }
+
+
+    /**
+     * @description:   控制台-利润分析应收金额导出明细
+     * @author: whp
+     **/
+    @Override
+    public HttpResult receivableExcel(ProfitAnalysisQueryDto profitAnalysisQueryDto) {
+        List<ReceivableExcel> list = profitAnalysisMapper.receivableExcel(profitAnalysisQueryDto);
+        String uploadPath = this.uploadPath + "/excel/";
+        Path path = Paths.get(uploadPath);
+        if (!Files.exists(path)) {
+            try {
+                Files.createDirectories(path);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        String fileName = EasyExcelUtils.downExcel(uploadPath, "应收明细", ReceivableExcel.class, list);
+        return HttpResult.ok("", uploadUrl + "excel/" + fileName);
+    }
+
+    /**
+     * @description:   控制台-利润分析实付金额导出明细
+     * @author: whp
+     **/
+    @Override
+    public HttpResult payAmountExcel(ProfitAnalysisQueryDto profitAnalysisQueryDto) {
+        List<PayAmountExcel> list = profitAnalysisMapper.payAmountExcel(profitAnalysisQueryDto);
+        String uploadPath = this.uploadPath + "/excel/";
+        Path path = Paths.get(uploadPath);
+        if (!Files.exists(path)) {
+            try {
+                Files.createDirectories(path);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        String fileName = EasyExcelUtils.downExcel(uploadPath, "实付明细", PayAmountExcel.class, list);
+        return HttpResult.ok("", uploadUrl + "excel/" + fileName);
+    }
 }
 
 

+ 36 - 1
src/main/java/com/ydtech/modules/admin/service/impl/SysDeptServiceImpl.java

@@ -16,6 +16,7 @@ import com.ydtech.modules.admin.dao.SysUserDeptRelationshipMapper;
 import com.ydtech.modules.admin.dao.SysUserMapper;
 import com.ydtech.modules.admin.model.SysArea;
 import com.ydtech.modules.admin.model.SysDept;
+import com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto;
 import com.ydtech.modules.admin.model.po.SysUserDeptRelationship;
 import com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo;
 import com.ydtech.modules.admin.model.vo.*;
@@ -828,6 +829,19 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
         if (users == null || users.isEmpty()) {
             return new ArrayList<>();
         }
+
+        List<SysUser> allList = new ArrayList<>();
+        for (SysUser user : users) {
+            this.addLeadUserList(user,allList);
+        }
+        List<SysUser> collect = allList.stream()
+                .collect(Collectors.collectingAndThen(
+                        Collectors.toMap(SysUser::getId, u -> u, (u1, u2) -> u1),  // 以id作为键来合并重复元素,保留第一个遇到的元素
+                        Map::values))
+                .stream()
+                .distinct()  // 进一步确保去重,主要针对可能存在的相同id但不同对象引用情况(较极端情况)
+                .collect(Collectors.toList());
+
         List<SysUser> topUsers = new ArrayList<>(); //存放1级用户,即没有直接上级的用户
         // 根据组织结构展示级别,筛选顶层节点并构建组织结构树
         if("admin".equals(sysUser.getName())){
@@ -837,10 +851,31 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
             topUsers.add(sysUser);
         }
         // 递归构建用户树结构
-        buildUserTree(topUsers, users,managementSource);
+        buildUserTree(topUsers, collect,managementSource);
         return topUsers;
     }
 
+    private void addLeadUserList(SysUser user, List<SysUser> allList) {
+        addLeadUserList(user, allList, new HashSet<>());
+    }
+
+    private void addLeadUserList(SysUser user, List<SysUser> allList, Set<String> processedIds) {
+        if (user == null) {
+            return;
+        }
+        // 先判断当前用户ID是否已经处理过,如果处理过则直接返回,避免循环引用导致的无限递归
+        if (processedIds.contains(user.getId())) {
+            return;
+        }
+        allList.add(user);
+        processedIds.add(user.getId());
+        String leaderId = user.getLeaderId();
+        if (StringUtils.isNotEmpty(leaderId)) {
+            SysUser leaderUser = sysUserMapper.getByUserId(leaderId);
+            addLeadUserList(leaderUser, allList, processedIds);
+        }
+    }
+
     /**
      * 拼接机构来源
      * @param users

+ 115 - 196
src/main/java/com/ydtech/modules/admin/service/impl/SysPartnerServiceImpl.java

@@ -439,7 +439,7 @@ public class SysPartnerServiceImpl extends ServiceImpl<SysPartnerMapper, SysPart
                             historyFee = historyFee.add(sysAgencyFeeApproval.getHistoryFee());
                         }
                     }
-                    agencyExtractFee.setHistoryFee(Optional.ofNullable(extractFee.subtract(historyFee)).orElse(BigDecimal.ZERO));
+                    agencyExtractFee.setHistoryFee(historyFee);
                     //可提现 = 总抽成-已提现
                     agencyExtractFee.setCashFee(extractFee.subtract(historyFee));
 
@@ -1160,225 +1160,144 @@ public class SysPartnerServiceImpl extends ServiceImpl<SysPartnerMapper, SysPart
         PartnerInfoFreeVo partnerInfoFreeVo = new PartnerInfoFreeVo();
         List<PartnerInfoVo> partnerInfoVoList = new ArrayList<>();
         String loginId = BaseController.getUserId();
-        //合伙人:1;工作室:2
-        Integer type = partnerGradeInfo.getType();
-        if (type == 1) {
-            List<String> partnerIds = partnerGradeInfo.getPartnerIds();
-            if (CollectionUtil.isEmpty(partnerIds)) {
-                return partnerInfoFreeVo;
-            }
-            //合伙人的直接工作室贡献的费用
-            List<SysRelationPerson> sysRelationPersons = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
-                    .in(SysRelationPerson::getSuggestId, partnerIds)
-                    .eq(SysRelationPerson::getDelFlag, 1)
-                    .eq(SysRelationPerson::getSource, 0)
-                    .eq(SysRelationPerson::getType, 1));
-            //工作室下所有的人
-            List<SysRelationPerson> sysRelationPersons1 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
-                    .in(SysRelationPerson::getSuggestId, partnerIds)
-                    .eq(SysRelationPerson::getDelFlag, 1)
-                    .eq(SysRelationPerson::getType, 1));
-            List<String> userIds = getUserIds(sysRelationPersons1);
-            BigDecimal sumPremium = BigDecimal.ZERO;
-            BigDecimal extractFee = BigDecimal.ZERO;
-            if (CollectionUtil.isNotEmpty(userIds)) {
-                for (String userId : userIds) {
-
-                    //费用
-                    List<SysPremiumDetails> sysPremiumDetails = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
-                            .eq(SysPremiumDetails::getUserId, loginId)
-                            .eq(SysPremiumDetails::getIssuerId,userId)
-                            .between(StringUtils.isNotEmpty(partnerGradeInfo.getBeginTime()) && StringUtils.isNotEmpty(partnerGradeInfo.getEndTime()),
-                                    SysPremiumDetails::getCreateTime, partnerGradeInfo.getBeginTime(), partnerGradeInfo.getEndTime())
-                            .eq(partnerGradeInfo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, partnerGradeInfo.getIndustrySector())
-                            .eq(SysPremiumDetails::getStatus, 1));
-                    if (CollectionUtil.isNotEmpty(sysPremiumDetails)) {
-                        Map<String, List<SysPremiumDetails>> map = sysPremiumDetails.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
-                                .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
-                        for (String s : map.keySet()) {
-                            List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
-                            sumPremium = sumPremium.add(sysPremiumDetails1.get(0).getSumpremium());
-                        }
-
-//                        sumPremium = sumPremium.add(sysPremiumDetails.get(0).getSumpremium());
-                        BigDecimal reduce = sysPremiumDetails.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
-                        extractFee = extractFee.add(reduce);
+        List<String> partnerIds = partnerGradeInfo.getPartnerIds();
+        if (CollectionUtil.isEmpty(partnerIds)) {
+            return partnerInfoFreeVo;
+        }
+        //关联工作室下所有的人
+        List<SysRelationPerson> sysRelationPersons1 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                .in(SysRelationPerson::getSuggestId, partnerIds)
+                .eq(SysRelationPerson::getDelFlag, 1)
+                .eq(SysRelationPerson::getType, 1));
+        List<String> userIds = getUserIds(sysRelationPersons1);
+        BigDecimal sumPremium = BigDecimal.ZERO;
+        BigDecimal extractFee = BigDecimal.ZERO;
+        if (CollectionUtil.isNotEmpty(userIds)) {
+            for (String userId : userIds) {
+                //费用
+                List<SysPremiumDetails> sysPremiumDetails = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
+                        .eq(SysPremiumDetails::getUserId, loginId)
+                        .eq(SysPremiumDetails::getIssuerId,userId)
+                        .between(StringUtils.isNotEmpty(partnerGradeInfo.getBeginTime()) && StringUtils.isNotEmpty(partnerGradeInfo.getEndTime()),
+                                SysPremiumDetails::getCreateTime, partnerGradeInfo.getBeginTime(), partnerGradeInfo.getEndTime())
+                        .eq(partnerGradeInfo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, partnerGradeInfo.getIndustrySector())
+                        .eq(SysPremiumDetails::getStatus, 1));
+                if (CollectionUtil.isNotEmpty(sysPremiumDetails)) {
+                    Map<String, List<SysPremiumDetails>> map = sysPremiumDetails.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
+                            .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
+                    for (String s : map.keySet()) {
+                        List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
+                        sumPremium = sumPremium.add(sysPremiumDetails1.get(0).getSumpremium());
                     }
 
+//                        sumPremium = sumPremium.add(sysPremiumDetails.get(0).getSumpremium());
+                    BigDecimal reduce = sysPremiumDetails.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
+                    extractFee = extractFee.add(reduce);
                 }
-            }
-            partnerInfoFreeVo.setSumPremium(sumPremium);
-            partnerInfoFreeVo.setExtractFee(extractFee);
-
-            //合伙人
-            List<SysPartner> sysPartnerList = sysPartnerMapper.selectList(new LambdaQueryWrapper<SysPartner>()
-                    .in(SysPartner::getUserId, partnerGradeInfo.getPartnerIds()).eq(SysPartner::getDelFlag, 1));
-            if (sysPartnerList.size() > 0) {
-                for (SysPartner sysPartner : sysPartnerList) {
-                    PartnerInfoVo partnerInfoVo = new PartnerInfoVo();
-                    partnerInfoVo.setLevel(sysPartner.getType());
-                    String userId = sysPartner.getUserId();
-                    partnerInfoVo.setUserId(userId);
-                    SysUser sysUser = sysUserMapper.selectById(userId);
-                    partnerInfoVo.setUserName(sysUser.getName());
-                    SysUser sysUser1 = sysUserMapper.selectById(sysPartner.getSuggestId());
-                    partnerInfoVo.setSuggestName(sysUser1.getName());
-                    //直接合伙人
-                    List<SysRelationPerson> sysRelationPersonList = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
-                            .eq(SysRelationPerson::getSuggestId, userId)
-                            .eq(SysRelationPerson::getDelFlag, 1)
-                            .eq(SysRelationPerson::getType, 0)
-                            .eq(SysRelationPerson::getSource, 0));
-                    List<String> collect = sysRelationPersonList.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
-                    partnerInfoVo.setPartnerIds(collect);
-                    partnerInfoVo.setPartnerNumber(collect.size());
-
-                    //直接管理员
-                    List<SysRelationPerson> sysRelationPersonList1 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
-                            .eq(SysRelationPerson::getSuggestId, userId)
-                            .eq(SysRelationPerson::getDelFlag, 1)
-                            .eq(SysRelationPerson::getType, 1)
-                            .eq(SysRelationPerson::getSource, 0));
-
-                    List<String> collects = sysRelationPersonList1.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
-                    partnerInfoVo.setLeaderIds(collects);
-                    partnerInfoVo.setWorkNumber(collects.size());
-                    //所有贡献费用
-                    //合伙人下所有工作室数 核算总代理人数
-                    List<SysRelationPerson> sysRelationPersonList2 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
-                            .eq(SysRelationPerson::getSuggestId, userId)
-                            .eq(SysRelationPerson::getDelFlag, 1)
-                            .eq(SysRelationPerson::getType, 1));
 
-                    List<String> userIds1 = getUserIds(sysRelationPersonList2);
-                    BigDecimal sumPremium1 = BigDecimal.ZERO;
-                    BigDecimal extractFee1 = BigDecimal.ZERO;
-                    if (CollectionUtil.isNotEmpty(userIds1)) {
-                        for (String id : userIds1) {
-                            //费用
-                            List<SysPremiumDetails> sysPremiumDetail = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
-                                    .eq(SysPremiumDetails::getUserId, loginId)
-                                    .eq(SysPremiumDetails::getIssuerId,id)
-                                    .between(StringUtils.isNotEmpty(partnerGradeInfo.getBeginTime()) && StringUtils.isNotEmpty(partnerGradeInfo.getEndTime()),
-                                            SysPremiumDetails::getCreateTime, partnerGradeInfo.getBeginTime(), partnerGradeInfo.getEndTime())
-                                    .eq(SysPremiumDetails::getStatus, 1)
-                                    .eq(partnerGradeInfo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, partnerGradeInfo.getIndustrySector()));
+            }
+        }
+        partnerInfoFreeVo.setSumPremium(sumPremium);
+        partnerInfoFreeVo.setExtractFee(extractFee);
 
-                            if (CollectionUtil.isNotEmpty(sysPremiumDetail)) {
-                                Map<String, List<SysPremiumDetails>> map = sysPremiumDetail.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
-                                        .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
-                                for (String s : map.keySet()) {
-                                    List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
-                                    sumPremium1 = sumPremium1.add(sysPremiumDetails1.get(0).getSumpremium());
-                                }
+        //合伙人
+        List<SysPartner> sysPartnerList = sysPartnerMapper.selectList(new LambdaQueryWrapper<SysPartner>()
+                .in(SysPartner::getUserId, partnerGradeInfo.getPartnerIds()).eq(SysPartner::getDelFlag, 1));
+        if (sysPartnerList.size() > 0) {
+            for (SysPartner sysPartner : sysPartnerList) {
+                PartnerInfoVo partnerInfoVo = new PartnerInfoVo();
+                partnerInfoVo.setLevel(sysPartner.getType());
+                String userId = sysPartner.getUserId();
+                partnerInfoVo.setUserId(userId);
+                SysUser sysUser = sysUserMapper.selectById(userId);
+                partnerInfoVo.setUserName(sysUser.getName());
+                SysUser sysUser1 = sysUserMapper.selectById(sysPartner.getSuggestId());
+                partnerInfoVo.setSuggestName(sysUser1.getName());
+                //直接合伙人
+                List<SysRelationPerson> sysRelationPersonList = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                        .eq(SysRelationPerson::getSuggestId, userId)
+                        .eq(SysRelationPerson::getDelFlag, 1)
+                        .eq(SysRelationPerson::getType, 0)
+                        .eq(SysRelationPerson::getSource, 0));
+                List<String> collect = sysRelationPersonList.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
+                partnerInfoVo.setPartnerIds(collect);
+                partnerInfoVo.setPartnerNumber(collect.size());
 
-//                                sumPremium1 = sumPremium1.add(sysPremiumDetail.get(0).getSumpremium());
-                                BigDecimal reduce = sysPremiumDetail.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
-                                extractFee1 = extractFee1.add(reduce);
-                            }
-                        }
+                //直接管理员
+                List<SysRelationPerson> sysRelationPersonList1 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                        .eq(SysRelationPerson::getSuggestId, userId)
+                        .eq(SysRelationPerson::getDelFlag, 1)
+                        .eq(SysRelationPerson::getType, 1)
+                        .eq(SysRelationPerson::getSource, 0));
 
-                    }
-                    partnerInfoVo.setSumPremium(sumPremium1);
-                    partnerInfoVo.setExtractFee(extractFee1);
+                List<String> collects = sysRelationPersonList1.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
+                partnerInfoVo.setLeaderIds(collects);
+                partnerInfoVo.setWorkNumber(collects.size());
+                //所有贡献费用
+                //合伙人下所有工作室数 核算总代理人数
+                List<SysRelationPerson> sysRelationPersonList2 = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
+                        .eq(SysRelationPerson::getSuggestId, userId)
+                        .eq(SysRelationPerson::getDelFlag, 1)
+                        .eq(SysRelationPerson::getType, 1));
 
-                    int deptManNum = 0;
-                    if (sysRelationPersonList2.size() > 0) {
-                        List<String> idList = sysRelationPersonList2.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
-                        List<SysAgencyLeader> leaderList = sysAgencyLeaderMapper.selectList(new LambdaQueryWrapper<SysAgencyLeader>()
-                                .in(SysAgencyLeader::getUserId, idList).eq(SysAgencyLeader::getDelFlag, 1));
-                        if (leaderList.size() > 0) {
-                            for (SysAgencyLeader sysAgencyLeader : leaderList) {
-                                //获取机构下的团队
-                                List<SysDept> sysDeptList = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
-                                        .likeRight(SysDept::getId, sysAgencyLeader.getDeptId())
-                                        .isNull(SysDept::getComlevel).eq(SysDept::getDelFlag, 0)
-                                        .eq(SysDept::getManagementSource, sysAgencyLeader.getSource()));
-                                if (sysDeptList.size() > 0) {
-                                    for (SysDept sysDept : sysDeptList) {
-                                        List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
-                                                .likeRight(SysUser::getId, sysDept.getId()).ne(SysUser::getStatus, 0));
-                                        deptManNum = deptManNum + sysUsers.size();
+                List<String> userIds1 = getUserIds(sysRelationPersonList2);
+                BigDecimal sumPremium1 = BigDecimal.ZERO;
+                BigDecimal extractFee1 = BigDecimal.ZERO;
+                if (CollectionUtil.isNotEmpty(userIds1)) {
+                    for (String id : userIds1) {
+                        //费用
+                        List<SysPremiumDetails> sysPremiumDetail = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
+                                .eq(SysPremiumDetails::getUserId, loginId)
+                                .eq(SysPremiumDetails::getIssuerId,id)
+                                .between(StringUtils.isNotEmpty(partnerGradeInfo.getBeginTime()) && StringUtils.isNotEmpty(partnerGradeInfo.getEndTime()),
+                                        SysPremiumDetails::getCreateTime, partnerGradeInfo.getBeginTime(), partnerGradeInfo.getEndTime())
+                                .eq(SysPremiumDetails::getStatus, 1)
+                                .eq(partnerGradeInfo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, partnerGradeInfo.getIndustrySector()));
 
-                                    }
-                                }
+                        if (CollectionUtil.isNotEmpty(sysPremiumDetail)) {
+                            Map<String, List<SysPremiumDetails>> map = sysPremiumDetail.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
+                                    .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
+                            for (String s : map.keySet()) {
+                                List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
+                                sumPremium1 = sumPremium1.add(sysPremiumDetails1.get(0).getSumpremium());
                             }
+
+//                                sumPremium1 = sumPremium1.add(sysPremiumDetail.get(0).getSumpremium());
+                            BigDecimal reduce = sysPremiumDetail.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
+                            extractFee1 = extractFee1.add(reduce);
                         }
                     }
-                    partnerInfoVo.setTeamManNum(deptManNum);
-
-                    partnerInfoVoList.add(partnerInfoVo);
                 }
-
-                partnerInfoFreeVo.setPartnerInfoVoList(partnerInfoVoList);
-            }
-        } else {
-            //工作室
-            List<String> leaderIds = partnerGradeInfo.getLeaderIds();
-            if (CollectionUtil.isEmpty(leaderIds)) {
-                return partnerInfoFreeVo;
-            }
-            //费用
-            List<SysPremiumDetails> sysPremiumDetails = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
-                    .in(SysPremiumDetails::getUserId, leaderIds)
-                    .between(StringUtils.isNotEmpty(partnerGradeInfo.getBeginTime()) && StringUtils.isNotEmpty(partnerGradeInfo.getEndTime()),
-                            SysPremiumDetails::getCreateTime, partnerGradeInfo.getBeginTime(), partnerGradeInfo.getEndTime())
-                    .eq(SysPremiumDetails::getStatus, 1)
-                    .eq(partnerGradeInfo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, partnerGradeInfo.getIndustrySector()));
-            BigDecimal sumPremium = sysPremiumDetails.stream().map(SysPremiumDetails::getSumpremium).reduce(BigDecimal.ZERO, BigDecimal::add);
-            BigDecimal extractFee = sysPremiumDetails.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
-            partnerInfoFreeVo.setSumPremium(sumPremium);
-            partnerInfoFreeVo.setExtractFee(extractFee);
-
-
-            List<SysAgencyLeader> leaderList = sysAgencyLeaderMapper.selectList(new LambdaQueryWrapper<SysAgencyLeader>()
-                    .in(SysAgencyLeader::getUserId, leaderIds).eq(SysAgencyLeader::getDelFlag, 1));
-
-            for (SysAgencyLeader sysAgencyLeader : leaderList) {
-                PartnerInfoVo partnerInfoVo = new PartnerInfoVo();
-
-                String userId = sysAgencyLeader.getUserId();
-                partnerInfoVo.setUserId(userId);
-                SysUser sysUser = sysUserMapper.selectById(userId);
-                partnerInfoVo.setUserName(sysUser.getName());
-                SysUser sysUser1 = sysUserMapper.selectById(sysAgencyLeader.getSuggestId());
-                partnerInfoVo.setSuggestName(sysUser1.getName());
-
-                //费用
-                List<SysPremiumDetails> sysPremiumDetail = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
-                        .eq(SysPremiumDetails::getUserId, userId)
-                        .between(StringUtils.isNotEmpty(partnerGradeInfo.getBeginTime()) && StringUtils.isNotEmpty(partnerGradeInfo.getEndTime()),
-                                SysPremiumDetails::getCreateTime, partnerGradeInfo.getBeginTime(), partnerGradeInfo.getEndTime())
-                        .eq(SysPremiumDetails::getStatus, 1)
-                        .eq(partnerGradeInfo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, partnerGradeInfo.getIndustrySector()));
-                BigDecimal sumPremium1 = sysPremiumDetail.stream().map(SysPremiumDetails::getSumpremium).reduce(BigDecimal.ZERO, BigDecimal::add);
-                BigDecimal extractFee1 = sysPremiumDetail.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add);
                 partnerInfoVo.setSumPremium(sumPremium1);
                 partnerInfoVo.setExtractFee(extractFee1);
 
                 int deptManNum = 0;
-                //获取机构下的团队
-                List<SysDept> sysDeptList = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
-                        .likeRight(SysDept::getId, sysAgencyLeader.getDeptId())
-                        .isNull(SysDept::getComlevel).eq(SysDept::getDelFlag, 0)
-                        .eq(SysDept::getManagementSource, sysAgencyLeader.getSource()));
-
-                partnerInfoVo.setDeptNum(sysDeptList.size());
-                List<String> collect = sysDeptList.stream().map(SysDept::getId).collect(Collectors.toList());
-                partnerInfoVo.setDeptIds(collect);
-                if (sysDeptList.size() > 0) {
-                    for (SysDept sysDept : sysDeptList) {
-                        List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
-                                .likeRight(SysUser::getId, sysDept.getId()).ne(SysUser::getStatus, 0));
-                        deptManNum = deptManNum + sysUsers.size();
+                if (sysRelationPersonList2.size() > 0) {
+                    List<String> idList = sysRelationPersonList2.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
+                    List<SysAgencyLeader> leaderList = sysAgencyLeaderMapper.selectList(new LambdaQueryWrapper<SysAgencyLeader>()
+                            .in(SysAgencyLeader::getUserId, idList).eq(SysAgencyLeader::getDelFlag, 1));
+                    if (leaderList.size() > 0) {
+                        for (SysAgencyLeader sysAgencyLeader : leaderList) {
+                            //获取机构下的团队
+                            List<SysDept> sysDeptList = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
+                                    .likeRight(SysDept::getId, sysAgencyLeader.getDeptId())
+                                    .isNull(SysDept::getComlevel).eq(SysDept::getDelFlag, 0)
+                                    .eq(SysDept::getManagementSource, sysAgencyLeader.getSource()));
+                            if (sysDeptList.size() > 0) {
+                                for (SysDept sysDept : sysDeptList) {
+                                    List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
+                                            .likeRight(SysUser::getId, sysDept.getId()).ne(SysUser::getStatus, 0));
+                                    deptManNum = deptManNum + sysUsers.size();
 
+                                }
+                            }
+                        }
                     }
                 }
                 partnerInfoVo.setTeamManNum(deptManNum);
 
                 partnerInfoVoList.add(partnerInfoVo);
             }
-
         }
         int sum = partnerInfoVoList.stream().mapToInt(PartnerInfoVo::getTeamManNum).sum();
         partnerInfoFreeVo.setTeamManNum(sum);

+ 41 - 3
src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java

@@ -251,7 +251,7 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
     @Override
     public BasePageResult<SysUserAccount> queryByVo1(SysUserAccountVo sysUserAccountVo) {
         Page<SysUserAccount> page = new Page<>(sysUserAccountVo.getPageNum(), sysUserAccountVo.getPageSize());
-        Page<SysUserAccount> sysUserAccountHistoryPage = baseMapper.queryPageOrder1(sysUserAccountVo,page);
+        Page<SysUserAccount> sysUserAccountHistoryPage = baseMapper.queryPageOrder1(page,sysUserAccountVo);
         if(sysUserAccountHistoryPage!=null){
             List<SysUserAccount> records = sysUserAccountHistoryPage.getRecords();
             List<SysUserAccount> newRecords = new ArrayList<>();
@@ -284,7 +284,7 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
             }
             sysUserAccountHistoryPage.setRecords(newRecords);
         }
-        return new BasePageResult<>(sysUserAccountVo.getPageNum(), page.getSize(), sysUserAccountHistoryPage.getTotal(), page.getPages(),
+        return new BasePageResult<>(sysUserAccountVo.getPageNum(), sysUserAccountVo.getPageSize(), sysUserAccountHistoryPage.getTotal(), page.getPages(),
                 sysUserAccountHistoryPage.getRecords());
     }
 
@@ -1664,6 +1664,44 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
             }
         }
     }
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/1/6 18:27
+     *  @Description:  查询提现的总金额
+     */
+    @Override
+    public BigDecimal queryCount() {;
+        List<SysUserAccount> list = baseMapper.queryCount();
+        BigDecimal sumYsTXAmount =BigDecimal.ZERO;
+        if(list!=null && !list.isEmpty()){
+            for(SysUserAccount  sysUserAccount :list){
+                MySumAmountQueryDto mySumAmountQueryDto =new MySumAmountQueryDto();
+                mySumAmountQueryDto.setUserId(sysUserAccount.getUserId());
+                //出单员是19 且是渠道的话,给渠道团队长
+                if ("21".equals(sysUserAccount.getRoleId()) && "1".equals(sysUserAccount.getManagementSource())) {
+                    mySumAmountQueryDto.setDeptId(sysUserAccount.getDeptId());
+                }
+                //如果是电销组长,将组员的数据算进来
+                if ("72".equals(sysUserAccount.getRoleId()) && "3".equals(sysUserAccount.getManagementSource())) {
+                    mySumAmountQueryDto.setGroupFlag(true);
+                }
+                // 可提现
+                BigDecimal ssKTAmount = sysUserAccount.getSumAmount()==null?BigDecimal.ZERO:sysUserAccount.getSumAmount();
+                sumYsTXAmount =sumYsTXAmount.add(ssKTAmount);
+            }
+        }
+        return   sumYsTXAmount;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/1/6 18:28
+     *  @Description:  通过用户id查询银行卡信息
+     */
+    @Override
+    public List<SysUserBankCard> queryCardListByUserId(String userId) {
+        return baseMapper.queryCardListByUserId(userId);
+    }
 
 }

+ 112 - 4
src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java

@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.gson.Gson;
 import com.ydtech.constants.InsuranceImageEnum;
 import com.ydtech.constants.SysConstants;
+import com.ydtech.constants.enums.dict.organization.OrganizationSource;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageResult;
 import com.ydtech.exception.SystemException;
@@ -21,10 +22,7 @@ import com.ydtech.modules.admin.components.UnionPayRequestApiComponent;
 import com.ydtech.modules.admin.components.request.UnionPayRequest;
 import com.ydtech.modules.admin.components.response.UnionPayResponse;
 import com.ydtech.modules.admin.constants.*;
-import com.ydtech.modules.admin.dao.SysDeptMapper;
-import com.ydtech.modules.admin.dao.SysPartnerMapper;
-import com.ydtech.modules.admin.dao.SysUserLinkAreaMapper;
-import com.ydtech.modules.admin.dao.SysUserMapper;
+import com.ydtech.modules.admin.dao.*;
 import com.ydtech.modules.admin.model.*;
 import com.ydtech.modules.admin.model.dto.*;
 import com.ydtech.modules.admin.model.po.SysUserAgentTrack;
@@ -44,7 +42,9 @@ import com.ydtech.modules.esm.model.vo.EsmUserImageVo;
 import com.ydtech.modules.esm.service.EsmUserImageService;
 import com.ydtech.modules.esm.service.EsmUserReferrerService;
 import com.ydtech.modules.message.constants.MessageTypeConstants;
+import com.ydtech.modules.message.entity.SystemMessage;
 import com.ydtech.modules.message.service.MessageSecretaryService;
+import com.ydtech.modules.message.service.SystemMessageService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.security.utils.PasswordUtils;
 import com.ydtech.utils.IDCardUtils;
@@ -142,6 +142,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Autowired
     private SysUserBankCardService bankCardService;
 
+    @Autowired
+    private SystemMessageService systemMessageService;
+
+    @Autowired
+    private SysUserRoleMapper sysUserRoleMapper;
+
     @Value("${httpUrl}")
     private String httpUrl;
     //晋掌柜APP: 未注册的手机号登录时创建新账户使用 -deptId -referrerId
@@ -872,6 +878,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
             SysUserInfo userInfo = sysUserVo.getSysUserInfo();
             userInfo.setId(sysUser.getId());
             sysUserInfoService.save(userInfo);
+            //站内信发送
+            pushMessageOrder(sysUser);
         } else {
             userId = gainNextUserId(sysUser.getDeptId());
 
@@ -896,6 +904,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                 //如果是 团队长或代码人 并且没有推荐人 则默认推荐人为自己
                 esmUserReferrerService.addReferrer(sysUser.getId(), userId);
             }
+            if ("20".equals(sysUser.getRoleId())) {
+                //如果是添加代理人则发送站内信
+                pushMessageAgent(sysUser);
+            }
             SysUserInfo userInfo = sysUserVo.getSysUserInfo();
             if (userInfo != null) {
                 if (null != userInfo.getLiveAddressString() && userInfo.getLiveAddressString().length > 0) {
@@ -914,6 +926,102 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         return HttpResult.ok("新增成功");
     }
 
+    //新增出单员发送新增站内信
+    private void pushMessageOrder(SysUser sysUser) {
+        //获取有渠道管理权限的用户ID
+        List<SysUserRole> sysUserRoles = sysUserRoleMapper.selectBymenuId(454);
+        List<SysUserRole> sysUserRoleList = sysUserRoles.stream()
+                .filter(user -> !StringUtils.isNullOrEmpty(user))
+                .distinct()
+                .collect(Collectors.toList());
+
+        Map<String, String> map = new HashMap<>();
+        List<SystemMessage> systemMessageList = new ArrayList<>();
+
+        SysUser user = BaseController.getUser();
+        StringBuilder loger = new StringBuilder()
+                .append(user.getId())
+                .append(user.getName());
+        Date date = new Date();
+        String dateString = new SimpleDateFormat("yyyy-MM-dd").format(date);
+        map.put("${添加人员账号姓名}", loger.toString());
+        map.put("${创建时间}", dateString);
+        map.put("${出单员姓名}", sysUser.getName());
+        map.put("${出单员工号}", sysUser.getId());
+        String content = systemMessageService.makeMessage(MessageModelConstants.MODEL_1.getContent(), map, null);
+        StringBuilder highLight = new StringBuilder()
+                .append(loger).append(";")
+                .append(dateString).append(";")
+                .append(sysUser.getName()).append(";")
+                .append(sysUser.getId()).append(";");
+
+        for (SysUserRole sysUserRole : sysUserRoleList) {
+            SystemMessage systemMessage = new SystemMessage();
+            systemMessage.setClassify(MessageConstants.CLASSIFY_3.getCode());
+            systemMessage.setType(MessageConstants.TYPE_1.getCode());
+            systemMessage.setTitle(MessageModelConstants.MODEL_1.getTitle());
+            systemMessage.setContent(content);
+            systemMessage.setJump("1");
+            systemMessage.setJumpUrl(MessageModelConstants.MODEL_1.getUrl());
+            systemMessage.setSenderId(BaseController.getUserId());
+            systemMessage.setReceiverId(sysUserRole.getUserId());
+            systemMessage.setState("0");
+            systemMessage.setHighLight(highLight.toString());
+            systemMessage.setSendTime(date);
+            systemMessageList.add(systemMessage);
+        }
+            systemMessageService.addSystemMessageList(systemMessageList);
+    }
+
+    //代理人新增 发送审核站内信
+    private void pushMessageAgent(SysUser sysUser) {
+        //获取有代理人审核按钮权限的用户ID
+        List<SysUserRole> sysUserRoles = sysUserRoleMapper.selectBymenuId(323);
+        List<SysUserRole> sysUserRoleList = sysUserRoles.stream()
+                .filter(user -> !StringUtils.isNullOrEmpty(user))
+                .distinct()
+                .collect(Collectors.toList());
+
+        String managementSource = new String();
+        SysDept dept = sysDeptService.getById(sysUser.getDeptId());
+        if (!StringUtils.isNullOrEmpty(dept))
+            managementSource = dept.getManagementSource();
+
+
+        Map<String, String> map = new HashMap<>();
+        List<SystemMessage> systemMessageList = new ArrayList<>();
+
+        Date date = new Date();
+        String dateString = new SimpleDateFormat("yyyy-MM-dd").format(date);
+        map.put("${人员类型}", OrganizationSource.getDescByCode(managementSource));
+        map.put("${审核数据生成时间}", dateString);
+        map.put("${待审核人员姓名}", sysUser.getName());
+        map.put("${待审核人员工号}", sysUser.getId());
+        String content = systemMessageService.makeMessage(MessageModelConstants.MODEL_2.getContent(), map, null);
+        StringBuilder highLight = new StringBuilder()
+                .append(OrganizationSource.getDescByCode(managementSource)).append(";")
+                .append(dateString).append(";")
+                .append(sysUser.getName()).append(";")
+                .append(sysUser.getId()).append(";");
+
+        for (SysUserRole sysUserRole : sysUserRoleList) {
+            SystemMessage systemMessage = new SystemMessage();
+            systemMessage.setClassify(MessageConstants.CLASSIFY_3.getCode());
+            systemMessage.setType(MessageConstants.TYPE_2.getCode());
+            systemMessage.setTitle(MessageModelConstants.MODEL_2.getTitle());
+            systemMessage.setContent(content);
+            systemMessage.setJump("1");
+            systemMessage.setJumpUrl(MessageModelConstants.MODEL_2.getUrl());
+            systemMessage.setSenderId(BaseController.getUserId());
+            systemMessage.setReceiverId(sysUserRole.getUserId());
+            systemMessage.setState("0");
+            systemMessage.setHighLight(highLight.toString());
+            systemMessage.setSendTime(date);
+            systemMessageList.add(systemMessage);
+        }
+            systemMessageService.addSystemMessageList(systemMessageList);
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public SysUser saveUserJzgInfo(SysUser2Vo sysUserVo) {

+ 4 - 1
src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java

@@ -124,6 +124,7 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         taskStatisticsVo.setEndDate(dateMapByType.get("endDate"));
 
         IPage<TaskStatisticsDto> list = this.insAreaCompanyMapper.queryPageTaskStatistics(page,taskStatisticsVo);
+        Long  total  = this.insAreaCompanyMapper.queryPageTaskStatisticsTotal(taskStatisticsVo);
         if (list != null && !list.getRecords().isEmpty()) {
             List<TaskStatisticsDto> records = list.getRecords();
             for (TaskStatisticsDto record : records) {
@@ -159,7 +160,6 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
                 taskStatisticsVo.setUserId(null);
             }
         }
-        Long  total  = this.insAreaCompanyMapper.queryPageTaskStatisticsTotal(taskStatisticsVo);
         list.setTotal(total);
         return list;
     }
@@ -532,6 +532,7 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
         taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
         taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
+        getDateByType(taskStatisticsVo.getDateType(), taskStatisticsVo);
         PageVo<TaskStatisticsVo> pageVo = new PageVo<>();
         Page page = new Page(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageSize());
         pageVo.setPageNum(taskStatisticsVo.getPageNum());
@@ -571,6 +572,7 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
             taskStatisticsVo.setParterCountyId(countyId);
         }
 
+        getDateByType(taskStatisticsVo.getDateType(), taskStatisticsVo);
         HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
         taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
         taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
@@ -606,6 +608,7 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
         taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
         taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
+        getDateByType(taskStatisticsVo.getDateType(), taskStatisticsVo);
         List<TaskStatisticsDto> result = new ArrayList<>();
          //0 报价中 1 待核保  2 已核保代缴费  3 已承保  4  核保退回
         for (int i = 0; i < 5; i++) {

+ 4 - 1
src/main/java/com/ydtech/modules/admin/utils/SliceUpDateUtil.java

@@ -262,7 +262,10 @@ public class SliceUpDateUtil {
      */
     public static String getEndOfMonth(int year, int month) {
         Calendar calendar = Calendar.getInstance();
-        calendar.set(year, month - 1, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
+        calendar.set(year, month - 1, 1);
+        int lastDayOfMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
+        calendar.set(Calendar.DAY_OF_MONTH, lastDayOfMonth);
+        // 设置时间为当天的最后一刻
         calendar.set(Calendar.HOUR_OF_DAY, 23);
         calendar.set(Calendar.MINUTE, 59);
         calendar.set(Calendar.SECOND, 59);

+ 12 - 1
src/main/java/com/ydtech/modules/console/dao/ProfitAnalysisMapper.java

@@ -1,5 +1,7 @@
 package com.ydtech.modules.console.dao;
 
+import com.ydtech.modules.admin.model.dto.PayAmountExcel;
+import com.ydtech.modules.admin.model.dto.ReceivableExcel;
 import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto;
 import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisQueryDto;
 import org.apache.ibatis.annotations.Mapper;
@@ -46,5 +48,14 @@ public interface ProfitAnalysisMapper {
      * @return  获取公司总支出
      */
     HashMap<String, BigDecimal> getTotalExpenditure( @Param("vo") ProfitAnalysisQueryDto profitAnalysisQueryDto);
-
+    /**
+     * @description:   控制台-利润分析应收金额导出明细
+     * @author: whp
+     **/
+    List<ReceivableExcel> receivableExcel(@Param("vo") ProfitAnalysisQueryDto profitAnalysisQueryDto);
+    /**
+     * @description:   控制台-利润分析实付金额导出明细
+     * @author: whp
+     **/
+    List<PayAmountExcel> payAmountExcel (@Param("vo") ProfitAnalysisQueryDto profitAnalysisQueryDto);
 }

+ 4 - 4
src/main/java/com/ydtech/modules/fnc/controller/CarSettleController.java

@@ -10,7 +10,6 @@ import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.base.controller.BaseController;
-import com.ydtech.modules.fee.service.FeeRuleSchemeService;
 import com.ydtech.modules.fnc.entity.InsFeeAudit;
 import com.ydtech.modules.fnc.entity.InsFeeAuditHistory;
 import com.ydtech.modules.fnc.entity.vo.ProblemOrderQueryVo;
@@ -31,13 +30,11 @@ import com.ydtech.modules.order.service.InsOrdersTrackService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
 import java.util.List;
 
 @Api(tags = "财务-车险结算")
@@ -138,7 +135,10 @@ public class CarSettleController extends BaseController {
 
                 //审核通过
                 if (auditOrderFeeVo.getAuditStatus().equals("1")) {
-
+                    LocalDateTime signingTime = areaList.get(0).getSigningTime();
+                    if (signingTime==null) {
+                        throw new SystemException("签单日期为空不允许审核,请手动更新订单签单时间或者联系管理员!!!");
+                    }
                     insFeeAuditService.feeAudit(orderNo, areaList.get(0).getId(), false, FeeAuditAuditstatus.PASSED.getCode());
                 } else if (auditOrderFeeVo.getAuditStatus().equals("0") || auditOrderFeeVo.getAuditStatus().equals("2")) {
                     insFeeAuditService.saveDefaultInsFeeAuditAndHistory(orderNo, areaList.get(0).getId(),

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

@@ -1,7 +1,6 @@
 package com.ydtech.modules.fnc.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.admin.model.report.financialReceivables.*;
 import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto;
 import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisQueryDto;
@@ -231,4 +230,11 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
     BigDecimal queryDateByNotTypeSumAmount(@Param("vo") FinancialReceivablesQueryVo financialReceivablesQueryVo);
 
     BigDecimal queryDateByTypeNotSumAmount(@Param("vo") FinancialReceivablesQueryVo financialReceivablesQueryVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/30 10:08
+     *  @Description:  查询签单日期为空的结算日期
+     */
+    List<InsPlyIncome> findListByDate(@Param("benginDate") String benginDate, @Param("endDate") String endDate);
 }

+ 7 - 1
src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java

@@ -281,5 +281,11 @@ public interface InsPlyIncomeService extends IService<InsPlyIncome> {
      * 纠正数据
      */
     void correctData(InsPlyIncomeVo insPlyIncomeVo);
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/30 10:36
+     *  @Description:  查询签单日期为空的结算数据
+     */
+    List<InsPlyIncome> findListByDate(String benginDate, String endDate);
 }

+ 5 - 11
src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java

@@ -2,17 +2,12 @@ package com.ydtech.modules.fnc.service.impl;
 
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.collection.CollUtil;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.constants.enums.dict.FeeAuditAuditstatus;
 import com.ydtech.constants.enums.dict.ins.InsFeeAuditDistributionStatusEnum;
 import com.ydtech.exception.SystemException;
-import com.ydtech.modules.admin.model.SysDept;
-import com.ydtech.modules.admin.model.SysDeptAccount;
-import com.ydtech.modules.admin.model.SysUser;
-import com.ydtech.modules.admin.model.SysUserRole;
 import com.ydtech.modules.admin.dao.SysPartnerAccountMapper;
 import com.ydtech.modules.admin.dao.SysPremiumDetailsMapper;
 import com.ydtech.modules.admin.model.*;
@@ -21,7 +16,6 @@ import com.ydtech.modules.admin.model.po.SysUserAccount;
 import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.service.*;
 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.fnc.dao.FncInsAreaCompanyMapper;
 import com.ydtech.modules.fnc.dao.InsFeeAuditMapper;
@@ -39,12 +33,10 @@ import com.ydtech.modules.ins.model.InsDeptFee;
 import com.ydtech.modules.ins.service.InsCommissionService;
 import com.ydtech.modules.ins.service.InsCompanyFeeService;
 import com.ydtech.modules.ins.service.InsDeptFeeService;
-import com.ydtech.modules.order.constants.BusinessConstant;
+import com.ydtech.modules.lg.service.PushLgDataServerService;
 import com.ydtech.modules.order.dao.InsOrdersMapper;
 import com.ydtech.modules.order.entity.InsFeeOrder;
 import com.ydtech.modules.order.entity.InsOrders;
-import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
-import com.ydtech.modules.order.entity.vo.OrderVo;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
@@ -65,7 +57,6 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.concurrent.ExecutorService;
@@ -142,6 +133,9 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
     @Autowired
     private SysUserRoleService sysUserRoleService;
 
+    @Autowired
+    private PushLgDataServerService dataServerService;
+
     private ExecutorService executorService= Executors.newCachedThreadPool();
 
 
@@ -403,7 +397,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
 
             }
             sysPremiumDetailsMapper.updateStatus(insAreaCompany.getId());
-
+            dataServerService.sendLgDataServer(insOrderNo);
         } catch (Exception e) {
             throw new SystemException("当前业务繁忙,请稍后重试");
         } finally {

+ 10 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -4198,4 +4198,14 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             }
         }
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/30 10:36
+     *  @Description: 查询签单日期为空的数据
+     */
+    @Override
+    public List<InsPlyIncome> findListByDate(String benginDate, String endDate) {
+        return baseMapper.findListByDate(benginDate,endDate);
+    }
 }

+ 2 - 1
src/main/java/com/ydtech/modules/inv/controller/InvAccountIncoiceController.java

@@ -99,7 +99,8 @@ public class InvAccountIncoiceController {
         JSONObject outProfit = invAccountIncoice.getOutProfit();
         JSONObject entProfit = invAccountIncoice.getEntProfit();
 
-        isProfitFull(outProfit, entProfit);
+        isProfitFull(outProfit, entProfit, invAccountIncoice.getPayoutMoney());
+
 
         return this.invAccountIncoiceService.updateInvAccountIncoice(invAccountIncoice);
     }

+ 6 - 0
src/main/java/com/ydtech/modules/inv/model/InvAccountIncoice.java

@@ -52,6 +52,12 @@ public class InvAccountIncoice implements Serializable{
     @ExcelProperty("开票方")
     private String invoiceBy;
 
+    //营业性质
+    @ApiModelProperty(value = "营业性质")
+    @ExcelProperty("公司类型")
+    @TableField(exist = false)
+    private String businessQuality;
+
     //对方单位
     @ApiModelProperty(value = "对方单位")
     @ExcelProperty("对方单位")

+ 35 - 1
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountIncoiceServiceImpl.java

@@ -11,6 +11,7 @@ import com.ydtech.constants.enums.inv.InvoiceTypeEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.constants.BusinessTypeEnum;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.inv.dao.InvAccountIncoiceMapper;
 import com.ydtech.modules.inv.model.*;
@@ -381,6 +382,11 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
                 invAccountIncoice.setRate(invAccountIncoice.getRate() + "%");
             }
         });
+
+        if (!StringUtils.isNullOrEmpty(invAccountIncoices) && invAccountIncoices.size() > 0) {
+            matchBusinessQuality(invAccountIncoices);
+        }
+
         File folder = new File(uploadFilePath);
         if (folder.exists()) {
             return EasyExcelUtils.downExcel(uploadFilePath, InvAccountIncoice.class, invAccountIncoices);
@@ -455,7 +461,9 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
         lambdaQuery.orderByDesc(InvAccountIncoice::getInvoiceTime);
 
         Page<InvAccountIncoice> invAccountIncoicePage = page(page, lambdaQuery);
-
+        if (!StringUtils.isNullOrEmpty(invAccountIncoicePage.getRecords()) && invAccountIncoicePage.getRecords().size() > 0) {
+            invAccountIncoicePage.setRecords(matchBusinessQuality(invAccountIncoicePage.getRecords()));
+        }
         /**
          * 合计
          */
@@ -502,5 +510,31 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
         return invAccountIncoiceMapper.selectList(lambdaQuery);
     }
 
+    public List<InvAccountIncoice> matchBusinessQuality(List<InvAccountIncoice> invAccountIncoices) {
+        List<String> accountIdList = invAccountIncoices
+                .stream()
+                .filter(account -> !StringUtils.isNullOrEmpty(account) && StringUtils.isNotEmpty(account.getAccountId()))
+                .map(InvAccountIncoice::getAccountId)
+                .distinct()
+                .collect(Collectors.toList());
+        LambdaQueryWrapper<InvAccount> invAccountIncoiceSQL = new LambdaQueryWrapper<InvAccount>()
+                .in(InvAccount::getAccountId, accountIdList);
+        List<InvAccount> invAccountList = invAccountService.list(invAccountIncoiceSQL);
+        invAccountIncoices
+                .stream()
+                .filter(invaccount -> !StringUtils.isNullOrEmpty(invaccount) && StringUtils.isNotEmpty(invaccount.getAccountId()))
+                .forEach(invaccount -> {
+                    invAccountList
+                            .stream()
+                            .filter(account -> !StringUtils.isNullOrEmpty(account) && StringUtils.isNotEmpty(account.getBusinessQuality()))
+                            .forEach(account -> {
+                                if (invaccount.getAccountId().equals(account.getAccountId())) {
+                                    invaccount.setBusinessQuality(BusinessTypeEnum.getBusinessType(account.getBusinessQuality()));
+                                }
+                            });
+                });
+        return invAccountIncoices;
+    }
+
 }
 

+ 2 - 0
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountServiceImpl.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.constants.BusinessTypeEnum;
 import com.ydtech.modules.inv.dao.InvAccountMapper;
 import com.ydtech.modules.inv.model.*;
 import com.ydtech.modules.inv.model.dto.InvAccountCardQueryDto;
@@ -185,6 +186,7 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
                         invAccountN.setInvAccountCardList(null);
                     }
                 }
+                invAccountN.setBusinessQuality(BusinessTypeEnum.getBusinessType(invAccountN.getBusinessQuality()));
             });
             return HttpResult.ok("", insAccounts);
         }

+ 27 - 0
src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java

@@ -277,6 +277,33 @@ public class TransferUtils {
         }
         return true;
     }
+    /**
+     * 判断归属是否分配完毕
+     *
+     * @param outProfit
+     * @param entProfit
+     * @return
+     */
+    public static Boolean isProfitFull(JSONObject outProfit, JSONObject entProfit, String payoutMoney) {
+        BigDecimal outAmount = new BigDecimal(0);
+        BigDecimal entAmount = new BigDecimal(0);
+        for (Map.Entry<String, Object> entry : outProfit.entrySet()) {
+            outAmount = outAmount.add(new BigDecimal(entry.getValue().toString()));
+        }
+        for (Map.Entry<String, Object> entry : entProfit.entrySet()) {
+            entAmount = entAmount.add(new BigDecimal(entry.getValue().toString()));
+        }
+        String string = (new BigDecimal(String.valueOf(entAmount)).add(new BigDecimal(String.valueOf(outAmount)))).toString();
+
+        if (new BigDecimal(string).compareTo(BigDecimal.ZERO) != 0) {
+            throw new SystemException("金额未完全分配");
+        }
+        if ((entAmount.compareTo(new BigDecimal(payoutMoney)) != 0)
+                || (outAmount.abs().compareTo(new BigDecimal(payoutMoney)) != 0)) {
+            throw new SystemException("进账金额与板块总金额不匹配");
+        }
+        return true;
+    }
 
     /**
      * 转给私户扣除余额方法

+ 14 - 0
src/main/java/com/ydtech/modules/largescreen/controller/DataController.java

@@ -58,6 +58,7 @@ public class DataController {
 
     @PostMapping("companySumData")
     public HttpResult companySumData(@RequestBody(required = false) DataQuery dataQuery) {
+        this.changeSignCreateTime(dataQuery);
         List<AgreementData> sumData = dataService.getCompanySumData(dataQuery);
         String[][] result = new String[sumData.size()][7];
 
@@ -83,6 +84,7 @@ public class DataController {
      */
     @PostMapping("orderStatusData")
     public HttpResult orderStatusData(@RequestBody(required = false) DataQuery dataQuery) {
+        this.changeSignCreateTime(dataQuery);
         List<CompanyData> sumData = dataService.getCompanyOrderStatusData(dataQuery);
 
         //转换格式
@@ -121,6 +123,7 @@ public class DataController {
      */
     @PostMapping("mapData")
     public HttpResult mapData(@RequestBody(required = false) DataQuery dataQuery) {
+        this.changeSignCreateTime(dataQuery);
         List<MapData> mapData = dataService.getMapData(dataQuery);
         return HttpResult.ok(mapData);
     }
@@ -198,6 +201,7 @@ public class DataController {
     @PostMapping("todayData")
     public HttpResult todayData(@RequestBody DataQuery dataQuery) {
         dataQuery.setOrderStatus("3");
+        this.changeSignCreateTime(dataQuery);
         List<OrderStatusData> orderStatusData = dataService.getOrderStatusData(dataQuery);
         if (orderStatusData.isEmpty()) {
             return HttpResult.error("当天无已承包数据");
@@ -209,6 +213,16 @@ public class DataController {
         return HttpResult.ok(toDayData);
     }
 
+    private void changeSignCreateTime(DataQuery dataQuery) {
+//      1.录单时间 2.签单时间
+        if(dataQuery.getTimeType().equals("2")){
+            dataQuery.setSignStartDate(dataQuery.getStartDate());
+            dataQuery.setSignEndDate(dataQuery.getEndDate());
+            dataQuery.setStartDate(null);
+            dataQuery.setEndDate(null);
+        }
+    }
+
 
     /**
      * 获取公司数据

+ 12 - 0
src/main/java/com/ydtech/modules/largescreen/model/query/DataQuery.java

@@ -19,4 +19,16 @@ public class DataQuery {
 
     @ApiModelProperty(value = "保险公司")
     private String companyId;
+
+
+    @ApiModelProperty(value = "时间类型")
+    private String timeType;
+
+
+
+    @ApiModelProperty(value = "签单起始日期")
+    private String signStartDate;
+
+    @ApiModelProperty(value = "签单结束日期")
+    private String signEndDate;
 }

+ 57 - 0
src/main/java/com/ydtech/modules/lg/LgDataServer.java

@@ -0,0 +1,57 @@
+package com.ydtech.modules.lg;
+
+import cn.hutool.extra.spring.SpringUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.ydtech.modules.lg.dao.PushLgDataServerMapper;
+import com.ydtech.modules.lg.model.PushLgDataServer;
+import com.ydtech.modules.ttqf.QuartzManager;
+import lombok.extern.slf4j.Slf4j;
+import org.quartz.Job;
+import org.quartz.JobDataMap;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+import java.util.Date;
+
+
+@Slf4j
+public class LgDataServer  implements Job {
+
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        try {
+            Integer executionFrequency = (Integer) QuartzManager.getInstance().getContext().get("executionFrequency");
+            JobDataMap mergedJobDataMap = jobExecutionContext.getMergedJobDataMap();
+            Object object = mergedJobDataMap.get("dataServer");
+            PushLgDataServer lgDataServer = JSONObject.parseObject((JSONObject.toJSONString(object)), PushLgDataServer.class);
+            JSONObject jsonObject = JSONObject.parseObject(SendUtils.send(JSONObject.toJSONString(lgDataServer)));
+            if (null != jsonObject){
+                if (String.valueOf(jsonObject.getInteger("code")).equals("200")){
+                    lgDataServer.setPushStatus(String.valueOf(jsonObject.getInteger("code")));
+                    lgDataServer.setMsg(jsonObject.getString("msg"));
+                    lgDataServer.setSendNumber(executionFrequency);
+                    lgDataServer.setSuccessPushTime(new Date());
+                    SpringUtil.getBean(PushLgDataServerMapper.class).updateById(lgDataServer);
+                    try {
+                        QuartzManager.getInstance().removeJob(jobExecutionContext);
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }
+                }
+            }
+            if (executionFrequency > 4){
+                lgDataServer.setSendNumber(executionFrequency);
+                SpringUtil.getBean(PushLgDataServerMapper.class).updateById(lgDataServer);
+                QuartzManager.getInstance().removeJob(jobExecutionContext);
+            }
+            executionFrequency ++;
+            log.info("lg推送重试任务执行{}",executionFrequency);
+            QuartzManager.getInstance().getContext().put("executionFrequency",executionFrequency);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+
+}

+ 60 - 1
src/main/java/com/ydtech/modules/lg/PushLgLogUtils.java

@@ -1,14 +1,18 @@
 package com.ydtech.modules.lg;
 
-
 import cn.hutool.extra.spring.SpringUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.lg.dao.PushLgEntityMapper;
+import com.ydtech.modules.lg.dao.PushLgDataServerMapper;
+import com.ydtech.modules.lg.model.PushLgDataServer;
 import com.ydtech.modules.lg.model.PushLgEntity;
+import com.ydtech.modules.order.entity.vo.OrderVo;
 import com.ydtech.modules.ttqf.QuartzManager;
 import com.ydtech.utils.StringUtils;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
 
 import java.util.Date;
 import java.util.HashMap;
@@ -16,6 +20,7 @@ import java.util.HashMap;
 @Component
 public class PushLgLogUtils {
 
+
     @Async
     public void pushLg(PushLgEntity lgEntity){
         int insert = SpringUtil.getBean(PushLgEntityMapper.class).insert(lgEntity);
@@ -52,4 +57,58 @@ public class PushLgLogUtils {
     }
 
 
+
+    @Async
+    public void pushLgDataServer(HttpResult<OrderVo> orderNo){
+        if (ObjectUtils.isEmpty(orderNo)){
+            return;
+        }
+        OrderVo accountingUser = orderNo.getData();
+        if (!StringUtils.equals(accountingUser.getSource(),"个代")){
+            return;
+        }
+        PushLgDataServer lgDataServer = new PushLgDataServer();
+        lgDataServer.setOrderNo(accountingUser.getOrderno());
+        lgDataServer.setUserName(String.valueOf(accountingUser.getInsureinfo().get("name")));
+        lgDataServer.setUserCarNum(String.valueOf(accountingUser.getCarinfo().get("licenseNo")));
+        lgDataServer.setUserPhone(String.valueOf(accountingUser.getInsureinfo().get("mobile")));
+        lgDataServer.setGiveBudget(accountingUser.getSumFee());
+        lgDataServer.setBelongingName(accountingUser.getUsername());
+        lgDataServer.setBelongingNo(accountingUser.getUserid());
+        lgDataServer.setSendTime(new Date());
+        PushLgDataServerMapper mapper = SpringUtil.getBean(PushLgDataServerMapper.class);
+        if (mapper.insert(lgDataServer) > 0){
+            lgDataServer.setZgUuid(lgDataServer.getSid());
+            JSONObject jsonObject = JSONObject.parseObject(SendUtils.sendDataServer(JSONObject.toJSONString(lgDataServer)));
+            if (!ObjectUtils.isEmpty(jsonObject) && String.valueOf(jsonObject.getInteger("code")).equals("200")){
+                lgDataServer.setPushStatus(String.valueOf(jsonObject.getInteger("code")));
+                lgDataServer.setMsg(jsonObject.getString("msg"));
+                lgDataServer.setSuccessPushTime(new Date());
+            }else {
+                lgDataServer.setPushStatus("");
+                lgDataServer.setMsg("推送失败");
+            }
+            mapper.updateById(lgDataServer);
+            if (!StringUtils.equals(lgDataServer.getPushStatus(),"200")){
+                pushLgDateServerRetry(lgDataServer);
+            }
+        }
+    }
+
+
+
+    public void pushLgDateServerRetry(PushLgDataServer dataServer){
+        try {
+            HashMap<String, Object> map = new HashMap<>();
+            map.put("dataServer", dataServer);
+            QuartzManager manager = QuartzManager.getInstance();
+            manager.getContext().put("executionFrequency",1);
+            manager.addJob(String.valueOf(dataServer.getSid()),"jobGroup" + dataServer.getSid(), LgDataServer.class,"*/30 * * * * ?",map);
+            manager.start();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+
 }

+ 1 - 1
src/main/java/com/ydtech/modules/lg/PushRetry.java

@@ -34,7 +34,7 @@ public class PushRetry implements Job {
                     }
                 }
             }
-            if (executionFrequency > 10){
+            if (executionFrequency > 4){
                 lgEntity.setSendNumber(executionFrequency);
                 SpringUtil.getBean(PushLgEntityMapper.class).updateById(lgEntity);
                 QuartzManager.getInstance().removeJob(jobExecutionContext);

+ 42 - 5
src/main/java/com/ydtech/modules/lg/SendUtils.java

@@ -19,17 +19,25 @@ public class SendUtils {
 
     private static String sendMessageIP;
 
-    @Value("${sendMessage-zg-yggl-IP}")
+    private static String sendMessageDataServerIP;
+
+    @Value("${lg-ip.withdrawal}")
     private void setSendMessageIP(String sendMessageIP){
         SendUtils.sendMessageIP = sendMessageIP;
     };
 
 
+    @Value("${lg-ip.dateServer}")
+    private void setSendMessageDataServerIP(String dataServerIp){
+        SendUtils.sendMessageDataServerIP = dataServerIp;
+    };
+
+
     public static String send(String data){
         // 获得Http客户端(可以理解为:你得先有一个浏览器;注意:实际上HttpClient与浏览器是不一样的)
         CloseableHttpClient httpClient = HttpClientBuilder.create().build();
         // 创建Post请求
-        HttpPost httpPost = new HttpPost(sendMessageIP + "/withdrawal/record/acceptPushWithdrawalData");
+        HttpPost httpPost = new HttpPost(sendMessageIP);
         StringEntity entity = new StringEntity(data, "UTF-8");
         // post请求是将参数放在请求体里面传过去的;这里将entity放入post请求体中
         httpPost.setEntity(entity);
@@ -43,8 +51,6 @@ public class SendUtils {
             HttpEntity responseEntity = response.getEntity();
             //从响应实体中截取状态码
             return EntityUtils.toString(responseEntity);
-//            String responseString = string.substring(string.lastIndexOf(":") + 1);
-//            String responseCode = responseString.substring(0, responseString.length() - 1);
         }catch (Exception e){
             e.printStackTrace();
             return "";
@@ -61,9 +67,40 @@ public class SendUtils {
                 e.printStackTrace();
             }
         }
+    }
 
 
-
+    public static String sendDataServer(String data){
+        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
+        HttpPost httpPost = new HttpPost(sendMessageDataServerIP);
+        StringEntity entity = new StringEntity(data, "UTF-8");
+        httpPost.setEntity(entity);
+        httpPost.setHeader("Content-Type", "application/json;charset=utf8");
+        // 响应模型
+        CloseableHttpResponse response = null;
+        try {
+            // 由客户端执行(发送)Post请求
+            response = httpClient.execute(httpPost);
+            // 从响应模型中获取响应实体
+            HttpEntity responseEntity = response.getEntity();
+            //从响应实体中截取状态码
+            return EntityUtils.toString(responseEntity);
+        }catch (Exception e){
+            e.printStackTrace();
+        }finally {
+            try {
+                // 释放资源
+                if (httpClient != null) {
+                    httpClient.close();
+                }
+                if (response != null) {
+                    response.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return "";
     }
 
 

+ 7 - 0
src/main/java/com/ydtech/modules/lg/dao/PushLgDataServerMapper.java

@@ -0,0 +1,7 @@
+package com.ydtech.modules.lg.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.lg.model.PushLgDataServer;
+
+public interface PushLgDataServerMapper extends BaseMapper<PushLgDataServer> {
+}

+ 46 - 0
src/main/java/com/ydtech/modules/lg/model/PushLgDataServer.java

@@ -0,0 +1,46 @@
+package com.ydtech.modules.lg.model;
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@TableName("push_lg_data_server")
+public class PushLgDataServer {
+
+    @TableId(type = IdType.ASSIGN_ID)
+    private Long sid;
+
+    private String orderNo;
+
+    private String userName;
+
+    private String userCarNum;
+
+    private String userPhone;
+
+    private String giveBudget;
+
+    private String belongingName;
+
+    private String belongingNo;
+
+    private String pushStatus;
+
+    private String msg;
+
+    private int sendNumber;
+
+    private Date sendTime;
+
+    private Date successPushTime;
+
+    @TableField(exist = false)
+    private Long zgUuid;
+
+}

+ 9 - 0
src/main/java/com/ydtech/modules/lg/service/PushLgDataServerService.java

@@ -0,0 +1,9 @@
+package com.ydtech.modules.lg.service;
+
+public interface PushLgDataServerService {
+
+
+
+    void sendLgDataServer(String  orderNum);
+
+}

+ 30 - 0
src/main/java/com/ydtech/modules/lg/service/impl/PushLgDataServerServiceImpl.java

@@ -0,0 +1,30 @@
+package com.ydtech.modules.lg.service.impl;
+
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.lg.PushLgLogUtils;
+import com.ydtech.modules.lg.service.PushLgDataServerService;
+import com.ydtech.modules.order.entity.vo.OrderVo;
+import com.ydtech.modules.order.service.InsOrdersService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PushLgDataServerServiceImpl implements PushLgDataServerService {
+
+
+    @Autowired
+    private InsOrdersService insOrdersService;
+
+
+    @Autowired
+    private PushLgLogUtils pushLgLogUtils;
+
+    @Override
+    public void sendLgDataServer(String orderNum) {
+        HttpResult<OrderVo> accountingUser = insOrdersService.getByCompanyId(orderNum, "accountingUser");
+        pushLgLogUtils.pushLgDataServer(accountingUser);
+    }
+
+
+}

+ 52 - 0
src/main/java/com/ydtech/modules/message/controller/SystemMessageController.java

@@ -0,0 +1,52 @@
+package com.ydtech.modules.message.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.message.entity.SystemMessageVo;
+import com.ydtech.modules.message.entity.dto.SystemMessageDTO;
+import com.ydtech.modules.message.service.SystemMessageService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+@Slf4j
+@Api(tags = "站内信")
+@RestController
+@RequestMapping("/sys/message")
+@RequiredArgsConstructor
+public class SystemMessageController {
+
+    @Autowired
+    private SystemMessageService systemMessageService;
+
+    @PostMapping("/get")
+    @ApiOperation("获取站内信信息")
+    public HttpResult<PageInfo<SystemMessageDTO>> getUserMessage(@RequestBody SystemMessageVo systemMessageVo) {
+        String userId = BaseController.getUserId();
+        systemMessageVo.setUserId(userId);
+        try {
+            PageInfo<SystemMessageDTO> systemMessageByUser = systemMessageService.getSystemMessageByUser(systemMessageVo);
+            return HttpResult.ok("success", systemMessageByUser);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return HttpResult.error("接口异常请重试!");
+        }
+    }
+
+    @PostMapping("/update")
+    @ApiOperation("修改站内信信息")
+    public HttpResult updateUserMessage(@RequestParam Integer id) {
+        try {
+            systemMessageService.updateSystemMessageByUser(id);
+            return HttpResult.ok("success");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return HttpResult.error("接口异常请重试!");
+        }
+    }
+}

+ 13 - 0
src/main/java/com/ydtech/modules/message/dao/SystemMessageMapper.java

@@ -0,0 +1,13 @@
+package com.ydtech.modules.message.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.message.entity.SystemMessage;
+
+import java.util.List;
+
+/**
+ * 站内信Mapper
+ */
+public interface SystemMessageMapper extends BaseMapper<SystemMessage> {
+
+}

+ 69 - 0
src/main/java/com/ydtech/modules/message/entity/SystemMessage.java

@@ -0,0 +1,69 @@
+package com.ydtech.modules.message.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.ydtech.modules.base.model.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+
+/**
+ * 站内信实体类
+ */
+@Data
+@TableName(value = "sys_message")
+@ApiModel
+public class SystemMessage extends BaseEntity {
+
+    private static final long serialVersionUID = -7650986460741587720L;
+
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "消息分类 1-公告 2-系统通知 3-事件触发")
+    @TableField(value = "classify")
+    private String classify;
+
+    @ApiModelProperty(value = "消息类型 01-增员消息 02-审批消息 03-待办消息")
+    @TableField(value = "type")
+    private String type;
+
+    @ApiModelProperty(value = "消息标题")
+    @TableField(value = "title")
+    private String title;
+
+    @ApiModelProperty(value = "消息内容")
+    @TableField(value = "content")
+    private String content;
+
+    @ApiModelProperty(value = "是否支持跳转 0-不支持 1-支持")
+    @TableField(value = "jump")
+    private String jump;
+
+    @ApiModelProperty(value = "跳转目标路径")
+    @TableField(value = "jump_url")
+    private String jumpUrl;
+
+    @ApiModelProperty(value = "消息接收方")
+    @TableField(value = "receiver_id")
+    private String receiverId;
+
+    @ApiModelProperty(value = "消息发送方")
+    @TableField(value = "sender_id")
+    private String senderId;
+
+    @ApiModelProperty(value = "状态 0-未读  1-已读")
+    @TableField(value = "state")
+    private String state;
+
+    @ApiModelProperty(value = "高亮字段")
+    @TableField(value = "high_light")
+    private String highLight;
+
+    @ApiModelProperty(value = "发送时间")
+    @TableField(value = "send_time" ,fill = FieldFill.INSERT)
+    private Date sendTime;
+
+}

+ 34 - 0
src/main/java/com/ydtech/modules/message/entity/SystemMessageVo.java

@@ -0,0 +1,34 @@
+package com.ydtech.modules.message.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class SystemMessageVo implements Serializable {
+
+    private static final long serialVersionUID = -4126594748984640557L;
+
+    @ApiModelProperty("消息类型")
+    private String msgType;
+
+    /**
+     * 当前页
+     */
+    @ApiModelProperty("当前页")
+    private Integer pageNum;
+
+    /**
+     * 每页数量
+     */
+    @ApiModelProperty("每页数量")
+    private Integer pageSize;
+
+    /**
+     * 登录人id
+     */
+    @ApiModelProperty("登录人id")
+    private String userId;
+
+}

+ 42 - 0
src/main/java/com/ydtech/modules/message/entity/dto/SystemMessageDTO.java

@@ -0,0 +1,42 @@
+package com.ydtech.modules.message.entity.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class SystemMessageDTO implements Serializable {
+
+    private static final long serialVersionUID = -6152572194386977084L;
+
+    private Integer id;
+
+    @ApiModelProperty(value = "消息分类 1-公告 2-系统通知 3-事件触发")
+    private String classify;
+
+    @ApiModelProperty(value = "消息类型 1-增员消息 2-审批消息 3-待办消息")
+    private String type;
+
+    @ApiModelProperty(value = "消息标题")
+    private String title;
+
+    @ApiModelProperty(value = "消息内容")
+    private String content;
+
+    @ApiModelProperty(value = "是否支持跳转 0-不支持 1-支持")
+    private String jump;
+
+    @ApiModelProperty(value = "跳转目标路径")
+    private String jumpUrl;
+
+    @ApiModelProperty(value = "状态 0-未读  1-已读")
+    private String state;
+
+    @ApiModelProperty(value = "高亮字段")
+    private String highLight;
+
+    @ApiModelProperty(value = "发送时间")
+    private Date sendTime;
+}

+ 22 - 0
src/main/java/com/ydtech/modules/message/service/SystemMessageService.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.message.service;
+
+
+import com.github.pagehelper.PageInfo;
+import com.ydtech.modules.message.entity.SystemMessage;
+import com.ydtech.modules.message.entity.SystemMessageVo;
+import com.ydtech.modules.message.entity.dto.SystemMessageDTO;
+
+import java.util.List;
+import java.util.Map;
+
+public interface SystemMessageService {
+
+
+    PageInfo<SystemMessageDTO> getSystemMessageByUser(SystemMessageVo systemMessageVo);
+
+    void addSystemMessageList(List<SystemMessage> systemMessageList);
+
+    void updateSystemMessageByUser(Integer id);
+
+    String makeMessage(String modelId, Map<String, String> map, String defV);
+}

+ 119 - 0
src/main/java/com/ydtech/modules/message/service/impl/SystemMessageServiceImpl.java

@@ -0,0 +1,119 @@
+package com.ydtech.modules.message.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ydtech.modules.admin.constants.MessageConstants;
+import com.ydtech.modules.admin.controller.websocket.SendMessageServer;
+import com.ydtech.modules.message.dao.SystemMessageMapper;
+import com.ydtech.modules.message.entity.SystemMessage;
+import com.ydtech.modules.message.entity.SystemMessageVo;
+import com.ydtech.modules.message.entity.dto.SystemMessageDTO;
+import com.ydtech.modules.message.service.SystemMessageService;
+import com.ydtech.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Service
+@Slf4j
+public class SystemMessageServiceImpl extends ServiceImpl<SystemMessageMapper, SystemMessage> implements SystemMessageService {
+
+    @Autowired
+    private SendMessageServer sendMessageServer;
+
+    @Override
+    public PageInfo<SystemMessageDTO> getSystemMessageByUser(SystemMessageVo systemMessageVo){
+        log.info("获取站内信入参:{}", JSONObject.toJSONString(systemMessageVo));
+
+        List<SystemMessageDTO> systemMessageDTOList = new ArrayList<>();
+
+        PageHelper.startPage(systemMessageVo.getPageNum(), systemMessageVo.getPageSize());
+
+        LambdaQueryWrapper<SystemMessage> systemMessageSql = new LambdaQueryWrapper<SystemMessage>()
+                .eq(SystemMessage::getReceiverId, systemMessageVo.getUserId())
+                .orderByDesc(SystemMessage::getSendTime);
+        if (StringUtils.isNotEmpty(systemMessageVo.getMsgType())) {
+            systemMessageSql.eq(SystemMessage::getType, systemMessageVo.getMsgType());
+        }
+        List<SystemMessage> systemMessageList = list(systemMessageSql);
+
+        systemMessageList.stream()
+                .filter(message -> !StringUtils.isNullOrEmpty(message))
+                .forEach(message -> {
+                    message.setClassify(MessageConstants.getMessageByTypeAndCode(message.getClassify(), "CLASSIFY"));
+                    message.setType(MessageConstants.getMessageByTypeAndCode(message.getType(), "TYPE"));
+                    SystemMessageDTO systemMessageDTO = new SystemMessageDTO();
+                    BeanUtils.copyProperties(message, systemMessageDTO);
+                    systemMessageDTOList.add(systemMessageDTO);
+                });
+
+        log.info("获取站内信出参:{}", JSONObject.toJSONString(systemMessageDTOList));
+
+        return new PageInfo<>(systemMessageDTOList);
+    }
+
+    @Override
+    public void addSystemMessageList(List<SystemMessage> systemMessageList){
+        log.info("新增站内信入参:{}", JSONObject.toJSONString(systemMessageList));
+        try {
+            if (ObjectUtils.isNotEmpty(systemMessageList) && !systemMessageList.isEmpty()) {
+                saveBatch(systemMessageList);
+                sendMessageServer.realTime(systemMessageList);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+    }
+
+    @Override
+    public void updateSystemMessageByUser(Integer id){
+        log.info("标记已读站内信入参:{}", id);
+        SystemMessage systemMessage = new SystemMessage();
+        systemMessage.setId(id);
+        systemMessage.setState("1");
+        if (ObjectUtils.isNotEmpty(id))
+            this.baseMapper.updateById(systemMessage);
+    }
+
+
+    @Override
+    public String makeMessage(String template, Map<String, String> map, String defV) {
+        Pattern pattern = Pattern.compile("\\$\\{[^}]+}");
+        Matcher matcher = pattern.matcher(template);
+        // 如果模板中没有参数。则直接返回
+        if (!matcher.find()) {
+            return template;
+        }
+        // 重置匹配模式
+        matcher.reset();
+        // 开始正则匹配
+        StringBuffer message = new StringBuffer();
+        while (matcher.find()) {
+            String group = matcher.group();
+            if (map.get(group) == null) {
+                continue;
+            }
+            matcher.appendReplacement(message, map.get(group));
+        }
+        matcher.appendTail(message);
+        Matcher m1 = pattern.matcher(message.toString());
+        // 替换成功或者默认内容为空,则返回
+        if (!m1.find() || StringUtils.isNullOrEmpty(defV)) {
+            return message.toString();
+        }
+        // 替换失败,返回默认值
+        return defV;
+    }
+}

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

@@ -78,7 +78,8 @@ public class ZijinDuplicateInsuranceComponents extends ResponseMessageAbstractHa
 
         //及时起保的
         if(CalculateFlagEnum.CF_2.getCode().equals(calculateFlag)){
-            jqEndDate = GuorenDuplicateInsuranceComponent.getTimelyEndDate(rtnMsg, TIMELY_JQ_REGEX);
+//            jqEndDate = GuorenDuplicateInsuranceComponent.getTimelyEndDate(rtnMsg, TIMELY_JQ_REGEX);
+            jqEndDate = GuorenDuplicateInsuranceComponent.getEndDate(rtnMsg, DAN_JQ_REGEX); // 获取日期修改
             if(jqEndDate.equals("")){
                 //正常的日期
                 jqEndDate = GuorenDuplicateInsuranceComponent.getEndDate(rtnMsg, DAN_JQ_REGEX);

+ 17 - 7
src/main/java/com/ydtech/modules/order/controller/InsOrderReadPdfController.java

@@ -2,10 +2,6 @@ package com.ydtech.modules.order.controller;
 
 
 import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.admin.model.dto.SysUserDto;
-import com.ydtech.modules.admin.model.dto.SysUserLinkAreaDto;
-import com.ydtech.modules.admin.model.vo.*;
-import com.ydtech.modules.admin.service.SysUserLinkAreaService;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -17,14 +13,11 @@ import com.ydtech.modules.order.entity.vo.OrderQueryVo;
 import com.ydtech.modules.order.service.InsOrderReadPdfService;
 import com.ydtech.modules.order.service.InsOrdersService;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
-import java.io.IOException;
-import java.util.List;
 
 /**
  *  @version
@@ -136,6 +129,23 @@ public class InsOrderReadPdfController extends BaseController {
     }
 
 
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/30 10:40
+     *  @Description: 手动更新结算表的签单时间
+     */
+    @GetMapping("updatePlySignDate")
+    @ApiOperation("手动更新结算表的签单时间")
+    public HttpResult<Object> updatePlySignDate(String id) {
 
+        try{
+            insOrderReadPdfService.updatePlySignDate(id);
+            return HttpResult.ok("操作成功");
+        }catch (Exception e){
+            return HttpResult.error("操作失败"+e.getMessage());
+        }
+
+    }
 
 }

+ 25 - 0
src/main/java/com/ydtech/modules/order/controller/QrCodeController.java

@@ -10,6 +10,7 @@ import com.ydtech.modules.admin.service.SysBarcodeConfigService;
 import com.ydtech.modules.admin.service.SysQRCodeRelationService;
 import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.esm.service.EsmInsCompanyService;
+import com.ydtech.modules.inv.utils.LocalDateTimeUtils;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrderQrCode;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -20,6 +21,10 @@ import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocol.constants.ValidStatus;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
+import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
 import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -131,16 +136,36 @@ public class QrCodeController {
         throw new SystemException("二维码销毁失败");
     }
 
+    @Autowired
+    private InsFeeOrderNewService insFeeOrderNewService;
+
+    @Autowired
+    private PtlAgreementProductCostsNewService ptlAgreementProductCostsNewService;
+
+
     @GetMapping(value = "/index")
     @ApiOperation(value = "扫描二维码地址")
     @SaIgnore
     public Object index(String areaCompanyId) throws IOException {
         InsOrderQrCode insOrderQrCode = insOrderQrCodeService.getOne(areaCompanyId);
         InsAreaCompany insAreaCompany = insAreaCompanyService.getById(areaCompanyId);
+
+        InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getByInsOrderNo(insAreaCompany.getId());
+        PtlAgreementProductCostsNew ptlAgreementProductCostsNew = ptlAgreementProductCostsNewService.getById(insFeeOrderNew.getCostsId());
+        String costsStartDate = ptlAgreementProductCostsNew.getCostsStartDate();
+        String costsEndDate = ptlAgreementProductCostsNew.getCostsEndDate();
+        boolean b = LocalDateTimeUtils.nowIsBetweenStartAndEnd(costsStartDate, costsEndDate);
+        // 先判断时间
+        if (!b) {
+            //重定向到错误页面中
+            return getModelAndView("费用失效,请重新报价。");
+        }
+        // 在判断状态
         if (ValidStatus.AVS_0.getCode().equals(Integer.parseInt(insAreaCompany.getCodeValidStatus()))) {
             //重定向到错误页面中
             return getModelAndView("费用失效,请重新报价。");
         }
+
         // 根据保险公司获取二维码配置方式
         LambdaQueryWrapper<SysBarcodeConfig> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(SysBarcodeConfig::getCompanyId, insAreaCompany.getCompanyId())

+ 4 - 2
src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java

@@ -14,7 +14,6 @@ import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.utils.StringUtils;
 import com.ydtech.utils.idgen.IdGenerate;
 import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -604,6 +603,9 @@ public class InsAreaCompany implements Serializable {
     @TableField(exist = false)
     private String jyPolicyNo;
 
+    @TableField(exist = false)
+    private String recorder;
+
     public InsAreaCompany(QuoteRespVo quoteRespVo, PtlAgreementAttribution ptlAgreementAttribution) {
         this.id = IdGenerate.nextId();
         this.orderno = quoteRespVo.getOrderno();
@@ -658,7 +660,7 @@ public class InsAreaCompany implements Serializable {
     }
 
     public void setPaymentLink(String paymentLink) {
-        this.signingTime = LocalDateTime.now();
+      //  this.signingTime = LocalDateTime.now();
         this.paymentLink = paymentLink;
     }
 }

+ 72 - 0
src/main/java/com/ydtech/modules/order/orderThread/OrderFailRunnableThread.java

@@ -0,0 +1,72 @@
+package com.ydtech.modules.order.orderThread;
+
+import com.alibaba.fastjson.JSON;
+import com.ydtech.constants.RabbitMqEnum;
+import com.ydtech.modules.order.entity.po.InsOrderPushMsg;
+import com.ydtech.modules.order.entity.vo.PushDataVo;
+import com.ydtech.modules.order.service.InsOrderPushMsgService;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.core.MessageProperties;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.UUID;
+
+import static org.springframework.amqp.core.MessageProperties.CONTENT_TYPE_TEXT_PLAIN;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/11/5 15:50
+ *  @Description:  处理失败订单的的线程池
+ */
+public class OrderFailRunnableThread implements Runnable {
+
+    private RabbitTemplate rabbitTemplate;
+
+    private ArrayList<String> message =new ArrayList<>();
+
+    private InsOrderPushMsgService insOrderPushMsgService;
+
+    public OrderFailRunnableThread(RabbitTemplate rabbitTemplate, ArrayList<String> message, InsOrderPushMsgService insOrderPushMsgService) {
+        this.rabbitTemplate = rabbitTemplate;
+        this.message = message;
+        this.insOrderPushMsgService = insOrderPushMsgService;
+    }
+
+    public OrderFailRunnableThread() {
+    }
+
+    public OrderFailRunnableThread(InsOrderPushMsgService insOrderPushMsgService, ArrayList<String> message) {
+        this.message = message;
+        this.insOrderPushMsgService = insOrderPushMsgService;
+    }
+
+    @Override
+    public void run() {
+        //发送数据
+        this.message.forEach(item ->{
+            //修改执行相应业务逻辑
+            MessageProperties messageProperties = new MessageProperties();
+            messageProperties.setMessageId(UUID.randomUUID().toString());
+            messageProperties.setContentType(CONTENT_TYPE_TEXT_PLAIN);
+            messageProperties.setContentEncoding("UTF-8");
+            Message message_cj = new Message(item.getBytes(StandardCharsets.UTF_8), messageProperties);
+            PushDataVo pushDataVo = JSON.parseObject(item, PushDataVo.class);
+            //推送
+            InsOrderPushMsg insOrderPushMsg = new InsOrderPushMsg(null, pushDataVo.getInsAreaCompany().getId(), "0", new Date(), pushDataVo.toString());
+            try{
+                //更新狀態
+                insOrderPushMsgService.save(insOrderPushMsg);
+                this.rabbitTemplate.convertAndSend(RabbitMqEnum.ORDER_EXCHANGE.getCode(), RabbitMqEnum.ORDER_ROUTINGKEY_FAIL.getCode(), message_cj);
+            }catch(Exception e){
+                e.getStackTrace();
+            }
+
+        });
+
+    }
+}
+

+ 20 - 12
src/main/java/com/ydtech/modules/order/orderThread/OrderRunnableThread.java

@@ -1,12 +1,20 @@
 package com.ydtech.modules.order.orderThread;
 
 import com.alibaba.fastjson.JSON;
+import com.ydtech.constants.RabbitMqEnum;
 import com.ydtech.modules.order.entity.po.InsOrderPushMsg;
 import com.ydtech.modules.order.entity.vo.PushDataVo;
 import com.ydtech.modules.order.service.InsOrderPushMsgService;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.core.MessageProperties;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
 
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.UUID;
+
+import static org.springframework.amqp.core.MessageProperties.CONTENT_TYPE_TEXT_PLAIN;
 
 /**
  *  @version
@@ -16,17 +24,17 @@ import java.util.Date;
  */
 public class OrderRunnableThread implements Runnable {
 
-    //private RabbitTemplate rabbitTemplate;
+    private RabbitTemplate rabbitTemplate;
 
     private ArrayList<String> message =new ArrayList<>();
 
     private InsOrderPushMsgService insOrderPushMsgService;
 
-   // public OrderRunnableThread(RabbitTemplate rabbitTemplate, ArrayList<String> message, InsOrderPushMsgService insOrderPushMsgService) {
-   //     this.rabbitTemplate = rabbitTemplate;
-   //     this.message = message;
-   //     this.insOrderPushMsgService = insOrderPushMsgService;
-    //}
+    public OrderRunnableThread(RabbitTemplate rabbitTemplate, ArrayList<String> message, InsOrderPushMsgService insOrderPushMsgService) {
+        this.rabbitTemplate = rabbitTemplate;
+        this.message = message;
+        this.insOrderPushMsgService = insOrderPushMsgService;
+    }
 
     public OrderRunnableThread() {
     }
@@ -41,18 +49,18 @@ public class OrderRunnableThread implements Runnable {
         //发送数据
         this.message.forEach(item ->{
             //修改执行相应业务逻辑
-           // MessageProperties messageProperties = new MessageProperties();
-           // messageProperties.setMessageId(UUID.randomUUID().toString());
-           // messageProperties.setContentType(CONTENT_TYPE_TEXT_PLAIN);
-           // messageProperties.setContentEncoding("UTF-8");
-           // Message message_cj = new Message(item.getBytes(StandardCharsets.UTF_8), messageProperties);
+            MessageProperties messageProperties = new MessageProperties();
+            messageProperties.setMessageId(UUID.randomUUID().toString());
+            messageProperties.setContentType(CONTENT_TYPE_TEXT_PLAIN);
+            messageProperties.setContentEncoding("UTF-8");
+            Message message_cj = new Message(item.getBytes(StandardCharsets.UTF_8), messageProperties);
             PushDataVo pushDataVo = JSON.parseObject(item, PushDataVo.class);
             //推送
             InsOrderPushMsg insOrderPushMsg = new InsOrderPushMsg(null, pushDataVo.getInsAreaCompany().getId(), "0", new Date(), pushDataVo.toString());
             try{
                 //更新狀態
                 insOrderPushMsgService.save(insOrderPushMsg);
-                //this.rabbitTemplate.convertAndSend(RabbitMqEnum.ORDER_EXCHANGE.getCode(), RabbitMqEnum.ORDER_ROUTINGKEY.getCode(), message_cj);
+                this.rabbitTemplate.convertAndSend(RabbitMqEnum.ORDER_EXCHANGE.getCode(), RabbitMqEnum.ORDER_ROUTINGKEY.getCode(), message_cj);
             }catch(Exception e){
                 e.getStackTrace();
             }

+ 72 - 0
src/main/java/com/ydtech/modules/order/orderThread/OrderSignRunnableThread.java

@@ -0,0 +1,72 @@
+package com.ydtech.modules.order.orderThread;
+
+import com.alibaba.fastjson.JSON;
+import com.ydtech.constants.RabbitMqEnum;
+import com.ydtech.modules.order.entity.po.InsOrderPushMsg;
+import com.ydtech.modules.order.entity.vo.PushDataVo;
+import com.ydtech.modules.order.service.InsOrderPushMsgService;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.core.MessageProperties;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.UUID;
+
+import static org.springframework.amqp.core.MessageProperties.CONTENT_TYPE_TEXT_PLAIN;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/11/5 15:50
+ *  @Description:  处理失败订单的的线程池
+ */
+public class OrderSignRunnableThread implements Runnable {
+
+    private RabbitTemplate rabbitTemplate;
+
+    private ArrayList<String> message =new ArrayList<>();
+
+    private InsOrderPushMsgService insOrderPushMsgService;
+
+    public OrderSignRunnableThread(RabbitTemplate rabbitTemplate, ArrayList<String> message, InsOrderPushMsgService insOrderPushMsgService) {
+        this.rabbitTemplate = rabbitTemplate;
+        this.message = message;
+        this.insOrderPushMsgService = insOrderPushMsgService;
+    }
+
+    public OrderSignRunnableThread() {
+    }
+
+    public OrderSignRunnableThread(InsOrderPushMsgService insOrderPushMsgService, ArrayList<String> message) {
+        this.message = message;
+        this.insOrderPushMsgService = insOrderPushMsgService;
+    }
+
+    @Override
+    public void run() {
+        //发送数据
+        this.message.forEach(item ->{
+            //修改执行相应业务逻辑
+            MessageProperties messageProperties = new MessageProperties();
+            messageProperties.setMessageId(UUID.randomUUID().toString());
+            messageProperties.setContentType(CONTENT_TYPE_TEXT_PLAIN);
+            messageProperties.setContentEncoding("UTF-8");
+            Message message_cj = new Message(item.getBytes(StandardCharsets.UTF_8), messageProperties);
+            PushDataVo pushDataVo = JSON.parseObject(item, PushDataVo.class);
+            //推送
+            InsOrderPushMsg insOrderPushMsg = new InsOrderPushMsg(null, pushDataVo.getInsAreaCompany().getId(), "0", new Date(), pushDataVo.toString());
+            try{
+                //更新狀態
+                insOrderPushMsgService.save(insOrderPushMsg);
+                this.rabbitTemplate.convertAndSend(RabbitMqEnum.ORDER_EXCHANGE.getCode(), RabbitMqEnum.ORDER_ROUTINGKEY_SIGN.getCode(), message_cj);
+            }catch(Exception e){
+                e.getStackTrace();
+            }
+
+        });
+
+    }
+}
+

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

@@ -34,4 +34,11 @@ public interface InsOrderPayDateRecordService extends IService<InsOrderPayDateRe
      *  @Description: 定时更新订单的时间
      */
      void batchOrderDate(String beginDate,String endDate);
+     /**
+      *  @version
+      *  @author: hxl
+      *  @Date: 2024/12/30 10:02
+      *  @Description: 自动更新应收单表中的签单日期
+      */
+    void batchOrderPlyOrderDate(String benginDate, String endDate);
 }

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

@@ -15,7 +15,7 @@ public interface InsOrderPushMsgService extends IService<InsOrderPushMsg> {
     *  @Date: 2024/11/11 8:38
     *  @Description: 查询历史订单
     */
-   void getPushInsAreaCompanyList();
+   void getPushInsAreaCompanyList(String month);
 
 
    /**

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

@@ -35,4 +35,11 @@ public interface InsOrderReadPdfService extends IService<InsOrderReadPdf> {
      *  @Description:  通過保險公司和pdf路徑读取配置信息
      */
     InsOrderReadPdfContentDto readPdfContent(InsOrderReadPdfContentVo insOrderReadPdfContentVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/30 10:41
+     *  @Description: 手动更新结算表的签单时间
+     */
+    void updatePlySignDate(String id);
 }

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

@@ -142,7 +142,7 @@ public class IdentifyServiceImpl implements IdentifyService {
     private CardUserInfo  convertUseNatureCode(CardUserInfo cardUserInfo) {
         String useNature = cardUserInfo.getUseNature();
         if(useNature!=null && !"".equals(useNature)){
-            if("营运".equals(useNature)){
+            if("营运".equals(useNature) || "货运".equals(useNature)){
                 useNature="营业";
             }else if("非营运".equals(useNature)){
                 useNature="非营业";

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

@@ -104,6 +104,9 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
     @Autowired
     private InsFeeAuditHistoryService insFeeAuditHistoryService;
 
+    @Autowired
+    private InsOrderPushMsgService  insOrderPushMsgService;
+
     public InsAreaCompanyServiceImpl(@Lazy InsOrdersService insOrdersService, InsOrdersTrackService insOrdersTrackService, SysDeptService sysDeptService) {
         this.insOrdersService = insOrdersService;
         this.insOrdersTrackService = insOrdersTrackService;
@@ -128,6 +131,10 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
     @Transactional
     public void updateCompanyAndOrders(InsAreaCompany insAreaCompany) {
         baseMapper.updateById(insAreaCompany);
+        // add by hxl  2024-11-11  添加推送数据
+        if(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insAreaCompany.getOrderstatus())){
+            insOrderPushMsgService.getPushSignInsAreaCompanyList(insAreaCompany.getId());
+        }
         //生成结算
         //判断协议是否为人工还是自动审核
         PtlAgreement ptlAgreement = ptlAgreementService.getById(insAreaCompany.getAgreementId());
@@ -777,6 +784,10 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
             //审核表数据插入
             insFeeAuditService.saveDefaultInsFeeAuditAndHistory(insAreaCompany.getOrderno(), insAreaCompany.getId(), FeeAuditAuditstatus.UNREVICEWED.getCode(), null);
         }
+        // add by  hxl  2024-12-27   添加外部订单承保数据推送
+        if(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insAreaCompany.getOrderstatus())){
+            insOrderPushMsgService.getPushSignInsAreaCompanyList(insAreaCompany.getId());
+        }
         return true;
     }
 
@@ -993,6 +1004,10 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
             //重新进入审核状态
             insFeeAuditService.saveDefaultInsFeeAuditAndHistory(insAreaCompany.getOrderno(), insAreaCompany.getId(), FeeAuditAuditstatus.UNREVICEWED.getCode(), null);
         }
+        // add by  hxl  2024-12-27   添加外部订单承保数据推送
+        if(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insAreaCompany.getOrderstatus())){
+            insOrderPushMsgService.getPushSignInsAreaCompanyList(insAreaCompany.getId());
+        }
         return true;
     }
 

+ 132 - 70
src/main/java/com/ydtech/modules/order/service/impl/InsOrderPayDateRecordServiceImpl.java

@@ -3,7 +3,8 @@ package com.ydtech.modules.order.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.exception.SystemException;
-import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.fnc.entity.InsPlyIncome;
+import com.ydtech.modules.fnc.service.InsPlyIncomeService;
 import com.ydtech.modules.order.dao.InsOrderPayDateRecordMapper;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.api.pingan.utils.PDFUtil;
@@ -12,6 +13,7 @@ import com.ydtech.modules.order.entity.dto.ReadPdfUrlListDto;
 import com.ydtech.modules.order.entity.po.InsOrderPayDateRecord;
 import com.ydtech.modules.order.entity.po.InsOrderReadPdf;
 import com.ydtech.modules.order.service.*;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -19,6 +21,7 @@ import org.springframework.stereotype.Service;
 
 import java.io.File;
 import java.time.LocalDateTime;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -29,12 +32,13 @@ import java.util.stream.Collectors;
  * @description 针对表【ins_order_pay_date_record(自动更新签单时间记录表)】的数据库操作Service实现
  * @createDate 2024-10-15 18:58:00
  */
+@Slf4j
 @Service
 public class InsOrderPayDateRecordServiceImpl extends ServiceImpl<InsOrderPayDateRecordMapper, InsOrderPayDateRecord>
         implements InsOrderPayDateRecordService {
 
-     @Autowired
-     private InsOrderPdfUrlService  insOrderPdfUrlService;
+    @Autowired
+    private InsOrderPdfUrlService insOrderPdfUrlService;
 
     @Autowired
     private InsAreaCompanyService insAreaCompanyService;
@@ -49,102 +53,124 @@ public class InsOrderPayDateRecordServiceImpl extends ServiceImpl<InsOrderPayDat
     private String apiUrl;
 
     @Autowired
-    private InsOrderReadPdfService  insOrderReadPdfService;
+    private InsOrderReadPdfService insOrderReadPdfService;
 
     @Autowired
     private InsOrdersTrackService insOrdersTrackService;
 
+
+    @Autowired
+    private InsPlyIncomeService insPlyIncomeService;
+
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/10/21 15:00
-     *  @Description: 更新签单日期和缴费时间
+     * @version
+     * @author: hxl
+     * @Date: 2024/10/21 15:00
+     * @Description: 更新签单日期和缴费时间
      */
     @Override
     public void updateOrderDate(String subOrderId) {
-        ReadPdfUrlListDto readPdfUrlListDto =null;
-        try{
-             readPdfUrlListDto = insOrderPdfUrlService.readPdfUrlList(subOrderId, false);
-        }catch(Exception e) {
-             throw new SystemException(e.getMessage());
+        ReadPdfUrlListDto readPdfUrlListDto = null;
+        try {
+            readPdfUrlListDto = insOrderPdfUrlService.readPdfUrlList(subOrderId, false);
+        } catch (Exception e) {
+            throw new SystemException(e.getMessage());
         }
         //判断外部订单
         InsAreaCompany subOrder = insAreaCompanyService.getById(subOrderId);
-        if(readPdfUrlListDto!=null){
-            String code ="";
-            String jqFileurl ="";
-            String sqFileurl ="";
+        if (readPdfUrlListDto != null) {
+            String code = "";
+            String jqFileurl = "";
+            String sqFileurl = "";
             //判断订单交强路径是否为空
-            if(readPdfUrlListDto.getOldfileList()!=null && !readPdfUrlListDto.getOldfileList().isEmpty()){
-                code="1";
+            if (readPdfUrlListDto.getOldfileList() != null && !readPdfUrlListDto.getOldfileList().isEmpty()) {
+                code = "1";
                 //交强
-                ReadPdfUrlDto jq= readPdfUrlListDto.getOldfileList().stream().filter(s->s.getFileTitle().equals("交强电子保单")).collect(Collectors.toList()).get(0);
-                if(jq!=null){
+                ReadPdfUrlDto jq = readPdfUrlListDto.getOldfileList().stream().filter(s -> s.getFileTitle().equals("交强电子保单")).collect(Collectors.toList()).get(0);
+                if (jq != null) {
                     jqFileurl = jq.getFileurl();
                 }
             }
-            if(readPdfUrlListDto.getBusinessList()!=null && !readPdfUrlListDto.getBusinessList().isEmpty()){
+            if (readPdfUrlListDto.getBusinessList() != null && !readPdfUrlListDto.getBusinessList().isEmpty()) {
                 //商业
-                ReadPdfUrlDto sy= readPdfUrlListDto.getBusinessList().stream().filter(s->s.getFileTitle().equals("商业电子保单")).collect(Collectors.toList()).get(0);
-                if(sy!=null){
+                ReadPdfUrlDto sy = readPdfUrlListDto.getBusinessList().stream().filter(s -> s.getFileTitle().equals("商业电子保单")).collect(Collectors.toList()).get(0);
+                if (sy != null) {
                     sqFileurl = sy.getFileurl();
                 }
             }
-            if(StringUtils.isBlank(jqFileurl)){
-                jqFileurl=sqFileurl;
-                code="2";
+            if (StringUtils.isBlank(jqFileurl)) {
+                jqFileurl = sqFileurl;
+                code = "2";
             }
-            String localUrl ="";
-            if(StringUtils.isNotBlank(jqFileurl)){
+            String localUrl = "";
+            if (StringUtils.isNotBlank(jqFileurl)) {
                 localUrl = PDFUtil.trafferHttpToLocalPath(jqFileurl);
+            } else {
+                throw new SystemException("保单为空不能更新!!");
             }
             //通过保险公司配置读取截取的前缀和后缀
             LambdaQueryWrapper<InsOrderReadPdf> qws = new LambdaQueryWrapper<>();
-            qws.eq(InsOrderReadPdf::getCompanyId,subOrder.getCompanyId());
-            qws.eq(InsOrderReadPdf::getType,code);
+            qws.eq(InsOrderReadPdf::getCompanyId, subOrder.getCompanyId());
+            qws.eq(InsOrderReadPdf::getType, code);
             List<InsOrderReadPdf> list = insOrderReadPdfService.list(qws);
-            HashMap<String,LocalDateTime> map=new HashMap<>();
-            HashMap<String,LocalDateTime> oldMap=new HashMap<>();
-            oldMap.put("payDate",subOrder.getPayDate());
-            oldMap.put("signingTime",subOrder.getPayDate());
+            HashMap<String, LocalDateTime> map = new HashMap<>();
+            HashMap<String, LocalDateTime> oldMap = new HashMap<>();
+            oldMap.put("payDate", subOrder.getPayDate());
+            oldMap.put("signingTime", subOrder.getPayDate());
             String pdfText = PDFUtil.getPdfText(localUrl);
-            if(StringUtils.isNotBlank(pdfText)){
-                if(list!=null  && list.size()>0){
-                    for(InsOrderReadPdf insOrderReadPdf:list){
-                       LocalDateTime pdfContentDate = PDFUtil.getPdfContentDate(pdfText, insOrderReadPdf.getReadBegin(), insOrderReadPdf.getReadEnd(), insOrderReadPdf.getReadType());
-                       map.put(insOrderReadPdf.getOrderMsg(),pdfContentDate);
+            if (StringUtils.isNotBlank(pdfText)) {
+                if (list != null && list.size() > 0) {
+                    for (InsOrderReadPdf insOrderReadPdf : list) {
+                        LocalDateTime pdfContentDate = PDFUtil.getPdfContentDate(pdfText, insOrderReadPdf.getReadBegin(), insOrderReadPdf.getReadEnd(), insOrderReadPdf.getReadType());
+                        map.put(insOrderReadPdf.getOrderMsg(), pdfContentDate);
                     }
                 }
             }
             //刪除临时文件
             if (jqFileurl.contains("http") || jqFileurl.contains("https")) {
-                File file =new File(localUrl);
+                File file = new File(localUrl);
                 file.delete();
             }
             //插入數據
-            InsOrderPayDateRecord  dto=new InsOrderPayDateRecord(null, subOrderId, new Date(), new BaseController().getUserId(), subOrder.getPayDate(), subOrder.getSigningTime(), map.get("payDate"), map.get("signingTime"), oldMap.toString(), map.toString());
+            InsOrderPayDateRecord dto = new InsOrderPayDateRecord(null, subOrderId, new Date(), "admin", subOrder.getPayDate(), subOrder.getSigningTime(), map.get("payDate"), map.get("signingTime"), oldMap.toString(), map.toString());
             this.save(dto);
-            if(map.get("payDate")!=null){
+            if (map.get("payDate") != null) {
                 subOrder.setPayDate(map.get("payDate"));
                 //插入轨迹表
-               // InsOrdersTrack insOrdersTrack = new InsOrdersTrack(subOrder.getId(), subOrder.getCompanyId(), subOrder.getInscompany(), subOrder.getOrderno(), "缴费时间", new BaseController().getUser().getId(), new BaseController().getUser().getName(),"缴费时间",map.get("payDate"));
-               // insOrdersTrackService.save(insOrdersTrack);
+                // InsOrdersTrack insOrdersTrack = new InsOrdersTrack(subOrder.getId(), subOrder.getCompanyId(), subOrder.getInscompany(), subOrder.getOrderno(), "缴费时间", new BaseController().getUser().getId(), new BaseController().getUser().getName(),"缴费时间",map.get("payDate"));
+                // insOrdersTrackService.save(insOrdersTrack);
             }
-            if(map.get("signingTime")!=null){
+            if (map.get("signingTime") != null) {
                 subOrder.setSigningTime(map.get("signingTime"));
             }
             //更新时间表
-             insAreaCompanyService.updateById(subOrder);
+            insAreaCompanyService.updateById(subOrder);
+            log.info("更新的订单表为" + subOrder.toString() + new Date().toString());
+            //判斷又沒有結算表如果有更新  add  by hxl  2024-12-30
+            if (subOrder.getSigningTime() != null) {
+                LambdaQueryWrapper<InsPlyIncome> lqw = new LambdaQueryWrapper<>();
+                lqw.eq(InsPlyIncome::getOrderno, subOrder.getId());
+                List<InsPlyIncome> insPlyIncome = insPlyIncomeService.list(lqw);
+
+                if (insPlyIncome != null && insPlyIncome.size() > 0) {
+                    for (InsPlyIncome plyIncome : insPlyIncome) {
+                        plyIncome.setSignDate(subOrder.getSigningTime());
+                        insPlyIncomeService.updateById(plyIncome);
+                        log.info("更新的结算表为" + plyIncome.toString() + new Date().toString());
+                    }
+                }
+            }
 
-        }else{
-           throw   new SystemException("生成保单失败");
+        } else {
+            throw new SystemException("生成保单失败");
         }
     }
+
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/10/21 17:01
-     *  @Description:  查看保单修改记录
+     * @version
+     * @author: hxl
+     * @Date: 2024/10/21 17:01
+     * @Description: 查看保单修改记录
      */
     @Override
     public List<InsOrderPayDateRecord> updateOrderDateRecord(String subOrderId) {
@@ -154,24 +180,60 @@ public class InsOrderPayDateRecordServiceImpl extends ServiceImpl<InsOrderPayDat
     }
 
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/10/22 10:51
-     *  @Description: 定时更新订单的缴费时间和签单日期
+     * @version
+     * @author: hxl
+     * @Date: 2024/10/22 10:51
+     * @Description: 定时更新订单的缴费时间和签单日期
+     */
+    public void batchOrderDate(String beginDate, String endDate) {
+        //查询当前时间0点 到当前时间范围内的已承保的订单  并更新时间 HH:mm:ss
+        List<InsAreaCompany> list = insAreaCompanyService.findListByDate(beginDate, endDate);
+        if (list != null && list.size() > 0) {
+            for (InsAreaCompany insAreaCompany : list) {
+                try {
+                    //更新時間
+                    updateOrderDate(insAreaCompany.getId());
+                } catch (Exception e) {
+
+                }
+            }
+        }
+    }
+
+    /**
+     * @version
+     * @author: hxl
+     * @Date: 2024/12/30 10:03
+     * @Description: 自动更新签单表的日期
      */
-    public void batchOrderDate(String beginDate,String endDate) {
-       //查询当前时间0点 到当前时间范围内的已承保的订单  并更新时间 HH:mm:ss
-       List<InsAreaCompany> list = insAreaCompanyService.findListByDate(beginDate,endDate);
-       if(list!=null && list.size()>0){
-           for(InsAreaCompany  insAreaCompany : list){
-               try{
-                   //更新時間
-                   updateOrderDate(insAreaCompany.getId());
-               }catch(Exception e){
-
-               }
-           }
-       }
+    @Override
+    public void batchOrderPlyOrderDate(String benginDate, String endDate) {
+        //查询签单日期为空的数据
+        List<InsPlyIncome> list = insPlyIncomeService.findListByDate(benginDate, endDate);
+        List<InsPlyIncome> newList = new ArrayList<>();
+        if (list != null && list.size() > 0) {
+            for (InsPlyIncome insPlyIncome : list) {
+                //更新子订单的签单时间
+                if (insPlyIncome.getSignDate() == null) {
+                    try {
+                        updateOrderDate(insPlyIncome.getOrderno());
+                    } catch (Exception e) {
+
+                    }
+                }
+                //更新時間
+                InsPlyIncome ply = insPlyIncomeService.getById(insPlyIncome.getId());
+                if (ply != null) {
+                    InsAreaCompany iac = insAreaCompanyService.getById(insPlyIncome.getOrderno());
+                    if (iac.getSigningTime() != null) {
+                        ply.setSignDate(iac.getSigningTime());
+                        newList.add(ply);
+                    }
+                }
+            }
+            insPlyIncomeService.saveOrUpdateBatch(newList);
+            log.info("更新的结算表为" + newList.toString() + new Date().toString());
+        }
     }
 }
 

+ 92 - 30
src/main/java/com/ydtech/modules/order/service/impl/InsOrderPushMsgServiceImpl.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.order.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.constants.RabbitMqEnum;
 import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.modules.admin.utils.SliceUpDateUtil;
 import com.ydtech.modules.order.dao.InsOrderPushMsgMapper;
@@ -17,11 +18,19 @@ import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.utils.OrderUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.core.MessageProperties;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.UUID;
+
+import static org.springframework.amqp.core.MessageProperties.CONTENT_TYPE_TEXT_PLAIN;
 
 /**
  * @author Administrator
@@ -46,8 +55,11 @@ public class InsOrderPushMsgServiceImpl extends ServiceImpl<InsOrderPushMsgMappe
     @Autowired
     private InsTaskImagesMapper insTaskImagesMapper;
 
-    //@Autowired
-    //private RabbitTemplate rabbitTemplate;
+    @Autowired
+    private RabbitTemplate rabbitTemplate;
+
+    @Autowired
+    private InsOrderPushMsgService insOrderPushMsgService;
 
 
     /**
@@ -57,25 +69,29 @@ public class InsOrderPushMsgServiceImpl extends ServiceImpl<InsOrderPushMsgMappe
      *  @Description: 推送历史的订单信息
      */
     @Override
-    public void getPushInsAreaCompanyList() {
-        List<String> dateList = insOrderPushMsgMapper.getPushInsAreaCompanyDateList();
-       // List<String> dateList  =new ArrayList<String>();
-       // dateList.add("2024-10");
-        if(dateList!=null && !dateList.isEmpty()){
-            //启动线程池
-            dateList.forEach(item ->{
-                String benginTime = SliceUpDateUtil.getStartOfMonth(Integer.parseInt(item.split("-")[0]), Integer.parseInt(item.split("-")[1]));
-                String endTime = SliceUpDateUtil.getEndOfMonth(Integer.parseInt(item.split("-")[0]), Integer.parseInt(item.split("-")[1]));
-                List<String> orderList = insOrderPushMsgMapper.getPushInsAreaCompanyList(benginTime,endTime);
-                ArrayList<String>  pushDataList =new ArrayList<String>();
-                if(orderList!=null && !orderList.isEmpty()){
-                    orderList.forEach(orderId ->{
-                        pushDataList.add(getPushDataJsonString(orderId));
-                    });
-                }
-                if(pushDataList!=null && !pushDataList.isEmpty()){
-                   // Thread thread = new Thread(new OrderRunnableThread(rabbitTemplate, pushDataList,this));
-                    //thread.start();
+    public void getPushInsAreaCompanyList(String month) {
+        String benginTime = SliceUpDateUtil.getStartOfMonth(Integer.parseInt(month.split("-")[0]), Integer.parseInt(month.split("-")[1]));
+        String endTime = SliceUpDateUtil.getEndOfMonth(Integer.parseInt(month.split("-")[0]), Integer.parseInt(month.split("-")[1]));
+        List<String> orderList = insOrderPushMsgMapper.getPushInsAreaCompanyList(benginTime,endTime);
+        ArrayList<String>  pushDataList =new ArrayList<String>();
+        if(orderList!=null && !orderList.isEmpty()){
+            orderList.forEach(orderId ->{
+                PushDataVo pushDataVo = getPushData(orderId);
+                String items = JSONObject.toJSONString(pushDataVo);
+                MessageProperties messageProperties = new MessageProperties();
+                messageProperties.setMessageId(UUID.randomUUID().toString());
+                messageProperties.setContentType(CONTENT_TYPE_TEXT_PLAIN);
+                messageProperties.setContentEncoding("UTF-8");
+                Message message_cj = new Message(items.getBytes(StandardCharsets.UTF_8), messageProperties);
+                //推送
+                InsOrderPushMsg insOrderPushMsg = new InsOrderPushMsg(null, pushDataVo.getInsAreaCompany().getId(), "0", new Date(), pushDataVo.toString());
+                try{
+                    //更新狀態
+                    insOrderPushMsgService.save(insOrderPushMsg);
+                    this.rabbitTemplate.convertAndSend(RabbitMqEnum.ORDER_EXCHANGE.getCode(), RabbitMqEnum.ORDER_ROUTINGKEY.getCode(), message_cj);
+                    Thread.sleep(1500);
+                }catch(Exception e){
+                    e.getStackTrace();
                 }
             });
         }
@@ -94,13 +110,25 @@ public class InsOrderPushMsgServiceImpl extends ServiceImpl<InsOrderPushMsgMappe
         if(orderList!=null && !orderList.isEmpty()){
             //通过
             orderList.forEach(orderId ->{
-                pushDataList.add(getPushDataJsonString(orderId));
+                PushDataVo pushDataVo = getPushData(orderId);
+                String item = JSONObject.toJSONString(pushDataVo);
+                MessageProperties messageProperties = new MessageProperties();
+                messageProperties.setMessageId(UUID.randomUUID().toString());
+                messageProperties.setContentType(CONTENT_TYPE_TEXT_PLAIN);
+                messageProperties.setContentEncoding("UTF-8");
+                Message message_cj = new Message(item.getBytes(StandardCharsets.UTF_8), messageProperties);
+                //推送
+                //InsOrderPushMsg insOrderPushMsg = new InsOrderPushMsg(null, pushDataVo.getInsAreaCompany().getId(), "0", new Date(), pushDataVo.toString());
+                try{
+                    //更新狀態
+                    //insOrderPushMsgService.save(insOrderPushMsg);
+                    this.rabbitTemplate.convertAndSend(RabbitMqEnum.ORDER_EXCHANGE_FAIL.getCode(), RabbitMqEnum.ORDER_ROUTINGKEY_FAIL.getCode(), message_cj);
+                    Thread.sleep(1500);
+                }catch(Exception e){
+                    e.getStackTrace();
+                }
             });
         }
-        if(pushDataList!=null && !pushDataList.isEmpty()){
-            //Thread thread = new Thread(new OrderRunnableThread(rabbitTemplate, pushDataList,this));
-            //thread.start();
-        }
      }
     /**
      *  @version
@@ -109,12 +137,29 @@ public class InsOrderPushMsgServiceImpl extends ServiceImpl<InsOrderPushMsgMappe
      *  @Description:  承保数据推送
      */
     @Override
-    public void getPushSignInsAreaCompanyList(String item) {
+    public void getPushSignInsAreaCompanyList(String orderId) {
         try{
-            ArrayList<String>  pushDataList =new ArrayList<String>();
-            pushDataList.add(getPushDataJsonString(item));
-            //Thread thread = new Thread(new OrderRunnableThread(rabbitTemplate, pushDataList,this));
+            //ArrayList<String>  pushDataList =new ArrayList<String>();
+            //pushDataList.add(getPushDataJsonString(item));
+            //Thread thread = new Thread(new OrderSignRunnableThread(rabbitTemplate, pushDataList,this));
             //thread.start();
+            PushDataVo pushDataVo = getPushData(orderId);
+            String item = JSONObject.toJSONString(pushDataVo);
+            MessageProperties messageProperties = new MessageProperties();
+            messageProperties.setMessageId(UUID.randomUUID().toString());
+            messageProperties.setContentType(CONTENT_TYPE_TEXT_PLAIN);
+            messageProperties.setContentEncoding("UTF-8");
+            Message message_cj = new Message(item.getBytes(StandardCharsets.UTF_8), messageProperties);
+            //推送
+            InsOrderPushMsg insOrderPushMsg = new InsOrderPushMsg(null, pushDataVo.getInsAreaCompany().getId(), "0", new Date(), pushDataVo.toString());
+            try{
+                //更新狀態
+                insOrderPushMsgService.save(insOrderPushMsg);
+                this.rabbitTemplate.convertAndSend(RabbitMqEnum.ORDER_EXCHANGE_FAIL.getCode(), RabbitMqEnum.ORDER_ROUTINGKEY_SIGN.getCode(), message_cj);
+
+            }catch(Exception e){
+                e.getStackTrace();
+            }
         }catch(Exception e){
             log.error(e.getMessage());
         }
@@ -156,4 +201,21 @@ public class InsOrderPushMsgServiceImpl extends ServiceImpl<InsOrderPushMsgMappe
         insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
     }
 
+
+    public PushDataVo getPushData(String orderId) {
+        //小订单的数据
+        InsAreaCompany insAreaCompany = insAreaCompanyService.getById(orderId);
+        //大订单数据
+        InsOrders orders = insOrdersService.getById(insAreaCompany.getOrderno());
+        String jyPolicyNo="";
+        String apiType = insAreaCompany.getApiType() == null ? null : insAreaCompany.getApiType() + "";
+        if (insAreaCompany.getCrossInsurance() != null) {
+            jyPolicyNo = OrderUtils.getJyPolicyNo(insAreaCompany.getCompanyId(), apiType, insAreaCompany.getCrossInsurance().toString(), String.valueOf(orders.getIsExternal()));
+        }
+        insAreaCompany.setJyPolicyNo(jyPolicyNo);
+        //影像数据
+        List<InsTaskImagesDto> taskImagesList = insTaskImagesMapper.getTaskImagesList(insAreaCompany.getOrderno());
+        PushDataVo pushDataVo  =new PushDataVo(insAreaCompany,orders,taskImagesList);
+        return pushDataVo;
+    }
 }

+ 45 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsOrderReadPdfServiceImpl.java

@@ -3,16 +3,22 @@ package com.ydtech.modules.order.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.SysUserRole;
 import com.ydtech.modules.admin.model.dto.SysUserLinkAreaDto;
+import com.ydtech.modules.fnc.entity.InsPlyIncome;
+import com.ydtech.modules.fnc.service.InsPlyIncomeService;
 import com.ydtech.modules.order.dao.InsOrderReadPdfMapper;
 import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.api.pingan.utils.PDFUtil;
 import com.ydtech.modules.order.entity.dto.InsOrderReadPdfContentDto;
 import com.ydtech.modules.order.entity.po.InsOrderReadPdf;
 import com.ydtech.modules.order.entity.vo.InsOrderReadPdfContentVo;
 import com.ydtech.modules.order.entity.vo.InsOrderReadPdfVo;
+import com.ydtech.modules.order.service.InsAreaCompanyService;
+import com.ydtech.modules.order.service.InsOrderPayDateRecordService;
 import com.ydtech.modules.order.service.InsOrderReadPdfService;
 import com.ydtech.utils.StringUtils;
 import org.springframework.beans.BeanUtils;
@@ -35,6 +41,15 @@ public class InsOrderReadPdfServiceImpl extends ServiceImpl<InsOrderReadPdfMappe
     @Autowired
     private InsOrderReadPdfMapper  insOrderReadPdfMapper;
 
+    @Autowired
+    private InsAreaCompanyService insAreaCompanyService;
+
+    @Autowired
+    private InsPlyIncomeService insPlyIncomeService;
+
+    @Autowired
+    private InsOrderPayDateRecordService insOrderPayDateRecordService;
+
     @Override
     public BasePageResult<InsOrderReadPdf> queryPage(InsOrderReadPdfVo insOrderReadPdfVo) {
         Page<InsOrderReadPdf> page = new Page<>(insOrderReadPdfVo.getPageNum(),
@@ -89,4 +104,34 @@ public class InsOrderReadPdfServiceImpl extends ServiceImpl<InsOrderReadPdfMappe
         }
         return new InsOrderReadPdfContentDto(pdfText,content);
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/30 10:42
+     *  @Description:  手动更新结算表的签单时间
+     */
+    @Override
+    public void updatePlySignDate(String id) {
+        InsPlyIncome  ply = insPlyIncomeService.getById(id);
+        if(ply!=null){
+           if(ply.getOrderno() ==null){
+               new SystemException("子订单编号为空不允许更新");
+           }else{
+               InsAreaCompany iac = insAreaCompanyService.getById(ply.getOrderno());
+               //更新子订单的签单时间
+               if(iac.getSigningTime()==null){
+                   try{
+                       insOrderPayDateRecordService.updateOrderDate(ply.getOrderno());
+                   }catch(Exception e){
+                       new SystemException("更新保单签单时期失败");
+                   }
+               }
+               InsAreaCompany newIac = insAreaCompanyService.getById(ply.getOrderno());
+               if(newIac.getSigningTime()!=null){
+                   ply.setSignDate(iac.getSigningTime());
+                   insPlyIncomeService.saveOrUpdate(ply);
+               }
+           }
+        }
+    }
 }

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

@@ -259,9 +259,14 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             insOrders.setCompanyId(insAreaCompany.getCompanyId());
             insOrders.setInsCompany(insAreaCompany.getInscompany());
             insOrders.setInsureTime(insAreaCompany.getPayDate());
-            //已承保记录保费数据
-            saveFeeInfo(insAreaCompany);
-
+            String id = insAreaCompany.getId();
+            if (StringUtils.isNotEmpty(id)) {
+                List<SysPremiumDetails> sysPremiumDetails = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>().eq(SysPremiumDetails::getCompanyId, id));
+                if ( sysPremiumDetails.size() == 0) {
+                    //已承保记录保费数据
+                    saveFeeInfo(insAreaCompany);
+                }
+            }
         }
 
         if (InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insOrders.getOrderstatus())) {

+ 3 - 0
src/main/java/com/ydtech/modules/order/service/impl/SysQuoteConfigServiceImpl.java

@@ -326,6 +326,9 @@ public class SysQuoteConfigServiceImpl extends ServiceImpl<SysQuoteConfigMapper,
         if(quoteDetailsQueryVo.getDeptId() == null) {
             quoteDetailsQueryVo.setDeptId(BaseController.getDeptId());
         }
+        if(quoteDetailsQueryVo.getOperator() == null){
+            quoteDetailsQueryVo.setOperator(BaseController.getUserId());
+        }
         Page<QuoteDetailsVo> quoteRecordPage = sysQuoteRecordMapper.getQuoteRecordPage(page, quoteDetailsQueryVo);
         quoteRecordPage.getRecords().forEach(item -> {
             item.setAction(QuoteNumberConstant.QuoteAction.getByCode(item.getAction()));

+ 42 - 0
src/main/java/com/ydtech/modules/order/timer/UpdateOrderMQTimer.java

@@ -0,0 +1,42 @@
+package com.ydtech.modules.order.timer;
+
+import com.ydtech.modules.order.service.InsOrderPushMsgService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/11/22 16:29
+ *  @Description: 推动补偿信息
+ */
+@Slf4j
+@Component
+public class UpdateOrderMQTimer {
+
+    @Autowired
+    private InsOrderPushMsgService insOrderPushMsgService;
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/11/22 16:31
+     *  @Description: 每2小时更新一次补偿消息的推送
+     */
+    @Scheduled(cron = "0 0 */2 * * ?")
+    private void updateOrderDateNoon() {
+        log.info("每2小时更新一次补偿消息的推送,启动时间:{}", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+        try {
+            insOrderPushMsgService.getPushCompensateInsAreaCompanyList();
+            log.info("每2小时更新一次补偿消息的推送,成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("每2小时更新一次补偿消息的推送,失败:{}", e.getMessage());
+        }
+    }
+}

+ 85 - 13
src/main/java/com/ydtech/modules/order/timer/UpdateOrderTimer.java

@@ -1,10 +1,13 @@
 package com.ydtech.modules.order.timer;
 
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.ydtech.modules.admin.utils.SliceUpDateUtil;
 import com.ydtech.modules.order.service.InsOrderPayDateRecordService;
 import com.ydtech.utils.DateUtil;
-import com.ydtech.utils.DateUtil_N;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -20,11 +23,27 @@ import java.util.Date;
  */
 @Slf4j
 @Component
+@EnableAsync
 public class UpdateOrderTimer {
 
     @Autowired
     private InsOrderPayDateRecordService insOrderPayDateRecordService;
 
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/27 17:26
+     *  @Description:  每10分钟执行下更新订单时间
+     */
+//    @Async
+//    @Scheduled(cron = "0 0/30 * * * ?")
+    @XxlJob("updateOrderDateMinite")
+    public void updateOrderDateMinite() {
+        String benginDate = DateUtil.getDateFormat(new Date(), "yyyy-MM-dd")+" 00:00:00";
+        String endDate = DateUtil.getDateFormat(new Date(), "yyyy-MM-dd")+" 23:59:59";
+        updateOrderDate(benginDate,endDate);
+    }
     /**
      *  @version
      *  @author: hxl
@@ -33,12 +52,28 @@ public class UpdateOrderTimer {
      * 中午一点
      * 凌晨一点
      */
+    @Async
     @Scheduled(cron = "0 0 13 * * ?")
-    private void updateOrderDateNoon() {
+    public void updateOrderDateNoon() {
+        //更新前一周的数据
+        String benginDate = SliceUpDateUtil.getBeforeDay(new Date(), 1) + " 00:00:00";
+        String endDate = SliceUpDateUtil.getBeforeDay(new Date(), 0) + " 23:59:59";
+        updateOrderDate(benginDate,endDate);
+    }
+
+    @Async
+    @Scheduled(cron = "0 0 1 * * ?")
+    public void updateOrderDateBeforeDawn() {
+        String benginDate = SliceUpDateUtil.getBeforeDay(new Date(), 1) + " 00:00:00";
+        String endDate = SliceUpDateUtil.getBeforeDay(new Date(), 0) + " 23:59:59";
+        updateOrderDate(benginDate,endDate);
+    }
+
+    private void updateOrderDate(String benginDate,String endDate) {
         log.info("定时更新订单的签单时间和缴费日期,启动时间:{}", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
-        //凌晨1点到中午1点
-        String benginDate = DateUtil.getDateFormat(new Date(), "yyyy-MM-dd")+" 01:00:00";
-        String endDate = DateUtil.getDateFormat(new Date(), "yyyy-MM-dd HH:mm:ss");
+        //中午1点到凌晨1点
+       // String benginDate = DateUtil.getDateFormat(new Date(), "yyyy-MM-dd")+" 00:00:00";
+       // String endDate = DateUtil.getDateFormat(new Date(), "yyyy-MM-dd")+" 23:59:59";
         try {
             insOrderPayDateRecordService.batchOrderDate(benginDate,endDate);
             log.info("定时更新订单的签单时间和缴费日期成功");
@@ -49,18 +84,55 @@ public class UpdateOrderTimer {
     }
 
 
+     /**
+      *  @version
+      *  @author: hxl
+      *  @Date: 2024/12/30 9:59
+      *  @Description:  自动更新结算表中签单日期为空的数据
+      */
+//    @Async
+//    @Scheduled(cron = "0 0/30 * * * ?")
+    @XxlJob("updateOrderPlyDateMinite")
+    public void updateOrderPlyDateMinite() {
+        String benginDate = DateUtil.getDateFormat(new Date(), "yyyy-MM-dd")+" 00:00:00";
+        String endDate = DateUtil.getDateFormat(new Date(), "yyyy-MM-dd")+" 23:59:59";
+        updatePlyDate(benginDate,endDate);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/30 9:59
+     *  @Description:  晚上一点执行上周数据
+     */
+    @Async
     @Scheduled(cron = "0 0 1 * * ?")
-    private void updateOrderDateBeforeDawn() {
-        log.info("定时更新订单的签单时间和缴费日期,启动时间:{}", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
-        //中午1点到凌晨1点
-        String benginDate = DateUtil.getDateFormat(DateUtil_N.getPreviousDate(new Date()), "yyyy-MM-dd")+" 13:00:01";
-        String endDate = DateUtil.getDateFormat(new Date(), "yyyy-MM-dd HH:mm:ss");
+    public void updateOrderPlyDateBeforeDawn() {
+        String benginDate = SliceUpDateUtil.getBeforeDay(new Date(), 1) + " 00:00:00";
+        String endDate = SliceUpDateUtil.getBeforeDay(new Date(), 0) + " 23:59:59";
+        updatePlyDate(benginDate,endDate);
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/30 9:59
+     *  @Description:  中午一点更新上周数据
+     */
+    @Async
+    @Scheduled(cron = "0 0 13 * * ?")
+    public void updateOrderPlyDateNoon() {
+        String benginDate = SliceUpDateUtil.getBeforeDay(new Date(), 1) + " 00:00:00";
+        String endDate = SliceUpDateUtil.getBeforeDay(new Date(), 0) + " 23:59:59";
+        updatePlyDate(benginDate,endDate);
+    }
+
+    private void updatePlyDate(String benginDate,String endDate) {
         try {
-            insOrderPayDateRecordService.batchOrderDate(benginDate,endDate);
-            log.info("定时更新订单的签单时间和缴费日期成功");
+            insOrderPayDateRecordService.batchOrderPlyOrderDate(benginDate,endDate);
+            log.info("定时更新结算表的签单时间和缴费日期成功"+new Date().toString());
         } catch (Exception e) {
             e.printStackTrace();
-            log.error("定时更新订单的签单时间和缴费日期失败:{}", e.getMessage());
+            log.error("定时更新结算表的签单时间和缴费日期失败:{}", e.getMessage());
         }
     }
 }

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

@@ -1851,7 +1851,7 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
                             retailProportion.getJqRetailLevel3Proportion(),
                             retailProportion.getSyRetailLevel3Proportion(),
                             retailProportion.getNoRetailLevel3Proportion());
-                    if (insFeeOrderNew.getFirstLevelUserId() != null) {
+                    if (insFeeOrderNew.getThreeLevelUserId() != null) {
                         SysUser byId = sysUserService.getById(insFeeOrderNew.getThreeLevelUserId());
                         retailFeeLevel3.setUserName(byId.getName() + "(" + byId.getId() + ")");
                     }

+ 5 - 3
src/main/java/com/ydtech/modules/ttqf/service/impl/TtqfServiceImpl.java

@@ -248,9 +248,11 @@ public class TtqfServiceImpl implements TtqfService {
         try {
             boolean sign = false;
             QueryPresignResultModel resultModel = RetrieveTTQFApi.queryPressing(sysUser.getIdentity());
-            if (Objects.equals(PayConstantStatus.SIGN_STATUS,resultModel.getSignStatus()) &&
-                    Objects.equals(PayConstantStatus.AUTH_STATUS,resultModel.getAuthStatus())){
-                sign = true;
+            if (ObjectUtils.isNotEmpty(resultModel)){
+                if (Objects.equals(PayConstantStatus.SIGN_STATUS,resultModel.getSignStatus()) &&
+                        Objects.equals(PayConstantStatus.AUTH_STATUS,resultModel.getAuthStatus())){
+                    sign = true;
+                }
             }
             return HttpResult.ok(WithdrawalFRes.builder().bizCode(sign ? "3" : "1").url("").msg(sign ? "已签约" : "未签约").build());
         }catch (Exception e){

+ 30 - 3
src/main/resources/application-pre.yml

@@ -207,7 +207,31 @@ spring:
     suffix: .html
     encoding: UTF-8
     cache: false
-
+  # RabbitMQ 配置
+  rabbitmq:
+    host: 172.24.144.220
+    port: 5672
+    username: admin
+    password: admin
+    # 开启消息发送到队列(Queue)失败的回调
+    publisher-returns: true
+    # 开启发送至交换机(Exchange)的确认
+    publisher-confirm-type: CORRELATED
+    listener:
+      simple:
+        # 表示消费者消费成功消息以后需要手工的进行签收(ack确认),默认为 auto
+        acknowledge-mode: manual
+        concurrency: 5
+        max-concurrency: 10
+        prefetch: 1
+        retry:
+          initial-interval: 5000ms
+          enabled: true
+          max-attempts: 5
+        default-requeue-rejected: true
+      template:
+        # 为 true 时,消息通过交换器无法匹配到队列时会返回给生产者
+        mandatory: true
 upload:
   basepath: ${filePath}
   file:
@@ -409,7 +433,7 @@ xxl:
       # 执行器注册 [选填]:优先使用该配置作为注册地址
       address: ""
       # 执行器IP [选填]:默认为空表示自动获取IP
-      ip: "172.24.144.220"
+      ip: ""
       # 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999
       port: 0
       # 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
@@ -461,4 +485,7 @@ sendMessage-zg-yggl-IP: https://test.baoxianzhanggui.com/prod-api
 #晋掌柜APP  手机注册用户 机构id  推荐人id
 jzg:
   deptId: "99140121M09D01"
-  referrerId: "99140121M09D01001"
+  referrerId: "99140121M09D01001"
+lg-ip:
+  dateServer: http://192.168.0.59:8081/system/record/receiveDistributeServices
+  withdrawal: http://192.168.0.59:8081/withdrawal/record/acceptPushWithdrawalData

+ 31 - 3
src/main/resources/application-prod.yml

@@ -199,7 +199,31 @@ spring:
     suffix: .html
     encoding: UTF-8
     cache: false
-
+  # RabbitMQ 配置
+  rabbitmq:
+    host: 172.24.144.220
+    port: 5672
+    username: admin
+    password: admin
+    # 开启消息发送到队列(Queue)失败的回调
+    publisher-returns: true
+    # 开启发送至交换机(Exchange)的确认
+    publisher-confirm-type: CORRELATED
+    listener:
+      simple:
+        # 表示消费者消费成功消息以后需要手工的进行签收(ack确认),默认为 auto
+        acknowledge-mode: manual
+        concurrency: 5
+        max-concurrency: 10
+        prefetch: 1
+        retry:
+          initial-interval: 5000ms
+          enabled: true
+          max-attempts: 5
+        default-requeue-rejected: true
+      template:
+        # 为 true 时,消息通过交换器无法匹配到队列时会返回给生产者
+        mandatory: true
 upload:
   basepath: ${filePath}
   file:
@@ -214,7 +238,8 @@ wechat:
   # 微信客服
   customer:
     corp-id: wwfe67d19509d43ec5
-    secret: lbn1DU7VhqK3dG0XDciPDXf_AdSryne84nvRhtSEGLc
+#    secret: lbn1DU7VhqK3dG0XDciPDXf_AdSryne84nvRhtSEGLc
+    secret: 5M_5mGONe-t4xCPlwPU-EJt53GiWaUjtbJjY5CR-dgc
     token: btgwGK2r
     encoding-aes-key: eevs11QeInJYRysGYnC8gK68F4CGsedM1Dn1X79cPCs
   open:
@@ -414,7 +439,7 @@ xxl:
       # 执行器注册 [选填]:优先使用该配置作为注册地址
       address: ""
       # 执行器IP [选填]:默认为空表示自动获取IP
-      ip: "172.24.144.220"
+      ip: ""
       # 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999
       port: 0
       # 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
@@ -467,3 +492,6 @@ sendMessage-zg-yggl-IP: https://test.baoxianzhanggui.com/prod-api
 jzg:
   deptId: "99140121M09D01"
   referrerId: "99140121M09D01001"
+lg-ip:
+  dateServer: http://172.24.144.219:8081/system/record/receiveDistributeServices
+  withdrawal: http://172.24.144.219:8081/withdrawal/record/acceptPushWithdrawalData

+ 31 - 2
src/main/resources/application-test.yml

@@ -217,7 +217,31 @@ spring:
     suffix: .html
     encoding: UTF-8
     cache: false
-
+  # RabbitMQ 配置
+  rabbitmq:
+    host: 172.24.144.218
+    port: 5672
+    username: admin
+    password: admin
+    # 开启消息发送到队列(Queue)失败的回调
+    publisher-returns: true
+    # 开启发送至交换机(Exchange)的确认
+    publisher-confirm-type: CORRELATED
+    listener:
+      simple:
+        # 表示消费者消费成功消息以后需要手工的进行签收(ack确认),默认为 auto
+        acknowledge-mode: manual
+        concurrency: 5
+        max-concurrency: 10
+        prefetch: 1
+        retry:
+          initial-interval: 5000ms
+          enabled: true
+          max-attempts: 5
+        default-requeue-rejected: true
+      template:
+        # 为 true 时,消息通过交换器无法匹配到队列时会返回给生产者
+        mandatory: true
 upload:
   # 路径带上前后斜杆
   basepath: ${filePath}
@@ -232,7 +256,8 @@ wechat:
   # 微信客服
   customer:
     corp-id: wwfe67d19509d43ec5
-    secret: lbn1DU7VhqK3dG0XDciPDXf_AdSryne84nvRhtSEGLc
+#    secret: lbn1DU7VhqK3dG0XDciPDXf_AdSryne84nvRhtSEGLc
+    secret: 5M_5mGONe-t4xCPlwPU-EJt53GiWaUjtbJjY5CR-dgc
     token: btgwGK2r
     encoding-aes-key: eevs11QeInJYRysGYnC8gK68F4CGsedM1Dn1X79cPCs
   open:
@@ -544,3 +569,7 @@ sendMessage-zg-yggl-IP: https://test.baoxianzhanggui.com/prod-api
 jzg:
   deptId: "99140121M09D01"
   referrerId: "99140121M09D01001"
+
+lg-ip:
+  dateServer: https://test.baoxianzhanggui.com/prod-api/system/record/receiveDistributeServices
+  withdrawal: https://test.baoxianzhanggui.com/prod-api/withdrawal/record/acceptPushWithdrawalData

+ 33 - 1
src/main/resources/mapper/modules/admin/DeptBalanceMapper.xml

@@ -184,7 +184,7 @@
              and   io.userid =#{userId}
             </if>
             <if test="beginDate !=null and beginDate != '' and endDate !=null and endDate != ''">
-                AND  iac.signing_time  BETWEEN  #{beginDate}  AND  #{endDate}
+                AND  DATE_FORMAT( iac.createtime, '%Y-%m-%d')  BETWEEN DATE_FORMAT( #{beginDate}, '%Y-%m-%d')    AND   DATE_FORMAT( #{endDate}, '%Y-%m-%d')
             </if>
         </where>
     </select>
@@ -207,4 +207,36 @@
             </if>
         </where>
     </select>
+
+    <select id="getIncomeIndication" resultType="java.util.HashMap">
+        select ifnull(sum(a.amount) ,0) as "totalAmount"
+        from (
+        SELECT
+        his.amount as "amount"
+        FROM
+        sys_user_account_history his
+        LEFT JOIN ins_area_company ins ON his.suborder = ins.id
+        LEFT JOIN ins_orders o ON o.orderno = ins.orderno
+        left join sys_amount_auditing saa on saa.id =his.auditiing_id
+        left join sys_user su on su.id =his.user_id
+        WHERE
+        his.property !=1
+        and his.property !=2
+        AND his.documentary = '2'
+        <if test="beginDate !=null and beginDate != '' and endDate !=null and endDate != '' ">
+            AND date(his.create_time) BETWEEN #{beginDate} AND #{endDate}
+        </if>
+        <if test="userId !=null and userId!=''">
+            AND his.user_id =#{userId}
+        </if>
+        <if test="name !=null and name !=''">
+            and su.name like concat('%',#{name},'%')
+        </if>
+
+        <if test="phoneNumber !=null and phoneNumber !=''">
+            and su.mobile =#{phoneNumber}
+        </if>
+        order by his.create_time desc
+        ) a
+    </select>
 </mapper>

+ 21 - 0
src/main/resources/mapper/modules/admin/SysPartnerAccountMapper.xml

@@ -13,4 +13,25 @@
     </resultMap>
 
 
+    <select id="getByDeptBalanceDto" resultType="com.ydtech.modules.admin.model.SysPartnerAccount">
+        select
+            a.id as "id",
+            a.user_id as "userId",
+            a.sum_Premium as "sumPremium",
+            a.extract_fee as "extractFee",
+            a.create_time as "createTime",
+            a.history_fee as "historyFee",
+            a.cash_fee as "cashFee"
+        from sys_partner_account a
+        <where>
+            <if test="beginDate !=null and beginDate !=''  and  endDate !=null and  endDate !=''">
+                AND DATE_FORMAT( a.create_time, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{beginDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
+            </if>
+            <if test="userId !=null and userId !=''">
+                AND a.user_id =#{userId}
+            </if>
+        </where>
+
+    </select>
+
 </mapper>

+ 5 - 3
src/main/resources/mapper/modules/admin/SysPartnerMapper.xml

@@ -16,7 +16,7 @@
         select
         sp.id as "id",
         sp.user_id as "userId",
-        sp.user_name as "userName",
+        su.name as "userName",
         sp.type as "type",
         sp.proportional as "proportional",
         sp.suggest_id as "suggestId",
@@ -24,15 +24,17 @@
         sp.create_time as "createTime",
         sp.create_by as "createBy",
         sp.del_flag as "delFlag",
-        sp.del_flag as "delFlag",
         sd.name as "deptName",
-        sd.comlevel as "comlevel"
+        sd.comlevel as "comlevel",
+        su.mobile as "mobile",
+        sp.type as  "patnerLevel"
         from sys_partner sp
         left join  sys_user su on  su.id =  sp.user_id
         left join  sys_dept sd on  sd.id =  su.dept_id
         <where>
             1=1
             and sp.del_flag ='1'
+            and  sp.type ='1'
             <if test="vo.deptId !=null and  vo.deptId!=''  ">
                 and sd.id  LIKE concat('%', #{vo.deptId}, '%')
             </if>

+ 21 - 0
src/main/resources/mapper/modules/admin/SysPremiumDetailsMapper.xml

@@ -49,6 +49,25 @@
     <sql id="setGroupConcatMaxLen">
         SET SESSION group_concat_max_len = 100000;
     </sql>
+    <select id="getTotalAmount" resultType="java.util.HashMap">
+        SELECT
+        sum(a.sumpremium) as "totalAmount",
+        sum(a.extract_fee) as "extractFeeAmount"
+        from
+        sys_premium_details a
+        <where>
+            a.status ='1'
+            <if test="beginDate !=null and beginDate != '' and endDate !=null and endDate != ''">
+                AND DATE_FORMAT( a.create_time, '%Y-%m-%d') BETWEEN DATE_FORMAT( #{beginDate}, '%Y-%m-%d') AND
+                DATE_FORMAT( #{endDate}, '%Y-%m-%d')
+            </if>
+            <if test="userId !=null  and  userId !=''">
+                and a.user_id = #{userId}
+            </if>
+        </where>
+
+
+    </select>
     <select id="queryInfoPage" resultType="java.util.Map">
         <include refid="setGroupConcatMaxLen"/>
         SELECT
@@ -97,6 +116,8 @@
             company_id ASC
         LIMIT #{dto.pageSize} OFFSET #{dto.pageNum};
     </select>
+
+    
     <select id="queryInfoPages" resultType="java.util.Map">
         SELECT
         company_id as companyId,

+ 66 - 11
src/main/resources/mapper/modules/admin/SysUserAccountMapper.xml

@@ -5,6 +5,7 @@
 <mapper namespace="com.ydtech.modules.admin.dao.SysUserAccountMapper">
 
     <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.po.SysUserAccount">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
             <id property="userId" column="user_id" jdbcType="VARCHAR"/>
             <result property="handlingFee" column="handling_fee" jdbcType="DECIMAL"/>
             <result property="documentary" column="documentary" jdbcType="DECIMAL"/>
@@ -28,8 +29,8 @@
             <result property="sumAmountPayment" column="sum_amount_payment" jdbcType="DECIMAL"/>
             <result property="managementSource" column="managementSource" jdbcType="VARCHAR"/>
             <result property="roleId" column="roleId" jdbcType="VARCHAR"/>
-        <collection property="sysUserAccountCardList" ofType="com.ydtech.modules.admin.model.po.SysUserBankCard"
-                    resultMap="sysUserAccountCardList"/>
+       <!-- <collection property="sysUserAccountCardList" ofType="com.ydtech.modules.admin.model.po.SysUserBankCard"
+                    resultMap="sysUserAccountCardList"/> -->
     </resultMap>
 
     <resultMap id="sysUserAccountCardList" type="com.ydtech.modules.admin.model.po.SysUserBankCard">
@@ -109,6 +110,7 @@
 
     <select id="queryPageOrder1"  resultMap="BaseResultMap">
         select
+        a.user_id as id,
         a.user_id,
         a.handling_fee,
         a.documentary,
@@ -126,13 +128,6 @@
         b.dept_id  as  deptId,
         b.name  as  name,
         sd.name  as  deptName,
-        c.id,
-        c.bank_number,
-        c.bank_account,
-        c.bank_address,
-        c.del_flag,
-        c.audit_status,
-        c.real_user_name,
         a.sum_amount,
         a.sum_amount_withdrawal,
         a.sum_amount_account,
@@ -143,10 +138,8 @@
         sys_user_account a
         left join sys_user b on a.user_id = b.id
         left join sys_dept sd on sd.id = b.dept_id
-        left join sys_user_bank_card c on c.user_id = a.user_id
         left join sys_user_role role on role.user_id = a.user_id
         <where>
-            1=1
             <if test="sysUserAccountVo.userId != null and sysUserAccountVo.userId != ''">
                 and a.user_id = #{sysUserAccountVo.userId}
             </if>
@@ -171,4 +164,66 @@
     </select>
 
 
+    <select id="queryCount"  resultMap="BaseResultMap">
+        select
+        a.user_id,
+        a.handling_fee,
+        a.documentary,
+        a.promotion,
+        a.create_time,
+        a.handling_amount_withdrawal,
+        a.handling_amount_account,
+        a.handling_amount_payment,
+        a.documentary_amount_withdrawal,
+        a.documentary_amount_account,
+        a.documentary_amount_payment,
+        a.promotion_amount_withdrawal,
+        a.promotion_amount_account,
+        a.promotion_amount_payment,
+        b.dept_id  as  deptId,
+        b.name  as  name,
+        sd.name  as  deptName,
+        sd.management_source  as managementSource,
+        role.role_id  as  roleId
+        from
+        sys_user_account a
+        left join sys_user b on a.user_id = b.id
+        left join sys_dept sd on sd.id = b.dept_id
+        left join sys_user_role role on role.user_id = a.user_id
+        <where>
+            a.user_id   not  in (
+            SELECT
+            su.id AS userId
+            FROM
+            sys_user su
+            LEFT JOIN sys_user_info info ON info.id = su.id
+            LEFT JOIN sys_dept sd ON su.dept_id = sd.id
+            LEFT JOIN sys_dept psd ON psd.id = sd.parent_id
+            LEFT JOIN sys_user_role t3 ON su.id = t3.user_id
+            LEFT JOIN sys_role t4 ON t3.role_id = t4.id
+            AND sd.del_flag = '0'
+            WHERE
+            su.dept_id LIKE concat( '%', '99', '%' )
+            AND t3.role_id IN ( 3 )
+            AND sd.management_source = 3
+            ORDER BY
+            su.create_time DESC
+            )
+        </where>
+    </select>
+
+
+    <select id="queryCardListByUserId"  resultMap="sysUserAccountCardList">
+        select
+            c.id,
+            c.bank_number,
+            c.bank_account,
+            c.bank_address,
+            c.del_flag,
+            c.audit_status,
+            c.real_user_name
+        from
+            sys_user_bank_card c
+        where  c.user_id =#{userId}
+    </select>
 </mapper>

+ 3 - 0
src/main/resources/mapper/modules/admin/SysUserMapper.xml

@@ -1387,6 +1387,7 @@
         <where>
             info.id is not null
             and su.id NOT LIKE '%M%'
+            AND ( su.type != '1' and  su.type != '2' )
             <if test="vo.provinceId != null and vo.provinceId != ''">
                 and sd.id like concat('%',#{vo.provinceId},'%')
             </if>
@@ -1488,6 +1489,7 @@
 
     <select id="getQxFrontlineAgentList" resultType="com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto">
         SELECT
+        su.leader_id  as "leaderId",
         sd.name as "deptName",
         su.name as "name",
         sd.id as "deptId",
@@ -1598,6 +1600,7 @@
         select t.id                 id,
                t.name               name,
                t.mobile             mobile,
+               t.leader_id          leaderId,
                t2.management_source managementSource,
                t.operatorCode,
                t2.id                deptId

Some files were not shown because too many files changed in this diff