...
|
...
|
@@ -7,6 +7,8 @@ import org.quartz.SchedulerException; |
7
|
7
|
import org.springframework.security.access.prepost.PreAuthorize;
|
8
|
8
|
import org.springframework.web.bind.annotation.*;
|
9
|
9
|
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
|
10
|
+import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException;
|
|
11
|
+import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage;
|
10
|
12
|
import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO;
|
11
|
13
|
import org.thingsboard.server.common.data.yunteng.dto.SysJobLogDTO;
|
12
|
14
|
import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum;
|
...
|
...
|
@@ -15,15 +17,13 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
15
|
17
|
import org.thingsboard.server.controller.BaseController;
|
16
|
18
|
import org.thingsboard.server.dao.yunteng.service.TkSysJobLogService;
|
17
|
19
|
|
|
20
|
+import java.sql.Timestamp;
|
18
|
21
|
import java.util.HashMap;
|
19
|
22
|
|
20
|
23
|
import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*;
|
21
|
24
|
import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE;
|
22
|
25
|
|
23
|
|
-/**
|
24
|
|
- * 调度日志操作处理
|
25
|
|
- *
|
26
|
|
- */
|
|
26
|
+/** 调度日志操作处理 */
|
27
|
27
|
@RestController
|
28
|
28
|
@RequestMapping("api/yt/monitor/job_log")
|
29
|
29
|
@RequiredArgsConstructor
|
...
|
...
|
@@ -44,6 +44,8 @@ public class SysJobLogController extends BaseController { |
44
|
44
|
@RequestParam(value = "jobGroup", required = false) String jobGroup,
|
45
|
45
|
@RequestParam(value = "status", required = false) Integer status,
|
46
|
46
|
@RequestParam(value = "jobId", required = false) String jobId,
|
|
47
|
+ @RequestParam(value = "startTime", required = false) Long startTime,
|
|
48
|
+ @RequestParam(value = "endTime", required = false) Long endTime,
|
47
|
49
|
@RequestParam(value = ORDER_FILED, required = false) String orderBy,
|
48
|
50
|
@RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType)
|
49
|
51
|
throws ThingsboardException {
|
...
|
...
|
@@ -58,6 +60,15 @@ public class SysJobLogController extends BaseController { |
58
|
60
|
if (orderType != null) {
|
59
|
61
|
queryMap.put(ORDER_TYPE, orderType.name());
|
60
|
62
|
}
|
|
63
|
+
|
|
64
|
+ if (null != startTime && null != endTime) {
|
|
65
|
+ if (startTime > endTime) {
|
|
66
|
+ throw new TkDataValidationException(
|
|
67
|
+ ErrorMessage.START_TIME_NOT_MORE_THAN_END_TIME.getMessage());
|
|
68
|
+ }
|
|
69
|
+ queryMap.put("startTime", new Timestamp(startTime).toLocalDateTime());
|
|
70
|
+ queryMap.put("endTime", new Timestamp(endTime).toLocalDateTime());
|
|
71
|
+ }
|
61
|
72
|
return tkSysJobLogService.sysJobLogPageByJobId(queryMap);
|
62
|
73
|
}
|
63
|
74
|
|
...
|
...
|
@@ -70,9 +81,10 @@ public class SysJobLogController extends BaseController { |
70
|
81
|
|
71
|
82
|
@GetMapping("/get/{jobId}/{id}")
|
72
|
83
|
@ApiOperation(value = "获取详情")
|
73
|
|
- public ResponseResult<SysJobLogDTO> getSysJobLog(@PathVariable("jobId") String jobId,@PathVariable("id") String id)
|
74
|
|
- throws SchedulerException {
|
75
|
|
- return ResponseResult.success(tkSysJobLogService.findSysJobLogById(jobId,id));
|
|
84
|
+ public ResponseResult<SysJobLogDTO> getSysJobLog(
|
|
85
|
+ @PathVariable("jobId") String jobId, @PathVariable("id") String id)
|
|
86
|
+ throws SchedulerException {
|
|
87
|
+ return ResponseResult.success(tkSysJobLogService.findSysJobLogById(jobId, id));
|
76
|
88
|
}
|
77
|
89
|
|
78
|
90
|
@PostMapping("/clean")
|
...
|
...
|
|