From bc1504d9917665b64f003a588de603b20478b026 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 14 Feb 2021 19:22:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=AE=8C=E6=88=90=20Job=20=E7=9A=84?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=92=8C=E4=BF=AE=E6=94=B9=202.=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=99=A8=E7=9A=84?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/.env.development | 2 +- ruoyi-ui/.env.production | 2 +- ruoyi-ui/.env.staging | 2 +- ruoyi-ui/package.json | 4 +- ruoyi-ui/src/api/monitor/job.js | 14 +- .../src/layout/components/Sidebar/Logo.vue | 2 +- ruoyi-ui/src/settings.js | 2 +- ruoyi-ui/src/utils/dict.js | 1 + ruoyi-ui/src/views/index.vue | 10 +- ruoyi-ui/src/views/login.vue | 2 +- ruoyi-ui/src/views/monitor/job/index.vue | 364 +++++------------- ruoyi-ui/src/views/tool/codegen/editTable.vue | 2 +- ruoyi-ui/src/views/tool/codegen/index.vue | 2 +- ruoyi-ui/vue.config.js | 2 +- .../controller/job/InfJobController.java | 2 +- .../controller/job/vo/job/InfJobBaseVO.java | 28 -- .../job/vo/job/InfJobCreateReqVO.java | 7 + .../controller/job/vo/job/InfJobRespVO.java | 20 + .../infra/dal/dataobject/job/InfJobDO.java | 2 +- .../service/job/impl/InfJobServiceImpl.java | 6 + .../job/auth/SysUserSessionTimeoutJob.java | 5 + .../codegen/java/controller/vo/baseVO.vm | 2 +- .../resources/codegen/vue/views/index.vue.vm | 12 +- 23 files changed, 169 insertions(+), 326 deletions(-) diff --git a/ruoyi-ui/.env.development b/ruoyi-ui/.env.development index 069b536cd..cbe5fa5a8 100644 --- a/ruoyi-ui/.env.development +++ b/ruoyi-ui/.env.development @@ -1,7 +1,7 @@ # 开发环境配置 ENV = 'development' -# 若依管理系统/开发环境 +# 芋道管理系统/开发环境 VUE_APP_BASE_API = '/dev-api' # VUE_APP_BASE_API = '/api' diff --git a/ruoyi-ui/.env.production b/ruoyi-ui/.env.production index a8e4af3b4..fbae57919 100644 --- a/ruoyi-ui/.env.production +++ b/ruoyi-ui/.env.production @@ -1,5 +1,5 @@ # 生产环境配置 ENV = 'production' -# 若依管理系统/生产环境 +# 芋道管理系统/生产环境 VUE_APP_BASE_API = '/prod-api' diff --git a/ruoyi-ui/.env.staging b/ruoyi-ui/.env.staging index 41d4817c4..4b93054c2 100644 --- a/ruoyi-ui/.env.staging +++ b/ruoyi-ui/.env.staging @@ -3,5 +3,5 @@ NODE_ENV = production # 测试环境配置 ENV = 'staging' -# 若依管理系统/测试环境 +# 芋道管理系统/测试环境 VUE_APP_BASE_API = '/stage-api' diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 7df639f52..853fff46e 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,8 +1,8 @@ { "name": "ruoyi", "version": "3.3.0", - "description": "若依管理系统", - "author": "若依", + "description": "芋道管理系统", + "author": "芋道", "license": "MIT", "scripts": { "dev": "vue-cli-service serve", diff --git a/ruoyi-ui/src/api/monitor/job.js b/ruoyi-ui/src/api/monitor/job.js index 58c43434a..c46a46f25 100644 --- a/ruoyi-ui/src/api/monitor/job.js +++ b/ruoyi-ui/src/api/monitor/job.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询定时任务调度列表 export function listJob(query) { return request({ - url: '/monitor/job/list', + url: '/infra/job/page', method: 'get', params: query }) @@ -12,7 +12,7 @@ export function listJob(query) { // 查询定时任务调度详细 export function getJob(jobId) { return request({ - url: '/monitor/job/' + jobId, + url: '/infra/job/get?id=' + jobId, method: 'get' }) } @@ -20,7 +20,7 @@ export function getJob(jobId) { // 新增定时任务调度 export function addJob(data) { return request({ - url: '/monitor/job', + url: '/infra/job/create', method: 'post', data: data }) @@ -29,7 +29,7 @@ export function addJob(data) { // 修改定时任务调度 export function updateJob(data) { return request({ - url: '/monitor/job', + url: '/infra/job/update', method: 'put', data: data }) @@ -38,7 +38,7 @@ export function updateJob(data) { // 删除定时任务调度 export function delJob(jobId) { return request({ - url: '/monitor/job/' + jobId, + url: '/infra/job/delete?id=' + jobId, method: 'delete' }) } @@ -46,7 +46,7 @@ export function delJob(jobId) { // 导出定时任务调度 export function exportJob(query) { return request({ - url: '/monitor/job/export', + url: '/infra/job/export', method: 'get', params: query }) @@ -77,4 +77,4 @@ export function runJob(jobId, jobGroup) { method: 'put', data: data }) -} \ No newline at end of file +} diff --git a/ruoyi-ui/src/layout/components/Sidebar/Logo.vue b/ruoyi-ui/src/layout/components/Sidebar/Logo.vue index afe5fcdc2..67e69e6e8 100644 --- a/ruoyi-ui/src/layout/components/Sidebar/Logo.vue +++ b/ruoyi-ui/src/layout/components/Sidebar/Logo.vue @@ -35,7 +35,7 @@ export default { }, data() { return { - title: '若依管理系统', + title: '芋道管理系统', logo: logoImg } } diff --git a/ruoyi-ui/src/settings.js b/ruoyi-ui/src/settings.js index 8eb92945d..9e76ba6a9 100644 --- a/ruoyi-ui/src/settings.js +++ b/ruoyi-ui/src/settings.js @@ -1,5 +1,5 @@ module.exports = { - title: '若依管理系统', + title: '芋道管理系统', /** * 侧边栏主题 深色主题theme-dark,浅色主题theme-light diff --git a/ruoyi-ui/src/utils/dict.js b/ruoyi-ui/src/utils/dict.js index ed71a09b3..057494fb4 100644 --- a/ruoyi-ui/src/utils/dict.js +++ b/ruoyi-ui/src/utils/dict.js @@ -17,6 +17,7 @@ export const DICT_TYPE = { SYS_CONFIG_TYPE: 'sys_config_type', INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type', + INF_JOB_STATUS: 'inf_job_status', TOOL_CODEGEN_TEMPLATE_TYPE: 'tool_codegen_template_type', } diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 4a35df61f..3f20fe95c 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -39,9 +39,9 @@ -

若依后台管理框架

+

芋道后台管理框架

- 一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了若依管理系统。,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。 + 一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了芋道管理系统。,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。

当前版本: v{{ version }} @@ -127,14 +127,14 @@

微信:/ *若依/ *芋道

支付宝:/ *若依/ *芋道

@@ -460,7 +460,7 @@
    -
  1. 若依前后端分离系统正式发布
  2. +
  3. 芋道前后端分离系统正式发布
diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index 7306a0134..9ea1d54c4 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -1,7 +1,7 @@ - + diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js index c8e87d42c..a5145af4c 100644 --- a/ruoyi-ui/vue.config.js +++ b/ruoyi-ui/vue.config.js @@ -6,7 +6,7 @@ function resolve(dir) { return path.join(__dirname, dir) } -const name = defaultSettings.title || '若依管理系统' // 标题 +const name = defaultSettings.title || '芋道管理系统' // 标题 const port = process.env.port || process.env.npm_config_port || 80 // 端口 diff --git a/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/InfJobController.java b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/InfJobController.java index 2ee4e865c..ab65d8e4d 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/InfJobController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/InfJobController.java @@ -89,7 +89,7 @@ public class InfJobController { @PreAuthorize("@ss.hasPermission('infra:job:export')") @OperateLog(type = EXPORT) public void exportJobExcel(@Valid InfJobExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { + HttpServletResponse response) throws IOException { List list = jobService.getJobList(exportReqVO); // 导出 Excel List datas = InfJobConvert.INSTANCE.convertList02(list); diff --git a/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobBaseVO.java b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobBaseVO.java index 0f111fa38..103778dd3 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobBaseVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobBaseVO.java @@ -2,12 +2,8 @@ package cn.iocoder.dashboard.modules.infra.controller.job.vo.job; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; -import java.util.Date; - -import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; /** * 定时任务 Base VO,提供给添加、修改、详细的子 VO 使用 @@ -20,14 +16,6 @@ public class InfJobBaseVO { @NotNull(message = "任务名称不能为空") private String name; - @ApiModelProperty(value = "任务状态", required = true, example = "1", notes = "参见 InfJobStatusEnum 枚举") - @NotNull(message = "任务状态不能为空") - private Integer status; - - @ApiModelProperty(value = "处理器的名字", required = true, example = "sysUserSessionTimeoutJob") - @NotNull(message = "处理器的名字不能为空") - private String handlerName; - @ApiModelProperty(value = "处理器的参数", example = "yudao") private String handlerParam; @@ -35,22 +23,6 @@ public class InfJobBaseVO { @NotNull(message = "CRON 表达式不能为空") private String cronExpression; - @ApiModelProperty(value = "最后一次执行的开始时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date executeBeginTime; - - @ApiModelProperty(value = "最后一次执行的结束时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date executeEndTime; - - @ApiModelProperty(value = "上一次触发时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date firePrevTime; - - @ApiModelProperty(value = "下一次触发时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date fireNextTime; - @ApiModelProperty(value = "监控超时时间", example = "1000") private Integer monitorTimeout; diff --git a/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobCreateReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobCreateReqVO.java index a4c331d03..a8ba55d8e 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobCreateReqVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobCreateReqVO.java @@ -1,14 +1,21 @@ package cn.iocoder.dashboard.modules.infra.controller.job.vo.job; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; +import javax.validation.constraints.NotNull; + @ApiModel("定时任务创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class InfJobCreateReqVO extends InfJobBaseVO { + @ApiModelProperty(value = "处理器的名字", required = true, example = "sysUserSessionTimeoutJob") + @NotNull(message = "处理器的名字不能为空") + private String handlerName; + } diff --git a/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobRespVO.java b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobRespVO.java index 543e4c187..95d52b1eb 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobRespVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobRespVO.java @@ -6,6 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; +import javax.validation.constraints.NotNull; import java.util.Date; @ApiModel("定时任务 Response VO") @@ -17,6 +18,25 @@ public class InfJobRespVO extends InfJobBaseVO { @ApiModelProperty(value = "任务编号", required = true, example = "1024") private Long id; + @ApiModelProperty(value = "任务状态", required = true, example = "1") + private Integer status; + + @ApiModelProperty(value = "处理器的名字", required = true, example = "sysUserSessionTimeoutJob") + @NotNull(message = "处理器的名字不能为空") + private String handlerName; + + @ApiModelProperty(value = "最后一次执行的开始时间") + private Date executeBeginTime; + + @ApiModelProperty(value = "最后一次执行的结束时间") + private Date executeEndTime; + + @ApiModelProperty(value = "上一次触发时间") + private Date firePrevTime; + + @ApiModelProperty(value = "下一次触发时间") + private Date fireNextTime; + @ApiModelProperty(value = "创建时间", required = true) private Date createTime; diff --git a/src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/job/InfJobDO.java b/src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/job/InfJobDO.java index d5884df6e..0aa343f7e 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/job/InfJobDO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/job/InfJobDO.java @@ -80,10 +80,10 @@ public class InfJobDO extends BaseDO { // ========== 监控相关字段 ========== /** * 监控超时时间,单位:毫秒 + * 为空时,表示不监控 * * 注意,这里的超时的目的,不是进行任务的取消,而是告警任务的执行时间过长 */ - @TableField(updateStrategy = FieldStrategy.IGNORED) private Integer monitorTimeout; // TODO misfirePolicy diff --git a/src/main/java/cn/iocoder/dashboard/modules/infra/service/job/impl/InfJobServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/infra/service/job/impl/InfJobServiceImpl.java index 59e3237f6..920c76d75 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/infra/service/job/impl/InfJobServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/service/job/impl/InfJobServiceImpl.java @@ -35,6 +35,9 @@ public class InfJobServiceImpl implements InfJobService { public Long createJob(InfJobCreateReqVO createReqVO) { // 插入 InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); + if (job.getMonitorTimeout() == null) { + job.setMonitorTimeout(0); + } jobMapper.insert(job); // 返回 return job.getId(); @@ -46,6 +49,9 @@ public class InfJobServiceImpl implements InfJobService { this.validateJobExists(updateReqVO.getId()); // 更新 InfJobDO updateObj = InfJobConvert.INSTANCE.convert(updateReqVO); + if (updateObj.getMonitorTimeout() == null) { + updateObj.setMonitorTimeout(0); + } jobMapper.updateById(updateObj); } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/job/auth/SysUserSessionTimeoutJob.java b/src/main/java/cn/iocoder/dashboard/modules/system/job/auth/SysUserSessionTimeoutJob.java index 1231be16e..176a6d327 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/job/auth/SysUserSessionTimeoutJob.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/job/auth/SysUserSessionTimeoutJob.java @@ -5,6 +5,11 @@ import cn.iocoder.dashboard.framework.quartz.core.handler.JobHandler; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +/** + * 用户 Session 超时 Job + * + * @author 芋道源码 + */ @Component @Slf4j public class SysUserSessionTimeoutJob implements JobHandler { diff --git a/src/main/resources/codegen/java/controller/vo/baseVO.vm b/src/main/resources/codegen/java/controller/vo/baseVO.vm index bc22b3c94..8e8586550 100644 --- a/src/main/resources/codegen/java/controller/vo/baseVO.vm +++ b/src/main/resources/codegen/java/controller/vo/baseVO.vm @@ -6,7 +6,7 @@ import io.swagger.annotations.*; import javax.validation.constraints.*; ## 处理 Date 字段的引入 #foreach ($column in $columns) -#if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult})##通用操作 +#if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult} && ${column.javaType} == "Date")## 时间类型 import org.springframework.format.annotation.DateTimeFormat; diff --git a/src/main/resources/codegen/vue/views/index.vue.vm b/src/main/resources/codegen/vue/views/index.vue.vm index 78a765b6e..490ed3c4d 100644 --- a/src/main/resources/codegen/vue/views/index.vue.vm +++ b/src/main/resources/codegen/vue/views/index.vue.vm @@ -218,11 +218,13 @@ export default { // 是否显示弹出层 open: false, #foreach ($column in $columns)## 时间范围 + #if ($column.listOperation) #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) dateRange${AttrName}: [], #end #end + #end // 查询参数 queryParams: { pageNo: 1, @@ -256,11 +258,13 @@ export default { // 处理查询参数 let params = {...this.queryParams}; #foreach ($column in $columns) + #if ($column.listOperation) #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}'); #end #end + #end // 执行查询 get${simpleClassName}Page(params).then(response => { this.list = response.data.list; @@ -277,12 +281,14 @@ export default { reset() { this.form = { #foreach ($column in $columns) - #if($column.htmlType == "checkbox") + #if ($column.createOperation || $column.updateOperation) + #if ($column.htmlType == "checkbox") $column.javaField: [], #else $column.javaField: undefined, #end #end + #end }; this.resetForm("form"); }, @@ -294,11 +300,13 @@ export default { /** 重置按钮操作 */ resetQuery() { #foreach ($column in $columns) + #if ($column.listOperation) #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) this.dateRange${AttrName} = []; #end #end + #end this.resetForm("queryForm"); this.handleQuery(); }, @@ -372,11 +380,13 @@ export default { params.pageNo = undefined; params.pageSize = undefined; #foreach ($column in $columns) + #if ($column.listOperation) #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}'); #end #end + #end // 执行导出 this.$confirm('是否确认导出所有${table.classComment}数据项?', "警告", { confirmButtonText: "确定",