Commit efe18b9f1309d4289d432994cb81f17aa86b964c

Authored by xp.Huang
1 parent 80fe0985

fix: 修复超级管理员cron表达式任务详细查询bug

... ... @@ -7,6 +7,7 @@ import io.swagger.annotations.Api;
7 7 import io.swagger.annotations.ApiOperation;
8 8 import java.util.HashMap;
9 9 import java.util.List;
  10 +import java.util.Map;
10 11 import javax.annotation.PostConstruct;
11 12 import lombok.RequiredArgsConstructor;
12 13 import org.apache.commons.lang3.StringUtils;
... ... @@ -124,24 +125,29 @@ public class SysJobController extends BaseController {
124 125 }
125 126
126 127 /** 校验cron表达式是否有效 */
127   - @GetMapping("/check_cron/{cronExpression}")
  128 + @PostMapping("/check_cron")
128 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 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 138 /** 查询cron表达式近5次的执行时间 */
137   - @GetMapping("/query_cron_expression/{cronExpression}")
  139 + @PostMapping("/query_cron_expression")
138 140 @ResponseBody
139 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 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 151 return ResponseResult.success(dateList);
146 152 }
147 153
... ...