commit | author | age
|
9bcb19
|
1 |
/* |
I |
2 |
Copyright [2020] [https://www.xiaonuo.vip] |
|
3 |
|
|
4 |
Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
you may not use this file except in compliance with the License. |
|
6 |
You may obtain a copy of the License at |
|
7 |
|
|
8 |
http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
|
|
10 |
Unless required by applicable law or agreed to in writing, software |
|
11 |
distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
See the License for the specific language governing permissions and |
|
14 |
limitations under the License. |
|
15 |
|
|
16 |
Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: |
|
17 |
|
|
18 |
1.请不要删除和修改根目录下的LICENSE文件。 |
|
19 |
2.请不要删除和修改Snowy源码头部的版权声明。 |
|
20 |
3.请保留源码和相关描述文件的项目出处,作者声明等。 |
|
21 |
4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
|
22 |
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
|
23 |
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip |
|
24 |
*/ |
|
25 |
package vip.xiaonuo.sys.modular.timer.controller; |
|
26 |
|
|
27 |
import org.springframework.validation.annotation.Validated; |
|
28 |
import org.springframework.web.bind.annotation.GetMapping; |
|
29 |
import org.springframework.web.bind.annotation.PostMapping; |
|
30 |
import org.springframework.web.bind.annotation.RequestBody; |
|
31 |
import org.springframework.web.bind.annotation.RestController; |
|
32 |
import vip.xiaonuo.core.annotion.BusinessLog; |
|
33 |
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum; |
|
34 |
import vip.xiaonuo.core.pojo.response.ResponseData; |
|
35 |
import vip.xiaonuo.core.pojo.response.SuccessResponseData; |
|
36 |
import vip.xiaonuo.sys.modular.timer.param.SysTimersParam; |
|
37 |
import vip.xiaonuo.sys.modular.timer.service.SysTimersService; |
|
38 |
|
|
39 |
import javax.annotation.Resource; |
|
40 |
import java.util.List; |
|
41 |
|
|
42 |
/** |
|
43 |
* 定时任务 控制器 |
|
44 |
* |
|
45 |
* @author yubaoshan |
|
46 |
* @date 2020/6/30 18:26 |
|
47 |
*/ |
|
48 |
@RestController |
|
49 |
public class SysTimersController { |
|
50 |
|
|
51 |
@Resource |
|
52 |
private SysTimersService sysTimersService; |
|
53 |
|
|
54 |
/** |
|
55 |
* 分页查询定时任务 |
|
56 |
* |
|
57 |
* @author yubaoshan |
|
58 |
* @date 2020/6/30 18:26 |
|
59 |
*/ |
|
60 |
@GetMapping("/sysTimers/page") |
|
61 |
@BusinessLog(title = "定时任务_分页查询", opType = LogAnnotionOpTypeEnum.QUERY) |
|
62 |
public ResponseData page(SysTimersParam sysTimersParam) { |
|
63 |
return new SuccessResponseData(sysTimersService.page(sysTimersParam)); |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* 获取全部定时任务 |
|
68 |
* |
|
69 |
* @author yubaoshan |
|
70 |
* @date 2020/6/30 18:26 |
|
71 |
*/ |
|
72 |
@GetMapping("/sysTimers/list") |
|
73 |
@BusinessLog(title = "定时任务_查询所有", opType = LogAnnotionOpTypeEnum.QUERY) |
|
74 |
public ResponseData list(SysTimersParam sysTimersParam) { |
|
75 |
return new SuccessResponseData(sysTimersService.list(sysTimersParam)); |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* 查看详情定时任务 |
|
80 |
* |
|
81 |
* @author yubaoshan |
|
82 |
* @date 2020/6/30 18:26 |
|
83 |
*/ |
|
84 |
@GetMapping("/sysTimers/detail") |
|
85 |
@BusinessLog(title = "定时任务_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL) |
|
86 |
public ResponseData detail(@Validated(SysTimersParam.detail.class) SysTimersParam sysTimersParam) { |
|
87 |
return new SuccessResponseData(sysTimersService.detail(sysTimersParam)); |
|
88 |
} |
|
89 |
|
|
90 |
/** |
|
91 |
* 添加定时任务 |
|
92 |
* |
|
93 |
* @author yubaoshan |
|
94 |
* @date 2020/6/30 18:26 |
|
95 |
*/ |
|
96 |
@PostMapping("/sysTimers/add") |
|
97 |
@BusinessLog(title = "定时任务_增加", opType = LogAnnotionOpTypeEnum.ADD) |
|
98 |
public ResponseData add(@RequestBody @Validated(SysTimersParam.add.class) SysTimersParam sysTimersParam) { |
|
99 |
sysTimersService.add(sysTimersParam); |
|
100 |
return new SuccessResponseData(); |
|
101 |
} |
|
102 |
|
|
103 |
/** |
|
104 |
* 删除定时任务 |
|
105 |
* |
|
106 |
* @author yubaoshan |
|
107 |
* @date 2020/6/30 18:26 |
|
108 |
*/ |
|
109 |
@PostMapping("/sysTimers/delete") |
|
110 |
@BusinessLog(title = "定时任务_删除", opType = LogAnnotionOpTypeEnum.DELETE) |
|
111 |
public ResponseData delete(@RequestBody @Validated(SysTimersParam.delete.class) SysTimersParam sysTimersParam) { |
|
112 |
sysTimersService.delete(sysTimersParam); |
|
113 |
return new SuccessResponseData(); |
|
114 |
} |
|
115 |
|
|
116 |
/** |
|
117 |
* 编辑定时任务 |
|
118 |
* |
|
119 |
* @author yubaoshan |
|
120 |
* @date 2020/6/30 18:26 |
|
121 |
*/ |
|
122 |
@PostMapping("/sysTimers/edit") |
|
123 |
@BusinessLog(title = "定时任务_编辑", opType = LogAnnotionOpTypeEnum.EDIT) |
|
124 |
public ResponseData edit(@RequestBody @Validated(SysTimersParam.edit.class) SysTimersParam sysTimersParam) { |
|
125 |
sysTimersService.edit(sysTimersParam); |
|
126 |
return new SuccessResponseData(); |
|
127 |
} |
|
128 |
|
|
129 |
/** |
|
130 |
* 获取系统的所有任务列表 |
|
131 |
* |
|
132 |
* @author yubaoshan |
|
133 |
* @date 2020/7/1 14:34 |
|
134 |
*/ |
|
135 |
@PostMapping("/sysTimers/getActionClasses") |
|
136 |
@BusinessLog(title = "定时任务_任务列表", opType = LogAnnotionOpTypeEnum.OTHER) |
|
137 |
public ResponseData getActionClasses() { |
|
138 |
List<String> actionClasses = sysTimersService.getActionClasses(); |
|
139 |
return new SuccessResponseData(actionClasses); |
|
140 |
} |
|
141 |
|
|
142 |
/** |
|
143 |
* 启动定时任务 |
|
144 |
* |
|
145 |
* @author yubaoshan |
|
146 |
* @date 2020/7/1 14:34 |
|
147 |
*/ |
|
148 |
@PostMapping("/sysTimers/start") |
|
149 |
@BusinessLog(title = "定时任务_启动", opType = LogAnnotionOpTypeEnum.OTHER) |
|
150 |
public ResponseData start(@RequestBody @Validated(SysTimersParam.start.class) SysTimersParam sysTimersParam) { |
|
151 |
sysTimersService.start(sysTimersParam); |
|
152 |
return new SuccessResponseData(); |
|
153 |
} |
|
154 |
|
|
155 |
/** |
|
156 |
* 停止定时任务 |
|
157 |
* |
|
158 |
* @author yubaoshan |
|
159 |
* @date 2020/7/1 14:34 |
|
160 |
*/ |
|
161 |
@PostMapping("/sysTimers/stop") |
|
162 |
@BusinessLog(title = "定时任务_关闭", opType = LogAnnotionOpTypeEnum.OTHER) |
|
163 |
public ResponseData stop(@RequestBody @Validated(SysTimersParam.stop.class) SysTimersParam sysTimersParam) { |
|
164 |
sysTimersService.stop(sysTimersParam); |
|
165 |
return new SuccessResponseData(); |
|
166 |
} |
|
167 |
|
|
168 |
} |