rev:去掉SWAGGER
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.nl.modules.common.base;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
@@ -44,22 +44,22 @@ public class BaseEntity implements Serializable {
|
||||
|
||||
@CreatedBy
|
||||
@Column(name = "create_by", updatable = false)
|
||||
@ApiModelProperty(value = "创建人", hidden = true)
|
||||
|
||||
private String createBy;
|
||||
|
||||
@LastModifiedBy
|
||||
@Column(name = "update_by")
|
||||
@ApiModelProperty(value = "更新人", hidden = true)
|
||||
|
||||
private String updatedBy;
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(name = "create_time", updatable = false)
|
||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
@UpdateTimestamp
|
||||
@Column(name = "update_time")
|
||||
@ApiModelProperty(value = "更新时间", hidden = true)
|
||||
|
||||
private Timestamp updateTime;
|
||||
|
||||
/* 分组校验 */
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.modules.common.config;
|
||||
|
||||
import com.fasterxml.classmate.TypeResolver;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.schema.AlternateTypeRule;
|
||||
import springfox.documentation.schema.AlternateTypeRuleConvention;
|
||||
import springfox.documentation.service.*;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.collect.Lists.newArrayList;
|
||||
import static springfox.documentation.schema.AlternateTypeRules.newRule;
|
||||
|
||||
/**
|
||||
* api页面 /doc.html
|
||||
*
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Value("${jwt.header}")
|
||||
private String tokenHeader;
|
||||
|
||||
@Value("${jwt.token-start-with}")
|
||||
private String tokenStartWith;
|
||||
|
||||
@Value("${swagger.enabled}")
|
||||
private Boolean enabled;
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("all")
|
||||
public Docket createRestApi() {
|
||||
// ParameterBuilder ticketPar = new ParameterBuilder();
|
||||
//// List<Parameter> pars = new ArrayList<>();
|
||||
//// ticketPar.name(tokenHeader).description("token")
|
||||
//// .modelRef(new ModelRef("string"))
|
||||
//// .parameterType("header")
|
||||
//// .defaultValue(tokenStartWith + " ")
|
||||
//// .required(true)
|
||||
//// .build();
|
||||
// pars.add(ticketPar.build());
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.enable(enabled)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
// .paths(Predicates.not(PathSelectors.regex("/error.*")))
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
// .globalOperationParameters(pars)
|
||||
//添加登陆认证
|
||||
.securitySchemes(securitySchemes())
|
||||
.securityContexts(securityContexts());
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.description("一个简单且易上手的 Spring boot 后台管理框架")
|
||||
.title("EL-ADMIN 接口文档")
|
||||
.version("2.4")
|
||||
.build();
|
||||
}
|
||||
|
||||
private List<SecurityScheme> securitySchemes() {
|
||||
//设置请求头信息
|
||||
List<SecurityScheme> securitySchemes = new ArrayList<>();
|
||||
ApiKey apiKey = new ApiKey(tokenHeader, tokenHeader, "header");
|
||||
securitySchemes.add(apiKey);
|
||||
return securitySchemes;
|
||||
}
|
||||
|
||||
private List<SecurityContext> securityContexts() {
|
||||
//设置需要登录认证的路径
|
||||
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||
// ^(?!auth).*$ 表示所有包含auth的接口不需要使用securitySchemes即不需要带token
|
||||
// ^标识开始 ()里是一子表达式 ?!/auth表示匹配不是/auth的位置,匹配上则添加请求头,注意路径已/开头 .表示任意字符 *表示前面的字符匹配多次 $标识结束
|
||||
securityContexts.add(getContextByPath("^(?!/auth).*$"));
|
||||
return securityContexts;
|
||||
}
|
||||
|
||||
private SecurityContext getContextByPath(String pathRegex) {
|
||||
return SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.forPaths(PathSelectors.regex(pathRegex))
|
||||
.build();
|
||||
}
|
||||
|
||||
private List<SecurityReference> defaultAuth() {
|
||||
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
securityReferences.add(new SecurityReference(tokenHeader, authorizationScopes));
|
||||
return securityReferences;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Pageable转换展示在swagger中
|
||||
*/
|
||||
@Configuration
|
||||
class SwaggerDataConfig {
|
||||
|
||||
@Bean
|
||||
public AlternateTypeRuleConvention pageableConvention(final TypeResolver resolver) {
|
||||
return new AlternateTypeRuleConvention() {
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return Ordered.HIGHEST_PRECEDENCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlternateTypeRule> rules() {
|
||||
return newArrayList(newRule(resolver.resolve(Pageable.class), resolver.resolve(Page.class)));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ApiModel
|
||||
@Data
|
||||
private static class Page {
|
||||
@ApiModelProperty("页码 (0..N)")
|
||||
private Integer page;
|
||||
|
||||
@ApiModelProperty("每页显示的数目")
|
||||
private Integer size;
|
||||
|
||||
@ApiModelProperty("以下列格式排序标准:property[,asc | desc]。 默认排序顺序为升序。 支持多种排序条件:如:id,asc")
|
||||
private List<String> sort;
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ package org.nl.modules.common.utils;
|
||||
/**
|
||||
* @author: liaojinlong
|
||||
* @date: 2020/6/11 15:49
|
||||
* @apiNote: 关于缓存的Key集合
|
||||
*/
|
||||
public interface CacheKey {
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.Date;
|
||||
/**
|
||||
* @author: liaojinlong
|
||||
* @date: 2020/6/11 16:28
|
||||
* @apiNote: JDK 8 新日期类 格式化与字符串转换 工具类
|
||||
*/
|
||||
public class DateUtil {
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.nl.modules.generator.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -39,47 +39,47 @@ public class ColumnInfo implements Serializable {
|
||||
|
||||
@Id
|
||||
@Column(name = "column_id")
|
||||
@ApiModelProperty(value = "ID", hidden = true)
|
||||
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "表名")
|
||||
|
||||
private String tableName;
|
||||
|
||||
@ApiModelProperty(value = "数据库字段名称")
|
||||
|
||||
private String columnName;
|
||||
|
||||
@ApiModelProperty(value = "数据库字段类型")
|
||||
|
||||
private String columnType;
|
||||
|
||||
@ApiModelProperty(value = "数据库字段键类型")
|
||||
|
||||
private String keyType;
|
||||
|
||||
@ApiModelProperty(value = "字段额外的参数")
|
||||
|
||||
private String extra;
|
||||
|
||||
@ApiModelProperty(value = "数据库字段描述")
|
||||
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "是否必填")
|
||||
|
||||
private Boolean notNull;
|
||||
|
||||
@ApiModelProperty(value = "是否在列表显示")
|
||||
|
||||
private Boolean listShow;
|
||||
|
||||
@ApiModelProperty(value = "是否表单显示")
|
||||
|
||||
private Boolean formShow;
|
||||
|
||||
@ApiModelProperty(value = "表单类型")
|
||||
|
||||
private String formType;
|
||||
|
||||
@ApiModelProperty(value = "查询 1:模糊 2:精确")
|
||||
|
||||
private String queryType;
|
||||
|
||||
@ApiModelProperty(value = "字典名称")
|
||||
|
||||
private String dictName;
|
||||
|
||||
@ApiModelProperty(value = "日期注解")
|
||||
|
||||
private String dateAnnotation;
|
||||
|
||||
public ColumnInfo(String tableName, String columnName, Boolean notNull, String columnType, String remark, String keyType, String extra) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.nl.modules.generator.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -43,38 +43,38 @@ public class GenConfig implements Serializable {
|
||||
|
||||
@Id
|
||||
@Column(name = "config_id")
|
||||
@ApiModelProperty(value = "ID", hidden = true)
|
||||
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "表名")
|
||||
|
||||
private String tableName;
|
||||
|
||||
@ApiModelProperty(value = "接口名称")
|
||||
|
||||
private String apiAlias;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "包路径")
|
||||
|
||||
private String pack;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "模块名")
|
||||
|
||||
private String moduleName;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "前端文件路径")
|
||||
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "前端文件路径")
|
||||
|
||||
private String apiPath;
|
||||
|
||||
@ApiModelProperty(value = "作者")
|
||||
|
||||
private String author;
|
||||
|
||||
@ApiModelProperty(value = "表前缀")
|
||||
|
||||
private String prefix;
|
||||
|
||||
@ApiModelProperty(value = "是否覆盖")
|
||||
|
||||
private Boolean cover = false;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.nl.modules.generator.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.generator.domain.GenConfig;
|
||||
import org.nl.modules.generator.service.GenConfigService;
|
||||
@@ -32,18 +31,18 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/genConfig")
|
||||
@Api(tags = "系统:代码生成器配置管理")
|
||||
|
||||
public class GenConfigController {
|
||||
|
||||
private final GenConfigService genConfigService;
|
||||
|
||||
@ApiOperation("查询")
|
||||
|
||||
@GetMapping(value = "/{tableName}")
|
||||
public ResponseEntity<Object> query(@PathVariable String tableName) {
|
||||
return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
|
||||
@PutMapping
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody GenConfig genConfig) {
|
||||
return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig), HttpStatus.OK);
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.nl.modules.generator.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.PageUtil;
|
||||
@@ -39,7 +38,7 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/generator")
|
||||
@Api(tags = "系统:代码生成管理")
|
||||
|
||||
public class GeneratorController {
|
||||
|
||||
private final GeneratorService generatorService;
|
||||
@@ -48,13 +47,13 @@ public class GeneratorController {
|
||||
@Value("${generator.enabled}")
|
||||
private Boolean generatorEnabled;
|
||||
|
||||
@ApiOperation("查询数据库数据")
|
||||
|
||||
@GetMapping(value = "/tables/all")
|
||||
public ResponseEntity<Object> queryTables() {
|
||||
return new ResponseEntity<>(generatorService.getTables(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询数据库数据")
|
||||
|
||||
@GetMapping(value = "/tables")
|
||||
public ResponseEntity<Object> queryTables(@RequestParam(defaultValue = "") String name,
|
||||
@RequestParam(defaultValue = "0") Integer page,
|
||||
@@ -63,21 +62,21 @@ public class GeneratorController {
|
||||
return new ResponseEntity<>(generatorService.getTables(name, startEnd), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询字段数据")
|
||||
|
||||
@GetMapping(value = "/columns")
|
||||
public ResponseEntity<Object> queryColumns(@RequestParam String tableName) {
|
||||
List<ColumnInfo> columnInfos = generatorService.getColumns(tableName);
|
||||
return new ResponseEntity<>(PageUtil.toPage(columnInfos, columnInfos.size()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("保存字段数据")
|
||||
|
||||
@PutMapping
|
||||
public ResponseEntity<HttpStatus> save(@RequestBody List<ColumnInfo> columnInfos) {
|
||||
generatorService.save(columnInfos);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("同步字段数据")
|
||||
|
||||
@PostMapping(value = "sync")
|
||||
public ResponseEntity<HttpStatus> sync(@RequestBody List<String> tables) {
|
||||
for (String table : tables) {
|
||||
@@ -86,7 +85,7 @@ public class GeneratorController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("生成代码")
|
||||
|
||||
@PostMapping(value = "/{tableName}/{type}")
|
||||
public ResponseEntity<Object> generator(@PathVariable String tableName, @PathVariable Integer type, HttpServletRequest request, HttpServletResponse response) {
|
||||
if (!generatorEnabled && type == 0) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.nl.modules.logging.rest;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
@@ -26,19 +26,19 @@ public class EsLogController {
|
||||
|
||||
|
||||
@GetMapping("/labels/{type}")
|
||||
@ApiOperation("获取标签")
|
||||
|
||||
public ResponseEntity<Object> labelsValues(@PathVariable String type) {
|
||||
return new ResponseEntity<>(esLogService.getLabelsValues(type), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/query")
|
||||
@ApiOperation("日志查询")
|
||||
|
||||
public ResponseEntity<Object> queryAll(@RequestBody LogQuery query) {
|
||||
return new ResponseEntity<>(esLogService.query(query), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping("/clearLogs")
|
||||
@ApiOperation("清空日志")
|
||||
|
||||
public ResponseEntity<Object> clearLogs(@RequestBody LogQuery query) {
|
||||
esLogService.clearLogs(query);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -48,17 +48,17 @@ public class EsLogController {
|
||||
@DeleteMapping("/thread")
|
||||
@Log("清空日志")
|
||||
public ResponseEntity<Object> thread() {
|
||||
log.info("Async线程链路测试"+Thread.currentThread().getName());
|
||||
log.error("Async线程链路测试"+Thread.currentThread().getName());
|
||||
log.info("Async线程链路测试"+Thread.currentThread().getName());
|
||||
log.info("线程链路测试"+Thread.currentThread().getName());
|
||||
log.info("Async线程链路测试" + Thread.currentThread().getName());
|
||||
log.error("Async线程链路测试" + Thread.currentThread().getName());
|
||||
log.info("Async线程链路测试" + Thread.currentThread().getName());
|
||||
log.info("线程链路测试" + Thread.currentThread().getName());
|
||||
|
||||
esLogService.syncdemo();
|
||||
new Thread(()->{
|
||||
log.info("线程链路测试"+Thread.currentThread().getName());
|
||||
log.error("线程链路测试"+Thread.currentThread().getName());
|
||||
log.info("线程链路测试"+Thread.currentThread().getName());
|
||||
log.info("线程链路测试"+Thread.currentThread().getName());
|
||||
new Thread(() -> {
|
||||
log.info("线程链路测试" + Thread.currentThread().getName());
|
||||
log.error("线程链路测试" + Thread.currentThread().getName());
|
||||
log.info("线程链路测试" + Thread.currentThread().getName());
|
||||
log.info("线程链路测试" + Thread.currentThread().getName());
|
||||
|
||||
}).start();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.nl.modules.logging.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.logging.service.InterfaceLogService;
|
||||
@@ -22,13 +21,13 @@ import java.util.Map;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/interfaceLog")
|
||||
@Api(tags = "系统:接口日志管理")
|
||||
|
||||
public class InterfaceLogController {
|
||||
private final InterfaceLogService interfaceLogService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询接口日志")
|
||||
@ApiOperation("查询接口日志")
|
||||
|
||||
//@SaCheckPermission("point:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(interfaceLogService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
@@ -36,7 +35,7 @@ public class InterfaceLogController {
|
||||
|
||||
@DeleteMapping(value = "/delLogs")
|
||||
@Log("删除所有接口日志")
|
||||
@ApiOperation("删除所有接口日志")
|
||||
|
||||
public ResponseEntity<Object> delLogs() {
|
||||
interfaceLogService.delLogs();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -44,7 +43,7 @@ public class InterfaceLogController {
|
||||
|
||||
@GetMapping("/logTypeList")
|
||||
@Log("查询接口日志类型下拉框")
|
||||
@ApiOperation("查询接口日志类型下拉框")
|
||||
|
||||
public ResponseEntity<Object> logTypeList() {
|
||||
return new ResponseEntity<>(interfaceLogService.logTypeList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.nl.modules.logging.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
@@ -34,13 +33,13 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/logs")
|
||||
@Api(tags = "系统:日志管理")
|
||||
|
||||
public class LogController {
|
||||
|
||||
private final LogService logService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("日志查询")
|
||||
|
||||
//@SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> query(LogQueryCriteria criteria, Pageable pageable) {
|
||||
criteria.setLogType("INFO");
|
||||
@@ -48,7 +47,7 @@ public class LogController {
|
||||
}
|
||||
|
||||
@GetMapping(value = "/user")
|
||||
// @ApiOperation("用户日志查询")
|
||||
//
|
||||
public ResponseEntity<Object> queryUserLog(LogQueryCriteria criteria, Pageable pageable) {
|
||||
criteria.setLogType("INFO");
|
||||
criteria.setBlurry(SecurityUtils.getCurrentUsername());
|
||||
@@ -56,7 +55,7 @@ public class LogController {
|
||||
}
|
||||
|
||||
@GetMapping(value = "/error")
|
||||
@ApiOperation("错误日志查询")
|
||||
|
||||
// @SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> queryErrorLog(LogQueryCriteria criteria, Pageable pageable) {
|
||||
criteria.setLogType("ERROR");
|
||||
@@ -64,7 +63,7 @@ public class LogController {
|
||||
}
|
||||
|
||||
@GetMapping(value = "/error/{id}")
|
||||
@ApiOperation("日志异常详情查询")
|
||||
|
||||
// @SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> queryErrorLogs(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK);
|
||||
@@ -72,7 +71,7 @@ public class LogController {
|
||||
|
||||
@DeleteMapping(value = "/del/error")
|
||||
@Log("删除所有ERROR日志")
|
||||
@ApiOperation("删除所有ERROR日志")
|
||||
|
||||
// @SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> delAllErrorLog() {
|
||||
logService.delAllByError();
|
||||
@@ -81,7 +80,7 @@ public class LogController {
|
||||
|
||||
@DeleteMapping(value = "/del/info")
|
||||
@Log("删除所有INFO日志")
|
||||
@ApiOperation("删除所有INFO日志")
|
||||
|
||||
// @SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> delAllInfoLog() {
|
||||
logService.delAllByInfo();
|
||||
|
||||
@@ -8,11 +8,9 @@ import cn.hutool.db.PageResult;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.IndexWriterConfig;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.queryparser.classic.QueryParser;
|
||||
import org.apache.lucene.search.*;
|
||||
@@ -44,7 +42,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class LuceneLogServiceImpl implements EsLogService {
|
||||
|
||||
static String[] INFO_LEVEL = new String[]{"DEBUG","INFO","WARN","ERROR"};
|
||||
static String[] INFO_LEVEL = new String[]{"DEBUG", "INFO", "WARN", "ERROR"};
|
||||
|
||||
@Value("${lucene.index.path}")
|
||||
private String indexUrl;
|
||||
@@ -54,18 +52,18 @@ public class LuceneLogServiceImpl implements EsLogService {
|
||||
try {
|
||||
// 初始化 Lucene 索引
|
||||
IndexWriter indexWriter = LuceneAppender.indexWriter;
|
||||
if (indexWriter != null){
|
||||
if (indexWriter != null) {
|
||||
BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder();
|
||||
DateTime offset = DateUtil.offset(new Date(), DateField.HOUR_OF_DAY, -10);
|
||||
TermRangeQuery termRangeQuery = new TermRangeQuery(
|
||||
"requestTime",null,
|
||||
"requestTime", null,
|
||||
new BytesRef(DateUtil.format(offset, "yyyy-MM-dd HH:mm:ss.SSS")), true, true);
|
||||
booleanQueryBuilder.add(termRangeQuery,BooleanClause.Occur.MUST);
|
||||
booleanQueryBuilder.add(termRangeQuery, BooleanClause.Occur.MUST);
|
||||
indexWriter.deleteDocuments(termRangeQuery);
|
||||
indexWriter.commit();
|
||||
}
|
||||
}catch (Exception ex){
|
||||
throw new BadRequestException("删除失败:"+ex.getMessage());
|
||||
} catch (Exception ex) {
|
||||
throw new BadRequestException("删除失败:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,25 +94,28 @@ public class LuceneLogServiceImpl implements EsLogService {
|
||||
BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder();
|
||||
//时间范围查询
|
||||
Date startDate = logQuery.getStartTime();
|
||||
Date endDate = logQuery.getEndTime();
|
||||
Date endDate = logQuery.getEndTime();
|
||||
|
||||
if (startDate == null){
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
if (startDate == null) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(1970, 0, 1);
|
||||
startDate = calendar.getTime(); }
|
||||
if (endDate == null){ endDate = new DateTime(); }
|
||||
startDate = calendar.getTime();
|
||||
}
|
||||
if (endDate == null) {
|
||||
endDate = new DateTime();
|
||||
}
|
||||
TermRangeQuery termRangeQuery = new TermRangeQuery(
|
||||
"requestTime",
|
||||
new BytesRef(DateUtil.format(startDate, "yyyy-MM-dd HH:mm:ss.SSS")),
|
||||
new BytesRef(DateUtil.format(endDate, "yyyy-MM-dd HH:mm:ss.SSS")), true, true);
|
||||
booleanQueryBuilder.add(termRangeQuery,BooleanClause.Occur.MUST);
|
||||
booleanQueryBuilder.add(termRangeQuery, BooleanClause.Occur.MUST);
|
||||
|
||||
// 字段之间的与或非关系,MUST表示and,MUST_NOT表示not,SHOULD表示or,有几个fields就必须有几个clauses
|
||||
if (ObjectUtil.isNotEmpty(logQuery.getTraceId())){
|
||||
if (ObjectUtil.isNotEmpty(logQuery.getTraceId())) {
|
||||
TermQuery termQuery = new TermQuery(new Term("traceId", logQuery.getTraceId()));
|
||||
booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(logQuery.getLogLevel())){
|
||||
if (ObjectUtil.isNotEmpty(logQuery.getLogLevel())) {
|
||||
TermQuery termQuery = new TermQuery(new Term("logLevel", logQuery.getLogLevel()));
|
||||
booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST);
|
||||
}
|
||||
@@ -127,20 +128,20 @@ public class LuceneLogServiceImpl implements EsLogService {
|
||||
booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (Boolean.TRUE.equals(logQuery.getIsRequest())) {
|
||||
Term traceid = new Term("traceId"," ");
|
||||
Term traceid = new Term("traceId", " ");
|
||||
TermQuery termQuery = new TermQuery(traceid);
|
||||
booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST_NOT);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(logQuery.getMessage())){
|
||||
if (ObjectUtil.isNotEmpty(logQuery.getMessage())) {
|
||||
//查询解析器
|
||||
QueryParser queryParser = new QueryParser("message", new IKAnalyzer(true));
|
||||
Query query = queryParser.parse(logQuery.getMessage());
|
||||
booleanQueryBuilder.add(query, BooleanClause.Occur.MUST);
|
||||
}
|
||||
|
||||
TopFieldCollector collector = TopFieldCollector.create(new Sort(new SortField("time", SortField.Type.LONG,true)), 20000, 0);
|
||||
TopFieldCollector collector = TopFieldCollector.create(new Sort(new SortField("time", SortField.Type.LONG, true)), 20000, 0);
|
||||
searcher.search(booleanQueryBuilder.build(), collector);
|
||||
TopDocs topDocs = collector.topDocs((logQuery.getPage()-1)*logQuery.getSize(), logQuery.getSize());
|
||||
TopDocs topDocs = collector.topDocs((logQuery.getPage() - 1) * logQuery.getSize(), logQuery.getSize());
|
||||
int totalSize = collector.getTotalHits();
|
||||
ScoreDoc[] scoreDocs = topDocs.scoreDocs;
|
||||
|
||||
@@ -164,10 +165,10 @@ public class LuceneLogServiceImpl implements EsLogService {
|
||||
page.addAll(list);
|
||||
page.setTotal(scoreDocs.length);
|
||||
res.put("total", totalSize);
|
||||
}catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
res.put("page",page);
|
||||
res.put("page", page);
|
||||
return res;
|
||||
|
||||
}
|
||||
@@ -176,10 +177,10 @@ public class LuceneLogServiceImpl implements EsLogService {
|
||||
@Override
|
||||
@Async
|
||||
public void syncdemo() {
|
||||
log.info("Async线程链路测试"+Thread.currentThread().getName());
|
||||
log.error("Async线程链路测试"+Thread.currentThread().getName());
|
||||
log.info("Async线程链路测试"+Thread.currentThread().getName());
|
||||
log.info("线程链路测试"+Thread.currentThread().getName());
|
||||
log.info("Async线程链路测试" + Thread.currentThread().getName());
|
||||
log.error("Async线程链路测试" + Thread.currentThread().getName());
|
||||
log.info("Async线程链路测试" + Thread.currentThread().getName());
|
||||
log.info("线程链路测试" + Thread.currentThread().getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.nl.modules.logicflow.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
@@ -22,7 +21,7 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "舞台管理")
|
||||
|
||||
@RequestMapping("/api/stage")
|
||||
@Slf4j
|
||||
public class StageController {
|
||||
@@ -30,7 +29,7 @@ public class StageController {
|
||||
|
||||
@GetMapping
|
||||
@Log("查询舞台")
|
||||
@ApiOperation("查询舞台")
|
||||
|
||||
//@SaCheckPermission("stage:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(stageService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
@@ -38,7 +37,7 @@ public class StageController {
|
||||
|
||||
@PostMapping
|
||||
@Log("新增舞台")
|
||||
@ApiOperation("新增舞台")
|
||||
|
||||
//@SaCheckPermission("stage:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StageDto dto) {
|
||||
stageService.create(dto);
|
||||
@@ -47,7 +46,7 @@ public class StageController {
|
||||
|
||||
@PutMapping
|
||||
@Log("修改舞台")
|
||||
@ApiOperation("修改舞台")
|
||||
|
||||
//@SaCheckPermission("stage:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StageDto dto) {
|
||||
stageService.update(dto);
|
||||
@@ -55,7 +54,7 @@ public class StageController {
|
||||
}
|
||||
|
||||
@Log("删除舞台")
|
||||
@ApiOperation("删除舞台")
|
||||
|
||||
//@SaCheckPermission("stage:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
@@ -65,7 +64,7 @@ public class StageController {
|
||||
|
||||
@GetMapping("/selectList")
|
||||
@Log("下拉选舞台")
|
||||
@ApiOperation("下拉选舞台")
|
||||
|
||||
//@SaCheckPermission("routePlan:list")
|
||||
public ResponseEntity<Object> selectList() {
|
||||
return new ResponseEntity<>(stageService.selectList(), HttpStatus.OK);
|
||||
@@ -73,7 +72,7 @@ public class StageController {
|
||||
|
||||
@PostMapping("/addNewStage")
|
||||
@Log("保存舞台数据")
|
||||
@ApiOperation("保存舞台数据")
|
||||
|
||||
public ResponseEntity<Object> addNewStage(@Validated @RequestBody StageDto dto) {
|
||||
log.info("dto{}", dto);
|
||||
stageService.addNewStage(dto);
|
||||
@@ -82,7 +81,7 @@ public class StageController {
|
||||
|
||||
@PostMapping("/getNewStageDataByCode")
|
||||
@Log("根据stage_code获取舞台数据")
|
||||
@ApiOperation("根据stage_code获取舞台数据")
|
||||
|
||||
public ResponseEntity<Object> getNewStageDataByCode(@RequestBody String code) {
|
||||
return new ResponseEntity<>(stageService.findByCode(code), HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.nl.modules.logicflow.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
@@ -22,7 +21,7 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "舞台管理")
|
||||
|
||||
@RequestMapping("/api/stageImage")
|
||||
@Slf4j
|
||||
public class StageImageController {
|
||||
@@ -30,7 +29,7 @@ public class StageImageController {
|
||||
|
||||
@GetMapping
|
||||
@Log("查询舞台")
|
||||
@ApiOperation("查询舞台")
|
||||
|
||||
//@SaCheckPermission("stageImage:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(stageImageService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
@@ -38,7 +37,7 @@ public class StageImageController {
|
||||
|
||||
@PostMapping
|
||||
@Log("新增舞台")
|
||||
@ApiOperation("新增舞台")
|
||||
|
||||
//@SaCheckPermission("stageImage:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StageImageDto dto) {
|
||||
stageImageService.create(dto);
|
||||
@@ -47,7 +46,7 @@ public class StageImageController {
|
||||
|
||||
@PutMapping
|
||||
@Log("修改舞台")
|
||||
@ApiOperation("修改舞台")
|
||||
|
||||
//@SaCheckPermission("stageImage:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StageImageDto dto) {
|
||||
stageImageService.update(dto);
|
||||
@@ -55,7 +54,7 @@ public class StageImageController {
|
||||
}
|
||||
|
||||
@Log("删除舞台")
|
||||
@ApiOperation("删除舞台")
|
||||
|
||||
//@SaCheckPermission("stageImage:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
@@ -65,7 +64,7 @@ public class StageImageController {
|
||||
|
||||
@GetMapping("/selectList")
|
||||
@Log("下拉选设备图标")
|
||||
@ApiOperation("下拉选设备图标")
|
||||
|
||||
//@SaCheckPermission("routePlan:list")
|
||||
public ResponseEntity<Object> selectList() {
|
||||
return new ResponseEntity<>(stageImageService.selectList(), HttpStatus.OK);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.nl.modules.mnt.websocket;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
@@ -17,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "定时任务")
|
||||
|
||||
@RequestMapping("/api/autoWeb")
|
||||
@Slf4j
|
||||
public class AutoWebSocketRiKu {
|
||||
@@ -26,7 +24,7 @@ public class AutoWebSocketRiKu {
|
||||
|
||||
@PostMapping("/query")
|
||||
@Log("查询数据")
|
||||
@ApiOperation("查询数据")
|
||||
|
||||
public ResponseEntity<Object> query() {
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("one", autoRiKuService.getOnePoint());
|
||||
@@ -40,7 +38,7 @@ public class AutoWebSocketRiKu {
|
||||
|
||||
@PostMapping("/queryNum")
|
||||
@Log("查询发货区")
|
||||
@ApiOperation("查询发货区")
|
||||
|
||||
public ResponseEntity<Object> queryNum(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(autoRiKuService.queryNum(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @apiNote 配置文件转换Pojo类的 统一配置 类
|
||||
* @author: liaojinlong
|
||||
* @date: 2020/6/10 19:04
|
||||
*/
|
||||
|
||||
@@ -7,8 +7,6 @@ import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.config.RsaProperties;
|
||||
@@ -41,13 +39,13 @@ import java.util.Map;
|
||||
@RestController
|
||||
@RequestMapping("/mobile/auth")
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "手持:系统授权接口")
|
||||
|
||||
public class MobileAuthorizationController {
|
||||
private final RedisUtils redisUtils;
|
||||
private final ISysUserService userService;
|
||||
private final ISysRoleService roleService;
|
||||
|
||||
@ApiOperation("登录授权")
|
||||
|
||||
@PostMapping(value = "/login")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception {
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.nl.modules.system.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.system.service.CodeDetailService;
|
||||
@@ -16,14 +14,14 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "系统:编码详情管理")
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/codeDetail")
|
||||
public class CodeDetailController {
|
||||
|
||||
private final CodeDetailService codeDetailService;
|
||||
|
||||
@ApiOperation("查询编码明细")
|
||||
|
||||
@GetMapping
|
||||
@SaCheckPermission("genCode:list")
|
||||
public ResponseEntity<Object> queryAll(@RequestParam Map form, Pageable pageable) {
|
||||
@@ -31,7 +29,7 @@ public class CodeDetailController {
|
||||
}
|
||||
|
||||
@Log("新增编码")
|
||||
@ApiOperation("新增编码")
|
||||
|
||||
@PostMapping
|
||||
@SaCheckPermission("genCode:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Map form) {
|
||||
@@ -40,7 +38,7 @@ public class CodeDetailController {
|
||||
}
|
||||
|
||||
@Log("删除编码")
|
||||
@ApiOperation("删除编码")
|
||||
|
||||
@DeleteMapping(value = "/{id}")
|
||||
@SaCheckPermission("genCode:del")
|
||||
public ResponseEntity<Object> delete(@PathVariable String id) {
|
||||
@@ -49,7 +47,7 @@ public class CodeDetailController {
|
||||
}
|
||||
|
||||
@Log("修改字典")
|
||||
@ApiOperation("修改字典")
|
||||
|
||||
@PutMapping
|
||||
@SaCheckPermission("dict:edit")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject json) {
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.nl.modules.system.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.system.service.GenCodeService;
|
||||
@@ -18,13 +16,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "系统:编码生成")
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/genCode")
|
||||
public class GenCodeController {
|
||||
private final GenCodeService genCodeService;
|
||||
|
||||
@ApiOperation("查询编码")
|
||||
|
||||
@GetMapping
|
||||
@SaCheckPermission("genCode:list")
|
||||
public ResponseEntity<Object> queryAll(@RequestParam Map form, Pageable pageable) {
|
||||
@@ -32,7 +30,7 @@ public class GenCodeController {
|
||||
}
|
||||
|
||||
@Log("新增编码")
|
||||
@ApiOperation("新增编码")
|
||||
|
||||
@PostMapping
|
||||
@SaCheckPermission("genCode:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Map form) {
|
||||
@@ -42,7 +40,7 @@ public class GenCodeController {
|
||||
}
|
||||
|
||||
@Log("删除编码")
|
||||
@ApiOperation("删除编码")
|
||||
|
||||
@DeleteMapping
|
||||
@SaCheckPermission("genCode:del")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
@@ -51,7 +49,7 @@ public class GenCodeController {
|
||||
}
|
||||
|
||||
@Log("修改字典")
|
||||
@ApiOperation("修改字典")
|
||||
|
||||
@PutMapping
|
||||
@SaCheckPermission("genCode:edit")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject json) {
|
||||
@@ -59,7 +57,7 @@ public class GenCodeController {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@ApiOperation("导出任务数据")
|
||||
|
||||
@GetMapping(value = "/codeDemo")
|
||||
@SaCheckPermission("genCode:list")
|
||||
public ResponseEntity<Object> CodeDemo(@RequestParam Map form) throws IOException {
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.nl.modules.system.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import org.nl.modules.common.annotation.Limit;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -30,7 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/limit")
|
||||
@Api(tags = "系统:限流测试管理")
|
||||
|
||||
public class LimitController {
|
||||
|
||||
private static final AtomicInteger ATOMIC_INTEGER = new AtomicInteger();
|
||||
@@ -39,7 +38,7 @@ public class LimitController {
|
||||
* 测试限流注解,下面配置说明该接口 60秒内最多只能访问 10次,保存到redis的键名为 limit_test,
|
||||
*/
|
||||
@GetMapping
|
||||
@ApiOperation("测试")
|
||||
|
||||
@Limit(key = "test", period = 60, count = 10, name = "testLimit", prefix = "limit")
|
||||
public int test() {
|
||||
return ATOMIC_INTEGER.incrementAndGet();
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.nl.modules.system.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.system.service.MonitorService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -31,14 +30,14 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "系统-服务监控管理")
|
||||
|
||||
@RequestMapping("/api/monitor")
|
||||
public class MonitorController {
|
||||
|
||||
private final MonitorService serverService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询服务监控")
|
||||
|
||||
// @SaCheckPermission("monitor:list")
|
||||
public ResponseEntity<Object> query() {
|
||||
return new ResponseEntity<>(serverService.getServers(), HttpStatus.OK);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.nl.modules.system.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
@@ -17,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "系统表格管理")
|
||||
|
||||
@RequestMapping("/api/redis")
|
||||
@Slf4j
|
||||
public class RedisController {
|
||||
@@ -26,27 +25,27 @@ public class RedisController {
|
||||
|
||||
@GetMapping("/get-monitor-info")
|
||||
@Log("查询redis的信息")
|
||||
@ApiOperation("查询redis的信息")
|
||||
|
||||
public ResponseEntity<Object> getRedisMonitorInfo() {
|
||||
return new ResponseEntity<>(redisService.getRedisMonitorInfo(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/get-key-define-list")
|
||||
@Log("获得 Redis Key 模板列表")
|
||||
@ApiOperation("获得 Redis Key 模板列表")
|
||||
|
||||
public ResponseEntity<Object> getKeyDefineList() {
|
||||
return new ResponseEntity<>(redisService.getKeyDefineList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/get-key-value-list")
|
||||
@Log("获得 Redis Key Value列表")
|
||||
@ApiOperation("获得 Redis Key Value列表")
|
||||
|
||||
public ResponseEntity<Object> getKeyValueList() {
|
||||
return new ResponseEntity<>(redisService.getKeyValueList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("根据key删除Redis数据")
|
||||
@ApiOperation("根据key删除Redis数据")
|
||||
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> deleteByKey(@RequestBody String[] ids) {
|
||||
redisService.deleteByKey(ids);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.nl.modules.system.service;
|
||||
|
||||
import org.nl.modules.system.service.dto.ParamDto;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.nl.modules.system.service.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -14,26 +13,26 @@ import java.time.Duration;
|
||||
* @Description: 管理后台 - Redis Key 信息 Response VO
|
||||
* @Date: 2022-08-04
|
||||
*/
|
||||
@ApiModel("管理后台 - Redis Key 信息 Response VO")
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
public class RedisKeyDefineRespVO {
|
||||
@ApiModelProperty(value = "Key 模板", required = true, example = "login_user:%s")
|
||||
|
||||
private String keyTemplate;
|
||||
|
||||
@ApiModelProperty(value = "Key 类型的枚举", required = true, example = "String")
|
||||
|
||||
private RedisKeyDefine.KeyTypeEnum keyType;
|
||||
|
||||
@ApiModelProperty(value = "Value 类型", required = true, example = "java.lang.String")
|
||||
|
||||
private Class<?> valueType;
|
||||
|
||||
@ApiModelProperty(value = "超时类型", required = true, example = "1")
|
||||
|
||||
private RedisKeyDefine.TimeoutTypeEnum timeoutType;
|
||||
|
||||
@ApiModelProperty(value = "过期时间,单位:毫秒", required = true, example = "1024")
|
||||
|
||||
private Duration timeout;
|
||||
|
||||
@ApiModelProperty(value = "备注", required = true, example = "啦啦啦啦~")
|
||||
|
||||
private String memo;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.nl.modules.system.service.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -14,33 +13,33 @@ import java.util.Properties;
|
||||
* @Description: 管理后台 - Redis 监控信息 Response VO
|
||||
* @Date: 2022-08-04
|
||||
*/
|
||||
@ApiModel("管理后台 - Redis 监控信息 Response VO")
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
public class RedisMonitorRespVO {
|
||||
@ApiModelProperty(value = "Redis info 指令结果", required = true, notes = "具体字段,查看 Redis 文档")
|
||||
|
||||
private Properties info;
|
||||
|
||||
@ApiModelProperty(value = "Redis key 数量", required = true, example = "1024")
|
||||
|
||||
private Long dbSize;
|
||||
|
||||
@ApiModelProperty(value = "CommandStat 数组", required = true)
|
||||
|
||||
private List<CommandStat> commandStats;
|
||||
|
||||
@ApiModel("Redis 命令统计结果")
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
public static class CommandStat {
|
||||
|
||||
@ApiModelProperty(value = "Redis 命令", required = true, example = "get")
|
||||
|
||||
private String command;
|
||||
|
||||
@ApiModelProperty(value = "调用次数", required = true, example = "1024")
|
||||
|
||||
private Integer calls;
|
||||
|
||||
@ApiModelProperty(value = "消耗 CPU 秒数", required = true, example = "666")
|
||||
|
||||
private Long usec;
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.nl.modules.tools.domain;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -39,26 +38,26 @@ public class LocalStorage extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@Column(name = "storage_id")
|
||||
@ApiModelProperty(value = "ID", hidden = true)
|
||||
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "真实文件名")
|
||||
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "文件名")
|
||||
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "后缀")
|
||||
|
||||
private String suffix;
|
||||
|
||||
@ApiModelProperty(value = "路径")
|
||||
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "类型")
|
||||
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "大小")
|
||||
|
||||
private String size;
|
||||
|
||||
public LocalStorage(String realName, String name, String suffix, String path, String type, String size) {
|
||||
|
||||
@@ -17,8 +17,6 @@ package org.nl.modules.tools.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
@@ -42,27 +40,27 @@ import java.io.IOException;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "工具:本地存储管理")
|
||||
|
||||
@RequestMapping("/api/localStorage")
|
||||
public class LocalStorageController {
|
||||
|
||||
private final LocalStorageService localStorageService;
|
||||
|
||||
@ApiOperation("查询文件")
|
||||
|
||||
@GetMapping
|
||||
@SaCheckPermission("storage:list")
|
||||
public ResponseEntity<Object> query(LocalStorageQueryCriteria criteria, Pageable pageable) {
|
||||
return new ResponseEntity<>(localStorageService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
|
||||
@GetMapping(value = "/download")
|
||||
@SaCheckPermission("storage:list")
|
||||
public void download(HttpServletResponse response, LocalStorageQueryCriteria criteria) throws IOException {
|
||||
localStorageService.download(localStorageService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
|
||||
@PostMapping
|
||||
@SaCheckPermission("storage:add")
|
||||
public ResponseEntity<Object> create(@RequestParam String name, @RequestParam("file") MultipartFile file) {
|
||||
@@ -71,7 +69,7 @@ public class LocalStorageController {
|
||||
}
|
||||
|
||||
@PostMapping("/pictures")
|
||||
@ApiOperation("上传图片")
|
||||
|
||||
public ResponseEntity<Object> upload(@RequestParam MultipartFile file) {
|
||||
// 判断文件是否为图片
|
||||
String suffix = FileUtil.getExtensionName(file.getOriginalFilename());
|
||||
@@ -83,7 +81,7 @@ public class LocalStorageController {
|
||||
}
|
||||
|
||||
@Log("修改文件")
|
||||
@ApiOperation("修改文件")
|
||||
|
||||
@PutMapping
|
||||
@SaCheckPermission("storage:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody LocalStorage resources) {
|
||||
@@ -93,13 +91,13 @@ public class LocalStorageController {
|
||||
|
||||
@Log("删除文件")
|
||||
@DeleteMapping
|
||||
@ApiOperation("多选删除")
|
||||
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
localStorageService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导入数据")
|
||||
|
||||
@PostMapping("/importExcel")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> importExcel(@RequestBody String path) {
|
||||
|
||||
Reference in New Issue
Block a user