Commit bc1504d9917665b64f003a588de603b20478b026

Authored by YunaiV
1 parent efbd8cad

1. 完成 Job 的新增和修改

2. 优化代码生成器的模板
ruoyi-ui/.env.development
1 1 # 开发环境配置
2 2 ENV = 'development'
3 3  
4   -# 若依管理系统/开发环境
  4 +# 芋道管理系统/开发环境
5 5 VUE_APP_BASE_API = '/dev-api'
6 6 # VUE_APP_BASE_API = '/api'
7 7  
... ...
ruoyi-ui/.env.production
1 1 # 生产环境配置
2 2 ENV = 'production'
3 3  
4   -# 若依管理系统/生产环境
  4 +# 芋道管理系统/生产环境
5 5 VUE_APP_BASE_API = '/prod-api'
... ...
ruoyi-ui/.env.staging
... ... @@ -3,5 +3,5 @@ NODE_ENV = production
3 3 # 测试环境配置
4 4 ENV = 'staging'
5 5  
6   -# 若依管理系统/测试环境
  6 +# 芋道管理系统/测试环境
7 7 VUE_APP_BASE_API = '/stage-api'
... ...
ruoyi-ui/package.json
1 1 {
2 2 "name": "ruoyi",
3 3 "version": "3.3.0",
4   - "description": "若依管理系统",
5   - "author": "若依",
  4 + "description": "芋道管理系统",
  5 + "author": "芋道",
6 6 "license": "MIT",
7 7 "scripts": {
8 8 "dev": "vue-cli-service serve",
... ...
ruoyi-ui/src/api/monitor/job.js
... ... @@ -3,7 +3,7 @@ import request from '@/utils/request'
3 3 // 查询定时任务调度列表
4 4 export function listJob(query) {
5 5 return request({
6   - url: '/monitor/job/list',
  6 + url: '/infra/job/page',
7 7 method: 'get',
8 8 params: query
9 9 })
... ... @@ -12,7 +12,7 @@ export function listJob(query) {
12 12 // 查询定时任务调度详细
13 13 export function getJob(jobId) {
14 14 return request({
15   - url: '/monitor/job/' + jobId,
  15 + url: '/infra/job/get?id=' + jobId,
16 16 method: 'get'
17 17 })
18 18 }
... ... @@ -20,7 +20,7 @@ export function getJob(jobId) {
20 20 // 新增定时任务调度
21 21 export function addJob(data) {
22 22 return request({
23   - url: '/monitor/job',
  23 + url: '/infra/job/create',
24 24 method: 'post',
25 25 data: data
26 26 })
... ... @@ -29,7 +29,7 @@ export function addJob(data) {
29 29 // 修改定时任务调度
30 30 export function updateJob(data) {
31 31 return request({
32   - url: '/monitor/job',
  32 + url: '/infra/job/update',
33 33 method: 'put',
34 34 data: data
35 35 })
... ... @@ -38,7 +38,7 @@ export function updateJob(data) {
38 38 // 删除定时任务调度
39 39 export function delJob(jobId) {
40 40 return request({
41   - url: '/monitor/job/' + jobId,
  41 + url: '/infra/job/delete?id=' + jobId,
42 42 method: 'delete'
43 43 })
44 44 }
... ... @@ -46,7 +46,7 @@ export function delJob(jobId) {
46 46 // 导出定时任务调度
47 47 export function exportJob(query) {
48 48 return request({
49   - url: '/monitor/job/export',
  49 + url: '/infra/job/export',
50 50 method: 'get',
51 51 params: query
52 52 })
... ... @@ -77,4 +77,4 @@ export function runJob(jobId, jobGroup) {
77 77 method: 'put',
78 78 data: data
79 79 })
80   -}
81 80 \ No newline at end of file
  81 +}
... ...
ruoyi-ui/src/layout/components/Sidebar/Logo.vue
... ... @@ -35,7 +35,7 @@ export default {
35 35 },
36 36 data() {
37 37 return {
38   - title: '若依管理系统',
  38 + title: '芋道管理系统',
39 39 logo: logoImg
40 40 }
41 41 }
... ...
ruoyi-ui/src/settings.js
1 1 module.exports = {
2   - title: '若依管理系统',
  2 + title: '芋道管理系统',
3 3  
4 4 /**
5 5 * 侧边栏主题 深色主题theme-dark,浅色主题theme-light
... ...
ruoyi-ui/src/utils/dict.js
... ... @@ -17,6 +17,7 @@ export const DICT_TYPE = {
17 17 SYS_CONFIG_TYPE: 'sys_config_type',
18 18  
19 19 INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type',
  20 + INF_JOB_STATUS: 'inf_job_status',
20 21  
21 22 TOOL_CODEGEN_TEMPLATE_TYPE: 'tool_codegen_template_type',
22 23 }
... ...
ruoyi-ui/src/views/index.vue
... ... @@ -39,9 +39,9 @@
39 39 </el-row>
40 40 <el-row :gutter="20">
41 41 <el-col :sm="24" :lg="12" style="padding-left: 20px">
42   - <h2>若依后台管理框架</h2>
  42 + <h2>芋道后台管理框架</h2>
43 43 <p>
44   - 一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了若依管理系统。,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。
  44 + 一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了芋道管理系统。,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。
45 45 </p>
46 46 <p>
47 47 <b>当前版本:</b> <span>v{{ version }}</span>
... ... @@ -127,14 +127,14 @@
127 127 <p>
128 128 <i class="el-icon-chat-dot-round"></i> 微信:<a
129 129 href="javascript:;"
130   - >/ *若依</a
  130 + >/ *芋道</a
131 131 >
132 132 </p>
133 133 <p>
134 134 <i class="el-icon-money"></i> 支付宝:<a
135 135 href="javascript:;"
136 136 class="支付宝信息"
137   - >/ *若依</a
  137 + >/ *芋道</a
138 138 >
139 139 </p>
140 140 </div>
... ... @@ -460,7 +460,7 @@
460 460 </el-collapse-item>
461 461 <el-collapse-item title="v1.0.0 - 2019-10-08">
462 462 <ol>
463   - <li>若依前后端分离系统正式发布</li>
  463 + <li>芋道前后端分离系统正式发布</li>
464 464 </ol>
465 465 </el-collapse-item>
466 466 </el-collapse>
... ...
ruoyi-ui/src/views/login.vue
1 1 <template>
2 2 <div class="login">
3 3 <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
4   - <h3 class="title">若依后台管理系统</h3>
  4 + <h3 class="title">芋道后台管理系统</h3>
5 5 <el-form-item prop="username">
6 6 <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
7 7 <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
... ...
ruoyi-ui/src/views/monitor/job/index.vue
1 1 <template>
2 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 6 </el-form-item>
23 7 <el-form-item label="任务状态" prop="status">
24 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 11 </el-select>
32 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 16 <el-form-item>
34 17 <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
35 18 <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
... ... @@ -38,171 +21,69 @@
38 21  
39 22 <el-row :gutter="10" class="mb8">
40 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 26 </el-col>
59 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 30 </el-col>
69 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 34 </el-col>
87 35 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
88 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 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 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 49 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
108 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 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 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 62 </template>
124 63 </el-table-column>
125 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 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 87 </el-form>
207 88 <div slot="footer" class="dialog-footer">
208 89 <el-button type="primary" @click="submitForm">确 定</el-button>
... ... @@ -212,44 +93,20 @@
212 93  
213 94 <!-- 任务日志详细 -->
214 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 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 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 110 </el-col>
254 111 </el-row>
255 112 </el-form>
... ... @@ -257,6 +114,7 @@
257 114 <el-button @click="openView = false">关 闭</el-button>
258 115 </div>
259 116 </el-dialog>
  117 +
260 118 </div>
261 119 </template>
262 120  
... ... @@ -269,12 +127,6 @@ export default {
269 127 return {
270 128 // 遮罩层
271 129 loading: true,
272   - // 选中数组
273   - ids: [],
274   - // 非单个禁用
275   - single: true,
276   - // 非多个禁用
277   - multiple: true,
278 130 // 显示搜索条件
279 131 showSearch: true,
280 132 // 总条数
... ... @@ -287,83 +139,59 @@ export default {
287 139 open: false,
288 140 // 是否显示详细弹出层
289 141 openView: false,
290   - // 任务组名字典
291   - jobGroupOptions: [],
292 142 // 状态字典
293 143 statusOptions: [],
294 144 // 查询参数
295 145 queryParams: {
296   - pageNum: 1,
  146 + pageNo: 1,
297 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 153 form: {},
304 154 // 表单校验
305 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 162 created() {
319 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 165 methods: {
328 166 /** 查询定时任务列表 */
329 167 getList() {
330 168 this.loading = true;
331 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 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 176 cancel() {
347 177 this.open = false;
348 178 this.reset();
349 179 },
350   - // 表单重置
  180 + /** 表单重置 */
351 181 reset() {
352 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 187 cronExpression: undefined,
358   - misfirePolicy: 1,
359   - concurrent: 1,
360   - status: "0"
  188 + monitorTimeout: undefined,
361 189 };
362 190 this.resetForm("form");
363 191 },
364 192 /** 搜索按钮操作 */
365 193 handleQuery() {
366   - this.queryParams.pageNum = 1;
  194 + this.queryParams.pageNo = 1;
367 195 this.getList();
368 196 },
369 197 /** 重置按钮操作 */
... ... @@ -371,21 +199,15 @@ export default {
371 199 this.resetForm("queryForm");
372 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 203 handleStatusChange(row) {
382 204 let text = row.status === "0" ? "启用" : "停用";
383   - this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', "警告", {
  205 + this.$confirm('确认要"' + text + '""' + row.name + '"任务吗?', "警告", {
384 206 confirmButtonText: "确定",
385 207 cancelButtonText: "取消",
386 208 type: "warning"
387 209 }).then(function() {
388   - return changeJobStatus(row.jobId, row.status);
  210 + return changeJobStatus(row.id, row.status);
389 211 }).then(() => {
390 212 this.msgSuccess(text + "成功");
391 213 }).catch(function() {
... ... @@ -394,19 +216,19 @@ export default {
394 216 },
395 217 /* 立即执行一次 */
396 218 handleRun(row) {
397   - this.$confirm('确认要立即执行一次"' + row.jobName + '"任务吗?', "警告", {
  219 + this.$confirm('确认要立即执行一次"' + row.name + '"任务吗?', "警告", {
398 220 confirmButtonText: "确定",
399 221 cancelButtonText: "取消",
400 222 type: "warning"
401 223 }).then(function() {
402   - return runJob(row.jobId, row.jobGroup);
  224 + return runJob(row.id, row.jobGroup);
403 225 }).then(() => {
404 226 this.msgSuccess("执行成功");
405 227 })
406 228 },
407 229 /** 任务详细信息 */
408 230 handleView(row) {
409   - getJob(row.jobId).then(response => {
  231 + getJob(row.id).then(response => {
410 232 this.form = response.data;
411 233 this.openView = true;
412 234 });
... ... @@ -424,8 +246,8 @@ export default {
424 246 /** 修改按钮操作 */
425 247 handleUpdate(row) {
426 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 251 this.form = response.data;
430 252 this.open = true;
431 253 this.title = "修改任务";
... ... @@ -435,7 +257,7 @@ export default {
435 257 submitForm: function() {
436 258 this.$refs["form"].validate(valid => {
437 259 if (valid) {
438   - if (this.form.jobId != undefined) {
  260 + if (this.form.id !== undefined) {
439 261 updateJob(this.form).then(response => {
440 262 this.msgSuccess("修改成功");
441 263 this.open = false;
... ... @@ -453,13 +275,13 @@ export default {
453 275 },
454 276 /** 删除按钮操作 */
455 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 280 confirmButtonText: "确定",
459 281 cancelButtonText: "取消",
460 282 type: "warning"
461 283 }).then(function() {
462   - return delJob(jobIds);
  284 + return delJob(ids);
463 285 }).then(() => {
464 286 this.getList();
465 287 this.msgSuccess("删除成功");
... ... @@ -480,4 +302,4 @@ export default {
480 302 }
481 303 }
482 304 };
483   -</script>
484 305 \ No newline at end of file
  306 +</script>
... ...
ruoyi-ui/src/views/tool/codegen/editTable.vue
... ... @@ -212,7 +212,7 @@ export default {
212 212 /** 关闭按钮 */
213 213 close() {
214 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 218 mounted() {
... ...
ruoyi-ui/src/views/tool/codegen/index.vue
... ... @@ -59,7 +59,7 @@
59 59 <span>{{ parseTime(scope.row.createTime) }}</span>
60 60 </template>
61 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 63 <template slot-scope="scope">
64 64 <span>{{ parseTime(scope.row.updateTime) }}</span>
65 65 </template>
... ...
ruoyi-ui/vue.config.js
... ... @@ -6,7 +6,7 @@ function resolve(dir) {
6 6 return path.join(__dirname, dir)
7 7 }
8 8  
9   -const name = defaultSettings.title || '若依管理系统' // 标题
  9 +const name = defaultSettings.title || '芋道管理系统' // 标题
10 10  
11 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 89 @PreAuthorize("@ss.hasPermission('infra:job:export')")
90 90 @OperateLog(type = EXPORT)
91 91 public void exportJobExcel(@Valid InfJobExportReqVO exportReqVO,
92   - HttpServletResponse response) throws IOException {
  92 + HttpServletResponse response) throws IOException {
93 93 List<InfJobDO> list = jobService.getJobList(exportReqVO);
94 94 // 导出 Excel
95 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 2  
3 3 import io.swagger.annotations.ApiModelProperty;
4 4 import lombok.Data;
5   -import org.springframework.format.annotation.DateTimeFormat;
6 5  
7 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 9 * 定时任务 Base VO,提供给添加、修改、详细的子 VO 使用
... ... @@ -20,14 +16,6 @@ public class InfJobBaseVO {
20 16 @NotNull(message = "任务名称不能为空")
21 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 19 @ApiModelProperty(value = "处理器的参数", example = "yudao")
32 20 private String handlerParam;
33 21  
... ... @@ -35,22 +23,6 @@ public class InfJobBaseVO {
35 23 @NotNull(message = "CRON 表达式不能为空")
36 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 26 @ApiModelProperty(value = "监控超时时间", example = "1000")
55 27 private Integer monitorTimeout;
56 28  
... ...
src/main/java/cn/iocoder/dashboard/modules/infra/controller/job/vo/job/InfJobCreateReqVO.java
1 1 package cn.iocoder.dashboard.modules.infra.controller.job.vo.job;
2 2  
3 3 import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
4 5 import lombok.Data;
5 6 import lombok.EqualsAndHashCode;
6 7 import lombok.ToString;
7 8  
  9 +import javax.validation.constraints.NotNull;
  10 +
8 11 @ApiModel("定时任务创建 Request VO")
9 12 @Data
10 13 @EqualsAndHashCode(callSuper = true)
11 14 @ToString(callSuper = true)
12 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 import lombok.EqualsAndHashCode;
7 7 import lombok.ToString;
8 8  
  9 +import javax.validation.constraints.NotNull;
9 10 import java.util.Date;
10 11  
11 12 @ApiModel("定时任务 Response VO")
... ... @@ -17,6 +18,25 @@ public class InfJobRespVO extends InfJobBaseVO {
17 18 @ApiModelProperty(value = "任务编号", required = true, example = "1024")
18 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 40 @ApiModelProperty(value = "创建时间", required = true)
21 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 80 // ========== 监控相关字段 ==========
81 81 /**
82 82 * 监控超时时间,单位:毫秒
  83 + * 为空时,表示不监控
83 84 *
84 85 * 注意,这里的超时的目的,不是进行任务的取消,而是告警任务的执行时间过长
85 86 */
86   - @TableField(updateStrategy = FieldStrategy.IGNORED)
87 87 private Integer monitorTimeout;
88 88  
89 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 35 public Long createJob(InfJobCreateReqVO createReqVO) {
36 36 // 插入
37 37 InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO);
  38 + if (job.getMonitorTimeout() == null) {
  39 + job.setMonitorTimeout(0);
  40 + }
38 41 jobMapper.insert(job);
39 42 // 返回
40 43 return job.getId();
... ... @@ -46,6 +49,9 @@ public class InfJobServiceImpl implements InfJobService {
46 49 this.validateJobExists(updateReqVO.getId());
47 50 // 更新
48 51 InfJobDO updateObj = InfJobConvert.INSTANCE.convert(updateReqVO);
  52 + if (updateObj.getMonitorTimeout() == null) {
  53 + updateObj.setMonitorTimeout(0);
  54 + }
49 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 5 import lombok.extern.slf4j.Slf4j;
6 6 import org.springframework.stereotype.Component;
7 7  
  8 +/**
  9 + * 用户 Session 超时 Job
  10 + *
  11 + * @author 芋道源码
  12 + */
8 13 @Component
9 14 @Slf4j
10 15 public class SysUserSessionTimeoutJob implements JobHandler {
... ...
src/main/resources/codegen/java/controller/vo/baseVO.vm
... ... @@ -6,7 +6,7 @@ import io.swagger.annotations.*;
6 6 import javax.validation.constraints.*;
7 7 ## 处理 Date 字段的引入
8 8 #foreach ($column in $columns)
9   -#if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult})##通用操作
  9 +#if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult}
10 10 && ${column.javaType} == "Date")## 时间类型
11 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 218 // 是否显示弹出层
219 219 open: false,
220 220 #foreach ($column in $columns)## 时间范围
  221 + #if ($column.listOperation)
221 222 #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
222 223 #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
223 224 dateRange${AttrName}: [],
224 225 #end
225 226 #end
  227 + #end
226 228 // 查询参数
227 229 queryParams: {
228 230 pageNo: 1,
... ... @@ -256,11 +258,13 @@ export default {
256 258 // 处理查询参数
257 259 let params = {...this.queryParams};
258 260 #foreach ($column in $columns)
  261 + #if ($column.listOperation)
259 262 #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
260 263 #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
261 264 this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}');
262 265 #end
263 266 #end
  267 + #end
264 268 // 执行查询
265 269 get${simpleClassName}Page(params).then(response => {
266 270 this.list = response.data.list;
... ... @@ -277,12 +281,14 @@ export default {
277 281 reset() {
278 282 this.form = {
279 283 #foreach ($column in $columns)
280   - #if($column.htmlType == "checkbox")
  284 + #if ($column.createOperation || $column.updateOperation)
  285 + #if ($column.htmlType == "checkbox")
281 286 $column.javaField: [],
282 287 #else
283 288 $column.javaField: undefined,
284 289 #end
285 290 #end
  291 + #end
286 292 };
287 293 this.resetForm("form");
288 294 },
... ... @@ -294,11 +300,13 @@ export default {
294 300 /** 重置按钮操作 */
295 301 resetQuery() {
296 302 #foreach ($column in $columns)
  303 + #if ($column.listOperation)
297 304 #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
298 305 #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
299 306 this.dateRange${AttrName} = [];
300 307 #end
301 308 #end
  309 + #end
302 310 this.resetForm("queryForm");
303 311 this.handleQuery();
304 312 },
... ... @@ -372,11 +380,13 @@ export default {
372 380 params.pageNo = undefined;
373 381 params.pageSize = undefined;
374 382 #foreach ($column in $columns)
  383 + #if ($column.listOperation)
375 384 #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
376 385 #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
377 386 this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}');
378 387 #end
379 388 #end
  389 + #end
380 390 // 执行导出
381 391 this.$confirm('是否确认导出所有${table.classComment}数据项?', "警告", {
382 392 confirmButtonText: "确定",
... ...