|
@@ -0,0 +1,57 @@
|
|
|
|
+package com.qmth.distributed.print.api.job;
|
|
|
|
+
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.qmth.boot.api.annotation.Aac;
|
|
|
|
+import com.qmth.boot.api.constant.ApiConstant;
|
|
|
|
+import com.qmth.boot.core.rateLimit.annotation.RateLimit;
|
|
|
|
+import com.qmth.distributed.print.business.entity.TSJobLog;
|
|
|
|
+import com.qmth.distributed.print.business.service.TSJobLogService;
|
|
|
|
+import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
|
+import com.qmth.teachcloud.common.util.Result;
|
|
|
|
+import com.qmth.teachcloud.common.util.ResultUtil;
|
|
|
|
+import io.swagger.annotations.*;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.util.Objects;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * <p>
|
|
|
|
+ * job 前端控制器
|
|
|
|
+ * </p>
|
|
|
|
+ *
|
|
|
|
+ * @author wangliang
|
|
|
|
+ * @since 2024-02-18
|
|
|
|
+ */
|
|
|
|
+@Api(tags = "job-运行情况Controller")
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_JOB)
|
|
|
|
+public class JobController {
|
|
|
|
+ private final static Logger log = LoggerFactory.getLogger(JobController.class);
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TSJobLogService tsJobLogService;
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "job列表")
|
|
|
|
+ @RequestMapping(value = "/list/{type}/{date}", method = RequestMethod.GET)
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = Objects.class)})
|
|
|
|
+ @Aac(auth = false, rateLimit = @RateLimit(count = 1, period = 1000L))
|
|
|
|
+ public Result reportList(@ApiParam(value = "类型", required = true) @PathVariable String type,
|
|
|
|
+ @ApiParam(value = "日期", required = true) @PathVariable String date) {
|
|
|
|
+ String startTime = date.trim() + " 00:00:00";
|
|
|
|
+ String endTime = date.trim() + " 23:59:59";
|
|
|
|
+ DateTime dateStartTime = DateUtil.parse(startTime, SystemConstant.DEFAULT_DATE_PATTERN);
|
|
|
|
+ DateTime dateEndTime = DateUtil.parse(endTime, SystemConstant.DEFAULT_DATE_PATTERN);
|
|
|
|
+ return ResultUtil.ok(tsJobLogService.list(new QueryWrapper<TSJobLog>().lambda()
|
|
|
|
+ .eq(TSJobLog::getType, type)
|
|
|
|
+ .ge(TSJobLog::getCreateTime, dateStartTime.getTime())
|
|
|
|
+ .le(TSJobLog::getCreateTime, dateEndTime.getTime()).orderByAsc(TSJobLog::getCreateTime)));
|
|
|
|
+ }
|
|
|
|
+}
|