From c75b52e15bd1f7e3c989ed79ab6520d0ecbacb8c Mon Sep 17 00:00:00 2001 From: Zheng Jie <201507802@qq.com> Date: Sun, 26 Dec 2021 16:42:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9Controller=E4=B8=AD=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E5=90=8D=E7=A7=B0=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 命名重复会打印如下日志,不介意的可以不修改: s.d.s.w.s.ApiListingReferenceScanner: Generating unique operation named --- .../java/me/zhengjie/config/RedisConfig.java | 2 +- .../me/zhengjie/rest/GenConfigController.java | 6 ++-- .../me/zhengjie/rest/GeneratorController.java | 8 ++--- .../java/me/zhengjie/rest/LogController.java | 8 ++--- .../zhengjie/service/impl/LogServiceImpl.java | 2 +- .../config/thread/AsyncTaskExecutePool.java | 15 +++------- .../config/thread/AsyncTaskProperties.java | 30 +++++++++++++++---- .../config/thread/ThreadPoolExecutorUtil.java | 11 +++---- .../modules/mnt/rest/AppController.java | 10 +++---- .../modules/mnt/rest/DatabaseController.java | 12 ++++---- .../modules/mnt/rest/DeployController.java | 12 ++++---- .../mnt/rest/DeployHistoryController.java | 6 ++-- .../mnt/rest/ServerDeployController.java | 12 ++++---- .../quartz/rest/QuartzJobController.java | 18 +++++------ .../security/rest/OnlineController.java | 6 ++-- .../modules/system/rest/DeptController.java | 12 ++++---- .../modules/system/rest/DictController.java | 12 ++++---- .../system/rest/DictDetailController.java | 8 ++--- .../modules/system/rest/JobController.java | 10 +++---- .../modules/system/rest/LimitController.java | 2 +- .../modules/system/rest/MenuController.java | 16 +++++----- .../system/rest/MonitorController.java | 2 +- .../modules/system/rest/RoleController.java | 18 +++++------ .../modules/system/rest/UserController.java | 18 +++++------ .../modules/system/service/UserService.java | 1 + .../template/generator/admin/Controller.ftl | 12 ++++---- .../me/zhengjie/rest/AliPayController.java | 4 +-- .../me/zhengjie/rest/EmailController.java | 4 +-- .../zhengjie/rest/LocalStorageController.java | 20 ++++++------- .../me/zhengjie/rest/QiniuController.java | 18 +++++------ 30 files changed, 163 insertions(+), 152 deletions(-) diff --git a/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java b/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java index 3994a030..aa383f64 100644 --- a/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java +++ b/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java @@ -98,7 +98,7 @@ public class RedisConfig extends CachingConfigurerSupport { @Override public KeyGenerator keyGenerator() { return (target, method, params) -> { - Map container = new HashMap<>(); + Map container = new HashMap<>(4); Class targetClassClass = target.getClass(); // 类地址 container.put("class",targetClassClass.toGenericString()); diff --git a/eladmin-generator/src/main/java/me/zhengjie/rest/GenConfigController.java b/eladmin-generator/src/main/java/me/zhengjie/rest/GenConfigController.java index 98ec149c..1c099993 100644 --- a/eladmin-generator/src/main/java/me/zhengjie/rest/GenConfigController.java +++ b/eladmin-generator/src/main/java/me/zhengjie/rest/GenConfigController.java @@ -39,13 +39,13 @@ public class GenConfigController { @ApiOperation("查询") @GetMapping(value = "/{tableName}") - public ResponseEntity query(@PathVariable String tableName){ + public ResponseEntity queryGenConfig(@PathVariable String tableName){ return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK); } - @ApiOperation("修改") @PutMapping - public ResponseEntity update(@Validated @RequestBody GenConfig genConfig){ + @ApiOperation("修改") + public ResponseEntity updateGenConfig(@Validated @RequestBody GenConfig genConfig){ return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig),HttpStatus.OK); } } diff --git a/eladmin-generator/src/main/java/me/zhengjie/rest/GeneratorController.java b/eladmin-generator/src/main/java/me/zhengjie/rest/GeneratorController.java index ce6a17d1..bfdfecc0 100644 --- a/eladmin-generator/src/main/java/me/zhengjie/rest/GeneratorController.java +++ b/eladmin-generator/src/main/java/me/zhengjie/rest/GeneratorController.java @@ -49,7 +49,7 @@ public class GeneratorController { @ApiOperation("查询数据库数据") @GetMapping(value = "/tables/all") - public ResponseEntity queryTables(){ + public ResponseEntity queryAllTables(){ return new ResponseEntity<>(generatorService.getTables(), HttpStatus.OK); } @@ -71,14 +71,14 @@ public class GeneratorController { @ApiOperation("保存字段数据") @PutMapping - public ResponseEntity save(@RequestBody List columnInfos){ + public ResponseEntity saveColumn(@RequestBody List columnInfos){ generatorService.save(columnInfos); return new ResponseEntity<>(HttpStatus.OK); } @ApiOperation("同步字段数据") @PostMapping(value = "sync") - public ResponseEntity sync(@RequestBody List tables){ + public ResponseEntity syncColumn(@RequestBody List 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 generator(@PathVariable String tableName, @PathVariable Integer type, HttpServletRequest request, HttpServletResponse response){ + public ResponseEntity generatorCode(@PathVariable String tableName, @PathVariable Integer type, HttpServletRequest request, HttpServletResponse response){ if(!generatorEnabled && type == 0){ throw new BadRequestException("此环境不允许生成代码,请选择预览或者下载查看!"); } diff --git a/eladmin-logging/src/main/java/me/zhengjie/rest/LogController.java b/eladmin-logging/src/main/java/me/zhengjie/rest/LogController.java index 693d0cde..4a6516a8 100644 --- a/eladmin-logging/src/main/java/me/zhengjie/rest/LogController.java +++ b/eladmin-logging/src/main/java/me/zhengjie/rest/LogController.java @@ -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 query(LogQueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 queryErrorLogs(@PathVariable Long id){ + public ResponseEntity queryErrorLogDetail(@PathVariable Long id){ return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK); } @DeleteMapping(value = "/del/error") diff --git a/eladmin-logging/src/main/java/me/zhengjie/service/impl/LogServiceImpl.java b/eladmin-logging/src/main/java/me/zhengjie/service/impl/LogServiceImpl.java index be50ea1a..ecc6efb8 100644 --- a/eladmin-logging/src/main/java/me/zhengjie/service/impl/LogServiceImpl.java +++ b/eladmin-logging/src/main/java/me/zhengjie/service/impl/LogServiceImpl.java @@ -113,7 +113,7 @@ public class LogServiceImpl implements LogService { //将RequestParam注解修饰的参数作为请求参数 RequestParam requestParam = parameters[i].getAnnotation(RequestParam.class); if (requestParam != null) { - Map map = new HashMap<>(); + Map map = new HashMap<>(4); String key = parameters[i].getName(); if (!StringUtils.isEmpty(requestParam.value())) { key = requestParam.value(); diff --git a/eladmin-system/src/main/java/me/zhengjie/config/thread/AsyncTaskExecutePool.java b/eladmin-system/src/main/java/me/zhengjie/config/thread/AsyncTaskExecutePool.java index 8df107ec..133cf55f 100644 --- a/eladmin-system/src/main/java/me/zhengjie/config/thread/AsyncTaskExecutePool.java +++ b/eladmin-system/src/main/java/me/zhengjie/config/thread/AsyncTaskExecutePool.java @@ -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的时候,如何处理新任务 diff --git a/eladmin-system/src/main/java/me/zhengjie/config/thread/AsyncTaskProperties.java b/eladmin-system/src/main/java/me/zhengjie/config/thread/AsyncTaskProperties.java index 21fdfd8e..6e075eab 100644 --- a/eladmin-system/src/main/java/me/zhengjie/config/thread/AsyncTaskProperties.java +++ b/eladmin-system/src/main/java/me/zhengjie/config/thread/AsyncTaskProperties.java @@ -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; + } } diff --git a/eladmin-system/src/main/java/me/zhengjie/config/thread/ThreadPoolExecutorUtil.java b/eladmin-system/src/main/java/me/zhengjie/config/thread/ThreadPoolExecutorUtil.java index 9a36abd3..8e04aa2b 100644 --- a/eladmin-system/src/main/java/me/zhengjie/config/thread/ThreadPoolExecutorUtil.java +++ b/eladmin-system/src/main/java/me/zhengjie/config/thread/ThreadPoolExecutorUtil.java @@ -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() ); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java index 9b5b08fa..61ce07c1 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java @@ -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 query(AppQueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 create(@Validated @RequestBody App resources){ + public ResponseEntity 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 update(@Validated @RequestBody App resources){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteApp(@RequestBody Set ids){ appService.delete(ids); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java index 9dfb43cc..215c802a 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java @@ -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 query(DatabaseQueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 create(@Validated @RequestBody Database resources){ + public ResponseEntity 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 update(@Validated @RequestBody Database resources){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteDatabase(@RequestBody Set 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 upload(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{ + public ResponseEntity uploadDatabase(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{ String id = request.getParameter("id"); DatabaseDto database = databaseService.findById(id); String fileName; diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java index 72b7b3e1..38197e82 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java @@ -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 query(DeployQueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 create(@Validated @RequestBody Deploy resources){ + public ResponseEntity 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 update(@Validated @RequestBody Deploy resources){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteDeploy(@RequestBody Set 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 upload(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{ + public ResponseEntity uploadDeploy(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{ Long id = Long.valueOf(request.getParameter("id")); String fileName = ""; if(file != null){ diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployHistoryController.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployHistoryController.java index 49fb6946..2d1037ba 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployHistoryController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployHistoryController.java @@ -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 query(DeployHistoryQueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteDeployHistory(@RequestBody Set ids){ deployhistoryService.delete(ids); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java index d4a135bf..894a90a9 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java @@ -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 query(ServerDeployQueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 create(@Validated @RequestBody ServerDeploy resources){ + public ResponseEntity 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 update(@Validated @RequestBody ServerDeploy resources){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteServerDeploy(@RequestBody Set 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 testConnect(@Validated @RequestBody ServerDeploy resources){ + public ResponseEntity testConnectServerDeploy(@Validated @RequestBody ServerDeploy resources){ return new ResponseEntity<>(serverDeployService.testConnect(resources),HttpStatus.CREATED); } } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java b/eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java index b4cb1cd4..31613572 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java @@ -51,28 +51,28 @@ public class QuartzJobController { @ApiOperation("查询定时任务") @GetMapping @PreAuthorize("@el.check('timing:list')") - public ResponseEntity query(JobQueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 queryJobLog(JobQueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 create(@Validated @RequestBody QuartzJob resources){ + public ResponseEntity 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 update(@Validated(QuartzJob.Update.class) @RequestBody QuartzJob resources){ + public ResponseEntity 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 update(@PathVariable Long id){ + public ResponseEntity 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 execution(@PathVariable Long id){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteQuartzJob(@RequestBody Set ids){ quartzJobService.delete(ids); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/OnlineController.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/OnlineController.java index 4b545d31..8b91fdfd 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/OnlineController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/OnlineController.java @@ -43,21 +43,21 @@ public class OnlineController { @ApiOperation("查询在线用户") @GetMapping @PreAuthorize("@el.check()") - public ResponseEntity query(String filter, Pageable pageable){ + public ResponseEntity 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 delete(@RequestBody Set keys) throws Exception { + public ResponseEntity deleteOnlineUser(@RequestBody Set keys) throws Exception { for (String key : keys) { // 解密Key key = EncryptUtils.desDecrypt(key); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java index 9b3b0ef2..99624306 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java @@ -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 query(DeptQueryCriteria criteria) throws Exception { + public ResponseEntity queryDept(DeptQueryCriteria criteria) throws Exception { List 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 getSuperior(@RequestBody List ids) { + public ResponseEntity getDeptSuperior(@RequestBody List ids) { Set 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 create(@Validated @RequestBody Dept resources){ + public ResponseEntity 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 update(@Validated(Dept.Update.class) @RequestBody Dept resources){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteDept(@RequestBody Set ids){ Set deptDtos = new HashSet<>(); for (Long id : ids) { List deptList = deptService.findByPid(id); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java index f1e4d58c..70705781 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java @@ -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 queryAll(){ + public ResponseEntity queryAllDict(){ return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK); } @ApiOperation("查询字典") @GetMapping @PreAuthorize("@el.check('dict:list')") - public ResponseEntity query(DictQueryCriteria resources, Pageable pageable){ + public ResponseEntity 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 create(@Validated @RequestBody Dict resources){ + public ResponseEntity 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 update(@Validated(Dict.Update.class) @RequestBody Dict resources){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteDict(@RequestBody Set ids){ dictService.delete(ids); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java index 92f65fdc..8ddbfe4b 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java @@ -51,7 +51,7 @@ public class DictDetailController { @ApiOperation("查询字典详情") @GetMapping - public ResponseEntity query(DictDetailQueryCriteria criteria, + public ResponseEntity 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 create(@Validated @RequestBody DictDetail resources){ + public ResponseEntity 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 update(@Validated(DictDetail.Update.class) @RequestBody DictDetail resources){ + public ResponseEntity 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 delete(@PathVariable Long id){ + public ResponseEntity deleteDictDetail(@PathVariable Long id){ dictDetailService.delete(id); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java index cac14c09..d904e278 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java @@ -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 query(JobQueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 create(@Validated @RequestBody Job resources){ + public ResponseEntity 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 update(@Validated(Job.Update.class) @RequestBody Job resources){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteJob(@RequestBody Set ids){ // 验证是否被用户关联 jobService.verification(ids); jobService.delete(ids); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/LimitController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/LimitController.java index 329c5ac6..02db642e 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/LimitController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/LimitController.java @@ -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(); } } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java index d5461a2f..66a1e82c 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java @@ -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 query(@RequestParam Long pid){ + public ResponseEntity 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 child(@RequestParam Long id){ + public ResponseEntity childMenu(@RequestParam Long id){ Set menuSet = new HashSet<>(); List 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 query(MenuQueryCriteria criteria) throws Exception { + public ResponseEntity queryMenu(MenuQueryCriteria criteria) throws Exception { List 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 getSuperior(@RequestBody List ids) { + public ResponseEntity getMenuSuperior(@RequestBody List ids) { Set 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 create(@Validated @RequestBody Menu resources){ + public ResponseEntity 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 update(@Validated(Menu.Update.class) @RequestBody Menu resources){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteMenu(@RequestBody Set ids){ Set menuSet = new HashSet<>(); for (Long id : ids) { List menuList = menuService.getMenus(id); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MonitorController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MonitorController.java index 35ac0c54..bb0e39b4 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MonitorController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MonitorController.java @@ -39,7 +39,7 @@ public class MonitorController { @GetMapping @ApiOperation("查询服务监控") @PreAuthorize("@el.check('monitor:list')") - public ResponseEntity query(){ + public ResponseEntity queryMonitor(){ return new ResponseEntity<>(serverService.getServers(),HttpStatus.OK); } } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java index a1edc931..f4f9f5e3 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java @@ -57,34 +57,34 @@ public class RoleController { @ApiOperation("获取单个role") @GetMapping(value = "/{id}") @PreAuthorize("@el.check('roles:list')") - public ResponseEntity query(@PathVariable Long id){ + public ResponseEntity 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 query(){ + public ResponseEntity queryAllRole(){ return new ResponseEntity<>(roleService.queryAll(),HttpStatus.OK); } @ApiOperation("查询角色") @GetMapping @PreAuthorize("@el.check('roles:list')") - public ResponseEntity query(RoleQueryCriteria criteria, Pageable pageable){ + public ResponseEntity queryRole(RoleQueryCriteria criteria, Pageable pageable){ return new ResponseEntity<>(roleService.queryAll(criteria,pageable),HttpStatus.OK); } @ApiOperation("获取用户级别") @GetMapping(value = "/level") - public ResponseEntity getLevel(){ + public ResponseEntity 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 create(@Validated @RequestBody Role resources){ + public ResponseEntity 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 update(@Validated(Role.Update.class) @RequestBody Role resources){ + public ResponseEntity 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 updateMenu(@RequestBody Role resources){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteRole(@RequestBody Set ids){ for (Long id : ids) { RoleDto role = roleService.findById(id); getLevels(role.getLevel()); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java index dfff4ecc..ed8e51fb 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java @@ -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 query(UserQueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 create(@Validated @RequestBody User resources){ + public ResponseEntity 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 update(@Validated(User.Update.class) @RequestBody User resources) throws Exception { + public ResponseEntity 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 center(@Validated(User.Update.class) @RequestBody User resources){ + public ResponseEntity 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 delete(@RequestBody Set ids){ + public ResponseEntity deleteUser(@RequestBody Set 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 updatePass(@RequestBody UserPassVo passVo) throws Exception { + public ResponseEntity 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 updateAvatar(@RequestParam MultipartFile avatar){ + public ResponseEntity updateUserAvatar(@RequestParam MultipartFile avatar){ return new ResponseEntity<>(userService.updateAvatar(avatar), HttpStatus.OK); } @Log("修改邮箱") @ApiOperation("修改邮箱") @PostMapping(value = "/updateEmail/{code}") - public ResponseEntity updateEmail(@PathVariable String code,@RequestBody User user) throws Exception { + public ResponseEntity 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())){ diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java index 814af925..babf592f 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java @@ -48,6 +48,7 @@ public interface UserService { /** * 编辑用户 * @param resources / + * @throws Exception / */ void update(User resources) throws Exception; diff --git a/eladmin-system/src/main/resources/template/generator/admin/Controller.ftl b/eladmin-system/src/main/resources/template/generator/admin/Controller.ftl index 5a6aa1e0..f81e280f 100644 --- a/eladmin-system/src/main/resources/template/generator/admin/Controller.ftl +++ b/eladmin-system/src/main/resources/template/generator/admin/Controller.ftl @@ -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 query(${className}QueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 create(@Validated @RequestBody ${className} resources){ + public ResponseEntity 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 update(@Validated @RequestBody ${className} resources){ + public ResponseEntity 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 delete(@RequestBody ${pkColumnType}[] ids) { + public ResponseEntity delete${className}(@RequestBody ${pkColumnType}[] ids) { ${changeClassName}Service.deleteAll(ids); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java b/eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java index 128bb404..0c03d0ae 100644 --- a/eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java +++ b/eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java @@ -53,14 +53,14 @@ public class AliPayController { private final AliPayService alipayService; @GetMapping - public ResponseEntity queryConfig() { + public ResponseEntity queryAliConfig() { return new ResponseEntity<>(alipayService.find(), HttpStatus.OK); } @Log("配置支付宝") @ApiOperation("配置支付宝") @PutMapping - public ResponseEntity updateConfig(@Validated @RequestBody AlipayConfig alipayConfig) { + public ResponseEntity updateAliPayConfig(@Validated @RequestBody AlipayConfig alipayConfig) { alipayService.config(alipayConfig); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/eladmin-tools/src/main/java/me/zhengjie/rest/EmailController.java b/eladmin-tools/src/main/java/me/zhengjie/rest/EmailController.java index 974de998..952f8ba2 100644 --- a/eladmin-tools/src/main/java/me/zhengjie/rest/EmailController.java +++ b/eladmin-tools/src/main/java/me/zhengjie/rest/EmailController.java @@ -41,14 +41,14 @@ public class EmailController { private final EmailService emailService; @GetMapping - public ResponseEntity queryConfig(){ + public ResponseEntity queryEmailConfig(){ return new ResponseEntity<>(emailService.find(),HttpStatus.OK); } @Log("配置邮件") @PutMapping @ApiOperation("配置邮件") - public ResponseEntity updateConfig(@Validated @RequestBody EmailConfig emailConfig) throws Exception { + public ResponseEntity updateEmailConfig(@Validated @RequestBody EmailConfig emailConfig) throws Exception { emailService.config(emailConfig,emailService.find()); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java b/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java index 6d7083de..45f39366 100644 --- a/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java +++ b/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java @@ -45,31 +45,31 @@ public class LocalStorageController { private final LocalStorageService localStorageService; - @ApiOperation("查询文件") @GetMapping + @ApiOperation("查询文件") @PreAuthorize("@el.check('storage:list')") - public ResponseEntity query(LocalStorageQueryCriteria criteria, Pageable pageable){ + public ResponseEntity 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 create(@RequestParam String name, @RequestParam("file") MultipartFile file){ + public ResponseEntity createFile(@RequestParam String name, @RequestParam("file") MultipartFile file){ localStorageService.create(name, file); return new ResponseEntity<>(HttpStatus.CREATED); } - @PostMapping("/pictures") @ApiOperation("上传图片") - public ResponseEntity upload(@RequestParam MultipartFile file){ + @PostMapping("/pictures") + public ResponseEntity 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 update(@Validated @RequestBody LocalStorage resources){ + public ResponseEntity 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 delete(@RequestBody Long[] ids) { + public ResponseEntity deleteFile(@RequestBody Long[] ids) { localStorageService.deleteAll(ids); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java b/eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java index 1bb32d71..a601bdfd 100644 --- a/eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java +++ b/eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java @@ -50,14 +50,14 @@ public class QiniuController { private final QiNiuService qiNiuService; @GetMapping(value = "/config") - public ResponseEntity queryConfig(){ + public ResponseEntity queryQiNiuConfig(){ return new ResponseEntity<>(qiNiuService.find(), HttpStatus.OK); } @Log("配置七牛云存储") @ApiOperation("配置七牛云存储") @PutMapping(value = "/config") - public ResponseEntity updateConfig(@Validated @RequestBody QiniuConfig qiniuConfig){ + public ResponseEntity 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 query(QiniuQueryCriteria criteria, Pageable pageable){ + public ResponseEntity queryQiNiu(QiniuQueryCriteria criteria, Pageable pageable){ return new ResponseEntity<>(qiNiuService.queryAll(criteria,pageable),HttpStatus.OK); } @Log("上传文件") @ApiOperation("上传文件") @PostMapping - public ResponseEntity upload(@RequestParam MultipartFile file){ + public ResponseEntity uploadQiNiu(@RequestParam MultipartFile file){ QiniuContent qiniuContent = qiNiuService.upload(file,qiNiuService.find()); Map map = new HashMap<>(3); map.put("id",qiniuContent.getId()); @@ -90,7 +90,7 @@ public class QiniuController { @Log("同步七牛云数据") @ApiOperation("同步七牛云数据") @PostMapping(value = "/synchronize") - public ResponseEntity synchronize(){ + public ResponseEntity 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 download(@PathVariable Long id){ + public ResponseEntity downloadQiNiu(@PathVariable Long id){ Map 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 delete(@PathVariable Long id){ + public ResponseEntity 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 deleteAll(@RequestBody Long[] ids) { + public ResponseEntity deleteAllQiNiu(@RequestBody Long[] ids) { qiNiuService.deleteAll(ids, qiNiuService.find()); return new ResponseEntity<>(HttpStatus.OK); }