From 7e626ea2193d39217fa7321a865bfab014c5ea69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Sun, 22 May 2022 13:07:36 +0800 Subject: [PATCH] update xxl-job 2.3.0 => 2.3.1 --- pom.xml | 2 +- .../job/admin/controller/IndexController.java | 6 +- .../admin/controller/JobApiController.java | 12 +- .../admin/controller/JobCodeController.java | 6 +- .../admin/controller/JobGroupController.java | 6 +- .../admin/controller/JobInfoController.java | 14 +- .../admin/controller/JobLogController.java | 22 +- .../job/admin/controller/UserController.java | 8 +- .../interceptor/CookieInterceptor.java | 5 +- .../interceptor/PermissionInterceptor.java | 6 +- .../resolver/WebExceptionResolver.java | 8 +- .../xxl/job/admin/core/alarm/JobAlarmer.java | 4 +- .../admin/core/alarm/impl/EmailJobAlarm.java | 59 +-- .../admin/core/complete/XxlJobCompleter.java | 32 +- .../admin/core/conf/XxlJobAdminConfig.java | 1 + .../job/admin/core/cron/CronExpression.java | 419 +++++++++--------- .../admin/core/exception/XxlJobException.java | 1 + .../xxl/job/admin/core/model/XxlJobGroup.java | 3 +- .../xxl/job/admin/core/model/XxlJobInfo.java | 2 +- .../job/admin/core/old/RemoteHttpJobBean.java | 4 +- .../core/old/XxlJobDynamicScheduler.java | 4 +- .../job/admin/core/old/XxlJobThreadPool.java | 2 +- .../core/route/ExecutorRouteStrategyEnum.java | 5 +- .../job/admin/core/route/ExecutorRouter.java | 2 +- .../route/strategy/ExecutorRouteBusyover.java | 12 +- .../strategy/ExecutorRouteConsistentHash.java | 13 +- .../route/strategy/ExecutorRouteFailover.java | 12 +- .../route/strategy/ExecutorRouteFirst.java | 2 +- .../core/route/strategy/ExecutorRouteLFU.java | 16 +- .../core/route/strategy/ExecutorRouteLRU.java | 14 +- .../route/strategy/ExecutorRouteLast.java | 2 +- .../route/strategy/ExecutorRouteRound.java | 4 +- .../core/scheduler/MisfireStrategyEnum.java | 4 +- .../core/scheduler/ScheduleTypeEnum.java | 4 +- .../admin/core/scheduler/XxlJobScheduler.java | 11 +- .../admin/core/thread/JobCompleteHelper.java | 4 +- .../core/thread/JobFailMonitorHelper.java | 4 +- .../admin/core/thread/JobLogReportHelper.java | 24 +- .../admin/core/thread/JobRegistryHelper.java | 4 +- .../admin/core/thread/JobScheduleHelper.java | 51 +-- .../admin/core/trigger/TriggerTypeEnum.java | 4 +- .../job/admin/core/trigger/XxlJobTrigger.java | 54 ++- .../xxl/job/admin/core/util/CookieUtil.java | 2 +- .../com/xxl/job/admin/core/util/I18nUtil.java | 11 +- .../job/admin/core/util/LocalCacheUtil.java | 23 +- .../xxl/job/admin/dao/XxlJobRegistryDao.java | 4 +- .../xxl/job/admin/service/LoginService.java | 16 +- .../admin/service/impl/XxlJobServiceImpl.java | 30 +- .../main/resources/i18n/message_en.properties | 12 +- .../resources/i18n/message_zh_CN.properties | 4 +- .../resources/i18n/message_zh_TC.properties | 4 +- .../main/resources/static/js/user.index.1.js | 358 +++++++-------- 52 files changed, 678 insertions(+), 658 deletions(-) diff --git a/pom.xml b/pom.xml index 62666b021..2dff117b8 100644 --- a/pom.xml +++ b/pom.xml @@ -37,7 +37,7 @@ 2.2.1 3.5.1 1.4.0 - 2.3.0 + 2.3.1 3.0.1 diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java index 8d5495c53..bbb25077d 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java @@ -56,13 +56,13 @@ public class IndexController { @PermissionLimit(limit = false) public ModelAndView toLogin(HttpServletRequest request, HttpServletResponse response, ModelAndView modelAndView) { if (loginService.ifLogin(request, response) != null) { - modelAndView.setView(new RedirectView("/" , true, false)); + modelAndView.setView(new RedirectView("/", true, false)); return modelAndView; } return new ModelAndView("login"); } - @RequestMapping(value = "login" , method = RequestMethod.POST) + @RequestMapping(value = "login", method = RequestMethod.POST) @ResponseBody @PermissionLimit(limit = false) public ReturnT loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember) { @@ -70,7 +70,7 @@ public class IndexController { return loginService.login(request, response, userName, password, ifRem); } - @RequestMapping(value = "logout" , method = RequestMethod.POST) + @RequestMapping(value = "logout", method = RequestMethod.POST) @ResponseBody @PermissionLimit(limit = false) public ReturnT logout(HttpServletRequest request, HttpServletResponse response) { diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java index aa51e7390..f4a37a71d 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java @@ -37,19 +37,19 @@ public class JobApiController { */ @RequestMapping("/{uri}") @ResponseBody - @PermissionLimit(limit=false) + @PermissionLimit(limit = false) public ReturnT api(HttpServletRequest request, @PathVariable("uri") String uri, @RequestBody(required = false) String data) { // valid if (!"POST".equalsIgnoreCase(request.getMethod())) { return new ReturnT(ReturnT.FAIL_CODE, "invalid request, HttpMethod not support."); } - if (uri==null || uri.trim().length()==0) { + if (uri == null || uri.trim().length() == 0) { return new ReturnT(ReturnT.FAIL_CODE, "invalid request, uri-mapping empty."); } - if (XxlJobAdminConfig.getAdminConfig().getAccessToken()!=null - && XxlJobAdminConfig.getAdminConfig().getAccessToken().trim().length()>0 - && !XxlJobAdminConfig.getAdminConfig().getAccessToken().equals(request.getHeader(XxlJobRemotingUtil.XXL_JOB_ACCESS_TOKEN))) { + if (XxlJobAdminConfig.getAdminConfig().getAccessToken() != null + && XxlJobAdminConfig.getAdminConfig().getAccessToken().trim().length() > 0 + && !XxlJobAdminConfig.getAdminConfig().getAccessToken().equals(request.getHeader(XxlJobRemotingUtil.XXL_JOB_ACCESS_TOKEN))) { return new ReturnT(ReturnT.FAIL_CODE, "The access token is wrong."); } @@ -64,7 +64,7 @@ public class JobApiController { RegistryParam registryParam = GsonTool.fromJson(data, RegistryParam.class); return adminBiz.registryRemove(registryParam); } else { - return new ReturnT(ReturnT.FAIL_CODE, "invalid request, uri-mapping("+ uri +") not found."); + return new ReturnT(ReturnT.FAIL_CODE, "invalid request, uri-mapping(" + uri + ") not found."); } } diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java index 0c8384f0f..9185f86b4 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java @@ -47,10 +47,10 @@ public class JobCodeController { JobInfoController.validPermission(request, jobInfo.getJobGroup()); // Glue类型-字典 - model.addAttribute("GlueTypeEnum" , GlueTypeEnum.values()); + model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); - model.addAttribute("jobInfo" , jobInfo); - model.addAttribute("jobLogGlues" , jobLogGlues); + model.addAttribute("jobInfo", jobInfo); + model.addAttribute("jobLogGlues", jobLogGlues); return "jobcode/jobcode.index"; } diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java index 4a4620092..82ec2dee4 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java @@ -52,9 +52,9 @@ public class JobGroupController { // package result Map maps = new HashMap(); - maps.put("recordsTotal" , list_count); // 总记录数 - maps.put("recordsFiltered" , list_count); // 过滤后的总记录数 - maps.put("data" , list); // 分页列表 + maps.put("recordsTotal", list_count); // 总记录数 + maps.put("recordsFiltered", list_count); // 过滤后的总记录数 + maps.put("data", list); // 分页列表 return maps; } diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java index 0f52bef73..157c60ba7 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java @@ -49,11 +49,11 @@ public class JobInfoController { public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) { // 枚举-字典 - model.addAttribute("ExecutorRouteStrategyEnum" , ExecutorRouteStrategyEnum.values()); // 路由策略-列表 - model.addAttribute("GlueTypeEnum" , GlueTypeEnum.values()); // Glue类型-字典 - model.addAttribute("ExecutorBlockStrategyEnum" , ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 - model.addAttribute("ScheduleTypeEnum" , ScheduleTypeEnum.values()); // 调度类型 - model.addAttribute("MisfireStrategyEnum" , MisfireStrategyEnum.values()); // 调度过期策略 + model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 + model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 + model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 + model.addAttribute("ScheduleTypeEnum", ScheduleTypeEnum.values()); // 调度类型 + model.addAttribute("MisfireStrategyEnum", MisfireStrategyEnum.values()); // 调度过期策略 // 执行器列表 List jobGroupList_all = xxlJobGroupDao.findAll(); @@ -64,8 +64,8 @@ public class JobInfoController { throw new XxlJobException(I18nUtil.getString("jobgroup_empty")); } - model.addAttribute("JobGroupList" , jobGroupList); - model.addAttribute("jobGroup" , jobGroup); + model.addAttribute("JobGroupList", jobGroupList); + model.addAttribute("jobGroup", jobGroup); return "jobinfo/jobinfo.index"; } diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java index 141b539c1..3369edb8f 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java @@ -1,7 +1,7 @@ package com.xxl.job.admin.controller; -import com.xxl.job.admin.core.complete.XxlJobCompleter; import com.xxl.job.admin.core.exception.XxlJobException; +import com.xxl.job.admin.core.complete.XxlJobCompleter; import com.xxl.job.admin.core.model.XxlJobGroup; import com.xxl.job.admin.core.model.XxlJobInfo; import com.xxl.job.admin.core.model.XxlJobLog; @@ -60,7 +60,7 @@ public class JobLogController { throw new XxlJobException(I18nUtil.getString("jobgroup_empty")); } - model.addAttribute("JobGroupList" , jobGroupList); + model.addAttribute("JobGroupList", jobGroupList); // 任务 if (jobId > 0) { @@ -69,7 +69,7 @@ public class JobLogController { throw new RuntimeException(I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_unvalid")); } - model.addAttribute("jobInfo" , jobInfo); + model.addAttribute("jobInfo", jobInfo); // valid permission JobInfoController.validPermission(request, jobInfo.getJobGroup()); @@ -112,9 +112,9 @@ public class JobLogController { // package result Map maps = new HashMap(); - maps.put("recordsTotal" , list_count); // 总记录数 - maps.put("recordsFiltered" , list_count); // 过滤后的总记录数 - maps.put("data" , list); // 分页列表 + maps.put("recordsTotal", list_count); // 总记录数 + maps.put("recordsFiltered", list_count); // 过滤后的总记录数 + maps.put("data", list); // 分页列表 return maps; } @@ -128,11 +128,11 @@ public class JobLogController { throw new RuntimeException(I18nUtil.getString("joblog_logid_unvalid")); } - model.addAttribute("triggerCode" , jobLog.getTriggerCode()); - model.addAttribute("handleCode" , jobLog.getHandleCode()); - model.addAttribute("executorAddress" , jobLog.getExecutorAddress()); - model.addAttribute("triggerTime" , jobLog.getTriggerTime().getTime()); - model.addAttribute("logId" , jobLog.getId()); + model.addAttribute("triggerCode", jobLog.getTriggerCode()); + model.addAttribute("handleCode", jobLog.getHandleCode()); + model.addAttribute("executorAddress", jobLog.getExecutorAddress()); + model.addAttribute("triggerTime", jobLog.getTriggerTime().getTime()); + model.addAttribute("logId", jobLog.getId()); return "joblog/joblog.detail"; } diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java index b38e1b1b8..878998d39 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java @@ -40,7 +40,7 @@ public class UserController { // 执行器列表 List groupList = xxlJobGroupDao.findAll(); - model.addAttribute("groupList" , groupList); + model.addAttribute("groupList", groupList); return "user/user.index"; } @@ -65,9 +65,9 @@ public class UserController { // package result Map maps = new HashMap(); - maps.put("recordsTotal" , list_count); // 总记录数 - maps.put("recordsFiltered" , list_count); // 过滤后的总记录数 - maps.put("data" , list); // 分页列表 + maps.put("recordsTotal", list_count); // 总记录数 + maps.put("recordsFiltered", list_count); // 过滤后的总记录数 + maps.put("data", list); // 分页列表 return maps; } diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java index 6714d1eca..228384996 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java @@ -29,15 +29,14 @@ public class CookieInterceptor implements AsyncHandlerInterceptor { for (Cookie ck : request.getCookies()) { cookieMap.put(ck.getName(), ck); } - modelAndView.addObject("cookieMap" , cookieMap); + modelAndView.addObject("cookieMap", cookieMap); } // static method if (modelAndView != null) { - modelAndView.addObject("I18nUtil" , FtlUtil.generateStaticModel(I18nUtil.class.getName())); + modelAndView.addObject("I18nUtil", FtlUtil.generateStaticModel(I18nUtil.class.getName())); } - AsyncHandlerInterceptor.super.postHandle(request, response, handler, modelAndView); } } diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java index ecaeca0ff..13e53b2f1 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java @@ -27,7 +27,7 @@ public class PermissionInterceptor implements AsyncHandlerInterceptor { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (!(handler instanceof HandlerMethod)) { - return AsyncHandlerInterceptor.super.preHandle(request, response, handler); + return true; // proceed with the next interceptor } // if need login @@ -44,7 +44,7 @@ public class PermissionInterceptor implements AsyncHandlerInterceptor { XxlJobUser loginUser = loginService.ifLogin(request, response); if (loginUser == null) { response.setStatus(302); - response.setHeader("location" , request.getContextPath() + "/toLogin"); + response.setHeader("location", request.getContextPath() + "/toLogin"); return false; } if (needAdminuser && loginUser.getRole() != 1) { @@ -53,7 +53,7 @@ public class PermissionInterceptor implements AsyncHandlerInterceptor { request.setAttribute(LoginService.LOGIN_IDENTITY_KEY, loginUser); } - return AsyncHandlerInterceptor.super.preHandle(request, response, handler); + return true; // proceed with the next interceptor } } diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java index 4cd7f193d..d7cc0db5e 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java @@ -1,8 +1,8 @@ package com.xxl.job.admin.controller.resolver; import com.xxl.job.admin.core.exception.XxlJobException; -import com.xxl.job.admin.core.util.JacksonUtil; import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.admin.core.util.JacksonUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -29,7 +29,7 @@ public class WebExceptionResolver implements HandlerExceptionResolver { HttpServletResponse response, Object handler, Exception ex) { if (!(ex instanceof XxlJobException)) { - logger.error("WebExceptionResolver:{}" , ex); + logger.error("WebExceptionResolver:{}", ex); } // if json @@ -43,7 +43,7 @@ public class WebExceptionResolver implements HandlerExceptionResolver { } // error result - ReturnT errorResult = new ReturnT(ReturnT.FAIL_CODE, ex.toString().replaceAll("\n" , "
")); + ReturnT errorResult = new ReturnT(ReturnT.FAIL_CODE, ex.toString().replaceAll("\n", "
")); // response ModelAndView mv = new ModelAndView(); @@ -57,7 +57,7 @@ public class WebExceptionResolver implements HandlerExceptionResolver { return mv; } else { - mv.addObject("exceptionMsg" , errorResult.getMsg()); + mv.addObject("exceptionMsg", errorResult.getMsg()); mv.setViewName("/common/common.exception"); return mv; } diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/JobAlarmer.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/JobAlarmer.java index 797dc900c..62dac9d27 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/JobAlarmer.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/JobAlarmer.java @@ -44,9 +44,9 @@ public class JobAlarmer implements ApplicationContextAware, InitializingBean { public boolean alarm(XxlJobInfo info, XxlJobLog jobLog) { boolean result = false; - if (jobAlarmList!=null && jobAlarmList.size()>0) { + if (jobAlarmList != null && jobAlarmList.size() > 0) { result = true; // success means all-success - for (JobAlarm alarm: jobAlarmList) { + for (JobAlarm alarm : jobAlarmList) { boolean resultItem = false; try { resultItem = alarm.doAlarm(info, jobLog); diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java index e7290d76f..6ad1c0b1c 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java @@ -32,18 +32,19 @@ public class EmailJobAlarm implements JobAlarm { * * @param jobLog */ - public boolean doAlarm(XxlJobInfo info, XxlJobLog jobLog){ + @Override + public boolean doAlarm(XxlJobInfo info, XxlJobLog jobLog) { boolean alarmResult = true; // send monitor email - if (info!=null && info.getAlarmEmail()!=null && info.getAlarmEmail().trim().length()>0) { + if (info != null && info.getAlarmEmail() != null && info.getAlarmEmail().trim().length() > 0) { // alarmContent String alarmContent = "Alarm Job LogId=" + jobLog.getId(); if (jobLog.getTriggerCode() != ReturnT.SUCCESS_CODE) { alarmContent += "
TriggerMsg=
" + jobLog.getTriggerMsg(); } - if (jobLog.getHandleCode()>0 && jobLog.getHandleCode() != ReturnT.SUCCESS_CODE) { + if (jobLog.getHandleCode() > 0 && jobLog.getHandleCode() != ReturnT.SUCCESS_CODE) { alarmContent += "
HandleCode=" + jobLog.getHandleMsg(); } @@ -52,13 +53,13 @@ public class EmailJobAlarm implements JobAlarm { String personal = I18nUtil.getString("admin_name_full"); String title = I18nUtil.getString("jobconf_monitor"); String content = MessageFormat.format(loadEmailJobAlarmTemplate(), - group!=null?group.getTitle():"null", - info.getId(), - info.getJobDesc(), - alarmContent); + group != null ? group.getTitle() : "null", + info.getId(), + info.getJobDesc(), + alarmContent); Set emailSet = new HashSet(Arrays.asList(info.getAlarmEmail().split(","))); - for (String email: emailSet) { + for (String email : emailSet) { // make mail try { @@ -88,28 +89,28 @@ public class EmailJobAlarm implements JobAlarm { * * @return */ - private static final String loadEmailJobAlarmTemplate(){ + private static final String loadEmailJobAlarmTemplate() { String mailBodyTemplate = "
" + I18nUtil.getString("jobconf_monitor_detail") + ":" + - "\n" + - " " + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "
"+ I18nUtil.getString("jobinfo_field_jobgroup") +""+ I18nUtil.getString("jobinfo_field_id") +""+ I18nUtil.getString("jobinfo_field_jobdesc") +""+ I18nUtil.getString("jobconf_monitor_alarm_title") +""+ I18nUtil.getString("jobconf_monitor_alarm_content") +"
{0}{1}{2}"+ I18nUtil.getString("jobconf_monitor_alarm_type") +"{3}
"; + "\n" + + " " + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
" + I18nUtil.getString("jobinfo_field_jobgroup") + "" + I18nUtil.getString("jobinfo_field_id") + "" + I18nUtil.getString("jobinfo_field_jobdesc") + "" + I18nUtil.getString("jobconf_monitor_alarm_title") + "" + I18nUtil.getString("jobconf_monitor_alarm_content") + "
{0}{1}{2}" + I18nUtil.getString("jobconf_monitor_alarm_type") + "{3}
"; return mailBodyTemplate; } diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/complete/XxlJobCompleter.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/complete/XxlJobCompleter.java index b9ac59a38..83399336b 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/complete/XxlJobCompleter.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/complete/XxlJobCompleter.java @@ -32,7 +32,7 @@ public class XxlJobCompleter { // text最大64kb 避免长度过长 if (xxlJobLog.getHandleMsg().length() > 15000) { - xxlJobLog.setHandleMsg( xxlJobLog.getHandleMsg().substring(0, 15000) ); + xxlJobLog.setHandleMsg(xxlJobLog.getHandleMsg().substring(0, 15000)); } // fresh handle @@ -43,18 +43,18 @@ public class XxlJobCompleter { /** * do somethind to finish job */ - private static void finishJob(XxlJobLog xxlJobLog){ + private static void finishJob(XxlJobLog xxlJobLog) { // 1、handle success, to trigger child job String triggerChildMsg = null; - if (XxlJobContext.HANDLE_COCE_SUCCESS == xxlJobLog.getHandleCode()) { + if (XxlJobContext.HANDLE_CODE_SUCCESS == xxlJobLog.getHandleCode()) { XxlJobInfo xxlJobInfo = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(xxlJobLog.getJobId()); - if (xxlJobInfo!=null && xxlJobInfo.getChildJobId()!=null && xxlJobInfo.getChildJobId().trim().length()>0) { - triggerChildMsg = "

>>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_child_run") +"<<<<<<<<<<<
"; + if (xxlJobInfo != null && xxlJobInfo.getChildJobId() != null && xxlJobInfo.getChildJobId().trim().length() > 0) { + triggerChildMsg = "

>>>>>>>>>>>" + I18nUtil.getString("jobconf_trigger_child_run") + "<<<<<<<<<<<
"; String[] childJobIds = xxlJobInfo.getChildJobId().split(","); for (int i = 0; i < childJobIds.length; i++) { - int childJobId = (childJobIds[i]!=null && childJobIds[i].trim().length()>0 && isNumeric(childJobIds[i]))?Integer.valueOf(childJobIds[i]):-1; + int childJobId = (childJobIds[i] != null && childJobIds[i].trim().length() > 0 && isNumeric(childJobIds[i])) ? Integer.valueOf(childJobIds[i]) : -1; if (childJobId > 0) { JobTriggerPoolHelper.trigger(childJobId, TriggerTypeEnum.PARENT, -1, null, null, null); @@ -62,16 +62,16 @@ public class XxlJobCompleter { // add msg triggerChildMsg += MessageFormat.format(I18nUtil.getString("jobconf_callback_child_msg1"), - (i+1), - childJobIds.length, - childJobIds[i], - (triggerChildResult.getCode()==ReturnT.SUCCESS_CODE?I18nUtil.getString("system_success"):I18nUtil.getString("system_fail")), - triggerChildResult.getMsg()); + (i + 1), + childJobIds.length, + childJobIds[i], + (triggerChildResult.getCode() == ReturnT.SUCCESS_CODE ? I18nUtil.getString("system_success") : I18nUtil.getString("system_fail")), + triggerChildResult.getMsg()); } else { triggerChildMsg += MessageFormat.format(I18nUtil.getString("jobconf_callback_child_msg2"), - (i+1), - childJobIds.length, - childJobIds[i]); + (i + 1), + childJobIds.length, + childJobIds[i]); } } @@ -79,7 +79,7 @@ public class XxlJobCompleter { } if (triggerChildMsg != null) { - xxlJobLog.setHandleMsg( xxlJobLog.getHandleMsg() + triggerChildMsg ); + xxlJobLog.setHandleMsg(xxlJobLog.getHandleMsg() + triggerChildMsg); } // 2、fix_delay trigger next @@ -87,7 +87,7 @@ public class XxlJobCompleter { } - private static boolean isNumeric(String str){ + private static boolean isNumeric(String str) { try { int result = Integer.valueOf(str); return true; diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java index 380b8a596..6e40cb760 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java @@ -23,6 +23,7 @@ import java.util.Arrays; public class XxlJobAdminConfig implements InitializingBean, DisposableBean { private static XxlJobAdminConfig adminConfig = null; + public static XxlJobAdminConfig getAdminConfig() { return adminConfig; } diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java index fce23524d..2ce373eeb 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java @@ -1,18 +1,18 @@ /* * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy + * of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations * under the License. - * + * */ package com.xxl.job.admin.core.cron; @@ -31,14 +31,14 @@ import java.util.TimeZone; import java.util.TreeSet; /** - * Provides a parser and evaluator for unix-like cron expressions. Cron + * Provides a parser and evaluator for unix-like cron expressions. Cron * expressions provide the ability to specify complex time combinations such as - * "At 8:00am every Monday through Friday" or "At 1:30am every - * last Friday of the month". + * "At 8:00am every Monday through Friday" or "At 1:30am every + * last Friday of the month". *

* Cron expressions are comprised of 6 required fields and one optional field * separated by white space. The fields respectively are described as follows: - * + * * * * @@ -98,7 +98,7 @@ import java.util.TreeSet; * *
Field Name
*

- * The '*' character is used to specify all values. For example, "*" + * The '*' character is used to specify all values. For example, "*" * in the minute field means "every minute". *

* The '?' character is allowed for the day-of-month and day-of-week fields. It @@ -113,55 +113,55 @@ import java.util.TreeSet; * Wednesday, and Friday". *

* The '/' character is used to specify increments. For example "0/15" - * in the seconds field means "the seconds 0, 15, 30, and 45". And + * in the seconds field means "the seconds 0, 15, 30, and 45". And * "5/15" in the seconds field means "the seconds 5, 20, 35, and * 50". Specifying '*' before the '/' is equivalent to specifying 0 is * the value to start with. Essentially, for each field in the expression, there - * is a set of numbers that can be turned on or off. For seconds and minutes, + * is a set of numbers that can be turned on or off. For seconds and minutes, * the numbers range from 0 to 59. For hours 0 to 23, for days of the month 0 to * 31, and for months 0 to 11 (JAN to DEC). The "/" character simply helps you turn * on every "nth" value in the given set. Thus "7/6" in the - * month field only turns on month "7", it does NOT mean every 6th - * month, please note that subtlety. + * month field only turns on month "7", it does NOT mean every 6th + * month, please note that subtlety. *

* The 'L' character is allowed for the day-of-month and day-of-week fields. - * This character is short-hand for "last", but it has different - * meaning in each of the two fields. For example, the value "L" in - * the day-of-month field means "the last day of the month" - day 31 - * for January, day 28 for February on non-leap years. If used in the - * day-of-week field by itself, it simply means "7" or + * This character is short-hand for "last", but it has different + * meaning in each of the two fields. For example, the value "L" in + * the day-of-month field means "the last day of the month" - day 31 + * for January, day 28 for February on non-leap years. If used in the + * day-of-week field by itself, it simply means "7" or * "SAT". But if used in the day-of-week field after another value, it * means "the last xxx day of the month" - for example "6L" - * means "the last friday of the month". You can also specify an offset - * from the last day of the month, such as "L-3" which would mean the third-to-last - * day of the calendar month. When using the 'L' option, it is important not to + * means "the last friday of the month". You can also specify an offset + * from the last day of the month, such as "L-3" which would mean the third-to-last + * day of the calendar month. When using the 'L' option, it is important not to * specify lists, or ranges of values, as you'll get confusing/unexpected results. *

- * The 'W' character is allowed for the day-of-month field. This character - * is used to specify the weekday (Monday-Friday) nearest the given day. As an - * example, if you were to specify "15W" as the value for the + * The 'W' character is allowed for the day-of-month field. This character + * is used to specify the weekday (Monday-Friday) nearest the given day. As an + * example, if you were to specify "15W" as the value for the * day-of-month field, the meaning is: "the nearest weekday to the 15th of - * the month". So if the 15th is a Saturday, the trigger will fire on + * the month". So if the 15th is a Saturday, the trigger will fire on * Friday the 14th. If the 15th is a Sunday, the trigger will fire on Monday the - * 16th. If the 15th is a Tuesday, then it will fire on Tuesday the 15th. + * 16th. If the 15th is a Tuesday, then it will fire on Tuesday the 15th. * However if you specify "1W" as the value for day-of-month, and the - * 1st is a Saturday, the trigger will fire on Monday the 3rd, as it will not - * 'jump' over the boundary of a month's days. The 'W' character can only be + * 1st is a Saturday, the trigger will fire on Monday the 3rd, as it will not + * 'jump' over the boundary of a month's days. The 'W' character can only be * specified when the day-of-month is a single day, not a range or list of days. *

- * The 'L' and 'W' characters can also be combined for the day-of-month - * expression to yield 'LW', which translates to "last weekday of the + * The 'L' and 'W' characters can also be combined for the day-of-month + * expression to yield 'LW', which translates to "last weekday of the * month". *

* The '#' character is allowed for the day-of-week field. This character is - * used to specify "the nth" XXX day of the month. For example, the - * value of "6#3" in the day-of-week field means the third Friday of - * the month (day 6 = Friday and "#3" = the 3rd one in the month). - * Other examples: "2#1" = the first Monday of the month and + * used to specify "the nth" XXX day of the month. For example, the + * value of "6#3" in the day-of-week field means the third Friday of + * the month (day 6 = Friday and "#3" = the 3rd one in the month). + * Other examples: "2#1" = the first Monday of the month and * "4#5" = the fifth Wednesday of the month. Note that if you specify * "#5" and there is not 5 of the given day-of-week in the month, then * no firing will occur that month. If the '#' character is used, there can - * only be one expression in the day-of-week field ("3#1,6#3" is + * only be one expression in the day-of-week field ("3#1,6#3" is * not valid, since there are two expressions). *

*