rev: 代码规范整理
This commit is contained in:
@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
/**
|
||||
* 开启审计功能 -> @EnableJpaAuditing
|
||||
* https://www.cnblogs.com/niceyoo/p/10908647.html
|
||||
* https://blog.csdn.net/qq_36850813/article/details/101194250
|
||||
*
|
||||
* @author ldjun
|
||||
* @date 2021/2/22 9:20:19
|
||||
@@ -31,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@SpringBootApplication(exclude = {
|
||||
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
||||
})
|
||||
@ServletComponentScan //https://blog.csdn.net/qq_36850813/article/details/101194250
|
||||
@ServletComponentScan
|
||||
@EnableTransactionManagement
|
||||
@EnableMethodCache(basePackages = "org.nl")
|
||||
@EnableCreateCacheAnnotation
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.common.domain.constant;
|
||||
|
||||
/*
|
||||
/**
|
||||
* s
|
||||
* @author ZZQ
|
||||
* @Date 2022/12/26 9:29 上午
|
||||
*/
|
||||
|
||||
@@ -13,10 +13,10 @@ import java.lang.reflect.Type;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
/**
|
||||
* 泛型必须为数据tb对应do:由mybatis管理
|
||||
* @author ZZQ
|
||||
* @Date 2022/12/14 6:33 下午
|
||||
* 泛型必须为数据tb对应do:由mybatis管理
|
||||
*/
|
||||
@Data
|
||||
public class BaseQuery<T> {
|
||||
@@ -53,8 +53,10 @@ public class BaseQuery<T> {
|
||||
JSONObject json = (JSONObject)JSONObject.toJSON(this);
|
||||
Type[] types = ((ParameterizedTypeImpl) this.getClass().getGenericSuperclass()).getActualTypeArguments();
|
||||
Map<String, ColumnCache> columnMap = LambdaUtils.getColumnMap((Class<?>) types[0]);
|
||||
|
||||
String dopStr = "doP";
|
||||
json.forEach((key, vel) -> {
|
||||
if (vel != null && !key.equals("doP")){
|
||||
if (vel != null && !key.equals(dopStr)){
|
||||
QParam qParam = doP.get(key);
|
||||
if (qParam != null){
|
||||
QueryTEnum.build(qParam.type,wrapper,qParam.k,vel);
|
||||
|
||||
@@ -2,13 +2,20 @@ package org.nl.common.domain.query;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/*
|
||||
/**
|
||||
* s
|
||||
* @author ZZQ
|
||||
* @Date 2022/12/14 8:40 下午
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface LConsumer<X,Y,Z> {
|
||||
|
||||
/**
|
||||
* 切面
|
||||
* @param x 、
|
||||
* @param y 、
|
||||
* @param z 、
|
||||
*/
|
||||
void accept(X x,Y y,Z z);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,9 +11,13 @@ import java.io.Serializable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 分页参数
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@Data
|
||||
public class PageQuery implements Serializable {
|
||||
|
||||
@@ -6,7 +6,8 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nl.common.enums.QueryTEnum;
|
||||
|
||||
/*
|
||||
/**
|
||||
* s
|
||||
* @author ZZQ
|
||||
* @Date 2022/12/15 1:41 下午
|
||||
*/
|
||||
|
||||
@@ -65,7 +65,10 @@ public class DeptVo extends BaseDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "子节点数目", hidden = true)
|
||||
private Integer sub_count = 0;
|
||||
//前端显示
|
||||
|
||||
/**
|
||||
* 前端显示
|
||||
*/
|
||||
private Boolean has_children =Boolean.FALSE;
|
||||
|
||||
private List<DeptVo> children;
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
package org.nl.common.enums;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 日志类型枚举
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public enum LogTypeEnum {
|
||||
// 设备日志
|
||||
DEVICE_LOG("设备日志"),
|
||||
// v
|
||||
INTERFACE_LOG("接口日志");
|
||||
|
||||
private String desc;
|
||||
|
||||
@@ -11,10 +11,15 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NoticeEnum {
|
||||
// 未读
|
||||
HAVE_READ_OFF("1","未读"),
|
||||
// 已读
|
||||
HAVE_READ_ON("2", "已读"),
|
||||
// 未处理
|
||||
DEAL_STATUS_NO("1", "未处理"),
|
||||
// 已处理
|
||||
DEAL_STATUS_YES("2", "已处理"),
|
||||
// 无需处理
|
||||
DEAL_STATUS_NO_NEED("3", "无需处理");
|
||||
|
||||
private final String value;
|
||||
|
||||
@@ -7,7 +7,8 @@ import org.nl.common.domain.query.LConsumer;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/*
|
||||
/**
|
||||
* s
|
||||
* @author ZZQ
|
||||
* @Date 2022/12/14 8:26 下午
|
||||
*/
|
||||
|
||||
@@ -11,9 +11,13 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PointStatusEnum {
|
||||
// 空位
|
||||
EMPTY_PLACE("1", "空位"),
|
||||
// 有料
|
||||
FULL_MATERIAL("2", "有料"),
|
||||
// 空载具
|
||||
EMPTY_VEHICLE("3", "空载具");
|
||||
|
||||
private final String value;
|
||||
private final String description;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ public class GlobalExceptionHandler {
|
||||
*/
|
||||
@ExceptionHandler(value = NotLoginException.class)
|
||||
public ResponseEntity<ApiError> notLoginException(Exception e) {
|
||||
// log.error(ThrowableUtil.getStackTrace(e));
|
||||
return buildResponseEntity(ApiError.error(401,"token 失效"));
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,6 @@ public class LogAspect {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
HttpServletResponse response = attributes.getResponse();
|
||||
// HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
|
||||
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
|
||||
@@ -21,23 +21,34 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@Configuration
|
||||
public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
|
||||
// 白名单
|
||||
/**
|
||||
* 白名单
|
||||
*/
|
||||
@Autowired
|
||||
private SecurityProperties securityProperties;
|
||||
|
||||
// Sa-Token 整合 jwt (Simple 简单模式)
|
||||
/**
|
||||
* Sa-Token 整合 jwt (Simple 简单模式)
|
||||
* @return StpLogic/
|
||||
*/
|
||||
@Bean
|
||||
public StpLogic getStpLogicJwt() {
|
||||
return new StpLogicJwtForSimple();
|
||||
}
|
||||
|
||||
// 注册 Sa-Token 拦截器,打开注解式鉴权功能
|
||||
/**
|
||||
* 注册 Sa-Token 拦截器,打开注解式鉴权功能
|
||||
* @param registry
|
||||
*/
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 注册 Sa-Token 拦截器,打开注解式鉴权功能
|
||||
/*
|
||||
* 注册 Sa-Token 拦截器,打开注解式鉴权功能
|
||||
* .excludePathPatterns(securityProperties.getExcludes()): 白名单
|
||||
*/
|
||||
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns(securityProperties.getExcludes()); // 白名单
|
||||
.excludePathPatterns(securityProperties.getExcludes());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,14 @@ import org.redisson.api.RedissonClient;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 编码工具类
|
||||
* </p>
|
||||
*
|
||||
* @author lyd
|
||||
* @since 2023-05-03
|
||||
*/
|
||||
public class CodeUtil {
|
||||
|
||||
@SneakyThrows
|
||||
|
||||
@@ -6,6 +6,14 @@ import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 工具类
|
||||
* </p>
|
||||
*
|
||||
* @author lyd
|
||||
* @since 2023-05-03
|
||||
*/
|
||||
public class ColUtil {
|
||||
private static final Logger log = LoggerFactory.getLogger(ColUtil.class);
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
/**
|
||||
* 复制工具类
|
||||
* @author ZZQ
|
||||
* @Date 2022/12/1 3:35 下午
|
||||
*/
|
||||
|
||||
@@ -18,12 +18,21 @@ import java.io.IOException;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Des加密解密算法工具类
|
||||
* </p>
|
||||
*
|
||||
* @author lyd
|
||||
* @since 2023-05-03
|
||||
*/
|
||||
public class DesUtil {
|
||||
//加密算法是des
|
||||
/**
|
||||
* 加密算法是des
|
||||
*/
|
||||
private static final String ALGORITHM = "DES";
|
||||
//转换格式
|
||||
/**
|
||||
* 转换格式
|
||||
*/
|
||||
private static final String TRANSFORMATION = "DES/CBC/PKCS5Padding";
|
||||
|
||||
/**
|
||||
|
||||
@@ -97,7 +97,6 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
File file = null;
|
||||
try {
|
||||
// 用uuid作为文件名,防止生成的临时文件重复
|
||||
//file = File.createTempFile(IdUtil.simpleUUID(), prefix);
|
||||
file = new File(SYS_TEM_DIR + IdUtil.simpleUUID() + prefix);
|
||||
// MultipartFile to File
|
||||
multipartFile.transferTo(file);
|
||||
|
||||
@@ -67,7 +67,6 @@ public class SecurityUtils {
|
||||
* @return 系统用户Id
|
||||
*/
|
||||
public static Long getDeptId() {
|
||||
// return getCurrentUser().getUser().getDept().getId();
|
||||
return 1L;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package org.nl.common.utils;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
public class YamlUtil {
|
||||
public static Properties properties;
|
||||
|
||||
public static String getValue(String key) {
|
||||
return (String) properties.get(key);
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,19 @@ public class CurrentUser implements Serializable {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private String id;
|
||||
|
||||
//账号
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
private String username;
|
||||
//姓名
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String presonName;
|
||||
|
||||
//用户详细信息
|
||||
/**
|
||||
* 用户详细信息
|
||||
*/
|
||||
private SysUser user;
|
||||
|
||||
private List<String> permissions = new ArrayList<>();
|
||||
|
||||
@@ -24,10 +24,6 @@ import org.springframework.stereotype.Service;
|
||||
public class ElPermissionConfig {
|
||||
|
||||
public Boolean check(String ...permissions){
|
||||
// 获取当前用户的所有权限
|
||||
// List<String> elPermissions = SecurityUtils.getCurrentUser().getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList());
|
||||
// 判断当前用户的所有权限是否包含接口上定义的权限
|
||||
// return elPermissions.contains("admin") || Arrays.stream(permissions).anyMatch(elPermissions::contains);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package org.nl.config;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ID生成工具类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public class IdUtil {
|
||||
public static Long getLongId() {
|
||||
return cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId();
|
||||
|
||||
@@ -8,7 +8,8 @@ import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
/*
|
||||
/**
|
||||
* s
|
||||
* @author ZZQ
|
||||
* @Date 2022/11/29 2:55 下午
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,9 @@ import java.util.List;
|
||||
public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
|
||||
|
||||
private static ApplicationContext applicationContext = null;
|
||||
//数据库连接的bean名字
|
||||
/**
|
||||
* 数据库连接的bean名字
|
||||
*/
|
||||
public static String dataSourceBeanName="dataSource";
|
||||
private static final List<CallBack> CALL_BACKS = new ArrayList<>();
|
||||
private static boolean addCallback = true;
|
||||
|
||||
@@ -5,6 +5,14 @@ import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* String工具类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@Component
|
||||
public class StringConverter implements Converter<String, String> {
|
||||
|
||||
|
||||
@@ -20,25 +20,14 @@ import java.time.format.DateTimeFormatter;
|
||||
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
|
||||
|
||||
/**
|
||||
* jackson 配置
|
||||
*
|
||||
* @author Lion Li
|
||||
* @author JohanChan
|
||||
* @ProjectName Demo
|
||||
* @Description 与前端交互时对实体类中Long类型的ID字段序列号
|
||||
* @time 2021/6/23 11:30
|
||||
*/
|
||||
/**
|
||||
* @author JohanChan
|
||||
* @ProjectName Demo
|
||||
* @Description 与前端交互时对实体类中Long类型的ID字段序列号
|
||||
* @time 2021/6/23 11:30
|
||||
*/
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 对象映射器:基于jackson将Java对象转为json,或者将json转为Java对象
|
||||
* 将JSON解析为Java对象的过程称为 [从JSON反序列化Java对象]
|
||||
* 从Java对象生成JSON的过程称为 [序列化Java对象到JSON]
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public class JacksonObjectMapper extends ObjectMapper {
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
/**
|
||||
* s
|
||||
* @author ZZQ
|
||||
* @Date 2023/11/13 09:36
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,8 @@ import org.nl.config.SpringContextHolder;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
||||
/*
|
||||
/**
|
||||
* s
|
||||
* @author ZZQ
|
||||
* @Date 2023/11/13 09:45
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,14 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 日志
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public class DynamicLogAppender {
|
||||
/**
|
||||
* 通过传入的动态名字,动态设置appender
|
||||
@@ -36,7 +44,8 @@ public class DynamicLogAppender {
|
||||
//设置日志记录器的滚动策略
|
||||
TimeBasedRollingPolicy policy = new TimeBasedRollingPolicy();
|
||||
policy.setFileNamePattern(oldLogPath+dynamicName+".%d{yyyy-MM-dd}.log");
|
||||
policy.setParent(appender); //设置父节点是appender
|
||||
//设置父节点是appender
|
||||
policy.setParent(appender);
|
||||
policy.setContext(context);
|
||||
policy.start();
|
||||
|
||||
|
||||
@@ -8,12 +8,25 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 日志储存
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public class DynamicLogger {
|
||||
String logPath;//日志存储路径
|
||||
/**
|
||||
* 日志存储路径
|
||||
*/
|
||||
String logPath;
|
||||
public DynamicLogger(String logPath) {
|
||||
this.logPath = logPath;
|
||||
}
|
||||
//对外暴露日志对象:每次拿的对象从内存里拿,没有再构建
|
||||
/**
|
||||
* 对外暴露日志对象:每次拿的对象从内存里拿,没有再构建
|
||||
*/
|
||||
private static Map<String,Logger> container = new HashMap<>();
|
||||
public Logger getLogger(String dynamicName) {
|
||||
Logger logger = container.get(dynamicName);
|
||||
@@ -24,7 +37,12 @@ public class DynamicLogger {
|
||||
container.put(dynamicName,logger);
|
||||
return logger;
|
||||
}
|
||||
//构建Logger对象,给Logger指定appender
|
||||
|
||||
/**
|
||||
* 构建Logger对象,给Logger指定appender
|
||||
* @param dynamicName /
|
||||
* @return Logger
|
||||
*/
|
||||
private Logger build(String dynamicName) {
|
||||
RollingFileAppender runTaskAppender =new DynamicLogAppender().getAppender(this.logPath,dynamicName);
|
||||
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||
|
||||
@@ -21,7 +21,12 @@ import java.nio.file.Paths;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* lucene索引器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public class Indexer {
|
||||
/**
|
||||
@@ -67,7 +72,6 @@ public class Indexer {
|
||||
}
|
||||
}
|
||||
//返回索引的文件数
|
||||
// return writer.numDocs();
|
||||
return writer.numRamDocs();
|
||||
}
|
||||
|
||||
@@ -84,7 +88,6 @@ public class Indexer {
|
||||
//添加索引文档
|
||||
//Document doc = json2Doc(jsonDoc);
|
||||
// Document doc = new Document();
|
||||
// doc.add(new TextField("content", jsonDoc, Field.Store.YES));
|
||||
Field fieldContent = new TextField("fieldContent", FileUtils.readFileToString(null, "UTF-8"), Field.Store.YES);
|
||||
|
||||
//将doc添加到索引中
|
||||
@@ -132,7 +135,6 @@ public class Indexer {
|
||||
long startTime = System.currentTimeMillis();
|
||||
//步骤三:读取磁盘中文件,对应每一个文件创建一个文档对象
|
||||
Document document = new Document();
|
||||
// document.add(new TextField("fieldContent", device_id, Field.Store.YES));
|
||||
document.add(new TextField("fieldContent", msg, Field.Store.YES));
|
||||
indexWriter.addDocument(document);
|
||||
//记录索引结束时间
|
||||
@@ -144,7 +146,9 @@ public class Indexer {
|
||||
System.out.println("建立索引成功-----关闭资源");
|
||||
}
|
||||
|
||||
//系统的日志文件路径
|
||||
/**
|
||||
* 系统的日志文件路径
|
||||
*/
|
||||
@Value("${logging.file.path}")
|
||||
private String logUrl;
|
||||
|
||||
@@ -168,7 +172,6 @@ public class Indexer {
|
||||
String strLine = null;
|
||||
while (null != (strLine = bufferedReader.readLine())) {
|
||||
Document document = new Document();
|
||||
// document.add(new Field());
|
||||
document.add(new TextField("fieldContent", strLine, Field.Store.YES));
|
||||
indexWriter.addDocument(document);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,14 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 、
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public class LuceneIndexWriter {
|
||||
private static IndexWriter indexWriter;
|
||||
|
||||
@@ -52,9 +60,11 @@ public class LuceneIndexWriter {
|
||||
}
|
||||
|
||||
public static String getDate(String timeString) throws ParseException {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");//时间格式
|
||||
//时间格式
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
|
||||
Date date = sdf.parse(timeString);
|
||||
timeString = DateUtil.format(date, "yyyy-MM-dd HH:mm:ss.SSS");//格式化后的时间
|
||||
//格式化后的时间
|
||||
timeString = DateUtil.format(date, "yyyy-MM-dd HH:mm:ss.SSS");
|
||||
return timeString;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,12 @@ import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* lucene查询器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@Slf4j
|
||||
public class Searcher {
|
||||
@@ -40,13 +45,17 @@ public class Searcher {
|
||||
//标准分词器,会自动去掉空格啊,is a the等单词
|
||||
Analyzer analyzer = new IKAnalyzer(true);
|
||||
|
||||
//记录索引开始时间
|
||||
// long startTime = System.currentTimeMillis();
|
||||
// 实际上Lucene本身不支持分页。因此我们需要自己进行逻辑分页。我们要准备分页参数:
|
||||
int pageSize = Integer.parseInt(whereJson.get("size").toString());// 每页条数
|
||||
int pageNum = Integer.parseInt(whereJson.get("page").toString()) - 1;// 当前页码
|
||||
int start = pageNum * pageSize;// 当前页的起始条数
|
||||
int end = start + pageSize;// 当前页的结束条数(不能包含)
|
||||
/*
|
||||
* 记录索引开始时间
|
||||
*/
|
||||
// 每页条数
|
||||
int pageSize = Integer.parseInt(whereJson.get("size").toString());
|
||||
// 当前页码
|
||||
int pageNum = Integer.parseInt(whereJson.get("page").toString()) - 1;
|
||||
// 当前页的起始条数
|
||||
int start = pageNum * pageSize;
|
||||
// 当前页的结束条数(不能包含)
|
||||
int end = start + pageSize;
|
||||
// 创建排序对象,需要排序字段SortField,参数:字段的名称、字段的类型、是否反转如果是false,升序。true降序
|
||||
Sort sort = new Sort(new SortField(LogMessageConstant.SORT_NAME, SortField.Type.LONG,true));
|
||||
|
||||
@@ -91,9 +100,6 @@ public class Searcher {
|
||||
}
|
||||
docs = searcher.search(booleanQueryBuilder.build(), end,sort);
|
||||
//记录索引时间
|
||||
// long endTime = System.currentTimeMillis();
|
||||
// log.info("匹配{}共耗时{}毫秒",booleanQueryBuilder.build(),(endTime-startTime));
|
||||
// log.info("查询到{}条日志文件", docs.totalHits.value);
|
||||
List<String> list = new ArrayList<>();
|
||||
ScoreDoc[] scoreDocs = docs.scoreDocs;
|
||||
if (end > docs.totalHits.value) end = (int) docs.totalHits.value;
|
||||
@@ -112,7 +118,6 @@ public class Searcher {
|
||||
LogMessageConstant.COLOR_MAGENTA + doc.get(LogMessageConstant.FIELD_CLASS_NAME) +
|
||||
LogMessageConstant.COLOR_RESET + " - " +
|
||||
LogMessageConstant.COLOR_BLACK + highlightKeyword(doc.get(LogMessageConstant.FIELD_MESSAGE), whereJson.getString("message"));
|
||||
// System.out.println(logInfo);
|
||||
list.add(logInfo);
|
||||
}
|
||||
reader.close();
|
||||
@@ -141,34 +146,6 @@ public class Searcher {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException, ParseException {
|
||||
// String indexDir = "D:\\lucene\\index";
|
||||
// //查询这个字符串
|
||||
// JSONObject whereJson = new JSONObject();
|
||||
// whereJson.put("size", "500");
|
||||
// whereJson.put("page", "1");
|
||||
// whereJson.put("message", "请求方法参数");
|
||||
//// whereJson.put(LogMessageConstant.FIELD_TRACEID, "13244183367577216");
|
||||
//
|
||||
// try {
|
||||
// search(indexDir, whereJson);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// 删除
|
||||
// Directory directory = FSDirectory.open(Paths.get("D:\\lucene\\index"));
|
||||
// IndexWriterConfig config = new IndexWriterConfig();
|
||||
// IndexWriter writer = new IndexWriter(directory, config);
|
||||
//
|
||||
// String timestampAsString = "2023-10-25 14:36:12";
|
||||
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// Date date = dateFormat.parse(timestampAsString);
|
||||
// long unixTimestamp = date.getTime(); // 获取Unix时间戳
|
||||
//
|
||||
// Query query = LongPoint.newRangeQuery("time", 0L, unixTimestamp);
|
||||
// writer.deleteDocuments(query);
|
||||
//
|
||||
// writer.commit();
|
||||
// writer.close();
|
||||
// 获取当前时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
// 减去七天
|
||||
|
||||
@@ -5,11 +5,18 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @deprecated 设置静态参数初始化
|
||||
* <p>
|
||||
* 设置静态参数初始化
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@Configuration
|
||||
public class StaticConfig {
|
||||
//日志索引目录
|
||||
/**
|
||||
* 日志索引目录
|
||||
*/
|
||||
@Value("${lucene.index.path}")
|
||||
private String luceneDir;
|
||||
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package org.nl.config.lucene;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* url
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public class UrlConfig {
|
||||
public static String luceneUrl;
|
||||
|
||||
|
||||
@@ -3,16 +3,24 @@ package org.nl.config.mybatis;
|
||||
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.PackageConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.DateType;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 自动生成代码
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public class CodeGenerator {
|
||||
|
||||
/**
|
||||
@@ -27,11 +35,11 @@ public class CodeGenerator {
|
||||
System.out.println(help.toString());
|
||||
if (scanner.hasNext()) {
|
||||
String ipt = scanner.next();
|
||||
if (!StringUtils.isEmpty(ipt)) {
|
||||
if (!StringUtils.isBlank(ipt)) {
|
||||
return ipt;
|
||||
}
|
||||
}
|
||||
throw new MybatisPlusException(LangProcess.msg("error_ParamError"));
|
||||
throw new MybatisPlusException("请输入正确的" + tip + "!");
|
||||
}
|
||||
|
||||
|
||||
@@ -49,28 +57,27 @@ public class CodeGenerator {
|
||||
gc.setOutputDir(projectPath + "/src/main/java/");
|
||||
gc.setAuthor("generator");
|
||||
gc.setOpen(false);
|
||||
// gc.setSwagger2(true);
|
||||
gc.setEntityName("%s");
|
||||
gc.setServiceName("I%sService");
|
||||
gc.setServiceImplName("%sServiceImpl");
|
||||
gc.setDateType(DateType.ONLY_DATE);
|
||||
mpg.setGlobalConfig(gc);
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl("jdbc:mysql://127.0.0.1:3306/stand_lms?setUnicode=true&characterEncoding=utf8");
|
||||
dsc.setUrl("jdbc:mysql://localhost:3306/lanzhou_two?serverTimezone=GMT&setUnicode=true&characterEncoding=utf8");
|
||||
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
|
||||
dsc.setUsername("root");
|
||||
dsc.setPassword("12356");
|
||||
dsc.setPassword("root");
|
||||
mpg.setDataSource(dsc);
|
||||
// 包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
// pc.setModuleName("");
|
||||
pc.setParent("org.nl."+menusName);
|
||||
pc.setController("controller." + moduleName);
|
||||
pc.setMapper("service."+moduleName+".dao.mapper");
|
||||
pc.setService("service." + moduleName);
|
||||
pc.setServiceImpl("service." + moduleName + ".impl");
|
||||
pc.setEntity("service." + moduleName + ".dao");
|
||||
pc.setXml("service." + moduleName + ".dao.mapper");
|
||||
pc.setXml("service." + moduleName + ".dao.mapper.xml");
|
||||
mpg.setPackageInfo(pc);
|
||||
// // 自定义配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@@ -82,19 +89,13 @@ public class CodeGenerator {
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
// strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
|
||||
strategy.setColumnNaming(NamingStrategy.no_change);
|
||||
strategy.setEntityLombokModel(true);
|
||||
strategy.setRestControllerStyle(true);
|
||||
// 公共父类
|
||||
// strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
|
||||
// 写于父类中的公共字段
|
||||
// strategy.setSuperEntityColumns("id");
|
||||
strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
|
||||
strategy.setControllerMappingHyphenStyle(false);
|
||||
// strategy.setTablePrefix("sys_");
|
||||
mpg.setStrategy(strategy);
|
||||
// mpg.setTemplateEngine(new FreemarkerTemplateEngine());
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,14 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* MybatisPlus配置
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@EnableTransactionManagement
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
@@ -18,6 +18,13 @@ public interface RedisConvert {
|
||||
|
||||
RedisConvert INSTANCE = Mappers.getMapper(RedisConvert.class);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param info
|
||||
* @param dbSize
|
||||
* @param commandStats
|
||||
* @return RedisMonitorRespVO
|
||||
*/
|
||||
default RedisMonitorRespVO build(Properties info, Long dbSize, Properties commandStats) {
|
||||
RedisMonitorRespVO respVO = RedisMonitorRespVO.builder().info(info).dbSize(dbSize)
|
||||
.commandStats(new ArrayList<>(commandStats.size())).build();
|
||||
|
||||
@@ -6,7 +6,8 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
/*
|
||||
/**
|
||||
* s
|
||||
* @author ZZQ
|
||||
* @Date 2022/11/24 3:47 下午
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/*
|
||||
/**
|
||||
* s
|
||||
* @author ZZQ
|
||||
* @Date 2022/11/28 10:58 上午
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,12 @@ import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 随项目启动模块
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
|
||||
@@ -85,7 +85,6 @@ public class DeptController {
|
||||
@Log("新增部门")
|
||||
@ApiOperation("新增部门")
|
||||
@PostMapping
|
||||
// @SaCheckPermission("dept:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SysDept resources){
|
||||
deptService.createDept(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -94,7 +93,6 @@ public class DeptController {
|
||||
@Log("修改部门")
|
||||
@ApiOperation("修改部门")
|
||||
@PutMapping
|
||||
// @SaCheckPermission("dept:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SysDept dept){
|
||||
if (dept.getPid() != null && dept.getDept_id().equals(dept.getPid())) {
|
||||
throw new BadRequestException(LangProcess.msg("login_childError"));
|
||||
@@ -106,7 +104,6 @@ public class DeptController {
|
||||
@Log("删除部门")
|
||||
@ApiOperation("删除部门")
|
||||
@DeleteMapping
|
||||
// @SaCheckPermission("dept:del")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> deptIds){
|
||||
if (CollectionUtils.isEmpty(deptIds)){
|
||||
return ResponseEntity.noContent().build();
|
||||
|
||||
@@ -37,14 +37,12 @@ public class SysDictController {
|
||||
@Log("查询字典")
|
||||
@GetMapping
|
||||
@ApiOperation("查询字典")
|
||||
// @SaCheckPermission("dict:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery pageable){
|
||||
return new ResponseEntity<>(TableDataInfo.build(dictService.queryAll(whereJson,pageable)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询所有字典信息")
|
||||
@GetMapping(value = "/all")
|
||||
// @SaCheckPermission("dict:list")
|
||||
public ResponseEntity<Object> queryAll(){
|
||||
return new ResponseEntity<>(dictService.queryAll(),HttpStatus.OK);
|
||||
}
|
||||
@@ -52,7 +50,6 @@ public class SysDictController {
|
||||
@Log("新增字典")
|
||||
@PostMapping
|
||||
@ApiOperation("新增字典")
|
||||
// @SaCheckPermission("dict:add")
|
||||
public ResponseEntity<Object> create(@RequestBody Dict dict){
|
||||
dictService.create(dict);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -61,7 +58,6 @@ public class SysDictController {
|
||||
@PutMapping
|
||||
@Log("修改字典")
|
||||
@ApiOperation("修改字典")
|
||||
//@SaCheckPermission("@el.check('dict:edit')")
|
||||
public ResponseEntity<Object> updateDict(@Validated @RequestBody Dict dto){
|
||||
dictService.updateDict(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -70,7 +66,6 @@ public class SysDictController {
|
||||
@Log("删除字典")
|
||||
@ApiOperation("删除字典")
|
||||
@DeleteMapping
|
||||
// @SaCheckPermission("dict:del")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids){
|
||||
dictService.deleteBatchByIds(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -97,7 +92,6 @@ public class SysDictController {
|
||||
@Log("新增字典详情")
|
||||
@ApiOperation("新增字典详情")
|
||||
@PostMapping("/dictDetail")
|
||||
// @SaCheckPermission("dict:add")
|
||||
public ResponseEntity<Object> createDetail(@RequestBody Dict resources){
|
||||
dictService.createDetail(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -106,7 +100,6 @@ public class SysDictController {
|
||||
@Log("修改字典详情")
|
||||
@ApiOperation("修改字典详情")
|
||||
@PutMapping("/dictDetail")
|
||||
// @SaCheckPermission("dict:edit")
|
||||
public ResponseEntity<Object> updateDetail(@RequestBody Dict resources){
|
||||
dictService.updateDetail(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -115,7 +108,6 @@ public class SysDictController {
|
||||
@Log("删除字典详情")
|
||||
@ApiOperation("删除字典详情")
|
||||
@DeleteMapping(value = "/dictDetail/{id}")
|
||||
// @SaCheckPermission("dict:del")
|
||||
public ResponseEntity<Object> deleteDetail(@PathVariable String id){
|
||||
dictService.deleteDetail(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -31,14 +31,12 @@ public class SysLogController {
|
||||
private ISysLogService logService;
|
||||
@GetMapping
|
||||
@ApiOperation("日志查询")
|
||||
//@SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> query(@RequestParam Map criteria, PageQuery pageable){
|
||||
criteria.put("log_type","INFO");
|
||||
return new ResponseEntity<>(TableDataInfo.build(logService.queryAll(criteria,pageable)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/user")
|
||||
// @ApiOperation("用户日志查询")
|
||||
public ResponseEntity<Object> queryUserLog(@RequestParam Map criteria, PageQuery pageable){
|
||||
criteria.put("log_type","INFO");
|
||||
criteria.put("username", SecurityUtils.getCurrentUsername());
|
||||
@@ -47,7 +45,6 @@ public class SysLogController {
|
||||
|
||||
@GetMapping(value = "/error")
|
||||
@ApiOperation("错误日志查询")
|
||||
// @SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> queryErrorLog(@RequestParam Map criteria, PageQuery pageable){
|
||||
criteria.put("log_type","ERROR");
|
||||
return new ResponseEntity<>(TableDataInfo.build(logService.queryAll(criteria,pageable)), HttpStatus.OK);
|
||||
@@ -55,7 +52,6 @@ public class SysLogController {
|
||||
|
||||
@GetMapping(value = "/error/{id}")
|
||||
@ApiOperation("日志异常详情查询")
|
||||
// @SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> queryErrorLogs(@PathVariable String id){
|
||||
return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK);
|
||||
}
|
||||
@@ -63,7 +59,6 @@ public class SysLogController {
|
||||
@DeleteMapping(value = "/del/error")
|
||||
@Log("删除所有ERROR日志")
|
||||
@ApiOperation("删除所有ERROR日志")
|
||||
// @SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> delAllErrorLog(){
|
||||
logService.delAllByError();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -72,7 +67,6 @@ public class SysLogController {
|
||||
@DeleteMapping(value = "/del/info")
|
||||
@Log("删除所有INFO日志")
|
||||
@ApiOperation("删除所有INFO日志")
|
||||
// @SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> delAllInfoLog(){
|
||||
logService.delAllByInfo();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -38,7 +38,6 @@ public class StageController {
|
||||
@GetMapping
|
||||
@Log("查询舞台")
|
||||
@ApiOperation("查询舞台")
|
||||
//@SaCheckPermission("stage:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(stageService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
@@ -46,7 +45,6 @@ public class StageController {
|
||||
@PostMapping
|
||||
@Log("新增舞台")
|
||||
@ApiOperation("新增舞台")
|
||||
//@SaCheckPermission("stage:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Stage dto) {
|
||||
stageService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -55,7 +53,6 @@ public class StageController {
|
||||
@PutMapping
|
||||
@Log("修改舞台")
|
||||
@ApiOperation("修改舞台")
|
||||
//@SaCheckPermission("stage:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody Stage dto) {
|
||||
stageService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -63,7 +60,6 @@ public class StageController {
|
||||
|
||||
@Log("删除舞台")
|
||||
@ApiOperation("删除舞台")
|
||||
//@SaCheckPermission("stage:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
stageService.deleteAll(ids);
|
||||
@@ -73,7 +69,6 @@ public class StageController {
|
||||
@GetMapping("/selectList")
|
||||
@Log("下拉选舞台")
|
||||
@ApiOperation("下拉选舞台")
|
||||
//@SaCheckPermission("routePlan:list")
|
||||
public ResponseEntity<Object> selectList() {
|
||||
return new ResponseEntity<>(stageService.selectList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ public class StageImageController {
|
||||
@GetMapping
|
||||
@Log("查询舞台")
|
||||
@ApiOperation("查询舞台")
|
||||
//@SaCheckPermission("stageImage:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(stageImageService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
@@ -45,7 +44,6 @@ public class StageImageController {
|
||||
@PostMapping
|
||||
@Log("新增舞台图片")
|
||||
@ApiOperation("新增舞台图片")
|
||||
//@SaCheckPermission("stageImage:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StageImage entity) {
|
||||
stageImageService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -54,7 +52,6 @@ public class StageImageController {
|
||||
@PutMapping
|
||||
@Log("修改舞台")
|
||||
@ApiOperation("修改舞台")
|
||||
//@SaCheckPermission("stageImage:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StageImage entity) {
|
||||
stageImageService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -62,7 +59,6 @@ public class StageImageController {
|
||||
|
||||
@Log("删除舞台")
|
||||
@ApiOperation("删除舞台")
|
||||
//@SaCheckPermission("stageImage:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
stageImageService.deleteAll(ids);
|
||||
@@ -72,7 +68,6 @@ public class StageImageController {
|
||||
@GetMapping("/selectList")
|
||||
@Log("下拉选设备图标")
|
||||
@ApiOperation("下拉选设备图标")
|
||||
//@SaCheckPermission("routePlan:list")
|
||||
public ResponseEntity<Object> selectList() {
|
||||
return new ResponseEntity<>(stageImageService.selectList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,14 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 日志检索
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "日志检索")
|
||||
@@ -26,7 +34,6 @@ public class LuceneController {
|
||||
@PostMapping("/getAll")
|
||||
@Log("日志检索")
|
||||
@ApiOperation("日志检索")
|
||||
//@PreAuthorize("@el.check('task:list')")
|
||||
public ResponseEntity<Object> get(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(luceneService.getAll(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ public class SysNoticeController {
|
||||
@GetMapping
|
||||
@Log("查询消息通知")
|
||||
@ApiOperation("查询消息通知")
|
||||
//@SaCheckPermission("@el.check('sysNotice:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(noticeService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
@@ -41,7 +40,6 @@ public class SysNoticeController {
|
||||
@PostMapping
|
||||
@Log("新增消息通知")
|
||||
@ApiOperation("新增消息通知")
|
||||
//@SaCheckPermission("@el.check('sysNotice:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SysNotice entity){
|
||||
noticeService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -50,7 +48,6 @@ public class SysNoticeController {
|
||||
@PutMapping
|
||||
@Log("修改消息通知")
|
||||
@ApiOperation("修改消息通知")
|
||||
//@SaCheckPermission("@el.check('sysNotice:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SysNotice entity){
|
||||
noticeService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -58,7 +55,6 @@ public class SysNoticeController {
|
||||
|
||||
@Log("删除消息通知")
|
||||
@ApiOperation("删除消息通知")
|
||||
//@SaCheckPermission("@el.check('sysNotice:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
noticeService.deleteAll(ids);
|
||||
|
||||
@@ -38,7 +38,6 @@ class SysParamController {
|
||||
@GetMapping
|
||||
@Log("查询系统参数")
|
||||
@ApiOperation("查询系统参数")
|
||||
//@SaCheckPermission("param:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(paramService.queryPage(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
@@ -46,7 +45,6 @@ class SysParamController {
|
||||
@PostMapping
|
||||
@Log("新增系统参数")
|
||||
@ApiOperation("新增系统参数")
|
||||
//@SaCheckPermission("param:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Param param){
|
||||
paramService.create(param);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -55,7 +53,6 @@ class SysParamController {
|
||||
@PutMapping
|
||||
@Log("修改系统参数")
|
||||
@ApiOperation("修改系统参数")
|
||||
//@SaCheckPermission("param:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody Param param){
|
||||
paramService.update(param);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -63,7 +60,6 @@ class SysParamController {
|
||||
|
||||
@Log("删除系统参数")
|
||||
@ApiOperation("删除系统参数")
|
||||
//@SaCheckPermission("param:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
List<String> Ids = Arrays.asList(ids);
|
||||
|
||||
@@ -39,7 +39,6 @@ public class SysDataPermissionController {
|
||||
@GetMapping
|
||||
@Log("查询数据权限")
|
||||
@ApiOperation("查询数据权限")
|
||||
//@SaCheckPermission("@el.check('dataPermission:list')")
|
||||
public ResponseEntity<Object> query(SysDataPermissionQuery dataPermissionQuery, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(dataPermissionService.queryAll(dataPermissionQuery, page)), HttpStatus.OK);
|
||||
}
|
||||
@@ -47,7 +46,6 @@ public class SysDataPermissionController {
|
||||
@PostMapping
|
||||
@Log("新增数据权限")
|
||||
@ApiOperation("新增数据权限")
|
||||
//@SaCheckPermission("@el.check('dataPermission:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SysDataPermission permission) {
|
||||
dataPermissionService.create(permission);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -56,7 +54,6 @@ public class SysDataPermissionController {
|
||||
@PutMapping
|
||||
@Log("修改数据权限")
|
||||
@ApiOperation("修改数据权限")
|
||||
//@SaCheckPermission("@el.check('dataPermission:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SysDataPermission permission) {
|
||||
dataPermissionService.update(permission);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -64,7 +61,6 @@ public class SysDataPermissionController {
|
||||
|
||||
@Log("删除数据权限")
|
||||
@ApiOperation("删除数据权限")
|
||||
//@SaCheckPermission("@el.check('dataPermission:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
dataPermissionService.deleteAll(ids);
|
||||
|
||||
@@ -85,7 +85,9 @@ public class AuthorizationController {
|
||||
String uuid = IdUtil.simpleUUID();
|
||||
//当验证码类型为 arithmetic时且长度 >= 2 时,captcha.text()的结果有几率为浮点型
|
||||
String captchaValue = captcha.text();
|
||||
if (captcha.getCharType() - 1 == LoginCodeEnum.arithmetic.ordinal() && captchaValue.contains(".")) {
|
||||
|
||||
String d = ".";
|
||||
if (captcha.getCharType() - 1 == LoginCodeEnum.arithmetic.ordinal() && captchaValue.contains(d)) {
|
||||
captchaValue = captchaValue.split("\\.")[0];
|
||||
}
|
||||
// 保存
|
||||
|
||||
@@ -49,13 +49,15 @@ public class MobileAuthorizationController {
|
||||
@PostMapping(value = "/login")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception {
|
||||
String salt = "salt";
|
||||
// 密码解密 - 前端的加密规则: encrypt(根据实际更改)
|
||||
String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, authUser.getPassword());
|
||||
// 校验数据库
|
||||
// 根据用户名查询,在比对密码
|
||||
// 拿到多个已经抛出异常
|
||||
SysUser userInfo = userService.getOne(new LambdaQueryWrapper<SysUser>()
|
||||
.eq(SysUser::getUsername, authUser.getUsername())); // 拿到多个已经抛出异常
|
||||
if (ObjectUtil.isEmpty(userInfo) || !userInfo.getPassword().equals(SaSecureUtil.md5BySalt(password, "salt"))) { // 这里需要密码加密
|
||||
.eq(SysUser::getUsername, authUser.getUsername()));
|
||||
if (ObjectUtil.isEmpty(userInfo) || !userInfo.getPassword().equals(SaSecureUtil.md5BySalt(password, salt))) {
|
||||
throw new BadRequestException(LangProcess.msg("login_pwd"));
|
||||
}
|
||||
// 获取权限列表 - 登录查找权限
|
||||
@@ -74,14 +76,17 @@ public class MobileAuthorizationController {
|
||||
user.setPermissions(permissionList);
|
||||
|
||||
// SaLoginModel 配置登录相关参数
|
||||
/*
|
||||
* PE: 此次登录的客户端设备类型, 用于[同端互斥登录]时指定此次登录的设备类型
|
||||
* loginInfo: Token挂载的扩展参数 (此方法只有在集成jwt插件时才会生效)
|
||||
*/
|
||||
StpUtil.login(userInfo.getUser_id(), new SaLoginModel()
|
||||
.setDevice("PE") // 此次登录的客户端设备类型, 用于[同端互斥登录]时指定此次登录的设备类型
|
||||
.setExtra("loginInfo", user) // Token挂载的扩展参数 (此方法只有在集成jwt插件时才会生效)
|
||||
.setDevice("PE")
|
||||
.setExtra("loginInfo", user)
|
||||
);
|
||||
|
||||
// 返回 token 与 用户信息
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("roles", permissionList);
|
||||
jsonObject.put("user", userInfo);
|
||||
JSONObject authInfo = new JSONObject(2) {{
|
||||
put("token", "Bearer " + StpUtil.getTokenValue());
|
||||
|
||||
@@ -40,7 +40,6 @@ public class ToolLocalStorageController {
|
||||
|
||||
@ApiOperation("查询文件")
|
||||
@GetMapping
|
||||
// @SaCheckPermission("storage:list")
|
||||
public ResponseEntity<Object> query(ToolLocalStorageQuery criteria, PageQuery pageable) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(localStorageService.queryAll(criteria, pageable)), HttpStatus.OK);
|
||||
}
|
||||
@@ -48,7 +47,6 @@ public class ToolLocalStorageController {
|
||||
@ApiOperation("上传文件")
|
||||
@PostMapping
|
||||
@SaIgnore
|
||||
// @SaCheckPermission("storage:add")
|
||||
public ResponseEntity<Object> create(@RequestParam String name, @RequestParam("file") MultipartFile file) {
|
||||
return new ResponseEntity<>(localStorageService.create(name, file), HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -45,21 +45,18 @@ public class OnlineController {
|
||||
|
||||
@ApiOperation("查询在线用户")
|
||||
@GetMapping
|
||||
// @SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> query(String filter, Pageable pageable){
|
||||
return new ResponseEntity<>(onlineUserService.getAll(filter, pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
// @SaCheckPermission("@el.check()")
|
||||
public void download(HttpServletResponse response, String filter) throws IOException {
|
||||
onlineUserService.download(onlineUserService.getAll(filter), response);
|
||||
}
|
||||
|
||||
@ApiOperation("踢出用户")
|
||||
@DeleteMapping
|
||||
// @SaCheckPermission("@el.check()")
|
||||
public ResponseEntity<Object> delete(@RequestBody List<OnlineUserDto> keys) throws Exception {
|
||||
for (OnlineUserDto key : keys) {
|
||||
// 解密Key
|
||||
|
||||
@@ -67,7 +67,6 @@ public class UserController {
|
||||
@Log("新增用户")
|
||||
@ApiOperation("新增用户")
|
||||
@PostMapping
|
||||
// @SaCheckPermission("user:add")
|
||||
public ResponseEntity<Object> create(@RequestBody Map user){
|
||||
userService.create(user);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -76,7 +75,6 @@ public class UserController {
|
||||
@Log("修改用户")
|
||||
@ApiOperation("修改用户")
|
||||
@PutMapping
|
||||
// @SaCheckPermission("user:edit")
|
||||
public ResponseEntity<Object> update( @RequestBody Map resources) throws Exception {
|
||||
userService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -84,7 +82,6 @@ public class UserController {
|
||||
|
||||
@Log("修改用户:个人中心")
|
||||
@ApiOperation("修改用户:个人中心")
|
||||
// @PutMapping(value = "center")
|
||||
public ResponseEntity<Object> center(@RequestBody SysUser resources){
|
||||
if(!resources.getUser_id().equals(StpUtil.getLoginIdAsLong())){
|
||||
throw new BadRequestException(LangProcess.msg("error_SystemAuthError"));
|
||||
@@ -96,7 +93,6 @@ public class UserController {
|
||||
@Log("删除用户")
|
||||
@ApiOperation("删除用户")
|
||||
@DeleteMapping
|
||||
// @SaCheckPermission("user:del")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
userService.removeByIds(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -139,9 +135,4 @@ public class UserController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果当前用户的角色级别低于创建用户的角色级别,则抛出权限不足的错误
|
||||
* @param resources /
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,18 @@ import java.util.Map;
|
||||
*/
|
||||
public interface ISysCodeRuleDetailService extends IService<SysCodeRuleDetail> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param form 查询条件
|
||||
* @param pageable 工具列
|
||||
* @return IPage<SysCodeRuleDetail>
|
||||
*/
|
||||
IPage<SysCodeRuleDetail> queryAll(CodeRuleDetailQuery form, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param codeRuleDetail 实体类
|
||||
*/
|
||||
void create(SysCodeRuleDetail codeRuleDetail);
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,7 +58,7 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation=Propagation.REQUIRES_NEW)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String codeDemo(Map form) {
|
||||
String code = (String) form.get("code");
|
||||
String id = codeRuleMapper.selectOne(new LambdaQueryWrapper<SysCodeRule>().eq(SysCodeRule::getCode, code)).getId();
|
||||
|
||||
@@ -11,8 +11,11 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CodeRuleTypeEnum {
|
||||
// 固定
|
||||
FIXED("01", "固定"),
|
||||
// 日期"
|
||||
DATE("02", "日期"),
|
||||
// 顺序
|
||||
ORDER("03", "顺序");
|
||||
|
||||
private final String type;
|
||||
|
||||
@@ -49,6 +49,11 @@ public interface ISysDeptService extends IService<SysDept> {
|
||||
* @param deptIds
|
||||
*/
|
||||
void saveUserDeptRelation(String UserId, Collection<String> deptIds);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param user 标识
|
||||
*/
|
||||
void delUserDeptRelation(String user);
|
||||
|
||||
/**
|
||||
@@ -63,8 +68,17 @@ public interface ISysDeptService extends IService<SysDept> {
|
||||
*/
|
||||
void delateDept(Set<String> deptIds);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dept 实体类
|
||||
*/
|
||||
void createDept(SysDept dept);
|
||||
|
||||
/**
|
||||
* 获取部门
|
||||
* @param userId 标识
|
||||
* @return List<SysDept> 部门集合
|
||||
*/
|
||||
List<SysDept> getUserDeptByUserId(String userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,14 +24,24 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
|
||||
* @param deptId
|
||||
*/
|
||||
void saveDeptRelation(@Param("user") String UserId,@Param("depts") Collection<String> deptId);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param UserId 标识
|
||||
*/
|
||||
void delDeptRelation(@Param("user") String UserId);
|
||||
|
||||
/**
|
||||
* 获取部门
|
||||
* @param deptIds
|
||||
* @return List<Map>
|
||||
*/
|
||||
List<Map> getDeptRelation(@Param("deptIds") Collection<String> deptIds);
|
||||
|
||||
/**
|
||||
* 跟新sub_count字段
|
||||
* @param deptId
|
||||
* @return
|
||||
* @return int 数字
|
||||
*/
|
||||
int updateSubCount(String deptId);
|
||||
|
||||
@@ -42,5 +52,10 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
|
||||
*/
|
||||
String findAllChild(String pid);
|
||||
|
||||
/**
|
||||
* 根据id获取
|
||||
* @param userId 标识
|
||||
* @return List<SysDept> 实体类集合
|
||||
*/
|
||||
List<SysDept> getUserDeptByUserId(String userId);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ import org.nl.system.service.dept.dao.SysDept;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
/**
|
||||
* 查询条件
|
||||
* @author ZZQ
|
||||
* @Date 2022/12/15 4:20 下午
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,9 @@ public interface ICodeGeneratorService extends IService<CodeColumnConfig> {
|
||||
|
||||
/**
|
||||
* 获得所有的表格信息
|
||||
* @return
|
||||
* @param name
|
||||
* @param pageQuery
|
||||
* @return IPage<TablesInfo>
|
||||
*/
|
||||
IPage<TablesInfo> getTables(String name, PageQuery pageQuery);
|
||||
|
||||
@@ -52,6 +54,12 @@ public interface ICodeGeneratorService extends IService<CodeColumnConfig> {
|
||||
@Async
|
||||
void sync(IPage<CodeColumnConfig> columnInfos, List<CodeColumnConfig> columnInfoList);
|
||||
|
||||
/**
|
||||
* 视图
|
||||
* @param byTableName
|
||||
* @param columns
|
||||
* @return ResponseEntity<Object>
|
||||
*/
|
||||
ResponseEntity<Object> preview(CodeGenConfig byTableName, IPage<CodeColumnConfig> columns);
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,7 +73,12 @@ public class CodeColumnConfig implements Serializable {
|
||||
@ApiModelProperty(value = "日期注解")
|
||||
private String date_annotation;
|
||||
|
||||
// 创建默认的实体
|
||||
/**
|
||||
* 创建默认的实体
|
||||
* @param tableName /
|
||||
* @param config /
|
||||
* @return CodeColumnConfig
|
||||
*/
|
||||
public static CodeColumnConfig createDefault(String tableName, ColumnInfo config) {
|
||||
CodeColumnConfig columnConfig = new CodeColumnConfig();
|
||||
columnConfig.setColumn_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
|
||||
@@ -19,17 +19,24 @@ public interface CodeColumnConfigMapper extends BaseMapper<CodeColumnConfig> {
|
||||
|
||||
/**
|
||||
* 分页查找
|
||||
* @param name
|
||||
* @return
|
||||
* @param name /
|
||||
* @param pageSize /
|
||||
* @param offset /
|
||||
* @return List<TablesInfo>
|
||||
*/
|
||||
List<TablesInfo> getTables(String name, int pageSize, int offset);
|
||||
|
||||
/**
|
||||
* 分页查询的总数
|
||||
* @param name
|
||||
* @return
|
||||
* @return long
|
||||
*/
|
||||
long getTablesTotal(String name);
|
||||
|
||||
/**
|
||||
* 获取字段名称
|
||||
* @param tableName
|
||||
* @return List<ColumnInfo>
|
||||
*/
|
||||
List<ColumnInfo> getTablesByTableName(String tableName);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,14 @@ import org.nl.system.service.lucene.dto.LuceneLogDto;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 日志检索服务
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public interface LuceneExecuteLogService {
|
||||
/**
|
||||
* 设备光电变化实时光电信号
|
||||
@@ -23,8 +31,8 @@ public interface LuceneExecuteLogService {
|
||||
|
||||
/**
|
||||
* 接口日志,会保留历史记录
|
||||
*
|
||||
* @param luceneLogDto 日志结果对象
|
||||
* @param luceneLogDto 日志结果对象
|
||||
* @throws IOException
|
||||
*/
|
||||
void interfaceExecuteLog(LuceneLogDto luceneLogDto) throws IOException;
|
||||
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package org.nl.system.service.lucene;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 、
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public interface LuceneService {
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,71 +5,101 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 日志DTO
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LuceneLogDto {
|
||||
|
||||
/* 日志标识 */
|
||||
/**
|
||||
* 日志标识
|
||||
*/
|
||||
private String log_uuid;
|
||||
/*日志类型*/
|
||||
/**
|
||||
* 日志类型
|
||||
*/
|
||||
private String logType;
|
||||
/*设备编号*/
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String device_code;
|
||||
/*内容详情*/
|
||||
/**
|
||||
* 内容详情
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/* 任务编码 */
|
||||
/**
|
||||
* 任务编码
|
||||
*/
|
||||
private String task_code;
|
||||
|
||||
/* 指令编码 */
|
||||
/**
|
||||
* 指令编码
|
||||
*/
|
||||
private String instruct_code;
|
||||
|
||||
/* 任务标识 */
|
||||
/**
|
||||
* 任务标识
|
||||
*/
|
||||
private String task_id;
|
||||
|
||||
/* 载具号 */
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/* 备注 */
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/* 日志类型 */
|
||||
/**
|
||||
* 日志类型
|
||||
*/
|
||||
private String log_type;
|
||||
|
||||
/* 方法 */
|
||||
/**
|
||||
* 方法
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/* 请求参数 */
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private String requestparam;
|
||||
|
||||
/* 响应参数 */
|
||||
/**
|
||||
* 响应参数
|
||||
*/
|
||||
private String responseparam;
|
||||
|
||||
/* 请求地址 */
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
private String requesturl;
|
||||
|
||||
/* 状态码 */
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private String status_code;
|
||||
|
||||
/* 是否删除 1:是;0:否 */
|
||||
/**
|
||||
* 是否删除 1:是;0:否
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/* 创建者 */
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_by;
|
||||
|
||||
/* 创建时间 YYYY-MM-DD hh:mm:ss */
|
||||
/**
|
||||
* 创建时间 YYYY-MM-DD hh:mm:ss
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/* 修改者 */
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_by;
|
||||
|
||||
/* 修改时间 */
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
|
||||
|
||||
public LuceneLogDto (final String opc_server_code,final String opc_plc_code,
|
||||
final String device_code,final String to_home,final int last_home,
|
||||
final int home) {
|
||||
|
||||
@@ -32,7 +32,9 @@ import java.io.IOException;
|
||||
@Slf4j
|
||||
public class LuceneExecuteLogServiceImpl implements LuceneExecuteLogService {
|
||||
|
||||
//日志目录
|
||||
/**
|
||||
* 日志目录
|
||||
*/
|
||||
@Value("${logging.file.path}")
|
||||
private String logPath;
|
||||
|
||||
@@ -64,7 +66,6 @@ public class LuceneExecuteLogServiceImpl implements LuceneExecuteLogService {
|
||||
//向document对象中添加域。
|
||||
if (ObjectUtil.isNotEmpty(luceneLogDto.getDevice_code())) {
|
||||
document.add(new StringField("device_code", luceneLogDto.getDevice_code(), Field.Store.YES));
|
||||
// document.add(new TextField("device_code", luceneLogDto.getDevice_code(), Field.Store.YES));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(luceneLogDto.getContent())) {
|
||||
document.add(new StringField("fieldContent", luceneLogDto.getContent(), Field.Store.YES));
|
||||
@@ -90,7 +91,6 @@ public class LuceneExecuteLogServiceImpl implements LuceneExecuteLogService {
|
||||
//实现日志文件按业务独立生成日志文件到指定路径
|
||||
DynamicLogger loggerBuilder =new DynamicLogger(logPath+"\\"+luceneLogDto.getLogType()+"\\");
|
||||
Logger logger = loggerBuilder.getLogger(luceneLogDto.getDevice_code());
|
||||
// logger.info("设备{}建立索引共耗时{}毫秒",luceneLogDto.getDevice_code(),endTime-startTime);
|
||||
logger.info("{}",luceneLogDto.toString());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.nl.system.service.lucene.impl;
|
||||
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -10,18 +8,25 @@ import org.nl.config.language.LangProcess;
|
||||
import org.nl.config.lucene.Searcher;
|
||||
import org.nl.system.service.lucene.LuceneService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 、
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class LuceneServiceImpl implements LuceneService {
|
||||
|
||||
//日志索引目录
|
||||
/**
|
||||
* 日志索引目录
|
||||
*/
|
||||
@Value("${lucene.index.path}")
|
||||
private String luceneUrl;
|
||||
|
||||
|
||||
@@ -98,7 +98,11 @@ public interface ISysMenuService extends IService<SysMenu> {
|
||||
*/
|
||||
void update(SysMenu menu);
|
||||
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
* @param userId 标识
|
||||
* @return List<MenuDto> 菜单集合
|
||||
*/
|
||||
List<MenuDto> findByUser(String userId);
|
||||
|
||||
/**
|
||||
@@ -108,13 +112,24 @@ public interface ISysMenuService extends IService<SysMenu> {
|
||||
* @return /
|
||||
*/
|
||||
List<MenuVo> buildMenus(List<MenuDto> menuDtos);
|
||||
|
||||
/**
|
||||
* 获取菜单父级
|
||||
* @param menuDtos 、
|
||||
* @param pid 父级id
|
||||
* @return List<MenuVo> 菜单集合
|
||||
*/
|
||||
List<MenuVo> buildMenus(List<MenuDto> menuDtos,String pid);
|
||||
|
||||
/**
|
||||
* 获取菜单
|
||||
* @param systemType /
|
||||
* @return List<MenuVo> 菜单集合
|
||||
*/
|
||||
List<MenuVo> buildMenus(String systemType);
|
||||
|
||||
/**
|
||||
* 构建菜单树
|
||||
*
|
||||
* @param menuDtos 原始数据
|
||||
* @return /
|
||||
*/
|
||||
@@ -122,18 +137,25 @@ public interface ISysMenuService extends IService<SysMenu> {
|
||||
|
||||
/**
|
||||
* 懒加载菜单数据
|
||||
*
|
||||
* @param pid /
|
||||
* @return /
|
||||
*/
|
||||
List<SysMenu> getMenus(String pid);
|
||||
|
||||
/**
|
||||
* s
|
||||
* @param sysMenu
|
||||
* @return
|
||||
*/
|
||||
MenuDto doToDto(SysMenu sysMenu);
|
||||
|
||||
/**
|
||||
* 根据roleId获取
|
||||
* @param roleId /
|
||||
* @param systemType /
|
||||
* @param category /
|
||||
* @return List<Map> 集合
|
||||
*/
|
||||
List<Map> getMenusByRole(String roleId, String systemType, String category);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,9 +18,19 @@ import java.util.Map;
|
||||
* @since 2022-12-15
|
||||
*/
|
||||
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
|
||||
/**
|
||||
* 查询菜单
|
||||
* @return List<SysMenu>
|
||||
*/
|
||||
@Select("select * from sys_menu where (pid is null or pid = '' or pid = 0 )")
|
||||
List<SysMenu> findByPidIsNull();
|
||||
|
||||
/**
|
||||
* 根据父级id查询
|
||||
* @param pid 父级id
|
||||
* @return List<SysMenu>
|
||||
*/
|
||||
@Select("select * from sys_menu where pid = #{pid}")
|
||||
List<SysMenu> findByPid(@Param("pid") String pid);
|
||||
|
||||
@@ -56,7 +66,18 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
@Delete(value = "delete from sys_roles_menus where menu_id = #{menuId}")
|
||||
void untiedMenu(String menuId);
|
||||
|
||||
/**
|
||||
* 获取菜单路由
|
||||
* @param systemType /
|
||||
* @param category /
|
||||
* @return List<Map>
|
||||
*/
|
||||
List<Map> getMenusByRole(@Param("systemType") String systemType, @Param("category")String category);
|
||||
|
||||
/**
|
||||
* 获取父级id
|
||||
* @param pid
|
||||
* @return /
|
||||
*/
|
||||
String findAllChild(String pid);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,14 @@ import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单Dto
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@Data
|
||||
public class MenuDto extends BaseDTO implements Serializable {
|
||||
|
||||
@@ -95,13 +103,17 @@ public class MenuDto extends BaseDTO implements Serializable {
|
||||
}
|
||||
|
||||
public String getLocalTitle(String local){
|
||||
if ("in".equals(local)){
|
||||
String in = "in";
|
||||
String en = "en";
|
||||
String zh = "zh";
|
||||
|
||||
if (in.equals(local)){
|
||||
return in_title;
|
||||
}
|
||||
if ("en".equals(local)){
|
||||
if (en.equals(local)){
|
||||
return en_title;
|
||||
}
|
||||
if ("zh".equals(local)){
|
||||
if (zh.equals(local)){
|
||||
return zh_title;
|
||||
}
|
||||
return title;
|
||||
|
||||
@@ -193,7 +193,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
public void update(SysMenu resources) {
|
||||
String menuId = resources.getMenu_id();
|
||||
SysMenu menu = baseMapper.selectById(menuId);
|
||||
String allChild = baseMapper.findAllChild(menuId); // 获取当前菜单的所有子菜单
|
||||
// 获取当前菜单的所有子菜单
|
||||
String allChild = baseMapper.findAllChild(menuId);
|
||||
List<String> allChildIds = ObjectUtil.isNotEmpty(allChild)?Arrays.asList(allChild.split(",")):null;
|
||||
if (ObjectUtil.isNotEmpty(allChildIds) && allChildIds.contains(resources.getPid())){
|
||||
throw new BadRequestException(LangProcess.msg("login_childError"));
|
||||
|
||||
@@ -46,30 +46,31 @@ public interface ISysNoticeService extends IService<SysNotice> {
|
||||
|
||||
/**
|
||||
* 获取未读的接收消息条数
|
||||
* @return Integer 数字
|
||||
*/
|
||||
Integer countByReceiveNotRead();
|
||||
|
||||
/**
|
||||
* 获取不同类型的前三条信息
|
||||
* @return
|
||||
* @return LinkedList<List<SysNotice>>
|
||||
*/
|
||||
LinkedList<List<SysNotice>> pageByReceive();
|
||||
|
||||
/**
|
||||
* 标记已读
|
||||
* @param id
|
||||
* @param id 、
|
||||
*/
|
||||
void read(String id);
|
||||
|
||||
/**
|
||||
* 处理信息
|
||||
* @param id
|
||||
* @param id 、
|
||||
*/
|
||||
void deal(String id);
|
||||
|
||||
/**
|
||||
* 批量已读
|
||||
* @param jsonObject
|
||||
* @param jsonObject 、
|
||||
*/
|
||||
void changeRead(JSONObject jsonObject);
|
||||
|
||||
|
||||
@@ -161,7 +161,6 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||
|
||||
@Override
|
||||
public void createNotice(String msg, String title, String type) {
|
||||
// log.info("创建消息通知-信息:{}, 标题:{}, 类型:{}", msg, title, type);
|
||||
// 获取标题相同的信息
|
||||
List<SysNotice> sysNotices = sysNoticeMapper.selectList(new LambdaQueryWrapper<SysNotice>()
|
||||
.eq(SysNotice::getNotice_title, title)
|
||||
|
||||
@@ -33,34 +33,39 @@ public interface ISysDataPermissionService extends IService<SysDataPermission> {
|
||||
|
||||
/**
|
||||
* 新增数据权限
|
||||
* @param dto
|
||||
* @param permission 实体类
|
||||
*/
|
||||
void create(SysDataPermission permission);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param permission
|
||||
* @param permission 实体类
|
||||
*/
|
||||
void update(SysDataPermission permission);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @param ids 唯一id
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* 获取类型
|
||||
* @return List<Dict>
|
||||
*/
|
||||
List<Dict> getDataScopeType();
|
||||
|
||||
/**
|
||||
* 获取数据权限下拉框
|
||||
* @return
|
||||
* @return List<SysDataPermission>
|
||||
*/
|
||||
List<SysDataPermission> getDataPermissionOption();
|
||||
|
||||
/**
|
||||
* 获取所有数据
|
||||
* @param id 标识
|
||||
* @return List<UserDataPermissionDto> 实体类集合
|
||||
*/
|
||||
List<UserDataPermissionDto> getDataShow(String id);
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,15 +17,45 @@ import java.util.List;
|
||||
*/
|
||||
public interface SysDataPermissionMapper extends BaseMapper<SysDataPermission> {
|
||||
|
||||
/**
|
||||
* 查询
|
||||
* @param userId 、
|
||||
* @param permissionScopeType 、
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> findDataScopeUserIdBySelfUserIdAndScopeType(String userId, String permissionScopeType);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
* @param userId 、
|
||||
* @param permissionScopeType 、
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> findDataScopeDeptIdBySelfUserIdAndScopeType(String userId, String permissionScopeType);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param userId 标识
|
||||
*/
|
||||
void deleteScopeBySelfUserId(String userId);
|
||||
|
||||
/**
|
||||
* 插入
|
||||
* @param dataScope 、
|
||||
*/
|
||||
void insertDataScope(@Param("dataScope") SysDataScope dataScope);
|
||||
|
||||
/**
|
||||
* 插入
|
||||
* @param dataScope 、
|
||||
*/
|
||||
void insertDataScopes(@Param("dataScope") SysDataScope dataScope);
|
||||
|
||||
/**
|
||||
* 获取明细
|
||||
* @param selfUserId 、
|
||||
* @param permissionScopeType 、
|
||||
* @return List<SysDataScope>
|
||||
*/
|
||||
List<SysDataScope> getDataDetail(String selfUserId, String permissionScopeType);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,11 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
public enum DataScopeEnum {
|
||||
|
||||
// 用户数据权限
|
||||
USER("user", "用户数据权限"),
|
||||
// 部门数据权限
|
||||
DEPT("dept", "部门数据权限"),
|
||||
// 自身数据权限
|
||||
SELF("self", "自身数据权限");
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
@@ -142,7 +142,8 @@ public class SysDataPermissionServiceImpl extends ServiceImpl<SysDataPermissionM
|
||||
// 保存用户数据权限
|
||||
userService.insertDataPermission(userDataPermissionDto);
|
||||
JSONArray users = scopeObj.getJSONArray("users");
|
||||
if (ObjectUtil.isNotEmpty(users)) { // 如果是用户直接将用户的id绑定进去
|
||||
// 如果是用户直接将用户的id绑定进去
|
||||
if (ObjectUtil.isNotEmpty(users)) {
|
||||
for (int j = 0; j < users.size(); j++) {
|
||||
JSONObject user = users.getJSONObject(j);
|
||||
String userId = user.getString("user_id");
|
||||
@@ -154,7 +155,8 @@ public class SysDataPermissionServiceImpl extends ServiceImpl<SysDataPermissionM
|
||||
}
|
||||
}
|
||||
JSONArray depts = scopeObj.getJSONArray("depts");
|
||||
if (ObjectUtil.isNotEmpty(depts)) { // 如果是部门,先根据部门id求出所有的用户id
|
||||
// 如果是部门,先根据部门id求出所有的用户id
|
||||
if (ObjectUtil.isNotEmpty(depts)) {
|
||||
for (int j = 0; j < depts.size(); j++) {
|
||||
JSONObject dept = depts.getJSONObject(j);
|
||||
String dept_id = dept.getString("dept_id");
|
||||
|
||||
@@ -67,11 +67,16 @@ public interface ISysQuartzJobService extends IService<SysQuartzJob> {
|
||||
*/
|
||||
void deleteJob(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 执行任务
|
||||
* @param tasks 标识
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
void executionSubJob(String[] tasks) throws InterruptedException;
|
||||
|
||||
/**
|
||||
* 查找已启动的任务
|
||||
* @return
|
||||
* @return List<SysQuartzJob>
|
||||
*/
|
||||
List<SysQuartzJob> findByIsPauseIsFalse();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,14 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 项目启动时重新激活启用的定时任务
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Order(100)
|
||||
@@ -28,9 +36,5 @@ public class JobRunner implements ApplicationRunner {
|
||||
*/
|
||||
@Override
|
||||
public void run(ApplicationArguments applicationArguments) {
|
||||
log.info("--------------------注入定时任务---------------------");
|
||||
// List<SysQuartzJob> quartzJobs = quartzJobService.findByIsPauseIsFalse();
|
||||
// quartzJobs.forEach(quartzManage::addJob);
|
||||
log.info("--------------------定时任务注入完成---------------------");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ public class AutoClearInteractionData {
|
||||
public void run(){
|
||||
Param max_rows_to_keep = paramService.findByCode("max_rows_to_keep");
|
||||
Param max_rows_to_delete = paramService.findByCode("max_rows_to_delete");
|
||||
// recordService.deleteByDay(interactionDay.getValue());
|
||||
recordService.deleteByRows(max_rows_to_keep, max_rows_to_delete);
|
||||
log.info("run 执行成功");
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ public class AutoClearLuceneData {
|
||||
// 获取时间戳
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
|
||||
Date date = dateFormat.parse(String.valueOf(sevenDaysAgo));
|
||||
long unixTimestamp = date.getTime(); // 获取Unix时间戳
|
||||
// 获取Unix时间戳
|
||||
long unixTimestamp = date.getTime();
|
||||
Query query = LongPoint.newRangeQuery("time", 0L, unixTimestamp);
|
||||
writer.deleteDocuments(query);
|
||||
writer.commit();
|
||||
|
||||
@@ -18,7 +18,7 @@ public class RedisKeyDefine {
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum KeyTypeEnum {
|
||||
|
||||
//
|
||||
STRING("String"),
|
||||
LIST("List"),
|
||||
HASH("Hash"),
|
||||
@@ -38,10 +38,12 @@ public class RedisKeyDefine {
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TimeoutTypeEnum {
|
||||
|
||||
FOREVER(1), // 永不超时
|
||||
DYNAMIC(2), // 动态超时
|
||||
FIXED(3); // 固定超时
|
||||
// 永不超时
|
||||
FOREVER(1),
|
||||
// 动态超时
|
||||
DYNAMIC(2),
|
||||
// 固定超时
|
||||
FIXED(3);
|
||||
|
||||
/**
|
||||
* 类型
|
||||
|
||||
@@ -12,17 +12,17 @@ public class RedisKeyRegistry {
|
||||
/**
|
||||
* Redis RedisKeyDefine 数组
|
||||
*/
|
||||
private static final List<RedisKeyDefine> defines = new ArrayList<>();
|
||||
private static final List<RedisKeyDefine> DE_FINES = new ArrayList<>();
|
||||
|
||||
public static void add(RedisKeyDefine define) {
|
||||
defines.add(define);
|
||||
DE_FINES.add(define);
|
||||
}
|
||||
|
||||
public static List<RedisKeyDefine> list() {
|
||||
return defines;
|
||||
return DE_FINES;
|
||||
}
|
||||
|
||||
public static int size() {
|
||||
return defines.size();
|
||||
return DE_FINES.size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ public class RedisServiceImpl implements RedisService {
|
||||
Long dbSize = stringRedisTemplate.execute(RedisServerCommands::dbSize);
|
||||
Properties commandStats = stringRedisTemplate.execute((
|
||||
RedisCallback<Properties>) connection -> connection.info("commandstats"));
|
||||
assert commandStats != null; // 断言,避免警告
|
||||
// 断言,避免警告
|
||||
assert commandStats != null;
|
||||
// 拼接结果返回
|
||||
// 转成实体
|
||||
JSONObject json = new JSONObject();
|
||||
@@ -45,9 +46,7 @@ public class RedisServiceImpl implements RedisService {
|
||||
|
||||
@Override
|
||||
public JSONObject getKeyDefineList() {
|
||||
// List<RedisKeyDefine> keyDefines = RedisKeyRegistry.list();
|
||||
JSONObject json = new JSONObject();
|
||||
// json.put("info", RedisConvert.INSTANCE.convertList(keyDefines));
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -60,9 +59,12 @@ public class RedisServiceImpl implements RedisService {
|
||||
while ( it.hasNext() ) {
|
||||
String key = it.next();
|
||||
JSONObject redis = new JSONObject();
|
||||
DataType dataType = stringRedisTemplate.type(key); // 数据类型
|
||||
String s = stringRedisTemplate.opsForValue().get(key); // 获取值
|
||||
Long expire = stringRedisTemplate.getExpire(key); // 获取剩余时间
|
||||
// 数据类型
|
||||
DataType dataType = stringRedisTemplate.type(key);
|
||||
// 获取值
|
||||
String s = stringRedisTemplate.opsForValue().get(key);
|
||||
// 获取剩余时间
|
||||
Long expire = stringRedisTemplate.getExpire(key);
|
||||
redis.put("dataType", dataType);
|
||||
redis.put("key", key);
|
||||
redis.put("value", s);
|
||||
|
||||
@@ -20,6 +20,12 @@ import java.util.Set;
|
||||
*/
|
||||
public interface ISysRoleService extends IService<SysRole> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param param 查询条件
|
||||
* @param page 分页工具
|
||||
* @return IPage<SysRole> 实体类集合
|
||||
*/
|
||||
IPage<SysRole> query(Map param, PageQuery page);
|
||||
|
||||
/**
|
||||
@@ -60,5 +66,10 @@ public interface ISysRoleService extends IService<SysRole> {
|
||||
* @param deptIds
|
||||
*/
|
||||
void saveUserRoleRelation(String UserId, List<String> deptIds);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param UserId 标识
|
||||
*/
|
||||
void delUserRoleRelation(String UserId);
|
||||
}
|
||||
|
||||
@@ -17,11 +17,30 @@ import java.util.List;
|
||||
*/
|
||||
public interface SysRoleMapper extends BaseMapper<SysRole> {
|
||||
|
||||
/**
|
||||
* 保存路由
|
||||
* @param UserId /
|
||||
* @param roles /
|
||||
*/
|
||||
void saveRoleRelation(@Param("user") String UserId, @Param("roles") Collection<String> roles);
|
||||
|
||||
/**
|
||||
* 删除路由
|
||||
* @param UserId /
|
||||
*/
|
||||
void delRoleRelation(@Param("user") String UserId);
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteRoleMenuBatchRoleIds(Collection<String> ids);
|
||||
|
||||
/**
|
||||
* 查询菜单
|
||||
* @param roleId /
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> selectMenuIdsByRoles(String roleId);
|
||||
|
||||
/**
|
||||
|
||||
@@ -140,8 +140,8 @@ public class OnlineUserService {
|
||||
if (ObjectUtil.isNotEmpty(one)) {
|
||||
redisUtils.del("oline-" + one.getUsername());
|
||||
}
|
||||
// 下线
|
||||
StpUtil.logoutByTokenValue(key.getKey()); // 通过token强退
|
||||
// 通过token强退
|
||||
StpUtil.logoutByTokenValue(key.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,8 +150,8 @@ public class OnlineUserService {
|
||||
*/
|
||||
public void kickOut(String key) {
|
||||
redisUtils.del(key);
|
||||
// 下线
|
||||
StpUtil.logoutByTokenValue(key); // 通过token强退
|
||||
// 通过token强退
|
||||
StpUtil.logoutByTokenValue(key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -246,10 +246,15 @@ public class OnlineUserService {
|
||||
if (StrUtil.isEmpty(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) {
|
||||
throw new BadRequestException(LangProcess.msg("login_CodeError"));
|
||||
}
|
||||
// 校验数据库
|
||||
// 根据用户名查询,在比对密码
|
||||
|
||||
/*
|
||||
* 校验数据库
|
||||
* username:根据用户名查询,在比对密码
|
||||
* SaSecureUtil.md5BySalt(password, "salt"): 这里需要密码加密
|
||||
*/
|
||||
String salt = "salt";
|
||||
SysUser userInfo = sysUserService.getOne(new QueryWrapper<SysUser>().eq("username",authUser.getUsername()));
|
||||
if (userInfo == null||!userInfo.getPassword().equals(SaSecureUtil.md5BySalt(password, "salt"))) { // 这里需要密码加密
|
||||
if (userInfo == null||!userInfo.getPassword().equals(SaSecureUtil.md5BySalt(password, salt))) {
|
||||
throw new BadRequestException(LangProcess.msg("login_pwd"));
|
||||
}
|
||||
|
||||
@@ -269,10 +274,14 @@ public class OnlineUserService {
|
||||
user.setUser(userInfo);
|
||||
user.setPermissions(permissionList);
|
||||
|
||||
// SaLoginModel 配置登录相关参数
|
||||
/*
|
||||
* SaLoginModel 配置登录相关参数
|
||||
* PC: 此次登录的客户端设备类型, 用于[同端互斥登录]时指定此次登录的设备类型
|
||||
* loginInfo: Token挂载的扩展参数 (此方法只有在集成jwt插件时才会生效)
|
||||
*/
|
||||
StpUtil.login(userInfo.getUser_id(), new SaLoginModel()
|
||||
.setDevice("PC") // 此次登录的客户端设备类型, 用于[同端互斥登录]时指定此次登录的设备类型
|
||||
.setExtra("loginInfo", user) // Token挂载的扩展参数 (此方法只有在集成jwt插件时才会生效)
|
||||
.setDevice("PC")
|
||||
.setExtra("loginInfo", user)
|
||||
);
|
||||
|
||||
// 返回 token 与 用户信息
|
||||
|
||||
@@ -20,6 +20,12 @@ import java.util.Set;
|
||||
*/
|
||||
public interface IToolLocalStorageService extends IService<ToolLocalStorage> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param criteria 查询条件
|
||||
* @param pageable 分页工具
|
||||
* @return IPage<ToolLocalStorage>
|
||||
*/
|
||||
IPage<ToolLocalStorage> queryAll(ToolLocalStorageQuery criteria, PageQuery pageable);
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,20 +21,63 @@ import java.util.Map;
|
||||
*/
|
||||
public interface ISysUserService extends IService<SysUser> {
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
* @param avatar 、
|
||||
* @return Map<String, String>
|
||||
*/
|
||||
Map<String, String> updateAvatar(MultipartFile avatar);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param query 查询条件
|
||||
* @param pageQuery 分页工具
|
||||
* @return List<SysUserDetail> 实体类集合
|
||||
*/
|
||||
List<SysUserDetail> getUserDetail(UserQuery query, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param userDetail 实体类
|
||||
*/
|
||||
void create(Map userDetail);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param userDetail 实体类
|
||||
*/
|
||||
void update(Map userDetail);
|
||||
|
||||
/**
|
||||
* 根据permissionId查询
|
||||
* @param permissionId 查询条件
|
||||
* @return List<UserDataPermissionDto> 实体类集合
|
||||
*/
|
||||
List<UserDataPermissionDto> getUserDataPermissionByPermissionId(String permissionId);
|
||||
|
||||
/**
|
||||
* 根据userId 查找
|
||||
* @param userId 条件
|
||||
* @return List<UserDataPermissionDto> 实体类集合
|
||||
*/
|
||||
List<UserDataPermissionDto> getUserDataPermissionByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 根据id删除
|
||||
* @param userId 条件
|
||||
*/
|
||||
void deleteDataPermissionById(String userId);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param userDataPermissionDto 实体类
|
||||
*/
|
||||
void insertDataPermission(UserDataPermissionDto userDataPermissionDto);
|
||||
|
||||
/**
|
||||
* 根据deptId获取
|
||||
* @param deptId 部门id
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> getUserIdByDeptId(String deptId);
|
||||
}
|
||||
|
||||
@@ -22,17 +22,52 @@ import java.util.Map;
|
||||
*/
|
||||
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param query 查询条件
|
||||
* @param page 分页工具
|
||||
* @return List<SysUserDetail> 实体类集合
|
||||
*/
|
||||
List<SysUserDetail> getUserDetail(@Param("query") UserQuery query, @Param("page")PageQuery page);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param query 查询条件
|
||||
* @param page 分页工具
|
||||
* @return List<Map<String,Object>>
|
||||
*/
|
||||
List<Map<String,Object>> getDetailForMap(@Param("query") UserQuery query, @Param("page")PageQuery page);
|
||||
|
||||
/**
|
||||
* 根据permissionId查询
|
||||
* @param permissionId 、
|
||||
* @return List<UserDataPermissionDto> 实体类集合
|
||||
*/
|
||||
List<UserDataPermissionDto> getUserDataPermissionByPermissionId(String permissionId);
|
||||
|
||||
/**
|
||||
* 根据userId查询
|
||||
* @param userId /
|
||||
* @return List<UserDataPermissionDto> 实体类集合
|
||||
*/
|
||||
List<UserDataPermissionDto> getUserDataPermissionByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 根据id删除
|
||||
* @param userId /
|
||||
*/
|
||||
void deleteDataPermissionById(String userId);
|
||||
|
||||
/**
|
||||
* 插入
|
||||
* @param dataPermission 实体类
|
||||
*/
|
||||
void insertDataPermission(@Param("dataPermission") UserDataPermissionDto dataPermission);
|
||||
|
||||
/**
|
||||
* 根据部门id查询
|
||||
* @param deptId 部门id
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> getUserIdByDeptId(String deptId);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.nl.system.service.user.dto;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import lombok.Data;
|
||||
import org.nl.system.service.dept.dao.SysDept;
|
||||
import org.nl.system.service.role.dao.SysRole;
|
||||
@@ -8,7 +7,8 @@ import org.nl.system.service.user.dao.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
/**
|
||||
* s
|
||||
* @author ZZQ
|
||||
* @Date 2022/12/16 10:02 上午
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,8 @@ import org.nl.common.domain.query.QParam;
|
||||
import org.nl.common.enums.QueryTEnum;
|
||||
import org.nl.system.service.user.dao.SysUser;
|
||||
|
||||
/*
|
||||
/**
|
||||
* 条件
|
||||
* @author ZZQ
|
||||
* @Date 2022/12/15 9:53 上午
|
||||
*/
|
||||
|
||||
@@ -97,7 +97,7 @@ public class ISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Map userDetail) {
|
||||
if(CollectionUtils.isEmpty(userDetail) || ObjectUtil.isEmpty(userDetail.get("user_id"))){
|
||||
return;
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package org.nl.wms;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/11/13 10:10
|
||||
*/
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/langest")
|
||||
public class LanguageTest {
|
||||
|
||||
@GetMapping("/code")
|
||||
@SaIgnore
|
||||
public String language(String code){
|
||||
return LangProcess.msg(code,"");
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ public class MdBaseClassstandardController {
|
||||
@GetMapping
|
||||
@Log("查询基础分类")
|
||||
@ApiOperation("查询基础分类")
|
||||
//@SaCheckPermission("@el.check('mdBaseClassstandard:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(mdBaseClassstandardService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
@@ -42,7 +41,6 @@ public class MdBaseClassstandardController {
|
||||
@PostMapping
|
||||
@Log("新增基础分类")
|
||||
@ApiOperation("新增基础分类")
|
||||
//@SaCheckPermission("@el.check('mdBaseClassstandard:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MdBaseClassstandard entity){
|
||||
mdBaseClassstandardService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -51,7 +49,6 @@ public class MdBaseClassstandardController {
|
||||
@PutMapping
|
||||
@Log("修改基础分类")
|
||||
@ApiOperation("修改基础分类")
|
||||
//@SaCheckPermission("@el.check('mdBaseClassstandard:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody MdBaseClassstandard entity){
|
||||
mdBaseClassstandardService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -59,7 +56,6 @@ public class MdBaseClassstandardController {
|
||||
|
||||
@Log("删除基础分类")
|
||||
@ApiOperation("删除基础分类")
|
||||
//@SaCheckPermission("@el.check('mdBaseClassstandard:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody List<String> ids) {
|
||||
mdBaseClassstandardService.deleteAll(ids);
|
||||
@@ -76,14 +72,12 @@ public class MdBaseClassstandardController {
|
||||
@GetMapping("/loadClass")
|
||||
@Log("查询基础类型")
|
||||
@ApiOperation("查询基础类型")
|
||||
//@PreAuthorize("@el.check('materialtype:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(mdBaseClassstandardService.loadClass(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询类别:根据ID获取同级与上级数据")
|
||||
@PostMapping("/superior")
|
||||
//@PreAuthorize("@el.check('user:list','dept:list')")
|
||||
public ResponseEntity<Object> getSuperior(@RequestBody String id) {
|
||||
MdBaseClassstandard classstandard = mdBaseClassstandardService.getById(id);
|
||||
ArrayList<MdBaseClassstandard> list = mdBaseClassstandardService.getSuperior(classstandard, new ArrayList<>());
|
||||
|
||||
@@ -56,7 +56,7 @@ public interface IMdBaseClassstandardService extends IService<MdBaseClassstandar
|
||||
List<MdBaseClassstandard> loadClass(Map whereJson);
|
||||
|
||||
/**
|
||||
*
|
||||
* 获取父级树
|
||||
* @param classstandard
|
||||
* @param objects
|
||||
* @return
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user