ソースを参照

Merge branch 'test' into test-dj

dongxin 1 年間 前
コミット
650b757ac5
59 ファイル変更1739 行追加181 行削除
  1. 20 0
      sql/Online.sql
  2. 4 1
      src/main/java/com/ydtech/SpringInsApplication.java
  3. 1 1
      src/main/java/com/ydtech/config/resttemplate/RestTemplateConfig.java
  4. 9 0
      src/main/java/com/ydtech/constants/enums/dict/organization/OrganizationSource.java
  5. 32 0
      src/main/java/com/ydtech/modules/admin/constants/BusinessTypeEnum.java
  6. 39 0
      src/main/java/com/ydtech/modules/admin/constants/MessageConstants.java
  7. 30 0
      src/main/java/com/ydtech/modules/admin/constants/MessageModelConstants.java
  8. 25 0
      src/main/java/com/ydtech/modules/admin/controller/profitAnalysis/ProfitAnalysisController.java
  9. 194 0
      src/main/java/com/ydtech/modules/admin/controller/websocket/SendMessageServer.java
  10. 3 0
      src/main/java/com/ydtech/modules/admin/dao/SysPartnerAccountMapper.java
  11. 4 0
      src/main/java/com/ydtech/modules/admin/dao/SysUserRoleMapper.java
  12. 6 0
      src/main/java/com/ydtech/modules/admin/model/dto/DeptBalanceDto.java
  13. 34 0
      src/main/java/com/ydtech/modules/admin/model/dto/PayAmountExcel.java
  14. 65 0
      src/main/java/com/ydtech/modules/admin/model/dto/ReceivableExcel.java
  15. 13 0
      src/main/java/com/ydtech/modules/admin/service/ProfitAnalysisService.java
  16. 41 35
      src/main/java/com/ydtech/modules/admin/service/impl/DeptBalanceServiceImpl.java
  17. 58 0
      src/main/java/com/ydtech/modules/admin/service/impl/ProfitAnalysisServiceImpl.java
  18. 112 4
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java
  19. 3 0
      src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java
  20. 12 1
      src/main/java/com/ydtech/modules/console/dao/ProfitAnalysisMapper.java
  21. 5 11
      src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java
  22. 2 1
      src/main/java/com/ydtech/modules/inv/controller/InvAccountIncoiceController.java
  23. 6 0
      src/main/java/com/ydtech/modules/inv/model/InvAccountIncoice.java
  24. 35 1
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountIncoiceServiceImpl.java
  25. 2 0
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountServiceImpl.java
  26. 27 0
      src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java
  27. 14 0
      src/main/java/com/ydtech/modules/largescreen/controller/DataController.java
  28. 12 0
      src/main/java/com/ydtech/modules/largescreen/model/query/DataQuery.java
  29. 57 0
      src/main/java/com/ydtech/modules/lg/LgDataServer.java
  30. 60 1
      src/main/java/com/ydtech/modules/lg/PushLgLogUtils.java
  31. 1 1
      src/main/java/com/ydtech/modules/lg/PushRetry.java
  32. 42 5
      src/main/java/com/ydtech/modules/lg/SendUtils.java
  33. 7 0
      src/main/java/com/ydtech/modules/lg/dao/PushLgDataServerMapper.java
  34. 46 0
      src/main/java/com/ydtech/modules/lg/model/PushLgDataServer.java
  35. 9 0
      src/main/java/com/ydtech/modules/lg/service/PushLgDataServerService.java
  36. 30 0
      src/main/java/com/ydtech/modules/lg/service/impl/PushLgDataServerServiceImpl.java
  37. 52 0
      src/main/java/com/ydtech/modules/message/controller/SystemMessageController.java
  38. 13 0
      src/main/java/com/ydtech/modules/message/dao/SystemMessageMapper.java
  39. 69 0
      src/main/java/com/ydtech/modules/message/entity/SystemMessage.java
  40. 34 0
      src/main/java/com/ydtech/modules/message/entity/SystemMessageVo.java
  41. 42 0
      src/main/java/com/ydtech/modules/message/entity/dto/SystemMessageDTO.java
  42. 22 0
      src/main/java/com/ydtech/modules/message/service/SystemMessageService.java
  43. 119 0
      src/main/java/com/ydtech/modules/message/service/impl/SystemMessageServiceImpl.java
  44. 25 0
      src/main/java/com/ydtech/modules/order/controller/QrCodeController.java
  45. 3 0
      src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java
  46. 93 90
      src/main/java/com/ydtech/modules/order/service/impl/InsOrderPayDateRecordServiceImpl.java
  47. 8 3
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  48. 7 4
      src/main/java/com/ydtech/modules/order/timer/UpdateOrderTimer.java
  49. 5 3
      src/main/java/com/ydtech/modules/ttqf/service/impl/TtqfServiceImpl.java
  50. 6 4
      src/main/resources/application-pre.yml
  51. 4 1
      src/main/resources/application-prod.yml
  52. 4 0
      src/main/resources/application-test.yml
  53. 21 0
      src/main/resources/mapper/modules/admin/SysPartnerAccountMapper.xml
  54. 39 0
      src/main/resources/mapper/modules/console/ProfitAnalysisMapper.xml
  55. 7 1
      src/main/resources/mapper/modules/console/WithdrawalTaskMapper.xml
  56. 29 6
      src/main/resources/mapper/modules/largescreen/AgreementDataMapper.xml
  57. 25 0
      src/main/resources/mapper/modules/message/SystemMessageMapper.xml
  58. 26 7
      src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml
  59. 26 0
      src/main/resources/mapper/modules/userRole/SysUserRoleMapper.xml

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

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

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

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

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

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

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

