Showing
1 changed file
with
14 additions
and
8 deletions
@@ -7,6 +7,7 @@ import io.swagger.annotations.Api; | @@ -7,6 +7,7 @@ import io.swagger.annotations.Api; | ||
7 | import io.swagger.annotations.ApiOperation; | 7 | import io.swagger.annotations.ApiOperation; |
8 | import java.util.HashMap; | 8 | import java.util.HashMap; |
9 | import java.util.List; | 9 | import java.util.List; |
10 | +import java.util.Map; | ||
10 | import javax.annotation.PostConstruct; | 11 | import javax.annotation.PostConstruct; |
11 | import lombok.RequiredArgsConstructor; | 12 | import lombok.RequiredArgsConstructor; |
12 | import org.apache.commons.lang3.StringUtils; | 13 | import org.apache.commons.lang3.StringUtils; |
@@ -124,24 +125,29 @@ public class SysJobController extends BaseController { | @@ -124,24 +125,29 @@ public class SysJobController extends BaseController { | ||
124 | } | 125 | } |
125 | 126 | ||
126 | /** 校验cron表达式是否有效 */ | 127 | /** 校验cron表达式是否有效 */ |
127 | - @GetMapping("/check_cron/{cronExpression}") | 128 | + @PostMapping("/check_cron") |
128 | @ApiOperation(value = "校验cron表达式是否有效") | 129 | @ApiOperation(value = "校验cron表达式是否有效") |
129 | - public boolean checkCronExpressionIsValid(@PathVariable("cronExpression") String cronExpression) { | ||
130 | - if (StringUtils.isEmpty(cronExpression)) { | 130 | + public boolean checkCronExpressionIsValid(@RequestBody Map<String,Object> query) { |
131 | + String cron = query.get("cron") != null ? (String) query.get("cron") :null; | ||
132 | + if (StringUtils.isEmpty(cron)) { | ||
131 | throw new TkDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); | 133 | throw new TkDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); |
132 | } | 134 | } |
133 | - return jobService.checkCronExpressionIsValid(cronExpression); | 135 | + return jobService.checkCronExpressionIsValid(cron); |
134 | } | 136 | } |
135 | 137 | ||
136 | /** 查询cron表达式近5次的执行时间 */ | 138 | /** 查询cron表达式近5次的执行时间 */ |
137 | - @GetMapping("/query_cron_expression/{cronExpression}") | 139 | + @PostMapping("/query_cron_expression") |
138 | @ResponseBody | 140 | @ResponseBody |
139 | @ApiOperation(value = "查询cron表达式近5次的执行时间") | 141 | @ApiOperation(value = "查询cron表达式近5次的执行时间") |
140 | - public ResponseResult queryCronExpression(@PathVariable("cronExpression") String cronExpression) { | ||
141 | - if (!jobService.checkCronExpressionIsValid(cronExpression)) { | 142 | + public ResponseResult queryCronExpression(@RequestBody Map<String,Object> query) { |
143 | + String cron = query.get("cron") != null ? (String) query.get("cron") :null; | ||
144 | + if (StringUtils.isEmpty(cron)) { | ||
145 | + throw new TkDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); | ||
146 | + } | ||
147 | + if (!jobService.checkCronExpressionIsValid(cron)) { | ||
142 | throw new TkDataValidationException(ErrorMessage.CRON_INVALID.getMessage()); | 148 | throw new TkDataValidationException(ErrorMessage.CRON_INVALID.getMessage()); |
143 | } | 149 | } |
144 | - List<String> dateList = CronUtils.getRecentTriggerTime(cronExpression); | 150 | + List<String> dateList = CronUtils.getRecentTriggerTime(cron); |
145 | return ResponseResult.success(dateList); | 151 | return ResponseResult.success(dateList); |
146 | } | 152 | } |
147 | 153 |