12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package com.xxl.job.controller;
- import com.xxl.job.core.biz.model.ReturnT;
- import com.xxl.job.service.XxlJobService;
- import org.springframework.beans.propertyeditors.CustomDateEditor;
- import org.springframework.web.bind.WebDataBinder;
- import org.springframework.web.bind.annotation.InitBinder;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import javax.annotation.Resource;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.Map;
- /**
- * @Description
- * @Author bqyang
- * @Date 2025/1/7 09:48
- * @Version 1.0
- */
- @RestController
- @RequestMapping("/xxl-job-admin")
- public class DashboardController {
- @Resource
- private XxlJobService xxlJobService;
- @RequestMapping("/chartInfo")
- public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
- ReturnT<Map<String, Object>> chartInfo = xxlJobService.chartInfo(startDate, endDate);
- return chartInfo;
- }
- @InitBinder
- public void initBinder(WebDataBinder binder) {
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- dateFormat.setLenient(false);
- binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
- }
- @RequestMapping("/dashboardInfo")
- public ReturnT<Map<String, Object>> dashboardInfo() {
- Map<String, Object> dashboardInfo = xxlJobService.dashboardInfo();
- return new ReturnT<>(dashboardInfo);
- }
- }
|