新增采集器终端netty 服务

segment2.0
linrf 2 years ago
parent 200243f524
commit 5429d71ac9

@ -6,7 +6,7 @@
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>collector-scheduling-management</artifactId>
<artifactId>collector-scheduling-management-linrf</artifactId>
<name>Archetype - collector-scheduling-management</name>
<url>http://maven.apache.org</url>

@ -1,33 +1,33 @@
//package com.docus.server;
//
//import com.baomidou.mybatisplus.generator.AutoGenerator;
//import com.docus.infrastructure.generator.BaseCodeGenerator;
//
//import java.util.HashMap;
//import java.util.Map;
//
//public class CodeGenerator {
// public static void main(String[] args) {
// //字段名和枚举名的映射,不区分表名
// Map<String, String> enumColumnMap = new HashMap<>();
// enumColumnMap.put("PROFILE_ITЕM", "AdminProfileItemEnum");
//
// enumColumnMap.put("ORGANIZATION_TYPE", "OrganizationTypeEnum ");
// enumColumnMap.put("OPERATE_STATUS", "OperateStatusEnum");
// enumColumnMap.put("STATE", "StateEnum");
// enumColumnMap.put("PRIVILEGE_LEVEL", "PrivilegeLevelEnum");
// enumColumnMap.put("FLAG", "FlagEnum");
// enumColumnMap.put("collect_type", "CollectTypeEnum");
// BaseCodeGenerator.setEnumColumnMap(enumColumnMap);
// BaseCodeGenerator.setModuleName("collector-scheduling-management");//多个module需要指定modulename
// //指定entity生成到独立module里并生成 api interface
// BaseCodeGenerator.setClientInterfaceModuleName("docus-client-interface");
// BaseCodeGenerator.setClientInterfaceSubFolder("scheduling.management");//文件夹
// BaseCodeGenerator.setClientInterfaceBasePackage("com.docus.server");
// AutoGenerator defaultConfig = BaseCodeGenerator.getDefaultConfig();
// defaultConfig.getGlobalConfig().setSwagger2(true);
// defaultConfig.getStrategy().setEntityLombokModel(true);
// defaultConfig.getStrategy().setInclude("sch_virtual_log", "sch_collect_error_log", "sch_collect_record", "sch_collect_record_retry_log", "sch_collector", "sch_collector_config", "sch_collector_version", "sch_collector_version_file", "sch_collector_version_log", "sch_operation_log", "sch_system_params", "sch_terminator");//需要生成的表,可指定多个,留空为全部生成
// BaseCodeGenerator.generate(defaultConfig);
// }
//}
package com.docus.server;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.docus.infrastructure.generator.BaseCodeGenerator;
import java.util.HashMap;
import java.util.Map;
public class CodeGenerator {
public static void main(String[] args) {
//字段名和枚举名的映射,不区分表名
Map<String, String> enumColumnMap = new HashMap<>();
enumColumnMap.put("PROFILE_ITЕM", "AdminProfileItemEnum");
enumColumnMap.put("ORGANIZATION_TYPE", "OrganizationTypeEnum ");
enumColumnMap.put("OPERATE_STATUS", "OperateStatusEnum");
enumColumnMap.put("STATE", "StateEnum");
enumColumnMap.put("PRIVILEGE_LEVEL", "PrivilegeLevelEnum");
enumColumnMap.put("FLAG", "FlagEnum");
enumColumnMap.put("collect_type", "CollectTypeEnum");
BaseCodeGenerator.setEnumColumnMap(enumColumnMap);
BaseCodeGenerator.setModuleName("collector-scheduling-management");//多个module需要指定modulename
//指定entity生成到独立module里并生成 api interface
BaseCodeGenerator.setClientInterfaceModuleName("docus-client-interface");
BaseCodeGenerator.setClientInterfaceSubFolder("scheduling.management");//文件夹
BaseCodeGenerator.setClientInterfaceBasePackage("com.docus.server");
AutoGenerator defaultConfig = BaseCodeGenerator.getDefaultConfig();
defaultConfig.getGlobalConfig().setSwagger2(true);
defaultConfig.getStrategy().setEntityLombokModel(true);
defaultConfig.getStrategy().setInclude("sch_collector_copy1");//需要生成的表,可指定多个,留空为全部生成
BaseCodeGenerator.generate(defaultConfig);
}
}

@ -5,14 +5,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
import javax.annotation.PreDestroy;
@EnableAsync
@EnableFeignClients(basePackages = {"com.docus.core.excel.feign", "com.docus.server.api.taskdistribute"})
@SpringBootApplication(scanBasePackages = {"com.docus"})
public class AppRunBootstrap {
public class ScheduleBootstrap {
public static void main(String[] args) {
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
SpringApplication.run(AppRunBootstrap.class, args);
SpringApplication.run(ScheduleBootstrap.class, args);
}
}

@ -9,7 +9,6 @@ import com.docus.server.common.netty.server.ChannelRepository;
import com.docus.server.dto.scheduling.management.schterminator.NettyTerminatorDTO;
import com.docus.server.enums.BusyStateEnum;
import com.docus.server.enums.OnlineStateEnum;
import com.fasterxml.jackson.core.type.TypeReference;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
@ -22,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.Serializable;
import java.net.InetSocketAddress;
/**
@ -52,12 +52,11 @@ public class NettyBusinessHandler extends SimpleChannelInboundHandler<ByteBuf> {
return;
}
CommMsg<TerminatorContent> commMsg = JSON.fromJSONWithGeneric(message, new TypeReference<CommMsg<TerminatorContent>>() {
});
CommMsg commMsg = JSON.fromJSON(message, CommMsg.class);
String messageType = commMsg.getMessageType();
String messageTime = commMsg.getMessageTime();
TerminatorContent messageContent = commMsg.getContent();
Serializable messageContent = commMsg.getContent();
if (messageType.equals(MsgConstants.TERMINATOR_RESTART)) {
log.info("接受到终端重启命令,内容{}", messageContent);

@ -9,13 +9,13 @@ import com.docus.server.common.netty.server.ChannelRepository;
import com.docus.server.dto.scheduling.management.schterminator.NettyTerminatorDTO;
import com.docus.server.enums.BusyStateEnum;
import com.docus.server.enums.OnlineStateEnum;
import com.fasterxml.jackson.core.type.TypeReference;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
import java.net.InetSocketAddress;
/**
@ -39,19 +39,18 @@ public class NettyHeartbeatHandler extends ChannelInboundHandlerAdapter {
return;
}
CommMsg<TerminatorContent> commMsg = JSON.fromJSONWithGeneric(message, new TypeReference<CommMsg<TerminatorContent>>() {
});
CommMsg commMsg = JSON.fromJSON(message, CommMsg.class);
String messageType = commMsg.getMessageType();
String messageTime = commMsg.getMessageTime();
TerminatorContent messageContent = commMsg.getContent();
Serializable content = commMsg.getContent();
if (messageType.equals(MsgConstants.HEARTBEAT_REQUEST)) {
log.info("接收到客户端的心跳");
log.info("接受到【采集器-终端】的心跳消息:消息类型={},消息时间={},消息内容={}", messageType, messageTime, messageContent);
log.info("接受到【采集器-终端】的心跳消息:消息类型={},消息时间={},消息内容={}", messageType, messageTime, content);
InetSocketAddress ipSocket = (InetSocketAddress) ctx.channel().remoteAddress();
String clientIp = ipSocket.getAddress().getHostAddress();

@ -3,7 +3,7 @@ api.base-package=com.docus.server
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://db.docus.cn:3306/docus-collector-scheduling?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.username=docus
spring.datasource.password=docus702
mybatis-plus.type-enums-package=com.docus.server.enums

@ -0,0 +1,73 @@
<assembly xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.0.0.xsd">
<id>exe</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<outputDirectory>/lib</outputDirectory>
<directory>${basedir}/target/lib</directory>
</fileSet>
<fileSet>
<outputDirectory>/config</outputDirectory>
<directory>${basedir}/target/resources</directory>
<fileMode>0755</fileMode>
<includes>
<include>*.xml</include>
<include>*.yml</include>
<include>*.properties</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory>/dataConfig</outputDirectory>
<directory>${basedir}/target/dataConfig</directory>
<fileMode>0755</fileMode>
<includes>
<include>*.json</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory>/</outputDirectory>
<directory>${basedir}/target/resources/bin</directory>
<fileMode>0755</fileMode>
<includes>
<include>*.bat</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory>/</outputDirectory>
<directory>${basedir}/target/resources/bin</directory>
<fileMode>0755</fileMode>
<includes>
<include>*.xml</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory>/</outputDirectory>
<directory>${basedir}</directory>
<fileMode>0755</fileMode>
<includes>
<include>*.exe</include>
</includes>
</fileSet>
<!-- 将项目启动jar打包到boot目录中 -->
<fileSet>
<directory>${basedir}/target</directory>
<outputDirectory>/</outputDirectory>
<fileMode>0755</fileMode>
<includes>
<include>${project.build.finalName}.jar</include>
</includes>
</fileSet>
</fileSets>
</assembly>

@ -0,0 +1,185 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>docus-collector-server</artifactId>
<groupId>com.docus</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>collector-terminal-management[0]</artifactId>
<name>Archetype - collector-scheduling-management</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>com.docus</groupId>
<artifactId>docus-api-common</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.30</version>
</dependency>
<dependency>
<groupId>cn.smallbun.screw</groupId>
<artifactId>screw-core</artifactId>
<version>1.0.3</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<!--打包时去除第三方依赖-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.4</version>
<configuration>
<layout>ZIP</layout>
<includes>
<include>
<groupId>non-exists</groupId>
<artifactId>non-exists</artifactId>
</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!--拷贝第三方依赖文件到指定目录-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<!--target/lib是依赖jar包的输出目录根据自己喜好配置-->
<outputDirectory>target/lib</outputDirectory>
<excludeTransitive>false</excludeTransitive>
<stripVersion>false</stripVersion>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<!-- copy资源文件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<outputDirectory>${project.build.directory}/resources</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-bin</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>bin/*.xml</include>
<include>bin/*.bat</include>
<include>*.yml</include>
<include>*.ftl</include>
</includes>
</resource>
</resources>
<outputDirectory>${project.build.directory}/resources</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-data-config</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>../../dataConfig</directory>
<filtering>true</filtering>
</resource>
</resources>
<outputDirectory>${project.build.directory}/dataConfig</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- 打jar包时忽略配置文件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<excludes>
<exclude>**/*.yml</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<configuration>
<finalName>${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,33 @@
package com.docus.server;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.docus.infrastructure.generator.BaseCodeGenerator;
import java.util.HashMap;
import java.util.Map;
public class CodeGenerator {
public static void main(String[] args) {
//字段名和枚举名的映射,不区分表名
Map<String, String> enumColumnMap = new HashMap<>();
enumColumnMap.put("PROFILE_ITЕM", "AdminProfileItemEnum");
enumColumnMap.put("ORGANIZATION_TYPE", "OrganizationTypeEnum ");
enumColumnMap.put("OPERATE_STATUS", "OperateStatusEnum");
enumColumnMap.put("STATE", "StateEnum");
enumColumnMap.put("PRIVILEGE_LEVEL", "PrivilegeLevelEnum");
enumColumnMap.put("FLAG", "FlagEnum");
enumColumnMap.put("collect_type", "CollectTypeEnum");
BaseCodeGenerator.setEnumColumnMap(enumColumnMap);
BaseCodeGenerator.setModuleName("collector-scheduling-management");//多个module需要指定modulename
//指定entity生成到独立module里并生成 api interface
BaseCodeGenerator.setClientInterfaceModuleName("docus-client-interface");
BaseCodeGenerator.setClientInterfaceSubFolder("scheduling.management");//文件夹
BaseCodeGenerator.setClientInterfaceBasePackage("com.docus.server");
AutoGenerator defaultConfig = BaseCodeGenerator.getDefaultConfig();
defaultConfig.getGlobalConfig().setSwagger2(true);
defaultConfig.getStrategy().setEntityLombokModel(true);
defaultConfig.getStrategy().setInclude("sch_collector_copy1");//需要生成的表,可指定多个,留空为全部生成
BaseCodeGenerator.generate(defaultConfig);
}
}

@ -0,0 +1,17 @@
package com.docus.server;
import com.docus.infrastructure.WebConfig;
import com.docus.infrastructure.web.json.JsonSerializerModule;
import com.docus.server.common.serializer.DefJsonSerializerModule;
import org.springframework.context.annotation.Configuration;
@Configuration
public class DefaultWebConfig extends WebConfig {
@Override
public JsonSerializerModule jsonSerializerModu1e() {
super.jsonSerializerModu1e();
return new DefJsonSerializerModule();
}
}

@ -0,0 +1,16 @@
package com.docus.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
@EnableAsync
@EnableFeignClients(basePackages = {"com.docus.core.excel.feign", "com.docus.server.api.taskdistribute"})
@SpringBootApplication(scanBasePackages = {"com.docus"})
public class TerminalBootstrap {
public static void main(String[] args) {
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
SpringApplication.run(TerminalBootstrap.class, args);
}
}

@ -0,0 +1,55 @@
package com.docus.server.common;
public class MsgConstants {
/**
*
*/
public static final String HEARTBEAT_REQUEST = "0".trim();
/**
* 线
*/
public static final String ONLINE_REGISTER = "1".trim();
/**
* 线
*/
public static final String OFFLINE_REMOVE = "2".trim();
/**
*
*/
public static final String EXCEPTION_REMOVE = "3".trim();
/**
*
*/
public static final String TERMINATOR_RESTART = "4".trim();
/**
*
*/
public static final String COLLECTOR_RESTART = "5".trim();
/**
*
*/
public static final String VIRTUAL_RESTART = "6".trim();
/**
*
*/
public static final String UPDATE_COLLECTOR_FILE = "7".trim();
/**
*
*/
public static final String UPDATE_COLLECTOR_CONFIG = "8".trim();
/**
*
*/
public static final String SCH_DISTRIBUTE_TASKS = "9".trim();
}

@ -0,0 +1,30 @@
package com.docus.server.common;
import com.docus.infrastructure.redis.listener.RedisKeyExpirationListener;
import com.docus.server.service.impl.RedisKeyExpirationService;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class RedisCollectorTaskKeyExpirationListener extends RedisKeyExpirationListener {
@Resource
private RedisKeyExpirationService redisKeyExpirationService;
public RedisCollectorTaskKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {
super(listenerContainer);
}
@Override
protected void processExpireKey(String expireKey) {
redisKeyExpirationService.expired(expireKey);
}
@Override
protected boolean validExpireKey(String expireKey) {
return expireKey.startsWith("schCollectorRecord:noRetryTask:expireKey:")
|| expireKey.startsWith("schCollectorRecord:isRetryTask:expireKey:");
}
}

@ -0,0 +1,439 @@
package com.docus.server.common;
import com.docus.core.util.DateUtil;
import com.docus.core.util.Func;
import com.docus.core.util.json.JSON;
import com.docus.infrastructure.redis.service.RedisOps;
import com.docus.server.api.taskdistribute.TaskDistributeApi;
import com.docus.server.common.netty.CommMsg;
import com.docus.server.common.netty.server.ChannelRepository;
import com.docus.server.dto.scheduling.management.schcollector.task.ReportDownTwoDTO;
import com.docus.server.dto.scheduling.management.schcollector.task.ReportTaskTwoDTO;
import com.docus.server.dto.scheduling.management.schcollector.task.SchCollectorTaskDTO;
import com.docus.server.dto.scheduling.management.schterminator.NettyTerminatorDTO;
import com.docus.server.entity.scheduling.management.SchCollectRecord;
import com.docus.server.entity.scheduling.management.SchCollectRecordRetryLog;
import com.docus.server.entity.scheduling.management.SchCollector;
import com.docus.server.enums.BusyStateEnum;
import com.docus.server.enums.RetryTaskEnum;
import com.docus.server.service.ISchCollectRecordRetryLogService;
import com.docus.server.service.ISchCollectRecordService;
import com.docus.server.service.ISchCollectorService;
import com.docus.server.service.ISchTerminatorService;
import com.google.common.collect.Lists;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.util.CharsetUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
@Component
@Slf4j
public class SchCollectorTask {
@Resource
private ChannelRepository channelRepository;
@Resource
private TaskDistributeApi taskDistributeApi;
@Resource
private ISchCollectRecordService iSchCollectRecordService;
@Resource
private ISchCollectRecordRetryLogService iSchCollectRecordRetryLogService;
@Resource
private ISchTerminatorService iSchTerminatorService;
@Resource
private ISchCollectorService iSchCollectorService;
@Resource
private RedisOps redisOps;
private BlockingQueue<ReportDownTwoDTO> retryTaskQueue = new LinkedBlockingQueue<>();
//定时任务
// 5 * * * * ? 在每分钟的5秒执行
@Scheduled(cron = "0/1 * * * * ?")
public void runTask() {
try {
log.info("定时任务: 开始执行");
//在线并且空闲的终端
List<NettyTerminatorDTO> terminalList = channelRepository.getAvailTerminator();
//没有可用的通道
if (Func.isEmpty(terminalList)) {
return;
}
//:todo 任务平台需要修改发布任务策略
List<ReportDownTwoDTO> reportDownTwoDTOList = getTask(terminalList.size());
if (Func.isEmpty(reportDownTwoDTOList) || Func.isBlank(reportDownTwoDTOList.get(0).getPatientId())) {
return;
}
//只采集,有优先级的
for (NettyTerminatorDTO terminal : terminalList) {
for (ReportDownTwoDTO report : reportDownTwoDTOList) {
//先找出有只采集的任务。
ReportTaskTwoDTO reportTaskTwoDto = report.getTasks().get(0);
if (!CollectionUtils.isEmpty(terminal.getOnlyCollectorIds()) && terminal.getOnlyCollectorIds().contains(reportTaskTwoDto.getCollectorId())
&& BusyStateEnum.IDLE.equals(terminal.getBusyState())) {
//把这个任务派给这个终端,并且把这个终端设置成繁忙
if (!CollectionUtils.isEmpty(terminal.getPriorityCollectorIds()) && terminal.getPriorityCollectorIds().contains(reportTaskTwoDto.getCollectorId())) {
//把这个任务派给这个终端
terminal.setBusyState(BusyStateEnum.BUSY);
iSchTerminatorService.saveOrUpdate(terminal.getTerminatorIp(), terminal);
tcpToClient(terminal, report);
}
return;
}
}
}
//只采集没有优先级
for (NettyTerminatorDTO terminal : terminalList) {
//把刚才已经分配任务过的采集器排除
if (BusyStateEnum.BUSY.equals(terminal.getBusyState())) {
continue;
}
for (ReportDownTwoDTO report : reportDownTwoDTOList) {
//先找出有只采集的任务。
ReportTaskTwoDTO reportTaskTwoDto = report.getTasks().get(0);
if (!CollectionUtils.isEmpty(terminal.getOnlyCollectorIds()) && terminal.getOnlyCollectorIds().contains(reportTaskTwoDto.getCollectorId())
&& BusyStateEnum.IDLE.equals(terminal.getBusyState())) {
//把这个任务派给这个终端,并且把这个终端设置成繁忙
terminal.setBusyState(BusyStateEnum.BUSY);
iSchTerminatorService.saveOrUpdate(terminal.getTerminatorIp(), terminal);
tcpToClient(terminal, report);
return;
}
}
}
//无只采集,有优先级
for (NettyTerminatorDTO terminal : terminalList) {
//把刚才已经分配任务过的采集器排除
if (BusyStateEnum.BUSY.equals(terminal.getBusyState())) {
continue;
}
for (ReportDownTwoDTO report : reportDownTwoDTOList) {
//先找出有只采集的任务。
ReportTaskTwoDTO reportTaskTwoDto = report.getTasks().get(0);
if (!CollectionUtils.isEmpty(terminal.getPriorityCollectorIds()) && terminal.getPriorityCollectorIds().contains(reportTaskTwoDto.getCollectorId())
&& BusyStateEnum.IDLE.equals(terminal.getBusyState())) {
//把这个任务派给这个终端
terminal.setBusyState(BusyStateEnum.BUSY);
iSchTerminatorService.saveOrUpdate(terminal.getTerminatorIp(), terminal);
tcpToClient(terminal, report);
return;
}
}
}
//无只采集,无优先级
for (NettyTerminatorDTO terminal : terminalList) {
//把刚才已经分配任务过的采集器排除
if (BusyStateEnum.BUSY.equals(terminal.getBusyState())) {
continue;
}
for (ReportDownTwoDTO report : reportDownTwoDTOList) {
//先找出有只采集的任务。
//把这个任务派给这个终端
ReportTaskTwoDTO reportTaskTwoDto = report.getTasks().get(0);
terminal.setBusyState(BusyStateEnum.BUSY);
iSchTerminatorService.saveOrUpdate(terminal.getTerminatorIp(), terminal);
tcpToClient(terminal, report);
return;
}
}
//只采集,空闲的。
//获取只采集的任务,并且进行分配。
for (NettyTerminatorDTO terminal : terminalList) {
//把刚才已经分配任务过的采集器排除
if (BusyStateEnum.BUSY.equals(terminal.getBusyState())) {
continue;
}
List<ReportDownTwoDTO> onlyTaskInfos = getOnlyTaskInfos(terminal.getOnlyCollectorIds());
if (CollectionUtils.isEmpty(onlyTaskInfos) || Func.isBlank(onlyTaskInfos.get(0).getPatientId())) {
return;
}
for (ReportDownTwoDTO report : onlyTaskInfos) {
//将这条任务分配这个这个终端
//下发
terminal.setBusyState(BusyStateEnum.BUSY);
iSchTerminatorService.saveOrUpdate(terminal.getTerminatorIp(), terminal);
tcpToClient(terminal, report);
return;
}
}
log.info("定时任务: 执行完毕");
} catch (
Exception e) {
log.error("定时任务执行出错", e);
}
}
private void tcpToClient(NettyTerminatorDTO terminal, ReportDownTwoDTO reportDownTwoDTO) {
Channel channel = channelRepository.get(terminal.getTerminatorIp());
Map<String, Object> params = reportDownTwoDTO.getParams();
SchCollectorTaskDTO messageContent = new SchCollectorTaskDTO();
if (CollectionUtils.isEmpty(params)) {
//不是重试任务
SchCollectRecord schCollectRecord = iSchCollectRecordService.saveOrUpdateRecord(terminal, reportDownTwoDTO);
messageContent.setCollectorRecordId(schCollectRecord.getId());
messageContent.setIsRetry(String.valueOf(RetryTaskEnum.NO_RETRY_TASK.getValue()));
messageContent.setTaskInfo(reportDownTwoDTO);
} else {
//重试任务
SchCollectRecordRetryLog schCollectRecordRetryLog = iSchCollectRecordRetryLogService.saveOrUpdateRecordRetryLog(terminal, reportDownTwoDTO);
messageContent.setCollectorRecordId(schCollectRecordRetryLog.getId());
messageContent.setIsRetry(String.valueOf(RetryTaskEnum.RETRY_TASK.getValue()));
messageContent.setTaskInfo(reportDownTwoDTO);
}
CommMsg commMsg = CommMsg.builder()
.messageType(MsgConstants.SCH_DISTRIBUTE_TASKS)
.messageTime(DateUtil.formatDateTime(new Date()))
.content(JSON.toJSON(messageContent))
.build();
//tcp 下发任务到终端
if (channel != null) {
channel.writeAndFlush(Unpooled.copiedBuffer(JSON.toJSON(commMsg), CharsetUtil.UTF_8));
}
String isRetry = messageContent.getIsRetry();
Long collectorRecordId = messageContent.getCollectorRecordId();
String collectorId = messageContent.getTaskInfo().getTasks().get(0).getCollectorId();
SchCollector schCollector = iSchCollectorService.findByCollectorId(collectorId);
if (RetryTaskEnum.NO_RETRY_TASK.equals(isRetry)) {
redisOps.setEx(String.format("schCollectorRecord:noRetryTask:expireKey:%s", collectorRecordId), String.valueOf(collectorRecordId), schCollector.getTaskTimeout());
} else {
redisOps.setEx(String.format("schCollectorRecord:isRetryTask:expireKey:%s", collectorRecordId), String.valueOf(collectorRecordId), schCollector.getTaskTimeout());
}
}
public void addRetryTask(ReportDownTwoDTO reportDownTwoDTO) {
this.retryTaskQueue.add(reportDownTwoDTO);
}
//根据有效终端一次获取一批任务例如10个终端获取10个不同类型任务
public List<ReportDownTwoDTO> getTask(int size) throws InterruptedException {
// return taskDistributeApi.getTask(String.valueOf(size));
//mock
String collectorId1 = "{\n" +
" \"createTime\": \"2022-12-03 12:39:30\",\n" +
" \"hospitals\": [\n" +
" {\n" +
" \"admissDate\": \"2023-12-31 01:01:01\",\n" +
" \"admissId\": \"amid_999901\",\n" +
" \"admissTimes\": 1,\n" +
" \"disDate\": \"2023-12-31 01:01:01\",\n" +
" \"disDeptName\": \"22222\",\n" +
" \"patientId\": \"758878610105573376\"\n" +
" }\n" +
" ],\n" +
" \"jzh\": \"jzh_999901\",\n" +
" \"patient\": {\n" +
" \"inpatientNo\": \"999901\",\n" +
" \"name\": \"ceshi\",\n" +
" \"patientId\": \"758878610105573376\"\n" +
" },\n" +
" \"patientId\": \"758878610105573376\",\n" +
" \"recordType\": \"1\",\n" +
" \"tasks\": [\n" +
" {\n" +
" \"collectorId\": \"1\",\n" +
" \"patientId\": \"758878610105573376\",\n" +
" \"taskId\": 834292710565826560\n" +
" }\n" +
" ]\n" +
"}";
ReportDownTwoDTO reportDownTwoDTO1 = JSON.fromJSON(collectorId1, ReportDownTwoDTO.class);
String collectorId2 = "{\n" +
" \"createTime\": \"2022-12-03 12:39:30\",\n" +
" \"hospitals\": [\n" +
" {\n" +
" \"admissDate\": \"2023-12-31 01:01:01\",\n" +
" \"admissId\": \"amid_999901\",\n" +
" \"admissTimes\": 1,\n" +
" \"disDate\": \"2023-12-31 01:01:01\",\n" +
" \"disDeptName\": \"22222\",\n" +
" \"patientId\": \"758878610105573376\"\n" +
" }\n" +
" ],\n" +
" \"jzh\": \"jzh_999901\",\n" +
" \"patient\": {\n" +
" \"inpatientNo\": \"999901\",\n" +
" \"name\": \"ceshi\",\n" +
" \"patientId\": \"758878610105573376\"\n" +
" },\n" +
" \"patientId\": \"758878610105573376\",\n" +
" \"recordType\": \"1\",\n" +
" \"tasks\": [\n" +
" {\n" +
" \"collectorId\": \"2\",\n" +
" \"patientId\": \"758878610105573376\",\n" +
" \"taskId\": 834292712465846272\n" +
" }\n" +
" ]\n" +
"}";
ReportDownTwoDTO reportDownTwoDTO2 = JSON.fromJSON(collectorId2, ReportDownTwoDTO.class);
String collectorId3 = "{\n" +
" \"createTime\": \"2023-01-09 19:26:11\",\n" +
" \"hospitals\": [\n" +
" {\n" +
" \"admissDate\": \"2023-12-31 01:01:01\",\n" +
" \"admissId\": \"amid_297974\",\n" +
" \"admissTimes\": 21,\n" +
" \"disDate\": \"2023-12-31 01:01:01\",\n" +
" \"disDeptName\": \"普外二科(甲乳胸烧伤整形)\",\n" +
" \"patientId\": \"772389719349678080\"\n" +
" }\n" +
" ],\n" +
" \"jzh\": \"jzh_297974\",\n" +
" \"patient\": {\n" +
" \"inpatientNo\": \"297974\",\n" +
" \"name\": \"曾美英\",\n" +
" \"patientId\": \"772389719349678080\"\n" +
" },\n" +
" \"patientId\": \"772389719349678080\",\n" +
" \"recordType\": \"1\",\n" +
" \"tasks\": [\n" +
" {\n" +
" \"collectorId\": \"3\",\n" +
" \"patientId\": \"772389719349678080\",\n" +
" \"taskId\": 838201379426750464\n" +
" }\n" +
" ]\n" +
"}";
ReportDownTwoDTO reportDownTwoDTO3 = JSON.fromJSON(collectorId3, ReportDownTwoDTO.class);
// List<ReportDownTwoDTO> allTaskList = Lists.newArrayList(reportDownTwoDTO1, reportDownTwoDTO2, reportDownTwoDTO3);
List<ReportDownTwoDTO> allTaskList = new ArrayList<>();
if (!CollectionUtils.isEmpty(this.retryTaskQueue)) {
ReportDownTwoDTO retryTask = (ReportDownTwoDTO) this.retryTaskQueue.take();
//重试任务
allTaskList.add(retryTask);
}
return allTaskList;
}
//根据采集器id类型一次获取一批采集器类型任务
private List<ReportDownTwoDTO> getOnlyTaskInfos(List<String> collectorIds) {
// return taskDistributeApi.getTask(collectorIds.get(0));
//mock
String collectorId2 = "{\n" +
" \"createTime\": \"2022-12-03 12:39:30\",\n" +
" \"hospitals\": [\n" +
" {\n" +
" \"admissDate\": \"2023-12-31 01:01:01\",\n" +
" \"admissId\": \"amid_999901\",\n" +
" \"admissTimes\": 1,\n" +
" \"disDate\": \"2023-12-31 01:01:01\",\n" +
" \"disDeptName\": \"22222\",\n" +
" \"patientId\": \"758878610105573376\"\n" +
" }\n" +
" ],\n" +
" \"jzh\": \"jzh_999901\",\n" +
" \"patient\": {\n" +
" \"inpatientNo\": \"999901\",\n" +
" \"name\": \"ceshi\",\n" +
" \"patientId\": \"758878610105573376\"\n" +
" },\n" +
" \"patientId\": \"758878610105573376\",\n" +
" \"recordType\": \"1\",\n" +
" \"tasks\": [\n" +
" {\n" +
" \"collectorId\": \"2\",\n" +
" \"patientId\": \"758878610105573376\",\n" +
" \"taskId\": 834292712465846272\n" +
" }\n" +
" ]\n" +
"}";
ReportDownTwoDTO reportDownTwoDTO2 = JSON.fromJSON(collectorId2, ReportDownTwoDTO.class);
String collectorId3 = "{\n" +
" \"createTime\": \"2022-12-03 12:39:30\",\n" +
" \"hospitals\": [\n" +
" {\n" +
" \"admissDate\": \"2023-12-31 01:01:01\",\n" +
" \"admissId\": \"amid_999901\",\n" +
" \"admissTimes\": 1,\n" +
" \"disDate\": \"2023-12-31 01:01:01\",\n" +
" \"disDeptName\": \"22222\",\n" +
" \"patientId\": \"758878610105573376\"\n" +
" }\n" +
" ],\n" +
" \"jzh\": \"jzh_999901\",\n" +
" \"patient\": {\n" +
" \"inpatientNo\": \"999901\",\n" +
" \"name\": \"ceshi\",\n" +
" \"patientId\": \"758878610105573376\"\n" +
" },\n" +
" \"patientId\": \"758878610105573376\",\n" +
" \"recordType\": \"1\",\n" +
" \"tasks\": [\n" +
" {\n" +
" \"collectorId\": \"3\",\n" +
" \"patientId\": \"758878610105573376\",\n" +
" \"taskId\": 834292883635392512\n" +
" }\n" +
" ]\n" +
"}";
ReportDownTwoDTO reportDownTwoDTO3 = JSON.fromJSON(collectorId3, ReportDownTwoDTO.class);
return Lists.newArrayList(reportDownTwoDTO2, reportDownTwoDTO3);
}
}

@ -0,0 +1,31 @@
package com.docus.server.common;
import com.docus.server.entity.scheduling.management.SchTerminator;
import com.docus.server.enums.BusyStateEnum;
import com.docus.server.enums.OnlineStateEnum;
import com.docus.server.service.ISchTerminatorService;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
/**
*
*/
@Component
public class TerminatorListener implements ApplicationListener<ContextRefreshedEvent> {
@Resource
private ISchTerminatorService iSchTerminatorService;
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
List<SchTerminator> terminators = iSchTerminatorService.findAll();
terminators.forEach(p -> {
p.setBusyState(BusyStateEnum.IDLE);
p.setOnlineState(OnlineStateEnum.OFFLINE);
});
iSchTerminatorService.batchUpdate(terminators);
}
}

@ -0,0 +1,22 @@
package com.docus.server.common.netty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class CommMsg<MSG_CONTENT extends Serializable> implements Serializable {
public String messageType;
public String messageTime;
public MSG_CONTENT content;
}

@ -0,0 +1,71 @@
package com.docus.server.common.netty.client;
import com.docus.core.util.json.JSON;
import com.docus.server.common.netty.CommMsg;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;
/**
* Created by 1-point at 2021/9/7
* Netty
*/
@Slf4j
@Component
public class NettyClient {
@Resource
private NettyClientProperties nettyProperties;
@Value("${spring.application.name}")
private String appName;
private SocketChannel socketChannel;
/**
*
*
* @param message
*/
public void sendMessage(CommMsg message) {
boolean success = socketChannel.writeAndFlush(JSON.toJSON(message)).isSuccess();
if (success) {
log.info("发送消息成功");
}
}
@PostConstruct
public void start() {
final EventLoopGroup group = new NioEventLoopGroup();
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(group)
.channel(NioSocketChannel.class)
.remoteAddress(nettyProperties.getHost(), nettyProperties.getPort())
.option(ChannelOption.SO_KEEPALIVE, true)
.option(ChannelOption.TCP_NODELAY, true)
.handler(new NettyClientInitializer(nettyProperties, this, appName));
ChannelFuture future = bootstrap.connect();
//客户端断线重连逻辑
future.addListener((ChannelFutureListener) status -> {
if (status.isSuccess()) {
log.info("连接Netty服务端成功");
} else {
log.warn("连接失败,进行断线重连");
status.channel().eventLoop().schedule(this::start, nettyProperties.getReconnectSeconds(), TimeUnit.SECONDS);
}
});
socketChannel = (SocketChannel) future.channel();
}
}

@ -0,0 +1,41 @@
package com.docus.server.common.netty.client;
import com.docus.server.common.netty.client.handler.ClientHandler;
import com.docus.server.common.netty.client.handler.HeartbeatHandler;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.handler.timeout.IdleStateHandler;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
public class NettyClientInitializer extends ChannelInitializer<Channel> {
private NettyClientProperties nettyProperties;
private NettyClient nettyClient;
private String appName;
@Override
protected void initChannel(Channel channel) throws Exception {
channel.pipeline()
// 加载空闲监听器
.addLast(new IdleStateHandler(nettyProperties.getReaderIdleTimeSeconds(),
nettyProperties.getWriterIdleTimeSeconds(), nettyProperties.getAllIdleTimeSeconds()))
// 加载加码解码处理器,同时解决粘包拆包问题
// .addLast(new ProtobufVarint32FrameDecoder())
// .addLast(new ProtobufDecoder(Payload.Message.getDefaultInstance()))
// .addLast(new ProtobufVarint32LengthFieldPrepender())
// .addLast(new ProtobufEncoder())
// 加载心跳处理器
.addLast(new HeartbeatHandler(nettyClient, nettyProperties, appName))
// 加载业务处理器
.addLast(new ClientHandler())
.addLast();
}
}

@ -0,0 +1,32 @@
package com.docus.server.common.netty.client;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = NettyClientProperties.PREFIX)
public class NettyClientProperties {
public static final String PREFIX = "netty.client";
// 读空闲等待时间
private int readerIdleTimeSeconds = 0;
// 写空闲等待时间
private int writerIdleTimeSeconds = 10;
// 读写空闲等待时间
private int allIdleTimeSeconds = 0;
// 服务主机
private String host;
// 服务端口
private Integer port;
// 重连时间/秒
private int reconnectSeconds = 10;
}

