Commit bc1504d9917665b64f003a588de603b20478b026
1 parent
efbd8cad
1. 完成 Job 的新增和修改
2. 优化代码生成器的模板
Showing
23 changed files
with
169 additions
and
326 deletions
ruoyi-ui/.env.development
ruoyi-ui/.env.production
ruoyi-ui/.env.staging
ruoyi-ui/package.json
| 1 | { | 1 | { |
| 2 | "name": "ruoyi", | 2 | "name": "ruoyi", |
| 3 | "version": "3.3.0", | 3 | "version": "3.3.0", |
| 4 | - "description": "若依管理系统", | ||
| 5 | - "author": "若依", | 4 | + "description": "芋道管理系统", |
| 5 | + "author": "芋道", | ||
| 6 | "license": "MIT", | 6 | "license": "MIT", |
| 7 | "scripts": { | 7 | "scripts": { |
| 8 | "dev": "vue-cli-service serve", | 8 | "dev": "vue-cli-service serve", |
ruoyi-ui/src/api/monitor/job.js
| @@ -3,7 +3,7 @@ import request from '@/utils/request' | @@ -3,7 +3,7 @@ import request from '@/utils/request' | ||
| 3 | // 查询定时任务调度列表 | 3 | // 查询定时任务调度列表 |
| 4 | export function listJob(query) { | 4 | export function listJob(query) { |
| 5 | return request({ | 5 | return request({ |
| 6 | - url: '/monitor/job/list', | 6 | + url: '/infra/job/page', |
| 7 | method: 'get', | 7 | method: 'get', |
| 8 | params: query | 8 | params: query |
| 9 | }) | 9 | }) |
| @@ -12,7 +12,7 @@ export function listJob(query) { | @@ -12,7 +12,7 @@ export function listJob(query) { | ||
| 12 | // 查询定时任务调度详细 | 12 | // 查询定时任务调度详细 |
| 13 | export function getJob(jobId) { | 13 | export function getJob(jobId) { |
| 14 | return request({ | 14 | return request({ |
| 15 | - url: '/monitor/job/' + jobId, | 15 | + url: '/infra/job/get?id=' + jobId, |
| 16 | method: 'get' | 16 | method: 'get' |
| 17 | }) | 17 | }) |
| 18 | } | 18 | } |
| @@ -20,7 +20,7 @@ export function getJob(jobId) { | @@ -20,7 +20,7 @@ export function getJob(jobId) { | ||
| 20 | // 新增定时任务调度 | 20 | // 新增定时任务调度 |
| 21 | export function addJob(data) { | 21 | export function addJob(data) { |
| 22 | return request({ | 22 | return request({ |
| 23 | - url: '/monitor/job', | 23 | + url: '/infra/job/create', |
| 24 | method: 'post', | 24 | method: 'post', |
| 25 | data: data | 25 | data: data |
| 26 | }) | 26 | }) |
| @@ -29,7 +29,7 @@ export function addJob(data) { | @@ -29,7 +29,7 @@ export function addJob(data) { | ||
| 29 | // 修改定时任务调度 | 29 | // 修改定时任务调度 |
| 30 | export function updateJob(data) { | 30 | export function updateJob(data) { |
| 31 | return request({ | 31 | return request({ |
| 32 | - url: '/monitor/job', | 32 | + url: '/infra/job/update', |
| 33 | method: 'put', | 33 | method: 'put', |
| 34 | data: data | 34 | data: data |
| 35 | }) | 35 | }) |
| @@ -38,7 +38,7 @@ export function updateJob(data) { | @@ -38,7 +38,7 @@ export function updateJob(data) { | ||
| 38 | // 删除定时任务调度 | 38 | // 删除定时任务调度 |
| 39 | export function delJob(jobId) { | 39 | export function delJob(jobId) { |
| 40 | return request({ | 40 | return request({ |
| 41 | - url: '/monitor/job/' + jobId, | 41 | + url: '/infra/job/delete?id=' + jobId, |
| 42 | method: 'delete' | 42 | method: 'delete' |
| 43 | }) | 43 | }) |
| 44 | } | 44 | } |
| @@ -46,7 +46,7 @@ export function delJob(jobId) { | @@ -46,7 +46,7 @@ export function delJob(jobId) { | ||
| 46 | // 导出定时任务调度 | 46 | // 导出定时任务调度 |
| 47 | export function exportJob(query) { | 47 | export function exportJob(query) { |
| 48 | return request({ | 48 | return request({ |
| 49 | - url: '/monitor/job/export', | 49 | + url: '/infra/job/export', |
| 50 | method: 'get', | 50 | method: 'get', |
| 51 | params: query | 51 | params: query |
| 52 | }) | 52 | }) |
| @@ -77,4 +77,4 @@ export function runJob(jobId, jobGroup) { | @@ -77,4 +77,4 @@ export function runJob(jobId, jobGroup) { | ||
| 77 | method: 'put', | 77 | method: 'put', |
| 78 | data: data | 78 | data: data |
| 79 | }) | 79 | }) |
| 80 | -} | ||
| 81 | \ No newline at end of file | 80 | \ No newline at end of file |
| 81 | +} |
ruoyi-ui/src/layout/components/Sidebar/Logo.vue
ruoyi-ui/src/settings.js
ruoyi-ui/src/utils/dict.js
| @@ -17,6 +17,7 @@ export const DICT_TYPE = { | @@ -17,6 +17,7 @@ export const DICT_TYPE = { | ||
| 17 | SYS_CONFIG_TYPE: 'sys_config_type', | 17 | SYS_CONFIG_TYPE: 'sys_config_type', |
| 18 | 18 | ||
| 19 | INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type', | 19 | INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type', |
| 20 | + INF_JOB_STATUS: 'inf_job_status', | ||
| 20 | 21 | ||
| 21 | TOOL_CODEGEN_TEMPLATE_TYPE: 'tool_codegen_template_type', | 22 | TOOL_CODEGEN_TEMPLATE_TYPE: 'tool_codegen_template_type', |
| 22 | } | 23 | } |
ruoyi-ui/src/views/index.vue
| @@ -39,9 +39,9 @@ | @@ -39,9 +39,9 @@ | ||
| 39 | </el-row> | 39 | </el-row> |
| 40 | <el-row :gutter="20"> | 40 | <el-row :gutter="20"> |
| 41 | <el-col :sm="24" :lg="12" style="padding-left: 20px"> | 41 | <el-col :sm="24" :lg="12" style="padding-left: 20px"> |
| 42 | - <h2>若依后台管理框架</h2> | 42 | + <h2>芋道后台管理框架</h2> |
| 43 | <p> | 43 | <p> |
| 44 | - 一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了若依管理系统。,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。 | 44 | + 一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了芋道管理系统。,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。 |
| 45 | </p> | 45 | </p> |
| 46 | <p> | 46 | <p> |
| 47 | <b>当前版本:</b> <span>v{{ version }}</span> | 47 | <b>当前版本:</b> <span>v{{ version }}</span> |
| @@ -127,14 +127,14 @@ | @@ -127,14 +127,14 @@ | ||
| 127 | <p> | 127 | <p> |
| 128 | <i class="el-icon-chat-dot-round"></i> 微信:<a | 128 | <i class="el-icon-chat-dot-round"></i> 微信:<a |
| 129 | href="javascript:;" | 129 | href="javascript:;" |
| 130 | - >/ *若依</a | 130 | + >/ *芋道</a |
| 131 | > | 131 | > |
| 132 | </p> | 132 | </p> |
| 133 | <p> | 133 | <p> |
| 134 | <i class="el-icon-money"></i> 支付宝:<a | 134 | <i class="el-icon-money"></i> 支付宝:<a |
| 135 | href="javascript:;" | 135 | href="javascript:;" |
| 136 | class="支付宝信息" | 136 | class="支付宝信息" |
| 137 | - >/ *若依</a | 137 | + >/ *芋道</a |
| 138 | > | 138 | > |
| 139 | </p> | 139 | </p> |
| 140 | </div> | 140 | </div> |
| @@ -460,7 +460,7 @@ | @@ -460,7 +460,7 @@ | ||
| 460 | </el-collapse-item> | 460 | </el-collapse-item> |
| 461 | <el-collapse-item title="v1.0.0 - 2019-10-08"> | 461 | <el-collapse-item title="v1.0.0 - 2019-10-08"> |
| 462 | <ol> | 462 | <ol> |
| 463 | - <li>若依前后端分离系统正式发布</li> | 463 | + <li>芋道前后端分离系统正式发布</li> |
| 464 | </ol> | 464 | </ol> |
| 465 | </el-collapse-item> | 465 | </el-collapse-item> |
| 466 | </el-collapse> | 466 | </el-collapse> |
ruoyi-ui/src/views/login.vue
| 1 | <template> | 1 | <template> |
| 2 | <div class="login"> | 2 | <div class="login"> |
| 3 | <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"> | 3 | <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"> |
| 4 | - <h3 class="title">若依后台管理系统</h3> | 4 | + <h3 class="title">芋道后台管理系统</h3> |
| 5 | <el-form-item prop="username"> | 5 | <el-form-item prop="username"> |
| 6 | <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号"> | 6 | <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号"> |
| 7 | <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /> | 7 | <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /> |
ruoyi-ui/src/views/monitor/job/index.vue
| 1 | <template> | 1 | <template> |
| 2 | <div class="app-container"> | 2 | <div class="app-container"> |
| 3 | - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> | ||
| 4 | - <el-form-item label="任务名称" prop="jobName"> | ||
| 5 | - <el-input | ||
| 6 | - v-model="queryParams.jobName" | ||
| 7 | - placeholder="请输入任务名称" | ||
| 8 | - clearable | ||
| 9 | - size="small" | ||
| 10 | - @keyup.enter.native="handleQuery" | ||
| 11 | - /> | ||
| 12 | - </el-form-item> | ||
| 13 | - <el-form-item label="任务组名" prop="jobGroup"> | ||
| 14 | - <el-select v-model="queryParams.jobGroup" placeholder="请选择任务组名" clearable size="small"> | ||
| 15 | - <el-option | ||
| 16 | - v-for="dict in jobGroupOptions" | ||
| 17 | - :key="dict.dictValue" | ||
| 18 | - :label="dict.dictLabel" | ||
| 19 | - :value="dict.dictValue" | ||
| 20 | - /> | ||
| 21 | - </el-select> | 3 | + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px"> |
| 4 | + <el-form-item label="任务名称" prop="name"> | ||
| 5 | + <el-input v-model="queryParams.name" placeholder="请输入任务名称" clearable size="small" @keyup.enter.native="handleQuery"/> | ||
| 22 | </el-form-item> | 6 | </el-form-item> |
| 23 | <el-form-item label="任务状态" prop="status"> | 7 | <el-form-item label="任务状态" prop="status"> |
| 24 | <el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable size="small"> | 8 | <el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable size="small"> |
| 25 | - <el-option | ||
| 26 | - v-for="dict in statusOptions" | ||
| 27 | - :key="dict.dictValue" | ||
| 28 | - :label="dict.dictLabel" | ||
| 29 | - :value="dict.dictValue" | ||
| 30 | - /> | 9 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.INF_JOB_STATUS)" |
| 10 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | ||
| 31 | </el-select> | 11 | </el-select> |
| 32 | </el-form-item> | 12 | </el-form-item> |
| 13 | + <el-form-item label="处理器的名字" prop="handlerName"> | ||
| 14 | + <el-input v-model="queryParams.handlerName" placeholder="请输入处理器的名字" clearable size="small" @keyup.enter.native="handleQuery"/> | ||
| 15 | + </el-form-item> | ||
| 33 | <el-form-item> | 16 | <el-form-item> |
| 34 | <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | 17 | <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
| 35 | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | 18 | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
| @@ -38,171 +21,69 @@ | @@ -38,171 +21,69 @@ | ||
| 38 | 21 | ||
| 39 | <el-row :gutter="10" class="mb8"> | 22 | <el-row :gutter="10" class="mb8"> |
| 40 | <el-col :span="1.5"> | 23 | <el-col :span="1.5"> |
| 41 | - <el-button | ||
| 42 | - type="primary" | ||
| 43 | - icon="el-icon-plus" | ||
| 44 | - size="mini" | ||
| 45 | - @click="handleAdd" | ||
| 46 | - v-hasPermi="['monitor:job:add']" | ||
| 47 | - >新增</el-button> | ||
| 48 | - </el-col> | ||
| 49 | - <el-col :span="1.5"> | ||
| 50 | - <el-button | ||
| 51 | - type="success" | ||
| 52 | - icon="el-icon-edit" | ||
| 53 | - size="mini" | ||
| 54 | - :disabled="single" | ||
| 55 | - @click="handleUpdate" | ||
| 56 | - v-hasPermi="['monitor:job:edit']" | ||
| 57 | - >修改</el-button> | 24 | + <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" |
| 25 | + v-hasPermi="['monitor:job:add']">新增</el-button> | ||
| 58 | </el-col> | 26 | </el-col> |
| 59 | <el-col :span="1.5"> | 27 | <el-col :span="1.5"> |
| 60 | - <el-button | ||
| 61 | - type="danger" | ||
| 62 | - icon="el-icon-delete" | ||
| 63 | - size="mini" | ||
| 64 | - :disabled="multiple" | ||
| 65 | - @click="handleDelete" | ||
| 66 | - v-hasPermi="['monitor:job:remove']" | ||
| 67 | - >删除</el-button> | 28 | + <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" |
| 29 | + v-hasPermi="['monitor:job:export']">导出</el-button> | ||
| 68 | </el-col> | 30 | </el-col> |
| 69 | <el-col :span="1.5"> | 31 | <el-col :span="1.5"> |
| 70 | - <el-button | ||
| 71 | - type="warning" | ||
| 72 | - icon="el-icon-download" | ||
| 73 | - size="mini" | ||
| 74 | - @click="handleExport" | ||
| 75 | - v-hasPermi="['monitor:job:export']" | ||
| 76 | - >导出</el-button> | ||
| 77 | - </el-col> | ||
| 78 | - <el-col :span="1.5"> | ||
| 79 | - <el-button | ||
| 80 | - type="info" | ||
| 81 | - icon="el-icon-s-operation" | ||
| 82 | - size="mini" | ||
| 83 | - @click="handleJobLog" | ||
| 84 | - v-hasPermi="['monitor:job:query']" | ||
| 85 | - >日志</el-button> | 32 | + <el-button type="info" icon="el-icon-s-operation" size="mini" @click="handleJobLog" |
| 33 | + v-hasPermi="['monitor:job:query']">日志</el-button> | ||
| 86 | </el-col> | 34 | </el-col> |
| 87 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | 35 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| 88 | </el-row> | 36 | </el-row> |
| 89 | 37 | ||
| 90 | - <el-table v-loading="loading" :data="jobList" @selection-change="handleSelectionChange"> | ||
| 91 | - <el-table-column type="selection" width="55" align="center" /> | ||
| 92 | - <el-table-column label="任务编号" align="center" prop="jobId" /> | ||
| 93 | - <el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" /> | ||
| 94 | - <el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" /> | ||
| 95 | - <el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> | ||
| 96 | - <el-table-column label="cron执行表达式" align="center" prop="cronExpression" :show-overflow-tooltip="true" /> | ||
| 97 | - <el-table-column label="状态" align="center"> | 38 | + <el-table v-loading="loading" :data="jobList"> |
| 39 | + <el-table-column label="任务编号" align="center" prop="id" /> | ||
| 40 | + <el-table-column label="任务名称" align="center" prop="name" /> | ||
| 41 | + <el-table-column label="任务状态" align="center" prop="status"> | ||
| 98 | <template slot-scope="scope"> | 42 | <template slot-scope="scope"> |
| 99 | - <el-switch | ||
| 100 | - v-model="scope.row.status" | ||
| 101 | - active-value="0" | ||
| 102 | - inactive-value="1" | ||
| 103 | - @change="handleStatusChange(scope.row)" | ||
| 104 | - ></el-switch> | 43 | + <span>{{ getDictDataLabel(DICT_TYPE.INF_JOB_STATUS, scope.row.status) }}</span> |
| 105 | </template> | 44 | </template> |
| 106 | - </el-table-column> | 45 | + </el-table-column>> |
| 46 | + <el-table-column label="处理器的名字" align="center" prop="handlerName" /> | ||
| 47 | + <el-table-column label="处理器的参数" align="center" prop="handlerParam" /> | ||
| 48 | + <el-table-column label="CRON 表达式" align="center" prop="cronExpression" /> | ||
| 107 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | 49 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| 108 | <template slot-scope="scope"> | 50 | <template slot-scope="scope"> |
| 51 | + <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)" | ||
| 52 | + v-hasPermi="['monitor:job:query']">详细</el-button> | ||
| 53 | + <el-button size="mini" type="text" icon="el-icon-view" @click="handleUpdate(scope.row)" | ||
| 54 | + v-hasPermi="['monitor:job:query']">修改</el-button> | ||
| 109 | <el-button | 55 | <el-button |
| 110 | - size="mini" | ||
| 111 | - type="text" | ||
| 112 | - icon="el-icon-caret-right" | ||
| 113 | - @click="handleRun(scope.row)" | ||
| 114 | - v-hasPermi="['monitor:job:changeStatus']" | 56 | + size="mini" |
| 57 | + type="text" | ||
| 58 | + icon="el-icon-caret-right" | ||
| 59 | + @click="handleRun(scope.row)" | ||
| 60 | + v-hasPermi="['monitor:job:changeStatus']" | ||
| 115 | >执行一次</el-button> | 61 | >执行一次</el-button> |
| 116 | - <el-button | ||
| 117 | - size="mini" | ||
| 118 | - type="text" | ||
| 119 | - icon="el-icon-view" | ||
| 120 | - @click="handleView(scope.row)" | ||
| 121 | - v-hasPermi="['monitor:job:query']" | ||
| 122 | - >详细</el-button> | ||
| 123 | </template> | 62 | </template> |
| 124 | </el-table-column> | 63 | </el-table-column> |
| 125 | </el-table> | 64 | </el-table> |
| 126 | - | ||
| 127 | - <pagination | ||
| 128 | - v-show="total>0" | ||
| 129 | - :total="total" | ||
| 130 | - :page.sync="queryParams.pageNum" | ||
| 131 | - :limit.sync="queryParams.pageSize" | ||
| 132 | - @pagination="getList" | ||
| 133 | - /> | 65 | + <!-- 分页组件 --> |
| 66 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 67 | + @pagination="getList"/> | ||
| 134 | 68 | ||
| 135 | <!-- 添加或修改定时任务对话框 --> | 69 | <!-- 添加或修改定时任务对话框 --> |
| 136 | - <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> | 70 | + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| 137 | <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | 71 | <el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
| 138 | - <el-row> | ||
| 139 | - <el-col :span="12"> | ||
| 140 | - <el-form-item label="任务名称" prop="jobName"> | ||
| 141 | - <el-input v-model="form.jobName" placeholder="请输入任务名称" /> | ||
| 142 | - </el-form-item> | ||
| 143 | - </el-col> | ||
| 144 | - <el-col :span="12"> | ||
| 145 | - <el-form-item label="任务分组" prop="jobGroup"> | ||
| 146 | - <el-select v-model="form.jobGroup" placeholder="请选择"> | ||
| 147 | - <el-option | ||
| 148 | - v-for="dict in jobGroupOptions" | ||
| 149 | - :key="dict.dictValue" | ||
| 150 | - :label="dict.dictLabel" | ||
| 151 | - :value="dict.dictValue" | ||
| 152 | - ></el-option> | ||
| 153 | - </el-select> | ||
| 154 | - </el-form-item> | ||
| 155 | - </el-col> | ||
| 156 | - <el-col :span="24"> | ||
| 157 | - <el-form-item prop="invokeTarget"> | ||
| 158 | - <span slot="label"> | ||
| 159 | - 调用方法 | ||
| 160 | - <el-tooltip placement="top"> | ||
| 161 | - <div slot="content"> | ||
| 162 | - Bean调用示例:ryTask.ryParams('ry') | ||
| 163 | - <br />Class类调用示例:com.ruoyi.quartz.task.RyTask.ryParams('ry') | ||
| 164 | - <br />参数说明:支持字符串,布尔类型,长整型,浮点型,整型 | ||
| 165 | - </div> | ||
| 166 | - <i class="el-icon-question"></i> | ||
| 167 | - </el-tooltip> | ||
| 168 | - </span> | ||
| 169 | - <el-input v-model="form.invokeTarget" placeholder="请输入调用目标字符串" /> | ||
| 170 | - </el-form-item> | ||
| 171 | - </el-col> | ||
| 172 | - <el-col :span="12"> | ||
| 173 | - <el-form-item label="cron表达式" prop="cronExpression"> | ||
| 174 | - <el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式" /> | ||
| 175 | - </el-form-item> | ||
| 176 | - </el-col> | ||
| 177 | - <el-col :span="12"> | ||
| 178 | - <el-form-item label="是否并发" prop="concurrent"> | ||
| 179 | - <el-radio-group v-model="form.concurrent" size="small"> | ||
| 180 | - <el-radio-button label="0">允许</el-radio-button> | ||
| 181 | - <el-radio-button label="1">禁止</el-radio-button> | ||
| 182 | - </el-radio-group> | ||
| 183 | - </el-form-item> | ||
| 184 | - </el-col> | ||
| 185 | - <el-col :span="24"> | ||
| 186 | - <el-form-item label="错误策略" prop="misfirePolicy"> | ||
| 187 | - <el-radio-group v-model="form.misfirePolicy" size="small"> | ||
| 188 | - <el-radio-button label="1">立即执行</el-radio-button> | ||
| 189 | - <el-radio-button label="2">执行一次</el-radio-button> | ||
| 190 | - <el-radio-button label="3">放弃执行</el-radio-button> | ||
| 191 | - </el-radio-group> | ||
| 192 | - </el-form-item> | ||
| 193 | - </el-col> | ||
| 194 | - <el-col :span="24"> | ||
| 195 | - <el-form-item label="状态"> | ||
| 196 | - <el-radio-group v-model="form.status"> | ||
| 197 | - <el-radio | ||
| 198 | - v-for="dict in statusOptions" | ||
| 199 | - :key="dict.dictValue" | ||
| 200 | - :label="dict.dictValue" | ||
| 201 | - >{{dict.dictLabel}}</el-radio> | ||
| 202 | - </el-radio-group> | ||
| 203 | - </el-form-item> | ||
| 204 | - </el-col> | ||
| 205 | - </el-row> | 72 | + <el-form-item label="任务名称" prop="name"> |
| 73 | + <el-input v-model="form.name" placeholder="请输入任务名称" /> | ||
| 74 | + </el-form-item> | ||
| 75 | + <el-form-item label="处理器的名字" prop="handlerName"> | ||
| 76 | + <el-input v-model="form.handlerName" placeholder="请输入处理器的名字" v-bind:readonly="form.id !== undefined" /> | ||
| 77 | + </el-form-item> | ||
| 78 | + <el-form-item label="处理器的参数" prop="handlerParam"> | ||
| 79 | + <el-input v-model="form.handlerParam" placeholder="请输入处理器的参数" /> | ||
| 80 | + </el-form-item> | ||
| 81 | + <el-form-item label="CRON 表达式" prop="cronExpression"> | ||
| 82 | + <el-input v-model="form.cronExpression" placeholder="请输入CRON 表达式" /> | ||
| 83 | + </el-form-item> | ||
| 84 | + <el-form-item label="监控超时时间" prop="monitorTimeout"> | ||
| 85 | + <el-input v-model="form.monitorTimeout" placeholder="请输入监控超时时间,单位:毫秒" /> | ||
| 86 | + </el-form-item> | ||
| 206 | </el-form> | 87 | </el-form> |
| 207 | <div slot="footer" class="dialog-footer"> | 88 | <div slot="footer" class="dialog-footer"> |
| 208 | <el-button type="primary" @click="submitForm">确 定</el-button> | 89 | <el-button type="primary" @click="submitForm">确 定</el-button> |
| @@ -212,44 +93,20 @@ | @@ -212,44 +93,20 @@ | ||
| 212 | 93 | ||
| 213 | <!-- 任务日志详细 --> | 94 | <!-- 任务日志详细 --> |
| 214 | <el-dialog title="任务详细" :visible.sync="openView" width="700px" append-to-body> | 95 | <el-dialog title="任务详细" :visible.sync="openView" width="700px" append-to-body> |
| 215 | - <el-form ref="form" :model="form" label-width="120px" size="mini"> | 96 | + <el-form ref="form" :model="form" label-width="200px" size="mini"> |
| 216 | <el-row> | 97 | <el-row> |
| 217 | - <el-col :span="12"> | ||
| 218 | - <el-form-item label="任务编号:">{{ form.jobId }}</el-form-item> | ||
| 219 | - <el-form-item label="任务名称:">{{ form.jobName }}</el-form-item> | ||
| 220 | - </el-col> | ||
| 221 | - <el-col :span="12"> | ||
| 222 | - <el-form-item label="任务分组:">{{ jobGroupFormat(form) }}</el-form-item> | ||
| 223 | - <el-form-item label="创建时间:">{{ form.createTime }}</el-form-item> | ||
| 224 | - </el-col> | ||
| 225 | - <el-col :span="12"> | ||
| 226 | - <el-form-item label="cron表达式:">{{ form.cronExpression }}</el-form-item> | ||
| 227 | - </el-col> | ||
| 228 | - <el-col :span="12"> | ||
| 229 | - <el-form-item label="下次执行时间:">{{ parseTime(form.nextValidTime) }}</el-form-item> | ||
| 230 | - </el-col> | ||
| 231 | <el-col :span="24"> | 98 | <el-col :span="24"> |
| 232 | - <el-form-item label="调用目标方法:">{{ form.invokeTarget }}</el-form-item> | ||
| 233 | - </el-col> | ||
| 234 | - <el-col :span="12"> | ||
| 235 | - <el-form-item label="任务状态:"> | ||
| 236 | - <div v-if="form.status == 0">正常</div> | ||
| 237 | - <div v-else-if="form.status == 1">失败</div> | ||
| 238 | - </el-form-item> | ||
| 239 | - </el-col> | ||
| 240 | - <el-col :span="12"> | ||
| 241 | - <el-form-item label="是否并发:"> | ||
| 242 | - <div v-if="form.concurrent == 0">允许</div> | ||
| 243 | - <div v-else-if="form.concurrent == 1">禁止</div> | ||
| 244 | - </el-form-item> | ||
| 245 | - </el-col> | ||
| 246 | - <el-col :span="12"> | ||
| 247 | - <el-form-item label="执行策略:"> | ||
| 248 | - <div v-if="form.misfirePolicy == 0">默认策略</div> | ||
| 249 | - <div v-else-if="form.misfirePolicy == 1">立即执行</div> | ||
| 250 | - <div v-else-if="form.misfirePolicy == 2">执行一次</div> | ||
| 251 | - <div v-else-if="form.misfirePolicy == 3">放弃执行</div> | ||
| 252 | - </el-form-item> | 99 | + <el-form-item label="任务编号:">{{ form.id }}</el-form-item> |
| 100 | + <el-form-item label="任务名称:">{{ form.name }}</el-form-item> | ||
| 101 | + <el-form-item label="任务名称:">{{ getDictDataLabel(DICT_TYPE.INF_JOB_STATUS, form.status) }}</el-form-item> | ||
| 102 | + <el-form-item label="处理器的名字:">{{ form.handlerName }}</el-form-item> | ||
| 103 | + <el-form-item label="处理器的参数:">{{ form.handlerParam }}</el-form-item> | ||
| 104 | + <el-form-item label="cron表达式:">{{ form.cronExpression }}</el-form-item> | ||
| 105 | + <el-form-item label="最后一次执行的开始时间:">{{ parseTime(form.executeBeginTime) }}</el-form-item> | ||
| 106 | + <el-form-item label="最后一次执行的开始时间:">{{ parseTime(form.executeEndTime) }}</el-form-item> | ||
| 107 | + <el-form-item label="上一次触发时间:">{{ parseTime(form.firePrevTime) }}</el-form-item> | ||
| 108 | + <el-form-item label="下一次触发时间:">{{ parseTime(form.fireNextTime) }}</el-form-item> | ||
| 109 | + <el-form-item label="监控超时时间:">{{ form.monitorTimeout > 0 ? form.monitorTimeout + " 毫秒" : "未开启" }}</el-form-item> | ||
| 253 | </el-col> | 110 | </el-col> |
| 254 | </el-row> | 111 | </el-row> |
| 255 | </el-form> | 112 | </el-form> |
| @@ -257,6 +114,7 @@ | @@ -257,6 +114,7 @@ | ||
| 257 | <el-button @click="openView = false">关 闭</el-button> | 114 | <el-button @click="openView = false">关 闭</el-button> |
| 258 | </div> | 115 | </div> |
| 259 | </el-dialog> | 116 | </el-dialog> |
| 117 | + | ||
| 260 | </div> | 118 | </div> |
| 261 | </template> | 119 | </template> |
| 262 | 120 | ||
| @@ -269,12 +127,6 @@ export default { | @@ -269,12 +127,6 @@ export default { | ||
| 269 | return { | 127 | return { |
| 270 | // 遮罩层 | 128 | // 遮罩层 |
| 271 | loading: true, | 129 | loading: true, |
| 272 | - // 选中数组 | ||
| 273 | - ids: [], | ||
| 274 | - // 非单个禁用 | ||
| 275 | - single: true, | ||
| 276 | - // 非多个禁用 | ||
| 277 | - multiple: true, | ||
| 278 | // 显示搜索条件 | 130 | // 显示搜索条件 |
| 279 | showSearch: true, | 131 | showSearch: true, |
| 280 | // 总条数 | 132 | // 总条数 |
| @@ -287,83 +139,59 @@ export default { | @@ -287,83 +139,59 @@ export default { | ||
| 287 | open: false, | 139 | open: false, |
| 288 | // 是否显示详细弹出层 | 140 | // 是否显示详细弹出层 |
| 289 | openView: false, | 141 | openView: false, |
| 290 | - // 任务组名字典 | ||
| 291 | - jobGroupOptions: [], | ||
| 292 | // 状态字典 | 142 | // 状态字典 |
| 293 | statusOptions: [], | 143 | statusOptions: [], |
| 294 | // 查询参数 | 144 | // 查询参数 |
| 295 | queryParams: { | 145 | queryParams: { |
| 296 | - pageNum: 1, | 146 | + pageNo: 1, |
| 297 | pageSize: 10, | 147 | pageSize: 10, |
| 298 | - jobName: undefined, | ||
| 299 | - jobGroup: undefined, | ||
| 300 | - status: undefined | 148 | + name: undefined, |
| 149 | + status: undefined, | ||
| 150 | + handlerName: undefined | ||
| 301 | }, | 151 | }, |
| 302 | // 表单参数 | 152 | // 表单参数 |
| 303 | form: {}, | 153 | form: {}, |
| 304 | // 表单校验 | 154 | // 表单校验 |
| 305 | rules: { | 155 | rules: { |
| 306 | - jobName: [ | ||
| 307 | - { required: true, message: "任务名称不能为空", trigger: "blur" } | ||
| 308 | - ], | ||
| 309 | - invokeTarget: [ | ||
| 310 | - { required: true, message: "调用目标字符串不能为空", trigger: "blur" } | ||
| 311 | - ], | ||
| 312 | - cronExpression: [ | ||
| 313 | - { required: true, message: "cron执行表达式不能为空", trigger: "blur" } | ||
| 314 | - ] | 156 | + name: [{ required: true, message: "任务名称不能为空", trigger: "blur" }], |
| 157 | + handlerName: [{ required: true, message: "处理器的名字不能为空", trigger: "blur" }], | ||
| 158 | + cronExpression: [{ required: true, message: "CRON 表达式不能为空", trigger: "blur" }], | ||
| 315 | } | 159 | } |
| 316 | }; | 160 | }; |
| 317 | }, | 161 | }, |
| 318 | created() { | 162 | created() { |
| 319 | this.getList(); | 163 | this.getList(); |
| 320 | - this.getDicts("sys_job_group").then(response => { | ||
| 321 | - this.jobGroupOptions = response.data; | ||
| 322 | - }); | ||
| 323 | - this.getDicts("sys_job_status").then(response => { | ||
| 324 | - this.statusOptions = response.data; | ||
| 325 | - }); | ||
| 326 | }, | 164 | }, |
| 327 | methods: { | 165 | methods: { |
| 328 | /** 查询定时任务列表 */ | 166 | /** 查询定时任务列表 */ |
| 329 | getList() { | 167 | getList() { |
| 330 | this.loading = true; | 168 | this.loading = true; |
| 331 | listJob(this.queryParams).then(response => { | 169 | listJob(this.queryParams).then(response => { |
| 332 | - this.jobList = response.rows; | ||
| 333 | - this.total = response.total; | 170 | + this.jobList = response.data.list; |
| 171 | + this.total = response.data.total; | ||
| 334 | this.loading = false; | 172 | this.loading = false; |
| 335 | }); | 173 | }); |
| 336 | }, | 174 | }, |
| 337 | - // 任务组名字典翻译 | ||
| 338 | - jobGroupFormat(row, column) { | ||
| 339 | - return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); | ||
| 340 | - }, | ||
| 341 | - // 状态字典翻译 | ||
| 342 | - statusFormat(row, column) { | ||
| 343 | - return this.selectDictLabel(this.statusOptions, row.status); | ||
| 344 | - }, | ||
| 345 | - // 取消按钮 | 175 | + /** 取消按钮 */ |
| 346 | cancel() { | 176 | cancel() { |
| 347 | this.open = false; | 177 | this.open = false; |
| 348 | this.reset(); | 178 | this.reset(); |
| 349 | }, | 179 | }, |
| 350 | - // 表单重置 | 180 | + /** 表单重置 */ |
| 351 | reset() { | 181 | reset() { |
| 352 | this.form = { | 182 | this.form = { |
| 353 | - jobId: undefined, | ||
| 354 | - jobName: undefined, | ||
| 355 | - jobGroup: undefined, | ||
| 356 | - invokeTarget: undefined, | 183 | + id: undefined, |
| 184 | + name: undefined, | ||
| 185 | + handlerName: undefined, | ||
| 186 | + handlerParam: undefined, | ||
| 357 | cronExpression: undefined, | 187 | cronExpression: undefined, |
| 358 | - misfirePolicy: 1, | ||
| 359 | - concurrent: 1, | ||
| 360 | - status: "0" | 188 | + monitorTimeout: undefined, |
| 361 | }; | 189 | }; |
| 362 | this.resetForm("form"); | 190 | this.resetForm("form"); |
| 363 | }, | 191 | }, |
| 364 | /** 搜索按钮操作 */ | 192 | /** 搜索按钮操作 */ |
| 365 | handleQuery() { | 193 | handleQuery() { |
| 366 | - this.queryParams.pageNum = 1; | 194 | + this.queryParams.pageNo = 1; |
| 367 | this.getList(); | 195 | this.getList(); |
| 368 | }, | 196 | }, |
| 369 | /** 重置按钮操作 */ | 197 | /** 重置按钮操作 */ |
| @@ -371,21 +199,15 @@ export default { | @@ -371,21 +199,15 @@ export default { | ||
| 371 | this.resetForm("queryForm"); | 199 | this.resetForm("queryForm"); |
| 372 | this.handleQuery(); | 200 | this.handleQuery(); |
| 373 | }, | 201 | }, |
| 374 | - // 多选框选中数据 | ||
| 375 | - handleSelectionChange(selection) { | ||
| 376 | - this.ids = selection.map(item => item.jobId); | ||
| 377 | - this.single = selection.length != 1; | ||
| 378 | - this.multiple = !selection.length; | ||
| 379 | - }, | ||
| 380 | // 任务状态修改 | 202 | // 任务状态修改 |
| 381 | handleStatusChange(row) { | 203 | handleStatusChange(row) { |
| 382 | let text = row.status === "0" ? "启用" : "停用"; | 204 | let text = row.status === "0" ? "启用" : "停用"; |
| 383 | - this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', "警告", { | 205 | + this.$confirm('确认要"' + text + '""' + row.name + '"任务吗?', "警告", { |
| 384 | confirmButtonText: "确定", | 206 | confirmButtonText: "确定", |
| 385 | cancelButtonText: "取消", | 207 | cancelButtonText: "取消", |
| 386 | type: "warning" | 208 | type: "warning" |
| 387 | }).then(function() { | 209 | }).then(function() { |
| 388 | - return changeJobStatus(row.jobId, row.status); | 210 | + return changeJobStatus(row.id, row.status); |
| 389 | }).then(() => { | 211 | }).then(() => { |
| 390 | this.msgSuccess(text + "成功"); | 212 | this.msgSuccess(text + "成功"); |
| 391 | }).catch(function() { | 213 | }).catch(function() { |
| @@ -394,19 +216,19 @@ export default { | @@ -394,19 +216,19 @@ export default { | ||
| 394 | }, | 216 | }, |
| 395 | /* 立即执行一次 */ | 217 | /* 立即执行一次 */ |
| 396 | handleRun(row) { | 218 | handleRun(row) { |
| 397 | - this.$confirm('确认要立即执行一次"' + row.jobName + '"任务吗?', "警告", { | 219 | + this.$confirm('确认要立即执行一次"' + row.name + '"任务吗?', "警告", { |
| 398 | confirmButtonText: "确定", | 220 | confirmButtonText: "确定", |
| 399 | cancelButtonText: "取消", | 221 | cancelButtonText: "取消", |
| 400 | type: "warning" | 222 | type: "warning" |
| 401 | }).then(function() { | 223 | }).then(function() { |
| 402 | - return runJob(row.jobId, row.jobGroup); | 224 | + return runJob(row.id, row.jobGroup); |
| 403 | }).then(() => { | 225 | }).then(() => { |
| 404 | this.msgSuccess("执行成功"); | 226 | this.msgSuccess("执行成功"); |
| 405 | }) | 227 | }) |
| 406 | }, | 228 | }, |
| 407 | /** 任务详细信息 */ | 229 | /** 任务详细信息 */ |
| 408 | handleView(row) { | 230 | handleView(row) { |
| 409 | - getJob(row.jobId).then(response => { | 231 | + getJob(row.id).then(response => { |
| 410 | this.form = response.data; | 232 | this.form = response.data; |
| 411 | this.openView = true; | 233 | this.openView = true; |
| 412 | }); | 234 | }); |
| @@ -424,8 +246,8 @@ export default { | @@ -424,8 +246,8 @@ export default { | ||
| 424 | /** 修改按钮操作 */ | 246 | /** 修改按钮操作 */ |
| 425 | handleUpdate(row) { | 247 | handleUpdate(row) { |
| 426 | this.reset(); | 248 | this.reset(); |
| 427 | - const jobId = row.jobId || this.ids; | ||
| 428 | - getJob(jobId).then(response => { | 249 | + const id = row.id; |
| 250 | + getJob(id).then(response => { | ||
| 429 | this.form = response.data; | 251 | this.form = response.data; |
| 430 | this.open = true; | 252 | this.open = true; |
| 431 | this.title = "修改任务"; | 253 | this.title = "修改任务"; |
| @@ -435,7 +257,7 @@ export default { | @@ -435,7 +257,7 @@ export default { | ||
| 435 | submitForm: function() { | 257 | submitForm: function() { |
| 436 | this.$refs["form"].validate(valid => { | 258 | this.$refs["form"].validate(valid => { |
| 437 | if (valid) { | 259 | if (valid) { |
| 438 | - if (this.form.jobId != undefined) { | 260 | + if (this.form.id !== undefined) { |
| 439 | updateJob(this.form).then(response => { | 261 | updateJob(this.form).then(response => { |
| 440 | this.msgSuccess("修改成功"); | 262 | this.msgSuccess("修改成功"); |
| 441 | this.open = false; | 263 | this.open = false; |
| @@ -453,13 +275,13 @@ export default { | @@ -453,13 +275,13 @@ export default { | ||
| 453 | }, | 275 | }, |
| 454 | /** 删除按钮操作 */ | 276 | /** 删除按钮操作 */ |
| 455 | handleDelete(row) { | 277 | handleDelete(row) { |
| 456 | - const jobIds = row.jobId || this.ids; | ||
| 457 | - this.$confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?', "警告", { | 278 | + const ids = row.id || this.ids; |
| 279 | + this.$confirm('是否确认删除定时任务编号为"' + ids + '"的数据项?', "警告", { | ||
| 458 | confirmButtonText: "确定", | 280 | confirmButtonText: "确定", |
| 459 | cancelButtonText: "取消", | 281 | cancelButtonText: "取消", |
| 460 | type: "warning" | 282 | type: "warning" |
| 461 | }).then(function() { | 283 | }).then(function() { |
| 462 | - return delJob(jobIds); | 284 | + return delJob(ids); |
| 463 | }).then(() => { | 285 | }).then(() => { |
| 464 | this.getList(); | 286 | this.getList(); |
| 465 | this.msgSuccess("删除成功"); | 287 | this.msgSuccess("删除成功"); |
| @@ -480,4 +302,4 @@ export default { | @@ -480,4 +302,4 @@ export default { | ||
| 480 | } | 302 | } |
| 481 | } | 303 | } |
| 482 | }; | 304 | }; |
| 483 | -</script> | ||
| 484 | \ No newline at end of file | 305 | \ No newline at end of file |
| 306 | +</script> |
ruoyi-ui/src/views/tool/codegen/editTable.vue
| @@ -212,7 +212,7 @@ export default { | @@ -212,7 +212,7 @@ export default { | ||
| 212 | /** 关闭按钮 */ | 212 | /** 关闭按钮 */ |
| 213 | close() { | 213 | close() { |
| 214 | this.$store.dispatch("tagsView/delView", this.$route); | 214 | this.$store.dispatch("tagsView/delView", this.$route); |
| 215 | - this.$router.push({ path: "/tool/gen", query: { t: Date.now()}}) | 215 | + this.$router.push({ path: "/tool/codegen", query: { t: Date.now()}}) |
| 216 | } | 216 | } |
| 217 | }, | 217 | }, |
| 218 | mounted() { | 218 | mounted() { |
ruoyi-ui/src/views/tool/codegen/index.vue
| @@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
| 59 | <span>{{ parseTime(scope.row.createTime) }}</span> | 59 | <span>{{ parseTime(scope.row.createTime) }}</span> |
| 60 | </template> | 60 | </template> |
| 61 | </el-table-column> | 61 | </el-table-column> |
| 62 | - <el-table-column label="创建时间" align="center" prop="createTime" width="160"> | 62 | + <el-table-column label="更新时间" align="center" prop="createTime" width="160"> |
| 63 | <template slot-scope="scope"> | 63 | <template slot-scope="scope"> |
| 64 | <span>{{ parseTime(scope.row.updateTime) }}</span> | 64 | <span>{{ parseTime(scope.row.updateTime) }}</span> |
| 65 | </template> | 65 | </template> |
ruoyi-ui/vue.config.js
| @@ -6,7 +6,7 @@ function resolve(dir) { | @@ -6,7 +6,7 @@ function resolve(dir) { | ||
| 6 | return path.join(__dirname, dir) | 6 | return path.join(__dirname, dir) |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | -const name = defaultSettings.title || '若依管理系统' // 标题 | 9 | +const name = defaultSettings.title || '芋道管理系统' // 标题 |
| 10 | 10 | ||
| 11 | const port = process.env.port || process.env.npm_config_port || 80 // 端口 | 11 | const port = process.env.port || process.env.npm_config_port || 80 // 端口 |
| 12 | 12 |
src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/InfJobController.java
| @@ -89,7 +89,7 @@ public class InfJobController { | @@ -89,7 +89,7 @@ public class InfJobController { | ||
| 89 | @PreAuthorize("@ss.hasPermission('infra:job:export')") | 89 | @PreAuthorize("@ss.hasPermission('infra:job:export')") |
| 90 | @OperateLog(type = EXPORT) | 90 | @OperateLog(type = EXPORT) |
| 91 | public void exportJobExcel(@Valid InfJobExportReqVO exportReqVO, | 91 | public void exportJobExcel(@Valid InfJobExportReqVO exportReqVO, |
| 92 | - HttpServletResponse response) throws IOException { | 92 | + HttpServletResponse response) throws IOException { |
| 93 | List<InfJobDO> list = jobService.getJobList(exportReqVO); | 93 | List<InfJobDO> list = jobService.getJobList(exportReqVO); |
| 94 | // 导出 Excel | 94 | // 导出 Excel |
| 95 | List<InfJobExcelVO> datas = InfJobConvert.INSTANCE.convertList02(list); | 95 | List<InfJobExcelVO> datas = InfJobConvert.INSTANCE.convertList02(list); |
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; | @@ -2,12 +2,8 @@ package cn.iocoder.dashboard.modules.infra.controller.job.vo.job; | ||
| 2 | 2 | ||
| 3 | import io.swagger.annotations.ApiModelProperty; | 3 | import io.swagger.annotations.ApiModelProperty; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | -import org.springframework.format.annotation.DateTimeFormat; | ||
| 6 | 5 | ||
| 7 | import javax.validation.constraints.NotNull; | 6 | import javax.validation.constraints.NotNull; |
| 8 | -import java.util.Date; | ||
| 9 | - | ||
| 10 | -import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 11 | 7 | ||
| 12 | /** | 8 | /** |
| 13 | * 定时任务 Base VO,提供给添加、修改、详细的子 VO 使用 | 9 | * 定时任务 Base VO,提供给添加、修改、详细的子 VO 使用 |
| @@ -20,14 +16,6 @@ public class InfJobBaseVO { | @@ -20,14 +16,6 @@ public class InfJobBaseVO { | ||
| 20 | @NotNull(message = "任务名称不能为空") | 16 | @NotNull(message = "任务名称不能为空") |
| 21 | private String name; | 17 | private String name; |
| 22 | 18 | ||
| 23 | - @ApiModelProperty(value = "任务状态", required = true, example = "1", notes = "参见 InfJobStatusEnum 枚举") | ||
| 24 | - @NotNull(message = "任务状态不能为空") | ||
| 25 | - private Integer status; | ||
| 26 | - | ||
| 27 | - @ApiModelProperty(value = "处理器的名字", required = true, example = "sysUserSessionTimeoutJob") | ||
| 28 | - @NotNull(message = "处理器的名字不能为空") | ||
| 29 | - private String handlerName; | ||
| 30 | - | ||
| 31 | @ApiModelProperty(value = "处理器的参数", example = "yudao") | 19 | @ApiModelProperty(value = "处理器的参数", example = "yudao") |
| 32 | private String handlerParam; | 20 | private String handlerParam; |
| 33 | 21 | ||
| @@ -35,22 +23,6 @@ public class InfJobBaseVO { | @@ -35,22 +23,6 @@ public class InfJobBaseVO { | ||
| 35 | @NotNull(message = "CRON 表达式不能为空") | 23 | @NotNull(message = "CRON 表达式不能为空") |
| 36 | private String cronExpression; | 24 | private String cronExpression; |
| 37 | 25 | ||
| 38 | - @ApiModelProperty(value = "最后一次执行的开始时间") | ||
| 39 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 40 | - private Date executeBeginTime; | ||
| 41 | - | ||
| 42 | - @ApiModelProperty(value = "最后一次执行的结束时间") | ||
| 43 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 44 | - private Date executeEndTime; | ||
| 45 | - | ||
| 46 | - @ApiModelProperty(value = "上一次触发时间") | ||
| 47 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 48 | - private Date firePrevTime; | ||
| 49 | - | ||
| 50 | - @ApiModelProperty(value = "下一次触发时间") | ||
| 51 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 52 | - private Date fireNextTime; | ||
| 53 | - | ||
| 54 | @ApiModelProperty(value = "监控超时时间", example = "1000") | 26 | @ApiModelProperty(value = "监控超时时间", example = "1000") |
| 55 | private Integer monitorTimeout; | 27 | private Integer monitorTimeout; |
| 56 | 28 |
src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobCreateReqVO.java
| 1 | package cn.iocoder.dashboard.modules.infra.controller.job.vo.job; | 1 | package cn.iocoder.dashboard.modules.infra.controller.job.vo.job; |
| 2 | 2 | ||
| 3 | import io.swagger.annotations.ApiModel; | 3 | import io.swagger.annotations.ApiModel; |
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 4 | import lombok.Data; | 5 | import lombok.Data; |
| 5 | import lombok.EqualsAndHashCode; | 6 | import lombok.EqualsAndHashCode; |
| 6 | import lombok.ToString; | 7 | import lombok.ToString; |
| 7 | 8 | ||
| 9 | +import javax.validation.constraints.NotNull; | ||
| 10 | + | ||
| 8 | @ApiModel("定时任务创建 Request VO") | 11 | @ApiModel("定时任务创建 Request VO") |
| 9 | @Data | 12 | @Data |
| 10 | @EqualsAndHashCode(callSuper = true) | 13 | @EqualsAndHashCode(callSuper = true) |
| 11 | @ToString(callSuper = true) | 14 | @ToString(callSuper = true) |
| 12 | public class InfJobCreateReqVO extends InfJobBaseVO { | 15 | public class InfJobCreateReqVO extends InfJobBaseVO { |
| 13 | 16 | ||
| 17 | + @ApiModelProperty(value = "处理器的名字", required = true, example = "sysUserSessionTimeoutJob") | ||
| 18 | + @NotNull(message = "处理器的名字不能为空") | ||
| 19 | + private String handlerName; | ||
| 20 | + | ||
| 14 | } | 21 | } |
src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobRespVO.java
| @@ -6,6 +6,7 @@ import lombok.Data; | @@ -6,6 +6,7 @@ import lombok.Data; | ||
| 6 | import lombok.EqualsAndHashCode; | 6 | import lombok.EqualsAndHashCode; |
| 7 | import lombok.ToString; | 7 | import lombok.ToString; |
| 8 | 8 | ||
| 9 | +import javax.validation.constraints.NotNull; | ||
| 9 | import java.util.Date; | 10 | import java.util.Date; |
| 10 | 11 | ||
| 11 | @ApiModel("定时任务 Response VO") | 12 | @ApiModel("定时任务 Response VO") |
| @@ -17,6 +18,25 @@ public class InfJobRespVO extends InfJobBaseVO { | @@ -17,6 +18,25 @@ public class InfJobRespVO extends InfJobBaseVO { | ||
| 17 | @ApiModelProperty(value = "任务编号", required = true, example = "1024") | 18 | @ApiModelProperty(value = "任务编号", required = true, example = "1024") |
| 18 | private Long id; | 19 | private Long id; |
| 19 | 20 | ||
| 21 | + @ApiModelProperty(value = "任务状态", required = true, example = "1") | ||
| 22 | + private Integer status; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty(value = "处理器的名字", required = true, example = "sysUserSessionTimeoutJob") | ||
| 25 | + @NotNull(message = "处理器的名字不能为空") | ||
| 26 | + private String handlerName; | ||
| 27 | + | ||
| 28 | + @ApiModelProperty(value = "最后一次执行的开始时间") | ||
| 29 | + private Date executeBeginTime; | ||
| 30 | + | ||
| 31 | + @ApiModelProperty(value = "最后一次执行的结束时间") | ||
| 32 | + private Date executeEndTime; | ||
| 33 | + | ||
| 34 | + @ApiModelProperty(value = "上一次触发时间") | ||
| 35 | + private Date firePrevTime; | ||
| 36 | + | ||
| 37 | + @ApiModelProperty(value = "下一次触发时间") | ||
| 38 | + private Date fireNextTime; | ||
| 39 | + | ||
| 20 | @ApiModelProperty(value = "创建时间", required = true) | 40 | @ApiModelProperty(value = "创建时间", required = true) |
| 21 | private Date createTime; | 41 | private Date createTime; |
| 22 | 42 |
src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/job/InfJobDO.java
| @@ -80,10 +80,10 @@ public class InfJobDO extends BaseDO { | @@ -80,10 +80,10 @@ public class InfJobDO extends BaseDO { | ||
| 80 | // ========== 监控相关字段 ========== | 80 | // ========== 监控相关字段 ========== |
| 81 | /** | 81 | /** |
| 82 | * 监控超时时间,单位:毫秒 | 82 | * 监控超时时间,单位:毫秒 |
| 83 | + * 为空时,表示不监控 | ||
| 83 | * | 84 | * |
| 84 | * 注意,这里的超时的目的,不是进行任务的取消,而是告警任务的执行时间过长 | 85 | * 注意,这里的超时的目的,不是进行任务的取消,而是告警任务的执行时间过长 |
| 85 | */ | 86 | */ |
| 86 | - @TableField(updateStrategy = FieldStrategy.IGNORED) | ||
| 87 | private Integer monitorTimeout; | 87 | private Integer monitorTimeout; |
| 88 | 88 | ||
| 89 | // TODO misfirePolicy | 89 | // TODO misfirePolicy |
src/main/java/cn/iocoder/dashboard/modules/infra/service/job/impl/InfJobServiceImpl.java
| @@ -35,6 +35,9 @@ public class InfJobServiceImpl implements InfJobService { | @@ -35,6 +35,9 @@ public class InfJobServiceImpl implements InfJobService { | ||
| 35 | public Long createJob(InfJobCreateReqVO createReqVO) { | 35 | public Long createJob(InfJobCreateReqVO createReqVO) { |
| 36 | // 插入 | 36 | // 插入 |
| 37 | InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); | 37 | InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); |
| 38 | + if (job.getMonitorTimeout() == null) { | ||
| 39 | + job.setMonitorTimeout(0); | ||
| 40 | + } | ||
| 38 | jobMapper.insert(job); | 41 | jobMapper.insert(job); |
| 39 | // 返回 | 42 | // 返回 |
| 40 | return job.getId(); | 43 | return job.getId(); |
| @@ -46,6 +49,9 @@ public class InfJobServiceImpl implements InfJobService { | @@ -46,6 +49,9 @@ public class InfJobServiceImpl implements InfJobService { | ||
| 46 | this.validateJobExists(updateReqVO.getId()); | 49 | this.validateJobExists(updateReqVO.getId()); |
| 47 | // 更新 | 50 | // 更新 |
| 48 | InfJobDO updateObj = InfJobConvert.INSTANCE.convert(updateReqVO); | 51 | InfJobDO updateObj = InfJobConvert.INSTANCE.convert(updateReqVO); |
| 52 | + if (updateObj.getMonitorTimeout() == null) { | ||
| 53 | + updateObj.setMonitorTimeout(0); | ||
| 54 | + } | ||
| 49 | jobMapper.updateById(updateObj); | 55 | jobMapper.updateById(updateObj); |
| 50 | } | 56 | } |
| 51 | 57 |
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; | @@ -5,6 +5,11 @@ import cn.iocoder.dashboard.framework.quartz.core.handler.JobHandler; | ||
| 5 | import lombok.extern.slf4j.Slf4j; | 5 | import lombok.extern.slf4j.Slf4j; |
| 6 | import org.springframework.stereotype.Component; | 6 | import org.springframework.stereotype.Component; |
| 7 | 7 | ||
| 8 | +/** | ||
| 9 | + * 用户 Session 超时 Job | ||
| 10 | + * | ||
| 11 | + * @author 芋道源码 | ||
| 12 | + */ | ||
| 8 | @Component | 13 | @Component |
| 9 | @Slf4j | 14 | @Slf4j |
| 10 | public class SysUserSessionTimeoutJob implements JobHandler { | 15 | public class SysUserSessionTimeoutJob implements JobHandler { |
src/main/resources/codegen/java/controller/vo/baseVO.vm
| @@ -6,7 +6,7 @@ import io.swagger.annotations.*; | @@ -6,7 +6,7 @@ import io.swagger.annotations.*; | ||
| 6 | import javax.validation.constraints.*; | 6 | import javax.validation.constraints.*; |
| 7 | ## 处理 Date 字段的引入 | 7 | ## 处理 Date 字段的引入 |
| 8 | #foreach ($column in $columns) | 8 | #foreach ($column in $columns) |
| 9 | -#if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult})##通用操作 | 9 | +#if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult} |
| 10 | && ${column.javaType} == "Date")## 时间类型 | 10 | && ${column.javaType} == "Date")## 时间类型 |
| 11 | import org.springframework.format.annotation.DateTimeFormat; | 11 | import org.springframework.format.annotation.DateTimeFormat; |
| 12 | 12 |
src/main/resources/codegen/vue/views/index.vue.vm
| @@ -218,11 +218,13 @@ export default { | @@ -218,11 +218,13 @@ export default { | ||
| 218 | // 是否显示弹出层 | 218 | // 是否显示弹出层 |
| 219 | open: false, | 219 | open: false, |
| 220 | #foreach ($column in $columns)## 时间范围 | 220 | #foreach ($column in $columns)## 时间范围 |
| 221 | + #if ($column.listOperation) | ||
| 221 | #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") | 222 | #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") |
| 222 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | 223 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| 223 | dateRange${AttrName}: [], | 224 | dateRange${AttrName}: [], |
| 224 | #end | 225 | #end |
| 225 | #end | 226 | #end |
| 227 | + #end | ||
| 226 | // 查询参数 | 228 | // 查询参数 |
| 227 | queryParams: { | 229 | queryParams: { |
| 228 | pageNo: 1, | 230 | pageNo: 1, |
| @@ -256,11 +258,13 @@ export default { | @@ -256,11 +258,13 @@ export default { | ||
| 256 | // 处理查询参数 | 258 | // 处理查询参数 |
| 257 | let params = {...this.queryParams}; | 259 | let params = {...this.queryParams}; |
| 258 | #foreach ($column in $columns) | 260 | #foreach ($column in $columns) |
| 261 | + #if ($column.listOperation) | ||
| 259 | #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") | 262 | #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") |
| 260 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | 263 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| 261 | this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}'); | 264 | this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}'); |
| 262 | #end | 265 | #end |
| 263 | #end | 266 | #end |
| 267 | + #end | ||
| 264 | // 执行查询 | 268 | // 执行查询 |
| 265 | get${simpleClassName}Page(params).then(response => { | 269 | get${simpleClassName}Page(params).then(response => { |
| 266 | this.list = response.data.list; | 270 | this.list = response.data.list; |
| @@ -277,12 +281,14 @@ export default { | @@ -277,12 +281,14 @@ export default { | ||
| 277 | reset() { | 281 | reset() { |
| 278 | this.form = { | 282 | this.form = { |
| 279 | #foreach ($column in $columns) | 283 | #foreach ($column in $columns) |
| 280 | - #if($column.htmlType == "checkbox") | 284 | + #if ($column.createOperation || $column.updateOperation) |
| 285 | + #if ($column.htmlType == "checkbox") | ||
| 281 | $column.javaField: [], | 286 | $column.javaField: [], |
| 282 | #else | 287 | #else |
| 283 | $column.javaField: undefined, | 288 | $column.javaField: undefined, |
| 284 | #end | 289 | #end |
| 285 | #end | 290 | #end |
| 291 | + #end | ||
| 286 | }; | 292 | }; |
| 287 | this.resetForm("form"); | 293 | this.resetForm("form"); |
| 288 | }, | 294 | }, |
| @@ -294,11 +300,13 @@ export default { | @@ -294,11 +300,13 @@ export default { | ||
| 294 | /** 重置按钮操作 */ | 300 | /** 重置按钮操作 */ |
| 295 | resetQuery() { | 301 | resetQuery() { |
| 296 | #foreach ($column in $columns) | 302 | #foreach ($column in $columns) |
| 303 | + #if ($column.listOperation) | ||
| 297 | #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") | 304 | #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") |
| 298 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | 305 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| 299 | this.dateRange${AttrName} = []; | 306 | this.dateRange${AttrName} = []; |
| 300 | #end | 307 | #end |
| 301 | #end | 308 | #end |
| 309 | + #end | ||
| 302 | this.resetForm("queryForm"); | 310 | this.resetForm("queryForm"); |
| 303 | this.handleQuery(); | 311 | this.handleQuery(); |
| 304 | }, | 312 | }, |
| @@ -372,11 +380,13 @@ export default { | @@ -372,11 +380,13 @@ export default { | ||
| 372 | params.pageNo = undefined; | 380 | params.pageNo = undefined; |
| 373 | params.pageSize = undefined; | 381 | params.pageSize = undefined; |
| 374 | #foreach ($column in $columns) | 382 | #foreach ($column in $columns) |
| 383 | + #if ($column.listOperation) | ||
| 375 | #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") | 384 | #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN") |
| 376 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | 385 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| 377 | this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}'); | 386 | this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}'); |
| 378 | #end | 387 | #end |
| 379 | #end | 388 | #end |
| 389 | + #end | ||
| 380 | // 执行导出 | 390 | // 执行导出 |
| 381 | this.$confirm('是否确认导出所有${table.classComment}数据项?', "警告", { | 391 | this.$confirm('是否确认导出所有${table.classComment}数据项?', "警告", { |
| 382 | confirmButtonText: "确定", | 392 | confirmButtonText: "确定", |