From 449b185bb7c25ebdb90cb8f8c7eb8be92500424a Mon Sep 17 00:00:00 2001 From: zfm Date: Thu, 10 Aug 2023 17:13:15 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=8D=87=E7=BA=A7springboot=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=88=B03.1.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 7 ++-- xxl-job-admin/pom.xml | 14 +++++++- .../job/admin/controller/IndexController.java | 6 ++-- .../admin/controller/JobApiController.java | 4 +-- .../admin/controller/JobCodeController.java | 4 +-- .../admin/controller/JobGroupController.java | 4 +-- .../admin/controller/JobInfoController.java | 4 +-- .../admin/controller/JobLogController.java | 4 +-- .../job/admin/controller/UserController.java | 4 +-- .../interceptor/CookieInterceptor.java | 6 ++-- .../interceptor/PermissionInterceptor.java | 6 ++-- .../controller/interceptor/WebMvcConfig.java | 2 +- .../resolver/WebExceptionResolver.java | 4 +-- .../admin/core/alarm/impl/EmailJobAlarm.java | 2 +- .../admin/core/conf/XxlJobAdminConfig.java | 2 +- .../core/old/XxlJobDynamicScheduler.java | 6 ++-- .../xxl/job/admin/core/util/CookieUtil.java | 6 ++-- .../xxl/job/admin/service/LoginService.java | 6 ++-- .../admin/service/impl/XxlJobServiceImpl.java | 2 +- .../controller/JobInfoControllerTest.java | 2 +- .../xxl/job/admin/dao/XxlJobGroupDaoTest.java | 2 +- .../xxl/job/admin/dao/XxlJobInfoDaoTest.java | 2 +- .../xxl/job/admin/dao/XxlJobLogDaoTest.java | 2 +- .../job/admin/dao/XxlJobLogGlueDaoTest.java | 2 +- .../job/admin/dao/XxlJobRegistryDaoTest.java | 2 +- xxl-job-core/pom.xml | 36 +++++++++++++------ .../job/core/glue/impl/SpringGlueFactory.java | 3 +- 27 files changed, 86 insertions(+), 58 deletions(-) diff --git a/pom.xml b/pom.xml index a1ffaf2d30..295927311b 100644 --- a/pom.xml +++ b/pom.xml @@ -27,15 +27,16 @@ 4.1.90.Final 2.10.1 - 5.3.26 - 2.7.9 + 6.0.11 + 3.1.2 2.3.0 8.0.32 1.7.36 5.9.2 - 1.3.2 + 6.0.0 + 2.1.1 4.0.10 diff --git a/xxl-job-admin/pom.xml b/xxl-job-admin/pom.xml index 4d3167071a..c218b1eed7 100644 --- a/xxl-job-admin/pom.xml +++ b/xxl-job-admin/pom.xml @@ -72,8 +72,20 @@ xxl-job-core ${project.parent.version} + + jakarta.annotation + jakarta.annotation-api + ${jakarta.annotation-api.version} + compile + + + jakarta.servlet + jakarta.servlet-api + ${jakarta.servlet-api.version} + compile + - + diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java index a84fb7dd7e..f0ec08b51e 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java @@ -15,9 +15,9 @@ import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java index aa51e73907..d650913fee 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java @@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import java.util.List; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java index 302b9bf9eb..1cd1975368 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java @@ -12,8 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import java.util.Date; import java.util.List; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java index 8e0c5a4d56..1dedad383f 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java @@ -15,8 +15,8 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import java.util.*; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java index ea314b3239..dbc12de60f 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java @@ -27,8 +27,8 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import java.text.ParseException; import java.util.*; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java index 67faebcce3..671bd49b64 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java @@ -24,8 +24,8 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import java.util.Date; import java.util.HashMap; import java.util.List; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java index 3f4c7559b5..13b999c77c 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java @@ -16,8 +16,8 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java index 930b9e8a84..027c1e92a5 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java @@ -6,9 +6,9 @@ import org.springframework.web.servlet.AsyncHandlerInterceptor; import org.springframework.web.servlet.ModelAndView; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.util.HashMap; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java index ecb281145a..ed675babef 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java @@ -8,9 +8,9 @@ import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.AsyncHandlerInterceptor; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; /** * 权限拦截 diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java index 0be6ba6631..9ac56c90af 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java @@ -4,7 +4,7 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import javax.annotation.Resource; +import jakarta.annotation.Resource; /** * web mvc config diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java index 114407b667..53d0325c4a 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java @@ -11,8 +11,8 @@ import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ModelAndView; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java index 16e5218489..04254b1010 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java @@ -7,12 +7,12 @@ import com.xxl.job.admin.core.model.XxlJobLog; import com.xxl.job.admin.core.util.I18nUtil; import com.xxl.job.core.biz.model.ReturnT; +import jakarta.mail.internet.MimeMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.stereotype.Component; -import javax.mail.internet.MimeMessage; import java.text.MessageFormat; import java.util.Arrays; import java.util.HashSet; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java index 380b8a596b..cde335fadd 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java @@ -9,7 +9,7 @@ import org.springframework.mail.javamail.JavaMailSender; import org.springframework.stereotype.Component; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import javax.sql.DataSource; import java.util.Arrays; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/XxlJobDynamicScheduler.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/XxlJobDynamicScheduler.java index 1e62aa1906..d9ec216180 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/XxlJobDynamicScheduler.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/XxlJobDynamicScheduler.java @@ -25,9 +25,9 @@ //import org.slf4j.LoggerFactory; //import org.springframework.util.Assert; // -//import javax.servlet.ServletException; -//import javax.servlet.http.HttpServletRequest; -//import javax.servlet.http.HttpServletResponse; +//import jakarta.servlet.ServletException; +//import jakarta.servlet.http.HttpServletRequest; +//import jakarta.servlet.http.HttpServletResponse; //import java.io.IOException; //import java.util.Date; //import java.util.concurrent.ConcurrentHashMap; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java index 34a898f3c4..16b58d0086 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java @@ -1,8 +1,8 @@ package com.xxl.job.admin.core.util; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; /** * Cookie.Util diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/LoginService.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/LoginService.java index e1cf2e44ed..fe157995e8 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/LoginService.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/LoginService.java @@ -9,9 +9,9 @@ import org.springframework.context.annotation.Configuration; import org.springframework.util.DigestUtils; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.math.BigInteger; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java index 530ee41c89..55dd96cf32 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java @@ -19,7 +19,7 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import java.text.MessageFormat; import java.util.*; diff --git a/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java b/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java index 49bf8aec34..4370c6e8b2 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java @@ -10,7 +10,7 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; -import javax.servlet.http.Cookie; +import jakarta.servlet.http.Cookie; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; diff --git a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobGroupDaoTest.java b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobGroupDaoTest.java index 90b68a9456..5274fedb72 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobGroupDaoTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobGroupDaoTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import java.util.Date; import java.util.List; diff --git a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobInfoDaoTest.java b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobInfoDaoTest.java index 0cb7d53c30..45a2e62fa5 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobInfoDaoTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobInfoDaoTest.java @@ -8,7 +8,7 @@ import org.slf4j.LoggerFactory; import org.springframework.boot.test.context.SpringBootTest; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import java.util.Date; import java.util.List; diff --git a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobLogDaoTest.java b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobLogDaoTest.java index c5888bb223..468ddf214a 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobLogDaoTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobLogDaoTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import java.util.Date; import java.util.List; diff --git a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobLogGlueDaoTest.java b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobLogGlueDaoTest.java index 1e9eee33b5..1960a2415a 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobLogGlueDaoTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobLogGlueDaoTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import java.util.Date; import java.util.List; diff --git a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobRegistryDaoTest.java b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobRegistryDaoTest.java index 5c0a15d88c..41f5a46f3c 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobRegistryDaoTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobRegistryDaoTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import java.util.Arrays; import java.util.Date; import java.util.List; diff --git a/xxl-job-core/pom.xml b/xxl-job-core/pom.xml index a91472bee1..7017930aa5 100644 --- a/xxl-job-core/pom.xml +++ b/xxl-job-core/pom.xml @@ -35,13 +35,6 @@ ${groovy.version} - - - org.springframework - spring-context - ${spring.version} - provided - @@ -51,14 +44,35 @@ ${slf4j-api.version} - + - javax.annotation - javax.annotation-api - ${javax.annotation-api.version} + jakarta.servlet + jakarta.servlet-api + ${jakarta.servlet-api.version} provided + + + + jakarta.annotation + jakarta.annotation-api + ${jakarta.annotation-api.version} + + + org.springframework + spring-beans + ${spring.version} + compile + + + + org.springframework + spring-context + ${spring.version} + compile + + \ No newline at end of file diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/glue/impl/SpringGlueFactory.java b/xxl-job-core/src/main/java/com/xxl/job/core/glue/impl/SpringGlueFactory.java index 37e44d5fae..8fd029e6cc 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/glue/impl/SpringGlueFactory.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/glue/impl/SpringGlueFactory.java @@ -8,7 +8,8 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.core.annotation.AnnotationUtils; -import javax.annotation.Resource; +import jakarta.annotation.Resource; + import java.lang.reflect.Field; import java.lang.reflect.Modifier; From 2a0ced96f216a5d0b6198a42b6f2629bdbc24ea9 Mon Sep 17 00:00:00 2001 From: zfm Date: Wed, 17 Jan 2024 11:37:33 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=94=AF=E6=8C=81postgres?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/deploy/docker_deploy.sh | 37 +++++ xxl-job-admin/Dockerfile | 16 +- xxl-job-admin/pom.xml | 13 +- .../job/admin/controller/IndexController.java | 6 +- .../admin/controller/JobApiController.java | 4 +- .../admin/controller/JobCodeController.java | 4 +- .../admin/controller/JobGroupController.java | 4 +- .../admin/controller/JobInfoController.java | 6 +- .../admin/controller/JobLogController.java | 4 +- .../job/admin/controller/UserController.java | 4 +- .../interceptor/CookieInterceptor.java | 6 +- .../interceptor/PermissionInterceptor.java | 7 +- .../controller/interceptor/WebMvcConfig.java | 3 +- .../resolver/WebExceptionResolver.java | 6 +- .../admin/core/conf/XxlJobAdminConfig.java | 2 +- .../job/admin/core/cron/CronExpression.java | 11 +- .../route/strategy/ExecutorRouteBusyover.java | 2 +- .../route/strategy/ExecutorRouteFailover.java | 2 +- .../com/xxl/job/admin/dao/XxlJobUserDao.java | 1 + .../xxl/job/admin/service/LoginService.java | 6 +- .../admin/service/impl/XxlJobServiceImpl.java | 2 +- .../src/main/resources/application.properties | 10 +- xxl-job-admin/src/main/resources/logback.xml | 2 +- .../mybatis-mapper/XxlJobGroupMapper.xml | 14 +- .../mybatis-mapper/XxlJobInfoMapper.xml | 2 +- .../mybatis-mapper/XxlJobLogGlueMapper.xml | 140 +++++++++--------- .../mybatis-mapper/XxlJobLogMapper.xml | 50 +++---- .../mybatis-mapper/XxlJobLogReportMapper.xml | 16 +- .../mybatis-mapper/XxlJobRegistryMapper.xml | 14 +- .../mybatis-mapper/XxlJobUserMapper.xml | 2 +- .../controller/JobInfoControllerTest.java | 3 +- .../xxl/job/admin/dao/XxlJobGroupDaoTest.java | 2 +- .../xxl/job/admin/dao/XxlJobInfoDaoTest.java | 2 +- .../xxl/job/admin/dao/XxlJobLogDaoTest.java | 2 +- .../job/admin/dao/XxlJobLogGlueDaoTest.java | 2 +- .../job/admin/dao/XxlJobRegistryDaoTest.java | 2 +- .../executor/impl/XxlJobSimpleExecutor.java | 2 - .../job/core/glue/impl/SpringGlueFactory.java | 3 +- .../xxl/job/core/util/XxlJobRemotingUtil.java | 1 - .../config/FrameLessXxlJobConfig.java | 2 +- .../src/main/resources/application.properties | 2 +- 41 files changed, 221 insertions(+), 198 deletions(-) create mode 100644 scripts/deploy/docker_deploy.sh mode change 100644 => 100755 xxl-job-admin/Dockerfile diff --git a/scripts/deploy/docker_deploy.sh b/scripts/deploy/docker_deploy.sh new file mode 100644 index 0000000000..7d613567cf --- /dev/null +++ b/scripts/deploy/docker_deploy.sh @@ -0,0 +1,37 @@ +#!/bin/bash +current=$(cd "$(dirname "$0")";pwd) +pwd +# 拼接镜像完整路径 +version="latest" +path="47.94.15.26:30014/xxx-jobs" +if [ -z $1 ]; then + version="latest" +else + version=$1 +fi +# 输出镜像路径 +echo '================================================================================================' +echo 'IMAGE: '$path +echo 'TAG: '${version} +echo '================================================================================================' +# 重新打包 +mvn clean package -DskipTests +if [ $? -ne 0 ]; then + echo "mvn clean package failed" + exit +fi +# 生成amd64平台镜像 +docker buildx build --platform=linux/amd64 -t ${path}:${version} ./xxl-job-admin +#先登录 +#docker login --username=admin 47.94.15.26:30014 +#密码 8szBZSttgqnxpv + +docker push ${path}:${version} +if [ $? -ne 0 ]; then + echo "docker push failed" + exit +fi +#docker rmi ${path}:${version} +echo '执行成功!' $(date "+%Y-%m-%d %H:%M:%S") +# admin JzKg5mOldcisrc +ssh admin@47.94.15.26 'sh /home/admin/upgrade_xxxbusiness.sh' \ No newline at end of file diff --git a/xxl-job-admin/Dockerfile b/xxl-job-admin/Dockerfile old mode 100644 new mode 100755 index dc1953712b..4b178b5e09 --- a/xxl-job-admin/Dockerfile +++ b/xxl-job-admin/Dockerfile @@ -1,11 +1,13 @@ -FROM openjdk:8-jre-slim -MAINTAINER xuxueli +# 基础镜像使用java +FROM eclipse-temurin:17-jre -ENV PARAMS="" +MAINTAINER enjoy-ai -ENV TZ=PRC +ENV PARAMS="" +WORKDIR /home/admin +ADD target/xxl-job-admin-*.jar /home/admin/app.jar +# TODO 时区调整 +ENV TZ=UTC RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -ADD target/xxl-job-admin-*.jar /app.jar - -ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $PARAMS"] \ No newline at end of file +ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/home/admin/app.jar"] \ No newline at end of file diff --git a/xxl-job-admin/pom.xml b/xxl-job-admin/pom.xml index c218b1eed7..ebdea83ff6 100644 --- a/xxl-job-admin/pom.xml +++ b/xxl-job-admin/pom.xml @@ -59,12 +59,7 @@ mybatis-spring-boot-starter ${mybatis-spring-boot-starter.version} - - - com.mysql - mysql-connector-j - ${mysql-connector-j.version} - + @@ -85,6 +80,12 @@ compile + + + org.postgresql + postgresql + 42.6.0 + diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java index f0ec08b51e..67304c29d8 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java @@ -4,6 +4,9 @@ import com.xxl.job.admin.service.LoginService; import com.xxl.job.admin.service.XxlJobService; import com.xxl.job.core.biz.model.ReturnT; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -15,9 +18,6 @@ import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java index d650913fee..8d0f566967 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java @@ -8,14 +8,14 @@ import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.util.GsonTool; import com.xxl.job.core.util.XxlJobRemotingUtil; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; import java.util.List; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java index 1cd1975368..4b291a1e29 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java @@ -7,13 +7,13 @@ import com.xxl.job.admin.dao.XxlJobLogGlueDao; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.glue.GlueTypeEnum; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; import java.util.Date; import java.util.List; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java index 1dedad383f..982310f888 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java @@ -9,14 +9,14 @@ import com.xxl.job.admin.dao.XxlJobRegistryDao; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.enums.RegistryConfig; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; import java.util.*; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java index dbc12de60f..3a13be4c6a 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java @@ -1,6 +1,5 @@ package com.xxl.job.admin.controller; -import com.xxl.job.admin.core.cron.CronExpression; import com.xxl.job.admin.core.exception.XxlJobException; import com.xxl.job.admin.core.model.XxlJobGroup; import com.xxl.job.admin.core.model.XxlJobInfo; @@ -19,6 +18,8 @@ import com.xxl.job.core.enums.ExecutorBlockStrategyEnum; import com.xxl.job.core.glue.GlueTypeEnum; import com.xxl.job.core.util.DateUtil; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; @@ -27,9 +28,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; -import java.text.ParseException; import java.util.*; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java index 671bd49b64..79cdfb341e 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java @@ -16,6 +16,8 @@ import com.xxl.job.core.biz.model.LogResult; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.util.DateUtil; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; @@ -24,8 +26,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; import java.util.Date; import java.util.HashMap; import java.util.List; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java index 13b999c77c..a9e71793d7 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java @@ -8,6 +8,8 @@ import com.xxl.job.admin.dao.XxlJobUserDao; import com.xxl.job.admin.service.LoginService; import com.xxl.job.core.biz.model.ReturnT; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.util.DigestUtils; @@ -16,8 +18,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java index 027c1e92a5..23d3a0041c 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java @@ -2,13 +2,13 @@ import com.xxl.job.admin.core.util.FtlUtil; import com.xxl.job.admin.core.util.I18nUtil; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.stereotype.Component; import org.springframework.web.servlet.AsyncHandlerInterceptor; import org.springframework.web.servlet.ModelAndView; -import jakarta.servlet.http.Cookie; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; import java.util.HashMap; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java index ed675babef..b6444ae774 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java @@ -4,13 +4,12 @@ import com.xxl.job.admin.core.model.XxlJobUser; import com.xxl.job.admin.core.util.I18nUtil; import com.xxl.job.admin.service.LoginService; -import org.springframework.stereotype.Component; -import org.springframework.web.method.HandlerMethod; -import org.springframework.web.servlet.AsyncHandlerInterceptor; - import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import org.springframework.stereotype.Component; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.AsyncHandlerInterceptor; /** * 权限拦截 diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java index 9ac56c90af..561be371c7 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java @@ -1,11 +1,10 @@ package com.xxl.job.admin.controller.interceptor; +import jakarta.annotation.Resource; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import jakarta.annotation.Resource; - /** * web mvc config * diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java index 53d0325c4a..33614f1111 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java @@ -1,8 +1,10 @@ package com.xxl.job.admin.controller.resolver; import com.xxl.job.admin.core.exception.XxlJobException; -import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.admin.core.util.JacksonUtil; +import com.xxl.job.core.biz.model.ReturnT; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -11,8 +13,6 @@ import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ModelAndView; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java index cde335fadd..20be206fb9 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java @@ -3,13 +3,13 @@ import com.xxl.job.admin.core.alarm.JobAlarmer; import com.xxl.job.admin.core.scheduler.XxlJobScheduler; import com.xxl.job.admin.dao.*; +import jakarta.annotation.Resource; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Value; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.stereotype.Component; -import jakarta.annotation.Resource; import javax.sql.DataSource; import java.util.Arrays; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java index fce23524d7..1791d88f1e 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java @@ -19,16 +19,7 @@ import java.io.Serializable; import java.text.ParseException; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Locale; -import java.util.Map; -import java.util.SortedSet; -import java.util.StringTokenizer; -import java.util.TimeZone; -import java.util.TreeSet; +import java.util.*; /** * Provides a parser and evaluator for unix-like cron expressions. Cron diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java index 868560fc29..50fe5bd78a 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java @@ -1,7 +1,7 @@ package com.xxl.job.admin.core.route.strategy; -import com.xxl.job.admin.core.scheduler.XxlJobScheduler; import com.xxl.job.admin.core.route.ExecutorRouter; +import com.xxl.job.admin.core.scheduler.XxlJobScheduler; import com.xxl.job.admin.core.util.I18nUtil; import com.xxl.job.core.biz.ExecutorBiz; import com.xxl.job.core.biz.model.IdleBeatParam; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java index a2e4c909a8..1b5750286b 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java @@ -1,7 +1,7 @@ package com.xxl.job.admin.core.route.strategy; -import com.xxl.job.admin.core.scheduler.XxlJobScheduler; import com.xxl.job.admin.core.route.ExecutorRouter; +import com.xxl.job.admin.core.scheduler.XxlJobScheduler; import com.xxl.job.admin.core.util.I18nUtil; import com.xxl.job.core.biz.ExecutorBiz; import com.xxl.job.core.biz.model.ReturnT; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobUserDao.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobUserDao.java index e840494753..78ba99f498 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobUserDao.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobUserDao.java @@ -3,6 +3,7 @@ import com.xxl.job.admin.core.model.XxlJobUser; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + import java.util.List; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/LoginService.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/LoginService.java index fe157995e8..11b215d32d 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/LoginService.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/LoginService.java @@ -6,12 +6,12 @@ import com.xxl.job.admin.core.util.JacksonUtil; import com.xxl.job.admin.dao.XxlJobUserDao; import com.xxl.job.core.biz.model.ReturnT; -import org.springframework.context.annotation.Configuration; -import org.springframework.util.DigestUtils; - import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import org.springframework.context.annotation.Configuration; +import org.springframework.util.DigestUtils; + import java.math.BigInteger; /** diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java index 55dd96cf32..f610e8c233 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java @@ -15,11 +15,11 @@ import com.xxl.job.core.enums.ExecutorBlockStrategyEnum; import com.xxl.job.core.glue.GlueTypeEnum; import com.xxl.job.core.util.DateUtil; +import jakarta.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import jakarta.annotation.Resource; import java.text.MessageFormat; import java.util.*; diff --git a/xxl-job-admin/src/main/resources/application.properties b/xxl-job-admin/src/main/resources/application.properties index 8727b6c762..24bdfc1ee4 100644 --- a/xxl-job-admin/src/main/resources/application.properties +++ b/xxl-job-admin/src/main/resources/application.properties @@ -1,5 +1,5 @@ ### web -server.port=8080 +server.port=8082 server.servlet.context-path=/xxl-job-admin ### actuator @@ -23,10 +23,10 @@ mybatis.mapper-locations=classpath:/mybatis-mapper/*Mapper.xml #mybatis.type-aliases-package=com.xxl.job.admin.core.model ### xxl-job, datasource -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai -spring.datasource.username=root -spring.datasource.password=root_pwd -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/enjoy-dev +spring.datasource.username=enjoy_user +spring.datasource.password=enjoy_password +spring.datasource.driver-class-name=org.postgresql.Driver ### datasource-pool spring.datasource.type=com.zaxxer.hikari.HikariDataSource diff --git a/xxl-job-admin/src/main/resources/logback.xml b/xxl-job-admin/src/main/resources/logback.xml index d4b08c2403..f4ce9009fb 100644 --- a/xxl-job-admin/src/main/resources/logback.xml +++ b/xxl-job-admin/src/main/resources/logback.xml @@ -2,7 +2,7 @@ logback - + diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml index 87299f88ba..e0a818c83a 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml @@ -35,17 +35,17 @@ - INSERT INTO xxl_job_group ( `app_name`, `title`, `address_type`, `address_list`, `update_time`) + INSERT INTO xxl_job_group ( app_name, title, address_type, address_list, update_time) values ( #{appname}, #{title}, #{addressType}, #{addressList}, #{updateTime} ); UPDATE xxl_job_group - SET `app_name` = #{appname}, - `title` = #{title}, - `address_type` = #{addressType}, - `address_list` = #{addressList}, - `update_time` = #{updateTime} + SET app_name = #{appname}, + title = #{title}, + address_type = #{addressType}, + address_list = #{addressList}, + update_time = #{updateTime} WHERE id = #{id} @@ -72,7 +72,7 @@ ORDER BY t.app_name, t.title, t.id ASC - LIMIT #{offset}, #{pagesize} + LIMIT #{pagesize} OFFSET #{offset} - SELECT - FROM xxl_job_logglue AS t - WHERE t.job_id = #{jobId} - ORDER BY id DESC - - - - DELETE FROM xxl_job_logglue - WHERE id NOT in( - SELECT id FROM( - SELECT id FROM xxl_job_logglue - WHERE `job_id` = #{jobId} - ORDER BY update_time desc - LIMIT 0, #{limit} - ) t1 - ) AND `job_id` = #{jobId} - - - - DELETE FROM xxl_job_logglue - WHERE `job_id` = #{jobId} - - + + + + + + + + + + + + + + + + t.id, + t.job_id, + t.glue_type, + t.glue_source, + t.glue_remark, + t.add_time, + t.update_time + + + + INSERT INTO xxl_job_logglue ( + job_id, + glue_type, + glue_source, + glue_remark, + add_time, + update_time + ) VALUES ( + #{jobId}, + #{glueType}, + #{glueSource}, + #{glueRemark}, + #{addTime}, + #{updateTime} + ); + + + + + + + DELETE FROM xxl_job_logglue + WHERE id NOT in( + SELECT id FROM( + SELECT id FROM xxl_job_logglue + WHERE job_id = #{jobId} + ORDER BY update_time desc + LIMIT 0, #{limit} + ) t1 + ) AND job_id = #{jobId} + + + + DELETE FROM xxl_job_logglue + WHERE job_id = #{jobId} + + \ No newline at end of file diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml index 4155f17982..28071cd421 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml @@ -75,7 +75,7 @@ ORDER BY t.trigger_time DESC - LIMIT #{offset}, #{pagesize} + LIMIT #{pagesize} OFFSET #{offset} SELECT - COUNT(handle_code) triggerDayCount, + COUNT(handle_code) as triggerDayCount, SUM(CASE WHEN (trigger_code in (0, 200) and handle_code = 0) then 1 else 0 end) as triggerDayCountRunning, SUM(CASE WHEN handle_code = 200 then 1 else 0 end) as triggerDayCountSuc FROM xxl_job_log @@ -228,13 +228,13 @@ @@ -242,8 +242,8 @@ UPDATE xxl_job_log SET - `alarm_status` = #{newAlarmStatus} - WHERE `id`= #{logId} AND `alarm_status` = #{oldAlarmStatus} + alarm_status = #{newAlarmStatus} + WHERE id= #{logId} AND alarm_status = #{oldAlarmStatus} diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml index 4cae667a28..b1673d2531 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml @@ -22,7 +22,7 @@ @@ -36,19 +36,19 @@ UPDATE xxl_job_registry - SET `update_time` = #{updateTime} - WHERE `registry_group` = #{registryGroup} - AND `registry_key` = #{registryKey} - AND `registry_value` = #{registryValue} + SET update_time = #{updateTime} + WHERE registry_group = #{registryGroup} + AND registry_key = #{registryKey} + AND registry_value = #{registryValue} - INSERT INTO xxl_job_registry( `registry_group` , `registry_key` , `registry_value`, `update_time`) + INSERT INTO xxl_job_registry( registry_group , registry_key , registry_value, update_time) VALUES( #{registryGroup} , #{registryKey} , #{registryValue}, #{updateTime}) diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobUserMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobUserMapper.xml index 9e09b4aae9..1deec58b88 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobUserMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobUserMapper.xml @@ -31,7 +31,7 @@ ORDER BY username ASC - LIMIT #{offset}, #{pagesize} + LIMIT #{pagesize} OFFSET #{offset} - <#if Request["XXL_JOB_LOGIN_IDENTITY"].role == 1> + <#if user.role == 1> <#-- 仅管理员支持查询全部;普通用户仅支持查询有权限的 jobGroup --> <#list JobGroupList as group> diff --git a/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java b/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java index 412d1c1dd0..c70b9e4247 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java @@ -1,5 +1,6 @@ package com.xxl.job.admin.controller; +import com.xxl.job.admin.core.model.XxlJobUser; import com.xxl.job.admin.service.LoginService; import jakarta.servlet.http.Cookie; import org.junit.jupiter.api.BeforeEach; @@ -24,7 +25,7 @@ public void login() throws Exception { post("/login") .contentType(MediaType.APPLICATION_FORM_URLENCODED) .param("userName", "admin") - .param("password", "123456") + .param("password", "enjoy_password") ).andReturn(); cookie = ret.getResponse().getCookie(LoginService.LOGIN_IDENTITY_KEY); } @@ -44,6 +45,10 @@ public void testAdd() throws Exception { ).andReturn(); logger.info(ret.getResponse().getContentAsString()); + + XxlJobUser loginUser = (XxlJobUser) ret.getRequest().getAttribute(LoginService.LOGIN_IDENTITY_KEY); + System.out.printf(loginUser.getUsername()); + } } From e316b7b65e0103d99990c246775f9167302f35da Mon Sep 17 00:00:00 2001 From: zfm Date: Wed, 17 Jan 2024 13:24:29 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/deploy/docker_deploy.sh | 37 --------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 scripts/deploy/docker_deploy.sh diff --git a/scripts/deploy/docker_deploy.sh b/scripts/deploy/docker_deploy.sh deleted file mode 100644 index 7d613567cf..0000000000 --- a/scripts/deploy/docker_deploy.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -current=$(cd "$(dirname "$0")";pwd) -pwd -# 拼接镜像完整路径 -version="latest" -path="47.94.15.26:30014/xxx-jobs" -if [ -z $1 ]; then - version="latest" -else - version=$1 -fi -# 输出镜像路径 -echo '================================================================================================' -echo 'IMAGE: '$path -echo 'TAG: '${version} -echo '================================================================================================' -# 重新打包 -mvn clean package -DskipTests -if [ $? -ne 0 ]; then - echo "mvn clean package failed" - exit -fi -# 生成amd64平台镜像 -docker buildx build --platform=linux/amd64 -t ${path}:${version} ./xxl-job-admin -#先登录 -#docker login --username=admin 47.94.15.26:30014 -#密码 8szBZSttgqnxpv - -docker push ${path}:${version} -if [ $? -ne 0 ]; then - echo "docker push failed" - exit -fi -#docker rmi ${path}:${version} -echo '执行成功!' $(date "+%Y-%m-%d %H:%M:%S") -# admin JzKg5mOldcisrc -ssh admin@47.94.15.26 'sh /home/admin/upgrade_xxxbusiness.sh' \ No newline at end of file