@ -0,0 +1,76 @@
package com.docus.server.common.netty.client.handler;
import com.docus.core.util.StringUtils;
import com.docus.core.util.json.JSON;
import com.docus.server.common.MsgConstants;
import com.docus.server.common.netty.CommMsg;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
@Slf4j
public class ClientHandler extends SimpleChannelInboundHandler<ByteBuf> {
@Override
protected void channelRead0(ChannelHandlerContext context, ByteBuf msg) throws Exception {
ByteBuf buf = (ByteBuf) msg;
//创建目标大小的数组
byte[] barray = new byte[buf.readableBytes()];
//把数据从bytebuf转移到byte[]
buf.getBytes(0, barray);
//将byte[]转成字符串用于打印
String message = new String(barray);
//空消息不处理
if (!StringUtils.hasText(message)) {
return;
}
CommMsg commMsg = JSON.fromJSON(message, CommMsg.class);
String messageType = commMsg.getMessageType();
String messageTime = commMsg.getMessageTime();
Serializable messageContent = commMsg.getContent();
log.info("======== 收到服务端消息, 消息时间={}, 消息类型={}, 消息内容={}", messageTime, messageType, messageContent + " ======== ");
if (messageType.equals(MsgConstants.TERMINATOR_RESTART)) {
log.info("接受到终端重启命令,内容={}", messageContent);
}
if (messageType.equals(MsgConstants.COLLECTOR_RESTART)) {
log.info("收到采集器重启命令,内容={}", messageContent);
}
if (messageType.equals(MsgConstants.VIRTUAL_RESTART)) {
log.info("收到虚拟机重启命令,内容={}", messageContent);
}
if (messageType.equals(MsgConstants.UPDATE_COLLECTOR_FILE)) {
log.info("收到更新采集器文件命令,内容={}", messageContent);
}
if (messageType.equals(MsgConstants.UPDATE_COLLECTOR_CONFIG)) {
log.info("收到更新采集器配置命令,内容={}", messageContent);
}
if (messageType.equals(MsgConstants.SCH_DISTRIBUTE_TASKS)) {
log.info("收到采集调度器下发任务命令,内容={}", messageContent);
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
cause.printStackTrace();
Channel channel = ctx.channel();
if (channel.isActive()) {
ctx.close();
}
super.exceptionCaught(ctx, cause);
}
}

@ -0,0 +1,100 @@
package com.docus.server.common.netty.client.handler;
import com.docus.core.util.DateUtil;
import com.docus.core.util.json.JSON;
import com.docus.server.common.MsgConstants;
import com.docus.server.common.netty.CommMsg;
import com.docus.server.common.netty.client.NettyClient;
import com.docus.server.common.netty.client.NettyClientProperties;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.EventLoop;
import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent;
import io.netty.util.CharsetUtil;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
*
*/
@Slf4j
@AllArgsConstructor
@NoArgsConstructor
public class HeartbeatHandler extends ChannelInboundHandlerAdapter {
private NettyClient nettyClient;
private NettyClientProperties nettyProperties;
private String appName;
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
log.info("通道激活......");
// Payload.Message.Builder builder = Payload.Message.newBuilder()
// .setClient(appName)
// .setContent("我来了")
// .setCmd(Payload.Message.type.AUTH);
CommMsg onlineRegister = CommMsg.builder()
.messageType(MsgConstants.ONLINE_REGISTER)
.messageTime(DateUtil.formatDateTime(new Date()))
.content(appName + " 我来了")
.build();
ctx.writeAndFlush(Unpooled.copiedBuffer(JSON.toJSON(onlineRegister), CharsetUtil.UTF_8));
super.channelActive(ctx);
}
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
if (evt instanceof IdleStateEvent) {
IdleStateEvent idleStateEvent = (IdleStateEvent) evt;
if (idleStateEvent.state() == IdleState.WRITER_IDLE) {
// 一定时间内,通道内未传递消息,发送心跳,保证存活
log.info("after {} seconds no message wrote", nettyProperties.getWriterIdleTimeSeconds());
// Payload.Message heartbeat = Payload.Message
// .newBuilder()
// .setCmd(Payload.Message.type.HEARTBEAT_REQUEST)
// .build();
CommMsg heartbeat = CommMsg.builder()
.messageType(MsgConstants.HEARTBEAT_REQUEST)
.messageTime(DateUtil.formatDateTime(new Date()))
.build();
//发送心跳消息,并在发送失败时关闭该接连
ctx.writeAndFlush(Unpooled.copiedBuffer(JSON.toJSON(heartbeat), CharsetUtil.UTF_8)).addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
}
} else {
super.userEventTriggered(ctx, evt);
}
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
//如果运行过程中服务端挂了,执行重连机制
log.info("通道释放==================");
EventLoop eventLoop = ctx.channel().eventLoop();
eventLoop.schedule(() -> nettyClient.start(), nettyProperties.getReconnectSeconds(), TimeUnit.SECONDS);
super.channelInactive(ctx);
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
cause.printStackTrace();
log.error("捕获的异常:{}", cause.getMessage());
ctx.close();
}
}

@ -0,0 +1,106 @@
package com.docus.server.common.netty.server;
import com.docus.server.dto.scheduling.management.schterminator.NettyTerminatorDTO;
import com.docus.server.enums.BusyStateEnum;
import com.docus.server.enums.OnlineStateEnum;
import com.docus.server.service.ISchTerminatorService;
import com.docus.server.vo.scheduling.management.schterminator.SchTerminatorVO;
import io.netty.channel.Channel;
import io.netty.util.AttributeKey;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/**
* IP
*/
@Component
@Slf4j
public class ChannelRepository {
@Resource
private ISchTerminatorService iSchTerminatorService;
/**
* <IP-Channel>
*/
private final static Map<String, Channel> IP_CHANNEL_CACHE_MAP = new ConcurrentHashMap<>();
/**
* <IP-Terminator>
*/
private final static Map<String, NettyTerminatorDTO> IP_TERMINATOR_CACHE_MAP = new ConcurrentHashMap<>();
/**
* 线
*/
public void put(NettyTerminatorDTO nettyTerminatorDTO, Channel channel) {
//客户端上线
String terminatorIp = nettyTerminatorDTO.getTerminatorIp();
//更新数据库终端数据
SchTerminatorVO schTerminatorVO = iSchTerminatorService.saveOrUpdate(terminatorIp, nettyTerminatorDTO);
nettyTerminatorDTO.setId(schTerminatorVO.getId());
//缓存
IP_CHANNEL_CACHE_MAP.put(terminatorIp, channel);
IP_TERMINATOR_CACHE_MAP.put(terminatorIp, nettyTerminatorDTO);
AttributeKey<String> attributeKey = AttributeKey.valueOf("ip");
channel.attr(attributeKey).set(terminatorIp);
}
public String getClientKey(Channel channel) {
AttributeKey<String> key = AttributeKey.valueOf("ip");
if (channel.hasAttr(key)) {
return channel.attr(key).get();
}
return null;
}
public Channel get(String key) {
return IP_CHANNEL_CACHE_MAP.get(key);
}
public NettyTerminatorDTO getTerminatorByIp(String key) {
return IP_TERMINATOR_CACHE_MAP.get(key);
}
public Map<String, Channel> getIpToChannelCacheMap() {
return IP_CHANNEL_CACHE_MAP;
}
public Map<String, NettyTerminatorDTO> getIpToTerminatorCacheMap() {
return IP_TERMINATOR_CACHE_MAP;
}
public List<NettyTerminatorDTO> getAvailTerminator() {
if (!CollectionUtils.isEmpty(IP_TERMINATOR_CACHE_MAP)) {
return IP_TERMINATOR_CACHE_MAP.values().stream().filter(p -> OnlineStateEnum.ONLINE.equals(p.getOnlineState())
&& BusyStateEnum.IDLE.equals(p.getBusyState())).collect(Collectors.toList());
}
return Collections.emptyList();
}
/**
* 线
*/
public void remove(String key) {
IP_CHANNEL_CACHE_MAP.remove(key);
NettyTerminatorDTO nettyTerminatorDTO = new NettyTerminatorDTO();
nettyTerminatorDTO.setOnlineState(OnlineStateEnum.OFFLINE);
iSchTerminatorService.saveOrUpdate(key, nettyTerminatorDTO);
}
}

@ -0,0 +1,70 @@
package com.docus.server.common.netty.server;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import java.net.InetSocketAddress;
/**
* netty
*/
@Component
@Slf4j
public class NettyServer {
/**
* boss 线
*/
private EventLoopGroup boss;
/**
* worker 线
*/
private EventLoopGroup worker;
@Resource
private NettyServerProperties serverProperties;
@Resource
private NettyServerInitializer serverInitializer;
@PostConstruct
public void start() throws InterruptedException {
boss = new NioEventLoopGroup(serverProperties.getBossThreadCount());
worker = new NioEventLoopGroup(serverProperties.getWorkerThreadCount());
ServerBootstrap bootstrap = new ServerBootstrap();
bootstrap.group(boss, worker)
// 指定Channel
.channel(NioServerSocketChannel.class)
//使用指定的端口设置套接字地址
.localAddress(new InetSocketAddress(serverProperties.getPort()))
//服务端可连接队列数,对应TCP/IP协议listen函数中backlog参数
.option(ChannelOption.SO_BACKLOG, 1024)
//设置TCP长连接,一般如果两个小时内没有数据的通信时,TCP会自动发送一个活动探测数据报文
.childOption(ChannelOption.SO_KEEPALIVE, true)
//将小的数据包包装成更大的帧进行传送,提高网络的负载
.childOption(ChannelOption.TCP_NODELAY, true)
.childHandler(serverInitializer);
ChannelFuture future = bootstrap.bind().sync();
if (future.isSuccess()) {
log.info("Start netty server successfully");
} else {
log.error("Start netty server failed");
}
}
@PreDestroy
public void destroy() throws InterruptedException {
boss.shutdownGracefully().sync();
worker.shutdownGracefully().sync();
log.info("关闭Netty");
}
}

@ -0,0 +1,52 @@
package com.docus.server.common.netty.server;
import com.docus.server.common.netty.server.handler.NettyBusinessHandler;
import com.docus.server.common.netty.server.handler.NettyHeartbeatHandler;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.handler.timeout.IdleStateHandler;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;
/**
* netty
*/
@Component
public class NettyServerInitializer extends ChannelInitializer<Channel> {
@Resource
private NettyServerProperties serverProperties;
@Resource
private NettyBusinessHandler businessHandler;
@Resource
private ChannelRepository channelRepository;
@Override
protected void initChannel(Channel channel) throws Exception {
channel.pipeline()
//空闲检测
.addLast(new IdleStateHandler(serverProperties.getReaderIdleTimeSeconds(),
serverProperties.getWriterIdleTimeSeconds(),
serverProperties.getAllIdleTimeSeconds(),
TimeUnit.SECONDS)
)
// 加载加码解码处理器,同时解决粘包拆包问题
// .addLast(new ProtobufVarint32FrameDecoder())
// .addLast(new ProtobufDecoder(Payload.CommMsg.getDefaultInstance()))
// .addLast(new ProtobufVarint32LengthFieldPrepender())
// .addLast(new ProtobufEncoder())
// .addLast(new LineBasedFrameDecoder(2048))
// .addLast(new StringDecoder())
// .addLast(new StringEncoder())
// 加载业务处理器
.addLast(new NettyHeartbeatHandler(channelRepository))
.addLast(businessHandler);
// .addLast(new EchoServerHandler());
}
}

@ -0,0 +1,31 @@
package com.docus.server.common.netty.server;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* netty
*/
@Data
@Component
@ConfigurationProperties(prefix = NettyServerProperties.PREFIX)
public class NettyServerProperties {
public static final String PREFIX = "netty.server";
// 读空闲等待时间
private int readerIdleTimeSeconds = 30;
// 写空闲等待时间
private int writerIdleTimeSeconds;
// 读写空闲等待时间
private int allIdleTimeSeconds;
private Integer port;
private int bossThreadCount;
private int workerThreadCount;
}

@ -0,0 +1,77 @@
package com.docus.server.common.netty.server.handler;
import com.docus.core.util.json.JSON;
import com.docus.server.common.netty.CommMsg;
import com.fasterxml.jackson.core.type.TypeReference;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.CharsetUtil;
import java.util.Date;
public class EchoServerHandler extends ChannelInboundHandlerAdapter {
//客户端连接上来,没有心跳前,属于离线状态,有心跳后,才属于在线状态。
//客户端断开后自动剔除agent。
@Override
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelRegistered();
Channel incoming = ctx.channel();
System.out.println("NettyClient:" + incoming.remoteAddress() + "在线1");
}
@Override
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelUnregistered();
Channel incoming = ctx.channel();
System.out.println("NettyClient:" + incoming.remoteAddress() + "在线2");
}
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelActive();
Channel incoming = ctx.channel();
System.out.println("NettyClient:" + incoming.remoteAddress() + "在线3");
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
try {
ByteBuf buf = (ByteBuf) msg;
//创建目标大小的数组
byte[] barray = new byte[buf.readableBytes()];
//把数据从bytebuf转移到byte[]
buf.getBytes(0, barray);
//将byte[]转成字符串用于打印
String str = new String(barray);
CommMsg<TerminatorContent> commMsg = JSON.fromJSONWithGeneric(str, new TypeReference<CommMsg<TerminatorContent>>() {
});
if (str.length() > 0) {
System.out.println(str);
System.out.println("收到消息回复一条消息给客户端");
System.out.println("client channelActive..");
ctx.writeAndFlush(Unpooled.copiedBuffer("服务器端发一条数据给客户端" + new Date().toString(), CharsetUtil.UTF_8)); // 必须有flush
System.out.flush();
} else {
System.out.println("不能读啊");
}
} finally {
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
System.out.println("server occur exception:" + cause.getMessage());
cause.printStackTrace();
ctx.close(); // 关闭发生异常的连接
}
}

@ -0,0 +1,144 @@
package com.docus.server.common.netty.server.handler;
import com.docus.core.util.Func;
import com.docus.core.util.StringUtils;
import com.docus.core.util.json.JSON;
import com.docus.server.common.MsgConstants;
import com.docus.server.common.netty.CommMsg;
import com.docus.server.common.netty.server.ChannelRepository;
import com.docus.server.dto.scheduling.management.schterminator.NettyTerminatorDTO;
import com.docus.server.enums.BusyStateEnum;
import com.docus.server.enums.OnlineStateEnum;
import com.fasterxml.jackson.core.type.TypeReference;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.util.concurrent.GlobalEventExecutor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.net.InetSocketAddress;
/**
*
*/
@Slf4j
@ChannelHandler.Sharable
@Component
public class NettyBusinessHandler extends SimpleChannelInboundHandler<ByteBuf> {
private static final ChannelGroup DEFAULT_CHANNEL_GROUP = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
@Resource
private ChannelRepository repository;
@Override
protected void channelRead0(ChannelHandlerContext channelHandlerContext, ByteBuf msg) throws Exception {
ByteBuf buf = (ByteBuf) msg;
//创建目标大小的数组
byte[] barray = new byte[buf.readableBytes()];
//把数据从bytebuf转移到byte[]
buf.getBytes(0, barray);
//将byte[]转成字符串用于打印
String message = new String(barray);
//空消息不处理
if (!StringUtils.hasText(message)) {
return;
}
CommMsg<TerminatorContent> commMsg = JSON.fromJSONWithGeneric(message, new TypeReference<CommMsg<TerminatorContent>>() {
});
String messageType = commMsg.getMessageType();
String messageTime = commMsg.getMessageTime();
TerminatorContent messageContent = commMsg.getContent();
if (messageType.equals(MsgConstants.TERMINATOR_RESTART)) {
log.info("接受到终端重启命令,内容{}", messageContent);
}
if (messageType.equals(MsgConstants.COLLECTOR_RESTART)) {
log.info("收到采集器重启命令,内容{}", messageContent);
}
if (messageType.equals(MsgConstants.VIRTUAL_RESTART)) {
log.info("收到虚拟机重启命令,内容{}", messageContent);
}
if (messageType.equals(MsgConstants.UPDATE_COLLECTOR_FILE)) {
log.info("收到更新采集器文件命令,内容{}", messageContent);
}
if (messageType.equals(MsgConstants.UPDATE_COLLECTOR_CONFIG)) {
log.info("收到更新采集器配置命令,内容{}", messageContent);
}
if (messageType.equals(MsgConstants.SCH_DISTRIBUTE_TASKS)) {
log.info("收到采集调度器下发任务命令,内容{}", messageContent);
}
}
/**
* netty client 线
*/
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelRegistered();
InetSocketAddress ipSocket = (InetSocketAddress) ctx.channel().remoteAddress();
String clientIp = ipSocket.getAddress().getHostAddress();
log.info("【采集器-终端IP】:{},连接上线,IP地址信息:{}", clientIp, clientIp);
String clientId = repository.getClientKey(ctx.channel());
if (Func.isBlank(clientId)) {
NettyTerminatorDTO nettyTerminatorDTO = new NettyTerminatorDTO();
nettyTerminatorDTO.setTerminatorIp(clientIp);
nettyTerminatorDTO.setBusyState(BusyStateEnum.IDLE);
nettyTerminatorDTO.setOnlineState(OnlineStateEnum.OFFLINE);
repository.put(nettyTerminatorDTO, ctx.channel());
}
DEFAULT_CHANNEL_GROUP.add(ctx.channel());
System.out.println(ctx.channel().remoteAddress() + " 上线," + "【采集器-终端】在线数量:" + DEFAULT_CHANNEL_GROUP.size());
}
/**
* netty client 线
*/
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
Channel channel = ctx.channel();
System.out.println(channel.remoteAddress() + " 下线," + "【采集器-终端】在线数量:" + DEFAULT_CHANNEL_GROUP.size());
String clientId = repository.getClientKey(channel);
log.error("客户端下线,终端连接:{}", clientId);
//移除终端,终端离线
if (clientId != null) {
repository.remove(clientId);
}
}
/**
* netty exception
*/
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
cause.printStackTrace();
Channel channel = ctx.channel();
if (channel.isActive()) {
ctx.close();
}
super.exceptionCaught(ctx, cause);
}
}

