Browse Source

系统重构

sakuya 3 years ago
parent
commit
509a2dc6a2

+ 32 - 0
eladmin-quartz/pom.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eladmin</artifactId>
+        <groupId>me.zhengjie</groupId>
+        <version>2.6</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>eladmin-quartz</artifactId>
+    <name>定时任务模块</name>
+
+    <properties>
+
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>me.zhengjie</groupId>
+            <artifactId>eladmin-tools</artifactId>
+            <version>2.6</version>
+        </dependency>
+
+        <!-- quartz -->
+        <dependency>
+            <groupId>org.quartz-scheduler</groupId>
+            <artifactId>quartz</artifactId>
+        </dependency>
+    </dependencies>
+</project>

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/quartz/config/JobRunner.java

@@ -13,12 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.config;
+package me.zhengjie.quartz.config;
 
 import lombok.RequiredArgsConstructor;
-import me.zhengjie.modules.quartz.domain.QuartzJob;
-import me.zhengjie.modules.quartz.repository.QuartzJobRepository;
-import me.zhengjie.modules.quartz.utils.QuartzManage;
+import me.zhengjie.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.repository.QuartzJobRepository;
+import me.zhengjie.quartz.utils.QuartzManage;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.ApplicationArguments;

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/config/QuartzConfig.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.config;
+package me.zhengjie.quartz.config;
 
 import org.quartz.spi.TriggerFiredBundle;
 import org.springframework.beans.factory.config.AutowireCapableBeanFactory;

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/domain/QuartzJob.java

@@ -13,12 +13,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.domain;
+package me.zhengjie.quartz.domain;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 import me.zhengjie.base.BaseEntity;
+
 import javax.persistence.*;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/domain/QuartzLog.java

@@ -13,11 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.domain;
+package me.zhengjie.quartz.domain;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.hibernate.annotations.CreationTimestamp;
+
 import javax.persistence.*;
 import java.io.Serializable;
 import java.sql.Timestamp;

+ 3 - 2
eladmin-system/src/main/java/me/zhengjie/modules/quartz/repository/QuartzJobRepository.java

@@ -13,11 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.repository;
+package me.zhengjie.quartz.repository;
 
-import me.zhengjie.modules.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.domain.QuartzJob;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
 import java.util.List;
 
 /**

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/quartz/repository/QuartzLogRepository.java

@@ -13,9 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.repository;
+package me.zhengjie.quartz.repository;
 
-import me.zhengjie.modules.quartz.domain.QuartzLog;
+import me.zhengjie.quartz.domain.QuartzLog;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 

+ 5 - 4
eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.rest;
+package me.zhengjie.quartz.rest;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -21,15 +21,16 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.annotation.Log;
 import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.modules.quartz.domain.QuartzJob;
-import me.zhengjie.modules.quartz.service.QuartzJobService;
-import me.zhengjie.modules.quartz.service.dto.JobQueryCriteria;
+import me.zhengjie.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.service.QuartzJobService;
+import me.zhengjie.quartz.service.dto.JobQueryCriteria;
 import org.springframework.data.domain.Pageable;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.Set;

+ 6 - 4
eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/QuartzJobService.java

@@ -13,12 +13,14 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.service;
+package me.zhengjie.quartz.service;
 
-import me.zhengjie.modules.quartz.domain.QuartzJob;
-import me.zhengjie.modules.quartz.domain.QuartzLog;
-import me.zhengjie.modules.quartz.service.dto.JobQueryCriteria;
+
+import me.zhengjie.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.domain.QuartzLog;
+import me.zhengjie.quartz.service.dto.JobQueryCriteria;
 import org.springframework.data.domain.Pageable;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.List;

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/dto/JobQueryCriteria.java

@@ -13,10 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.service.dto;
+package me.zhengjie.quartz.service.dto;
 
 import lombok.Data;
 import me.zhengjie.annotation.Query;
+
 import java.sql.Timestamp;
 import java.util.List;
 

+ 9 - 8
eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/QuartzJobServiceImpl.java

@@ -13,25 +13,26 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.service.impl;
+package me.zhengjie.quartz.service.impl;
 
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.modules.quartz.domain.QuartzJob;
-import me.zhengjie.modules.quartz.domain.QuartzLog;
-import me.zhengjie.modules.quartz.repository.QuartzJobRepository;
-import me.zhengjie.modules.quartz.repository.QuartzLogRepository;
-import me.zhengjie.modules.quartz.service.QuartzJobService;
-import me.zhengjie.modules.quartz.service.dto.JobQueryCriteria;
-import me.zhengjie.modules.quartz.utils.QuartzManage;
+import me.zhengjie.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.domain.QuartzLog;
+import me.zhengjie.quartz.repository.QuartzJobRepository;
+import me.zhengjie.quartz.repository.QuartzLogRepository;
+import me.zhengjie.quartz.service.QuartzJobService;
+import me.zhengjie.quartz.service.dto.JobQueryCriteria;
+import me.zhengjie.quartz.utils.QuartzManage;
 import me.zhengjie.utils.*;
 import org.quartz.CronExpression;
 import org.springframework.data.domain.Pageable;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.*;

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/TestTask.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.task;
+package me.zhengjie.quartz.task;
 
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.scheduling.annotation.Async;

+ 13 - 7
eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/ExecutionJob.java

@@ -13,17 +13,17 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.utils;
+package me.zhengjie.quartz.utils;
 
 import cn.hutool.extra.template.Template;
 import cn.hutool.extra.template.TemplateConfig;
 import cn.hutool.extra.template.TemplateEngine;
 import cn.hutool.extra.template.TemplateUtil;
 import me.zhengjie.domain.vo.EmailVo;
-import me.zhengjie.modules.quartz.domain.QuartzJob;
-import me.zhengjie.modules.quartz.domain.QuartzLog;
-import me.zhengjie.modules.quartz.repository.QuartzLogRepository;
-import me.zhengjie.modules.quartz.service.QuartzJobService;
+import me.zhengjie.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.domain.QuartzLog;
+import me.zhengjie.quartz.repository.QuartzLogRepository;
+import me.zhengjie.quartz.service.QuartzJobService;
 import me.zhengjie.service.EmailService;
 import me.zhengjie.utils.RedisUtils;
 import me.zhengjie.utils.SpringContextHolder;
@@ -34,8 +34,14 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.quartz.QuartzJobBean;
-import java.util.*;
-import java.util.concurrent.*;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
 
 /**
  * 参考人人开源,https://gitee.com/renrenio/renren-security

+ 4 - 3
eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/QuartzManage.java

@@ -13,17 +13,18 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.utils;
+package me.zhengjie.quartz.utils;
 
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.modules.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.domain.QuartzJob;
 import org.quartz.*;
 import org.quartz.impl.triggers.CronTriggerImpl;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+
 import javax.annotation.Resource;
 import java.util.Date;
+
 import static org.quartz.TriggerBuilder.newTrigger;
 
 /**

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/QuartzRunnable.java

@@ -13,12 +13,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.utils;
+package me.zhengjie.quartz.utils;
 
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.utils.SpringContextHolder;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.util.ReflectionUtils;
+
 import java.lang.reflect.Method;
 import java.util.concurrent.Callable;