init:删除无用配置
This commit is contained in:
@@ -9,7 +9,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sun.xml.bind.v2.model.core.ID;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.PageUtil;
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
package org.nl.wms.sch_manage.service.util;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.reflections.Reflections;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 任务自动下发
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-06-09
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@Order(value = 1)
|
||||
public class AutoSendTask {
|
||||
private static Set<Class<? extends AbstractTask>> subTypes = null;
|
||||
// 类加载时候执行扫描
|
||||
static {
|
||||
Reflections reflections = new Reflections("org.nl.wms.sch_manage.service.util.tasks");
|
||||
subTypes = reflections.getSubTypesOf(AbstractTask.class);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
log.debug("定时任务AutoCreateTask开始执行:");
|
||||
this.doExecute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 需要按照任务配置类型并行执行
|
||||
*/
|
||||
private void doExecute() {
|
||||
subTypes.forEach(clz -> {
|
||||
// 调用AbstractAcsTask类的每个子类的schedule()方法
|
||||
try {
|
||||
Object obj = SpringContextHolder.getBean(clz);
|
||||
Method m = obj.getClass().getMethod("schedule");
|
||||
m.invoke(obj);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
log.info("定时器执行失败:{}", e.getTargetException().getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info("定时器执行失败:{}", e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user