+ 41 - 35
src/main/java/com/ydtech/modules/admin/service/impl/DeptBalanceServiceImpl.java

@@ -98,42 +98,40 @@ 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());
+
+                    SysPartnerAccount sysPartnerAccount =sysPartnerAccountMapper.getByDeptBalanceDto(itemLeader);
+                    if (sysPartnerAccount != null) {
+                        BigDecimal sumPremium = sysPartnerAccount.getSumPremium();
+                        BigDecimal extractFee = sysPartnerAccount.getExtractFee();
+                        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);
                 }
             }
@@ -345,10 +343,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());
@@ -360,7 +367,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);

+ 58 - 0
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
@@ -380,6 +397,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);
+    }
 }
 
 

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

+ 3 - 0
src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java

@@ -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++) {

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

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

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

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

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

@@ -603,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();

+ 93 - 90
src/main/java/com/ydtech/modules/order/service/impl/InsOrderPayDateRecordServiceImpl.java

@@ -37,8 +37,8 @@ import java.util.stream.Collectors;
 public class InsOrderPayDateRecordServiceImpl extends ServiceImpl<InsOrderPayDateRecordMapper, InsOrderPayDateRecord>
         implements InsOrderPayDateRecordService {
 
-     @Autowired
-     private InsOrderPdfUrlService  insOrderPdfUrlService;
+    @Autowired
+    private InsOrderPdfUrlService insOrderPdfUrlService;
 
     @Autowired
     private InsAreaCompanyService insAreaCompanyService;
@@ -53,7 +53,7 @@ public class InsOrderPayDateRecordServiceImpl extends ServiceImpl<InsOrderPayDat
     private String apiUrl;
 
     @Autowired
-    private InsOrderReadPdfService  insOrderReadPdfService;
+    private InsOrderReadPdfService insOrderReadPdfService;
 
     @Autowired
     private InsOrdersTrackService insOrdersTrackService;
@@ -61,114 +61,116 @@ public class InsOrderPayDateRecordServiceImpl extends ServiceImpl<InsOrderPayDat
 
     @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{
+            } 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(), "admin", 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);
-             log.info("更新的订单表为"+subOrder.toString()+new Date().toString());
+            insAreaCompanyService.updateById(subOrder);
+            log.info("更新的订单表为" + subOrder.toString() + new Date().toString());
             //判斷又沒有結算表如果有更新  add  by hxl  2024-12-30
-            if(subOrder.getSigningTime()!=null){
+            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){
+                if (insPlyIncome != null && insPlyIncome.size() > 0) {
                     for (InsPlyIncome plyIncome : insPlyIncome) {
                         plyIncome.setSignDate(subOrder.getSigningTime());
                         insPlyIncomeService.updateById(plyIncome);
-                        log.info("更新的结算表为"+plyIncome.toString()+new Date().toString());
+                        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) {
@@ -178,58 +180,59 @@ 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){
-
-               }
-           }
-       }
+    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: 自动更新签单表的日期
+     * @version
+     * @author: hxl
+     * @Date: 2024/12/30 10:03
+     * @Description: 自动更新签单表的日期
      */
     @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){
+        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){
+                if (insPlyIncome.getSignDate() == null) {
+                    try {
+                        updateOrderDate(insPlyIncome.getOrderno());
+                    } catch (Exception e) {
 
                     }
                 }
                 //更新時間
-                InsPlyIncome  ply = insPlyIncomeService.getById(insPlyIncome.getId());
-                if(ply!=null){
+                InsPlyIncome ply = insPlyIncomeService.getById(insPlyIncome.getId());
+                if (ply != null) {
                     InsAreaCompany iac = insAreaCompanyService.getById(insPlyIncome.getOrderno());
-                    if(iac.getSigningTime()!=null){
+                    if (iac.getSigningTime() != null) {
                         ply.setSignDate(iac.getSigningTime());
                         newList.add(ply);
                     }
                 }
             }
             insPlyIncomeService.saveOrUpdateBatch(newList);
-            log.info("更新的结算表为"+newList.toString()+new Date().toString());
+            log.info("更新的结算表为" + newList.toString() + new Date().toString());
         }
     }
 }