@ -0,0 +1,104 @@
package com.docus.server.common.netty.server.handler;
import com.docus.core.util.Func;
import com.docus.core.util.StringUtils;
import com.docus.core.util.json.JSON;
import com.docus.server.common.MsgConstants;
import com.docus.server.common.netty.CommMsg;
import com.docus.server.common.netty.server.ChannelRepository;
import com.docus.server.dto.scheduling.management.schterminator.NettyTerminatorDTO;
import com.docus.server.enums.BusyStateEnum;
import com.docus.server.enums.OnlineStateEnum;
import com.fasterxml.jackson.core.type.TypeReference;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.extern.slf4j.Slf4j;
import java.net.InetSocketAddress;
/**
*
*/
@Slf4j
@ChannelHandler.Sharable
public class NettyHeartbeatHandler extends ChannelInboundHandlerAdapter {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
ByteBuf buf = (ByteBuf) msg;
//创建目标大小的数组
byte[] barray = new byte[buf.readableBytes()];
//把数据从bytebuf转移到byte[]
buf.getBytes(0, barray);
//将byte[]转成字符串用于打印
String message = new String(barray);
//空消息不处理
if (!StringUtils.hasText(message)) {
return;
}
CommMsg<TerminatorContent> commMsg = JSON.fromJSONWithGeneric(message, new TypeReference<CommMsg<TerminatorContent>>() {
});
String messageType = commMsg.getMessageType();
String messageTime = commMsg.getMessageTime();
TerminatorContent messageContent = commMsg.getContent();
if (messageType.equals(MsgConstants.HEARTBEAT_REQUEST)) {
log.info("接收到客户端的心跳");
log.info("接受到【采集器-终端】的心跳消息:消息类型={},消息时间={},消息内容={}", messageType, messageTime, messageContent);
InetSocketAddress ipSocket = (InetSocketAddress) ctx.channel().remoteAddress();
String clientIp = ipSocket.getAddress().getHostAddress();
log.info("【采集器-终端IP】:{},连接上线,IP地址信息:{}", clientIp, clientIp);
String clientKey = repository.getClientKey(ctx.channel());
if (Func.isNotBlank(clientKey)) {
NettyTerminatorDTO nettyTerminatorDTO = new NettyTerminatorDTO();
nettyTerminatorDTO.setTerminatorIp(clientIp);
nettyTerminatorDTO.setBusyState(BusyStateEnum.IDLE);
nettyTerminatorDTO.setOnlineState(OnlineStateEnum.ONLINE);
//将ip和channel进行映射
repository.put(nettyTerminatorDTO, ctx.channel());
}
} else {
if (ctx.channel().isOpen()) {
//触发下一个handler
ctx.fireChannelRead(msg);
}
}
}
private ChannelRepository repository;
public NettyHeartbeatHandler(ChannelRepository repository) {
this.repository = repository;
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
cause.printStackTrace();
String clientId = repository.getClientKey(ctx.channel());
log.error("通道发生异常,终端连接:{}", clientId);
//移除终端,终端离线
if (clientId != null) {
repository.remove(clientId);
}
if (ctx.channel().isActive()) {
ctx.close();
}
super.exceptionCaught(ctx, cause);
}
}

@ -0,0 +1,22 @@
package com.docus.server.common.netty.server.handler;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class TerminatorContent implements Serializable {
/*终端IP*/
private String terminatorIp;
/*终端名称*/
private String terminatorName;
}

@ -0,0 +1,152 @@
package com.docus.server.common.process;
import com.docus.core.util.Func;
import com.docus.log.context.TrackContext;
import com.docus.log.processor.AbstractProcessor;
import com.docus.server.common.netty.server.ChannelRepository;
import com.docus.server.dto.scheduling.management.schcollectrecord.EditSchCollectRecordDTO;
import com.docus.server.dto.scheduling.management.schterminator.EditSchTerminatorDTO;
import com.docus.server.dto.scheduling.management.schterminator.NettyTerminatorDTO;
import com.docus.server.enums.BusyStateEnum;
import com.docus.server.enums.RetryTaskEnum;
import com.docus.server.enums.StateEnum;
import com.docus.server.service.ISchCollectRecordRetryLogService;
import com.docus.server.service.ISchCollectRecordService;
import com.docus.server.service.ISchTerminatorService;
import com.docus.server.vo.scheduling.management.schcollectrecord.SchCollectRecordVO;
import com.docus.server.vo.scheduling.management.schcollectrecordretrylog.SchCollectRecordRetryLogVO;
import com.docus.server.vo.scheduling.management.schterminator.SchTerminatorVO;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* channel
*/
public class ChannelProcessor extends AbstractProcessor {
@Resource
private ChannelRepository channelRepository;
@Resource
private ISchTerminatorService iSchTerminatorService;
@Resource
private ISchCollectRecordService iSchCollectRecordService;
@Resource
private ISchCollectRecordRetryLogService iSchCollectRecordRetryLogService;
@Override
protected Object doProcess(TrackContext context) {
String group = context.getGroup();
switch (group) {
case "SchCollectRecordController-edit":
return doSchCollectRecordControllerEdit(context);
case "SchTerminatorController":
return doSchTerminatorController(context);
case "RedisKeyExpirationService-expired":
return doRedisKeyExpired(context);
default:
return true;
}
}
private Object doRedisKeyExpired(TrackContext context) {
boolean error = context.isError();
String expireKey = (String) context.getArgs()[0];
String recordId = expireKey.substring(expireKey.lastIndexOf(":") + 1);
if (!error) {
if (expireKey.startsWith("schCollectorRecord:isRetryTask:expireKey:")) {
retryTask(recordId);
}
if (expireKey.startsWith("schCollectorRecord:noRetryTask:expireKey:")) {
noRetryTask(recordId);
}
}
return null;
}
private boolean doSchCollectRecordControllerEdit(TrackContext context) {
return logCollectRecord(context);
}
private boolean doSchTerminatorController(TrackContext context) {
return logTerminator(context);
}
private boolean logCollectRecord(TrackContext context) {
boolean error = context.isError();
EditSchCollectRecordDTO collectRecordDTO = (EditSchCollectRecordDTO) context.getArgs()[0];
if (!error) {
if (RetryTaskEnum.NO_RETRY_TASK.equals(collectRecordDTO.getIsRetryTask())) {
noRetryTask(String.valueOf(collectRecordDTO.getId()));
} else if (RetryTaskEnum.RETRY_TASK.equals(collectRecordDTO.getIsRetryTask())) {
retryTask(String.valueOf(collectRecordDTO.getId()));
}
}
return error;
}
private void retryTask(String recordLogId) {
SchCollectRecordRetryLogVO retryLogVO = iSchCollectRecordRetryLogService.findById(recordLogId);
updateTerminatorState(retryLogVO.getTerminatorId(), retryLogVO.getTaskExecState());
}
private void noRetryTask(String recordId) {
SchCollectRecordVO schCollectRecordVO = iSchCollectRecordService.findById(recordId);
updateTerminatorState(schCollectRecordVO.getTerminatorId(), schCollectRecordVO.getTaskExecState());
}
private void updateTerminatorState(Long terminatorId, StateEnum taskExecState) {
SchTerminatorVO schTerminatorVO = iSchTerminatorService.findById(String.valueOf(terminatorId));
NettyTerminatorDTO nettyTerminatorDTO = channelRepository.getTerminatorByIp(String.valueOf(schTerminatorVO.getTerminatorIp()));
if (Func.isEmpty(nettyTerminatorDTO)) {
return;
}
List<StateEnum> stateEnums = Arrays.asList(StateEnum.values());
if (stateEnums.contains(taskExecState)) {
nettyTerminatorDTO.setBusyState(BusyStateEnum.IDLE);
}
}
private boolean logTerminator(TrackContext context) {
boolean error = context.isError();
EditSchTerminatorDTO terminatorDTO = (EditSchTerminatorDTO) context.getArgs()[0];
if (!error) {
SchTerminatorVO terminatorVO = iSchTerminatorService.findById(String.valueOf(terminatorDTO.getId()));
NettyTerminatorDTO nettyTerminatorDTO = channelRepository.getTerminatorByIp(terminatorVO.getTerminatorIp());
if (Func.isNotBlank(terminatorDTO.getOnlyCollectorIds())) {
List<String> onlyList = Arrays.stream(terminatorDTO.getOnlyCollectorIds().split(",")).map(String::valueOf).collect(Collectors.toList());
nettyTerminatorDTO.setOnlyCollectorIds(onlyList);
}
if (Func.isNotBlank(terminatorDTO.getPriorityCollectorIds())) {
List<String> priList = Arrays.stream(terminatorDTO.getPriorityCollectorIds().split(",")).map(String::valueOf).collect(Collectors.toList());
nettyTerminatorDTO.setPriorityCollectorIds(priList);
}
}
return error;
}
}

@ -0,0 +1,72 @@
package com.docus.server.common.process;
import com.docus.infrastructure.redis.service.IdService;
import com.docus.log.context.TrackContext;
import com.docus.log.processor.AbstractProcessor;
import com.docus.server.dto.scheduling.management.schcollector.UpdateSchCollectorDTO;
import com.docus.server.entity.scheduling.management.SchCollector;
import com.docus.server.entity.scheduling.management.SchCollectorVersion;
import com.docus.server.entity.scheduling.management.SchCollectorVersionLog;
import com.docus.server.entity.scheduling.management.SchSystemParams;
import com.docus.server.enums.StateEnum;
import com.docus.server.infrastructure.dao.ISchCollectorDao;
import com.docus.server.infrastructure.dao.ISchCollectorVersionDao;
import com.docus.server.infrastructure.dao.ISchCollectorVersionLogDao;
import com.docus.server.infrastructure.dao.ISchSystemParamsDao;
import javax.annotation.Resource;
/**
*
*/
public class CollectorVersionProcessor extends AbstractProcessor {
@Resource
private ISchCollectorVersionLogDao iSchCollectorVersionLogDao;
@Resource
private ISchCollectorVersionDao iSchCollectorVersionDao;
@Resource
private ISchSystemParamsDao iSchSystemParamsDao;
@Resource
private ISchCollectorDao iSchCollectorDao;
@Resource
private IdService idService;
@Override
public Object beforeProcess(TrackContext context) {
super.beforeProcess(context);
UpdateSchCollectorDTO updateDTO = (UpdateSchCollectorDTO) context.getArgs()[0];
Long collectorId = updateDTO.getCollectorId();
SchCollector schCollector = iSchCollectorDao.findOneBy("collectorId", collectorId);
SchCollectorVersion preVersion = iSchCollectorVersionDao.findById(schCollector.getCollectorVersionId());
return preVersion.getCollectVersion();
}
@Override
protected Object doProcess(TrackContext context) {
logProcess(context);
return null;
}
private void logProcess(TrackContext context) {
boolean error = context.isError();
UpdateSchCollectorDTO updateDTO = (UpdateSchCollectorDTO) context.getArgs()[0];
Long collectorId = updateDTO.getCollectorId();
String preVersion = (String) context.getBeforeResult();
SchCollectorVersion curVersion = iSchCollectorVersionDao.findById(updateDTO.getCollectorVersionId());
SchSystemParams schSystemParams = iSchSystemParamsDao.findOneBy("paramValue", collectorId);
SchCollectorVersionLog log = new SchCollectorVersionLog();
log.setId(idService.getDateSeq());
log.setCollectorId(collectorId);
log.setOperationModule(context.getGroup());
log.setOperationType(context.getAction());
log.setOperationDesc(context.getDesc());
log.setOperationContent(String.format("采集器:%s上一个版本是%s更换成当前版本是%s", schSystemParams.getParamName(), preVersion, curVersion.getCollectVersion()));
log.setState(error ? StateEnum.FAIL : StateEnum.OK);
iSchCollectorVersionLogDao.save(log);
}
}

@ -0,0 +1,62 @@
package com.docus.server.common.process;
import com.docus.core.util.json.JSON;
import com.docus.log.context.TrackContext;
import com.docus.log.processor.AbstractProcessor;
import com.docus.server.common.MsgConstants;
import com.docus.server.dto.scheduling.management.schcollector.UpdateSchCollectorDTO;
import com.docus.server.dto.scheduling.management.schterminator.CommMsgDTO;
import com.docus.server.entity.scheduling.management.SchCollectorVersionFile;
import com.docus.server.service.ICommMsgService;
import com.docus.server.service.ISchCollectorVersionFileService;
import com.docus.server.service.ISchCollectorVersionService;
import com.docus.server.vo.scheduling.management.schcollectorversion.SchCollectorVersionVO;
import com.docus.server.vo.scheduling.management.schcollectorversion.TcpSchCollectorVersionContentVO;
import com.google.common.collect.Lists;
import javax.annotation.Resource;
import java.util.List;
/**
* tcp
*/
public class TcpProcessor extends AbstractProcessor {
@Resource
private ICommMsgService iCommMsgService;
@Resource
private ISchCollectorVersionFileService iSchCollectorVersionFileService;
@Resource
private ISchCollectorVersionService iSchCollectorVersionService;
@Override
protected Object doProcess(TrackContext context) {
return logProcess(context);
}
private boolean logProcess(TrackContext context) {
boolean error = context.isError();
if (!error) {
UpdateSchCollectorDTO updateSchCollectorDTO = (UpdateSchCollectorDTO) context.getArgs()[0];
Long collectorId = updateSchCollectorDTO.getCollectorId();
Long collectorVersionId = updateSchCollectorDTO.getCollectorVersionId();
SchCollectorVersionFile schCollectorVersionFile = iSchCollectorVersionFileService.findByCollectorIdAndVersionId(collectorId, collectorVersionId);
SchCollectorVersionVO schCollectorVersionVO = iSchCollectorVersionService.findById(String.valueOf(collectorVersionId));
TcpSchCollectorVersionContentVO tcpSchCollectorVersionContentVO = new TcpSchCollectorVersionContentVO();
tcpSchCollectorVersionContentVO.setCollectorId(collectorId);
tcpSchCollectorVersionContentVO.setFilePath(schCollectorVersionFile.getFilePath());
tcpSchCollectorVersionContentVO.setCollectorVersion(schCollectorVersionVO.getCollectVersion());
List<TcpSchCollectorVersionContentVO> tcpSchCollectorVersionContentVOList = Lists.newArrayList(tcpSchCollectorVersionContentVO);
CommMsgDTO commMsgDTO = CommMsgDTO.builder()
.content(JSON.toJSON(tcpSchCollectorVersionContentVOList))
.messageType(MsgConstants.UPDATE_COLLECTOR_FILE)
.build();
iCommMsgService.clientsCommand(commMsgDTO);
}
return error;
}
}

@ -0,0 +1,25 @@
package com.docus.server.common.serializer;
import com.docus.core.util.Convert;
import com.docus.infrastructure.web.json.JsonSerializerModule;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.time.ZoneId;
import java.util.Date;
import java.util.TimeZone;
public class DefJsonSerializerModule extends JsonSerializerModule {
public DefJsonSerializerModule() {
addSerializer(Date.class, new JsonSerializer<Date>() {
@Override
public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeString(date == null ? null : Convert.toString(date, Convert.DATA_FORMAT_DATETIME_SLASH, TimeZone.getTimeZone(ZoneId.systemDefault())));
}
});
}
}

@ -0,0 +1,64 @@
package com.docus.server.common.serializer;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* handler
*/
@Component
public class StringToDateConverter implements Converter<String, Date> {
private static final List<String> DATE_FORMARTS = new ArrayList<>(4);
static {
DATE_FORMARTS.add("yyyy-MM");
DATE_FORMARTS.add("yyyy-MM-dd");
DATE_FORMARTS.add("yyyy-MM-dd hh:mm");
DATE_FORMARTS.add("yyyy-MM-dd hh:mm:ss");
}
@Override
public Date convert(String source) {
String value = source.trim();
if ("".equals(value)) {
return null;
}
if (source.matches("^\\d{4}-\\d{1,2}$")) {
return parseDate(source, DATE_FORMARTS.get(0));
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2}$")) {
return parseDate(source, DATE_FORMARTS.get(1));
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}$")) {
return parseDate(source, DATE_FORMARTS.get(2));
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$")) {
return parseDate(source, DATE_FORMARTS.get(3));
} else {
throw new IllegalArgumentException("Invalid boolean value '" + source + "'");
}
}
/**
*
*
* @param dateStr String
* @param format String
* @return Date
*/
public Date parseDate(String dateStr, String format) {
Date date = null;
try {
DateFormat dateFormat = new SimpleDateFormat(format);
date = dateFormat.parse(dateStr);
} catch (Exception e) {
System.out.println(String.format("日期%s转换%s错误", dateStr, format));
}
return date;
}
}

