Forráskód Böngészése

feature: 新增controller接口入参限定修饰符 #I4U9BT

chenghua 4 éve
szülő
commit
2dd10792ec

+ 1 - 1
manager/src/main/java/com/usthe/manager/controller/AccountController.java

@@ -91,7 +91,7 @@ public class AccountController {
     @ApiOperation(value = "TOKEN刷新", notes = "使用刷新TOKEN重新获取TOKEN")
     public ResponseEntity<Message<Map<String, String>>> refreshToken(
             @ApiParam(value = "刷新TOKEN", example = "xxx")
-            @PathVariable("refreshToken") @NotNull String refreshToken) {
+            @PathVariable("refreshToken") @NotNull final String refreshToken) {
         String userId;
         boolean isRefresh;
         try {

+ 2 - 2
manager/src/main/java/com/usthe/manager/controller/AppController.java

@@ -36,7 +36,7 @@ public class AppController {
     @GetMapping(path = "/{app}/params")
     @ApiOperation(value = "查询监控类型的参数结构", notes = "根据app查询指定监控类型的需要输入参数的结构")
     public ResponseEntity<Message<List<ParamDefine>>> queryAppParamDefines(
-            @ApiParam(value = "监控类型名称", example = "api") @PathVariable("app") String app) {
+            @ApiParam(value = "监控类型名称", example = "api") @PathVariable("app") final String app) {
         List<ParamDefine> paramDefines = appService.getAppParamDefines(app.toLowerCase());
         return ResponseEntity.ok(new Message<>(paramDefines));
     }
@@ -44,7 +44,7 @@ public class AppController {
     @GetMapping(path = "/{app}/define")
     @ApiOperation(value = "查询监控类型的结构定义", notes = "根据app查询指定监控类型的定义结构")
     public ResponseEntity<Message<Job>> queryAppDefine(
-            @ApiParam(value = "监控类型名称", example = "api") @PathVariable("app") String app) {
+            @ApiParam(value = "监控类型名称", example = "api") @PathVariable("app") final String app) {
         Job define = appService.getAppDefine(app.toLowerCase());
         return ResponseEntity.ok(new Message<>(define));
     }

+ 2 - 2
manager/src/main/java/com/usthe/manager/controller/MonitorController.java

@@ -64,7 +64,7 @@ public class MonitorController {
     @GetMapping(path = "/{id}")
     @ApiOperation(value = "查询监控", notes = "根据监控ID获取监控信息")
     public ResponseEntity<Message<MonitorDto>> getMonitor(
-            @ApiParam(value = "监控ID", example = "6565463543") @PathVariable("id") long id) {
+            @ApiParam(value = "监控ID", example = "6565463543") @PathVariable("id") final long id) {
         // 获取监控信息
         MonitorDto monitorDto = monitorService.getMonitorDto(id);
         Message.MessageBuilder<MonitorDto> messageBuilder = Message.builder();
@@ -79,7 +79,7 @@ public class MonitorController {
     @DeleteMapping(path = "/{id}")
     @ApiOperation(value = "删除监控", notes = "根据监控ID删除监控应用,监控不存在也是删除成功")
     public ResponseEntity<Message<Void>> deleteMonitor(
-            @ApiParam(value = "监控ID", example = "6565463543") @PathVariable("id") long id) {
+            @ApiParam(value = "监控ID", example = "6565463543") @PathVariable("id") final long id) {
         // 删除监控,监控不存在或删除成功都返回成功
         monitorService.deleteMonitor(id);
         return ResponseEntity.ok(new Message<>("Delete success"));

+ 7 - 7
manager/src/main/java/com/usthe/manager/controller/MonitorsController.java

@@ -44,12 +44,12 @@ public class MonitorsController {
     @GetMapping
     @ApiOperation(value = "查询监控列表", notes = "根据查询过滤项获取监控信息列表")
     public ResponseEntity<Message<Page<Monitor>>> getMonitors(
-            @ApiParam(value = "监控ID", example = "6565463543") @RequestParam(required = false) List<Long> ids,
-            @ApiParam(value = "监控类型", example = "linux") @RequestParam(required = false) String app,
-            @ApiParam(value = "监控名称,模糊查询", example = "linux-127.0.0.1") @RequestParam(required = false) String name,
-            @ApiParam(value = "监控Host,模糊查询", example = "127.0.0.1") @RequestParam(required = false) String host,
-            @ApiParam(value = "排序字段,默认id", example = "name") @RequestParam(defaultValue = "id") String sort,
-            @ApiParam(value = "排序方式,asc:升序,desc:降序", example = "desc") @RequestParam(defaultValue = "desc") String order,
+            @ApiParam(value = "监控ID", example = "6565463543") @RequestParam(required = false) final List<Long> ids,
+            @ApiParam(value = "监控类型", example = "linux") @RequestParam(required = false) final String app,
+            @ApiParam(value = "监控名称,模糊查询", example = "linux-127.0.0.1") @RequestParam(required = false) final String name,
+            @ApiParam(value = "监控Host,模糊查询", example = "127.0.0.1") @RequestParam(required = false) final String host,
+            @ApiParam(value = "排序字段,默认id", example = "name") @RequestParam(defaultValue = "id") final String sort,
+            @ApiParam(value = "排序方式,asc:升序,desc:降序", example = "desc") @RequestParam(defaultValue = "desc") final String order,
             @ApiParam(value = "列表当前分页", example = "0") @RequestParam(defaultValue = "0") int pageIndex,
             @ApiParam(value = "列表分页数量", example = "8") @RequestParam(defaultValue = "8") int pageSize) {
 
@@ -94,7 +94,7 @@ public class MonitorsController {
     @GetMapping(path = "/{app}")
     @ApiOperation(value = "查询指定监控类型的监控列表", notes = "根据查询过滤指定监控类型的所有获取监控信息列表")
     public ResponseEntity<Message<List<Monitor>>> getAppMonitors(
-            @ApiParam(value = "监控类型", example = "linux") @PathVariable(required = false) String app) {
+            @ApiParam(value = "监控类型", example = "linux") @PathVariable(required = false) final String app) {
         List<Monitor> monitors = monitorService.getAppMonitors(app);
         Message<List<Monitor>> message = new Message<>(monitors);
         return ResponseEntity.ok(message);

+ 4 - 4
manager/src/main/java/com/usthe/manager/controller/NoticeConfigController.java

@@ -57,7 +57,7 @@ public class NoticeConfigController {
     @DeleteMapping(path = "/receiver/{id}")
     @ApiOperation(value = "删除指定接收人", notes = "删除已存在的接收人信息")
     public ResponseEntity<Message<Void>> deleteNoticeReceiver(
-            @ApiParam(value = "接收人ID", example = "6565463543") @PathVariable("id") Long receiverId) {
+            @ApiParam(value = "接收人ID", example = "6565463543") @PathVariable("id") final Long receiverId) {
         // 不存在或删除成功都返回成功
         noticeConfigService.deleteReceiver(receiverId);
         return ResponseEntity.ok(new Message<>("Delete success"));
@@ -66,7 +66,7 @@ public class NoticeConfigController {
     @GetMapping(path = "/receivers")
     @ApiOperation(value = "查询消息通知接收人", notes = "根据查询过滤项获取消息通知接收人列表")
     public ResponseEntity<Message<List<NoticeReceiver>>> getReceivers(
-            @ApiParam(value = "接收人名称,模糊查询", example = "tom") @RequestParam(required = false) String name) {
+            @ApiParam(value = "接收人名称,模糊查询", example = "tom") @RequestParam(required = false) final String name) {
 
         Specification<NoticeReceiver> specification = (root, query, criteriaBuilder) -> {
             Predicate predicate = criteriaBuilder.conjunction();
@@ -99,7 +99,7 @@ public class NoticeConfigController {
     @DeleteMapping(path = "/rule/{id}")
     @ApiOperation(value = "删除指定通知策略", notes = "删除已存在的通知策略信息")
     public ResponseEntity<Message<Void>> deleteNoticeRule(
-            @ApiParam(value = "通知策略ID", example = "6565463543") @PathVariable("id") Long ruleId) {
+            @ApiParam(value = "通知策略ID", example = "6565463543") @PathVariable("id") final Long ruleId) {
         // 不存在或删除成功都返回成功
         noticeConfigService.deleteNoticeRule(ruleId);
         return ResponseEntity.ok(new Message<>("Delete success"));
@@ -108,7 +108,7 @@ public class NoticeConfigController {
     @GetMapping(path = "/rules")
     @ApiOperation(value = "查询消息通知策略", notes = "根据查询过滤项获取消息通知策略列表")
     public ResponseEntity<Message<List<NoticeRule>>> getRules(
-            @ApiParam(value = "接收人名称,模糊查询", example = "rule1") @RequestParam(required = false) String name) {
+            @ApiParam(value = "接收人名称,模糊查询", example = "rule1") @RequestParam(required = false) final String name) {
 
         Specification<NoticeRule> specification = (root, query, criteriaBuilder) -> {
             Predicate predicate = criteriaBuilder.conjunction();