+ 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())) {

+ 7 - 4
src/main/java/com/ydtech/modules/order/timer/UpdateOrderTimer.java

@@ -1,5 +1,6 @@
 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;
@@ -35,8 +36,9 @@ public class UpdateOrderTimer {
      *  @Date: 2024/12/27 17:26
      *  @Description:  每10分钟执行下更新订单时间
      */
-    @Async
-    @Scheduled(cron = "0 0/30 * * * ?")
+//    @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";
@@ -88,8 +90,9 @@ public class UpdateOrderTimer {
       *  @Date: 2024/12/30 9:59
       *  @Description:  自动更新结算表中签单日期为空的数据
       */
-    @Async
-    @Scheduled(cron = "0 0/30 * * * ?")
+//    @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";

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

+ 6 - 4
src/main/resources/application-pre.yml

@@ -246,8 +246,7 @@ wechat:
   # 微信客服
   customer:
     corp-id: wwfe67d19509d43ec5
-#    secret: lbn1DU7VhqK3dG0XDciPDXf_AdSryne84nvRhtSEGLc
-    secret: 5M_5mGONe-t4xCPlwPU-EJt53GiWaUjtbJjY5CR-dgc
+    secret: lbn1DU7VhqK3dG0XDciPDXf_AdSryne84nvRhtSEGLc
     token: btgwGK2r
     encoding-aes-key: eevs11QeInJYRysGYnC8gK68F4CGsedM1Dn1X79cPCs
   open:
@@ -434,7 +433,7 @@ xxl:
       # 执行器注册 [选填]:优先使用该配置作为注册地址
       address: ""
       # 执行器IP [选填]:默认为空表示自动获取IP
-      ip: "172.24.144.220"
+      ip: ""
       # 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999
       port: 0
       # 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
@@ -486,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

+ 4 - 1
src/main/resources/application-prod.yml

@@ -439,7 +439,7 @@ xxl:
       # 执行器注册 [选填]:优先使用该配置作为注册地址
       address: ""
       # 执行器IP [选填]:默认为空表示自动获取IP
-      ip: "172.24.144.220"
+      ip: ""
       # 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999
       port: 0
       # 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
@@ -492,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

+ 4 - 0
src/main/resources/application-test.yml

@@ -569,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

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

+ 39 - 0
src/main/resources/mapper/modules/console/ProfitAnalysisMapper.xml

@@ -319,4 +319,43 @@
 
     </select>
 
+
+    <select id="receivableExcel" resultType="com.ydtech.modules.admin.model.dto.ReceivableExcel">
+        SELECT
+        *
+        FROM
+        ins_ply_income a
+        <where>
+            <if test="vo.year !=null  and  vo.year !=''">
+                and DATE_FORMAT( a.signdate, '%Y') =#{vo.year}
+            </if>
+        </where>
+    </select>
+
+
+    <select id="payAmountExcel" resultType="com.ydtech.modules.admin.model.dto.PayAmountExcel">
+        SELECT
+        a.bank_number as "bankNumber",
+        a.amount as "amount",
+        a.user_id as "userId",
+        a.create_time as "createTime",
+        a.auditing_user_id as "auditingUserId",
+        a.account_name as "accountName",
+        a.auditing_time as "auditingTime",
+        CASE WHEN a.auditing_status='3' THEN "审核通过" ELSE "未审核通过" END   as "auditingStatus",
+        su.name as "userName",
+        su.name as "auditingUserName"
+        FROM
+        sys_amount_auditing a
+        LEFT JOIN sys_user_account_history b ON a.id = b.auditiing_id
+        LEFT JOIN sys_user su ON su.id = a.user_id
+        LEFT JOIN sys_user su1 ON su1.id = a.auditing_user_id
+        <where>
+            a.auditing_status = '3'
+            <if test="vo.year !=null  and  vo.year !=''">
+                and DATE_FORMAT( a.auditing_time, '%Y') =#{vo.year}
+            </if>
+        </where>
+    </select>
+
 </mapper>

+ 7 - 1
src/main/resources/mapper/modules/console/WithdrawalTaskMapper.xml

@@ -43,6 +43,8 @@
                  left join sys_user_bank_card bc on bc.bank_number =a.bank_number and bc.user_id =a.user_id
                  left join sys_user su2 on su2.id = a.auditing_user_id
         <where>
+            and a.auditing_status in ('3','2')
+            and b.id is  not  null
             <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
                 AND a.create_time BETWEEN #{vo.beginDate} AND #{vo.endDate}
             </if>
@@ -53,7 +55,7 @@
     <select id="countWithdrawal" resultType="java.util.HashMap">
         select
               IFNULL(sum(a.amount),0) as "allWithdrawalAmount",
-              IFNULL(count(a.id),0) as "allWithdrawalNumber",
+              IFNULL(count(CASE WHEN a.auditing_status = 2 THEN  1  END),0)  +  IFNULL(count(CASE WHEN a.auditing_status = 3 THEN  1  END),0) as "allWithdrawalNumber",
               IFNULL(sum( CASE WHEN a.auditing_status = 2 THEN  IFNULL(a.amount,0)  END ),0)  AS notWithdrawalAmount,
               IFNULL(sum( CASE WHEN a.auditing_status = 3 THEN  IFNULL(a.amount,0)  END ),0)  AS withdrawalAmount,
               IFNULL(count(CASE WHEN a.auditing_status = 2 THEN  1  END),0) as "notAllWithdrawalNumber",
@@ -61,6 +63,10 @@
               IFNULL(sum( CASE WHEN a.auditing_status = 4 THEN  IFNULL(a.amount,0)  END ),0)  AS "failedWithdrawalAmount",
               IFNULL(count(CASE WHEN a.auditing_status = 4 THEN  1  END),0) as "failedWithdrawalNumber"
         from sys_amount_auditing a
+        LEFT JOIN sys_user su ON su.id = a.user_id
+        LEFT JOIN sys_dept sd ON sd.id = su.dept_id
+        LEFT JOIN sys_user_bank_card bc ON bc.bank_number = a.bank_number
+        AND bc.user_id = a.user_id
         <where>
             <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
                 AND a.create_time BETWEEN #{vo.beginDate} AND #{vo.endDate}

+ 29 - 6
src/main/resources/mapper/modules/largescreen/AgreementDataMapper.xml

@@ -10,7 +10,7 @@
         COALESCE(SUM(jqpremium), 0) AS jqPremium,
         COALESCE(SUM(sypremium), 0) AS syPremium,
         COALESCE(SUM(taxamount), 0) AS taxPremium,
-        COALESCE(SUM(jqpremium) + SUM(sypremium), 0) AS sumPremium,
+        COALESCE(SUM(jqpremium) + SUM(sypremium)  + SUM(jypremium), 0) AS sumPremium,
         COALESCE(COUNT(iac.id), 0) as sumOrderNum
         FROM
         ptl_agreement pa
@@ -23,6 +23,11 @@
         <if test="startDate != null and startDate != ''">
             and iac.createtime BETWEEN #{startDate} and #{endDate}
         </if>
+
+        <if test="signStartDate != null and signStartDate != ''  and signEndDate !=null and signEndDate !=''">
+            and iac.signing_time BETWEEN #{signStartDate} and #{signEndDate}
+        </if>
+
         GROUP BY
         pa.insurance_company_id, pa.insurance_company
         order by
@@ -44,10 +49,11 @@
         COALESCE(SUM(jqpremium), 0) AS jqPremium,
         COALESCE(SUM(sypremium), 0) AS syPremium,
         COALESCE(SUM(taxamount), 0) AS taxPremium,
-        COALESCE(SUM(jqpremium) + SUM(sypremium), 0) AS sumPremium,
-        COALESCE(COUNT(iac.id), 0) as sumOrderNum
+        COALESCE(SUM(jqpremium) + SUM(sypremium) + SUM(jypremium), 0) AS sumPremium,
+        COALESCE(COUNT(io.orderno), 0) as sumOrderNum
         FROM
         ins_area_company iac
+        left join ins_orders io  on io.orderno  =  iac.orderno
         WHERE
         1=1
         <if test="orderStatus != null and orderStatus != ''">
@@ -56,6 +62,11 @@
         <if test="startDate != null and startDate != ''">
             and iac.createtime BETWEEN #{startDate} and #{endDate}
         </if>
+
+        <if test="signStartDate != null and signStartDate != ''  and signEndDate !=null and signEndDate !=''">
+            and iac.signing_time BETWEEN #{signStartDate} and #{signEndDate}
+        </if>
+
         <if test="companyId != null and companyId != ''">
             and iac.company_id = #{companyId}
         </if>
@@ -87,6 +98,10 @@
         <if test="startDate != null and startDate != ''">
             and iac.createtime BETWEEN #{startDate} and #{endDate}
         </if>
+
+        <if test="signStartDate != null and signStartDate != ''  and signEndDate !=null and signEndDate !=''">
+            and iac.signing_time BETWEEN #{signStartDate} and #{signEndDate}
+        </if>
         AND
         sd.id != 9991401
         group by
@@ -98,15 +113,23 @@
 
     <select id="getOrderNumber" parameterType="com.ydtech.modules.largescreen.model.query.DataQuery"
             resultType="Integer">
+        select count(a.orderno) from (
         SELECT
-        count( orderno )
+        io.orderno
         FROM
-        ins_orders
+        ins_orders io
+        left join ins_area_company iac on iac.orderno =io.orderno
         WHERE
         1=1
         <if test="startDate != null and startDate != ''">
-            and createtime BETWEEN #{startDate} and #{endDate}
+            and io.createtime BETWEEN #{startDate} and #{endDate}
+        </if>
+
+        <if test="signStartDate != null and signStartDate != ''  and signEndDate !=null and signEndDate !=''">
+            and iac.signing_time BETWEEN #{signStartDate} and #{signEndDate}
         </if>
+        group by io.orderno
+        ) a
     </select>
 
 

+ 25 - 0
src/main/resources/mapper/modules/message/SystemMessageMapper.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.message.dao.SystemMessageMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.message.entity.SystemMessage">
+        <id property="id" column="id"/>
+        <result property="classify" column="classify"/>
+        <result property="type" column="type"/>
+        <result property="title" column="title"/>
+        <result property="content" column="content"/>
+        <result property="jump" column="jump"/>
+        <result property="jumpUrl" column="jump_url"/>
+        <result property="receiverId" column="receiver_id"/>
+        <result property="senderId" column="sender_id"/>
+        <result property="state" column="state"/>
+        <result property="highLight" column="high_light"/>
+        <result property="sendTime" column="send_time"/>
+        <result property="createTime" column="create_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateBy" column="update_by"/>
+    </resultMap>
+
+
+</mapper>

+ 26 - 7
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -2307,8 +2307,12 @@
         <if test="vo.parterCompanyId  != null  and  vo.parterCompanyId!='' ">
             and agree.partner_companies_id = #{vo.parterCompanyId}
         </if>
-        <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
-            AND   DATE_FORMAT( iac.signing_time, '%Y-%m-%d')   BETWEEN DATE_FORMAT( #{vo.createtimeStart}, '%Y-%m-%d')  AND DATE_FORMAT( #{vo.createtimeEnd}, '%Y-%m-%d')
+
+        <if test="vo.signingTimeStart != null and vo.signingTimeStart!='' and vo.signingTimeEnd != null and vo.signingTimeEnd != ''">
+            AND DATE_FORMAT(iac.signing_time, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.signingTimeStart}, '%Y-%m-%d') AND DATE_FORMAT(#{vo.signingTimeEnd}, '%Y-%m-%d')
+        </if>
+        <if test="vo.enterTimeStart != null and vo.enterTimeStart!='' and vo.enterTimeEnd != null and vo.enterTimeEnd != ''">
+            AND DATE_FORMAT(iac.createtime, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.enterTimeStart}, '%Y-%m-%d') AND DATE_FORMAT(#{vo.enterTimeEnd}, '%Y-%m-%d')
         </if>
         <if test="vo.provinceId != null and vo.provinceId != '' and  vo.cityId == null and vo.countyId == null  and vo.houseId == null ">
             and io.deptid like concat('%',#{vo.provinceId},'%')
@@ -2407,6 +2411,14 @@
         <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
             AND   DATE_FORMAT( iac.signing_time, '%Y-%m-%d')   BETWEEN DATE_FORMAT( #{vo.createtimeStart}, '%Y-%m-%d')  AND DATE_FORMAT( #{vo.createtimeEnd}, '%Y-%m-%d')
         </if>
+
+        <if test="vo.signingTimeStart != null and vo.signingTimeStart!='' and vo.signingTimeEnd != null and vo.signingTimeEnd != ''">
+            AND DATE_FORMAT(iac.signing_time, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.signingTimeStart}, '%Y-%m-%d') AND DATE_FORMAT(#{vo.signingTimeEnd}, '%Y-%m-%d')
+        </if>
+        <if test="vo.enterTimeStart != null and vo.enterTimeStart!='' and vo.enterTimeEnd != null and vo.enterTimeEnd != ''">
+            AND DATE_FORMAT(iac.createtime, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.enterTimeStart}, '%Y-%m-%d') AND DATE_FORMAT(#{vo.enterTimeEnd}, '%Y-%m-%d')
+        </if>
+
         <if test="vo.provinceId != null and vo.provinceId != '' and  vo.cityId == null and vo.countyId == null  and vo.houseId == null ">
             and io.deptid like concat('%',#{vo.provinceId},'%')
         </if>
@@ -2471,8 +2483,11 @@
         <if test="vo.parterCompanyId  != null  and  vo.parterCompanyId!='' ">
             and agree.partner_companies_id = #{vo.parterCompanyId}
         </if>
-        <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
-            AND   DATE_FORMAT( iac.signing_time, '%Y-%m-%d')   BETWEEN DATE_FORMAT( #{vo.createtimeStart}, '%Y-%m-%d')  AND DATE_FORMAT( #{vo.createtimeEnd}, '%Y-%m-%d')
+        <if test="vo.signingTimeStart != null and vo.signingTimeStart!='' and vo.signingTimeEnd != null and vo.signingTimeEnd != ''">
+            AND DATE_FORMAT(iac.signing_time, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.signingTimeStart}, '%Y-%m-%d') AND DATE_FORMAT(#{vo.signingTimeEnd}, '%Y-%m-%d')
+        </if>
+        <if test="vo.enterTimeStart != null and vo.enterTimeStart!='' and vo.enterTimeEnd != null and vo.enterTimeEnd != ''">
+            AND DATE_FORMAT(iac.createtime, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.enterTimeStart}, '%Y-%m-%d') AND DATE_FORMAT(#{vo.enterTimeEnd}, '%Y-%m-%d')
         </if>
         <if test="vo.provinceId != null and vo.provinceId != '' and  vo.cityId == null and vo.countyId == null  and vo.houseId == null ">
             and io.deptid like concat('%',#{vo.provinceId},'%')
@@ -2541,8 +2556,11 @@
         <if test="vo.parterCompanyId  != null  and  vo.parterCompanyId!='' ">
             and agree.partner_companies_id = #{vo.parterCompanyId}
         </if>
-        <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
-            AND   DATE_FORMAT( iac.signing_time, '%Y-%m-%d')   BETWEEN DATE_FORMAT( #{vo.createtimeStart}, '%Y-%m-%d')  AND DATE_FORMAT( #{vo.createtimeEnd}, '%Y-%m-%d')
+        <if test="vo.signingTimeStart != null and vo.signingTimeStart!='' and vo.signingTimeEnd != null and vo.signingTimeEnd != ''">
+            AND DATE_FORMAT(iac.signing_time, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.signingTimeStart}, '%Y-%m-%d') AND DATE_FORMAT(#{vo.signingTimeEnd}, '%Y-%m-%d')
+        </if>
+        <if test="vo.enterTimeStart != null and vo.enterTimeStart!='' and vo.enterTimeEnd != null and vo.enterTimeEnd != ''">
+            AND DATE_FORMAT(iac.createtime, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.enterTimeStart}, '%Y-%m-%d') AND DATE_FORMAT(#{vo.enterTimeEnd}, '%Y-%m-%d')
         </if>
         <if test="vo.provinceId != null and vo.provinceId != ''">
             and io.deptid like "${vo.provinceId}%"
@@ -3275,7 +3293,8 @@
         ifa.audittime,
         ifa.audituser as auditname,
         ifa.rejectinfo,
-        "1" as orderExternalStatus
+        "1" as orderExternalStatus,
+        iac.operator_name as recorder
         FROM
         ins_fee_audit ifa
         LEFT JOIN

+ 26 - 0
src/main/resources/mapper/modules/userRole/SysUserRoleMapper.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.admin.dao.SysUserRoleMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.SysUserRole">
+        <id property="id" column="id" />
+        <result property="userId" column="user_id" />
+        <result property="roleId" column="role_id"/>
+        <result property="createBy" column="create_by" />
+        <result property="createTime" column="create_time"/>
+        <result property="lastUpdateBy" column="last_update_by"/>
+        <result property="lastUpdateTime" column="last_update_time"/>
+    </resultMap>
+
+    <select id="selectBymenuId" resultMap="BaseResultMap">
+        SELECT
+            sur.user_id,
+            sur.role_id
+        FROM
+            sys_user_role sur
+                LEFT JOIN sys_role_menu srm ON sur.role_id = srm.role_id
+        WHERE
+            srm.menu_id = #{menuId}
+    </select>
+
+</mapper>