@ -0,0 +1,107 @@
package com.docus.server.common.test;
import java.util.ArrayList;
import java.util.List;
public class DispatchService {
public void dispatch() {
//获取所有空闲的终端
List<Terminal> terminalList = new ArrayList<>();
List<TaskInfo> taskInfos = this.getTaskInfos(terminalList.size());
//只采集,有优先级的
for (Terminal terminal : terminalList) {
for (TaskInfo taskInfo : taskInfos) {
//先找出有只采集的任务。
if (terminal.getOnlyTags().contains(taskInfo.getCollectType())) {
//把这个任务派给这个终端,并且把这个终端设置成繁忙
if (terminal.getPriorityTags().contains(taskInfo.getCollectType())) {
//把这个任务派给这个终端
terminal.setState(1);
return;
}
}
}
}
//只采集没有优先级
for (Terminal terminal : terminalList) {
//把刚才已经分配任务过的采集器排除
if (terminal.getState() == 1) {
continue;
}
for (TaskInfo taskInfo : taskInfos) {
//先找出有只采集的任务。
if (terminal.getOnlyTags().contains(taskInfo.getCollectType())) {
//把这个任务派给这个终端,并且把这个终端设置成繁忙
terminal.setState(1);
return;
}
}
}
//无只采集,有优先级
for (Terminal terminal : terminalList) {
//把刚才已经分配任务过的采集器排除
if (terminal.getState() == 1) {
continue;
}
for (TaskInfo taskInfo : taskInfos) {
//先找出有只采集的任务。
if (terminal.getPriorityTags().contains(taskInfo.getCollectType())) {
//把这个任务派给这个终端
terminal.setState(1);
return;
}
}
}
//无只采集,无优先级
for (Terminal terminal : terminalList) {
//把刚才已经分配任务过的采集器排除
if (terminal.getState() == 1) {
continue;
}
for (TaskInfo taskInfo : taskInfos) {
//先找出有只采集的任务。
//把这个任务派给这个终端
terminal.setState(1);
return;
}
}
}
private void dispatchTask(List<TaskInfo> taskInfos, Terminal terminal) {
for (TaskInfo taskInfo : taskInfos) {
//先找出有只采集的任务。
if (terminal.getOnlyTags().contains(taskInfo.getCollectType())) {
//把这个任务派给这个终端
return;
}
if (terminal.getPriorityTags().contains(taskInfo.getCollectType())) {
//把这个任务派给这个终端
return;
}
}
}
public List<TaskInfo> getTaskInfos(int size) {
return null;
}
}

@ -0,0 +1,14 @@
package com.docus.server.common.test;
import lombok.Data;
@Data
public class TaskInfo {
private Long taskId;
private String collectType;
private String info;
}

@ -0,0 +1,16 @@
package com.docus.server.common.test;
import lombok.Data;
import java.util.List;
@Data
public class Terminal {
private String id;
private String collectType;
private List<String> priorityTags;
private List<String> onlyTags;
private Integer state;
}

@ -0,0 +1,25 @@
package com.docus.server.controller;
import com.docus.server.api.scheduling.management.CommMsgApi;
import com.docus.server.dto.scheduling.management.schterminator.CommMsgDTO;
import com.docus.server.service.ICommMsgService;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* TCP API
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class CommMsgController implements CommMsgApi {
@Resource
private ICommMsgService iCommMsgService;
@Override
public void clientCommand(CommMsgDTO commMsgDTO) {
iCommMsgService.clientCommand(commMsgDTO);
}
}

@ -0,0 +1,31 @@
package com.docus.server.controller;
import com.docus.server.api.scheduling.management.FileApi;
import com.docus.server.service.IFileUploadService;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
/**
* API
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class FileController implements FileApi {
@Resource
private IFileUploadService iFileUploadService;
@Override
public void downloadFile(String filePath, HttpServletResponse response) throws Exception {
iFileUploadService.downloadFile(filePath, response);
}
@Override
public void uploadFile(MultipartFile[] multipartFiles, String pathKey) throws Exception {
iFileUploadService.uploadFile(multipartFiles, pathKey);
}
}

@ -0,0 +1,81 @@
package com.docus.server.controller;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.scheduling.management.SchCollectErrorLogApi;
import com.docus.server.dto.scheduling.management.schcollecterrorlog.AddSchCollectErrorLogDTO;
import com.docus.server.dto.scheduling.management.schcollecterrorlog.DeleteSchCollectErrorLogDTO;
import com.docus.server.dto.scheduling.management.schcollecterrorlog.EditSchCollectErrorLogDTO;
import com.docus.server.service.ISchCollectErrorLogService;
import com.docus.server.vo.scheduling.management.schcollecterrorlog.SchCollectErrorLogVO;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class SchCollectErrorLogController implements SchCollectErrorLogApi {
@Resource
private ISchCollectErrorLogService iSchCollectErrorLogService;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectErrorLogVO findById(String id) {
return iSchCollectErrorLogService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectErrorLogVO> search(SearchDTO searchDTO) {
return iSchCollectErrorLogService.search(searchDTO);
}
/**
*
*
* @param addSchCollectErrorLogDTO
* @return
*/
@Override
public boolean add(AddSchCollectErrorLogDTO addSchCollectErrorLogDTO, MultipartFile[] multipartFiles) throws Exception {
return iSchCollectErrorLogService.add(addSchCollectErrorLogDTO, multipartFiles);
}
/**
*
*
* @param editSchCollectErrorLogDTO
* @return
*/
@Override
public boolean edit(EditSchCollectErrorLogDTO editSchCollectErrorLogDTO) {
return iSchCollectErrorLogService.edit(editSchCollectErrorLogDTO);
}
/**
*
*
* @param deleteSchCollectErrorLogDTO
* @return
*/
@Override
public int delete(DeleteSchCollectErrorLogDTO deleteSchCollectErrorLogDTO) {
return iSchCollectErrorLogService.delete(deleteSchCollectErrorLogDTO);
}
}

