mirror of https://github.com/elunez/eladmin
代码优化,修改Controller中方法,避免名称重复
命名重复会打印如下日志,不介意的可以不修改: s.d.s.w.s.ApiListingReferenceScanner: Generating unique operation namedpull/721/head
parent
db1a20a83c
commit
c75b52e15b
|
@ -98,7 +98,7 @@ public class RedisConfig extends CachingConfigurerSupport {
|
|||
@Override
|
||||
public KeyGenerator keyGenerator() {
|
||||
return (target, method, params) -> {
|
||||
Map<String,Object> container = new HashMap<>();
|
||||
Map<String,Object> container = new HashMap<>(4);
|
||||
Class<?> targetClassClass = target.getClass();
|
||||
// 类地址
|
||||
container.put("class",targetClassClass.toGenericString());
|
||||
|
|
|
@ -39,13 +39,13 @@ public class GenConfigController {
|
|||
|
||||
@ApiOperation("查询")
|
||||
@GetMapping(value = "/{tableName}")
|
||||
public ResponseEntity<Object> query(@PathVariable String tableName){
|
||||
public ResponseEntity<Object> queryGenConfig(@PathVariable String tableName){
|
||||
return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody GenConfig genConfig){
|
||||
@ApiOperation("修改")
|
||||
public ResponseEntity<Object> updateGenConfig(@Validated @RequestBody GenConfig genConfig){
|
||||
return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class GeneratorController {
|
|||
|
||||
@ApiOperation("查询数据库数据")
|
||||
@GetMapping(value = "/tables/all")
|
||||
public ResponseEntity<Object> queryTables(){
|
||||
public ResponseEntity<Object> queryAllTables(){
|
||||
return new ResponseEntity<>(generatorService.getTables(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -71,14 +71,14 @@ public class GeneratorController {
|
|||
|
||||
@ApiOperation("保存字段数据")
|
||||
@PutMapping
|
||||
public ResponseEntity<HttpStatus> save(@RequestBody List<ColumnInfo> columnInfos){
|
||||
public ResponseEntity<HttpStatus> saveColumn(@RequestBody List<ColumnInfo> columnInfos){
|
||||
generatorService.save(columnInfos);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("同步字段数据")
|
||||
@PostMapping(value = "sync")
|
||||
public ResponseEntity<HttpStatus> sync(@RequestBody List<String> tables){
|
||||
public ResponseEntity<HttpStatus> syncColumn(@RequestBody List<String> tables){
|
||||
for (String table : tables) {
|
||||
generatorService.sync(generatorService.getColumns(table), generatorService.query(table));
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class GeneratorController {
|
|||
|
||||
@ApiOperation("生成代码")
|
||||
@PostMapping(value = "/{tableName}/{type}")
|
||||
public ResponseEntity<Object> generator(@PathVariable String tableName, @PathVariable Integer type, HttpServletRequest request, HttpServletResponse response){
|
||||
public ResponseEntity<Object> generatorCode(@PathVariable String tableName, @PathVariable Integer type, HttpServletRequest request, HttpServletResponse response){
|
||||
if(!generatorEnabled && type == 0){
|
||||
throw new BadRequestException("此环境不允许生成代码,请选择预览或者下载查看!");
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class LogController {
|
|||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check()")
|
||||
public void download(HttpServletResponse response, LogQueryCriteria criteria) throws IOException {
|
||||
public void exportLog(HttpServletResponse response, LogQueryCriteria criteria) throws IOException {
|
||||
criteria.setLogType("INFO");
|
||||
logService.download(logService.queryAll(criteria), response);
|
||||
}
|
||||
|
@ -55,14 +55,14 @@ public class LogController {
|
|||
@ApiOperation("导出错误数据")
|
||||
@GetMapping(value = "/error/download")
|
||||
@PreAuthorize("@el.check()")
|
||||
public void downloadErrorLog(HttpServletResponse response, LogQueryCriteria criteria) throws IOException {
|
||||
public void exportErrorLog(HttpServletResponse response, LogQueryCriteria criteria) throws IOException {
|
||||
criteria.setLogType("ERROR");
|
||||
logService.download(logService.queryAll(criteria), response);
|
||||
}
|
||||
@GetMapping
|
||||
@ApiOperation("日志查询")
|
||||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<Object> query(LogQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryLog(LogQueryCriteria criteria, Pageable pageable){
|
||||
criteria.setLogType("INFO");
|
||||
return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class LogController {
|
|||
@GetMapping(value = "/error/{id}")
|
||||
@ApiOperation("日志异常详情查询")
|
||||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<Object> queryErrorLogs(@PathVariable Long id){
|
||||
public ResponseEntity<Object> queryErrorLogDetail(@PathVariable Long id){
|
||||
return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK);
|
||||
}
|
||||
@DeleteMapping(value = "/del/error")
|
||||
|
|
|
@ -113,7 +113,7 @@ public class LogServiceImpl implements LogService {
|
|||
//将RequestParam注解修饰的参数作为请求参数
|
||||
RequestParam requestParam = parameters[i].getAnnotation(RequestParam.class);
|
||||
if (requestParam != null) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>(4);
|
||||
String key = parameters[i].getName();
|
||||
if (!StringUtils.isEmpty(requestParam.value())) {
|
||||
key = requestParam.value();
|
||||
|
|
|
@ -32,24 +32,17 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|||
@Configuration
|
||||
public class AsyncTaskExecutePool implements AsyncConfigurer {
|
||||
|
||||
/** 注入配置类 */
|
||||
private final AsyncTaskProperties config;
|
||||
|
||||
public AsyncTaskExecutePool(AsyncTaskProperties config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Executor getAsyncExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
//核心线程池大小
|
||||
executor.setCorePoolSize(config.getCorePoolSize());
|
||||
executor.setCorePoolSize(AsyncTaskProperties.corePoolSize);
|
||||
//最大线程数
|
||||
executor.setMaxPoolSize(config.getMaxPoolSize());
|
||||
executor.setMaxPoolSize(AsyncTaskProperties.maxPoolSize);
|
||||
//队列容量
|
||||
executor.setQueueCapacity(config.getQueueCapacity());
|
||||
executor.setQueueCapacity(AsyncTaskProperties.queueCapacity);
|
||||
//活跃时间
|
||||
executor.setKeepAliveSeconds(config.getKeepAliveSeconds());
|
||||
executor.setKeepAliveSeconds(AsyncTaskProperties.keepAliveSeconds);
|
||||
//线程名字前缀
|
||||
executor.setThreadNamePrefix("el-async-");
|
||||
// setRejectedExecutionHandler:当pool已经达到max size的时候,如何处理新任务
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package me.zhengjie.config.thread;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -26,14 +27,33 @@ import org.springframework.stereotype.Component;
|
|||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "task.pool")
|
||||
public class AsyncTaskProperties {
|
||||
|
||||
private int corePoolSize;
|
||||
public static int corePoolSize;
|
||||
|
||||
private int maxPoolSize;
|
||||
public static int maxPoolSize;
|
||||
|
||||
private int keepAliveSeconds;
|
||||
public static int keepAliveSeconds;
|
||||
|
||||
private int queueCapacity;
|
||||
public static int queueCapacity;
|
||||
|
||||
@Value("${task.pool.core-pool-size}")
|
||||
public void setCorePoolSize(int corePoolSize) {
|
||||
AsyncTaskProperties.corePoolSize = corePoolSize;
|
||||
}
|
||||
|
||||
@Value("${task.pool.max-pool-size}")
|
||||
public void setMaxPoolSize(int maxPoolSize) {
|
||||
AsyncTaskProperties.maxPoolSize = maxPoolSize;
|
||||
}
|
||||
|
||||
@Value("${task.pool.keep-alive-seconds}")
|
||||
public void setKeepAliveSeconds(int keepAliveSeconds) {
|
||||
AsyncTaskProperties.keepAliveSeconds = keepAliveSeconds;
|
||||
}
|
||||
|
||||
@Value("${task.pool.queue-capacity}")
|
||||
public void setQueueCapacity(int queueCapacity) {
|
||||
AsyncTaskProperties.queueCapacity = queueCapacity;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
package me.zhengjie.config.thread;
|
||||
|
||||
import me.zhengjie.utils.SpringContextHolder;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -29,13 +27,12 @@ import java.util.concurrent.TimeUnit;
|
|||
public class ThreadPoolExecutorUtil {
|
||||
|
||||
public static ThreadPoolExecutor getPoll(){
|
||||
AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class);
|
||||
return new ThreadPoolExecutor(
|
||||
properties.getCorePoolSize(),
|
||||
properties.getMaxPoolSize(),
|
||||
properties.getKeepAliveSeconds(),
|
||||
AsyncTaskProperties.corePoolSize,
|
||||
AsyncTaskProperties.maxPoolSize,
|
||||
AsyncTaskProperties.keepAliveSeconds,
|
||||
TimeUnit.SECONDS,
|
||||
new ArrayBlockingQueue<>(properties.getQueueCapacity()),
|
||||
new ArrayBlockingQueue<>(AsyncTaskProperties.queueCapacity),
|
||||
new TheadFactoryName()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -47,14 +47,14 @@ public class AppController {
|
|||
@ApiOperation("导出应用数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('app:list')")
|
||||
public void download(HttpServletResponse response, AppQueryCriteria criteria) throws IOException {
|
||||
public void exportApp(HttpServletResponse response, AppQueryCriteria criteria) throws IOException {
|
||||
appService.download(appService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询应用")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('app:list')")
|
||||
public ResponseEntity<Object> query(AppQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryApp(AppQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(appService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class AppController {
|
|||
@ApiOperation(value = "新增应用")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('app:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody App resources){
|
||||
public ResponseEntity<Object> createApp(@Validated @RequestBody App resources){
|
||||
appService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class AppController {
|
|||
@ApiOperation(value = "修改应用")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('app:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody App resources){
|
||||
public ResponseEntity<Object> updateApp(@Validated @RequestBody App resources){
|
||||
appService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class AppController {
|
|||
@ApiOperation(value = "删除应用")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('app:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
public ResponseEntity<Object> deleteApp(@RequestBody Set<Long> ids){
|
||||
appService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -55,14 +55,14 @@ public class DatabaseController {
|
|||
@ApiOperation("导出数据库数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('database:list')")
|
||||
public void download(HttpServletResponse response, DatabaseQueryCriteria criteria) throws IOException {
|
||||
public void exportDatabase(HttpServletResponse response, DatabaseQueryCriteria criteria) throws IOException {
|
||||
databaseService.download(databaseService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询数据库")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('database:list')")
|
||||
public ResponseEntity<Object> query(DatabaseQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryDatabase(DatabaseQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(databaseService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class DatabaseController {
|
|||
@ApiOperation(value = "新增数据库")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('database:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Database resources){
|
||||
public ResponseEntity<Object> createDatabase(@Validated @RequestBody Database resources){
|
||||
databaseService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class DatabaseController {
|
|||
@ApiOperation(value = "修改数据库")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('database:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody Database resources){
|
||||
public ResponseEntity<Object> updateDatabase(@Validated @RequestBody Database resources){
|
||||
databaseService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class DatabaseController {
|
|||
@ApiOperation(value = "删除数据库")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('database:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids){
|
||||
public ResponseEntity<Object> deleteDatabase(@RequestBody Set<String> ids){
|
||||
databaseService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class DatabaseController {
|
|||
@ApiOperation(value = "执行SQL脚本")
|
||||
@PostMapping(value = "/upload")
|
||||
@PreAuthorize("@el.check('database:add')")
|
||||
public ResponseEntity<Object> upload(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{
|
||||
public ResponseEntity<Object> uploadDatabase(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{
|
||||
String id = request.getParameter("id");
|
||||
DatabaseDto database = databaseService.findById(id);
|
||||
String fileName;
|
||||
|
|
|
@ -57,14 +57,14 @@ public class DeployController {
|
|||
@ApiOperation("导出部署数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('database:list')")
|
||||
public void download(HttpServletResponse response, DeployQueryCriteria criteria) throws IOException {
|
||||
public void exportDeployData(HttpServletResponse response, DeployQueryCriteria criteria) throws IOException {
|
||||
deployService.download(deployService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询部署")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('deploy:list')")
|
||||
public ResponseEntity<Object> query(DeployQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryDeployData(DeployQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(deployService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class DeployController {
|
|||
@ApiOperation(value = "新增部署")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('deploy:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Deploy resources){
|
||||
public ResponseEntity<Object> createDeploy(@Validated @RequestBody Deploy resources){
|
||||
deployService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class DeployController {
|
|||
@ApiOperation(value = "修改部署")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('deploy:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody Deploy resources){
|
||||
public ResponseEntity<Object> updateDeploy(@Validated @RequestBody Deploy resources){
|
||||
deployService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class DeployController {
|
|||
@ApiOperation(value = "删除部署")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('deploy:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
public ResponseEntity<Object> deleteDeploy(@RequestBody Set<Long> ids){
|
||||
deployService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class DeployController {
|
|||
@ApiOperation(value = "上传文件部署")
|
||||
@PostMapping(value = "/upload")
|
||||
@PreAuthorize("@el.check('deploy:edit')")
|
||||
public ResponseEntity<Object> upload(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{
|
||||
public ResponseEntity<Object> uploadDeploy(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{
|
||||
Long id = Long.valueOf(request.getParameter("id"));
|
||||
String fileName = "";
|
||||
if(file != null){
|
||||
|
|
|
@ -45,14 +45,14 @@ public class DeployHistoryController {
|
|||
@ApiOperation("导出部署历史数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('deployHistory:list')")
|
||||
public void download(HttpServletResponse response, DeployHistoryQueryCriteria criteria) throws IOException {
|
||||
public void exportDeployHistory(HttpServletResponse response, DeployHistoryQueryCriteria criteria) throws IOException {
|
||||
deployhistoryService.download(deployhistoryService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询部署历史")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('deployHistory:list')")
|
||||
public ResponseEntity<Object> query(DeployHistoryQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryDeployHistory(DeployHistoryQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(deployhistoryService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class DeployHistoryController {
|
|||
@ApiOperation(value = "删除部署历史")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('deployHistory:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids){
|
||||
public ResponseEntity<Object> deleteDeployHistory(@RequestBody Set<String> ids){
|
||||
deployhistoryService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -47,14 +47,14 @@ public class ServerDeployController {
|
|||
@ApiOperation("导出服务器数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('serverDeploy:list')")
|
||||
public void download(HttpServletResponse response, ServerDeployQueryCriteria criteria) throws IOException {
|
||||
public void exportServerDeploy(HttpServletResponse response, ServerDeployQueryCriteria criteria) throws IOException {
|
||||
serverDeployService.download(serverDeployService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询服务器")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:list')")
|
||||
public ResponseEntity<Object> query(ServerDeployQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryServerDeploy(ServerDeployQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(serverDeployService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class ServerDeployController {
|
|||
@ApiOperation(value = "新增服务器")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody ServerDeploy resources){
|
||||
public ResponseEntity<Object> createServerDeploy(@Validated @RequestBody ServerDeploy resources){
|
||||
serverDeployService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class ServerDeployController {
|
|||
@ApiOperation(value = "修改服务器")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody ServerDeploy resources){
|
||||
public ResponseEntity<Object> updateServerDeploy(@Validated @RequestBody ServerDeploy resources){
|
||||
serverDeployService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class ServerDeployController {
|
|||
@ApiOperation(value = "删除Server")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
public ResponseEntity<Object> deleteServerDeploy(@RequestBody Set<Long> ids){
|
||||
serverDeployService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class ServerDeployController {
|
|||
@ApiOperation(value = "测试连接服务器")
|
||||
@PostMapping("/testConnect")
|
||||
@PreAuthorize("@el.check('serverDeploy:add')")
|
||||
public ResponseEntity<Object> testConnect(@Validated @RequestBody ServerDeploy resources){
|
||||
public ResponseEntity<Object> testConnectServerDeploy(@Validated @RequestBody ServerDeploy resources){
|
||||
return new ResponseEntity<>(serverDeployService.testConnect(resources),HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,28 +51,28 @@ public class QuartzJobController {
|
|||
@ApiOperation("查询定时任务")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
public ResponseEntity<Object> query(JobQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryQuartzJob(JobQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(quartzJobService.queryAll(criteria,pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出任务数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
public void download(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
public void exportQuartzJob(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
quartzJobService.download(quartzJobService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("导出日志数据")
|
||||
@GetMapping(value = "/logs/download")
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
public void downloadLog(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
public void exportQuartzJobLog(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
quartzJobService.downloadLog(quartzJobService.queryAllLog(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询任务执行日志")
|
||||
@GetMapping(value = "/logs")
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
public ResponseEntity<Object> queryJobLog(JobQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryQuartzJobLog(JobQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(quartzJobService.queryAllLog(criteria,pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class QuartzJobController {
|
|||
@ApiOperation("新增定时任务")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('timing:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody QuartzJob resources){
|
||||
public ResponseEntity<Object> createQuartzJob(@Validated @RequestBody QuartzJob resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class QuartzJobController {
|
|||
@ApiOperation("修改定时任务")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('timing:edit')")
|
||||
public ResponseEntity<Object> update(@Validated(QuartzJob.Update.class) @RequestBody QuartzJob resources){
|
||||
public ResponseEntity<Object> updateQuartzJob(@Validated(QuartzJob.Update.class) @RequestBody QuartzJob resources){
|
||||
quartzJobService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class QuartzJobController {
|
|||
@ApiOperation("更改定时任务状态")
|
||||
@PutMapping(value = "/{id}")
|
||||
@PreAuthorize("@el.check('timing:edit')")
|
||||
public ResponseEntity<Object> update(@PathVariable Long id){
|
||||
public ResponseEntity<Object> updateQuartzJobStatus(@PathVariable Long id){
|
||||
quartzJobService.updateIsPause(quartzJobService.findById(id));
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class QuartzJobController {
|
|||
@ApiOperation("执行定时任务")
|
||||
@PutMapping(value = "/exec/{id}")
|
||||
@PreAuthorize("@el.check('timing:edit')")
|
||||
public ResponseEntity<Object> execution(@PathVariable Long id){
|
||||
public ResponseEntity<Object> executionQuartzJob(@PathVariable Long id){
|
||||
quartzJobService.execution(quartzJobService.findById(id));
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class QuartzJobController {
|
|||
@ApiOperation("删除定时任务")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('timing:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
public ResponseEntity<Object> deleteQuartzJob(@RequestBody Set<Long> ids){
|
||||
quartzJobService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -43,21 +43,21 @@ public class OnlineController {
|
|||
@ApiOperation("查询在线用户")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<Object> query(String filter, Pageable pageable){
|
||||
public ResponseEntity<Object> queryOnlineUser(String filter, Pageable pageable){
|
||||
return new ResponseEntity<>(onlineUserService.getAll(filter, pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check()")
|
||||
public void download(HttpServletResponse response, String filter) throws IOException {
|
||||
public void exportOnlineUser(HttpServletResponse response, String filter) throws IOException {
|
||||
onlineUserService.download(onlineUserService.getAll(filter), response);
|
||||
}
|
||||
|
||||
@ApiOperation("踢出用户")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> keys) throws Exception {
|
||||
public ResponseEntity<Object> deleteOnlineUser(@RequestBody Set<String> keys) throws Exception {
|
||||
for (String key : keys) {
|
||||
// 解密Key
|
||||
key = EncryptUtils.desDecrypt(key);
|
||||
|
|
|
@ -50,14 +50,14 @@ public class DeptController {
|
|||
@ApiOperation("导出部门数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('dept:list')")
|
||||
public void download(HttpServletResponse response, DeptQueryCriteria criteria) throws Exception {
|
||||
public void exportDept(HttpServletResponse response, DeptQueryCriteria criteria) throws Exception {
|
||||
deptService.download(deptService.queryAll(criteria, false), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询部门")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||
public ResponseEntity<Object> query(DeptQueryCriteria criteria) throws Exception {
|
||||
public ResponseEntity<Object> queryDept(DeptQueryCriteria criteria) throws Exception {
|
||||
List<DeptDto> deptDtos = deptService.queryAll(criteria, true);
|
||||
return new ResponseEntity<>(PageUtil.toPage(deptDtos, deptDtos.size()),HttpStatus.OK);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class DeptController {
|
|||
@ApiOperation("查询部门:根据ID获取同级与上级数据")
|
||||
@PostMapping("/superior")
|
||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||
public ResponseEntity<Object> getSuperior(@RequestBody List<Long> ids) {
|
||||
public ResponseEntity<Object> getDeptSuperior(@RequestBody List<Long> ids) {
|
||||
Set<DeptDto> deptDtos = new LinkedHashSet<>();
|
||||
for (Long id : ids) {
|
||||
DeptDto deptDto = deptService.findById(id);
|
||||
|
@ -79,7 +79,7 @@ public class DeptController {
|
|||
@ApiOperation("新增部门")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('dept:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Dept resources){
|
||||
public ResponseEntity<Object> createDept(@Validated @RequestBody Dept resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class DeptController {
|
|||
@ApiOperation("修改部门")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('dept:edit')")
|
||||
public ResponseEntity<Object> update(@Validated(Dept.Update.class) @RequestBody Dept resources){
|
||||
public ResponseEntity<Object> updateDept(@Validated(Dept.Update.class) @RequestBody Dept resources){
|
||||
deptService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class DeptController {
|
|||
@ApiOperation("删除部门")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('dept:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
public ResponseEntity<Object> deleteDept(@RequestBody Set<Long> ids){
|
||||
Set<DeptDto> deptDtos = new HashSet<>();
|
||||
for (Long id : ids) {
|
||||
List<Dept> deptList = deptService.findByPid(id);
|
||||
|
|
|
@ -49,21 +49,21 @@ public class DictController {
|
|||
@ApiOperation("导出字典数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
public void download(HttpServletResponse response, DictQueryCriteria criteria) throws IOException {
|
||||
public void exportDict(HttpServletResponse response, DictQueryCriteria criteria) throws IOException {
|
||||
dictService.download(dictService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典")
|
||||
@GetMapping(value = "/all")
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
public ResponseEntity<Object> queryAll(){
|
||||
public ResponseEntity<Object> queryAllDict(){
|
||||
return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
public ResponseEntity<Object> query(DictQueryCriteria resources, Pageable pageable){
|
||||
public ResponseEntity<Object> queryDict(DictQueryCriteria resources, Pageable pageable){
|
||||
return new ResponseEntity<>(dictService.queryAll(resources,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class DictController {
|
|||
@ApiOperation("新增字典")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('dict:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Dict resources){
|
||||
public ResponseEntity<Object> createDict(@Validated @RequestBody Dict resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class DictController {
|
|||
@ApiOperation("修改字典")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('dict:edit')")
|
||||
public ResponseEntity<Object> update(@Validated(Dict.Update.class) @RequestBody Dict resources){
|
||||
public ResponseEntity<Object> updateDict(@Validated(Dict.Update.class) @RequestBody Dict resources){
|
||||
dictService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class DictController {
|
|||
@ApiOperation("删除字典")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('dict:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
public ResponseEntity<Object> deleteDict(@RequestBody Set<Long> ids){
|
||||
dictService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class DictDetailController {
|
|||
|
||||
@ApiOperation("查询字典详情")
|
||||
@GetMapping
|
||||
public ResponseEntity<Object> query(DictDetailQueryCriteria criteria,
|
||||
public ResponseEntity<Object> queryDictDetail(DictDetailQueryCriteria criteria,
|
||||
@PageableDefault(sort = {"dictSort"}, direction = Sort.Direction.ASC) Pageable pageable){
|
||||
return new ResponseEntity<>(dictDetailService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class DictDetailController {
|
|||
@ApiOperation("新增字典详情")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('dict:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody DictDetail resources){
|
||||
public ResponseEntity<Object> createDictDetail(@Validated @RequestBody DictDetail resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class DictDetailController {
|
|||
@ApiOperation("修改字典详情")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('dict:edit')")
|
||||
public ResponseEntity<Object> update(@Validated(DictDetail.Update.class) @RequestBody DictDetail resources){
|
||||
public ResponseEntity<Object> updateDictDetail(@Validated(DictDetail.Update.class) @RequestBody DictDetail resources){
|
||||
dictDetailService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class DictDetailController {
|
|||
@ApiOperation("删除字典详情")
|
||||
@DeleteMapping(value = "/{id}")
|
||||
@PreAuthorize("@el.check('dict:del')")
|
||||
public ResponseEntity<Object> delete(@PathVariable Long id){
|
||||
public ResponseEntity<Object> deleteDictDetail(@PathVariable Long id){
|
||||
dictDetailService.delete(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -49,14 +49,14 @@ public class JobController {
|
|||
@ApiOperation("导出岗位数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('job:list')")
|
||||
public void download(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
public void exportJob(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
jobService.download(jobService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询岗位")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('job:list','user:list')")
|
||||
public ResponseEntity<Object> query(JobQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryJob(JobQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(jobService.queryAll(criteria, pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class JobController {
|
|||
@ApiOperation("新增岗位")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('job:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Job resources){
|
||||
public ResponseEntity<Object> createJob(@Validated @RequestBody Job resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class JobController {
|
|||
@ApiOperation("修改岗位")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('job:edit')")
|
||||
public ResponseEntity<Object> update(@Validated(Job.Update.class) @RequestBody Job resources){
|
||||
public ResponseEntity<Object> updateJob(@Validated(Job.Update.class) @RequestBody Job resources){
|
||||
jobService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class JobController {
|
|||
@ApiOperation("删除岗位")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('job:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
public ResponseEntity<Object> deleteJob(@RequestBody Set<Long> ids){
|
||||
// 验证是否被用户关联
|
||||
jobService.verification(ids);
|
||||
jobService.delete(ids);
|
||||
|
|
|
@ -41,7 +41,7 @@ public class LimitController {
|
|||
@AnonymousGetMapping
|
||||
@ApiOperation("测试")
|
||||
@Limit(key = "test", period = 60, count = 10, name = "testLimit", prefix = "limit")
|
||||
public int test() {
|
||||
public int testLimit() {
|
||||
return ATOMIC_INTEGER.incrementAndGet();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class MenuController {
|
|||
@ApiOperation("导出菜单数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public void download(HttpServletResponse response, MenuQueryCriteria criteria) throws Exception {
|
||||
public void exportMenu(HttpServletResponse response, MenuQueryCriteria criteria) throws Exception {
|
||||
menuService.download(menuService.queryAll(criteria, false), response);
|
||||
}
|
||||
|
||||
|
@ -70,14 +70,14 @@ public class MenuController {
|
|||
@ApiOperation("返回全部的菜单")
|
||||
@GetMapping(value = "/lazy")
|
||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Long pid){
|
||||
public ResponseEntity<Object> queryAllMenu(@RequestParam Long pid){
|
||||
return new ResponseEntity<>(menuService.getMenus(pid),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("根据菜单ID返回所有子节点ID,包含自身ID")
|
||||
@GetMapping(value = "/child")
|
||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||
public ResponseEntity<Object> child(@RequestParam Long id){
|
||||
public ResponseEntity<Object> childMenu(@RequestParam Long id){
|
||||
Set<Menu> menuSet = new HashSet<>();
|
||||
List<MenuDto> menuList = menuService.getMenus(id);
|
||||
menuSet.add(menuService.findOne(id));
|
||||
|
@ -89,7 +89,7 @@ public class MenuController {
|
|||
@GetMapping
|
||||
@ApiOperation("查询菜单")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public ResponseEntity<Object> query(MenuQueryCriteria criteria) throws Exception {
|
||||
public ResponseEntity<Object> queryMenu(MenuQueryCriteria criteria) throws Exception {
|
||||
List<MenuDto> menuDtoList = menuService.queryAll(criteria, true);
|
||||
return new ResponseEntity<>(PageUtil.toPage(menuDtoList, menuDtoList.size()),HttpStatus.OK);
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class MenuController {
|
|||
@ApiOperation("查询菜单:根据ID获取同级与上级数据")
|
||||
@PostMapping("/superior")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public ResponseEntity<Object> getSuperior(@RequestBody List<Long> ids) {
|
||||
public ResponseEntity<Object> getMenuSuperior(@RequestBody List<Long> ids) {
|
||||
Set<MenuDto> menuDtos = new LinkedHashSet<>();
|
||||
if(CollectionUtil.isNotEmpty(ids)){
|
||||
for (Long id : ids) {
|
||||
|
@ -113,7 +113,7 @@ public class MenuController {
|
|||
@ApiOperation("新增菜单")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('menu:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Menu resources){
|
||||
public ResponseEntity<Object> createMenu(@Validated @RequestBody Menu resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public class MenuController {
|
|||
@ApiOperation("修改菜单")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('menu:edit')")
|
||||
public ResponseEntity<Object> update(@Validated(Menu.Update.class) @RequestBody Menu resources){
|
||||
public ResponseEntity<Object> updateMenu(@Validated(Menu.Update.class) @RequestBody Menu resources){
|
||||
menuService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ public class MenuController {
|
|||
@ApiOperation("删除菜单")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('menu:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
public ResponseEntity<Object> deleteMenu(@RequestBody Set<Long> ids){
|
||||
Set<Menu> menuSet = new HashSet<>();
|
||||
for (Long id : ids) {
|
||||
List<MenuDto> menuList = menuService.getMenus(id);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class MonitorController {
|
|||
@GetMapping
|
||||
@ApiOperation("查询服务监控")
|
||||
@PreAuthorize("@el.check('monitor:list')")
|
||||
public ResponseEntity<Object> query(){
|
||||
public ResponseEntity<Object> queryMonitor(){
|
||||
return new ResponseEntity<>(serverService.getServers(),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,34 +57,34 @@ public class RoleController {
|
|||
@ApiOperation("获取单个role")
|
||||
@GetMapping(value = "/{id}")
|
||||
@PreAuthorize("@el.check('roles:list')")
|
||||
public ResponseEntity<Object> query(@PathVariable Long id){
|
||||
public ResponseEntity<Object> findRoleById(@PathVariable Long id){
|
||||
return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出角色数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('role:list')")
|
||||
public void download(HttpServletResponse response, RoleQueryCriteria criteria) throws IOException {
|
||||
public void exportRole(HttpServletResponse response, RoleQueryCriteria criteria) throws IOException {
|
||||
roleService.download(roleService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("返回全部的角色")
|
||||
@GetMapping(value = "/all")
|
||||
@PreAuthorize("@el.check('roles:list','user:add','user:edit')")
|
||||
public ResponseEntity<Object> query(){
|
||||
public ResponseEntity<Object> queryAllRole(){
|
||||
return new ResponseEntity<>(roleService.queryAll(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询角色")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('roles:list')")
|
||||
public ResponseEntity<Object> query(RoleQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryRole(RoleQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(roleService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户级别")
|
||||
@GetMapping(value = "/level")
|
||||
public ResponseEntity<Object> getLevel(){
|
||||
public ResponseEntity<Object> getRoleLevel(){
|
||||
return new ResponseEntity<>(Dict.create().set("level", getLevels(null)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class RoleController {
|
|||
@ApiOperation("新增角色")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('roles:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Role resources){
|
||||
public ResponseEntity<Object> createRole(@Validated @RequestBody Role resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class RoleController {
|
|||
@ApiOperation("修改角色")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('roles:edit')")
|
||||
public ResponseEntity<Object> update(@Validated(Role.Update.class) @RequestBody Role resources){
|
||||
public ResponseEntity<Object> updateRole(@Validated(Role.Update.class) @RequestBody Role resources){
|
||||
getLevels(resources.getLevel());
|
||||
roleService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
|
@ -115,7 +115,7 @@ public class RoleController {
|
|||
@ApiOperation("修改角色菜单")
|
||||
@PutMapping(value = "/menu")
|
||||
@PreAuthorize("@el.check('roles:edit')")
|
||||
public ResponseEntity<Object> updateMenu(@RequestBody Role resources){
|
||||
public ResponseEntity<Object> updateRoleMenu(@RequestBody Role resources){
|
||||
RoleDto role = roleService.findById(resources.getId());
|
||||
getLevels(role.getLevel());
|
||||
roleService.updateMenu(resources,role);
|
||||
|
@ -126,7 +126,7 @@ public class RoleController {
|
|||
@ApiOperation("删除角色")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('roles:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
public ResponseEntity<Object> deleteRole(@RequestBody Set<Long> ids){
|
||||
for (Long id : ids) {
|
||||
RoleDto role = roleService.findById(id);
|
||||
getLevels(role.getLevel());
|
||||
|
|
|
@ -70,14 +70,14 @@ public class UserController {
|
|||
@ApiOperation("导出用户数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
public void download(HttpServletResponse response, UserQueryCriteria criteria) throws IOException {
|
||||
public void exportUser(HttpServletResponse response, UserQueryCriteria criteria) throws IOException {
|
||||
userService.download(userService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
public ResponseEntity<Object> query(UserQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryUser(UserQueryCriteria criteria, Pageable pageable){
|
||||
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
|
||||
criteria.getDeptIds().add(criteria.getDeptId());
|
||||
// 先查找是否存在子节点
|
||||
|
@ -106,7 +106,7 @@ public class UserController {
|
|||
@ApiOperation("新增用户")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('user:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody User resources){
|
||||
public ResponseEntity<Object> createUser(@Validated @RequestBody User resources){
|
||||
checkLevel(resources);
|
||||
// 默认密码 123456
|
||||
resources.setPassword(passwordEncoder.encode("123456"));
|
||||
|
@ -118,7 +118,7 @@ public class UserController {
|
|||
@ApiOperation("修改用户")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('user:edit')")
|
||||
public ResponseEntity<Object> update(@Validated(User.Update.class) @RequestBody User resources) throws Exception {
|
||||
public ResponseEntity<Object> updateUser(@Validated(User.Update.class) @RequestBody User resources) throws Exception {
|
||||
checkLevel(resources);
|
||||
userService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
|
@ -127,7 +127,7 @@ public class UserController {
|
|||
@Log("修改用户:个人中心")
|
||||
@ApiOperation("修改用户:个人中心")
|
||||
@PutMapping(value = "center")
|
||||
public ResponseEntity<Object> center(@Validated(User.Update.class) @RequestBody User resources){
|
||||
public ResponseEntity<Object> centerUser(@Validated(User.Update.class) @RequestBody User resources){
|
||||
if(!resources.getId().equals(SecurityUtils.getCurrentUserId())){
|
||||
throw new BadRequestException("不能修改他人资料");
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class UserController {
|
|||
@ApiOperation("删除用户")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('user:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
public ResponseEntity<Object> deleteUser(@RequestBody Set<Long> ids){
|
||||
for (Long id : ids) {
|
||||
Integer currentLevel = Collections.min(roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
|
||||
Integer optLevel = Collections.min(roleService.findByUsersId(id).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
|
||||
|
@ -153,7 +153,7 @@ public class UserController {
|
|||
|
||||
@ApiOperation("修改密码")
|
||||
@PostMapping(value = "/updatePass")
|
||||
public ResponseEntity<Object> updatePass(@RequestBody UserPassVo passVo) throws Exception {
|
||||
public ResponseEntity<Object> updateUserPass(@RequestBody UserPassVo passVo) throws Exception {
|
||||
String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getOldPass());
|
||||
String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getNewPass());
|
||||
UserDto user = userService.findByName(SecurityUtils.getCurrentUsername());
|
||||
|
@ -169,14 +169,14 @@ public class UserController {
|
|||
|
||||
@ApiOperation("修改头像")
|
||||
@PostMapping(value = "/updateAvatar")
|
||||
public ResponseEntity<Object> updateAvatar(@RequestParam MultipartFile avatar){
|
||||
public ResponseEntity<Object> updateUserAvatar(@RequestParam MultipartFile avatar){
|
||||
return new ResponseEntity<>(userService.updateAvatar(avatar), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("修改邮箱")
|
||||
@ApiOperation("修改邮箱")
|
||||
@PostMapping(value = "/updateEmail/{code}")
|
||||
public ResponseEntity<Object> updateEmail(@PathVariable String code,@RequestBody User user) throws Exception {
|
||||
public ResponseEntity<Object> updateUserEmail(@PathVariable String code,@RequestBody User user) throws Exception {
|
||||
String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,user.getPassword());
|
||||
UserDto userDto = userService.findByName(SecurityUtils.getCurrentUsername());
|
||||
if(!passwordEncoder.matches(password, userDto.getPassword())){
|
||||
|
|
|
@ -48,6 +48,7 @@ public interface UserService {
|
|||
/**
|
||||
* 编辑用户
|
||||
* @param resources /
|
||||
* @throws Exception /
|
||||
*/
|
||||
void update(User resources) throws Exception;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ${className}Controller {
|
|||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('${changeClassName}:list')")
|
||||
public void download(HttpServletResponse response, ${className}QueryCriteria criteria) throws IOException {
|
||||
public void export${className}(HttpServletResponse response, ${className}QueryCriteria criteria) throws IOException {
|
||||
${changeClassName}Service.download(${changeClassName}Service.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class ${className}Controller {
|
|||
@Log("查询${apiAlias}")
|
||||
@ApiOperation("查询${apiAlias}")
|
||||
@PreAuthorize("@el.check('${changeClassName}:list')")
|
||||
public ResponseEntity<Object> query(${className}QueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> query${className}(${className}QueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(${changeClassName}Service.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class ${className}Controller {
|
|||
@Log("新增${apiAlias}")
|
||||
@ApiOperation("新增${apiAlias}")
|
||||
@PreAuthorize("@el.check('${changeClassName}:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody ${className} resources){
|
||||
public ResponseEntity<Object> create${className}(@Validated @RequestBody ${className} resources){
|
||||
return new ResponseEntity<>(${changeClassName}Service.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
@ -71,16 +71,16 @@ public class ${className}Controller {
|
|||
@Log("修改${apiAlias}")
|
||||
@ApiOperation("修改${apiAlias}")
|
||||
@PreAuthorize("@el.check('${changeClassName}:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody ${className} resources){
|
||||
public ResponseEntity<Object> update${className}(@Validated @RequestBody ${className} resources){
|
||||
${changeClassName}Service.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除${apiAlias}")
|
||||
@ApiOperation("删除${apiAlias}")
|
||||
@PreAuthorize("@el.check('${changeClassName}:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody ${pkColumnType}[] ids) {
|
||||
public ResponseEntity<Object> delete${className}(@RequestBody ${pkColumnType}[] ids) {
|
||||
${changeClassName}Service.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -53,14 +53,14 @@ public class AliPayController {
|
|||
private final AliPayService alipayService;
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<AlipayConfig> queryConfig() {
|
||||
public ResponseEntity<AlipayConfig> queryAliConfig() {
|
||||
return new ResponseEntity<>(alipayService.find(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("配置支付宝")
|
||||
@ApiOperation("配置支付宝")
|
||||
@PutMapping
|
||||
public ResponseEntity<Object> updateConfig(@Validated @RequestBody AlipayConfig alipayConfig) {
|
||||
public ResponseEntity<Object> updateAliPayConfig(@Validated @RequestBody AlipayConfig alipayConfig) {
|
||||
alipayService.config(alipayConfig);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -41,14 +41,14 @@ public class EmailController {
|
|||
private final EmailService emailService;
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Object> queryConfig(){
|
||||
public ResponseEntity<Object> queryEmailConfig(){
|
||||
return new ResponseEntity<>(emailService.find(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("配置邮件")
|
||||
@PutMapping
|
||||
@ApiOperation("配置邮件")
|
||||
public ResponseEntity<Object> updateConfig(@Validated @RequestBody EmailConfig emailConfig) throws Exception {
|
||||
public ResponseEntity<Object> updateEmailConfig(@Validated @RequestBody EmailConfig emailConfig) throws Exception {
|
||||
emailService.config(emailConfig,emailService.find());
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -45,31 +45,31 @@ public class LocalStorageController {
|
|||
|
||||
private final LocalStorageService localStorageService;
|
||||
|
||||
@ApiOperation("查询文件")
|
||||
@GetMapping
|
||||
@ApiOperation("查询文件")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public ResponseEntity<Object> query(LocalStorageQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryFile(LocalStorageQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(localStorageService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public void download(HttpServletResponse response, LocalStorageQueryCriteria criteria) throws IOException {
|
||||
public void exportFile(HttpServletResponse response, LocalStorageQueryCriteria criteria) throws IOException {
|
||||
localStorageService.download(localStorageService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
@PostMapping
|
||||
@ApiOperation("上传文件")
|
||||
@PreAuthorize("@el.check('storage:add')")
|
||||
public ResponseEntity<Object> create(@RequestParam String name, @RequestParam("file") MultipartFile file){
|
||||
public ResponseEntity<Object> createFile(@RequestParam String name, @RequestParam("file") MultipartFile file){
|
||||
localStorageService.create(name, file);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping("/pictures")
|
||||
@ApiOperation("上传图片")
|
||||
public ResponseEntity<Object> upload(@RequestParam MultipartFile file){
|
||||
@PostMapping("/pictures")
|
||||
public ResponseEntity<Object> uploadPicture(@RequestParam MultipartFile file){
|
||||
// 判断文件是否为图片
|
||||
String suffix = FileUtil.getExtensionName(file.getOriginalFilename());
|
||||
if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){
|
||||
|
@ -79,11 +79,11 @@ public class LocalStorageController {
|
|||
return new ResponseEntity<>(localStorage, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改文件")
|
||||
@ApiOperation("修改文件")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('storage:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody LocalStorage resources){
|
||||
public ResponseEntity<Object> updateFile(@Validated @RequestBody LocalStorage resources){
|
||||
localStorageService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class LocalStorageController {
|
|||
@Log("删除文件")
|
||||
@DeleteMapping
|
||||
@ApiOperation("多选删除")
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
public ResponseEntity<Object> deleteFile(@RequestBody Long[] ids) {
|
||||
localStorageService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -50,14 +50,14 @@ public class QiniuController {
|
|||
private final QiNiuService qiNiuService;
|
||||
|
||||
@GetMapping(value = "/config")
|
||||
public ResponseEntity<Object> queryConfig(){
|
||||
public ResponseEntity<Object> queryQiNiuConfig(){
|
||||
return new ResponseEntity<>(qiNiuService.find(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("配置七牛云存储")
|
||||
@ApiOperation("配置七牛云存储")
|
||||
@PutMapping(value = "/config")
|
||||
public ResponseEntity<Object> updateConfig(@Validated @RequestBody QiniuConfig qiniuConfig){
|
||||
public ResponseEntity<Object> updateQiNiuConfig(@Validated @RequestBody QiniuConfig qiniuConfig){
|
||||
qiNiuService.config(qiniuConfig);
|
||||
qiNiuService.update(qiniuConfig.getType());
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
@ -65,20 +65,20 @@ public class QiniuController {
|
|||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(HttpServletResponse response, QiniuQueryCriteria criteria) throws IOException {
|
||||
public void exportQiNiu(HttpServletResponse response, QiniuQueryCriteria criteria) throws IOException {
|
||||
qiNiuService.downloadList(qiNiuService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询文件")
|
||||
@GetMapping
|
||||
public ResponseEntity<Object> query(QiniuQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity<Object> queryQiNiu(QiniuQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(qiNiuService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("上传文件")
|
||||
@ApiOperation("上传文件")
|
||||
@PostMapping
|
||||
public ResponseEntity<Object> upload(@RequestParam MultipartFile file){
|
||||
public ResponseEntity<Object> uploadQiNiu(@RequestParam MultipartFile file){
|
||||
QiniuContent qiniuContent = qiNiuService.upload(file,qiNiuService.find());
|
||||
Map<String,Object> map = new HashMap<>(3);
|
||||
map.put("id",qiniuContent.getId());
|
||||
|
@ -90,7 +90,7 @@ public class QiniuController {
|
|||
@Log("同步七牛云数据")
|
||||
@ApiOperation("同步七牛云数据")
|
||||
@PostMapping(value = "/synchronize")
|
||||
public ResponseEntity<Object> synchronize(){
|
||||
public ResponseEntity<Object> synchronizeQiNiu(){
|
||||
qiNiuService.synchronize(qiNiuService.find());
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class QiniuController {
|
|||
@Log("下载文件")
|
||||
@ApiOperation("下载文件")
|
||||
@GetMapping(value = "/download/{id}")
|
||||
public ResponseEntity<Object> download(@PathVariable Long id){
|
||||
public ResponseEntity<Object> downloadQiNiu(@PathVariable Long id){
|
||||
Map<String,Object> map = new HashMap<>(1);
|
||||
map.put("url", qiNiuService.download(qiNiuService.findByContentId(id),qiNiuService.find()));
|
||||
return new ResponseEntity<>(map,HttpStatus.OK);
|
||||
|
@ -107,7 +107,7 @@ public class QiniuController {
|
|||
@Log("删除文件")
|
||||
@ApiOperation("删除文件")
|
||||
@DeleteMapping(value = "/{id}")
|
||||
public ResponseEntity<Object> delete(@PathVariable Long id){
|
||||
public ResponseEntity<Object> deleteQiNiu(@PathVariable Long id){
|
||||
qiNiuService.delete(qiNiuService.findByContentId(id),qiNiuService.find());
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class QiniuController {
|
|||
@Log("删除多张图片")
|
||||
@ApiOperation("删除多张图片")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> deleteAll(@RequestBody Long[] ids) {
|
||||
public ResponseEntity<Object> deleteAllQiNiu(@RequestBody Long[] ids) {
|
||||
qiNiuService.deleteAll(ids, qiNiuService.find());
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue