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

This commit is contained in:
zhangzq
2025-03-14 10:14:30 +08:00
8 changed files with 63 additions and 13 deletions

View File

@@ -32,8 +32,8 @@ public class BaseQuery<T> {
/**
* 创建时间范围查询
*/
private Date start_time;
private Date end_time;
private String begin_time;
private String end_time;
/**
@@ -44,8 +44,8 @@ public class BaseQuery<T> {
* 通过buid构建
*/
public Map<String, QParam> doP = MapOf.of("blurry", QParam.builder().k(new String[]{"name"}).type(QueryTEnum.LK).build()
, "startTime", QParam.builder().k(new String[]{"create_time"}).type(QueryTEnum.LT).build()
, "endTime", QParam.builder().k(new String[]{"create_time"}).type(QueryTEnum.LE).build()
, "begin_time", QParam.builder().k(new String[]{"create_time"}).type(QueryTEnum.GT).build()
, "end_time", QParam.builder().k(new String[]{"create_time"}).type(QueryTEnum.LE).build()
, "sort", QParam.builder().k(new String[]{"sort"}).type(QueryTEnum.BY).build()
);

View File

@@ -30,6 +30,9 @@ public enum QueryTEnum {
LE((q, k, v) -> {
q.le(k[0], v);
}),
GT((q, k, v) -> {
q.gt(k[0], v);
}),
BY((q, k, v) -> {
q.orderByDesc(k[0], v);
}),

View File

@@ -1,5 +1,6 @@
package org.nl.system.service.quartz.utils;
import cn.hutool.core.net.NetUtil;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.system.service.quartz.dao.SysQuartzJob;
@@ -26,6 +27,14 @@ public class QuartzManage {
private Scheduler scheduler;
public void addJob(SysQuartzJob quartzJob) {
//本机IP
String localIp = NetUtil.getLocalhostStr();
System.out.println("本机ip"+localIp);
if (!judgmentIp(quartzJob.getJob_ip())) {
throw new BadRequestException("本机ip与"+localIp+"调度ip"+quartzJob.getJob_ip()+"不同");
}
try {
// 构建job信息
JobDetail jobDetail = JobBuilder.newJob(ExecutionJob.class).
@@ -62,8 +71,16 @@ public class QuartzManage {
* @param quartzJob /
*/
public void updateJobCron(SysQuartzJob quartzJob) {
//本机IP
String localIp = NetUtil.getLocalhostStr();
System.out.println("本机ip"+localIp);
TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getJob_id());
if (!judgmentIp(quartzJob.getJob_ip())) {
throw new BadRequestException("本机ip与"+localIp+"调度ip"+quartzJob.getJob_ip()+"不同");
}
try {
TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getJob_id());
CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
// 如果不存在则创建一个定时任务
if (trigger == null) {
@@ -93,8 +110,16 @@ public class QuartzManage {
* @param quartzJob /
*/
public void resumeJob(SysQuartzJob quartzJob) {
//本机IP
String localIp = NetUtil.getLocalhostStr();
System.out.println("本机ip"+localIp);
TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getJob_id());
if (!judgmentIp(quartzJob.getJob_ip())) {
throw new BadRequestException("本机ip与"+localIp+"调度ip"+quartzJob.getJob_ip()+"不同");
}
try {
TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getJob_id());
CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
// 如果不存在则创建一个定时任务
if (trigger == null) {
@@ -129,9 +154,21 @@ public class QuartzManage {
* @param quartzJob /
*/
public void runJobNow(SysQuartzJob quartzJob) {
//本机IP
String localIp = NetUtil.getLocalhostStr();
System.out.println("本机ip"+localIp);
TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getJob_id());
if (!judgmentIp(quartzJob.getJob_ip())) {
throw new BadRequestException("本机ip与"+localIp+"调度ip"+quartzJob.getJob_ip()+"不同");
}
try {
TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getJob_id());
CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
log.info("定时任务:{}, 执行ip: {}, 定时任务开启", quartzJob.getJob_name(), localIp);
System.out.println("定时任务: " + quartzJob.getJob_name() + ", 执行ip: " + localIp + ", 定时任务开启");
// 如果不存在则创建一个定时任务
if (trigger == null) {
addJob(quartzJob);
@@ -140,6 +177,7 @@ public class QuartzManage {
dataMap.put(SysQuartzJob.JOB_KEY, quartzJob);
JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getJob_id());
scheduler.triggerJob(jobKey, dataMap);
} catch (Exception e) {
log.error("定时任务执行失败", e);
throw new BadRequestException("定时任务执行失败");
@@ -161,4 +199,9 @@ public class QuartzManage {
throw new BadRequestException("删除定时任务失败");
}
}
public static Boolean judgmentIp(String ip) {
return NetUtil.localAddressList(null).stream()
.anyMatch(inet -> ip.equals(inet.getHostAddress()));
}
}

View File

@@ -80,13 +80,14 @@ public class ToolLocalStorage implements Serializable {
*/
private String update_time;
public ToolLocalStorage(String realName, String name, String suffix, String path, String type, String size) {
public ToolLocalStorage(String realName, String name, String suffix, String path, String type, String size, String create_time) {
this.real_name = realName;
this.name = name;
this.suffix = suffix;
this.path = path;
this.type = type;
this.size = size;
this.create_time = create_time;
}

View File

@@ -115,7 +115,8 @@ public class AutoSaveIvtExcel {
"xls",
path,
type,
"");
"",
DateUtil.now());
iToolLocalStorageService.save(localStorage);
workbook.write(fileOut);

View File

@@ -110,7 +110,8 @@ public class AutoSaveIvtExcelTwo {
"xls",
path,
type,
"");
"",
DateUtil.now());
iToolLocalStorageService.save(localStorage);
workbook.write(fileOut);

View File

@@ -131,7 +131,8 @@ public class AutoSendIvtExcel {
"xls",
path,
type,
"");
"",
DateUtil.now());
iToolLocalStorageService.save(localStorage);
}
workbook.write(fileOut);

View File

@@ -94,8 +94,8 @@
<el-table-column prop="type" label="类别" />
<el-table-column prop="size" label="大小" />
<el-table-column prop="operate" label="操作人" />
<el-table-column prop="createTime" label="创建日期" />
<el-table-column prop="updateTime" label="修改日期" />
<el-table-column prop="create_time" label="创建日期" />
<el-table-column prop="update_time" label="修改日期" />
</el-table>
<!--分页组件-->
<pagination />