@ -0,0 +1,103 @@
package com.docus.server.controller;
import com.docus.core.util.ParamsUtils;
import com.docus.core.util.json.JSON;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.log.annotation.TrackGroup;
import com.docus.server.api.scheduling.management.SchCollectRecordApi;
import com.docus.server.common.SchCollectorTask;
import com.docus.server.common.process.ChannelProcessor;
import com.docus.server.dto.scheduling.management.schcollector.task.ReportDownTwoDTO;
import com.docus.server.dto.scheduling.management.schcollectrecord.AddSchCollectRecordDTO;
import com.docus.server.dto.scheduling.management.schcollectrecord.DeleteSchCollectRecordDTO;
import com.docus.server.dto.scheduling.management.schcollectrecord.EditSchCollectRecordDTO;
import com.docus.server.dto.scheduling.management.schcollectrecord.RetrySchCollectRecordDTO;
import com.docus.server.entity.scheduling.management.SchCollectRecord;
import com.docus.server.enums.RetryTaskEnum;
import com.docus.server.service.ISchCollectRecordService;
import com.docus.server.vo.scheduling.management.schcollectrecord.SchCollectRecordVO;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class SchCollectRecordController implements SchCollectRecordApi {
@Resource
private ISchCollectRecordService iSchCollectRecordService;
@Resource
private SchCollectorTask schedulerTask;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectRecordVO findById(String id) {
return iSchCollectRecordService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectRecordVO> search(SearchDTO searchDTO) {
return iSchCollectRecordService.search(searchDTO);
}
/**
*
*
* @param addSchCollectRecordDTO
* @return
*/
@Override
public SchCollectRecord add(AddSchCollectRecordDTO addSchCollectRecordDTO) {
return iSchCollectRecordService.add(addSchCollectRecordDTO);
}
/**
*
*
* @param editSchCollectRecordDTO
* @return
*/
@TrackGroup(group = "SchCollectRecordController-edit", processor = ChannelProcessor.class)
@Override
public boolean edit(EditSchCollectRecordDTO editSchCollectRecordDTO) {
return iSchCollectRecordService.edit(editSchCollectRecordDTO);
}
/**
*
*
* @param deleteSchCollectRecordDTO
* @return
*/
@Override
public int delete(DeleteSchCollectRecordDTO deleteSchCollectRecordDTO) {
return iSchCollectRecordService.delete(deleteSchCollectRecordDTO);
}
@Override
public void retryTask(RetrySchCollectRecordDTO retrySchCollectRecordDTO) {
ReportDownTwoDTO report = JSON.fromJSON(retrySchCollectRecordDTO.getTaskOriginJson(), ReportDownTwoDTO.class);
report.setParams(ParamsUtils
.addParam("collectRecordId", retrySchCollectRecordDTO.getId())
.addParam("isRetryTask", RetryTaskEnum.RETRY_TASK.getValue())
.param());
schedulerTask.addRetryTask(report);
}
}

@ -0,0 +1,81 @@
package com.docus.server.controller;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.scheduling.management.SchCollectRecordRetryLogApi;
import com.docus.server.dto.scheduling.management.schcollectrecordretrylog.AddSchCollectRecordRetryLogDTO;
import com.docus.server.dto.scheduling.management.schcollectrecordretrylog.DeleteSchCollectRecordRetryLogDTO;
import com.docus.server.dto.scheduling.management.schcollectrecordretrylog.EditSchCollectRecordRetryLogDTO;
import com.docus.server.entity.scheduling.management.SchCollectRecordRetryLog;
import com.docus.server.service.ISchCollectRecordRetryLogService;
import com.docus.server.vo.scheduling.management.schcollectrecordretrylog.SchCollectRecordRetryLogVO;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class SchCollectRecordRetryLogController implements SchCollectRecordRetryLogApi {
@Resource
private ISchCollectRecordRetryLogService iSchCollectRecordRetryLogService;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectRecordRetryLogVO findById(String id) {
return iSchCollectRecordRetryLogService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectRecordRetryLogVO> search(SearchDTO searchDTO) {
return iSchCollectRecordRetryLogService.search(searchDTO);
}
/**
*
*
* @param addSchCollectRecordRetryLogDTO
* @return
*/
@Override
public SchCollectRecordRetryLog add(AddSchCollectRecordRetryLogDTO addSchCollectRecordRetryLogDTO) {
return iSchCollectRecordRetryLogService.add(addSchCollectRecordRetryLogDTO);
}
/**
*
*
* @param editSchCollectRecordRetryLogDTO
* @return
*/
@Override
public boolean edit(EditSchCollectRecordRetryLogDTO editSchCollectRecordRetryLogDTO) {
return iSchCollectRecordRetryLogService.edit(editSchCollectRecordRetryLogDTO);
}
/**
*
*
* @param deleteSchCollectRecordRetryLogDTO
* @return
*/
@Override
public int delete(DeleteSchCollectRecordRetryLogDTO deleteSchCollectRecordRetryLogDTO) {
return iSchCollectRecordRetryLogService.delete(deleteSchCollectRecordRetryLogDTO);
}
}

@ -0,0 +1,94 @@
package com.docus.server.controller;
import com.docus.core.util.json.JSON;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.scheduling.management.SchCollectorConfigApi;
import com.docus.server.dto.scheduling.management.schcollectorconfig.AddSchCollectorConfigDTO;
import com.docus.server.dto.scheduling.management.schcollectorconfig.DeleteSchCollectorConfigDTO;
import com.docus.server.dto.scheduling.management.schcollectorconfig.EditSchCollectorConfigDTO;
import com.docus.server.service.ISchCollectorConfigService;
import com.docus.server.vo.scheduling.management.schcollectorconfig.SchCollectorConfigVO;
import com.google.common.collect.Maps;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class SchCollectorConfigController implements SchCollectorConfigApi {
@Resource
private ISchCollectorConfigService iSchCollectorConfigService;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectorConfigVO findById(String id) {
return iSchCollectorConfigService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectorConfigVO> search(SearchDTO searchDTO) {
return iSchCollectorConfigService.search(searchDTO);
}
/**
*
*
* @param addSchCollectorConfigDTO
* @return
*/
@Override
public boolean add(AddSchCollectorConfigDTO addSchCollectorConfigDTO) {
return iSchCollectorConfigService.add(addSchCollectorConfigDTO);
}
/**
*
*
* @param editSchCollectorConfigDTO
* @return
*/
@Override
public boolean edit(EditSchCollectorConfigDTO editSchCollectorConfigDTO) {
return iSchCollectorConfigService.edit(editSchCollectorConfigDTO);
}
/**
*
*
* @param deleteSchCollectorConfigDTO
* @return
*/
@Override
public int delete(DeleteSchCollectorConfigDTO deleteSchCollectorConfigDTO) {
return iSchCollectorConfigService.delete(deleteSchCollectorConfigDTO);
}
public static void main(String[] args) {
HashMap<Object, Object> objectObjectHashMap = Maps.newHashMap();
objectObjectHashMap.put("ocr.url", "http://192.168.2.13/ocr");
objectObjectHashMap.put("ocr.name", "lin");
objectObjectHashMap.put("ocr.pwd", "123");
System.out.println(JSON.toJSON(objectObjectHashMap));
}
}

@ -0,0 +1,94 @@
package com.docus.server.controller;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.log.annotation.TrackLogGroup;
import com.docus.server.api.scheduling.management.SchCollectorApi;
import com.docus.server.common.process.CollectorVersionProcessor;
import com.docus.server.dto.scheduling.management.schcollector.AddSchCollectorDTO;
import com.docus.server.dto.scheduling.management.schcollector.DeleteSchCollectorDTO;
import com.docus.server.dto.scheduling.management.schcollector.EditSchCollectorDTO;
import com.docus.server.dto.scheduling.management.schcollector.UpdateSchCollectorDTO;
import com.docus.server.service.ISchCollectorService;
import com.docus.server.vo.scheduling.management.schcollector.SchCollectorVO;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class SchCollectorController implements SchCollectorApi {
@Resource
private ISchCollectorService iSchCollectorService;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectorVO findById(String id) {
return iSchCollectorService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectorVO> search(SearchDTO searchDTO) {
return iSchCollectorService.search(searchDTO);
}
/**
*
*
* @param addSchCollectorDTO
* @return
*/
@Override
public boolean add(AddSchCollectorDTO addSchCollectorDTO) {
return iSchCollectorService.add(addSchCollectorDTO);
}
/**
*
*
* @param editSchCollectorDTO
* @return
*/
@Override
public boolean edit(EditSchCollectorDTO editSchCollectorDTO) {
return iSchCollectorService.edit(editSchCollectorDTO);
}
/**
*
*
* @param deleteSchCollectorDTO
* @return
*/
@Override
public int delete(DeleteSchCollectorDTO deleteSchCollectorDTO) {
return iSchCollectorService.delete(deleteSchCollectorDTO);
}
/**
*
*
* @return
*/
@TrackLogGroup(group = "采集器管理", action = "更新", desc = "更新采集器版本", processor = CollectorVersionProcessor.class)
@Override
public boolean updateVersion(UpdateSchCollectorDTO updateDTO) {
return iSchCollectorService.updateVersion(updateDTO);
}
}

@ -0,0 +1,84 @@
package com.docus.server.controller;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.scheduling.management.SchCollectorVersionApi;
import com.docus.server.dto.scheduling.management.schcollectorversion.AddSchCollectorVersionDTO;
import com.docus.server.dto.scheduling.management.schcollectorversion.DeleteSchCollectorVersionDTO;
import com.docus.server.dto.scheduling.management.schcollectorversion.EditSchCollectorVersionDTO;
import com.docus.server.service.ISchCollectorService;
import com.docus.server.service.ISchCollectorVersionService;
import com.docus.server.vo.scheduling.management.schcollectorversion.SchCollectorVersionVO;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class SchCollectorVersionController implements SchCollectorVersionApi {
@Resource
private ISchCollectorVersionService iSchCollectorVersionService;
@Resource
private ISchCollectorService iSchCollectorService;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectorVersionVO findById(String id) {
return iSchCollectorVersionService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectorVersionVO> search(SearchDTO searchDTO) {
return iSchCollectorVersionService.search(searchDTO);
}
/**
*
*
* @param addSchCollectorVersionDTO
* @return
*/
@Override
public boolean add(AddSchCollectorVersionDTO addSchCollectorVersionDTO) {
return iSchCollectorVersionService.add(addSchCollectorVersionDTO);
}
/**
*
*
* @param editSchCollectorVersionDTO
* @return
*/
@Override
public boolean edit(EditSchCollectorVersionDTO editSchCollectorVersionDTO) {
return iSchCollectorVersionService.edit(editSchCollectorVersionDTO);
}
/**
*
*
* @param deleteSchCollectorVersionDTO
* @return
*/
@Override
public int delete(DeleteSchCollectorVersionDTO deleteSchCollectorVersionDTO) {
return iSchCollectorVersionService.delete(deleteSchCollectorVersionDTO);
}
}

@ -0,0 +1,114 @@
package com.docus.server.controller;
import cn.hutool.core.util.StrUtil;
import com.docus.core.util.Func;
import com.docus.infrastructure.web.exception.ApiException;
import com.docus.infrastructure.web.exception.ExceptionCode;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.scheduling.management.SchCollectorVersionFileApi;
import com.docus.server.dto.scheduling.management.schcollectorversionfile.AddSchCollectorVersionFileDTO;
import com.docus.server.dto.scheduling.management.schcollectorversionfile.DeleteSchCollectorVersionFileDTO;
import com.docus.server.dto.scheduling.management.schcollectorversionfile.EditSchCollectorVersionFileDTO;
import com.docus.server.entity.scheduling.management.SchCollectorVersion;
import com.docus.server.service.ISchCollectorVersionFileService;
import com.docus.server.service.ISchCollectorVersionService;
import com.docus.server.vo.scheduling.management.schcollectorversionfile.SchCollectorVersionFileVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
@Slf4j
public class SchCollectorVersionFileController implements SchCollectorVersionFileApi {
@Resource
private ISchCollectorVersionFileService iSchCollectorVersionFileService;
@Resource
private ISchCollectorVersionService iSchCollectorVersionService;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectorVersionFileVO findById(String id) {
return iSchCollectorVersionFileService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectorVersionFileVO> search(SearchDTO searchDTO) {
return iSchCollectorVersionFileService.search(searchDTO);
}
/**
*
*
* @param addDTO
* @return
*/
@Override
public boolean add(AddSchCollectorVersionFileDTO addDTO, MultipartFile[] multipartFiles) throws Exception {
if (fileValid(multipartFiles, addDTO)) {
throw new ApiException(ExceptionCode.ParamIllegal.getCode(), "请选择文件和填写上传文件信息!");
}
SchCollectorVersion schCollectorVersion = iSchCollectorVersionService.findByVersion(addDTO.getCollectorId(), addDTO.getCollectorVersionNo());
if (null != schCollectorVersion) {
throw new ApiException(ExceptionCode.ParamIllegal.getCode(), "当前采集器版本号已存在!");
}
iSchCollectorVersionFileService.addVersionAndFile(addDTO, multipartFiles);
return true;
}
private boolean fileValid(MultipartFile[] multipartFiles, AddSchCollectorVersionFileDTO addSchCollectorVersionFileDTO) {
return multipartFiles == null
|| multipartFiles.length == 0
|| StrUtil.isBlank(addSchCollectorVersionFileDTO.getCollectorVersionNo())
|| Func.isEmpty(addSchCollectorVersionFileDTO.getCollectorId());
}
public boolean add(AddSchCollectorVersionFileDTO addSchCollectorVersionFileDTO) {
return iSchCollectorVersionFileService.add(addSchCollectorVersionFileDTO);
}
/**
*
*
* @param editSchCollectorVersionFileDTO
* @return
*/
@Override
public boolean edit(EditSchCollectorVersionFileDTO editSchCollectorVersionFileDTO) {
return iSchCollectorVersionFileService.edit(editSchCollectorVersionFileDTO);
}
/**
*
*
* @param deleteSchCollectorVersionFileDTO
* @return
*/
@Override
public int delete(DeleteSchCollectorVersionFileDTO deleteSchCollectorVersionFileDTO) {
return iSchCollectorVersionFileService.delete(deleteSchCollectorVersionFileDTO);
}
}

@ -0,0 +1,80 @@
package com.docus.server.controller;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.scheduling.management.SchCollectorVersionLogApi;
import com.docus.server.dto.scheduling.management.schcollectorversionlog.AddSchCollectorVersionLogDTO;
import com.docus.server.dto.scheduling.management.schcollectorversionlog.DeleteSchCollectorVersionLogDTO;
import com.docus.server.dto.scheduling.management.schcollectorversionlog.EditSchCollectorVersionLogDTO;
import com.docus.server.service.ISchCollectorVersionLogService;
import com.docus.server.vo.scheduling.management.schcollectorversionlog.SchCollectorVersionLogVO;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class SchCollectorVersionLogController implements SchCollectorVersionLogApi {
@Resource
private ISchCollectorVersionLogService iSchCollectorVersionLogService;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectorVersionLogVO findById(String id) {
return iSchCollectorVersionLogService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectorVersionLogVO> search(SearchDTO searchDTO) {
return iSchCollectorVersionLogService.search(searchDTO);
}
/**
*
*
* @param addSchCollectorVersionLogDTO
* @return
*/
@Override
public boolean add(AddSchCollectorVersionLogDTO addSchCollectorVersionLogDTO) {
return iSchCollectorVersionLogService.add(addSchCollectorVersionLogDTO);
}
/**
*
*
* @param editSchCollectorVersionLogDTO
* @return
*/
@Override
public boolean edit(EditSchCollectorVersionLogDTO editSchCollectorVersionLogDTO) {
return iSchCollectorVersionLogService.edit(editSchCollectorVersionLogDTO);
}
/**
*
*
* @param deleteSchCollectorVersionLogDTO
* @return
*/
@Override
public int delete(DeleteSchCollectorVersionLogDTO deleteSchCollectorVersionLogDTO) {
return iSchCollectorVersionLogService.delete(deleteSchCollectorVersionLogDTO);
}
}

@ -0,0 +1,80 @@
package com.docus.server.controller;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.scheduling.management.SchOperationLogApi;
import com.docus.server.dto.scheduling.management.schoperationlog.AddSchOperationLogDTO;
import com.docus.server.dto.scheduling.management.schoperationlog.DeleteSchOperationLogDTO;
import com.docus.server.dto.scheduling.management.schoperationlog.EditSchOperationLogDTO;
import com.docus.server.service.ISchOperationLogService;
import com.docus.server.vo.scheduling.management.schoperationlog.SchOperationLogVO;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class SchOperationLogController implements SchOperationLogApi {
@Resource
private ISchOperationLogService iSchOperationLogService;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchOperationLogVO findById(String id) {
return iSchOperationLogService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchOperationLogVO> search(SearchDTO searchDTO) {
return iSchOperationLogService.search(searchDTO);
}
/**
*
*
* @param addSchOperationLogDTO
* @return
*/
@Override
public boolean add(AddSchOperationLogDTO addSchOperationLogDTO) {
return iSchOperationLogService.add(addSchOperationLogDTO);
}
/**
*
*
* @param editSchOperationLogDTO
* @return
*/
@Override
public boolean edit(EditSchOperationLogDTO editSchOperationLogDTO) {
return iSchOperationLogService.edit(editSchOperationLogDTO);
}
/**
*
*
* @param deleteSchOperationLogDTO
* @return
*/
@Override
public int delete(DeleteSchOperationLogDTO deleteSchOperationLogDTO) {
return iSchOperationLogService.delete(deleteSchOperationLogDTO);
}
}

@ -0,0 +1,80 @@
package com.docus.server.controller;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.scheduling.management.SchSystemParamsApi;
import com.docus.server.dto.scheduling.management.schsystemparams.AddSchSystemParamsDTO;
import com.docus.server.dto.scheduling.management.schsystemparams.DeleteSchSystemParamsDTO;
import com.docus.server.dto.scheduling.management.schsystemparams.EditSchSystemParamsDTO;
import com.docus.server.service.ISchSystemParamsService;
import com.docus.server.vo.scheduling.management.schsystemparams.SchSystemParamsVO;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class SchSystemParamsController implements SchSystemParamsApi {
@Resource
private ISchSystemParamsService iSchSystemParamsService;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchSystemParamsVO findById(String id) {
return iSchSystemParamsService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchSystemParamsVO> search(SearchDTO searchDTO) {
return iSchSystemParamsService.search(searchDTO);
}
/**
*
*
* @param addSchSystemParamsDTO
* @return
*/
@Override
public boolean add(AddSchSystemParamsDTO addSchSystemParamsDTO) {
return iSchSystemParamsService.add(addSchSystemParamsDTO);
}
/**
*
*
* @param editSchSystemParamsDTO
* @return
*/
@Override
public boolean edit(EditSchSystemParamsDTO editSchSystemParamsDTO) {
return iSchSystemParamsService.edit(editSchSystemParamsDTO);
}
/**
*
*
* @param deleteSchSystemParamsDTO
* @return
*/
@Override
public int delete(DeleteSchSystemParamsDTO deleteSchSystemParamsDTO) {
return iSchSystemParamsService.delete(deleteSchSystemParamsDTO);
}
}

@ -0,0 +1,87 @@
package com.docus.server.controller;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.log.annotation.TrackGroup;
import com.docus.server.api.scheduling.management.SchTerminatorApi;
import com.docus.server.common.netty.server.ChannelRepository;
import com.docus.server.common.process.ChannelProcessor;
import com.docus.server.dto.scheduling.management.schterminator.AddSchTerminatorDTO;
import com.docus.server.dto.scheduling.management.schterminator.DeleteSchTerminatorDTO;
import com.docus.server.dto.scheduling.management.schterminator.EditSchTerminatorDTO;
import com.docus.server.service.ISchTerminatorService;
import com.docus.server.vo.scheduling.management.schterminator.SchTerminatorVO;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class SchTerminatorController implements SchTerminatorApi {
@Resource
private ISchTerminatorService iSchTerminatorService;
@Resource
private ChannelRepository channelRepository;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchTerminatorVO findById(String id) {
return iSchTerminatorService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchTerminatorVO> search(SearchDTO searchDTO) {
return iSchTerminatorService.search(searchDTO);
}
/**
*
*
* @param addSchTerminatorDTO
* @return
*/
@Override
public boolean add(AddSchTerminatorDTO addSchTerminatorDTO) {
return iSchTerminatorService.add(addSchTerminatorDTO);
}
/**
*
*
* @param editSchTerminatorDTO
* @return
*/
@TrackGroup(group = "SchTerminatorController", processor = ChannelProcessor.class)
@Override
public boolean edit(EditSchTerminatorDTO editSchTerminatorDTO) {
return iSchTerminatorService.edit(editSchTerminatorDTO);
}
/**
*
*
* @param deleteSchTerminatorDTO
* @return
*/
@Override
public int delete(DeleteSchTerminatorDTO deleteSchTerminatorDTO) {
return iSchTerminatorService.delete(deleteSchTerminatorDTO);
}
}

@ -0,0 +1,80 @@
package com.docus.server.controller;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.scheduling.management.SchVirtualLogApi;
import com.docus.server.dto.scheduling.management.schvirtuallog.AddSchVirtualLogDTO;
import com.docus.server.dto.scheduling.management.schvirtuallog.DeleteSchVirtualLogDTO;
import com.docus.server.dto.scheduling.management.schvirtuallog.EditSchVirtualLogDTO;
import com.docus.server.service.ISchVirtualLogService;
import com.docus.server.vo.scheduling.management.schvirtuallog.SchVirtualLogVO;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 使
*
* @author AutoGenerator
* @since 2023-07-15
*/
@RestController
public class SchVirtualLogController implements SchVirtualLogApi {
@Resource
private ISchVirtualLogService iSchVirtualLogService;
/**
*
*
* @param id Id
* @return
*/
@Override
public SchVirtualLogVO findById(String id) {
return iSchVirtualLogService.findById(id);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchVirtualLogVO> search(SearchDTO searchDTO) {
return iSchVirtualLogService.search(searchDTO);
}
/**
*
*
* @param addSchVirtualLogDTO
* @return
*/
@Override
public boolean add(AddSchVirtualLogDTO addSchVirtualLogDTO) {
return iSchVirtualLogService.add(addSchVirtualLogDTO);
}
/**
*
*
* @param editSchVirtualLogDTO
* @return
*/
@Override
public boolean edit(EditSchVirtualLogDTO editSchVirtualLogDTO) {
return iSchVirtualLogService.edit(editSchVirtualLogDTO);
}
/**
*
*
* @param deleteSchVirtualLogDTO
* @return
*/
@Override
public int delete(DeleteSchVirtualLogDTO deleteSchVirtualLogDTO) {
return iSchVirtualLogService.delete(deleteSchVirtualLogDTO);
}
}

@ -0,0 +1,24 @@
package com.docus.server.convert;
import com.docus.server.common.netty.CommMsg;
import com.docus.server.dto.scheduling.management.schterminator.CommMsgDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface CommMsgConvert {
CommMsgConvert INSTANCE = Mappers.getMapper(CommMsgConvert.class);
@Mappings({})
CommMsg convertDO(CommMsgDTO commMsgDTO);
}

@ -0,0 +1,48 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectErrorLog;
import com.docus.server.dto.scheduling.management.schcollecterrorlog.AddSchCollectErrorLogDTO;
import com.docus.server.dto.scheduling.management.schcollecterrorlog.EditSchCollectErrorLogDTO;
import com.docus.server.dto.scheduling.management.schcollecterrorlog.DeleteSchCollectErrorLogDTO;
import com.docus.server.vo.scheduling.management.schcollecterrorlog.SchCollectErrorLogVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectErrorLogConvert {
SchCollectErrorLogConvert INSTANCE = Mappers.getMapper(SchCollectErrorLogConvert.class);
@Mappings({})
SchCollectErrorLog convertDO(AddSchCollectErrorLogDTO addSchCollectErrorLogDTO);
@Mappings({})
SchCollectErrorLog convertDO(EditSchCollectErrorLogDTO editSchCollectErrorLogDTO);
@Mappings({})
List<SchCollectErrorLog> convertAddDOList(List<AddSchCollectErrorLogDTO> addSchCollectErrorLogDTO);
@Mappings({})
List<SchCollectErrorLog> convertEditDOList(List<EditSchCollectErrorLogDTO> editSchCollectErrorLogDTO);
@Mappings({})
SchCollectErrorLogVO convertVO(SchCollectErrorLog schCollectErrorLog);
@Mappings({})
List<SchCollectErrorLogVO> convertVO(List<SchCollectErrorLog> schCollectErrorLogList);
@Mappings({})
PageResult<SchCollectErrorLogVO> convertVO(PageResult<SchCollectErrorLog> pageResult);
}

@ -0,0 +1,47 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.dto.scheduling.management.schcollectrecord.AddSchCollectRecordDTO;
import com.docus.server.dto.scheduling.management.schcollectrecord.EditSchCollectRecordDTO;
import com.docus.server.entity.scheduling.management.SchCollectRecord;
import com.docus.server.vo.scheduling.management.schcollectrecord.SchCollectRecordVO;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectRecordConvert {
SchCollectRecordConvert INSTANCE = Mappers.getMapper(SchCollectRecordConvert.class);
@Mappings({})
SchCollectRecord convertDO(AddSchCollectRecordDTO addSchCollectRecordDTO);
@Mappings({})
SchCollectRecord convertDO(EditSchCollectRecordDTO editSchCollectRecordDTO, @MappingTarget SchCollectRecord schCollectRecord);
@Mappings({})
List<SchCollectRecord> convertAddDOList(List<AddSchCollectRecordDTO> addSchCollectRecordDTO);
@Mappings({})
List<SchCollectRecord> convertEditDOList(List<EditSchCollectRecordDTO> editSchCollectRecordDTO);
@Mappings({})
SchCollectRecordVO convertVO(SchCollectRecord schCollectRecord);
@Mappings({})
List<SchCollectRecordVO> convertVO(List<SchCollectRecord> schCollectRecordList);
@Mappings({})
PageResult<SchCollectRecordVO> convertVO(PageResult<SchCollectRecord> pageResult);
}

@ -0,0 +1,51 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.dto.scheduling.management.schcollectrecord.EditSchCollectRecordDTO;
import com.docus.server.dto.scheduling.management.schcollectrecordretrylog.AddSchCollectRecordRetryLogDTO;
import com.docus.server.dto.scheduling.management.schcollectrecordretrylog.EditSchCollectRecordRetryLogDTO;
import com.docus.server.entity.scheduling.management.SchCollectRecordRetryLog;
import com.docus.server.vo.scheduling.management.schcollectrecordretrylog.SchCollectRecordRetryLogVO;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectRecordRetryLogConvert {
SchCollectRecordRetryLogConvert INSTANCE = Mappers.getMapper(SchCollectRecordRetryLogConvert.class);
@Mappings({})
SchCollectRecordRetryLog convertDO(EditSchCollectRecordDTO editSchCollectRecordDTO, @MappingTarget SchCollectRecordRetryLog schCollectRecordRetryLog);
@Mappings({})
SchCollectRecordRetryLog convertDO(AddSchCollectRecordRetryLogDTO addSchCollectRecordRetryLogDTO);
@Mappings({})
SchCollectRecordRetryLog convertDO(EditSchCollectRecordRetryLogDTO editSchCollectRecordRetryLogDTO);
@Mappings({})
List<SchCollectRecordRetryLog> convertAddDOList(List<AddSchCollectRecordRetryLogDTO> addSchCollectRecordRetryLogDTO);
@Mappings({})
List<SchCollectRecordRetryLog> convertEditDOList(List<EditSchCollectRecordRetryLogDTO> editSchCollectRecordRetryLogDTO);
@Mappings({})
SchCollectRecordRetryLogVO convertVO(SchCollectRecordRetryLog schCollectRecordRetryLog);
@Mappings({})
List<SchCollectRecordRetryLogVO> convertVO(List<SchCollectRecordRetryLog> schCollectRecordRetryLogList);
@Mappings({})
PageResult<SchCollectRecordRetryLogVO> convertVO(PageResult<SchCollectRecordRetryLog> pageResult);
}

@ -0,0 +1,44 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.dto.scheduling.management.schcollectorconfig.AddSchCollectorConfigDTO;
import com.docus.server.dto.scheduling.management.schcollectorconfig.EditSchCollectorConfigDTO;
import com.docus.server.entity.scheduling.management.SchCollectorConfig;
import com.docus.server.vo.scheduling.management.schcollectorconfig.SchCollectorConfigVO;
import com.docus.server.vo.scheduling.management.schcollectorconfig.TcpSchCollectorConfigVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectorConfigConvert {
SchCollectorConfigConvert INSTANCE = Mappers.getMapper(SchCollectorConfigConvert.class);
@Mappings({})
SchCollectorConfig convertDO(AddSchCollectorConfigDTO addSchCollectorConfigDTO);
@Mappings({})
SchCollectorConfig convertDO(EditSchCollectorConfigDTO editSchCollectorConfigDTO);
@Mappings({})
SchCollectorConfigVO convertVO(SchCollectorConfig schCollectorConfig);
@Mappings({})
PageResult<SchCollectorConfigVO> convertVO(PageResult<SchCollectorConfig> pageResult);
@Mappings({})
List<TcpSchCollectorConfigVO> convertTcpVOList(List<SchCollectorConfig> publicConfig);
@Mappings({})
TcpSchCollectorConfigVO convertTcpVO(SchCollectorConfig schCollectorConfig);
}

@ -0,0 +1,47 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.dto.scheduling.management.schcollector.AddSchCollectorDTO;
import com.docus.server.dto.scheduling.management.schcollector.EditSchCollectorDTO;
import com.docus.server.entity.scheduling.management.SchCollector;
import com.docus.server.vo.scheduling.management.schcollector.SchCollectorVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectorConvert {
SchCollectorConvert INSTANCE = Mappers.getMapper(SchCollectorConvert.class);
@Mappings({})
SchCollector convertDO(AddSchCollectorDTO addSchCollectorDTO);
@Mappings({})
SchCollector convertDO(EditSchCollectorDTO editSchCollectorDTO);
@Mappings({})
List<SchCollector> convertAddDOList(List<AddSchCollectorDTO> addSchCollectorDTO);
@Mappings({})
List<SchCollector> convertEditDOList(List<EditSchCollectorDTO> editSchCollectorDTO);
@Mappings({})
SchCollectorVO convertVO(SchCollector schCollector);
@Mappings({})
List<SchCollectorVO> convertVO(List<SchCollector> schCollectorList);
@Mappings({})
PageResult<SchCollectorVO> convertVO(PageResult<SchCollector> pageResult);
}

@ -0,0 +1,46 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.dto.scheduling.management.schcollectorversion.AddSchCollectorVersionDTO;
import com.docus.server.dto.scheduling.management.schcollectorversion.EditSchCollectorVersionDTO;
import com.docus.server.entity.scheduling.management.SchCollectorVersion;
import com.docus.server.vo.scheduling.management.schcollectorversion.SchCollectorVersionVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectorVersionConvert {
SchCollectorVersionConvert INSTANCE = Mappers.getMapper(SchCollectorVersionConvert.class);
@Mappings({})
SchCollectorVersion convertDO(AddSchCollectorVersionDTO addSchCollectorVersionDTO);
@Mappings({})
SchCollectorVersion convertDO(EditSchCollectorVersionDTO editSchCollectorVersionDTO);
@Mappings({})
List<SchCollectorVersion> convertAddDOList(List<AddSchCollectorVersionDTO> addSchCollectorVersionDTO);
@Mappings({})
List<SchCollectorVersion> convertEditDOList(List<EditSchCollectorVersionDTO> editSchCollectorVersionDTO);
@Mappings({})
SchCollectorVersionVO convertVO(SchCollectorVersion schCollectorVersion);
@Mappings({})
List<SchCollectorVersionVO> convertVO(List<SchCollectorVersion> schCollectorVersionList);
@Mappings({})
PageResult<SchCollectorVersionVO> convertVO(PageResult<SchCollectorVersion> pageResult);
}

@ -0,0 +1,48 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectorVersionFile;
import com.docus.server.dto.scheduling.management.schcollectorversionfile.AddSchCollectorVersionFileDTO;
import com.docus.server.dto.scheduling.management.schcollectorversionfile.EditSchCollectorVersionFileDTO;
import com.docus.server.dto.scheduling.management.schcollectorversionfile.DeleteSchCollectorVersionFileDTO;
import com.docus.server.vo.scheduling.management.schcollectorversionfile.SchCollectorVersionFileVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectorVersionFileConvert {
SchCollectorVersionFileConvert INSTANCE = Mappers.getMapper(SchCollectorVersionFileConvert.class);
@Mappings({})
SchCollectorVersionFile convertDO(AddSchCollectorVersionFileDTO addSchCollectorVersionFileDTO);
@Mappings({})
SchCollectorVersionFile convertDO(EditSchCollectorVersionFileDTO editSchCollectorVersionFileDTO);
@Mappings({})
List<SchCollectorVersionFile> convertAddDOList(List<AddSchCollectorVersionFileDTO> addSchCollectorVersionFileDTO);
@Mappings({})
List<SchCollectorVersionFile> convertEditDOList(List<EditSchCollectorVersionFileDTO> editSchCollectorVersionFileDTO);
@Mappings({})
SchCollectorVersionFileVO convertVO(SchCollectorVersionFile schCollectorVersionFile);
@Mappings({})
List<SchCollectorVersionFileVO> convertVO(List<SchCollectorVersionFile> schCollectorVersionFileList);
@Mappings({})
PageResult<SchCollectorVersionFileVO> convertVO(PageResult<SchCollectorVersionFile> pageResult);
}

@ -0,0 +1,48 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectorVersionLog;
import com.docus.server.dto.scheduling.management.schcollectorversionlog.AddSchCollectorVersionLogDTO;
import com.docus.server.dto.scheduling.management.schcollectorversionlog.EditSchCollectorVersionLogDTO;
import com.docus.server.dto.scheduling.management.schcollectorversionlog.DeleteSchCollectorVersionLogDTO;
import com.docus.server.vo.scheduling.management.schcollectorversionlog.SchCollectorVersionLogVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectorVersionLogConvert {
SchCollectorVersionLogConvert INSTANCE = Mappers.getMapper(SchCollectorVersionLogConvert.class);
@Mappings({})
SchCollectorVersionLog convertDO(AddSchCollectorVersionLogDTO addSchCollectorVersionLogDTO);
@Mappings({})
SchCollectorVersionLog convertDO(EditSchCollectorVersionLogDTO editSchCollectorVersionLogDTO);
@Mappings({})
List<SchCollectorVersionLog> convertAddDOList(List<AddSchCollectorVersionLogDTO> addSchCollectorVersionLogDTO);
@Mappings({})
List<SchCollectorVersionLog> convertEditDOList(List<EditSchCollectorVersionLogDTO> editSchCollectorVersionLogDTO);
@Mappings({})
SchCollectorVersionLogVO convertVO(SchCollectorVersionLog schCollectorVersionLog);
@Mappings({})
List<SchCollectorVersionLogVO> convertVO(List<SchCollectorVersionLog> schCollectorVersionLogList);
@Mappings({})
PageResult<SchCollectorVersionLogVO> convertVO(PageResult<SchCollectorVersionLog> pageResult);
}

@ -0,0 +1,48 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchOperationLog;
import com.docus.server.dto.scheduling.management.schoperationlog.AddSchOperationLogDTO;
import com.docus.server.dto.scheduling.management.schoperationlog.EditSchOperationLogDTO;
import com.docus.server.dto.scheduling.management.schoperationlog.DeleteSchOperationLogDTO;
import com.docus.server.vo.scheduling.management.schoperationlog.SchOperationLogVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchOperationLogConvert {
SchOperationLogConvert INSTANCE = Mappers.getMapper(SchOperationLogConvert.class);
@Mappings({})
SchOperationLog convertDO(AddSchOperationLogDTO addSchOperationLogDTO);
@Mappings({})
SchOperationLog convertDO(EditSchOperationLogDTO editSchOperationLogDTO);
@Mappings({})
List<SchOperationLog> convertAddDOList(List<AddSchOperationLogDTO> addSchOperationLogDTO);
@Mappings({})
List<SchOperationLog> convertEditDOList(List<EditSchOperationLogDTO> editSchOperationLogDTO);
@Mappings({})
SchOperationLogVO convertVO(SchOperationLog schOperationLog);
@Mappings({})
List<SchOperationLogVO> convertVO(List<SchOperationLog> schOperationLogList);
@Mappings({})
PageResult<SchOperationLogVO> convertVO(PageResult<SchOperationLog> pageResult);
}

@ -0,0 +1,48 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchSystemParams;
import com.docus.server.dto.scheduling.management.schsystemparams.AddSchSystemParamsDTO;
import com.docus.server.dto.scheduling.management.schsystemparams.EditSchSystemParamsDTO;
import com.docus.server.dto.scheduling.management.schsystemparams.DeleteSchSystemParamsDTO;
import com.docus.server.vo.scheduling.management.schsystemparams.SchSystemParamsVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchSystemParamsConvert {
SchSystemParamsConvert INSTANCE = Mappers.getMapper(SchSystemParamsConvert.class);
@Mappings({})
SchSystemParams convertDO(AddSchSystemParamsDTO addSchSystemParamsDTO);
@Mappings({})
SchSystemParams convertDO(EditSchSystemParamsDTO editSchSystemParamsDTO);
@Mappings({})
List<SchSystemParams> convertAddDOList(List<AddSchSystemParamsDTO> addSchSystemParamsDTO);
@Mappings({})
List<SchSystemParams> convertEditDOList(List<EditSchSystemParamsDTO> editSchSystemParamsDTO);
@Mappings({})
SchSystemParamsVO convertVO(SchSystemParams schSystemParams);
@Mappings({})
List<SchSystemParamsVO> convertVO(List<SchSystemParams> schSystemParamsList);
@Mappings({})
PageResult<SchSystemParamsVO> convertVO(PageResult<SchSystemParams> pageResult);
}

@ -0,0 +1,42 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.dto.scheduling.management.schterminator.AddSchTerminatorDTO;
import com.docus.server.dto.scheduling.management.schterminator.EditSchTerminatorDTO;
import com.docus.server.entity.scheduling.management.SchTerminator;
import com.docus.server.vo.scheduling.management.schterminator.SchTerminatorVO;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
*
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchTerminatorConvert {
SchTerminatorConvert INSTANCE = Mappers.getMapper(SchTerminatorConvert.class);
@Mappings({})
SchTerminator convertDO(AddSchTerminatorDTO addSchTerminatorDTO);
@Mappings({})
SchTerminator convertDO(EditSchTerminatorDTO editSchTerminatorDTO, @MappingTarget SchTerminator schTerminator1);
@Mappings({})
SchTerminatorVO convertVO(SchTerminator schTerminator);
@Mappings({})
List<SchTerminatorVO> convertVO(List<SchTerminator> schTerminatorList);
@Mappings({})
PageResult<SchTerminatorVO> convertVO(PageResult<SchTerminator> pageResult);
}

@ -0,0 +1,46 @@
package com.docus.server.convert;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.dto.scheduling.management.schvirtuallog.AddSchVirtualLogDTO;
import com.docus.server.dto.scheduling.management.schvirtuallog.EditSchVirtualLogDTO;
import com.docus.server.entity.scheduling.management.SchVirtualLog;
import com.docus.server.vo.scheduling.management.schvirtuallog.SchVirtualLogVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 使
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchVirtualLogConvert {
SchVirtualLogConvert INSTANCE = Mappers.getMapper(SchVirtualLogConvert.class);
@Mappings({})
SchVirtualLog convertDO(AddSchVirtualLogDTO addSchVirtualLogDTO);
@Mappings({})
SchVirtualLog convertDO(EditSchVirtualLogDTO editSchVirtualLogDTO);
@Mappings({})
List<SchVirtualLog> convertAddDOList(List<AddSchVirtualLogDTO> addSchVirtualLogDTO);
@Mappings({})
List<SchVirtualLog> convertEditDOList(List<EditSchVirtualLogDTO> editSchVirtualLogDTO);
@Mappings({})
SchVirtualLogVO convertVO(SchVirtualLog schVirtualLog);
@Mappings({})
List<SchVirtualLogVO> convertVO(List<SchVirtualLog> schVirtualLogList);
@Mappings({})
PageResult<SchVirtualLogVO> convertVO(PageResult<SchVirtualLog> pageResult);
}

@ -0,0 +1,7 @@
package com.docus.server.infrastructure.cache;
import com.docus.server.annotation.CacheLayer;
@CacheLayer("schetaskCacheLayer")
public class TaskCacheLayer {
}

@ -0,0 +1,4 @@
package com.docus.server.infrastructure.client;
public class DownLoadAPI {
}

@ -0,0 +1,57 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectErrorLog;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchCollectErrorLogDao extends IBaseDao<SchCollectErrorLog> {
/**
*
*
* @param id id
* @return
*/
SchCollectErrorLog findById(String id);
/**
*
*
* @param schCollectErrorLog
* @return
*/
boolean add(SchCollectErrorLog schCollectErrorLog);
/**
*
*
* @param schCollectErrorLog
* @return
*/
boolean edit(SchCollectErrorLog schCollectErrorLog);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchCollectErrorLog> search(SearchDTO searchDTO);
}

@ -0,0 +1,57 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectRecord;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchCollectRecordDao extends IBaseDao<SchCollectRecord> {
/**
*
*
* @param id id
* @return
*/
SchCollectRecord findById(String id);
/**
*
*
* @param schCollectRecord
* @return
*/
boolean add(SchCollectRecord schCollectRecord);
/**
*
*
* @param schCollectRecord
* @return
*/
boolean edit(SchCollectRecord schCollectRecord);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchCollectRecord> search(SearchDTO searchDTO);
}

@ -0,0 +1,57 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectRecordRetryLog;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchCollectRecordRetryLogDao extends IBaseDao<SchCollectRecordRetryLog> {
/**
*
*
* @param id id
* @return
*/
SchCollectRecordRetryLog findById(String id);
/**
*
*
* @param schCollectRecordRetryLog
* @return
*/
boolean add(SchCollectRecordRetryLog schCollectRecordRetryLog);
/**
*
*
* @param schCollectRecordRetryLog
* @return
*/
boolean edit(SchCollectRecordRetryLog schCollectRecordRetryLog);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchCollectRecordRetryLog> search(SearchDTO searchDTO);
}

@ -0,0 +1,57 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectorConfig;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchCollectorConfigDao extends IBaseDao<SchCollectorConfig> {
/**
*
*
* @param id id
* @return
*/
SchCollectorConfig findById(String id);
/**
*
*
* @param schCollectorConfig
* @return
*/
boolean add(SchCollectorConfig schCollectorConfig);
/**
*
*
* @param schCollectorConfig
* @return
*/
boolean edit(SchCollectorConfig schCollectorConfig);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchCollectorConfig> search(SearchDTO searchDTO);
}

@ -0,0 +1,57 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollector;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchCollectorDao extends IBaseDao<SchCollector> {
/**
*
*
* @param id id
* @return
*/
SchCollector findById(String id);
/**
*
*
* @param schCollector
* @return
*/
boolean add(SchCollector schCollector);
/**
*
*
* @param schCollector
* @return
*/
boolean edit(SchCollector schCollector);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchCollector> search(SearchDTO searchDTO);
}

@ -0,0 +1,66 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectorVersion;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchCollectorVersionDao extends IBaseDao<SchCollectorVersion> {
/**
*
*
* @param id id
* @return
*/
SchCollectorVersion findById(String id);
/**
*
*
* @param schCollectorVersion
* @return
*/
boolean add(SchCollectorVersion schCollectorVersion);
/**
*
*
* @param schCollectorVersion
* @return
*/
boolean edit(SchCollectorVersion schCollectorVersion);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchCollectorVersion> search(SearchDTO searchDTO);
/**
* id
*
* @param collectorId id
* @param collectorVersionNo
* @return SchCollectorVersion
*/
SchCollectorVersion findByVersion(Long collectorId, String collectorVersionNo);
}

@ -0,0 +1,58 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectorVersionFile;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchCollectorVersionFileDao extends IBaseDao<SchCollectorVersionFile> {
/**
*
*
* @param id id
* @return
*/
SchCollectorVersionFile findById(String id);
/**
*
*
* @param schCollectorVersionFile
* @return
*/
boolean add(SchCollectorVersionFile schCollectorVersionFile);
/**
*
*
* @param schCollectorVersionFile
* @return
*/
boolean edit(SchCollectorVersionFile schCollectorVersionFile);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchCollectorVersionFile> search(SearchDTO searchDTO);
SchCollectorVersionFile findByVersionIdAndCollectorId(Long collectorId, Long collectorVersionId);
}

@ -0,0 +1,57 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectorVersionLog;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchCollectorVersionLogDao extends IBaseDao<SchCollectorVersionLog> {
/**
*
*
* @param id id
* @return
*/
SchCollectorVersionLog findById(String id);
/**
*
*
* @param schCollectorVersionLog
* @return
*/
boolean add(SchCollectorVersionLog schCollectorVersionLog);
/**
*
*
* @param schCollectorVersionLog
* @return
*/
boolean edit(SchCollectorVersionLog schCollectorVersionLog);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchCollectorVersionLog> search(SearchDTO searchDTO);
}

@ -0,0 +1,57 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchOperationLog;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchOperationLogDao extends IBaseDao<SchOperationLog> {
/**
*
*
* @param id id
* @return
*/
SchOperationLog findById(String id);
/**
*
*
* @param schOperationLog
* @return
*/
boolean add(SchOperationLog schOperationLog);
/**
*
*
* @param schOperationLog
* @return
*/
boolean edit(SchOperationLog schOperationLog);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchOperationLog> search(SearchDTO searchDTO);
}

@ -0,0 +1,57 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchSystemParams;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchSystemParamsDao extends IBaseDao<SchSystemParams> {
/**
*
*
* @param id id
* @return
*/
SchSystemParams findById(String id);
/**
*
*
* @param schSystemParams
* @return
*/
boolean add(SchSystemParams schSystemParams);
/**
*
*
* @param schSystemParams
* @return
*/
boolean edit(SchSystemParams schSystemParams);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchSystemParams> search(SearchDTO searchDTO);
}

@ -0,0 +1,57 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchTerminator;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchTerminatorDao extends IBaseDao<SchTerminator> {
/**
*
*
* @param id id
* @return
*/
SchTerminator findById(String id);
/**
*
*
* @param schTerminator
* @return
*/
boolean add(SchTerminator schTerminator);
/**
*
*
* @param schTerminator
* @return
*/
boolean edit(SchTerminator schTerminator);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchTerminator> search(SearchDTO searchDTO);
}

@ -0,0 +1,57 @@
package com.docus.server.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchVirtualLog;
import java.util.List;
/**
* 使 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
public interface ISchVirtualLogDao extends IBaseDao<SchVirtualLog> {
/**
*
*
* @param id id
* @return
*/
SchVirtualLog findById(String id);
/**
*
*
* @param schVirtualLog
* @return
*/
boolean add(SchVirtualLog schVirtualLog);
/**
*
*
* @param schVirtualLog
* @return
*/
boolean edit(SchVirtualLog schVirtualLog);
/**
*
*
* @param ids ids
* @return
*/
int delete(List<Long> ids);
/**
*
*
* @param searchDTO
* @return
*/
PageResult<SchVirtualLog> search(SearchDTO searchDTO);
}

@ -0,0 +1,104 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectErrorLog;
import com.docus.server.infrastructure.dao.ISchCollectErrorLogDao;
import com.docus.server.infrastructure.mapper.SchCollectErrorLogMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchCollectErrorLogDaoImpl extends BaseDaoImpl<SchCollectErrorLogMapper, SchCollectErrorLog> implements ISchCollectErrorLogDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectErrorLog findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schCollectErrorLog
* @return
*/
@Override
public boolean add(SchCollectErrorLog schCollectErrorLog) {
return super.save(schCollectErrorLog);
}
/**
*
*
* @param schCollectErrorLog
* @return
*/
@Override
public boolean edit(SchCollectErrorLog schCollectErrorLog) {
return super.updateById(schCollectErrorLog);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectErrorLog> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchCollectErrorLog> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchCollectErrorLog::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
query.le(SchCollectErrorLog::getCreateTime, endTime);
}
//关键字比较多个列or
//if (!StringUtils.isEmpty(searchDTO.getKeyword())) {
//单个列用like
//query. like(SchCollectErrorLog::getxxx, searchDTO.getKeyword());
//多个列用like
//query. and(sub -> sub.like(SchCollectErrorLog::getxx1, searchDTO.getKeyword())
// оr(). like(SchCollectErrorLog::getXX2, searchDTO.getKeyword()))
//);
//}
//默认createTime倒序排序
query.orderByDesc(SchCollectErrorLog::getCreateTime);
List<SchCollectErrorLog> list = super.find(query);
return new PageResult<>(list);
}
}

@ -0,0 +1,101 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectRecord;
import com.docus.server.infrastructure.dao.ISchCollectRecordDao;
import com.docus.server.infrastructure.mapper.SchCollectRecordMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchCollectRecordDaoImpl extends BaseDaoImpl<SchCollectRecordMapper, SchCollectRecord> implements ISchCollectRecordDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectRecord findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schCollectRecord
* @return
*/
@Override
public boolean add(SchCollectRecord schCollectRecord) {
return super.save(schCollectRecord);
}
/**
*
*
* @param schCollectRecord
* @return
*/
@Override
public boolean edit(SchCollectRecord schCollectRecord) {
return super.updateById(schCollectRecord);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectRecord> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchCollectRecord> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchCollectRecord::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
query.le(SchCollectRecord::getCreateTime, searchDTO.getEndTime());
}
Object collectorId = searchDTO.getParams("collectorId");
if (Func.isNotEmpty(collectorId)) {
query.eq(SchCollectRecord::getCollectorId, collectorId);
}
//默认createTime倒序排序
query.orderByDesc(SchCollectRecord::getCreateTime);
List<SchCollectRecord> list = super.find(query);
return new PageResult<>(list);
}
}

@ -0,0 +1,100 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectRecordRetryLog;
import com.docus.server.infrastructure.dao.ISchCollectRecordRetryLogDao;
import com.docus.server.infrastructure.mapper.SchCollectRecordRetryLogMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchCollectRecordRetryLogDaoImpl extends BaseDaoImpl<SchCollectRecordRetryLogMapper, SchCollectRecordRetryLog> implements ISchCollectRecordRetryLogDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectRecordRetryLog findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schCollectRecordRetryLog
* @return
*/
@Override
public boolean add(SchCollectRecordRetryLog schCollectRecordRetryLog) {
return super.save(schCollectRecordRetryLog);
}
/**
*
*
* @param schCollectRecordRetryLog
* @return
*/
@Override
public boolean edit(SchCollectRecordRetryLog schCollectRecordRetryLog) {
return super.updateById(schCollectRecordRetryLog);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectRecordRetryLog> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchCollectRecordRetryLog> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchCollectRecordRetryLog::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
query.le(SchCollectRecordRetryLog::getCreateTime, searchDTO.getEndTime());
}
Object collectorId = searchDTO.getParams("collectorId");
if (Func.isNotEmpty(collectorId)) {
query.eq(SchCollectRecordRetryLog::getCollectorId, collectorId);
}
//默认createTime倒序排序
query.orderByDesc(SchCollectRecordRetryLog::getCreateTime);
List<SchCollectRecordRetryLog> list = super.find(query);
return new PageResult<>(list);
}
}

@ -0,0 +1,109 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectorConfig;
import com.docus.server.infrastructure.dao.ISchCollectorConfigDao;
import com.docus.server.infrastructure.mapper.SchCollectorConfigMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchCollectorConfigDaoImpl extends BaseDaoImpl<SchCollectorConfigMapper, SchCollectorConfig> implements ISchCollectorConfigDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectorConfig findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schCollectorConfig
* @return
*/
@Override
public boolean add(SchCollectorConfig schCollectorConfig) {
return super.save(schCollectorConfig);
}
/**
*
*
* @param schCollectorConfig
* @return
*/
@Override
public boolean edit(SchCollectorConfig schCollectorConfig) {
return super.updateById(schCollectorConfig);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectorConfig> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchCollectorConfig> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchCollectorConfig::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
query.le(SchCollectorConfig::getCreateTime, endTime);
}
if (searchDTO.getParams("collectorId") != null && searchDTO.getParams("collectorId") != "") {
query.eq(SchCollectorConfig::getCollectorId, searchDTO.getParams("collectorId"));
}
if (searchDTO.getParams("configType") != null && searchDTO.getParams("configType") != "") {
query.eq(SchCollectorConfig::getConfigType, searchDTO.getParams("configType"));
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
query.le(SchCollectorConfig::getCreateTime, endTime);
}
//默认createTime倒序排序
query.orderByDesc(SchCollectorConfig::getCreateTime);
List<SchCollectorConfig> list = super.find(query);
return new PageResult<>(list);
}
}

@ -0,0 +1,102 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollector;
import com.docus.server.infrastructure.dao.ISchCollectorDao;
import com.docus.server.infrastructure.mapper.SchCollectorMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchCollectorDaoImpl extends BaseDaoImpl<SchCollectorMapper, SchCollector> implements ISchCollectorDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollector findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schCollector
* @return
*/
@Override
public boolean add(SchCollector schCollector) {
return super.save(schCollector);
}
/**
*
*
* @param schCollector
* @return
*/
@Override
public boolean edit(SchCollector schCollector) {
return super.updateById(schCollector);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollector> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchCollector> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchCollector::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
query.le(SchCollector::getCreateTime, endTime);
}
Object collectorId = searchDTO.getParams("collectorId");
if (Func.isNotEmpty(collectorId)) {
query.eq(SchCollector::getCollectorId, collectorId);
}
//默认createTime倒序排序
query.orderByDesc(SchCollector::getCreateTime);
List<SchCollector> list = super.find(query);
return new PageResult<>(list);
}
}

@ -0,0 +1,117 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectorVersion;
import com.docus.server.infrastructure.dao.ISchCollectorVersionDao;
import com.docus.server.infrastructure.mapper.SchCollectorVersionMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchCollectorVersionDaoImpl extends BaseDaoImpl<SchCollectorVersionMapper, SchCollectorVersion> implements ISchCollectorVersionDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectorVersion findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schCollectorVersion
* @return
*/
@Override
public boolean add(SchCollectorVersion schCollectorVersion) {
return super.save(schCollectorVersion);
}
/**
*
*
* @param schCollectorVersion
* @return
*/
@Override
public boolean edit(SchCollectorVersion schCollectorVersion) {
return super.updateById(schCollectorVersion);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectorVersion> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchCollectorVersion> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchCollectorVersion::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
query.le(SchCollectorVersion::getCreateTime, endTime);
}
Object collectorId = searchDTO.getParams("collectorId");
if (Func.isNotEmpty(collectorId)) {
query.eq(SchCollectorVersion::getCollectorId, collectorId);
}
//默认createTime倒序排序
query.orderByDesc(SchCollectorVersion::getCreateTime);
List<SchCollectorVersion> list = super.find(query);
return new PageResult<>(list);
}
@Override
public SchCollectorVersion findByVersion(Long collectorId, String collectorVersionNo) {
LambdaQueryWrapper<SchCollectorVersion> query = Wrappers.lambdaQuery();
if (Func.isNotEmpty(collectorId)) {
query.ge(SchCollectorVersion::getCollectorId, collectorId);
}
if (Func.isNotBlank(collectorVersionNo)) {
query.le(SchCollectorVersion::getCollectVersion, collectorVersionNo);
}
return super.findOne(query);
}
}

