Browse Source

重构项目

liukaixiong 4 years ago
parent
commit
6e928f83e7
44 changed files with 1471 additions and 1574 deletions
  1. 12 2
      README.md
  2. 25 13
      env/sql/mysql.sql
  3. 64 12
      jay-monitor-data-client/src/main/java/com/jay/monitor/data/client/MonitorDataClient.java
  4. 0 8
      jay-monitor-data-client/src/main/java/com/jay/monitor/data/client/config/ClientMonitorAutoConfiguration.java
  5. 25 0
      jay-monitor-data-client/src/main/java/com/jay/monitor/data/client/config/KafkaMonitorAutoConfiguration.java
  6. 15 0
      jay-monitor-data-client/src/test/java/com/jay/monitor/data/client/MonitorSendProducerTest.java
  7. 20 0
      jay-monitor-data-core/src/main/java/com/jay/monitor/data/core/model/serializable/URLDataDTO.java
  8. 15 0
      jay-monitor-data-server/pom.xml
  9. 2 0
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/config/props/MonitorProperties.java
  10. 46 0
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/controllers/ApiController.java
  11. 20 3
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/controllers/IndexController.java
  12. 0 32
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/daos/JayMonitorMqLogMapper.java
  13. 7 0
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/daos/JayMonitorMqMapperExt.java
  14. 4 2
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/daos/JayMonitorUrlMapper.java
  15. 7 0
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/daos/JayMonitorUrlMapperExt.java
  16. 19 0
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/daos/PartitionOperation.java
  17. 96 76
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/ext/mybatis/interceptor/SplitTableInterceptor.java
  18. 15 2
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/factory/generate/DayIdGenerate.java
  19. 26 13
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorMq.java
  20. 140 87
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorMqExample.java
  21. 0 105
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorMqLog.java
  22. 0 689
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorMqLogExample.java
  23. 48 24
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorUrl.java
  24. 249 100
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorUrlExample.java
  25. 14 22
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/process/MQUserProcess.java
  26. 2 1
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/process/URLUserProcess.java
  27. 176 2
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/store/AbstractStoreProcess.java
  28. 10 0
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/store/StoreDataManager.java
  29. 1 1
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/store/mysql/MysqlDDLProcess.java
  30. 72 27
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/store/mysql/MysqlMQStoreProcess.java
  31. 56 34
      jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/store/mysql/MysqlUrlStoreProcess.java
  32. 1 1
      jay-monitor-data-server/src/main/resources/application-dev.yml
  33. 3 0
      jay-monitor-data-server/src/main/resources/application-test.yml
  34. 6 1
      jay-monitor-data-server/src/main/resources/application.yml
  35. 3 4
      jay-monitor-data-server/src/main/resources/logback.xml
  36. 0 237
      jay-monitor-data-server/src/main/resources/mybatis/mapper/JayMonitorMqLogMapper.xml
  37. 40 25
      jay-monitor-data-server/src/main/resources/mybatis/mapper/JayMonitorMqMapper.xml
  38. 41 0
      jay-monitor-data-server/src/main/resources/mybatis/mapper/JayMonitorMqMapperExt.xml
  39. 60 43
      jay-monitor-data-server/src/main/resources/mybatis/mapper/JayMonitorUrlMapper.xml
  40. 34 0
      jay-monitor-data-server/src/main/resources/mybatis/mapper/JayMonitorUrlMapperExt.xml
  41. 44 0
      jay-monitor-data-server/src/test/java/com/jay/monitor/data/server/daos/BatchJayMonitorMqMapperTest.java
  42. 40 0
      jay-monitor-data-server/src/test/java/com/jay/monitor/data/server/daos/JayMonitorMqLogMapperExtTest.java
  43. 13 2
      jay-monitor-data-server/src/test/java/com/jay/monitor/data/server/model/TestDataRequest.java
  44. 0 6
      jay-monitor-data-server/src/test/resources/application.yml

+ 12 - 2
README.md

@@ -62,8 +62,18 @@ elab_common.longConvertDateTime(res.created)
 
 
 
-
-
+Mysql 注意事项:
+ 
+ You can change this value on the server by setting the max_allowed_packet' variable.
+1. 配置方面希望加大`max_allowed_packet`参数,由于SQL是批量执行的,可以会比较大。
+```mysql
+[mysqld]
+max_allowed_packet = 50M # 也可以继续调大点
+```
+查看配置:
+```sql
+show variables like '%max_allowed_pack%';
+```
 
 
 

+ 25 - 13
env/sql/mysql.sql

@@ -39,22 +39,34 @@ CREATE TABLE `jay_monitor_url`  (
   INDEX `idx_request`(`application_name`, `request_time`) USING BTREE COMMENT '请求事件维度'
 );
 
-CREATE TABLE `jay_monitor_url_log`  (
-  `id` int NOT NULL AUTO_INCREMENT,
-  `monitor_id` int(11) NULL COMMENT '监控来源编号',
-  `log_id` varchar(50) NULL COMMENT '日志编号',
-  `monitor_type` varchar(50) NULL COMMENT '监控类型',
-  `log_text` text NULL COMMENT '日志文本',
-  `create_date` date NULL COMMENT '创建日期',
-  PRIMARY KEY (`id`),
-  INDEX `idx_monitor`(`monitor_id`, `monitor_type`) USING BTREE COMMENT '监控关系',
-  INDEX `idx_create_date`(`create_date`) USING BTREE COMMENT '创建时间索引,用来清空文本'
-);
+
 
 CREATE USER `jay_monitor`@`%` IDENTIFIED BY 'jayzhou';
 
 GRANT Alter, Create, Execute, Index, Insert, References, Select, Update ON `jay\_monitor`.* TO `jay_monitor`@`%`;
 
 
-ALTER TABLE `jay_monitor_mq`
-ADD COLUMN `source_time` datetime NULL DEFAULT NULL COMMENT '数据来源时间' AFTER `status`;
+ CREATE TABLE `jay_monitor_mq` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键名称',
+  `application_name` varchar(50) DEFAULT NULL COMMENT '应用名称',
+  `application_ip` varchar(20) DEFAULT NULL COMMENT '应用地址',
+  `mq_type` varchar(20) DEFAULT NULL COMMENT 'mq类型 ',
+  `invoke_type` varchar(10) DEFAULT NULL COMMENT '执行类型  producer/consumer',
+  `topic` varchar(50) DEFAULT NULL COMMENT '订阅主题',
+  `partition_name` varchar(100) DEFAULT NULL COMMENT '分区名称',
+  `msg_id` varchar(50) DEFAULT NULL COMMENT '消息编号',
+  `data_group_name` varchar(50) DEFAULT NULL COMMENT '应用监控组',
+  `data_group_key` varchar(50) DEFAULT NULL COMMENT '应用监控key',
+  `data_id` varchar(50) DEFAULT NULL COMMENT '数据编号',
+  `root_log_id` varchar(50) DEFAULT NULL COMMENT '根日志编号',
+  `parent_log_id` varchar(50) DEFAULT NULL COMMENT '上级日志编号',
+  `log_id` varchar(50) DEFAULT NULL COMMENT '日志编号',
+  `status` int(4) DEFAULT NULL COMMENT '状态1:正常消息 -1异常消息',
+  `source_time` datetime DEFAULT NULL COMMENT '数据来源时间',
+  `created_time` datetime DEFAULT NULL COMMENT '时间时间',
+  PRIMARY KEY (`id`),
+  KEY `idx_data_id` (`data_id`) USING BTREE COMMENT '根据数据的标识编号来确认数据',
+  KEY `idx_group_name_key` (`data_group_name`,`data_group_key`) USING BTREE COMMENT '根据组和key建立联合索引',
+  KEY `idx_application` (`topic`,`application_name`) USING BTREE COMMENT '根据topic和应用名称来定位索引',
+  KEY `idx_source_time` (`source_time`) USING BTREE COMMENT '根据数据的来源时间定位数据'
+) ENGINE=InnoDB AUTO_INCREMENT=118859 DEFAULT CHARSET=utf8mb4;

+ 64 - 12
jay-monitor-data-client/src/main/java/com/jay/monitor/data/client/MonitorDataClient.java

@@ -32,6 +32,11 @@ public class MonitorDataClient implements Runnable {
 
     private String addr;
 
+    /**
+     * 是否接收监控请求数据
+     */
+    private volatile boolean isEnabledReceive = true;
+
     private RpcClient client = new RpcClient();
 
     private ExecutorService executorService = Executors.newSingleThreadExecutor();
@@ -85,11 +90,33 @@ public class MonitorDataClient implements Runnable {
 
         if (data instanceof ApplicationData) {
             ApplicationData applicationData = (ApplicationData) data;
-            applicationData.setApplicationName(applicationName);
-            applicationData.setIp(ip);
+            if (applicationData.getApplicationName() == null) {
+                applicationData.setApplicationName(applicationName);
+            }
+            if (applicationData.getIp() == null) {
+                applicationData.setIp(ip);
+
+            }
         }
 
         client.oneway(getAddr(), data, invokeContext);
+        if (!isEnabledReceive()) {
+            enabledReceive();
+        }
+    }
+
+    public boolean isEnabledReceive() {
+        return isEnabledReceive;
+    }
+
+    private void enabledReceive() {
+        isEnabledReceive = true;
+        logger.info("开启接收监控数据标识");
+    }
+
+    private void offReceive() {
+        isEnabledReceive = false;
+        logger.warn("关闭接收监控数据标识");
     }
 
     /**
@@ -98,13 +125,15 @@ public class MonitorDataClient implements Runnable {
      * @param data
      */
     public void sendObjectMsg(BaseDTO data) {
-        boolean isAdd = queueData.offer(data);
-        if (!isAdd) {
-            counter.increment();
-            long current = counter.longValue();
-            if (current % 1000 == 0) {
-                logger.warn("容量不够,请及时扩容 queueSize:" + this.queueSize);
-                counter.reset();
+        if (isEnabledReceive()) {
+            boolean isAdd = queueData.offer(data);
+            if (!isAdd) {
+                counter.increment();
+                long current = counter.longValue();
+                if (current % 1000 == 0) {
+                    logger.warn("容量不够,请及时扩容 queueSize:" + this.queueSize);
+                    counter.reset();
+                }
             }
         }
     }
@@ -136,9 +165,7 @@ public class MonitorDataClient implements Runnable {
             } catch (Exception e) {
                 logger.warn("monitor consumer fail : " + e.getMessage());
                 // 当遇到连接问题的时候,尝试休眠等待.
-                if (e.getMessage().startsWith("Create connection failed.")) {
-                    sleep(30000);
-                }
+                connectionProblem(e);
             } finally {
                 sleep(5);
             }
@@ -146,6 +173,31 @@ public class MonitorDataClient implements Runnable {
         }
     }
 
+    /**
+     * 连接问题处理
+     *
+     * @param e
+     */
+    private void connectionProblem(Exception e) {
+        if (e.getMessage().startsWith("Create connection failed.")) {
+            // 如果连接不上了,先关闭接收数据入口,休眠一段时间
+            offReceive();
+            sleep(30000);
+            enabledReceive();
+        }
+        // 消费不过来了.
+        else if (e.getMessage().startsWith("Check connection failed for address")) {
+            // offReceive();
+            sleep(5000);
+            // enabledReceive();
+        }
+    }
+
+    /**
+     * 遇到一些不可控的情况,尝试休眠,让出CPU
+     *
+     * @param ms
+     */
     private void sleep(long ms) {
         try {
             // 需要注意的是,这里休眠只是为了不让CPU飙百,避免没有数据来的情况下。

+ 0 - 8
jay-monitor-data-client/src/main/java/com/jay/monitor/data/client/config/ClientMonitorAutoConfiguration.java

@@ -4,7 +4,6 @@ import com.alibaba.druid.pool.DruidDataSource;
 import com.jay.monitor.data.client.MonitorDataClient;
 import com.jay.monitor.data.client.MonitorSendProducer;
 import com.jay.monitor.data.client.config.props.MonitorProperties;
-import com.jay.monitor.data.client.ext.kafka.KafkaMonitorProducer;
 import com.jay.monitor.data.client.filter.DruidMonitorFilter;
 import com.jay.monitor.data.core.enums.MonitorDataConstants;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,7 +14,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
-import org.springframework.kafka.core.KafkaTemplate;
 
 import java.net.InetAddress;
 
@@ -51,10 +49,4 @@ public class ClientMonitorAutoConfiguration {
         return monitorFilter;
     }
 
-    @Bean
-    @ConditionalOnBean(value = {KafkaTemplate.class})
-    public KafkaMonitorProducer kafkaMonitorFilter() {
-        return new KafkaMonitorProducer();
-    }
-
 }

+ 25 - 0
jay-monitor-data-client/src/main/java/com/jay/monitor/data/client/config/KafkaMonitorAutoConfiguration.java

@@ -0,0 +1,25 @@
+package com.jay.monitor.data.client.config;
+
+import com.jay.monitor.data.client.ext.kafka.KafkaMonitorProducer;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.kafka.support.ProducerListener;
+
+/**
+ * @Module 配置类
+ * @Description 相关kafka配置
+ * @Author liukaixiong
+ * @Date 2020/11/19 14:17
+ */
+@Configuration
+public class KafkaMonitorAutoConfiguration {
+
+    @Bean
+    @ConditionalOnClass(value = {KafkaTemplate.class, ProducerListener.class})
+    public KafkaMonitorProducer kafkaMonitorProducer() {
+        return new KafkaMonitorProducer();
+    }
+
+}

File diff suppressed because it is too large
+ 15 - 0
jay-monitor-data-client/src/test/java/com/jay/monitor/data/client/MonitorSendProducerTest.java


+ 20 - 0
jay-monitor-data-core/src/main/java/com/jay/monitor/data/core/model/serializable/URLDataDTO.java

@@ -17,6 +17,26 @@ public class URLDataDTO extends CommonDataDTO {
 
     private String url;
 
+    private String userId;
+
+    private String clientIp;
+
+    public String getClientIp() {
+        return clientIp;
+    }
+
+    public void setClientIp(String clientIp) {
+        this.clientIp = clientIp;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
     public String getUrl() {
         return url;
     }

+ 15 - 0
jay-monitor-data-server/pom.xml

@@ -20,15 +20,24 @@
             <artifactId>jay-monitor-data-api</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>com.cat.file.message</groupId>
+            <artifactId>spring-cat-file</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
+
         <dependency>
             <groupId>com.jay.monitor.data</groupId>
             <artifactId>jay-monitor-data-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-logging</artifactId>
@@ -48,6 +57,7 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-thymeleaf</artifactId>
         </dependency>
+
         <dependency>
             <groupId>nz.net.ultraq.thymeleaf</groupId>
             <artifactId>thymeleaf-layout-dialect</artifactId>
@@ -58,15 +68,18 @@
             <groupId>com.github.xiaoymin</groupId>
             <artifactId>swagger-bootstrap-ui</artifactId>
         </dependency>
+
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-test</artifactId>
         </dependency>
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
         </dependency>
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-configuration-processor</artifactId>
@@ -94,10 +107,12 @@
             <artifactId>mysql-connector-java</artifactId>
             <version>5.1.47</version>
         </dependency>
+
         <dependency>
             <groupId>com.baomidou</groupId>
             <artifactId>mybatis-plus-boot-starter</artifactId>
         </dependency>
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-quartz</artifactId>

+ 2 - 0
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/config/props/MonitorProperties.java

@@ -22,6 +22,8 @@ public class MonitorProperties {
      */
     private Map<StoreType, StoreInfo> storeInfo = new HashMap<>();
 
+
+
     public Map<StoreType, StoreInfo> getStoreInfo() {
         return storeInfo;
     }

+ 46 - 0
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/controllers/ApiController.java

@@ -0,0 +1,46 @@
+package com.jay.monitor.data.server.controllers;
+
+import com.jay.monitor.data.core.enums.MsgTypeEnums;
+import com.jay.monitor.data.server.store.StoreDataManager;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * @author : liukx
+ * @describe :首页
+ * @time : 2019/3/1 - 16:31
+ */
+@Controller
+@RequestMapping(value = "/api")
+public class ApiController {
+    private SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
+
+    @Autowired
+    private StoreDataManager storeDataManager;
+
+    @RequestMapping(value = "/log/mq", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
+    @ResponseBody
+    public String searchMqIdLog(@RequestParam(value = "date", required = false) String date, @RequestParam("id") String id) throws Exception {
+        if (StringUtils.isEmpty(date)) {
+            date = sdf.format(new Date());
+        }
+        return storeDataManager.selectContentById(MsgTypeEnums.MQ, date, id);
+    }
+
+    @RequestMapping(value = "/log/url", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
+    @ResponseBody
+    public String searchUrlIdLog(@RequestParam(value = "date", required = false) String date, @RequestParam("id") String id) throws Exception {
+        if (StringUtils.isEmpty(date)) {
+            date = sdf.format(new Date());
+        }
+        return storeDataManager.selectContentById(MsgTypeEnums.URL, date, id);
+    }
+}

+ 20 - 3
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/controllers/IndexController.java

@@ -1,12 +1,13 @@
 package com.jay.monitor.data.server.controllers;
 
+import com.cat.file.message.MessageManagerProcess;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.*;
 
 /**
- * @describe :首页
  * @author : liukx
+ * @describe :首页
  * @time : 2019/3/1 - 16:31
  */
 @Controller
@@ -14,8 +15,24 @@ import org.springframework.web.bind.annotation.RequestMethod;
 public class IndexController {
     final static private String page = "/";
 
+    @Autowired
+    private MessageManagerProcess messageManagerProcess;
+
     @RequestMapping(value = "/index.html", method = RequestMethod.GET)
     public String index() throws Exception {
         return page + "index";
     }
+
+    @RequestMapping(value = "/getLogId", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
+    @ResponseBody
+    public String getLogId(@RequestParam("id") String logId) throws Exception {
+        return messageManagerProcess.getMessage(logId);
+    }
+
+    @RequestMapping(value = "/storeDisk", method = RequestMethod.GET)
+    @ResponseBody
+    public String storeDisk() throws Exception {
+        messageManagerProcess.closeAll();
+        return "OK";
+    }
 }

+ 0 - 32
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/daos/JayMonitorMqLogMapper.java

@@ -1,32 +0,0 @@
-package com.jay.monitor.data.server.daos;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.jay.monitor.data.server.models.entity.JayMonitorMqLog;
-import com.jay.monitor.data.server.models.entity.JayMonitorMqLogExample;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface JayMonitorMqLogMapper extends BaseMapper<JayMonitorMqLog> {
-    long countByExample(JayMonitorMqLogExample example);
-
-    int deleteByExample(JayMonitorMqLogExample example);
-
-    int deleteByPrimaryKey(Integer id);
-
-    int insert(JayMonitorMqLog record);
-
-    int insertSelective(JayMonitorMqLog record);
-
-    List<JayMonitorMqLog> selectByExample(JayMonitorMqLogExample example);
-
-    JayMonitorMqLog selectByPrimaryKey(Integer id);
-
-    int updateByExampleSelective(@Param("record") JayMonitorMqLog record, @Param("example") JayMonitorMqLogExample example);
-
-    int updateByExample(@Param("record") JayMonitorMqLog record, @Param("example") JayMonitorMqLogExample example);
-
-    int updateByPrimaryKeySelective(JayMonitorMqLog record);
-
-    int updateByPrimaryKey(JayMonitorMqLog record);
-}

+ 7 - 0
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/daos/JayMonitorMqMapperExt.java

@@ -0,0 +1,7 @@
+package com.jay.monitor.data.server.daos;
+
+import com.jay.monitor.data.server.models.entity.JayMonitorMq;
+
+public interface JayMonitorMqMapperExt extends PartitionOperation<JayMonitorMq> {
+
+}

+ 4 - 2
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/daos/JayMonitorUrlMapper.java

@@ -1,11 +1,13 @@
 package com.jay.monitor.data.server.daos;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.jay.monitor.data.server.models.entity.JayMonitorUrl;
 import com.jay.monitor.data.server.models.entity.JayMonitorUrlExample;
-import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
-public interface JayMonitorUrlMapper {
+import java.util.List;
+
+public interface JayMonitorUrlMapper extends BaseMapper<JayMonitorUrl> {
     long countByExample(JayMonitorUrlExample example);
 
     int deleteByExample(JayMonitorUrlExample example);

+ 7 - 0
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/daos/JayMonitorUrlMapperExt.java

@@ -0,0 +1,7 @@
+package com.jay.monitor.data.server.daos;
+
+import com.jay.monitor.data.server.models.entity.JayMonitorUrl;
+
+public interface JayMonitorUrlMapperExt extends PartitionOperation<JayMonitorUrl> {
+
+}

+ 19 - 0
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/daos/PartitionOperation.java

@@ -0,0 +1,19 @@
+package com.jay.monitor.data.server.daos;
+
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Module 分区操作
+ * @Description 分区操作定义
+ * @Author liukaixiong
+ * @Date 2020/11/19 15:46
+ */
+public interface PartitionOperation<T> {
+
+    public int batchPartitionInsert(@Param("date") String date, @Param("list") List<T> monitorList);
+
+    public T selectPartitionById(@Param("date") String date, @Param("id") Integer id);
+
+}

+ 96 - 76
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/ext/mybatis/interceptor/SplitTableInterceptor.java

@@ -1,76 +1,96 @@
-package com.jay.monitor.data.server.ext.mybatis.interceptor;
-
-import com.baomidou.mybatisplus.core.metadata.TableInfo;
-import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
-import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
-import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler;
-import com.jay.monitor.data.server.config.props.MonitorProperties;
-import com.jay.monitor.data.server.enums.DataSplitType;
-import com.jay.monitor.data.server.store.mysql.MysqlDDLProcess;
-import com.jay.monitor.data.server.utils.MonitorPropertiesUtil;
-import org.apache.ibatis.executor.statement.StatementHandler;
-import org.apache.ibatis.mapping.*;
-import org.apache.ibatis.plugin.Interceptor;
-import org.apache.ibatis.plugin.Intercepts;
-import org.apache.ibatis.plugin.Invocation;
-import org.apache.ibatis.plugin.Signature;
-import org.apache.ibatis.reflection.MetaObject;
-import org.apache.ibatis.reflection.SystemMetaObject;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.sql.Connection;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @Module 拦截器
- * @Description 负责重写表名称的数据,按照拆分的规则找到对应的表。
- * @Author liukaixiong
- * @Date 2020/11/5 10:55
- */
-@Component
-@Intercepts({@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})})
-public class SplitTableInterceptor extends AbstractSqlParserHandler implements Interceptor {
-
-    @Autowired
-    private MysqlDDLProcess ddlProcess;
-
-    @Autowired
-    private MonitorProperties monitorProperties;
-
-    @Override
-    public Object intercept(Invocation invocation) throws Throwable {
-
-        StatementHandler statementHandler = PluginUtils.realTarget(invocation.getTarget());
-        MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
-        // SQL 解析
-        this.sqlParser(metaObject);
-        MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
-
-        // 如果是查询方法
-        if (SqlCommandType.SELECT == mappedStatement.getSqlCommandType()
-                || StatementType.CALLABLE == mappedStatement.getStatementType()) {
-            return invocation.proceed();
-        }
-        // 针对定义了rowBounds,做为mapper接口方法的参数
-        BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql");
-        TableInfo tableInfo = TableInfoHelper.getTableInfo(boundSql.getParameterObject().getClass());
-        String tableName = tableInfo.getTableName();
-
-        // 从配置文件中获取对应的规则
-        Map<String, DataSplitType> tableRuleMap = MonitorPropertiesUtil.getMysqlTableRuleMap(monitorProperties);
-
-        if (tableRuleMap != null) {
-            DataSplitType dataSplitType = tableRuleMap.get(tableName);
-            String sql = boundSql.getSql();
-            String dataId = ddlProcess.getDataId(tableName,dataSplitType);
-            String newSql = sql.replace(tableName, dataId);
-            List<ParameterMapping> mappings = new ArrayList<>(boundSql.getParameterMappings());
-            metaObject.setValue("delegate.boundSql.sql", newSql);
-            metaObject.setValue("delegate.boundSql.parameterMappings", mappings);
-        }
-        return invocation.proceed();
-    }
-}
+//package com.jay.monitor.data.server.ext.mybatis.interceptor;
+//
+//import com.baomidou.mybatisplus.core.metadata.TableInfo;
+//import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
+//import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
+//import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler;
+//import com.jay.monitor.data.server.config.props.MonitorProperties;
+//import com.jay.monitor.data.server.enums.DataSplitType;
+//import com.jay.monitor.data.server.store.mysql.MysqlDDLProcess;
+//import com.jay.monitor.data.server.utils.MonitorPropertiesUtil;
+//import org.apache.ibatis.executor.statement.StatementHandler;
+//import org.apache.ibatis.mapping.*;
+//import org.apache.ibatis.plugin.Interceptor;
+//import org.apache.ibatis.plugin.Intercepts;
+//import org.apache.ibatis.plugin.Invocation;
+//import org.apache.ibatis.plugin.Signature;
+//import org.apache.ibatis.reflection.MetaObject;
+//import org.apache.ibatis.reflection.SystemMetaObject;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//import java.sql.Connection;
+//import java.util.ArrayList;
+//import java.util.List;
+//import java.util.Map;
+//
+///**
+// * @Module 拦截器
+// * @Description 负责重写表名称的数据,按照拆分的规则找到对应的表。
+// * @Author liukaixiong
+// * @Date 2020/11/5 10:55
+// */
+//@Component
+//@Intercepts({@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})})
+//public class SplitTableInterceptor extends AbstractSqlParserHandler implements Interceptor {
+//
+//    @Autowired
+//    private MysqlDDLProcess ddlProcess;
+//
+//    @Autowired
+//    private MonitorProperties monitorProperties;
+//
+//    @Override
+//    public Object intercept(Invocation invocation) throws Throwable {
+//
+//        StatementHandler statementHandler = PluginUtils.realTarget(invocation.getTarget());
+//        MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
+//        // SQL 解析
+//        this.sqlParser(metaObject);
+//        MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
+//
+//        // 如果是查询方法
+//        if (SqlCommandType.SELECT == mappedStatement.getSqlCommandType()
+//                || StatementType.CALLABLE == mappedStatement.getStatementType()) {
+//            return invocation.proceed();
+//        }
+//        // 针对定义了rowBounds,做为mapper接口方法的参数
+//        BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql");
+//        TableInfo tableInfo = TableInfoHelper.getTableInfo(getRequestClass(boundSql));
+//        if (tableInfo != null) {
+//            String tableName = tableInfo.getTableName();
+//            // 从配置文件中获取对应的规则
+//            Map<String, DataSplitType> tableRuleMap = MonitorPropertiesUtil.getMysqlTableRuleMap(monitorProperties);
+//
+//            if (tableRuleMap != null) {
+//                DataSplitType dataSplitType = tableRuleMap.get(tableName);
+//                if (dataSplitType != null) {
+//                    String sql = boundSql.getSql();
+//                    String dataId = ddlProcess.getDataId(tableName, dataSplitType);
+//                    String newSql = sql.replace(tableName, dataId);
+//                    List<ParameterMapping> mappings = new ArrayList<>(boundSql.getParameterMappings());
+//                    metaObject.setValue("delegate.boundSql.sql", newSql);
+//                    metaObject.setValue("delegate.boundSql.parameterMappings", mappings);
+//                }
+//            }
+//        }
+//        return invocation.proceed();
+//    }
+//
+//    private Class<?> getRequestClass(BoundSql boundSql) {
+//        Object parameterObject = boundSql.getParameterObject();
+//        if (parameterObject instanceof Map) {
+//            Map parameterMap = (Map) parameterObject;
+//            if (parameterMap.containsKey("collection")) {
+//                Object collection = parameterMap.get("collection");
+//                if (collection instanceof List) {
+//                    List list = (List) collection;
+//                    if (list != null && list.size() > 0) {
+//                        return list.get(0).getClass();
+//                    }
+//                }
+//            }
+//        }
+//        return boundSql.getParameterObject().getClass();
+//    }
+//}

+ 15 - 2
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/factory/generate/DayIdGenerate.java

@@ -2,6 +2,8 @@ package com.jay.monitor.data.server.factory.generate;
 
 import com.jay.monitor.data.server.enums.DataSplitType;
 import com.jay.monitor.data.server.factory.IdGenerateService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
 import java.text.SimpleDateFormat;
@@ -16,9 +18,16 @@ import java.util.function.Consumer;
  */
 @Component
 public class DayIdGenerate implements IdGenerateService {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+    /**
+     * 防止在做天分割的时候,获取当前的时间戳不对。
+     */
+    private final long delaySecond = 1800 * 1000L;
 
+    /**
+     * 一天的秒
+     */
     private final long DAY = 24 * 3600 * 1000L;
-
     /**
      * 算天的时候可能要考虑时区,得先加8小时
      */
@@ -53,7 +62,11 @@ public class DayIdGenerate implements IdGenerateService {
 
     private String resetCounter(long timestamp) {
         this.m_timestamp = timestamp;
-        this.defaultId = sdf.format(new Date(System.currentTimeMillis()));
+        // 这里是为了防止出现,获取当前时间戳 刚好卡在昨天末尾的那个点上.
+        long currentTimeMillis = System.currentTimeMillis();
+        long currentTimestamp = currentTimeMillis + delaySecond;
+        this.defaultId = sdf.format(new Date(currentTimestamp));
+        logger.info("重置Day的编号! 当前时间戳:" + currentTimeMillis + "\t 累加后的时间戳:" + currentTimestamp + " 默认编号:" + this.defaultId);
         return this.defaultId;
     }
 

+ 26 - 13
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorMq.java

@@ -67,6 +67,16 @@ public class JayMonitorMq implements Serializable {
      */
     private String dataId;
 
+    /**
+     * 根日志编号
+     */
+    private String rootLogId;
+
+    /**
+     * 上级日志编号
+     */
+    private String parentLogId;
+
     /**
      * 日志编号
      */
@@ -87,11 +97,6 @@ public class JayMonitorMq implements Serializable {
      */
     private Date createdTime;
 
-    /**
-     * 日期
-     */
-    private Date createdDay;
-
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -182,6 +187,22 @@ public class JayMonitorMq implements Serializable {
         this.dataId = dataId;
     }
 
+    public String getRootLogId() {
+        return rootLogId;
+    }
+
+    public void setRootLogId(String rootLogId) {
+        this.rootLogId = rootLogId;
+    }
+
+    public String getParentLogId() {
+        return parentLogId;
+    }
+
+    public void setParentLogId(String parentLogId) {
+        this.parentLogId = parentLogId;
+    }
+
     public String getLogId() {
         return logId;
     }
@@ -213,12 +234,4 @@ public class JayMonitorMq implements Serializable {
     public void setCreatedTime(Date createdTime) {
         this.createdTime = createdTime;
     }
-
-    public Date getCreatedDay() {
-        return createdDay;
-    }
-
-    public void setCreatedDay(Date createdDay) {
-        this.createdDay = createdDay;
-    }
 }

+ 140 - 87
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorMqExample.java

@@ -2,7 +2,6 @@ package com.jay.monitor.data.server.models.entity;
 
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 
 public class JayMonitorMqExample {
@@ -106,32 +105,6 @@ public class JayMonitorMqExample {
             criteria.add(new Criterion(condition, value1, value2));
         }
 
-        protected void addCriterionForJDBCDate(String condition, Date value, String property) {
-            if (value == null) {
-                throw new RuntimeException("Value for " + property + " cannot be null");
-            }
-            addCriterion(condition, new java.sql.Date(value.getTime()), property);
-        }
-
-        protected void addCriterionForJDBCDate(String condition, List<Date> values, String property) {
-            if (values == null || values.size() == 0) {
-                throw new RuntimeException("Value list for " + property + " cannot be null or empty");
-            }
-            List<java.sql.Date> dateList = new ArrayList<>();
-            Iterator<Date> iter = values.iterator();
-            while (iter.hasNext()) {
-                dateList.add(new java.sql.Date(iter.next().getTime()));
-            }
-            addCriterion(condition, dateList, property);
-        }
-
-        protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) {
-            if (value1 == null || value2 == null) {
-                throw new RuntimeException("Between values for " + property + " cannot be null");
-            }
-            addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property);
-        }
-
         public Criteria andIdIsNull() {
             addCriterion("id is null");
             return (Criteria) this;
@@ -892,6 +865,146 @@ public class JayMonitorMqExample {
             return (Criteria) this;
         }
 
+        public Criteria andRootLogIdIsNull() {
+            addCriterion("root_log_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdIsNotNull() {
+            addCriterion("root_log_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdEqualTo(String value) {
+            addCriterion("root_log_id =", value, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdNotEqualTo(String value) {
+            addCriterion("root_log_id <>", value, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdGreaterThan(String value) {
+            addCriterion("root_log_id >", value, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdGreaterThanOrEqualTo(String value) {
+            addCriterion("root_log_id >=", value, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdLessThan(String value) {
+            addCriterion("root_log_id <", value, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdLessThanOrEqualTo(String value) {
+            addCriterion("root_log_id <=", value, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdLike(String value) {
+            addCriterion("root_log_id like", value, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdNotLike(String value) {
+            addCriterion("root_log_id not like", value, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdIn(List<String> values) {
+            addCriterion("root_log_id in", values, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdNotIn(List<String> values) {
+            addCriterion("root_log_id not in", values, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdBetween(String value1, String value2) {
+            addCriterion("root_log_id between", value1, value2, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRootLogIdNotBetween(String value1, String value2) {
+            addCriterion("root_log_id not between", value1, value2, "rootLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdIsNull() {
+            addCriterion("parent_log_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdIsNotNull() {
+            addCriterion("parent_log_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdEqualTo(String value) {
+            addCriterion("parent_log_id =", value, "parentLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdNotEqualTo(String value) {
+            addCriterion("parent_log_id <>", value, "parentLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdGreaterThan(String value) {
+            addCriterion("parent_log_id >", value, "parentLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdGreaterThanOrEqualTo(String value) {
+            addCriterion("parent_log_id >=", value, "parentLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdLessThan(String value) {
+            addCriterion("parent_log_id <", value, "parentLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdLessThanOrEqualTo(String value) {
+            addCriterion("parent_log_id <=", value, "parentLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdLike(String value) {
+            addCriterion("parent_log_id like", value, "parentLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdNotLike(String value) {
+            addCriterion("parent_log_id not like", value, "parentLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdIn(List<String> values) {
+            addCriterion("parent_log_id in", values, "parentLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdNotIn(List<String> values) {
+            addCriterion("parent_log_id not in", values, "parentLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdBetween(String value1, String value2) {
+            addCriterion("parent_log_id between", value1, value2, "parentLogId");
+            return (Criteria) this;
+        }
+
+        public Criteria andParentLogIdNotBetween(String value1, String value2) {
+            addCriterion("parent_log_id not between", value1, value2, "parentLogId");
+            return (Criteria) this;
+        }
+
         public Criteria andLogIdIsNull() {
             addCriterion("log_id is null");
             return (Criteria) this;
@@ -1141,66 +1254,6 @@ public class JayMonitorMqExample {
             addCriterion("created_time not between", value1, value2, "createdTime");
             return (Criteria) this;
         }
-
-        public Criteria andCreatedDayIsNull() {
-            addCriterion("created_day is null");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayIsNotNull() {
-            addCriterion("created_day is not null");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayEqualTo(Date value) {
-            addCriterionForJDBCDate("created_day =", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayNotEqualTo(Date value) {
-            addCriterionForJDBCDate("created_day <>", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayGreaterThan(Date value) {
-            addCriterionForJDBCDate("created_day >", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayGreaterThanOrEqualTo(Date value) {
-            addCriterionForJDBCDate("created_day >=", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayLessThan(Date value) {
-            addCriterionForJDBCDate("created_day <", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayLessThanOrEqualTo(Date value) {
-            addCriterionForJDBCDate("created_day <=", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayIn(List<Date> values) {
-            addCriterionForJDBCDate("created_day in", values, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayNotIn(List<Date> values) {
-            addCriterionForJDBCDate("created_day not in", values, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayBetween(Date value1, Date value2) {
-            addCriterionForJDBCDate("created_day between", value1, value2, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayNotBetween(Date value1, Date value2) {
-            addCriterionForJDBCDate("created_day not between", value1, value2, "createdDay");
-            return (Criteria) this;
-        }
     }
 
     /**

+ 0 - 105
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorMqLog.java

@@ -1,105 +0,0 @@
-package com.jay.monitor.data.server.models.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * jay_monitor_mq_log
- * @author 
- */
-public class JayMonitorMqLog implements Serializable {
-
-    @TableId(type = IdType.AUTO)
-    private Integer id;
-
-    /**
-     * 监控来源编号
-     */
-    private Integer monitorId;
-
-    /**
-     * 根日志编号
-     */
-    private String rootLogId;
-
-    /**
-     * 上级日志编号
-     */
-    private String parentLogId;
-
-    /**
-     * 日志编号
-     */
-    private String logId;
-
-    /**
-     * 日志文本
-     */
-    private String logText;
-
-    /**
-     * 创建日期
-     */
-    private Date createDate;
-
-    private static final long serialVersionUID = 1L;
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public Integer getMonitorId() {
-        return monitorId;
-    }
-
-    public void setMonitorId(Integer monitorId) {
-        this.monitorId = monitorId;
-    }
-
-    public String getRootLogId() {
-        return rootLogId;
-    }
-
-    public void setRootLogId(String rootLogId) {
-        this.rootLogId = rootLogId;
-    }
-
-    public String getParentLogId() {
-        return parentLogId;
-    }
-
-    public void setParentLogId(String parentLogId) {
-        this.parentLogId = parentLogId;
-    }
-
-    public String getLogId() {
-        return logId;
-    }
-
-    public void setLogId(String logId) {
-        this.logId = logId;
-    }
-
-    public String getLogText() {
-        return logText;
-    }
-
-    public void setLogText(String logText) {
-        this.logText = logText;
-    }
-
-    public Date getCreateDate() {
-        return createDate;
-    }
-
-    public void setCreateDate(Date createDate) {
-        this.createDate = createDate;
-    }
-}

+ 0 - 689
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorMqLogExample.java

@@ -1,689 +0,0 @@
-package com.jay.monitor.data.server.models.entity;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
-public class JayMonitorMqLogExample {
-    protected String orderByClause;
-
-    protected boolean distinct;
-
-    protected List<Criteria> oredCriteria;
-
-    public JayMonitorMqLogExample() {
-        oredCriteria = new ArrayList<>();
-    }
-
-    public void setOrderByClause(String orderByClause) {
-        this.orderByClause = orderByClause;
-    }
-
-    public String getOrderByClause() {
-        return orderByClause;
-    }
-
-    public void setDistinct(boolean distinct) {
-        this.distinct = distinct;
-    }
-
-    public boolean isDistinct() {
-        return distinct;
-    }
-
-    public List<Criteria> getOredCriteria() {
-        return oredCriteria;
-    }
-
-    public void or(Criteria criteria) {
-        oredCriteria.add(criteria);
-    }
-
-    public Criteria or() {
-        Criteria criteria = createCriteriaInternal();
-        oredCriteria.add(criteria);
-        return criteria;
-    }
-
-    public Criteria createCriteria() {
-        Criteria criteria = createCriteriaInternal();
-        if (oredCriteria.size() == 0) {
-            oredCriteria.add(criteria);
-        }
-        return criteria;
-    }
-
-    protected Criteria createCriteriaInternal() {
-        Criteria criteria = new Criteria();
-        return criteria;
-    }
-
-    public void clear() {
-        oredCriteria.clear();
-        orderByClause = null;
-        distinct = false;
-    }
-
-    protected abstract static class GeneratedCriteria {
-        protected List<Criterion> criteria;
-
-        protected GeneratedCriteria() {
-            super();
-            criteria = new ArrayList<>();
-        }
-
-        public boolean isValid() {
-            return criteria.size() > 0;
-        }
-
-        public List<Criterion> getAllCriteria() {
-            return criteria;
-        }
-
-        public List<Criterion> getCriteria() {
-            return criteria;
-        }
-
-        protected void addCriterion(String condition) {
-            if (condition == null) {
-                throw new RuntimeException("Value for condition cannot be null");
-            }
-            criteria.add(new Criterion(condition));
-        }
-
-        protected void addCriterion(String condition, Object value, String property) {
-            if (value == null) {
-                throw new RuntimeException("Value for " + property + " cannot be null");
-            }
-            criteria.add(new Criterion(condition, value));
-        }
-
-        protected void addCriterion(String condition, Object value1, Object value2, String property) {
-            if (value1 == null || value2 == null) {
-                throw new RuntimeException("Between values for " + property + " cannot be null");
-            }
-            criteria.add(new Criterion(condition, value1, value2));
-        }
-
-        protected void addCriterionForJDBCDate(String condition, Date value, String property) {
-            if (value == null) {
-                throw new RuntimeException("Value for " + property + " cannot be null");
-            }
-            addCriterion(condition, new java.sql.Date(value.getTime()), property);
-        }
-
-        protected void addCriterionForJDBCDate(String condition, List<Date> values, String property) {
-            if (values == null || values.size() == 0) {
-                throw new RuntimeException("Value list for " + property + " cannot be null or empty");
-            }
-            List<java.sql.Date> dateList = new ArrayList<>();
-            Iterator<Date> iter = values.iterator();
-            while (iter.hasNext()) {
-                dateList.add(new java.sql.Date(iter.next().getTime()));
-            }
-            addCriterion(condition, dateList, property);
-        }
-
-        protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) {
-            if (value1 == null || value2 == null) {
-                throw new RuntimeException("Between values for " + property + " cannot be null");
-            }
-            addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property);
-        }
-
-        public Criteria andIdIsNull() {
-            addCriterion("id is null");
-            return (Criteria) this;
-        }
-
-        public Criteria andIdIsNotNull() {
-            addCriterion("id is not null");
-            return (Criteria) this;
-        }
-
-        public Criteria andIdEqualTo(Integer value) {
-            addCriterion("id =", value, "id");
-            return (Criteria) this;
-        }
-
-        public Criteria andIdNotEqualTo(Integer value) {
-            addCriterion("id <>", value, "id");
-            return (Criteria) this;
-        }
-
-        public Criteria andIdGreaterThan(Integer value) {
-            addCriterion("id >", value, "id");
-            return (Criteria) this;
-        }
-
-        public Criteria andIdGreaterThanOrEqualTo(Integer value) {
-            addCriterion("id >=", value, "id");
-            return (Criteria) this;
-        }
-
-        public Criteria andIdLessThan(Integer value) {
-            addCriterion("id <", value, "id");
-            return (Criteria) this;
-        }
-
-        public Criteria andIdLessThanOrEqualTo(Integer value) {
-            addCriterion("id <=", value, "id");
-            return (Criteria) this;
-        }
-
-        public Criteria andIdIn(List<Integer> values) {
-            addCriterion("id in", values, "id");
-            return (Criteria) this;
-        }
-
-        public Criteria andIdNotIn(List<Integer> values) {
-            addCriterion("id not in", values, "id");
-            return (Criteria) this;
-        }
-
-        public Criteria andIdBetween(Integer value1, Integer value2) {
-            addCriterion("id between", value1, value2, "id");
-            return (Criteria) this;
-        }
-
-        public Criteria andIdNotBetween(Integer value1, Integer value2) {
-            addCriterion("id not between", value1, value2, "id");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdIsNull() {
-            addCriterion("monitor_id is null");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdIsNotNull() {
-            addCriterion("monitor_id is not null");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdEqualTo(Integer value) {
-            addCriterion("monitor_id =", value, "monitorId");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdNotEqualTo(Integer value) {
-            addCriterion("monitor_id <>", value, "monitorId");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdGreaterThan(Integer value) {
-            addCriterion("monitor_id >", value, "monitorId");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdGreaterThanOrEqualTo(Integer value) {
-            addCriterion("monitor_id >=", value, "monitorId");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdLessThan(Integer value) {
-            addCriterion("monitor_id <", value, "monitorId");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdLessThanOrEqualTo(Integer value) {
-            addCriterion("monitor_id <=", value, "monitorId");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdIn(List<Integer> values) {
-            addCriterion("monitor_id in", values, "monitorId");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdNotIn(List<Integer> values) {
-            addCriterion("monitor_id not in", values, "monitorId");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdBetween(Integer value1, Integer value2) {
-            addCriterion("monitor_id between", value1, value2, "monitorId");
-            return (Criteria) this;
-        }
-
-        public Criteria andMonitorIdNotBetween(Integer value1, Integer value2) {
-            addCriterion("monitor_id not between", value1, value2, "monitorId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdIsNull() {
-            addCriterion("root_log_id is null");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdIsNotNull() {
-            addCriterion("root_log_id is not null");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdEqualTo(String value) {
-            addCriterion("root_log_id =", value, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdNotEqualTo(String value) {
-            addCriterion("root_log_id <>", value, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdGreaterThan(String value) {
-            addCriterion("root_log_id >", value, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdGreaterThanOrEqualTo(String value) {
-            addCriterion("root_log_id >=", value, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdLessThan(String value) {
-            addCriterion("root_log_id <", value, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdLessThanOrEqualTo(String value) {
-            addCriterion("root_log_id <=", value, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdLike(String value) {
-            addCriterion("root_log_id like", value, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdNotLike(String value) {
-            addCriterion("root_log_id not like", value, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdIn(List<String> values) {
-            addCriterion("root_log_id in", values, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdNotIn(List<String> values) {
-            addCriterion("root_log_id not in", values, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdBetween(String value1, String value2) {
-            addCriterion("root_log_id between", value1, value2, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andRootLogIdNotBetween(String value1, String value2) {
-            addCriterion("root_log_id not between", value1, value2, "rootLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdIsNull() {
-            addCriterion("parent_log_id is null");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdIsNotNull() {
-            addCriterion("parent_log_id is not null");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdEqualTo(String value) {
-            addCriterion("parent_log_id =", value, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdNotEqualTo(String value) {
-            addCriterion("parent_log_id <>", value, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdGreaterThan(String value) {
-            addCriterion("parent_log_id >", value, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdGreaterThanOrEqualTo(String value) {
-            addCriterion("parent_log_id >=", value, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdLessThan(String value) {
-            addCriterion("parent_log_id <", value, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdLessThanOrEqualTo(String value) {
-            addCriterion("parent_log_id <=", value, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdLike(String value) {
-            addCriterion("parent_log_id like", value, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdNotLike(String value) {
-            addCriterion("parent_log_id not like", value, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdIn(List<String> values) {
-            addCriterion("parent_log_id in", values, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdNotIn(List<String> values) {
-            addCriterion("parent_log_id not in", values, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdBetween(String value1, String value2) {
-            addCriterion("parent_log_id between", value1, value2, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andParentLogIdNotBetween(String value1, String value2) {
-            addCriterion("parent_log_id not between", value1, value2, "parentLogId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdIsNull() {
-            addCriterion("log_id is null");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdIsNotNull() {
-            addCriterion("log_id is not null");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdEqualTo(String value) {
-            addCriterion("log_id =", value, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdNotEqualTo(String value) {
-            addCriterion("log_id <>", value, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdGreaterThan(String value) {
-            addCriterion("log_id >", value, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdGreaterThanOrEqualTo(String value) {
-            addCriterion("log_id >=", value, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdLessThan(String value) {
-            addCriterion("log_id <", value, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdLessThanOrEqualTo(String value) {
-            addCriterion("log_id <=", value, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdLike(String value) {
-            addCriterion("log_id like", value, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdNotLike(String value) {
-            addCriterion("log_id not like", value, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdIn(List<String> values) {
-            addCriterion("log_id in", values, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdNotIn(List<String> values) {
-            addCriterion("log_id not in", values, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdBetween(String value1, String value2) {
-            addCriterion("log_id between", value1, value2, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogIdNotBetween(String value1, String value2) {
-            addCriterion("log_id not between", value1, value2, "logId");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextIsNull() {
-            addCriterion("log_text is null");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextIsNotNull() {
-            addCriterion("log_text is not null");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextEqualTo(String value) {
-            addCriterion("log_text =", value, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextNotEqualTo(String value) {
-            addCriterion("log_text <>", value, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextGreaterThan(String value) {
-            addCriterion("log_text >", value, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextGreaterThanOrEqualTo(String value) {
-            addCriterion("log_text >=", value, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextLessThan(String value) {
-            addCriterion("log_text <", value, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextLessThanOrEqualTo(String value) {
-            addCriterion("log_text <=", value, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextLike(String value) {
-            addCriterion("log_text like", value, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextNotLike(String value) {
-            addCriterion("log_text not like", value, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextIn(List<String> values) {
-            addCriterion("log_text in", values, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextNotIn(List<String> values) {
-            addCriterion("log_text not in", values, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextBetween(String value1, String value2) {
-            addCriterion("log_text between", value1, value2, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andLogTextNotBetween(String value1, String value2) {
-            addCriterion("log_text not between", value1, value2, "logText");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateIsNull() {
-            addCriterion("create_date is null");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateIsNotNull() {
-            addCriterion("create_date is not null");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateEqualTo(Date value) {
-            addCriterionForJDBCDate("create_date =", value, "createDate");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateNotEqualTo(Date value) {
-            addCriterionForJDBCDate("create_date <>", value, "createDate");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateGreaterThan(Date value) {
-            addCriterionForJDBCDate("create_date >", value, "createDate");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateGreaterThanOrEqualTo(Date value) {
-            addCriterionForJDBCDate("create_date >=", value, "createDate");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateLessThan(Date value) {
-            addCriterionForJDBCDate("create_date <", value, "createDate");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateLessThanOrEqualTo(Date value) {
-            addCriterionForJDBCDate("create_date <=", value, "createDate");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateIn(List<Date> values) {
-            addCriterionForJDBCDate("create_date in", values, "createDate");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateNotIn(List<Date> values) {
-            addCriterionForJDBCDate("create_date not in", values, "createDate");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateBetween(Date value1, Date value2) {
-            addCriterionForJDBCDate("create_date between", value1, value2, "createDate");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreateDateNotBetween(Date value1, Date value2) {
-            addCriterionForJDBCDate("create_date not between", value1, value2, "createDate");
-            return (Criteria) this;
-        }
-    }
-
-    /**
-     */
-    public static class Criteria extends GeneratedCriteria {
-        protected Criteria() {
-            super();
-        }
-    }
-
-    public static class Criterion {
-        private String condition;
-
-        private Object value;
-
-        private Object secondValue;
-
-        private boolean noValue;
-
-        private boolean singleValue;
-
-        private boolean betweenValue;
-
-        private boolean listValue;
-
-        private String typeHandler;
-
-        public String getCondition() {
-            return condition;
-        }
-
-        public Object getValue() {
-            return value;
-        }
-
-        public Object getSecondValue() {
-            return secondValue;
-        }
-
-        public boolean isNoValue() {
-            return noValue;
-        }
-
-        public boolean isSingleValue() {
-            return singleValue;
-        }
-
-        public boolean isBetweenValue() {
-            return betweenValue;
-        }
-
-        public boolean isListValue() {
-            return listValue;
-        }
-
-        public String getTypeHandler() {
-            return typeHandler;
-        }
-
-        protected Criterion(String condition) {
-            super();
-            this.condition = condition;
-            this.typeHandler = null;
-            this.noValue = true;
-        }
-
-        protected Criterion(String condition, Object value, String typeHandler) {
-            super();
-            this.condition = condition;
-            this.value = value;
-            this.typeHandler = typeHandler;
-            if (value instanceof List<?>) {
-                this.listValue = true;
-            } else {
-                this.singleValue = true;
-            }
-        }
-
-        protected Criterion(String condition, Object value) {
-            this(condition, value, null);
-        }
-
-        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
-            super();
-            this.condition = condition;
-            this.value = value;
-            this.secondValue = secondValue;
-            this.typeHandler = typeHandler;
-            this.betweenValue = true;
-        }
-
-        protected Criterion(String condition, Object value, Object secondValue) {
-            this(condition, value, secondValue, null);
-        }
-    }
-}

+ 48 - 24
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorUrl.java

@@ -1,5 +1,9 @@
 package com.jay.monitor.data.server.models.entity;
 
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -11,6 +15,7 @@ public class JayMonitorUrl implements Serializable {
     /**
      * 主键名称
      */
+    @TableId(type = IdType.AUTO)
     private Integer id;
 
     /**
@@ -24,14 +29,19 @@ public class JayMonitorUrl implements Serializable {
     private String applicationIp;
 
     /**
-     * 应用监控类型
+     * 请求路径
      */
-    private String monitorType;
+    private String url;
 
     /**
-     * 请求路径
+     * 用户编号
      */
-    private String url;
+    private String userId;
+
+    /**
+     * 客户端ip
+     */
+    private String clientIp;
 
     /**
      * 应用监控组
@@ -49,24 +59,26 @@ public class JayMonitorUrl implements Serializable {
     private String dataId;
 
     /**
-     * 状态1:正常消息 -1异常消息
+     * 状态: 客户端返回的状态码
      */
     private Integer status;
 
+    /**
+     * 日志编号
+     */
+    private String logId;
+
     /**
      * 请求时长
      */
     private Integer requestTime;
 
     /**
-     * 时间时间
+     * 创建时间
      */
     private Date createdTime;
 
-    /**
-     * 日期
-     */
-    private Date createdDay;
+    private static final long serialVersionUID = 1L;
 
     public Integer getId() {
         return id;
@@ -92,14 +104,6 @@ public class JayMonitorUrl implements Serializable {
         this.applicationIp = applicationIp;
     }
 
-    public String getMonitorType() {
-        return monitorType;
-    }
-
-    public void setMonitorType(String monitorType) {
-        this.monitorType = monitorType;
-    }
-
     public String getUrl() {
         return url;
     }
@@ -108,6 +112,22 @@ public class JayMonitorUrl implements Serializable {
         this.url = url;
     }
 
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getClientIp() {
+        return clientIp;
+    }
+
+    public void setClientIp(String clientIp) {
+        this.clientIp = clientIp;
+    }
+
     public String getDataGroupName() {
         return dataGroupName;
     }
@@ -140,6 +160,14 @@ public class JayMonitorUrl implements Serializable {
         this.status = status;
     }
 
+    public String getLogId() {
+        return logId;
+    }
+
+    public void setLogId(String logId) {
+        this.logId = logId;
+    }
+
     public Integer getRequestTime() {
         return requestTime;
     }
@@ -156,11 +184,7 @@ public class JayMonitorUrl implements Serializable {
         this.createdTime = createdTime;
     }
 
-    public Date getCreatedDay() {
-        return createdDay;
-    }
-
-    public void setCreatedDay(Date createdDay) {
-        this.createdDay = createdDay;
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
     }
 }

+ 249 - 100
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorUrlExample.java

@@ -1,8 +1,7 @@
 package com.jay.monitor.data.server.models.entity;
 
-import java.time.LocalDate;
-import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 public class JayMonitorUrlExample {
@@ -306,73 +305,213 @@ public class JayMonitorUrlExample {
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeIsNull() {
-            addCriterion("monitor_type is null");
+        public Criteria andUrlIsNull() {
+            addCriterion("url is null");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeIsNotNull() {
-            addCriterion("monitor_type is not null");
+        public Criteria andUrlIsNotNull() {
+            addCriterion("url is not null");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeEqualTo(String value) {
-            addCriterion("monitor_type =", value, "monitorType");
+        public Criteria andUrlEqualTo(String value) {
+            addCriterion("url =", value, "url");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeNotEqualTo(String value) {
-            addCriterion("monitor_type <>", value, "monitorType");
+        public Criteria andUrlNotEqualTo(String value) {
+            addCriterion("url <>", value, "url");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeGreaterThan(String value) {
-            addCriterion("monitor_type >", value, "monitorType");
+        public Criteria andUrlGreaterThan(String value) {
+            addCriterion("url >", value, "url");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeGreaterThanOrEqualTo(String value) {
-            addCriterion("monitor_type >=", value, "monitorType");
+        public Criteria andUrlGreaterThanOrEqualTo(String value) {
+            addCriterion("url >=", value, "url");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeLessThan(String value) {
-            addCriterion("monitor_type <", value, "monitorType");
+        public Criteria andUrlLessThan(String value) {
+            addCriterion("url <", value, "url");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeLessThanOrEqualTo(String value) {
-            addCriterion("monitor_type <=", value, "monitorType");
+        public Criteria andUrlLessThanOrEqualTo(String value) {
+            addCriterion("url <=", value, "url");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeLike(String value) {
-            addCriterion("monitor_type like", value, "monitorType");
+        public Criteria andUrlLike(String value) {
+            addCriterion("url like", value, "url");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeNotLike(String value) {
-            addCriterion("monitor_type not like", value, "monitorType");
+        public Criteria andUrlNotLike(String value) {
+            addCriterion("url not like", value, "url");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeIn(List<String> values) {
-            addCriterion("monitor_type in", values, "monitorType");
+        public Criteria andUrlIn(List<String> values) {
+            addCriterion("url in", values, "url");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeNotIn(List<String> values) {
-            addCriterion("monitor_type not in", values, "monitorType");
+        public Criteria andUrlNotIn(List<String> values) {
+            addCriterion("url not in", values, "url");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeBetween(String value1, String value2) {
-            addCriterion("monitor_type between", value1, value2, "monitorType");
+        public Criteria andUrlBetween(String value1, String value2) {
+            addCriterion("url between", value1, value2, "url");
             return (Criteria) this;
         }
 
-        public Criteria andMonitorTypeNotBetween(String value1, String value2) {
-            addCriterion("monitor_type not between", value1, value2, "monitorType");
+        public Criteria andUrlNotBetween(String value1, String value2) {
+            addCriterion("url not between", value1, value2, "url");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIsNull() {
+            addCriterion("user_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIsNotNull() {
+            addCriterion("user_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdEqualTo(String value) {
+            addCriterion("user_id =", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotEqualTo(String value) {
+            addCriterion("user_id <>", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdGreaterThan(String value) {
+            addCriterion("user_id >", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdGreaterThanOrEqualTo(String value) {
+            addCriterion("user_id >=", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLessThan(String value) {
+            addCriterion("user_id <", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLessThanOrEqualTo(String value) {
+            addCriterion("user_id <=", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLike(String value) {
+            addCriterion("user_id like", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotLike(String value) {
+            addCriterion("user_id not like", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIn(List<String> values) {
+            addCriterion("user_id in", values, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotIn(List<String> values) {
+            addCriterion("user_id not in", values, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdBetween(String value1, String value2) {
+            addCriterion("user_id between", value1, value2, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotBetween(String value1, String value2) {
+            addCriterion("user_id not between", value1, value2, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpIsNull() {
+            addCriterion("client_ip is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpIsNotNull() {
+            addCriterion("client_ip is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpEqualTo(String value) {
+            addCriterion("client_ip =", value, "clientIp");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpNotEqualTo(String value) {
+            addCriterion("client_ip <>", value, "clientIp");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpGreaterThan(String value) {
+            addCriterion("client_ip >", value, "clientIp");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpGreaterThanOrEqualTo(String value) {
+            addCriterion("client_ip >=", value, "clientIp");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpLessThan(String value) {
+            addCriterion("client_ip <", value, "clientIp");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpLessThanOrEqualTo(String value) {
+            addCriterion("client_ip <=", value, "clientIp");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpLike(String value) {
+            addCriterion("client_ip like", value, "clientIp");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpNotLike(String value) {
+            addCriterion("client_ip not like", value, "clientIp");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpIn(List<String> values) {
+            addCriterion("client_ip in", values, "clientIp");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpNotIn(List<String> values) {
+            addCriterion("client_ip not in", values, "clientIp");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpBetween(String value1, String value2) {
+            addCriterion("client_ip between", value1, value2, "clientIp");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientIpNotBetween(String value1, String value2) {
+            addCriterion("client_ip not between", value1, value2, "clientIp");
             return (Criteria) this;
         }
 
@@ -646,6 +785,76 @@ public class JayMonitorUrlExample {
             return (Criteria) this;
         }
 
+        public Criteria andLogIdIsNull() {
+            addCriterion("log_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdIsNotNull() {
+            addCriterion("log_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdEqualTo(String value) {
+            addCriterion("log_id =", value, "logId");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdNotEqualTo(String value) {
+            addCriterion("log_id <>", value, "logId");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdGreaterThan(String value) {
+            addCriterion("log_id >", value, "logId");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdGreaterThanOrEqualTo(String value) {
+            addCriterion("log_id >=", value, "logId");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdLessThan(String value) {
+            addCriterion("log_id <", value, "logId");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdLessThanOrEqualTo(String value) {
+            addCriterion("log_id <=", value, "logId");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdLike(String value) {
+            addCriterion("log_id like", value, "logId");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdNotLike(String value) {
+            addCriterion("log_id not like", value, "logId");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdIn(List<String> values) {
+            addCriterion("log_id in", values, "logId");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdNotIn(List<String> values) {
+            addCriterion("log_id not in", values, "logId");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdBetween(String value1, String value2) {
+            addCriterion("log_id between", value1, value2, "logId");
+            return (Criteria) this;
+        }
+
+        public Criteria andLogIdNotBetween(String value1, String value2) {
+            addCriterion("log_id not between", value1, value2, "logId");
+            return (Criteria) this;
+        }
+
         public Criteria andRequestTimeIsNull() {
             addCriterion("request_time is null");
             return (Criteria) this;
@@ -716,115 +925,55 @@ public class JayMonitorUrlExample {
             return (Criteria) this;
         }
 
-        public Criteria andCreatedTimeEqualTo(LocalDateTime value) {
+        public Criteria andCreatedTimeEqualTo(Date value) {
             addCriterion("created_time =", value, "createdTime");
             return (Criteria) this;
         }
 
-        public Criteria andCreatedTimeNotEqualTo(LocalDateTime value) {
+        public Criteria andCreatedTimeNotEqualTo(Date value) {
             addCriterion("created_time <>", value, "createdTime");
             return (Criteria) this;
         }
 
-        public Criteria andCreatedTimeGreaterThan(LocalDateTime value) {
+        public Criteria andCreatedTimeGreaterThan(Date value) {
             addCriterion("created_time >", value, "createdTime");
             return (Criteria) this;
         }
 
-        public Criteria andCreatedTimeGreaterThanOrEqualTo(LocalDateTime value) {
+        public Criteria andCreatedTimeGreaterThanOrEqualTo(Date value) {
             addCriterion("created_time >=", value, "createdTime");
             return (Criteria) this;
         }
 
-        public Criteria andCreatedTimeLessThan(LocalDateTime value) {
+        public Criteria andCreatedTimeLessThan(Date value) {
             addCriterion("created_time <", value, "createdTime");
             return (Criteria) this;
         }
 
-        public Criteria andCreatedTimeLessThanOrEqualTo(LocalDateTime value) {
+        public Criteria andCreatedTimeLessThanOrEqualTo(Date value) {
             addCriterion("created_time <=", value, "createdTime");
             return (Criteria) this;
         }
 
-        public Criteria andCreatedTimeIn(List<LocalDateTime> values) {
+        public Criteria andCreatedTimeIn(List<Date> values) {
             addCriterion("created_time in", values, "createdTime");
             return (Criteria) this;
         }
 
-        public Criteria andCreatedTimeNotIn(List<LocalDateTime> values) {
+        public Criteria andCreatedTimeNotIn(List<Date> values) {
             addCriterion("created_time not in", values, "createdTime");
             return (Criteria) this;
         }
 
-        public Criteria andCreatedTimeBetween(LocalDateTime value1, LocalDateTime value2) {
+        public Criteria andCreatedTimeBetween(Date value1, Date value2) {
             addCriterion("created_time between", value1, value2, "createdTime");
             return (Criteria) this;
         }
 
-        public Criteria andCreatedTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
+        public Criteria andCreatedTimeNotBetween(Date value1, Date value2) {
             addCriterion("created_time not between", value1, value2, "createdTime");
             return (Criteria) this;
         }
-
-        public Criteria andCreatedDayIsNull() {
-            addCriterion("created_day is null");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayIsNotNull() {
-            addCriterion("created_day is not null");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayEqualTo(LocalDate value) {
-            addCriterion("created_day =", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayNotEqualTo(LocalDate value) {
-            addCriterion("created_day <>", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayGreaterThan(LocalDate value) {
-            addCriterion("created_day >", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayGreaterThanOrEqualTo(LocalDate value) {
-            addCriterion("created_day >=", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayLessThan(LocalDate value) {
-            addCriterion("created_day <", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayLessThanOrEqualTo(LocalDate value) {
-            addCriterion("created_day <=", value, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayIn(List<LocalDate> values) {
-            addCriterion("created_day in", values, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayNotIn(List<LocalDate> values) {
-            addCriterion("created_day not in", values, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayBetween(LocalDate value1, LocalDate value2) {
-            addCriterion("created_day between", value1, value2, "createdDay");
-            return (Criteria) this;
-        }
-
-        public Criteria andCreatedDayNotBetween(LocalDate value1, LocalDate value2) {
-            addCriterion("created_day not between", value1, value2, "createdDay");
-            return (Criteria) this;
-        }
     }
 
     /**

+ 14 - 22
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/process/MQUserProcess.java

@@ -30,32 +30,24 @@ public class MQUserProcess extends AbstractUserProcess<MQDataDTO> {
     public Object handleRequest0(BizContext bizCtx, MQDataDTO request) throws Exception {
         logger.debug("接收到的URL 传输对象:" + JSON.toJSONString(request));
         return storeDataManager.store(MsgTypeEnums.MQ, request);
-//        JayMonitorMq monitorUrl = new JayMonitorMq();
-//        BeanUtils.copyProperties(request, monitorUrl);
-//        monitorUrl.setApplicationName(DataUtils.getStringValue(request.getApplicationName(), bizCtx.getInvokeContext().get(MonitorDataConstants.INVOKE_CLIENT_NAME)));
-//        monitorUrl.setApplicationIp(DataUtils.getStringValue(request.getIp(), bizCtx.getInvokeContext().get(MonitorDataConstants.INVOKE_CLIENT_IP)));
-//        monitorUrl.setCreatedDay(request.getCreateDate());
-//        monitorUrl.setCreatedTime(request.getCreateDate());
-//        monitorUrl.setMonitorType(request.getType().name());
-//        monitorUrl.setDataGroupName(request.getGroupName());
-//        monitorUrl.setDataGroupKey(request.getGroupName());
-//        monitorUrl.setDataId(request.getDataId());
-//
-//        int id = urlMapper.insert(monitorUrl);
-//
-//        JayMonitorUrlLog urlLog = new JayMonitorUrlLog();
-//        urlLog.setMonitorId(id);
-//        urlLog.setCreateDate(request.getCreateDate());
-//        urlLog.setLogId(request.getLogId());
-//        urlLog.setLogText(request.getJsonContent());
-//        urlLog.setMonitorType(request.getType().name());
-//        int logId = urlLogMapper.insert(urlLog);
-//        logger.debug(" 接收到客户端传递过来的数据 ... ");
-//        return request;
     }
 
     @Override
     public List<String> multiInterest() {
         return getNamesList(MQDataDTO.class);
     }
+
+//    @Override
+//    public Executor getExecutor() {
+//        return new ThreadPoolExecutor(ConfigManager.default_tp_min_size(),
+//                ConfigManager.default_tp_max_size(),
+//                ConfigManager.default_tp_keepalive_time(),
+//                TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory(
+//                "jay-mq-process-executor", true));
+//    }
+
+    @Override
+    public ExecutorSelector getExecutorSelector() {
+        return super.getExecutorSelector();
+    }
 }

+ 2 - 1
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/process/URLUserProcess.java

@@ -18,7 +18,7 @@ import java.util.List;
  * @Date 2020/10/23 15:52
  */
 @Component
-public class URLUserProcess extends AbstractUserProcess<URLDataDTO> {
+public class URLUserProcess extends AbstractUserProcess<URLDataDTO>   {
 
     private Logger logger = LoggerFactory.getLogger(URLUserProcess.class);
 
@@ -35,4 +35,5 @@ public class URLUserProcess extends AbstractUserProcess<URLDataDTO> {
     public List<String> multiInterest() {
         return getNamesList(URLDataDTO.class);
     }
+
 }

+ 176 - 2
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/store/AbstractStoreProcess.java

@@ -1,7 +1,22 @@
 package com.jay.monitor.data.server.store;
 
 import com.jay.monitor.data.core.enums.MsgTypeEnums;
+import com.jay.monitor.data.server.config.props.MonitorProperties;
+import com.jay.monitor.data.server.enums.DataSplitType;
 import com.jay.monitor.data.server.enums.StoreType;
+import com.jay.monitor.data.server.store.mysql.MysqlDDLProcess;
+import com.jay.monitor.data.server.utils.MonitorPropertiesUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.atomic.LongAdder;
 
 /**
  * @Module 执行器
@@ -9,7 +24,39 @@ import com.jay.monitor.data.server.enums.StoreType;
  * @Author liukaixiong
  * @Date 2020/10/29 13:33
  */
-public abstract class AbstractStoreProcess<T> {
+public abstract class AbstractStoreProcess<T> implements Runnable, InitializingBean {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    private LongAdder counter = new LongAdder();
+
+    private int queueSize = 5000;
+
+    private int batchSize = 500;
+
+    private BlockingQueue<T> queue = new ArrayBlockingQueue<>(queueSize);
+
+    @Autowired
+    private MysqlDDLProcess ddlProcess;
+
+    @Autowired
+    private MonitorProperties monitorProperties;
+
+    public void setQueueSize(int queueSize) {
+        this.queueSize = queueSize;
+    }
+
+    public int getQueueSize() {
+        return queueSize;
+    }
+
+    public int getBatchSize() {
+        return batchSize;
+    }
+
+    public void setBatchSize(int batchSize) {
+        this.batchSize = batchSize;
+    }
+
     /**
      * 存储类型
      *
@@ -24,6 +71,133 @@ public abstract class AbstractStoreProcess<T> {
      */
     public abstract MsgTypeEnums msgTypeEnums();
 
-    public abstract Object store(T data) throws Exception;
+    public Object store(T request) throws Exception {
+
+        storeBefore(request);
+
+        boolean add = getQueue().offer(request);
+
+        if (!add) {
+
+            counter.decrement();
+
+            if (counter.intValue() == 0 || counter.intValue() > queueSize) {
+                logger.warn(getClass() + " 队列消费满了,装不下去了");
+                counter.reset();
+            }
+        }
+
+        storeAfter(request, add);
+
+        return add;
+    }
+
+    /**
+     * 存储之前触发
+     *
+     * @param request
+     */
+    protected void storeBefore(T request) {
+
+    }
+
+    /**
+     * 存储之后触发
+     *
+     * @param request
+     * @param success
+     */
+    protected void storeAfter(T request, boolean success) {
+    }
+
+
+    public abstract String searchContentById(String date, String id) throws Exception;
+
+    public abstract void speedUpConsumerList(List<T> request);
+
+    public void speedUpConsumer(BlockingQueue<T> queue, int rate) {
+        List<T> requestList = new ArrayList<>();
+
+        for (int i = 0; i < rate; i++) {
+            T request = queue.poll();
+            requestList.add(request);
+        }
+
+        speedUpConsumerList(requestList);
+    }
+
+    protected BlockingQueue<T> getQueue() {
+        return queue;
+    }
+
+    @Override
+    public void run() {
+        logger.info("开启异步消费机...");
+        int defaultSize = getQueueSize();
+        int batchSize = getBatchSize();
+        int minBatch = batchSize / 10;
+        int thresholdValue = (int) (defaultSize * 0.8);
+        while (true) {
+            try {
+                int size = this.queue.size();
+                if (size > 0) {
+                    if (size > thresholdValue) {
+                        speedUpConsumer(this.queue, defaultSize / 2);
+                    } else if (size > batchSize) {
+                        speedUpConsumer(this.queue, batchSize);
+                    } else if (size > minBatch) {
+                        speedUpConsumer(this.queue, size);
+                    } else {
+                        // 如果数量不多的情况下
+                        speedUpConsumer(this.queue, 1);
+                    }
+                }
+            } catch (Exception e) {
+                logger.warn("异步队列消费失败", e);
+                sleep(5);
+            } finally {
+                sleep(5);
+            }
+        }
+    }
+
+    private void sleep(int ms) {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void startConsumerThread() {
+        String threadName = getClass().getSimpleName() + "-consumer-thread";
+        logger.info("开启消费线程:" + threadName);
+        new Thread(this, threadName).start();
+    }
+
+    @Override
+    public void afterPropertiesSet() throws Exception {
+        startConsumerThread();
+    }
+
+    /**
+     * 获取分区编号
+     *
+     * @return
+     */
+    protected String getPartitionId() {
+        // 从配置文件中获取对应的规则
+        Map<String, DataSplitType> tableRuleMap = MonitorPropertiesUtil.getMysqlTableRuleMap(monitorProperties);
+
+        if (tableRuleMap != null) {
+            DataSplitType dataSplitType = tableRuleMap.get(tableName());
+            if (dataSplitType != null) {
+                String dataId = ddlProcess.getDataId(tableName(), dataSplitType);
+                return dataId;
+            }
+        }
+        return null;
+    }
 
+    public abstract String tableName();
 }

+ 10 - 0
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/store/StoreDataManager.java

@@ -44,6 +44,16 @@ public class StoreDataManager implements InitializingBean {
         return null;
     }
 
+    public String selectContentById(MsgTypeEnums msgType, String date, String logId) throws Exception {
+        AbstractStoreProcess storeProcess = processMap.get(msgType);
+        if (storeProcess != null) {
+            return storeProcess.searchContentById(date,logId);
+        } else {
+            logger.warn("找不到对应的[" + storeType + "]存储处理器 : " + msgType);
+        }
+        return null;
+    }
+
 
     @Override
     public void afterPropertiesSet() throws Exception {

+ 1 - 1
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/store/mysql/MysqlDDLProcess.java

@@ -67,7 +67,7 @@ public class MysqlDDLProcess extends AbstractSplitDataProcess {
     @Override
     public String getDataId(String tableName, DataSplitType dataSplitType) {
         String currentId = dataIdFactory.getCurrentId(dataSplitType);
-        return getNewTableName(tableName, currentId);
+        return currentId;
     }
 
     protected String getNewTableName(String tableName, String id) {

+ 72 - 27
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/store/mysql/MysqlMQStoreProcess.java

@@ -1,20 +1,26 @@
 package com.jay.monitor.data.server.store.mysql;
 
+import com.cat.file.message.MessageManagerProcess;
+import com.cat.file.message.internal.DefaultMessageTree;
+import com.cat.file.message.internal.MessageTree;
 import com.jay.monitor.data.core.enums.MsgTypeEnums;
 import com.jay.monitor.data.core.model.serializable.MQDataDTO;
-import com.jay.monitor.data.server.daos.JayMonitorMqLogMapper;
-import com.jay.monitor.data.server.daos.JayMonitorMqMapper;
+import com.jay.monitor.data.server.daos.JayMonitorMqMapperExt;
 import com.jay.monitor.data.server.enums.StoreType;
 import com.jay.monitor.data.server.models.entity.JayMonitorMq;
-import com.jay.monitor.data.server.models.entity.JayMonitorMqLog;
 import com.jay.monitor.data.server.store.AbstractStoreProcess;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.LongAdder;
+
 /**
  * @Module 数据存储器
  * @Description Mysql的MQ存储实现
@@ -27,11 +33,19 @@ public class MysqlMQStoreProcess extends AbstractStoreProcess<MQDataDTO> {
 
     private Logger logger = LoggerFactory.getLogger(getClass());
 
+    private LongAdder counter = new LongAdder();
+
+    /**
+     * 队列的大小
+     */
+    public int defaultSize = 5000;
+
     @Autowired
-    private JayMonitorMqMapper mqMapper;
+    @Qualifier("jayMonitorMqMapperExt")
+    private JayMonitorMqMapperExt mqMapper;
 
     @Autowired
-    private JayMonitorMqLogMapper mqLogMapper;
+    private MessageManagerProcess messageManagerProcess;
 
     @Override
     public StoreType storeType() {
@@ -44,30 +58,61 @@ public class MysqlMQStoreProcess extends AbstractStoreProcess<MQDataDTO> {
     }
 
     @Override
-    public Object store(MQDataDTO request) throws Exception {
+    public String tableName() {
+        return "jay_monitor_mq";
+    }
+
+    /**
+     * 加速消费,单条记录插入会造成大量的并发写
+     *
+     * @param dataList
+     */
+    @Override
+    public void speedUpConsumerList(List<MQDataDTO> dataList) {
+        List<JayMonitorMq> monitorList = new ArrayList<>();
+
+        for (int i = 0; i < dataList.size(); i++) {
+            MQDataDTO request = dataList.get(i);
+            JayMonitorMq mqData = builderJayMonitorMq(request);
+            monitorList.add(mqData);
+        }
+
+        mqMapper.batchPartitionInsert(getPartitionId(), monitorList);
+
+        for (int i = 0; i < monitorList.size(); i++) {
+            Integer id = monitorList.get(i).getId();
+            MQDataDTO dataDTO = dataList.get(i);
+            MessageTree messageTree = new DefaultMessageTree(dataDTO.getApplicationName(), dataDTO.getIp(), id, dataDTO.getCreateDate(), dataDTO.getJsonContent());
+            this.messageManagerProcess.insert(messageTree);
+            logger.debug("添加成功:" + messageTree.getMessageId());
+        }
+    }
+
+    @Override
+    public String searchContentById(String date, String id) throws Exception {
+        JayMonitorMq jayMonitorMq = mqMapper.selectPartitionById(date, Integer.valueOf(id));
+        MessageTree messageTree = new DefaultMessageTree(jayMonitorMq.getApplicationName(), jayMonitorMq.getApplicationIp(), jayMonitorMq.getId(), jayMonitorMq.getCreatedTime(), null);
+        String messageId = messageTree.getMessageId();
+        return this.messageManagerProcess.getMessage(messageId);
+    }
+
+    private JayMonitorMq builderJayMonitorMq(MQDataDTO request) {
         JayMonitorMq mqData = new JayMonitorMq();
-        BeanUtils.copyProperties(request, mqData);
-        mqData.setApplicationName(request.getApplicationName());
-        mqData.setApplicationIp(request.getIp());
-        mqData.setCreatedDay(request.getCreateDate());
-        mqData.setCreatedTime(request.getCreateDate());
-        mqData.setDataGroupName(request.getGroupName());
-        mqData.setDataGroupKey(request.getGroupKeyName());
-        mqData.setDataId(request.getDataId());
-        mqData.setLogId(request.getLogId());
-        // mqData.setInvokeType(request.getInvokeType().name());
-        int affectRow = mqMapper.insert(mqData);
-        if (affectRow == 1) {
-            JayMonitorMqLog mqLog = new JayMonitorMqLog();
-            mqLog.setMonitorId(mqData.getId());
-            mqLog.setParentLogId(request.getParentLogId());
-            mqLog.setRootLogId(request.getRootLogId());
-            mqLog.setCreateDate(request.getCreateDate());
-            mqLog.setLogId(request.getLogId());
-            mqLog.setLogText(request.getJsonContent());
-            int logId = mqLogMapper.insert(mqLog);
+        try {
+            BeanUtils.copyProperties(request, mqData);
+            mqData.setApplicationName(request.getApplicationName());
+            mqData.setApplicationIp(request.getIp());
+            mqData.setCreatedTime(request.getCreateDate());
+            mqData.setDataGroupName(request.getGroupName());
+            mqData.setDataGroupKey(request.getGroupKeyName());
+            mqData.setDataId(request.getDataId());
+            mqData.setLogId(request.getLogId());
+            mqData.setInvokeType(request.getInvokeType().name());
+        } catch (Exception e) {
+            logger.error("builderJayMonitorMq", e);
         }
-        return null;
+        return mqData;
     }
 
+
 }

+ 56 - 34
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/store/mysql/MysqlUrlStoreProcess.java

@@ -1,21 +1,26 @@
 package com.jay.monitor.data.server.store.mysql;
 
+import com.cat.file.message.MessageManagerProcess;
+import com.cat.file.message.internal.DefaultMessageTree;
+import com.cat.file.message.internal.MessageTree;
 import com.jay.monitor.data.core.enums.MsgTypeEnums;
 import com.jay.monitor.data.core.model.serializable.URLDataDTO;
-import com.jay.monitor.data.server.daos.JayMonitorUrlLogMapper;
-import com.jay.monitor.data.server.daos.JayMonitorUrlMapper;
+import com.jay.monitor.data.server.daos.JayMonitorUrlMapperExt;
 import com.jay.monitor.data.server.enums.StoreType;
 import com.jay.monitor.data.server.models.entity.JayMonitorUrl;
-import com.jay.monitor.data.server.models.entity.JayMonitorUrlLog;
 import com.jay.monitor.data.server.store.AbstractStoreProcess;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @Module 执行器
  * @Description Mysql的URL请求类型处理器
@@ -27,12 +32,12 @@ import org.springframework.stereotype.Component;
 public class MysqlUrlStoreProcess extends AbstractStoreProcess<URLDataDTO> {
 
     private Logger logger = LoggerFactory.getLogger(getClass());
-
     @Autowired
-    private JayMonitorUrlMapper urlMapper;
+    @Qualifier("jayMonitorUrlMapperExt")
+    private JayMonitorUrlMapperExt urlMapper;
 
     @Autowired
-    private JayMonitorUrlLogMapper urlLogMapper;
+    private MessageManagerProcess messageManagerProcess;
 
     @Override
     public StoreType storeType() {
@@ -45,37 +50,54 @@ public class MysqlUrlStoreProcess extends AbstractStoreProcess<URLDataDTO> {
     }
 
     @Override
-    public Object store(URLDataDTO baseDTO) throws Exception {
+    public String tableName() {
+        return "jay_monitor_url";
+    }
 
-        URLDataDTO request = (URLDataDTO) baseDTO;
-        String url = request.getUrl();
-        if (StringUtils.isNotEmpty(request.getUrl())) {
-            url = url.replaceAll("//", "/");
-        }
+    @Override
+    public String searchContentById(String date, String id) throws Exception {
+        JayMonitorUrl monitorData = urlMapper.selectPartitionById(date, Integer.valueOf(id));
+        MessageTree messageTree = new DefaultMessageTree(monitorData.getApplicationName(), monitorData.getApplicationIp(), monitorData.getId(), monitorData.getCreatedTime(), null);
+        String messageId = messageTree.getMessageId();
+        return this.messageManagerProcess.getMessage(messageId);
+    }
 
-        JayMonitorUrl monitorUrl = new JayMonitorUrl();
-        BeanUtils.copyProperties(request, monitorUrl);
-        monitorUrl.setUrl(url);
-        monitorUrl.setApplicationName(request.getApplicationName());
-        monitorUrl.setApplicationIp(request.getIp());
-        monitorUrl.setCreatedDay(request.getCreateDate());
-        monitorUrl.setCreatedTime(request.getCreateDate());
-        monitorUrl.setMonitorType(request.getType().name());
-        monitorUrl.setDataGroupName(request.getGroupName());
-        monitorUrl.setDataGroupKey(request.getGroupName());
-        monitorUrl.setDataId(request.getDataId());
+    @Override
+    public void speedUpConsumerList(List<URLDataDTO> requestList) {
+        List<JayMonitorUrl> monitorList = new ArrayList<>();
+        for (int i = 0; i < requestList.size(); i++) {
 
-        int id = urlMapper.insert(monitorUrl);
+            URLDataDTO request = requestList.get(i);
+            String url = request.getUrl();
+            if (StringUtils.isNotEmpty(request.getUrl())) {
+                url = url.replaceAll("//", "/");
+            }
 
-        JayMonitorUrlLog urlLog = new JayMonitorUrlLog();
-        urlLog.setMonitorId(id);
-        urlLog.setCreateDate(request.getCreateDate());
-        urlLog.setLogId(request.getLogId());
-        urlLog.setLogText(request.getJsonContent());
-        urlLog.setMonitorType(request.getType().name());
-        int logId = urlLogMapper.insert(urlLog);
-        logger.debug(" 接收到客户端传递过来的数据 ... ");
-        return null;
-    }
+            JayMonitorUrl monitorUrl = new JayMonitorUrl();
+            BeanUtils.copyProperties(request, monitorUrl);
+            monitorUrl.setUrl(url);
+            monitorUrl.setApplicationName(request.getApplicationName());
+            monitorUrl.setApplicationIp(request.getIp());
+            monitorUrl.setCreatedTime(request.getCreateDate());
+            monitorUrl.setDataGroupName(request.getGroupName());
+            monitorUrl.setDataGroupKey(request.getGroupKeyName());
+            monitorUrl.setDataId(request.getDataId());
+            monitorUrl.setClientIp(request.getClientIp());
+            monitorUrl.setUserId(request.getUserId());
+            if (request.getRequestTime() != null) {
+                monitorUrl.setRequestTime(request.getRequestTime().intValue());
+            }
+            monitorList.add(monitorUrl);
+        }
 
+        urlMapper.batchPartitionInsert(getPartitionId(), monitorList);
+
+        for (int i = 0; i < monitorList.size(); i++) {
+            Integer id = monitorList.get(i).getId();
+            URLDataDTO dataDTO = requestList.get(i);
+            MessageTree messageTree = new DefaultMessageTree(dataDTO.getApplicationName(), dataDTO.getIp(), id, dataDTO.getCreateDate(), dataDTO.getJsonContent());
+            this.messageManagerProcess.insert(messageTree);
+            logger.debug("添加成功:" + messageTree.getMessageId());
+        }
+    }
 }

+ 1 - 1
jay-monitor-data-server/src/main/resources/application-dev.yml

@@ -8,4 +8,4 @@ spring:
 
 logging:
   level:
-    com.jay.monitor.data.server: debug
+    com.jay.monitor.data.server: DEBUG

+ 3 - 0
jay-monitor-data-server/src/main/resources/application-test.yml

@@ -6,3 +6,6 @@ spring:
     username: jay_monitor
     password: jayzhou
 
+#logging:
+#  level:
+#    com.jay.monitor.data.server: debug

+ 6 - 1
jay-monitor-data-server/src/main/resources/application.yml

@@ -19,7 +19,7 @@ spring:
       mysql:
         table-rule:
           jay_monitor_mq: day
-          jay_monitor_mq_log: day
+          jay_monitor_url: day
   thymeleaf:
     cache: false
     prefix: classpath:/templates
@@ -33,11 +33,16 @@ spring:
         content:
           enabled: true
           paths: /**
+  cat:
+    file:
+      base-data-dir: /data/appdatas/cat/bucket/dump/
 mybatis-plus:
   mapper-locations: classpath*:/mybatis/mapper/*.xml,classpath:mybatis/mapper/ext/*.xml
   type-aliases-package: com.jay.monitor.data.server.daos
   config-location: classpath:/mybatis/mybatis-config.xml
 
+
+
 swagger2:
   basePackage: com.jay.monitor.data.server.controllers
   title: backstage

+ 3 - 4
jay-monitor-data-server/src/main/resources/logback.xml

@@ -68,14 +68,13 @@
             <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
         </encoder>
     </appender>
-
-    <logger name="com.jay.monitor.data.server" level="INFO" additivity="false">
+    <logger name="com.jay.monitor.data.server" level="INFO"  additivity="false">
         <appender-ref ref="stdout"/>
     </logger>
 
     <root level="INFO">
-        <appender-ref ref="console"></appender-ref>
+<!--        <appender-ref ref="console"></appender-ref>-->
         <appender-ref ref="ASYNC_FILE"></appender-ref>
-        <!--        <appender-ref ref="cat"/>-->
+        <appender-ref ref="ERROR_LOG"></appender-ref>
     </root>
 </configuration>

+ 0 - 237
jay-monitor-data-server/src/main/resources/mybatis/mapper/JayMonitorMqLogMapper.xml

@@ -1,237 +0,0 @@
-<?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.jay.monitor.data.server.daos.JayMonitorMqLogMapper">
-  <resultMap id="BaseResultMap" type="com.jay.monitor.data.server.models.entity.JayMonitorMqLog">
-    <id column="id" jdbcType="INTEGER" property="id" />
-    <result column="monitor_id" jdbcType="INTEGER" property="monitorId" />
-    <result column="root_log_id" jdbcType="VARCHAR" property="rootLogId" />
-    <result column="parent_log_id" jdbcType="VARCHAR" property="parentLogId" />
-    <result column="log_id" jdbcType="VARCHAR" property="logId" />
-    <result column="log_text" jdbcType="VARCHAR" property="logText" />
-    <result column="create_date" jdbcType="DATE" property="createDate" />
-  </resultMap>
-  <sql id="Example_Where_Clause">
-    <where>
-      <foreach collection="oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Update_By_Example_Where_Clause">
-    <where>
-      <foreach collection="example.oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Base_Column_List">
-    id, monitor_id, root_log_id, parent_log_id, log_id, log_text, create_date
-  </sql>
-  <select id="selectByExample" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorMqLogExample" resultMap="BaseResultMap">
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from jay_monitor_mq_log
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
-    select 
-    <include refid="Base_Column_List" />
-    from jay_monitor_mq_log
-    where id = #{id,jdbcType=INTEGER}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
-    delete from jay_monitor_mq_log
-    where id = #{id,jdbcType=INTEGER}
-  </delete>
-  <delete id="deleteByExample" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorMqLogExample">
-    delete from jay_monitor_mq_log
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorMqLog" useGeneratedKeys="true">
-    insert into jay_monitor_mq_log (monitor_id, root_log_id, parent_log_id, 
-      log_id, log_text, create_date
-      )
-    values (#{monitorId,jdbcType=INTEGER}, #{rootLogId,jdbcType=VARCHAR}, #{parentLogId,jdbcType=VARCHAR}, 
-      #{logId,jdbcType=VARCHAR}, #{logText,jdbcType=VARCHAR}, #{createDate,jdbcType=DATE}
-      )
-  </insert>
-  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorMqLog" useGeneratedKeys="true">
-    insert into jay_monitor_mq_log
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="monitorId != null">
-        monitor_id,
-      </if>
-      <if test="rootLogId != null">
-        root_log_id,
-      </if>
-      <if test="parentLogId != null">
-        parent_log_id,
-      </if>
-      <if test="logId != null">
-        log_id,
-      </if>
-      <if test="logText != null">
-        log_text,
-      </if>
-      <if test="createDate != null">
-        create_date,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="monitorId != null">
-        #{monitorId,jdbcType=INTEGER},
-      </if>
-      <if test="rootLogId != null">
-        #{rootLogId,jdbcType=VARCHAR},
-      </if>
-      <if test="parentLogId != null">
-        #{parentLogId,jdbcType=VARCHAR},
-      </if>
-      <if test="logId != null">
-        #{logId,jdbcType=VARCHAR},
-      </if>
-      <if test="logText != null">
-        #{logText,jdbcType=VARCHAR},
-      </if>
-      <if test="createDate != null">
-        #{createDate,jdbcType=DATE},
-      </if>
-    </trim>
-  </insert>
-  <select id="countByExample" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorMqLogExample" resultType="java.lang.Long">
-    select count(*) from jay_monitor_mq_log
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    update jay_monitor_mq_log
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=INTEGER},
-      </if>
-      <if test="record.monitorId != null">
-        monitor_id = #{record.monitorId,jdbcType=INTEGER},
-      </if>
-      <if test="record.rootLogId != null">
-        root_log_id = #{record.rootLogId,jdbcType=VARCHAR},
-      </if>
-      <if test="record.parentLogId != null">
-        parent_log_id = #{record.parentLogId,jdbcType=VARCHAR},
-      </if>
-      <if test="record.logId != null">
-        log_id = #{record.logId,jdbcType=VARCHAR},
-      </if>
-      <if test="record.logText != null">
-        log_text = #{record.logText,jdbcType=VARCHAR},
-      </if>
-      <if test="record.createDate != null">
-        create_date = #{record.createDate,jdbcType=DATE},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map">
-    update jay_monitor_mq_log
-    set id = #{record.id,jdbcType=INTEGER},
-      monitor_id = #{record.monitorId,jdbcType=INTEGER},
-      root_log_id = #{record.rootLogId,jdbcType=VARCHAR},
-      parent_log_id = #{record.parentLogId,jdbcType=VARCHAR},
-      log_id = #{record.logId,jdbcType=VARCHAR},
-      log_text = #{record.logText,jdbcType=VARCHAR},
-      create_date = #{record.createDate,jdbcType=DATE}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorMqLog">
-    update jay_monitor_mq_log
-    <set>
-      <if test="monitorId != null">
-        monitor_id = #{monitorId,jdbcType=INTEGER},
-      </if>
-      <if test="rootLogId != null">
-        root_log_id = #{rootLogId,jdbcType=VARCHAR},
-      </if>
-      <if test="parentLogId != null">
-        parent_log_id = #{parentLogId,jdbcType=VARCHAR},
-      </if>
-      <if test="logId != null">
-        log_id = #{logId,jdbcType=VARCHAR},
-      </if>
-      <if test="logText != null">
-        log_text = #{logText,jdbcType=VARCHAR},
-      </if>
-      <if test="createDate != null">
-        create_date = #{createDate,jdbcType=DATE},
-      </if>
-    </set>
-    where id = #{id,jdbcType=INTEGER}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorMqLog">
-    update jay_monitor_mq_log
-    set monitor_id = #{monitorId,jdbcType=INTEGER},
-      root_log_id = #{rootLogId,jdbcType=VARCHAR},
-      parent_log_id = #{parentLogId,jdbcType=VARCHAR},
-      log_id = #{logId,jdbcType=VARCHAR},
-      log_text = #{logText,jdbcType=VARCHAR},
-      create_date = #{createDate,jdbcType=DATE}
-    where id = #{id,jdbcType=INTEGER}
-  </update>
-</mapper>

+ 40 - 25
jay-monitor-data-server/src/main/resources/mybatis/mapper/JayMonitorMqMapper.xml

@@ -13,11 +13,12 @@
     <result column="data_group_name" jdbcType="VARCHAR" property="dataGroupName" />
     <result column="data_group_key" jdbcType="VARCHAR" property="dataGroupKey" />
     <result column="data_id" jdbcType="VARCHAR" property="dataId" />
+    <result column="root_log_id" jdbcType="VARCHAR" property="rootLogId" />
+    <result column="parent_log_id" jdbcType="VARCHAR" property="parentLogId" />
     <result column="log_id" jdbcType="VARCHAR" property="logId" />
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="source_time" jdbcType="TIMESTAMP" property="sourceTime" />
     <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
-    <result column="created_day" jdbcType="DATE" property="createdDay" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <where>
@@ -79,8 +80,8 @@
   </sql>
   <sql id="Base_Column_List">
     id, application_name, application_ip, mq_type, invoke_type, topic, partition_name, 
-    msg_id, data_group_name, data_group_key, data_id, log_id, `status`, source_time, 
-    created_time, created_day
+    msg_id, data_group_name, data_group_key, data_id, root_log_id, parent_log_id, log_id, 
+    `status`, source_time, created_time
   </sql>
   <select id="selectByExample" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorMqExample" resultMap="BaseResultMap">
     select
@@ -116,15 +117,15 @@
     insert into jay_monitor_mq (application_name, application_ip, mq_type, 
       invoke_type, topic, partition_name, 
       msg_id, data_group_name, data_group_key, 
-      data_id, log_id, `status`, 
-      source_time, created_time, created_day
-      )
+      data_id, root_log_id, parent_log_id, 
+      log_id, `status`, source_time, 
+      created_time)
     values (#{applicationName,jdbcType=VARCHAR}, #{applicationIp,jdbcType=VARCHAR}, #{mqType,jdbcType=VARCHAR}, 
       #{invokeType,jdbcType=VARCHAR}, #{topic,jdbcType=VARCHAR}, #{partitionName,jdbcType=VARCHAR}, 
       #{msgId,jdbcType=VARCHAR}, #{dataGroupName,jdbcType=VARCHAR}, #{dataGroupKey,jdbcType=VARCHAR}, 
-      #{dataId,jdbcType=VARCHAR}, #{logId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, 
-      #{sourceTime,jdbcType=TIMESTAMP}, #{createdTime,jdbcType=TIMESTAMP}, #{createdDay,jdbcType=DATE}
-      )
+      #{dataId,jdbcType=VARCHAR}, #{rootLogId,jdbcType=VARCHAR}, #{parentLogId,jdbcType=VARCHAR}, 
+      #{logId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{sourceTime,jdbcType=TIMESTAMP}, 
+      #{createdTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorMq" useGeneratedKeys="true">
     insert into jay_monitor_mq
@@ -159,6 +160,12 @@
       <if test="dataId != null">
         data_id,
       </if>
+      <if test="rootLogId != null">
+        root_log_id,
+      </if>
+      <if test="parentLogId != null">
+        parent_log_id,
+      </if>
       <if test="logId != null">
         log_id,
       </if>
@@ -171,9 +178,6 @@
       <if test="createdTime != null">
         created_time,
       </if>
-      <if test="createdDay != null">
-        created_day,
-      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="applicationName != null">
@@ -206,6 +210,12 @@
       <if test="dataId != null">
         #{dataId,jdbcType=VARCHAR},
       </if>
+      <if test="rootLogId != null">
+        #{rootLogId,jdbcType=VARCHAR},
+      </if>
+      <if test="parentLogId != null">
+        #{parentLogId,jdbcType=VARCHAR},
+      </if>
       <if test="logId != null">
         #{logId,jdbcType=VARCHAR},
       </if>
@@ -218,9 +228,6 @@
       <if test="createdTime != null">
         #{createdTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="createdDay != null">
-        #{createdDay,jdbcType=DATE},
-      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorMqExample" resultType="java.lang.Long">
@@ -265,6 +272,12 @@
       <if test="record.dataId != null">
         data_id = #{record.dataId,jdbcType=VARCHAR},
       </if>
+      <if test="record.rootLogId != null">
+        root_log_id = #{record.rootLogId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.parentLogId != null">
+        parent_log_id = #{record.parentLogId,jdbcType=VARCHAR},
+      </if>
       <if test="record.logId != null">
         log_id = #{record.logId,jdbcType=VARCHAR},
       </if>
@@ -277,9 +290,6 @@
       <if test="record.createdTime != null">
         created_time = #{record.createdTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="record.createdDay != null">
-        created_day = #{record.createdDay,jdbcType=DATE},
-      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -298,11 +308,12 @@
       data_group_name = #{record.dataGroupName,jdbcType=VARCHAR},
       data_group_key = #{record.dataGroupKey,jdbcType=VARCHAR},
       data_id = #{record.dataId,jdbcType=VARCHAR},
+      root_log_id = #{record.rootLogId,jdbcType=VARCHAR},
+      parent_log_id = #{record.parentLogId,jdbcType=VARCHAR},
       log_id = #{record.logId,jdbcType=VARCHAR},
       `status` = #{record.status,jdbcType=INTEGER},
       source_time = #{record.sourceTime,jdbcType=TIMESTAMP},
-      created_time = #{record.createdTime,jdbcType=TIMESTAMP},
-      created_day = #{record.createdDay,jdbcType=DATE}
+      created_time = #{record.createdTime,jdbcType=TIMESTAMP}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -340,6 +351,12 @@
       <if test="dataId != null">
         data_id = #{dataId,jdbcType=VARCHAR},
       </if>
+      <if test="rootLogId != null">
+        root_log_id = #{rootLogId,jdbcType=VARCHAR},
+      </if>
+      <if test="parentLogId != null">
+        parent_log_id = #{parentLogId,jdbcType=VARCHAR},
+      </if>
       <if test="logId != null">
         log_id = #{logId,jdbcType=VARCHAR},
       </if>
@@ -352,9 +369,6 @@
       <if test="createdTime != null">
         created_time = #{createdTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="createdDay != null">
-        created_day = #{createdDay,jdbcType=DATE},
-      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -370,11 +384,12 @@
       data_group_name = #{dataGroupName,jdbcType=VARCHAR},
       data_group_key = #{dataGroupKey,jdbcType=VARCHAR},
       data_id = #{dataId,jdbcType=VARCHAR},
+      root_log_id = #{rootLogId,jdbcType=VARCHAR},
+      parent_log_id = #{parentLogId,jdbcType=VARCHAR},
       log_id = #{logId,jdbcType=VARCHAR},
       `status` = #{status,jdbcType=INTEGER},
       source_time = #{sourceTime,jdbcType=TIMESTAMP},
-      created_time = #{createdTime,jdbcType=TIMESTAMP},
-      created_day = #{createdDay,jdbcType=DATE}
+      created_time = #{createdTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=INTEGER}
   </update>
 </mapper>

+ 41 - 0
jay-monitor-data-server/src/main/resources/mybatis/mapper/JayMonitorMqMapperExt.xml

@@ -0,0 +1,41 @@
+<?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.jay.monitor.data.server.daos.JayMonitorMqMapperExt">
+    <insert id="batchPartitionInsert" keyColumn="list.id" keyProperty="list.id"
+            useGeneratedKeys="true">
+        insert into jay_monitor_mq_${date} (application_name, application_ip, mq_type,
+        invoke_type, topic, partition_name,
+        msg_id, data_group_name, data_group_key,
+        data_id, root_log_id, parent_log_id,
+        log_id, `status`, source_time,
+        created_time)
+        values
+        <foreach collection="list" item="item" index="index" separator=",">
+            (
+            #{item.applicationName,jdbcType=VARCHAR}, #{item.applicationIp,jdbcType=VARCHAR},
+            #{item.mqType,jdbcType=VARCHAR},
+            #{item.invokeType,jdbcType=VARCHAR}, #{item.topic,jdbcType=VARCHAR}, #{item.partitionName,jdbcType=VARCHAR},
+            #{item.msgId,jdbcType=VARCHAR}, #{item.dataGroupName,jdbcType=VARCHAR},
+            #{item.dataGroupKey,jdbcType=VARCHAR},
+            #{item.dataId,jdbcType=VARCHAR}, #{item.rootLogId,jdbcType=VARCHAR}, #{item.parentLogId,jdbcType=VARCHAR},
+            #{item.logId,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER}, #{item.sourceTime,jdbcType=TIMESTAMP},
+            #{item.createdTime,jdbcType=TIMESTAMP}
+            )
+        </foreach>
+    </insert>
+
+    <sql id="Base_Column_List">
+    id, application_name, application_ip, mq_type, invoke_type, topic, partition_name,
+    msg_id, data_group_name, data_group_key, data_id, root_log_id, parent_log_id, log_id,
+    `status`, source_time, created_time
+  </sql>
+
+    <select id="selectPartitionById" resultType="com.jay.monitor.data.server.models.entity.JayMonitorMq">
+        select
+        <include refid="Base_Column_List"/>
+        from jay_monitor_mq_${date}
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+
+
+</mapper>

+ 60 - 43
jay-monitor-data-server/src/main/resources/mybatis/mapper/JayMonitorUrlMapper.xml

@@ -1,19 +1,20 @@
 <?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.jay.monitor.data.server.daos.JayMonitorUrlDao">
+<mapper namespace="com.jay.monitor.data.server.daos.JayMonitorUrlMapper">
   <resultMap id="BaseResultMap" type="com.jay.monitor.data.server.models.entity.JayMonitorUrl">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="application_name" jdbcType="VARCHAR" property="applicationName" />
     <result column="application_ip" jdbcType="VARCHAR" property="applicationIp" />
-    <result column="monitor_type" jdbcType="VARCHAR" property="monitorType" />
     <result column="url" jdbcType="VARCHAR" property="url" />
+    <result column="user_id" jdbcType="VARCHAR" property="userId" />
+    <result column="client_ip" jdbcType="VARCHAR" property="clientIp" />
     <result column="data_group_name" jdbcType="VARCHAR" property="dataGroupName" />
     <result column="data_group_key" jdbcType="VARCHAR" property="dataGroupKey" />
     <result column="data_id" jdbcType="VARCHAR" property="dataId" />
     <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="log_id" jdbcType="VARCHAR" property="logId" />
     <result column="request_time" jdbcType="INTEGER" property="requestTime" />
     <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
-    <result column="created_day" jdbcType="DATE" property="createdDay" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <where>
@@ -74,8 +75,8 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, application_name, application_ip, monitor_type, url, data_group_name, data_group_key, 
-    data_id, `status`, request_time, created_time, created_day
+    id, application_name, application_ip, url, user_id, client_ip, data_group_name, data_group_key, 
+    data_id, `status`, log_id, request_time, created_time
   </sql>
   <select id="selectByExample" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorUrlExample" resultMap="BaseResultMap">
     select
@@ -108,14 +109,16 @@
     </if>
   </delete>
   <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorUrl" useGeneratedKeys="true">
-    insert into jay_monitor_url (application_name, application_ip, monitor_type, 
-      url, data_group_name, data_group_key, 
-      data_id, `status`, request_time, 
-      created_time, created_day)
-    values (#{applicationName,jdbcType=VARCHAR}, #{applicationIp,jdbcType=VARCHAR}, #{monitorType,jdbcType=VARCHAR}, 
-      #{url,jdbcType=VARCHAR}, #{dataGroupName,jdbcType=VARCHAR}, #{dataGroupKey,jdbcType=VARCHAR}, 
-      #{dataId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{requestTime,jdbcType=INTEGER}, 
-      #{createdTime,jdbcType=TIMESTAMP}, #{createdDay,jdbcType=DATE})
+    insert into jay_monitor_url (application_name, application_ip, url, 
+      user_id, client_ip, data_group_name, 
+      data_group_key, data_id, `status`, 
+      log_id, request_time, created_time
+      )
+    values (#{applicationName,jdbcType=VARCHAR}, #{applicationIp,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, 
+      #{userId,jdbcType=VARCHAR}, #{clientIp,jdbcType=VARCHAR}, #{dataGroupName,jdbcType=VARCHAR}, 
+      #{dataGroupKey,jdbcType=VARCHAR}, #{dataId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, 
+      #{logId,jdbcType=VARCHAR}, #{requestTime,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}
+      )
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorUrl" useGeneratedKeys="true">
     insert into jay_monitor_url
@@ -126,12 +129,15 @@
       <if test="applicationIp != null">
         application_ip,
       </if>
-      <if test="monitorType != null">
-        monitor_type,
-      </if>
       <if test="url != null">
         url,
       </if>
+      <if test="userId != null">
+        user_id,
+      </if>
+      <if test="clientIp != null">
+        client_ip,
+      </if>
       <if test="dataGroupName != null">
         data_group_name,
       </if>
@@ -144,15 +150,15 @@
       <if test="status != null">
         `status`,
       </if>
+      <if test="logId != null">
+        log_id,
+      </if>
       <if test="requestTime != null">
         request_time,
       </if>
       <if test="createdTime != null">
         created_time,
       </if>
-      <if test="createdDay != null">
-        created_day,
-      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="applicationName != null">
@@ -161,12 +167,15 @@
       <if test="applicationIp != null">
         #{applicationIp,jdbcType=VARCHAR},
       </if>
-      <if test="monitorType != null">
-        #{monitorType,jdbcType=VARCHAR},
-      </if>
       <if test="url != null">
         #{url,jdbcType=VARCHAR},
       </if>
+      <if test="userId != null">
+        #{userId,jdbcType=VARCHAR},
+      </if>
+      <if test="clientIp != null">
+        #{clientIp,jdbcType=VARCHAR},
+      </if>
       <if test="dataGroupName != null">
         #{dataGroupName,jdbcType=VARCHAR},
       </if>
@@ -179,15 +188,15 @@
       <if test="status != null">
         #{status,jdbcType=INTEGER},
       </if>
+      <if test="logId != null">
+        #{logId,jdbcType=VARCHAR},
+      </if>
       <if test="requestTime != null">
         #{requestTime,jdbcType=INTEGER},
       </if>
       <if test="createdTime != null">
         #{createdTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="createdDay != null">
-        #{createdDay,jdbcType=DATE},
-      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.jay.monitor.data.server.models.entity.JayMonitorUrlExample" resultType="java.lang.Long">
@@ -208,12 +217,15 @@
       <if test="record.applicationIp != null">
         application_ip = #{record.applicationIp,jdbcType=VARCHAR},
       </if>
-      <if test="record.monitorType != null">
-        monitor_type = #{record.monitorType,jdbcType=VARCHAR},
-      </if>
       <if test="record.url != null">
         url = #{record.url,jdbcType=VARCHAR},
       </if>
+      <if test="record.userId != null">
+        user_id = #{record.userId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.clientIp != null">
+        client_ip = #{record.clientIp,jdbcType=VARCHAR},
+      </if>
       <if test="record.dataGroupName != null">
         data_group_name = #{record.dataGroupName,jdbcType=VARCHAR},
       </if>
@@ -226,15 +238,15 @@
       <if test="record.status != null">
         `status` = #{record.status,jdbcType=INTEGER},
       </if>
+      <if test="record.logId != null">
+        log_id = #{record.logId,jdbcType=VARCHAR},
+      </if>
       <if test="record.requestTime != null">
         request_time = #{record.requestTime,jdbcType=INTEGER},
       </if>
       <if test="record.createdTime != null">
         created_time = #{record.createdTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="record.createdDay != null">
-        created_day = #{record.createdDay,jdbcType=DATE},
-      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -245,15 +257,16 @@
     set id = #{record.id,jdbcType=INTEGER},
       application_name = #{record.applicationName,jdbcType=VARCHAR},
       application_ip = #{record.applicationIp,jdbcType=VARCHAR},
-      monitor_type = #{record.monitorType,jdbcType=VARCHAR},
       url = #{record.url,jdbcType=VARCHAR},
+      user_id = #{record.userId,jdbcType=VARCHAR},
+      client_ip = #{record.clientIp,jdbcType=VARCHAR},
       data_group_name = #{record.dataGroupName,jdbcType=VARCHAR},
       data_group_key = #{record.dataGroupKey,jdbcType=VARCHAR},
       data_id = #{record.dataId,jdbcType=VARCHAR},
       `status` = #{record.status,jdbcType=INTEGER},
+      log_id = #{record.logId,jdbcType=VARCHAR},
       request_time = #{record.requestTime,jdbcType=INTEGER},
-      created_time = #{record.createdTime,jdbcType=TIMESTAMP},
-      created_day = #{record.createdDay,jdbcType=DATE}
+      created_time = #{record.createdTime,jdbcType=TIMESTAMP}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -267,12 +280,15 @@
       <if test="applicationIp != null">
         application_ip = #{applicationIp,jdbcType=VARCHAR},
       </if>
-      <if test="monitorType != null">
-        monitor_type = #{monitorType,jdbcType=VARCHAR},
-      </if>
       <if test="url != null">
         url = #{url,jdbcType=VARCHAR},
       </if>
+      <if test="userId != null">
+        user_id = #{userId,jdbcType=VARCHAR},
+      </if>
+      <if test="clientIp != null">
+        client_ip = #{clientIp,jdbcType=VARCHAR},
+      </if>
       <if test="dataGroupName != null">
         data_group_name = #{dataGroupName,jdbcType=VARCHAR},
       </if>
@@ -285,15 +301,15 @@
       <if test="status != null">
         `status` = #{status,jdbcType=INTEGER},
       </if>
+      <if test="logId != null">
+        log_id = #{logId,jdbcType=VARCHAR},
+      </if>
       <if test="requestTime != null">
         request_time = #{requestTime,jdbcType=INTEGER},
       </if>
       <if test="createdTime != null">
         created_time = #{createdTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="createdDay != null">
-        created_day = #{createdDay,jdbcType=DATE},
-      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -301,15 +317,16 @@
     update jay_monitor_url
     set application_name = #{applicationName,jdbcType=VARCHAR},
       application_ip = #{applicationIp,jdbcType=VARCHAR},
-      monitor_type = #{monitorType,jdbcType=VARCHAR},
       url = #{url,jdbcType=VARCHAR},
+      user_id = #{userId,jdbcType=VARCHAR},
+      client_ip = #{clientIp,jdbcType=VARCHAR},
       data_group_name = #{dataGroupName,jdbcType=VARCHAR},
       data_group_key = #{dataGroupKey,jdbcType=VARCHAR},
       data_id = #{dataId,jdbcType=VARCHAR},
       `status` = #{status,jdbcType=INTEGER},
+      log_id = #{logId,jdbcType=VARCHAR},
       request_time = #{requestTime,jdbcType=INTEGER},
-      created_time = #{createdTime,jdbcType=TIMESTAMP},
-      created_day = #{createdDay,jdbcType=DATE}
+      created_time = #{createdTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=INTEGER}
   </update>
 </mapper>

+ 34 - 0
jay-monitor-data-server/src/main/resources/mybatis/mapper/JayMonitorUrlMapperExt.xml

@@ -0,0 +1,34 @@
+<?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.jay.monitor.data.server.daos.JayMonitorUrlMapperExt">
+
+  <insert id="batchPartitionInsert" keyColumn="list.id" keyProperty="list.id" useGeneratedKeys="true">
+    insert into jay_monitor_url_${date}
+    (application_name, application_ip, url,
+    user_id, client_ip, data_group_name,
+    data_group_key, data_id, `status`,
+    log_id, request_time, created_time )
+    values
+    <foreach collection="list" item="item" index="index" separator=",">
+      (#{item.applicationName,jdbcType=VARCHAR}, #{item.applicationIp,jdbcType=VARCHAR}, #{item.url,jdbcType=VARCHAR},
+      #{item.userId,jdbcType=VARCHAR}, #{item.clientIp,jdbcType=VARCHAR}, #{item.dataGroupName,jdbcType=VARCHAR},
+      #{item.dataGroupKey,jdbcType=VARCHAR}, #{item.dataId,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER},
+      #{item.logId,jdbcType=VARCHAR}, #{item.requestTime,jdbcType=INTEGER}, #{item.createdTime,jdbcType=TIMESTAMP}
+      )
+    </foreach>
+  </insert>
+
+  <sql id="Base_Column_List">
+    id, application_name, application_ip, url, user_id, client_ip, data_group_name, data_group_key,
+    data_id, `status`, log_id, request_time, created_time
+  </sql>
+
+  <select id="selectPartitionById" resultType="com.jay.monitor.data.server.models.entity.JayMonitorUrl">
+    select
+    <include refid="Base_Column_List"/>
+    from jay_monitor_url_${date}
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+
+
+</mapper>

+ 44 - 0
jay-monitor-data-server/src/test/java/com/jay/monitor/data/server/daos/BatchJayMonitorMqMapperTest.java

@@ -0,0 +1,44 @@
+//package com.jay.monitor.data.server.daos;
+//
+//import com.jay.monitor.data.server.MonitorServerApplication;
+//import com.jay.monitor.data.server.models.entity.JayMonitorMq;
+//import org.junit.Test;
+//import org.junit.runner.RunWith;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.boot.test.context.SpringBootTest;
+//import org.springframework.test.context.junit4.SpringRunner;
+//
+//import java.util.ArrayList;
+//import java.util.List;
+//
+///**
+// * @Module TODO
+// * @Description TODO
+// * @Author liukaixiong
+// * @Date 2020/11/9 18:36
+// */
+//@RunWith(SpringRunner.class)
+//@SpringBootTest(classes = {MonitorServerApplication.class})
+//public class BatchJayMonitorMqMapperTest {
+//
+//    @Autowired
+//    private JayMonitorMqMapperExt batchJayMonitorMqMapper;
+//
+//    @Test
+//    public void batchInsert() {
+//        List<JayMonitorMq> monitorMqs = new ArrayList<>();
+//        JayMonitorMqLog jq = new JayMonitorMqLog();
+//        for (int i = 0; i < 10; i++) {
+//            JayMonitorMq jayMonitorMq = new JayMonitorMq();
+//            jayMonitorMq.setDataGroupName("aaa");
+//            jayMonitorMq.setApplicationName("test");
+//            jayMonitorMq.setDataId("1231231");
+//            monitorMqs.add(jayMonitorMq);
+//            jq.setMonitorId(jayMonitorMq.getId());
+//        }
+//
+//
+//        int i = batchJayMonitorMqMapper.batchInsert(monitorMqs);
+//        System.out.println(i);
+//    }
+//}

+ 40 - 0
jay-monitor-data-server/src/test/java/com/jay/monitor/data/server/daos/JayMonitorMqLogMapperExtTest.java

@@ -0,0 +1,40 @@
+//package com.jay.monitor.data.server.daos;
+//
+//import com.jay.monitor.data.server.MonitorServerApplication;
+//import org.junit.Test;
+//import org.junit.runner.RunWith;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.boot.test.context.SpringBootTest;
+//import org.springframework.test.context.junit4.SpringRunner;
+//
+//import java.util.ArrayList;
+//import java.util.List;
+//
+///**
+// * @Module TODO
+// * @Description TODO
+// * @Author liukaixiong
+// * @Date 2020/11/10 10:57
+// */
+//@RunWith(SpringRunner.class)
+//@SpringBootTest(classes = {MonitorServerApplication.class})
+//public class JayMonitorMqLogMapperExtTest {
+//    @Autowired
+//    private JayMonitorMqLogMapperExt jayMonitorMqLogMapperExt;
+//
+//    @Test
+//    public void batchInsert() {
+//        List<JayMonitorMqLog> monitorMqs = new ArrayList<>();
+//        JayMonitorMqLog jq = new JayMonitorMqLog();
+//        for (int i = 0; i < 10; i++) {
+//            JayMonitorMqLog jayMonitorMq = new JayMonitorMqLog();
+//            jayMonitorMq.setLogId("aaa");
+//            jayMonitorMq.setRootLogId("test");
+//            jayMonitorMq.setLogText("1231231");
+//            monitorMqs.add(jayMonitorMq);
+//            jq.setMonitorId(jayMonitorMq.getId());
+//        }
+//        jayMonitorMqLogMapperExt.batchInsert(monitorMqs);
+//        System.out.println("=======");
+//    }
+//}

+ 13 - 2
jay-monitor-data-server/src/test/java/com/jay/monitor/data/server/model/TestDataRequest.java

@@ -1,5 +1,16 @@
 package com.jay.monitor.data.server.model;
 
+import com.jay.monitor.data.server.config.props.MonitorProperties;
+import com.jay.monitor.data.server.factory.DataIdFactory;
+import com.jay.monitor.data.server.factory.callback.DefaultIdChangeCallback;
+import com.jay.monitor.data.server.factory.generate.DayIdGenerate;
+import com.jay.monitor.data.server.store.SplitDataManager;
+import com.jay.monitor.data.server.store.mysql.MysqlDDLProcess;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
 import java.io.Serializable;
 
 /**
@@ -8,14 +19,14 @@ import java.io.Serializable;
  * @author : liukx
  * @time : 2020/8/26 - 14:49
  */
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {MonitorProperties.class, DataSourceAutoConfiguration.class, MysqlDDLProcess.class, SplitDataManager.class, DayIdGenerate.class, DataIdFactory.class, DefaultIdChangeCallback.class})
 public class TestDataRequest implements Serializable {
 
     private String name;
 
-
     private String msg;
 
-
     public TestDataRequest(String name,  String msg) {
         this.name = name;
         this.msg = msg;

+ 0 - 6
jay-monitor-data-server/src/test/resources/application.yml

@@ -44,12 +44,6 @@ mybatis-plus:
   type-aliases-package: com.jay.monitor.data.server.daos
   config-location: classpath:/mybatis/mybatis-config.xml
 
-  security:
-    oauth2:
-      client:
-        provider:
-          fff:
-            tokenUri: http
 swagger2:
   basePackage: com.jay.monitor.data.server.controllers
   title: backstage