计划任务管理
This commit is contained in:
parent
c2a64e30f5
commit
621e7916dc
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.mdd.admin.controller;
|
||||||
|
|
||||||
|
import com.mdd.admin.service.ICrontabService;
|
||||||
|
import com.mdd.admin.validate.commons.PageValidate;
|
||||||
|
import com.mdd.admin.vo.CrontabListedVo;
|
||||||
|
import com.mdd.common.core.AjaxResult;
|
||||||
|
import com.mdd.common.core.PageResult;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RequestMapping("api/crontab")
|
||||||
|
public class CrontabController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ICrontabService iCrontabService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划任务列表
|
||||||
|
*
|
||||||
|
* @author fzr
|
||||||
|
* @param pageValidate 分页参数
|
||||||
|
* @return AjaxResult<Object>
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult<Object> list(@Validated PageValidate pageValidate) {
|
||||||
|
PageResult<CrontabListedVo> list = iCrontabService.list(pageValidate);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public AjaxResult<Object> detail() {
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
public AjaxResult<Object> add() {
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/edit")
|
||||||
|
public AjaxResult<Object> edit() {
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/del")
|
||||||
|
public AjaxResult<Object> del() {
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.mdd.admin.controller;
|
package com.mdd.admin.controller;
|
||||||
|
|
||||||
import com.mdd.admin.service.IIndexCommonService;
|
import com.mdd.admin.service.IIndexService;
|
||||||
import com.mdd.common.core.AjaxResult;
|
import com.mdd.common.core.AjaxResult;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
@ -19,7 +19,7 @@ import java.util.Map;
|
||||||
public class IndexController {
|
public class IndexController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
IIndexCommonService iIndexCommonService;
|
IIndexService iIndexService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制台
|
* 控制台
|
||||||
|
|
@ -29,7 +29,7 @@ public class IndexController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/console")
|
@GetMapping("/console")
|
||||||
public AjaxResult<Map<String, Object>> console() {
|
public AjaxResult<Map<String, Object>> console() {
|
||||||
Map<String, Object> map = iIndexCommonService.console();
|
Map<String, Object> map = iIndexService.console();
|
||||||
return AjaxResult.success(map);
|
return AjaxResult.success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class IndexController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/config")
|
@GetMapping("/config")
|
||||||
public AjaxResult<Map<String, Object>> config() {
|
public AjaxResult<Map<String, Object>> config() {
|
||||||
Map<String, Object> map = iIndexCommonService.config();
|
Map<String, Object> map = iIndexService.config();
|
||||||
return AjaxResult.success(map);
|
return AjaxResult.success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.mdd.admin.service;
|
||||||
|
|
||||||
|
import com.mdd.admin.validate.commons.PageValidate;
|
||||||
|
import com.mdd.admin.vo.CrontabDetailVo;
|
||||||
|
import com.mdd.admin.vo.CrontabListedVo;
|
||||||
|
import com.mdd.common.core.PageResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划任务服务接口类
|
||||||
|
*/
|
||||||
|
public interface ICrontabService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划任务列表
|
||||||
|
*
|
||||||
|
* @author fzr
|
||||||
|
* @param pageValidate 分页参数
|
||||||
|
* @return PageResult<CrontabListedVo>
|
||||||
|
*/
|
||||||
|
PageResult<CrontabListedVo> list(PageValidate pageValidate);
|
||||||
|
|
||||||
|
CrontabDetailVo detail();
|
||||||
|
|
||||||
|
void add();
|
||||||
|
|
||||||
|
void edit();
|
||||||
|
|
||||||
|
void del();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@ import java.util.Map;
|
||||||
/**
|
/**
|
||||||
* 主页服务接口类
|
* 主页服务接口类
|
||||||
*/
|
*/
|
||||||
public interface IIndexCommonService {
|
public interface IIndexService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制台数据
|
* 控制台数据
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.mdd.admin.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.mdd.admin.service.ICrontabService;
|
||||||
|
import com.mdd.admin.validate.commons.PageValidate;
|
||||||
|
import com.mdd.admin.vo.CrontabDetailVo;
|
||||||
|
import com.mdd.admin.vo.CrontabListedVo;
|
||||||
|
import com.mdd.admin.vo.article.ArticleListedVo;
|
||||||
|
import com.mdd.common.core.PageResult;
|
||||||
|
import com.mdd.common.entity.Crontab;
|
||||||
|
import com.mdd.common.mapper.CrontabMapper;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划任务服务实现类
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CrontabServiceImpl implements ICrontabService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CrontabMapper crontabMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划任务列表
|
||||||
|
*
|
||||||
|
* @author fzr
|
||||||
|
* @param pageValidate 分页参数
|
||||||
|
* @return PageResult<CrontabListedVo>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<CrontabListedVo> list(PageValidate pageValidate) {
|
||||||
|
Integer pageNo = pageValidate.getPageNo();
|
||||||
|
Integer pageSize = pageValidate.getPageSize();
|
||||||
|
|
||||||
|
IPage<Crontab> iPage = crontabMapper.selectPage(new Page<>(pageNo, pageSize),
|
||||||
|
new QueryWrapper<Crontab>()
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.orderByDesc("id"));
|
||||||
|
|
||||||
|
List<CrontabListedVo> list = new LinkedList<>();
|
||||||
|
for (Crontab crontab : iPage.getRecords()) {
|
||||||
|
CrontabListedVo vo = new CrontabListedVo();
|
||||||
|
BeanUtils.copyProperties(crontab, vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CrontabDetailVo detail() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void edit() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void del() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.mdd.admin.service.impl;
|
package com.mdd.admin.service.impl;
|
||||||
|
|
||||||
import com.mdd.admin.service.IIndexCommonService;
|
import com.mdd.admin.service.IIndexService;
|
||||||
import com.mdd.common.config.GlobalConfig;
|
import com.mdd.common.config.GlobalConfig;
|
||||||
import com.mdd.common.utils.ArrayUtil;
|
import com.mdd.common.utils.ArrayUtil;
|
||||||
import com.mdd.common.utils.ConfigUtil;
|
import com.mdd.common.utils.ConfigUtil;
|
||||||
|
|
@ -14,7 +14,7 @@ import java.util.*;
|
||||||
* 主页服务实现类
|
* 主页服务实现类
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class IndexCommonServiceImpl implements IIndexCommonService {
|
public class IndexServiceImpl implements IIndexService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制台数据
|
* 控制台数据
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.mdd.admin.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CrontabDetailVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
private String command;
|
||||||
|
private String rules;
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.mdd.admin.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CrontabListedVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
private String command;
|
||||||
|
private String rules;
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.mdd.common.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划任务实体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Crontab implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer id; // 主键
|
||||||
|
private String name; // 任务名称
|
||||||
|
private String command; // 任务命令
|
||||||
|
private String rules; // 任务规则
|
||||||
|
private String remark; // 备注信息
|
||||||
|
private Integer status; // 执行状态:1=运行, 2-停止, 3=错误
|
||||||
|
private Integer isDelete; // 是否删除: 0=否, 1=是
|
||||||
|
private Long createTime; // 创建时间
|
||||||
|
private Long updateTime; // 更新时间
|
||||||
|
private Long deleteTime; // 删除时间
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.mdd.common.mapper;
|
||||||
|
|
||||||
|
import com.mdd.common.core.basics.IBaseMapper;
|
||||||
|
import com.mdd.common.entity.Crontab;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划任务Mapper
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CrontabMapper extends IBaseMapper<Crontab> {
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue