diff --git a/_solon_plugin/job-solon-plugin/pom.xml b/_solon_plugin/job-solon-plugin/pom.xml new file mode 100644 index 00000000..09fa545b --- /dev/null +++ b/_solon_plugin/job-solon-plugin/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + + org.noear + solon-parent + 2.2.1 + + + fun.asgc + job-solon-plugin + jar + + + + org.noear + solon + + + org.projectlombok + lombok + + + + org.quartz-scheduler + quartz + 2.3.1 + + + + cn.hutool + hutool-core + 5.8.15 + + + \ No newline at end of file diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/CustomThreadFactory.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/CustomThreadFactory.java new file mode 100644 index 00000000..2e099423 --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/CustomThreadFactory.java @@ -0,0 +1,34 @@ +package fun.asgc.solon.extend.job; + +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * + * @author: aoshiguchen + * @date: 2022/9/4 + */ +public class CustomThreadFactory implements ThreadFactory { + private final ThreadGroup group; + private final AtomicInteger threadNumber = new AtomicInteger(1); + private final String namePrefix; + + public CustomThreadFactory(String prefix) { + SecurityManager s = System.getSecurityManager(); + group = (s != null) ? s.getThreadGroup() : + Thread.currentThread().getThreadGroup(); + namePrefix = prefix + "-thread-"; + } + + @Override + public Thread newThread(Runnable r) { + Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0); + if (t.isDaemon()) { + t.setDaemon(false); + } + if (t.getPriority() != Thread.NORM_PRIORITY) { + t.setPriority(Thread.NORM_PRIORITY); + } + return t; + } +} diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobCallback.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobCallback.java new file mode 100644 index 00000000..8283475d --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobCallback.java @@ -0,0 +1,17 @@ +package fun.asgc.solon.extend.job; + +/** + * + * @author: aoshiguchen + * @date: 2022/9/4 + */ +public interface IJobCallback { + + /** + * 执行日志 + * @param jobInfo + * @param param + * @param throwable + */ + void executeLog(JobInfo jobInfo, String param, Throwable throwable); +} diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobExecutor.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobExecutor.java new file mode 100644 index 00000000..127a4344 --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobExecutor.java @@ -0,0 +1,34 @@ +package fun.asgc.solon.extend.job; + +/** + * + * @author: aoshiguchen + * @date: 2022/9/4 + */ +public interface IJobExecutor { + + /** + * 初始化 + * @throws JobException + */ + void init() throws Exception; + + /** + * 新增job + * @param jobInfo + */ + void add(JobInfo jobInfo); + + /** + * 删除job + * @param jobName + */ + void remove(String jobName); + + /** + * 触发 + * @param jobName + * @param param + */ + void trigger(String jobName, String param); +} diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobHandler.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobHandler.java new file mode 100644 index 00000000..a712f570 --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobHandler.java @@ -0,0 +1,16 @@ +package fun.asgc.solon.extend.job; + +/** + * @author: aoshiguchen + * @date: 2022/9/4 + */ +public interface IJobHandler { + + /** + * job执行 + * @param param + * @throws Exception + */ + void execute(String param) throws Exception; + +} diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobSource.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobSource.java new file mode 100644 index 00000000..c9f805ad --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/IJobSource.java @@ -0,0 +1,17 @@ +package fun.asgc.solon.extend.job; + +import java.util.List; + +/** + * + * @author: aoshiguchen + * @date: 2022/9/4 + */ +public interface IJobSource { + + /** + * 获取所有job列表 + * @return + */ + List sourceList(); +} diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/JobBean.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/JobBean.java new file mode 100644 index 00000000..9763e69f --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/JobBean.java @@ -0,0 +1,26 @@ +package fun.asgc.solon.extend.job; + +import fun.asgc.solon.extend.job.impl.JobExecutor; +import lombok.extern.slf4j.Slf4j; +import org.noear.solon.Solon; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +/** + * + * @author: aoshiguchen + * @date: 2022/9/4 + */ +@Slf4j +public class JobBean implements Job { + + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + JobExecutor jobExecutor = Solon.context().getBean(JobExecutor.class); + if (null != jobExecutor) { + jobExecutor.execute(jobExecutionContext); + } + } + +} diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/JobInfo.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/JobInfo.java new file mode 100644 index 00000000..db51ec15 --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/JobInfo.java @@ -0,0 +1,23 @@ +package fun.asgc.solon.extend.job; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Map; + +/** + * + * @author: aoshiguchen + * @date: 2022/9/4 + */ +@Accessors(chain = true) +@Data +public class JobInfo { + private String id; + private String name; + private String desc; + private String cron; + private String param; + private boolean enable; + private Map extension; +} diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/XPluginImp.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/XPluginImp.java new file mode 100644 index 00000000..cdab50b4 --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/XPluginImp.java @@ -0,0 +1,45 @@ +package fun.asgc.solon.extend.job; + +import fun.asgc.solon.extend.job.annotation.EnableJob; +import fun.asgc.solon.extend.job.impl.DefaultJobCallback; +import fun.asgc.solon.extend.job.impl.DefaultJobSource; +import fun.asgc.solon.extend.job.impl.JobExecutor; +import org.noear.solon.Solon; +import org.noear.solon.core.AopContext; +import org.noear.solon.core.Plugin; +import org.noear.solon.core.event.AppLoadEndEvent; + +/** + * @author: aoshiguchen + * @date: 2023/3/11 + */ +public class XPluginImp implements Plugin { + + @Override + public void start(AopContext context) throws Throwable { + EnableJob enableJob = Solon.app().source().getAnnotation(EnableJob.class); + if (null == enableJob || !enableJob.value()) { + return; + } + + //应用加载完后,再启动任务 + Solon.app().onEvent(AppLoadEndEvent.class, e -> { + IJobSource jobSource = context.getBean(IJobSource.class); + IJobCallback jobCallback = context.getBean(IJobCallback.class); + if (null == jobSource) { + jobSource = new DefaultJobSource(); + } + if (null == jobCallback) { + jobCallback = new DefaultJobCallback(); + } + + JobExecutor jobExecutor = new JobExecutor(); + jobExecutor.setJobSource(jobSource); + jobExecutor.setJobCallback(jobCallback); + jobExecutor.start(); + + context.wrapAndPut(JobExecutor.class, jobExecutor); + }); + } + +} diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/annotation/EnableJob.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/annotation/EnableJob.java new file mode 100644 index 00000000..b5c929a3 --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/annotation/EnableJob.java @@ -0,0 +1,16 @@ +package fun.asgc.solon.extend.job.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author: aoshiguchen + * @date: 2023/3/12 + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface EnableJob { + boolean value() default true; +} diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/annotation/JobHandler.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/annotation/JobHandler.java new file mode 100644 index 00000000..add2cfda --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/annotation/JobHandler.java @@ -0,0 +1,20 @@ +package fun.asgc.solon.extend.job.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * + * @author: aoshiguchen + * @date: 2022/9/4 + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface JobHandler { + String name(); + String desc() default ""; + String cron(); + String param() default ""; +} diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/impl/DefaultJobCallback.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/impl/DefaultJobCallback.java new file mode 100644 index 00000000..9226e437 --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/impl/DefaultJobCallback.java @@ -0,0 +1,23 @@ +package fun.asgc.solon.extend.job.impl; + +import fun.asgc.solon.extend.job.IJobCallback; +import fun.asgc.solon.extend.job.JobInfo; +import lombok.extern.slf4j.Slf4j; + +/** + * @author: aoshiguchen + * @date: 2023/3/12 + */ +@Slf4j +public class DefaultJobCallback implements IJobCallback { + + @Override + public void executeLog(JobInfo jobInfo, String param, Throwable throwable) { + if (null == throwable) { + log.debug("[Solon Plugin Job] Job执行 id:{} name:{} desc:{} param:{}", jobInfo.getId(), jobInfo.getName(), jobInfo.getDesc(), param); + } else { + log.error("[Solon Plugin Job] Job执行 id:{} name:{} desc:{} param:{}", jobInfo.getId(), jobInfo.getName(), jobInfo.getDesc(), param, throwable); + } + } + +} diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/impl/DefaultJobSource.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/impl/DefaultJobSource.java new file mode 100644 index 00000000..48116b1a --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/impl/DefaultJobSource.java @@ -0,0 +1,44 @@ +package fun.asgc.solon.extend.job.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import fun.asgc.solon.extend.job.IJobHandler; +import fun.asgc.solon.extend.job.IJobSource; +import fun.asgc.solon.extend.job.annotation.JobHandler; +import fun.asgc.solon.extend.job.JobInfo; +import org.noear.solon.Solon; + +import java.util.List; + +/** + * + * @author: aoshiguchen + * @date: 2022/9/4 + */ +public class DefaultJobSource implements IJobSource { + + @Override + public List sourceList() { + List jobHandlerList = Solon.context().getBeansOfType(IJobHandler.class); + if (CollectionUtil.isEmpty(jobHandlerList)) { + return CollectionUtil.newArrayList(); + } + List jobInfoList = CollectionUtil.newArrayList(); + for (IJobHandler jobHandler : jobHandlerList) { + JobHandler handler = jobHandler.getClass().getAnnotation(JobHandler.class); + if (null == handler || StrUtil.isEmpty(handler.name()) || StrUtil.isEmpty(handler.cron())) { + continue; + } + jobInfoList.add(new JobInfo() + .setId(handler.name()) + .setName(handler.name()) + .setDesc(handler.desc()) + .setCron(handler.cron()) + .setParam(handler.param()) + .setEnable(true) + ); + } + return jobInfoList; + } + +} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobExecutor.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/impl/JobExecutor.java similarity index 65% rename from neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobExecutor.java rename to _solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/impl/JobExecutor.java index 8968e3aa..bffdf6c3 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobExecutor.java +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/impl/JobExecutor.java @@ -1,34 +1,10 @@ -/** - * Copyright (c) 2022 aoshiguchen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package fun.asgc.neutrino.proxy.server.base.quartz; +package fun.asgc.solon.extend.job.impl; -import com.google.common.collect.Sets; -import fun.asgc.neutrino.core.base.CustomThreadFactory; -import fun.asgc.neutrino.core.util.CollectionUtil; -import lombok.extern.slf4j.Slf4j; -import org.noear.snack.core.utils.StringUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import fun.asgc.solon.extend.job.*; +import fun.asgc.solon.extend.job.annotation.JobHandler; import org.noear.solon.Solon; -import org.noear.solon.core.event.AppLoadEndEvent; -import org.noear.solon.core.event.EventListener; import org.quartz.*; import org.quartz.impl.StdSchedulerFactory; @@ -45,31 +21,21 @@ import java.util.concurrent.TimeUnit; * @author: aoshiguchen * @date: 2022/9/4 */ -@Slf4j -public class JobExecutor implements IJobExecutor, EventListener { +public class JobExecutor implements IJobExecutor { private IJobSource jobSource; private ThreadPoolExecutor threadPoolExecutor; private Map jobInfoMap = new ConcurrentHashMap<>(); private SchedulerFactory schedulerFactory; private Scheduler scheduler; private Map jobHandlerMap = new ConcurrentHashMap<>(); - private Set runJobSet = Sets.newHashSet(); + private Set runJobSet = CollectionUtil.newHashSet(); private IJobCallback jobCallback; private Map triggerKeyMap = new ConcurrentHashMap<>(); - @Override - public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable { - start(); - } - public void start() { - Boolean enableJob = Solon.cfg().getBool("neutrino.job.enable", false); - if (!enableJob || null == jobSource) { - return; - } if (null == threadPoolExecutor) { threadPoolExecutor = new ThreadPoolExecutor(5, 20, 10L, TimeUnit.SECONDS, - new LinkedBlockingQueue<>(), new CustomThreadFactory("DefaultJobPool")); + new LinkedBlockingQueue<>(), new CustomThreadFactory("SolonJob")); } List jobHandlerList = Solon.context().getBeansOfType(IJobHandler.class); @@ -88,7 +54,7 @@ public class JobExecutor implements IJobExecutor, EventListener this.scheduler = schedulerFactory.getScheduler(); this.init(); } catch (Exception e){ - throw new JobException("job初始化异常"); + throw new RuntimeException("job初始化异常"); } } @@ -105,7 +71,7 @@ public class JobExecutor implements IJobExecutor, EventListener } @Override - public void init() throws JobException { + public void init() throws Exception { List jobInfoList = jobSource.sourceList(); if (CollectionUtil.isEmpty(jobInfoList)) { return; @@ -114,13 +80,12 @@ public class JobExecutor implements IJobExecutor, EventListener for (JobInfo jobInfo : jobInfoList) { add(jobInfo); } - log.info("Job初始化完成."); } @Override - public void add(JobInfo jobInfo) throws JobException { - if (null == jobInfo || StringUtil.isEmpty(jobInfo.getId()) || StringUtil.isEmpty(jobInfo.getName()) || - StringUtil.isEmpty(jobInfo.getCron())) { + public void add(JobInfo jobInfo) { + if (null == jobInfo || StrUtil.isEmpty(jobInfo.getId()) || StrUtil.isEmpty(jobInfo.getName()) || + StrUtil.isEmpty(jobInfo.getCron())) { return; } synchronized (jobInfo.getId()) { diff --git a/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/package-info.java b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/package-info.java new file mode 100644 index 00000000..2a228d94 --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/java/fun/asgc/solon/extend/job/package-info.java @@ -0,0 +1 @@ +package fun.asgc.solon.extend.job; \ No newline at end of file diff --git a/_solon_plugin/job-solon-plugin/src/main/resources/META-INF/solon/fun.asgc.solon.extend.job.properties b/_solon_plugin/job-solon-plugin/src/main/resources/META-INF/solon/fun.asgc.solon.extend.job.properties new file mode 100644 index 00000000..2f207886 --- /dev/null +++ b/_solon_plugin/job-solon-plugin/src/main/resources/META-INF/solon/fun.asgc.solon.extend.job.properties @@ -0,0 +1,2 @@ +solon.plugin=fun.asgc.solon.extend.job.XPluginImp +solon.plugin.priority=2 \ No newline at end of file diff --git a/_solon_plugin/orika-solon-plugin/src/main/java/fun/asgc/solon/extend/orika/package-info.java b/_solon_plugin/orika-solon-plugin/src/main/java/fun/asgc/solon/extend/orika/package-info.java index e69de29b..43d711cd 100644 --- a/_solon_plugin/orika-solon-plugin/src/main/java/fun/asgc/solon/extend/orika/package-info.java +++ b/_solon_plugin/orika-solon-plugin/src/main/java/fun/asgc/solon/extend/orika/package-info.java @@ -0,0 +1 @@ +package fun.asgc.solon.extend.orika; \ No newline at end of file diff --git a/neutrino-proxy-server/pom.xml b/neutrino-proxy-server/pom.xml index 336c0041..46d421d2 100644 --- a/neutrino-proxy-server/pom.xml +++ b/neutrino-proxy-server/pom.xml @@ -48,6 +48,20 @@ system ${project.basedir}/../_solon_plugin/orika-solon-plugin/pom.xml + + + fun.asgc + job-solon-plugin + 2.2.1 + system + ${project.basedir}/../_solon_plugin/job-solon-plugin/pom.xml + + + + cn.hutool + hutool-core + 5.8.15 + diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/ProxyServer.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/ProxyServer.java index 9bc2731c..2824d25f 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/ProxyServer.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/ProxyServer.java @@ -1,5 +1,6 @@ package fun.asgc.neutrino.proxy.server; +import fun.asgc.solon.extend.job.annotation.EnableJob; import org.noear.solon.Solon; import org.noear.solon.annotation.Controller; import org.noear.solon.web.cors.CrossFilter; @@ -9,6 +10,7 @@ import org.noear.solon.web.cors.CrossFilter; * @author: aoshiguchen * @date: 2022/6/16 */ +@EnableJob @Controller public class ProxyServer { diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/DefaultJobSource.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/DefaultJobSource.java deleted file mode 100644 index d4977ec0..00000000 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/DefaultJobSource.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) 2022 aoshiguchen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package fun.asgc.neutrino.proxy.server.base.quartz; - -import com.google.common.collect.Lists; -import fun.asgc.neutrino.core.util.BeanManager; -import fun.asgc.neutrino.core.util.CollectionUtil; -import fun.asgc.neutrino.core.util.StringUtil; - -import java.util.List; - -/** - * - * @author: aoshiguchen - * @date: 2022/9/4 - */ -public class DefaultJobSource implements IJobSource { - - @Override - public List sourceList() { - List jobHandlerList = BeanManager.getBeanListBySuperClass(IJobHandler.class); - if (CollectionUtil.isEmpty(jobHandlerList)) { - return Lists.newArrayList(); - } - List jobInfoList = Lists.newArrayList(); - for (IJobHandler jobHandler : jobHandlerList) { - JobHandler handler = jobHandler.getClass().getAnnotation(JobHandler.class); - if (null == handler || StringUtil.isEmpty(handler.name()) || StringUtil.isEmpty(handler.cron())) { - continue; - } - jobInfoList.add(new JobInfo() - .setId(handler.name()) - .setName(handler.name()) - .setDesc(handler.desc()) - .setCron(handler.cron()) - .setParam(handler.param()) - .setEnable(true) - ); - } - return jobInfoList; - } - -} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobCallback.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobCallback.java deleted file mode 100644 index fcac145a..00000000 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobCallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2022 aoshiguchen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package fun.asgc.neutrino.proxy.server.base.quartz; - -/** - * - * @author: aoshiguchen - * @date: 2022/9/4 - */ -public interface IJobCallback { - - /** - * 执行日志 - * @param jobInfo - * @param param - * @param throwable - */ - void executeLog(JobInfo jobInfo, String param, Throwable throwable); -} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobExecutor.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobExecutor.java deleted file mode 100644 index 79de2c77..00000000 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobExecutor.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) 2022 aoshiguchen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package fun.asgc.neutrino.proxy.server.base.quartz; - -/** - * - * @author: aoshiguchen - * @date: 2022/9/4 - */ -public interface IJobExecutor { - - /** - * 初始化 - * @throws JobException - */ - void init() throws JobException; - - /** - * 新增job - * @param jobInfo - */ - void add(JobInfo jobInfo); - - /** - * 删除job - * @param jobName - */ - void remove(String jobName); - - /** - * 触发 - * @param jobName - * @param param - */ - void trigger(String jobName, String param); -} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobHandler.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobHandler.java deleted file mode 100644 index bf459fb5..00000000 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2022 aoshiguchen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package fun.asgc.neutrino.proxy.server.base.quartz; - -/** - * @author: aoshiguchen - * @date: 2022/9/4 - */ -public interface IJobHandler { - - /** - * job执行 - * @param param - * @throws Exception - */ - void execute(String param) throws Exception; - -} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobSource.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobSource.java deleted file mode 100644 index 4c04a76a..00000000 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/IJobSource.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2022 aoshiguchen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package fun.asgc.neutrino.proxy.server.base.quartz; - -import java.util.List; - -/** - * - * @author: aoshiguchen - * @date: 2022/9/4 - */ -public interface IJobSource { - - /** - * 获取所有job列表 - * @return - */ - List sourceList(); -} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobBean.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobBean.java deleted file mode 100644 index f34c6f8b..00000000 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobBean.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) 2022 aoshiguchen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package fun.asgc.neutrino.proxy.server.base.quartz; - -import lombok.extern.slf4j.Slf4j; -import org.noear.solon.Solon; -import org.quartz.Job; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -/** - * - * @author: aoshiguchen - * @date: 2022/9/4 - */ -@Slf4j -public class JobBean implements Job { - - @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - JobExecutor jobExecutor = Solon.context().getBean(JobExecutor.class); - if (null != jobExecutor) { - jobExecutor.execute(jobExecutionContext); - } - } - -} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobConfig.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobConfig.java deleted file mode 100644 index 544e568c..00000000 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobConfig.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2022 aoshiguchen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package fun.asgc.neutrino.proxy.server.base.quartz; - -import fun.asgc.neutrino.proxy.server.service.JobInfoService; -import fun.asgc.neutrino.proxy.server.service.JobLogService; -import org.noear.solon.annotation.Bean; -import org.noear.solon.annotation.Configuration; -import org.noear.solon.annotation.Inject; -import org.noear.solon.core.event.AppLoadEndEvent; -import org.noear.solon.core.event.EventBus; - -/** - * 定时任务配置 - * @author: aoshiguchen - * @date: 2022/9/4 - */ -@Configuration -public class JobConfig { - - @Bean - public JobExecutor jobExecutor(@Inject JobLogService jobLogService, @Inject JobInfoService jobInfoService) { - JobExecutor executor = new JobExecutor(); - executor.setJobSource(jobInfoService); - executor.setJobCallback(jobLogService); - EventBus.subscribe(AppLoadEndEvent.class, executor); - return executor; - } -} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobException.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobException.java deleted file mode 100644 index 33ba2bba..00000000 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobException.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (C) 2018-2022 Zeyi information technology (Shanghai) Co., Ltd. - *

- * All right reserved. - *

- * This software is the confidential and proprietary - * information of Zeyi Company of China. - * ("Confidential Information"). You shall not disclose - * such Confidential Information and shall use it only - * in accordance with the terms of the contract agreement - * you entered into with Zeyi inc. - */ -package fun.asgc.neutrino.proxy.server.base.quartz; - -import fun.asgc.neutrino.core.exception.InternalException; - -/** - * - * @author: wen.y - * @date: 2022/9/4 - */ -public class JobException extends InternalException { - - public JobException(String message) { - super(message); - } - - public JobException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobHandler.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobHandler.java deleted file mode 100644 index 91625347..00000000 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobHandler.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2022 aoshiguchen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package fun.asgc.neutrino.proxy.server.base.quartz; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * - * @author: aoshiguchen - * @date: 2022/9/4 - */ -@Target({ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -public @interface JobHandler { - String name(); - String desc() default ""; - String cron(); - String param() default ""; -} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobInfo.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobInfo.java deleted file mode 100644 index a06b34f0..00000000 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/quartz/JobInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2022 aoshiguchen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package fun.asgc.neutrino.proxy.server.base.quartz; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Map; - -/** - * - * @author: aoshiguchen - * @date: 2022/9/4 - */ -@Accessors(chain = true) -@Data -public class JobInfo { - private String id; - private String name; - private String desc; - private String cron; - private String param; - private boolean enable; - private Map extension; -} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/DataCleanJob.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/DataCleanJob.java index 6c9c936f..5d2a4cba 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/DataCleanJob.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/DataCleanJob.java @@ -24,9 +24,9 @@ package fun.asgc.neutrino.proxy.server.job; import com.alibaba.fastjson.JSONObject; import fun.asgc.neutrino.core.annotation.Autowired; import fun.asgc.neutrino.core.util.DateUtil; -import fun.asgc.neutrino.proxy.server.base.quartz.IJobHandler; -import fun.asgc.neutrino.proxy.server.base.quartz.JobHandler; import fun.asgc.neutrino.proxy.server.dal.*; +import fun.asgc.solon.extend.job.IJobHandler; +import fun.asgc.solon.extend.job.annotation.JobHandler; import lombok.Data; import lombok.experimental.Accessors; import lombok.extern.slf4j.Slf4j; diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/DemoJob.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/DemoJob.java index ed9b8257..3a7533ff 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/DemoJob.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/DemoJob.java @@ -21,8 +21,8 @@ */ package fun.asgc.neutrino.proxy.server.job; -import fun.asgc.neutrino.proxy.server.base.quartz.IJobHandler; -import fun.asgc.neutrino.proxy.server.base.quartz.JobHandler; +import fun.asgc.solon.extend.job.IJobHandler; +import fun.asgc.solon.extend.job.annotation.JobHandler; import lombok.extern.slf4j.Slf4j; import org.noear.solon.annotation.Component; diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForDayJob.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForDayJob.java index fdf0b440..8e0537f7 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForDayJob.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForDayJob.java @@ -23,8 +23,6 @@ package fun.asgc.neutrino.proxy.server.job; import fun.asgc.neutrino.core.util.CollectionUtil; import fun.asgc.neutrino.core.util.DateUtil; -import fun.asgc.neutrino.proxy.server.base.quartz.IJobHandler; -import fun.asgc.neutrino.proxy.server.base.quartz.JobHandler; import fun.asgc.neutrino.proxy.server.dal.FlowReportDayMapper; import fun.asgc.neutrino.proxy.server.dal.FlowReportHourMapper; import fun.asgc.neutrino.proxy.server.dal.FlowReportMinuteMapper; @@ -32,6 +30,8 @@ import fun.asgc.neutrino.proxy.server.dal.LicenseMapper; import fun.asgc.neutrino.proxy.server.dal.entity.FlowReportDayDO; import fun.asgc.neutrino.proxy.server.dal.entity.FlowReportHourDO; import fun.asgc.neutrino.proxy.server.service.FlowReportService; +import fun.asgc.solon.extend.job.IJobHandler; +import fun.asgc.solon.extend.job.annotation.JobHandler; import lombok.extern.slf4j.Slf4j; import org.noear.solon.annotation.Component; import org.noear.solon.annotation.Inject; diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForHourJob.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForHourJob.java index f2c6471e..aa263ba6 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForHourJob.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForHourJob.java @@ -23,14 +23,14 @@ package fun.asgc.neutrino.proxy.server.job; import fun.asgc.neutrino.core.util.CollectionUtil; import fun.asgc.neutrino.core.util.DateUtil; -import fun.asgc.neutrino.proxy.server.base.quartz.IJobHandler; -import fun.asgc.neutrino.proxy.server.base.quartz.JobHandler; import fun.asgc.neutrino.proxy.server.dal.FlowReportHourMapper; import fun.asgc.neutrino.proxy.server.dal.FlowReportMinuteMapper; import fun.asgc.neutrino.proxy.server.dal.LicenseMapper; import fun.asgc.neutrino.proxy.server.dal.entity.FlowReportHourDO; import fun.asgc.neutrino.proxy.server.dal.entity.FlowReportMinuteDO; import fun.asgc.neutrino.proxy.server.service.FlowReportService; +import fun.asgc.solon.extend.job.IJobHandler; +import fun.asgc.solon.extend.job.annotation.JobHandler; import lombok.extern.slf4j.Slf4j; import org.noear.solon.annotation.Component; import org.noear.solon.annotation.Inject; diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForMinuteJob.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForMinuteJob.java index 776aa885..ead9ede7 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForMinuteJob.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForMinuteJob.java @@ -23,13 +23,13 @@ package fun.asgc.neutrino.proxy.server.job; import fun.asgc.neutrino.core.util.CollectionUtil; import fun.asgc.neutrino.core.util.DateUtil; -import fun.asgc.neutrino.proxy.server.base.quartz.IJobHandler; -import fun.asgc.neutrino.proxy.server.base.quartz.JobHandler; import fun.asgc.neutrino.proxy.server.dal.FlowReportMinuteMapper; import fun.asgc.neutrino.proxy.server.dal.LicenseMapper; import fun.asgc.neutrino.proxy.server.dal.entity.FlowReportMinuteDO; import fun.asgc.neutrino.proxy.server.dal.entity.LicenseDO; import fun.asgc.neutrino.proxy.server.service.FlowReportService; +import fun.asgc.solon.extend.job.IJobHandler; +import fun.asgc.solon.extend.job.annotation.JobHandler; import lombok.extern.slf4j.Slf4j; import org.noear.solon.annotation.Component; import org.noear.solon.annotation.Inject; diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForMonthJob.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForMonthJob.java index ee7aed77..28ec30b0 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForMonthJob.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/job/FlowReportForMonthJob.java @@ -23,12 +23,12 @@ package fun.asgc.neutrino.proxy.server.job; import fun.asgc.neutrino.core.util.CollectionUtil; import fun.asgc.neutrino.core.util.DateUtil; -import fun.asgc.neutrino.proxy.server.base.quartz.IJobHandler; -import fun.asgc.neutrino.proxy.server.base.quartz.JobHandler; import fun.asgc.neutrino.proxy.server.dal.*; import fun.asgc.neutrino.proxy.server.dal.entity.FlowReportDayDO; import fun.asgc.neutrino.proxy.server.dal.entity.FlowReportMonthDO; import fun.asgc.neutrino.proxy.server.service.FlowReportService; +import fun.asgc.solon.extend.job.IJobHandler; +import fun.asgc.solon.extend.job.annotation.JobHandler; import lombok.extern.slf4j.Slf4j; import org.noear.solon.annotation.Component; import org.noear.solon.annotation.Inject; diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/JobInfoService.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/JobInfoService.java index d456458b..5b596152 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/JobInfoService.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/JobInfoService.java @@ -28,9 +28,6 @@ import com.google.common.collect.Lists; import fun.asgc.neutrino.core.util.CollectionUtil; import fun.asgc.neutrino.proxy.server.base.page.PageInfo; import fun.asgc.neutrino.proxy.server.base.page.PageQuery; -import fun.asgc.neutrino.proxy.server.base.quartz.IJobSource; -import fun.asgc.neutrino.proxy.server.base.quartz.JobExecutor; -import fun.asgc.neutrino.proxy.server.base.quartz.JobInfo; import fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum; import fun.asgc.neutrino.proxy.server.constant.ExceptionConstant; import fun.asgc.neutrino.proxy.server.controller.req.JobInfoExecuteReq; @@ -44,6 +41,9 @@ import fun.asgc.neutrino.proxy.server.controller.res.JobInfoUpdateRes; import fun.asgc.neutrino.proxy.server.dal.JobInfoMapper; import fun.asgc.neutrino.proxy.server.dal.entity.JobInfoDO; import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil; +import fun.asgc.solon.extend.job.IJobSource; +import fun.asgc.solon.extend.job.JobInfo; +import fun.asgc.solon.extend.job.impl.JobExecutor; import lombok.extern.slf4j.Slf4j; import ma.glasnost.orika.MapperFactory; import org.apache.ibatis.solon.annotation.Db; diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/JobLogService.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/JobLogService.java index 59237157..794a49aa 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/JobLogService.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/JobLogService.java @@ -26,12 +26,12 @@ import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import fun.asgc.neutrino.proxy.server.base.page.PageInfo; import fun.asgc.neutrino.proxy.server.base.page.PageQuery; -import fun.asgc.neutrino.proxy.server.base.quartz.IJobCallback; -import fun.asgc.neutrino.proxy.server.base.quartz.JobInfo; import fun.asgc.neutrino.proxy.server.controller.req.JobLogListReq; import fun.asgc.neutrino.proxy.server.controller.res.JobLogListRes; import fun.asgc.neutrino.proxy.server.dal.JobLogMapper; import fun.asgc.neutrino.proxy.server.dal.entity.JobLogDO; +import fun.asgc.solon.extend.job.IJobCallback; +import fun.asgc.solon.extend.job.JobInfo; import lombok.extern.slf4j.Slf4j; import ma.glasnost.orika.MapperFactory; import org.apache.commons.lang3.exception.ExceptionUtils; diff --git a/neutrino-proxy-server/src/main/resources/META-INF/solon/solon.extend.mapper.properties b/neutrino-proxy-server/src/main/resources/META-INF/solon/solon.extend.mapper.properties deleted file mode 100644 index d072f15e..00000000 --- a/neutrino-proxy-server/src/main/resources/META-INF/solon/solon.extend.mapper.properties +++ /dev/null @@ -1,2 +0,0 @@ -solon.plugin=fun.asgc.neutrino.proxy.server.base.db.MapperPlugin -solon.plugin.priority=3 \ No newline at end of file