@ -0,0 +1,112 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectorVersionFile;
import com.docus.server.enums.CancelEnum;
import com.docus.server.infrastructure.dao.ISchCollectorVersionFileDao;
import com.docus.server.infrastructure.mapper.SchCollectorVersionFileMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchCollectorVersionFileDaoImpl extends BaseDaoImpl<SchCollectorVersionFileMapper, SchCollectorVersionFile> implements ISchCollectorVersionFileDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectorVersionFile findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schCollectorVersionFile
* @return
*/
@Override
public boolean add(SchCollectorVersionFile schCollectorVersionFile) {
return super.save(schCollectorVersionFile);
}
/**
*
*
* @param schCollectorVersionFile
* @return
*/
@Override
public boolean edit(SchCollectorVersionFile schCollectorVersionFile) {
return super.updateById(schCollectorVersionFile);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectorVersionFile> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchCollectorVersionFile> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchCollectorVersionFile::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
query.le(SchCollectorVersionFile::getCreateTime, endTime);
}
//默认createTime倒序排序
query.orderByDesc(SchCollectorVersionFile::getCreateTime);
List<SchCollectorVersionFile> list = super.find(query);
return new PageResult<>(list);
}
@Override
public SchCollectorVersionFile findByVersionIdAndCollectorId(Long collectorId, Long collectorVersionId) {
LambdaQueryWrapper<SchCollectorVersionFile> query = Wrappers.lambdaQuery();
if (Func.isNotEmpty(collectorId)) {
query.eq(SchCollectorVersionFile::getCollectorId, collectorId);
}
if (Func.isNotEmpty(collectorVersionId)) {
query.eq(SchCollectorVersionFile::getCollectorVersionId, collectorVersionId);
}
query.ne(SchCollectorVersionFile::getState, CancelEnum.CANCEL);
return super.findOne(query);
}
}

@ -0,0 +1,100 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchCollectorVersionLog;
import com.docus.server.infrastructure.dao.ISchCollectorVersionLogDao;
import com.docus.server.infrastructure.mapper.SchCollectorVersionLogMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchCollectorVersionLogDaoImpl extends BaseDaoImpl<SchCollectorVersionLogMapper, SchCollectorVersionLog> implements ISchCollectorVersionLogDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchCollectorVersionLog findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schCollectorVersionLog
* @return
*/
@Override
public boolean add(SchCollectorVersionLog schCollectorVersionLog) {
return super.save(schCollectorVersionLog);
}
/**
*
*
* @param schCollectorVersionLog
* @return
*/
@Override
public boolean edit(SchCollectorVersionLog schCollectorVersionLog) {
return super.updateById(schCollectorVersionLog);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchCollectorVersionLog> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchCollectorVersionLog> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchCollectorVersionLog::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
query.le(SchCollectorVersionLog::getCreateTime, endTime);
}
Object collectorId = searchDTO.getParams("collectorId");
if (Func.isNotEmpty(collectorId)) {
query.eq(SchCollectorVersionLog::getCollectorId, collectorId);
}
//默认createTime倒序排序
query.orderByDesc(SchCollectorVersionLog::getCreateTime);
List<SchCollectorVersionLog> list = super.find(query);
return new PageResult<>(list);
}
}

@ -0,0 +1,104 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchOperationLog;
import com.docus.server.infrastructure.dao.ISchOperationLogDao;
import com.docus.server.infrastructure.mapper.SchOperationLogMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchOperationLogDaoImpl extends BaseDaoImpl<SchOperationLogMapper, SchOperationLog> implements ISchOperationLogDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchOperationLog findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schOperationLog
* @return
*/
@Override
public boolean add(SchOperationLog schOperationLog) {
return super.save(schOperationLog);
}
/**
*
*
* @param schOperationLog
* @return
*/
@Override
public boolean edit(SchOperationLog schOperationLog) {
return super.updateById(schOperationLog);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchOperationLog> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchOperationLog> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchOperationLog::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
query.le(SchOperationLog::getCreateTime, endTime);
}
//关键字比较多个列or
//if (!StringUtils.isEmpty(searchDTO.getKeyword())) {
//单个列用like
//query. like(SchOperationLog::getxxx, searchDTO.getKeyword());
//多个列用like
//query. and(sub -> sub.like(SchOperationLog::getxx1, searchDTO.getKeyword())
// оr(). like(SchOperationLog::getXX2, searchDTO.getKeyword()))
//);
//}
//默认createTime倒序排序
query.orderByDesc(SchOperationLog::getCreateTime);
List<SchOperationLog> list = super.find(query);
return new PageResult<>(list);
}
}

@ -0,0 +1,103 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchSystemParams;
import com.docus.server.infrastructure.dao.ISchSystemParamsDao;
import com.docus.server.infrastructure.mapper.SchSystemParamsMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchSystemParamsDaoImpl extends BaseDaoImpl<SchSystemParamsMapper, SchSystemParams> implements ISchSystemParamsDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchSystemParams findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schSystemParams
* @return
*/
@Override
public boolean add(SchSystemParams schSystemParams) {
return super.save(schSystemParams);
}
/**
*
*
* @param schSystemParams
* @return
*/
@Override
public boolean edit(SchSystemParams schSystemParams) {
return super.updateById(schSystemParams);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchSystemParams> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchSystemParams> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchSystemParams::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
query.le(SchSystemParams::getCreateTime, endTime);
}
//分组查询系统参数表
String paramGroup = String.valueOf(searchDTO.getParams("paramGroup"));
if (Func.isNotBlank(paramGroup)) {
query.eq(SchSystemParams::getParamGroup, paramGroup);
}
//默认createTime倒序排序
query.orderByDesc(SchSystemParams::getCreateTime);
List<SchSystemParams> list = super.find(query);
return new PageResult<>(list);
}
}

@ -0,0 +1,101 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchTerminator;
import com.docus.server.infrastructure.dao.ISchTerminatorDao;
import com.docus.server.infrastructure.mapper.SchTerminatorMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchTerminatorDaoImpl extends BaseDaoImpl<SchTerminatorMapper, SchTerminator> implements ISchTerminatorDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchTerminator findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schTerminator
* @return
*/
@Override
public boolean add(SchTerminator schTerminator) {
return super.save(schTerminator);
}
/**
*
*
* @param schTerminator
* @return
*/
@Override
public boolean edit(SchTerminator schTerminator) {
return super.updateById(schTerminator);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchTerminator> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchTerminator> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchTerminator::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
query.le(SchTerminator::getCreateTime, endTime);
}
//在线状态
if (searchDTO.getParams("onlineState") != null) {
query.eq(SchTerminator::getOnlineState, searchDTO.getParams("onlineState"));
}
//默认createTime倒序排序
query.orderByDesc(SchTerminator::getCreateTime);
List<SchTerminator> list = super.find(query);
return new PageResult<>(list);
}
}

@ -0,0 +1,104 @@
package com.docus.server.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.entity.scheduling.management.SchVirtualLog;
import com.docus.server.infrastructure.dao.ISchVirtualLogDao;
import com.docus.server.infrastructure.mapper.SchVirtualLogMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* 使 访
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Repository
public class SchVirtualLogDaoImpl extends BaseDaoImpl<SchVirtualLogMapper, SchVirtualLog> implements ISchVirtualLogDao {
/**
*
*
* @param id Id
* @return
*/
@Override
public SchVirtualLog findById(String id) {
return super.findById(id);
}
/**
*
*
* @param schVirtualLog
* @return
*/
@Override
public boolean add(SchVirtualLog schVirtualLog) {
return super.save(schVirtualLog);
}
/**
*
*
* @param schVirtualLog
* @return
*/
@Override
public boolean edit(SchVirtualLog schVirtualLog) {
return super.updateById(schVirtualLog);
}
/**
*
*
* @param ids ids
* @return
*/
@Override
public int delete(List<Long> ids) {
return super.deleteByIds(ids);
}
/**
*
*
* @param searchDTO
* @return
*/
@Override
public PageResult<SchVirtualLog> search(SearchDTO searchDTO) {
//分页
PageHelper.startPage(searchDTO.getPageNum(), searchDTO.getPageSize());
LambdaQueryWrapper<SchVirtualLog> query = Wrappers.lambdaQuery();
//时间范围默认按createTime
if (searchDTO.getBeginTime() != null) {
query.ge(SchVirtualLog::getCreateTime, searchDTO.getBeginTime());
}
if (searchDTO.getEndTime() != null) {
Date endTime = searchDTO.getEndTime();
query.le(SchVirtualLog::getCreateTime, endTime);
}
//关键字比较多个列or
//if (!StringUtils.isEmpty(searchDTO.getKeyword())) {
//单个列用like
//query. like(SchVirtualLog::getxxx, searchDTO.getKeyword());
//多个列用like
//query. and(sub -> sub.like(SchVirtualLog::getxx1, searchDTO.getKeyword())
// оr(). like(SchVirtualLog::getXX2, searchDTO.getKeyword()))
//);
//}
//默认createTime倒序排序
query.orderByDesc(SchVirtualLog::getCreateTime);
List<SchVirtualLog> list = super.find(query);
return new PageResult<>(list);
}
}

@ -0,0 +1,17 @@
package com.docus.server.infrastructure.mapper;
import com.docus.server.entity.scheduling.management.SchCollectErrorLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
*
* Mapper
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectErrorLogMapper extends BaseMapper<SchCollectErrorLog> {
}

@ -0,0 +1,17 @@
package com.docus.server.infrastructure.mapper;
import com.docus.server.entity.scheduling.management.SchCollectRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
*
* Mapper
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectRecordMapper extends BaseMapper<SchCollectRecord> {
}

@ -0,0 +1,17 @@
package com.docus.server.infrastructure.mapper;
import com.docus.server.entity.scheduling.management.SchCollectRecordRetryLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
*
* Mapper
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectRecordRetryLogMapper extends BaseMapper<SchCollectRecordRetryLog> {
}

@ -0,0 +1,17 @@
package com.docus.server.infrastructure.mapper;
import com.docus.server.entity.scheduling.management.SchCollectorConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
*
* Mapper
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectorConfigMapper extends BaseMapper<SchCollectorConfig> {
}

@ -0,0 +1,17 @@
package com.docus.server.infrastructure.mapper;
import com.docus.server.entity.scheduling.management.SchCollector;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
*
* Mapper
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectorMapper extends BaseMapper<SchCollector> {
}

@ -0,0 +1,17 @@
package com.docus.server.infrastructure.mapper;
import com.docus.server.entity.scheduling.management.SchCollectorVersionFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
*
* Mapper
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectorVersionFileMapper extends BaseMapper<SchCollectorVersionFile> {
}

@ -0,0 +1,17 @@
package com.docus.server.infrastructure.mapper;
import com.docus.server.entity.scheduling.management.SchCollectorVersionLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
*
* Mapper
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectorVersionLogMapper extends BaseMapper<SchCollectorVersionLog> {
}

@ -0,0 +1,17 @@
package com.docus.server.infrastructure.mapper;
import com.docus.server.entity.scheduling.management.SchCollectorVersion;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
*
* Mapper
*
* @author AutoGenerator
* @since 2023-07-15
*/
@Mapper
public interface SchCollectorVersionMapper extends BaseMapper<SchCollectorVersion> {
}

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

Loading…
Cancel
Save