add: 日志管理、mes测试接口、多数据源
This commit is contained in:
@@ -33,6 +33,12 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- dynamic-datasource -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>4.1.3</version>
|
||||
</dependency>
|
||||
<!-- https://onew.me/logback/2018/09/17/logback_win.html-->
|
||||
<dependency>
|
||||
<groupId>org.fusesource.jansi</groupId>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
|
||||
import com.alicp.jetcache.anno.config.EnableMethodCache;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -8,6 +9,7 @@ import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
@@ -28,7 +30,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@Api(hidden = true)
|
||||
@SpringBootApplication(exclude = {
|
||||
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
||||
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
|
||||
DataSourceAutoConfiguration.class,
|
||||
DruidDataSourceAutoConfigure.class
|
||||
})
|
||||
@ServletComponentScan //https://blog.csdn.net/qq_36850813/article/details/101194250
|
||||
@EnableTransactionManagement
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* 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.common.logging.aspect;
|
||||
|
||||
@@ -30,7 +30,8 @@ import org.nl.common.utils.RequestHolder;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.StringUtils;
|
||||
import org.nl.common.utils.ThrowableUtil;
|
||||
import org.nl.common.logging.domain.Log;
|
||||
import org.nl.system.service.logging.ISysLogService;
|
||||
import org.nl.system.service.logging.dao.SysLog;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -46,45 +47,43 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-24
|
||||
*//*
|
||||
*/
|
||||
|
||||
@Component
|
||||
@Aspect
|
||||
@Slf4j
|
||||
public class LogAspect {
|
||||
|
||||
private final LogService logService;
|
||||
private final ISysLogService logService;
|
||||
|
||||
ThreadLocal<Long> currentTime = new ThreadLocal<>();
|
||||
|
||||
public LogAspect(LogService logService) {
|
||||
public LogAspect(ISysLogService logService) {
|
||||
this.logService = logService;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
/**
|
||||
* 配置切入点
|
||||
*//*
|
||||
*/
|
||||
|
||||
@Pointcut("@annotation(org.nl.common.logging.annotation.Log)")
|
||||
public void logPointcut() {
|
||||
// 该方法无方法体,主要为了让同类中其他方法使用此切入点
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
/**
|
||||
* 配置环绕通知,使用在方法logPointcut()上注册的切入点
|
||||
*
|
||||
* @param joinPoint join point for advice
|
||||
*//*
|
||||
*/
|
||||
|
||||
@Around("logPointcut()")
|
||||
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
HttpServletResponse response = attributes.getResponse();
|
||||
// HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
@@ -94,26 +93,21 @@ public class LogAspect {
|
||||
Method method = signature.getMethod();
|
||||
// 方法路径
|
||||
String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
|
||||
String params=getParameter(method, joinPoint.getArgs());
|
||||
|
||||
log.info("请求uri:{}", request.getRequestURI());
|
||||
log.info("请求方法:{}",methodName);
|
||||
log.info("请求方法参数:{}",params);
|
||||
String params = getParameter(method, joinPoint.getArgs());
|
||||
|
||||
Object result;
|
||||
currentTime.set(System.currentTimeMillis());
|
||||
result = joinPoint.proceed();
|
||||
Log log = new Log("INFO",System.currentTimeMillis() - currentTime.get());
|
||||
SysLog log = new SysLog("INFO", System.currentTimeMillis() - currentTime.get());
|
||||
currentTime.remove();
|
||||
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request),joinPoint, log);
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), joinPoint, log);
|
||||
return result;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
/**
|
||||
* 根据方法和传入的参数获取请求参数
|
||||
*//*
|
||||
*/
|
||||
|
||||
private String getParameter(Method method, Object[] args) {
|
||||
List<Object> argList = new ArrayList<>();
|
||||
@@ -142,29 +136,28 @@ public class LogAspect {
|
||||
return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList);
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
|
||||
/**
|
||||
* 配置异常通知
|
||||
*
|
||||
* @param joinPoint join point for advice
|
||||
* @param e exception
|
||||
*//*
|
||||
* @param e exception
|
||||
*/
|
||||
|
||||
@AfterThrowing(pointcut = "logPointcut()", throwing = "e")
|
||||
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
|
||||
Log log = new Log("ERROR",System.currentTimeMillis() - currentTime.get());
|
||||
SysLog log = new SysLog("ERROR", System.currentTimeMillis() - currentTime.get());
|
||||
currentTime.remove();
|
||||
log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes());
|
||||
log.setException_detail(ThrowableUtil.getStackTrace(e).getBytes());
|
||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, log);
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint) joinPoint, log);
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
try {
|
||||
return SecurityUtils.getCurrentUsername();
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,11 @@
|
||||
*/
|
||||
package org.nl.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@@ -36,6 +40,18 @@ public class ConfigurerAdapter implements WebMvcConfigurer {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
config.setAllowCredentials(true);
|
||||
config.addAllowedOrigin("*");
|
||||
config.addAllowedHeader("*");
|
||||
config.addAllowedMethod("*");
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
FileProperties.ElPath path = properties.getPath();
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
package org.nl.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class DataBaseConfig {
|
||||
|
||||
@Primary
|
||||
@Bean(name = "dataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.druid")
|
||||
public DataSource dataSource() {
|
||||
return new DruidDataSource();
|
||||
}
|
||||
|
||||
}
|
||||
//package org.nl.config;
|
||||
//
|
||||
//import com.alibaba.druid.pool.DruidDataSource;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.context.annotation.Primary;
|
||||
//
|
||||
//import javax.sql.DataSource;
|
||||
//
|
||||
//@Configuration
|
||||
//@Slf4j
|
||||
//public class DataBaseConfig {
|
||||
//
|
||||
// @Primary
|
||||
// @Bean(name = "dataSource")
|
||||
// @ConfigurationProperties(prefix = "spring.datasource.druid")
|
||||
// public DataSource dataSource() {
|
||||
// return new DruidDataSource();
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.nl.config.lucene;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 定义lucene相关常量
|
||||
* @Date: 2023/8/25
|
||||
*/
|
||||
public class LogMessageConstant {
|
||||
/** 级别 */
|
||||
public final static String FIELD_LEVEL = "level";
|
||||
/** 时间 */
|
||||
public final static String FIELD_TIMESTAMP = "timestamp";
|
||||
/** 类的限定名 */
|
||||
public final static String FIELD_CLASS_NAME = "logger";
|
||||
/** 线程名 */
|
||||
public final static String FIELD_THREAD = "thread";
|
||||
/** 日志内容 */
|
||||
public final static String FIELD_MESSAGE = "message";
|
||||
public final static String FIELD_TRACEID = "tlogTraceId";
|
||||
// 定义颜色值
|
||||
/** 文本颜色:黑色 */
|
||||
public final static String COLOR_BLACK = "\u001B[30m";
|
||||
/** 文本颜色:红色 */
|
||||
public final static String COLOR_RED = "\u001B[31m";
|
||||
/** 文本颜色:绿色 */
|
||||
public final static String COLOR_GREEN = "\u001B[32m";
|
||||
/** 文本颜色:黄色 */
|
||||
public final static String COLOR_YELLOW = "\u001B[33m";
|
||||
/** 文本颜色:蓝色 */
|
||||
public final static String COLOR_BLUE = "\u001B[34m";
|
||||
/** 文本颜色:品红色 */
|
||||
public final static String COLOR_MAGENTA = "\u001B[35m";
|
||||
/** 文本颜色:青色 */
|
||||
public final static String COLOR_CYAN = "\u001B[36m";
|
||||
/** 文本颜色:白色 */
|
||||
public final static String COLOR_WHITE = "\u001B[37m";
|
||||
/** 文本颜色重置 */
|
||||
public final static String COLOR_RESET = "\u001B[0m";
|
||||
/** 背景颜色:黄色 */
|
||||
public final static String BACKGROUND_YELLOW = "\u001B[43m";
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package org.nl.config.lucene;
|
||||
/**
|
||||
* @author ldjun
|
||||
* @version 1.0
|
||||
* @date 2023年08月24日 13:00
|
||||
* @desc desc
|
||||
*/
|
||||
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.AppenderBase;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.document.*;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.IndexWriterConfig;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.FSDirectory;
|
||||
import org.wltea.analyzer.lucene.IKAnalyzer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Map;
|
||||
|
||||
public class LuceneAppender extends AppenderBase<ILoggingEvent> {
|
||||
|
||||
private Directory index;
|
||||
private IndexWriter indexWriter;
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
super.start();
|
||||
String indexPath = "C:\\lucene\\index";
|
||||
try {
|
||||
index = FSDirectory.open(Paths.get(indexPath));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 初始化 Lucene 索引
|
||||
Analyzer analyzer = new IKAnalyzer();
|
||||
IndexWriterConfig config = new IndexWriterConfig(analyzer);
|
||||
try {
|
||||
indexWriter = new IndexWriter(index, config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void append(ILoggingEvent event) {
|
||||
String message = event.getFormattedMessage();
|
||||
Map<String, String> mdcPropertyMap = event.getMDCPropertyMap();
|
||||
Document doc = new Document();
|
||||
String formattedDateTime = DateUtil.format(new java.util.Date(event.getTimeStamp()), "yyyy-MM-dd HH:mm:ss.SSS");
|
||||
doc.add(new StringField(LogMessageConstant.FIELD_LEVEL, event.getLevel().toString(), Field.Store.YES));
|
||||
doc.add(new StringField(LogMessageConstant.FIELD_TIMESTAMP, formattedDateTime,Field.Store.YES));
|
||||
doc.add(new StoredField(LogMessageConstant.FIELD_CLASS_NAME, event.getLoggerName()));
|
||||
doc.add(new StoredField(LogMessageConstant.FIELD_THREAD, event.getThreadName()));
|
||||
if (ObjectUtil.isNotEmpty(mdcPropertyMap)) {
|
||||
String traceId = mdcPropertyMap.get(LogMessageConstant.FIELD_TRACEID);
|
||||
if (ObjectUtil.isNotEmpty(traceId)) {
|
||||
doc.add(new StringField(LogMessageConstant.FIELD_TRACEID, traceId,Field.Store.YES));
|
||||
} else {
|
||||
doc.add(new StringField(LogMessageConstant.FIELD_TRACEID, "无生成链路ID",Field.Store.YES));
|
||||
}
|
||||
} else {
|
||||
doc.add(new StringField(LogMessageConstant.FIELD_TRACEID, "无生成链路ID",Field.Store.YES));
|
||||
}
|
||||
doc.add(new TextField(LogMessageConstant.FIELD_MESSAGE, message, Field.Store.YES));
|
||||
try {
|
||||
indexWriter.addDocument(doc);
|
||||
indexWriter.commit();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
super.stop();
|
||||
try {
|
||||
indexWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,20 @@ package org.nl.config.lucene;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.IndexReader;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.queryparser.classic.QueryParser;
|
||||
import org.apache.lucene.search.*;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.FSDirectory;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.wltea.analyzer.lucene.IKAnalyzer;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
@@ -26,33 +29,30 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class Searcher {
|
||||
|
||||
public static Map<String, Object> search(String indexDir, String ext,Map whereJson) throws Exception {
|
||||
public static Map<String, Object> search(String indexDir, JSONObject whereJson) throws Exception {
|
||||
//获取要查询的路径,也就是索引所在的位置
|
||||
Directory dir = FSDirectory.open(Paths.get(indexDir));
|
||||
IndexReader reader = DirectoryReader.open(dir);
|
||||
//构建IndexSearcher
|
||||
IndexSearcher searcher = new IndexSearcher(reader);
|
||||
//标准分词器,会自动去掉空格啊,is a the等单词
|
||||
// Analyzer analyzer = new StandardAnalyzer();
|
||||
// Analyzer analyzer = new IKAnalyzer(false);
|
||||
//查询解析器
|
||||
// QueryParser queryParser = new QueryParser("fieldContent", analyzer);
|
||||
Analyzer analyzer = new IKAnalyzer(true);
|
||||
|
||||
//记录索引开始时间
|
||||
long startTime = System.currentTimeMillis();
|
||||
// long startTime = System.currentTimeMillis();
|
||||
// 实际上Lucene本身不支持分页。因此我们需要自己进行逻辑分页。我们要准备分页参数:
|
||||
int pageSize = Integer.parseInt(whereJson.get("size").toString());// 每页条数
|
||||
int pageNum = Integer.parseInt(whereJson.get("page").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("logTime", SortField.Type.DOC,true));
|
||||
Sort sort = new Sort(new SortField("timestamp", SortField.Type.DOC,true));
|
||||
|
||||
TopDocs docs = null;
|
||||
BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder();
|
||||
//时间范围查询
|
||||
String startDate = (String) whereJson.get("begin_time");
|
||||
String endDate = (String) whereJson.get("end_time");
|
||||
String startDate = whereJson.getString("begin_time");
|
||||
String endDate = whereJson.getString("end_time");
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
calendar.set(1970, 0, 1);
|
||||
if (startDate == null){
|
||||
@@ -65,74 +65,90 @@ public class Searcher {
|
||||
} else {
|
||||
endDate = LuceneIndexWriter.getDate(endDate);
|
||||
}
|
||||
TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", new BytesRef(startDate), new BytesRef(endDate), true, true);
|
||||
// 字段之间的与或非关系,MUST表示and,MUST_NOT表示not,SHOULD表示or,有几个fields就必须有几个clauses
|
||||
TermRangeQuery termRangeQuery = new TermRangeQuery("timestamp", new BytesRef(startDate),
|
||||
new BytesRef(endDate), true, true);
|
||||
booleanQueryBuilder.add(termRangeQuery,BooleanClause.Occur.MUST);
|
||||
if (whereJson.get("device_code") != null){
|
||||
Query termQuery = new TermQuery(new Term("device_code", (String) whereJson.get("device_code")));
|
||||
booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (whereJson.get("method") != null){
|
||||
Query termQuery = new TermQuery(new Term("method", (String) whereJson.get("method")));
|
||||
booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (whereJson.get("status_code") != null){
|
||||
Query termQuery = new TermQuery(new Term("status_code", (String) whereJson.get("status_code")));
|
||||
booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (whereJson.get("requestparam") != null){
|
||||
WildcardQuery query = new WildcardQuery(new Term("requestparam", "*"+(String) whereJson.get("requestparam")+"*"));
|
||||
booleanQueryBuilder.add(query,BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (whereJson.get("responseparam") != null){
|
||||
WildcardQuery query = new WildcardQuery(new Term("responseparam", "*"+(String) whereJson.get("responseparam")+"*"));
|
||||
booleanQueryBuilder.add(query,BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (whereJson.get("blurry") != null) {
|
||||
WildcardQuery query = new WildcardQuery(new Term("fieldContent", "*"+(String) whereJson.get("blurry")+"*"));
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get(LogMessageConstant.FIELD_MESSAGE))){
|
||||
//查询解析器
|
||||
QueryParser queryParser = new QueryParser("message", analyzer);
|
||||
Query query = queryParser.parse(whereJson.getString("message"));
|
||||
booleanQueryBuilder.add(query, BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get(LogMessageConstant.FIELD_TRACEID))){
|
||||
//查询解析器
|
||||
TermQuery termQuery = new TermQuery(new Term(LogMessageConstant.FIELD_TRACEID,
|
||||
whereJson.getString(LogMessageConstant.FIELD_TRACEID).trim()));
|
||||
booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get(LogMessageConstant.FIELD_LEVEL))){
|
||||
//查询解析器
|
||||
TermQuery termQuery = new TermQuery(new Term(LogMessageConstant.FIELD_LEVEL,
|
||||
whereJson.get(LogMessageConstant.FIELD_LEVEL).toString()));
|
||||
booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST);
|
||||
}
|
||||
docs = searcher.search(booleanQueryBuilder.build(), end,sort);
|
||||
//记录索引时间
|
||||
long endTime = System.currentTimeMillis();
|
||||
log.info("匹配{}共耗时{}毫秒",booleanQueryBuilder.build(),(endTime-startTime));
|
||||
log.info("查询到{}条日志文件", docs.totalHits.value);
|
||||
// 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;
|
||||
JSONArray array = new JSONArray();
|
||||
|
||||
for (int i = start; i < end; i++) {
|
||||
ScoreDoc scoreDoc = scoreDocs[i];
|
||||
Document doc = reader.document(scoreDoc.doc);
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("content",doc.get("fieldContent"));
|
||||
object.put("device_code",doc.get("device_code"));
|
||||
object.put("logTime",doc.get("logTime"));
|
||||
object.put("method",doc.get("method"));
|
||||
object.put("status_code",doc.get("status_code"));
|
||||
object.put("requestparam",doc.get("requestparam"));
|
||||
object.put("responseparam",doc.get("responseparam"));
|
||||
if(doc.get("fieldContent") != null) {
|
||||
array.add(object);
|
||||
}
|
||||
}
|
||||
for(Object logDto:array){
|
||||
log.info(logDto.toString());
|
||||
String logInfo = LogMessageConstant.COLOR_YELLOW + doc.get(LogMessageConstant.FIELD_TRACEID) +
|
||||
LogMessageConstant.COLOR_RESET + " - " +
|
||||
LogMessageConstant.COLOR_RED + doc.get(LogMessageConstant.FIELD_TIMESTAMP) +
|
||||
LogMessageConstant.COLOR_RESET + " - " +
|
||||
LogMessageConstant.COLOR_GREEN + "[" + doc.get(LogMessageConstant.FIELD_THREAD) + "]" +
|
||||
LogMessageConstant.COLOR_RESET + " - " +
|
||||
LogMessageConstant.COLOR_BLACK + doc.get(LogMessageConstant.FIELD_LEVEL) +
|
||||
LogMessageConstant.COLOR_RESET + " - " +
|
||||
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();
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("content", array);
|
||||
jo.put("content", list);
|
||||
jo.put("totalElements", docs.totalHits.value);
|
||||
return jo;
|
||||
}
|
||||
|
||||
public static String highlightKeyword(String text, String keyword) {
|
||||
if (ObjectUtil.isEmpty(keyword)) {
|
||||
return text;
|
||||
}
|
||||
|
||||
int startIndex = text.indexOf(keyword);
|
||||
if (startIndex != -1) {
|
||||
int endIndex = startIndex + keyword.length();
|
||||
String beforeKeyword = text.substring(0, startIndex);
|
||||
String afterKeyword = text.substring(endIndex);
|
||||
String highlightedKeyword = LogMessageConstant.BACKGROUND_YELLOW + keyword + LogMessageConstant.COLOR_RESET
|
||||
+ LogMessageConstant.COLOR_BLACK;
|
||||
return beforeKeyword + highlightedKeyword + afterKeyword;
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String indexDir = "D:\\lucene\\index";
|
||||
//查询这个字符串
|
||||
String q = "07.832";
|
||||
Map whereJson = null;
|
||||
JSONObject whereJson = new JSONObject();
|
||||
whereJson.put("size", "500");
|
||||
whereJson.put("page", "1");
|
||||
whereJson.put("message", "请求方法参数");
|
||||
// whereJson.put(LogMessageConstant.FIELD_TRACEID, "13244183367577216");
|
||||
|
||||
try {
|
||||
search(indexDir, q,whereJson);
|
||||
search(indexDir, whereJson);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
package org.nl.config.saconfig;
|
||||
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 跨域过滤器
|
||||
* @author kong
|
||||
*/
|
||||
@Component
|
||||
@Order(-200)
|
||||
public class CorsFilter implements Filter {
|
||||
|
||||
static final String OPTIONS = "OPTIONS";
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
HttpServletResponse response = (HttpServletResponse) res;
|
||||
// 允许指定域访问跨域资源
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
// 允许所有请求方式
|
||||
response.setHeader("Access-Control-Allow-Methods", "*");
|
||||
// 有效时间
|
||||
response.setHeader("Access-Control-Max-Age", "3600");
|
||||
// 允许的header参数
|
||||
response.setHeader("Access-Control-Allow-Headers", "*");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
|
||||
// 如果是预检请求,直接返回
|
||||
if (OPTIONS.equals(request.getMethod())) {
|
||||
System.out.println("=======================浏览器发来了OPTIONS预检请求==========");
|
||||
response.getWriter().print("");
|
||||
return;
|
||||
}
|
||||
|
||||
// System.out.println("*********************************过滤器被使用**************************");
|
||||
chain.doFilter(req, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
}
|
||||
//package org.nl.config.saconfig;
|
||||
//
|
||||
//import org.springframework.core.annotation.Order;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.web.cors.CorsConfiguration;
|
||||
//
|
||||
//import javax.servlet.*;
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//import java.io.IOException;
|
||||
//
|
||||
///**
|
||||
// * 跨域过滤器
|
||||
// * @author kong
|
||||
// */
|
||||
//@Component
|
||||
//@Order(-200)
|
||||
//public class CorsFilter implements Filter {
|
||||
//
|
||||
// static final String OPTIONS = "OPTIONS";
|
||||
//
|
||||
// @Override
|
||||
// public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
// throws IOException, ServletException {
|
||||
// HttpServletRequest request = (HttpServletRequest) req;
|
||||
// HttpServletResponse response = (HttpServletResponse) res;
|
||||
// // 允许指定域访问跨域资源
|
||||
// response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
// // 允许所有请求方式
|
||||
// response.setHeader("Access-Control-Allow-Methods", "*");
|
||||
// // 有效时间
|
||||
// response.setHeader("Access-Control-Max-Age", "3600");
|
||||
// // 允许的header参数
|
||||
// response.setHeader("Access-Control-Allow-Headers", "*");
|
||||
// response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
//
|
||||
// // 如果是预检请求,直接返回
|
||||
// if (OPTIONS.equals(request.getMethod())) {
|
||||
// System.out.println("=======================浏览器发来了OPTIONS预检请求==========");
|
||||
// response.getWriter().print("");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // System.out.println("*********************************过滤器被使用**************************");
|
||||
// chain.doFilter(req, res);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void init(FilterConfig filterConfig) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void destroy() {
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
* @Date 2022/11/28 10:58 上午
|
||||
*/
|
||||
@Configuration
|
||||
public class SaInitCOnfig {
|
||||
public class SaInitConfig {
|
||||
|
||||
@Autowired
|
||||
LoginUserHandler loginUserHandler;
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.system.controller.lucence;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -9,10 +10,7 @@ import org.nl.system.service.lucene.LuceneService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -25,11 +23,11 @@ public class LuceneController {
|
||||
|
||||
private final LuceneService luceneService;
|
||||
|
||||
@GetMapping("/getAll")
|
||||
@PostMapping("/getAll")
|
||||
@Log("日志检索")
|
||||
@ApiOperation("日志检索")
|
||||
//@PreAuthorize("@el.check('task:list')")
|
||||
public ResponseEntity<Object> get(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(luceneService.getAll(whereJson, page), HttpStatus.OK);
|
||||
public ResponseEntity<Object> get(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(luceneService.getAll(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package org.nl.system.service.logging;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.logging.dao.SysLog;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -41,4 +43,15 @@ public interface ISysLogService extends IService<SysLog> {
|
||||
* 删除所有操作日志
|
||||
*/
|
||||
void delAllByInfo();
|
||||
|
||||
/**
|
||||
* 保存日志数据
|
||||
* @param username 用户
|
||||
* @param browser 浏览器
|
||||
* @param ip 请求IP
|
||||
* @param joinPoint /
|
||||
* @param log 日志实体
|
||||
*/
|
||||
@Async
|
||||
void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, SysLog log);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@ package org.nl.system.service.logging.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -16,6 +17,7 @@ import lombok.EqualsAndHashCode;
|
||||
* @since 2023-05-08
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sys_log")
|
||||
public class SysLog implements Serializable {
|
||||
@@ -51,5 +53,8 @@ public class SysLog implements Serializable {
|
||||
|
||||
private String create_time;
|
||||
|
||||
|
||||
public SysLog(String logType, Long time) {
|
||||
this.log_type = logType;
|
||||
this.time = time;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,35 @@
|
||||
package org.nl.system.service.logging.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.utils.StringUtils;
|
||||
import org.nl.common.utils.ValidationUtil;
|
||||
import org.nl.system.service.logging.ISysLogService;
|
||||
import org.nl.system.service.logging.dao.SysLog;
|
||||
import org.nl.system.service.logging.dao.mapper.SysLogMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Parameter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -71,4 +86,60 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
||||
public void delAllByInfo() {
|
||||
logMapper.delete(new LambdaQueryWrapper<SysLog>().eq(SysLog::getLog_type, "INFO"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, SysLog logDto) {
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
Log aopLog = method.getAnnotation(Log.class);
|
||||
|
||||
// 方法路径
|
||||
String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
|
||||
|
||||
// 描述
|
||||
if (logDto != null) {
|
||||
logDto.setDescription(aopLog.value());
|
||||
}
|
||||
assert logDto != null;
|
||||
logDto.setRequest_ip(ip);
|
||||
|
||||
logDto.setAddress(StringUtils.getCityInfo(logDto.getRequest_ip()));
|
||||
logDto.setMethod(methodName);
|
||||
logDto.setUsername(username);
|
||||
logDto.setParams(getParameter(method, joinPoint.getArgs()));
|
||||
logDto.setBrowser(browser);
|
||||
logDto.setLog_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
logDto.setCreate_time(DateUtil.now());
|
||||
logMapper.insert(logDto);
|
||||
}
|
||||
/**
|
||||
* 根据方法和传入的参数获取请求参数
|
||||
*/
|
||||
private String getParameter(Method method, Object[] args) {
|
||||
List<Object> argList = new ArrayList<>();
|
||||
Parameter[] parameters = method.getParameters();
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
//将RequestBody注解修饰的参数作为请求参数
|
||||
RequestBody requestBody = parameters[i].getAnnotation(RequestBody.class);
|
||||
if (requestBody != null) {
|
||||
argList.add(args[i]);
|
||||
}
|
||||
//将RequestParam注解修饰的参数作为请求参数
|
||||
RequestParam requestParam = parameters[i].getAnnotation(RequestParam.class);
|
||||
if (requestParam != null) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String key = parameters[i].getName();
|
||||
if (!StrUtil.isEmpty(requestParam.value())) {
|
||||
key = requestParam.value();
|
||||
}
|
||||
map.put(key, args[i]);
|
||||
argList.add(map);
|
||||
}
|
||||
}
|
||||
if (argList.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -12,8 +13,7 @@ public interface LuceneService {
|
||||
* 获取数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> getAll(Map whereJson, Pageable page);
|
||||
Map<String, Object> getAll(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ public class LuceneServiceImpl implements LuceneService {
|
||||
private String luceneUrl;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAll(Map whereJson, Pageable page) {
|
||||
public Map<String, Object> getAll(JSONObject whereJson) {
|
||||
JSONObject jo = new JSONObject();
|
||||
try {
|
||||
JSONObject jsonObject = (JSONObject) Searcher.search(luceneUrl, "", whereJson);
|
||||
JSONObject jsonObject = (JSONObject) Searcher.search(luceneUrl, whereJson);
|
||||
JSONArray array = jsonObject.getJSONArray("content");
|
||||
int totalElements = Integer.parseInt(jsonObject.get("totalElements").toString());
|
||||
jo.put("content", array);
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package org.nl.wms.ext.acs.service;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: mes请求wms
|
||||
* @Date: 2023/8/3
|
||||
*/
|
||||
public interface MesToWmsService {
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
@@ -600,21 +601,28 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
*/
|
||||
@Override
|
||||
public BaseResponse pressRequestMaterial(JSONObject param) {
|
||||
// todo: 换成acs请求
|
||||
String requestNo = param.getString("requestNo");
|
||||
String deviceCode = param.getString("device_code");
|
||||
// 换成acs请求
|
||||
ApplyTaskRequest request = param.toJavaObject(ApplyTaskRequest.class);
|
||||
String deviceCode = request.getDevice_code();
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(basePoint)) {
|
||||
throw new BadRequestException("设备[" + deviceCode + "]不存在");
|
||||
}
|
||||
if (basePoint.getPoint_status().equals(PointStatusEnum.EMPTY_POINT.getCode())) {
|
||||
throw new BadRequestException("设备[" + deviceCode + "]已经叫料");
|
||||
}
|
||||
// 获取设备位
|
||||
SchBasePoint devicePoint = pointService.getById(basePoint.getParent_point_code());
|
||||
// todo: 1、校验是否有工单,是否需要叫料
|
||||
// 1、校验是否有工单,是否需要叫料
|
||||
PdmBdWorkorder deviceProductionTask = workorderService.getByCode(request.getOrder_code());
|
||||
if (ObjectUtil.isNotEmpty(deviceProductionTask)) {
|
||||
throw new BadRequestException("压机" + deviceCode + "暂无生产的工单");
|
||||
}
|
||||
// todo: 2、通知混碾机生产泥料
|
||||
// todo: 3、修改设备点位为空位,并且更新时间
|
||||
// 3、修改设备点位为空位,并且更新时间
|
||||
PointUtils.setUpdateByAcs(devicePoint);
|
||||
PointUtils.clearPoint(devicePoint);
|
||||
return null;
|
||||
return BaseResponse.responseOk(request.getRequestNo(), "压机要料完成");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.acs.service.MesToWmsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/8/3
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MesToWmsServiceImpl implements MesToWmsService {
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.nl.wms.ext.mes.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.ext.mes.service.MesToWmsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: mes请求wms
|
||||
* @Date: 2023/8/30
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "mes请求lms")
|
||||
@RequestMapping("/api/mes")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class MesToWmsController {
|
||||
@Autowired
|
||||
private MesToWmsService mesToWmsService;
|
||||
|
||||
@PostMapping("/downOrder")
|
||||
@Log("下发工单")
|
||||
@ApiOperation("下发工单")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> downOrderForMes(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(mesToWmsService.downOrderForMes(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.wms.ext.mes.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: mes请求wms
|
||||
* @Date: 2023/8/3
|
||||
*/
|
||||
public interface MesToWmsService {
|
||||
/**
|
||||
* mes下发工单
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
JSONObject downOrderForMes(JSONObject param);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.ext.acs.service;
|
||||
package org.nl.wms.ext.mes.service;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.nl.wms.ext.mes.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.mes.service.MesToWmsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/8/3
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MesToWmsServiceImpl implements MesToWmsService {
|
||||
@Override
|
||||
public JSONObject downOrderForMes(JSONObject param) {
|
||||
log.info("mes传来工单信息:" + param);
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
package org.nl.wms.ext.mes.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.acs.service.WmsToMesService;
|
||||
import org.nl.wms.ext.mes.service.WmsToMesService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
|
||||
<properties>
|
||||
<comment>IK Analyzer 扩展配置</comment>
|
||||
<!--用户可以在这里配置自己的扩展字典 -->
|
||||
<entry key="ext_dict">ext.dic;</entry>
|
||||
|
||||
<!--用户可以在这里配置自己的扩展停止词字典-->
|
||||
<entry key="ext_stopwords">stopword.dic;</entry>
|
||||
|
||||
</properties>
|
||||
@@ -2,56 +2,18 @@ server:
|
||||
port: 8010
|
||||
#配置数据源
|
||||
spring:
|
||||
autoconfigure:
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rtmg_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:stand_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:12356}
|
||||
# password: ${DB_PWD:P@ssw0rd}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
min-idle: 15
|
||||
# 最大连接数
|
||||
max-active: 30
|
||||
# 超时时间(以秒数为单位)
|
||||
remove-abandoned-timeout: 180
|
||||
# 获取连接超时时间
|
||||
max-wait: 3000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接在池中最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||
test-while-idle: true
|
||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||
test-on-borrow: true
|
||||
# 是否在归还到池中前进行检验
|
||||
test-on-return: false
|
||||
# 检测连接是否有效
|
||||
validation-query: select 1
|
||||
# 配置监控统计
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 记录慢SQL
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic:
|
||||
primary: db1
|
||||
datasource:
|
||||
db1:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rtmg_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:12356}
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
redis:
|
||||
#数据库索引
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
|
||||
@@ -2,55 +2,18 @@ server:
|
||||
port: 8010
|
||||
#配置数据源
|
||||
spring:
|
||||
autoconfigure:
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.4.121}:${DB_PORT:3306}/${DB_NAME:yy_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
min-idle: 15
|
||||
# 最大连接数
|
||||
max-active: 60
|
||||
# 获取连接超时时间
|
||||
max-wait: 5000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接在池中最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||
test-while-idle: true
|
||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||
test-on-borrow: true
|
||||
# 是否在归还到池中前进行检验
|
||||
test-on-return: false
|
||||
# 检测连接是否有效
|
||||
validation-query: select 1
|
||||
# 配置监控统计
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
# 控制台管理用户名和密码
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
login-username: admin
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 记录慢SQL
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic:
|
||||
primary: db1
|
||||
datasource:
|
||||
db1:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:10.93.41.198}:${DB_PORT:3306}/${DB_NAME:rl_mg_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
redis:
|
||||
#数据库索引
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
|
||||
@@ -1,4 +1,44 @@
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
initial-size: 5 #初始化时建立物理连接的个数
|
||||
min-idle: 15 #最小连接池数量
|
||||
maxActive: 30 #最大连接池数量
|
||||
maxWait: 3000 #获取连接时最大等待时间,单位毫秒
|
||||
#申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
|
||||
test-while-idle: true
|
||||
time-between-eviction-runs-millis: 300000 #既作为检测的间隔时间又作为test-while-idle执行的依据
|
||||
min-evictable-idle-time-millis: 900000 #销毁线程时检测当前连接的最后活动时间和当前时间差大于该值时,关闭当前连接
|
||||
#用来检测连接是否有效的sql
|
||||
#mysql中为 select 'x'
|
||||
#oracle中为 select 1 from dual
|
||||
validation-query: SELECT 'x'
|
||||
test-on-borrow: true #申请连接时会执行validationQuery检测连接是否有效,开启会降低性能,默认为true
|
||||
test-on-return: false #归还连接时会执行validationQuery检测连接是否有效,开启会降低性能,默认为true
|
||||
exception-sorter: true #当数据库抛出不可恢复的异常时,抛弃该连接
|
||||
pool-prepared-statements: true #是否缓存preparedStatement,mysql5.5+建议开启
|
||||
max-pool-prepared-statement-per-connection-size: 20 #当值大于20时poolPreparedStatements会自动修改为true
|
||||
#通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||||
use-global-data-source-stat: true #合并多个DruidDataSource的监控数据
|
||||
#filters通过别名的方式配置扩展插件,常用的插件有:
|
||||
#监控统计用的filter:stat 日志用的filter:log4j 防御sql注入的filter:wall
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 记录慢SQL
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
#设置访问druid监控页面的拦截路径及账号和密码,默认没有
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
login-username: admin
|
||||
login-password: admin
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
@@ -90,4 +130,4 @@ mybatis-plus:
|
||||
id-type: INPUT
|
||||
lucene:
|
||||
index:
|
||||
path: D:\lucene\index
|
||||
path: C:\lucene\index
|
||||
|
||||
@@ -47,6 +47,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
<appender name="luceneAppender" class="org.nl.config.lucene.LuceneAppender" />
|
||||
|
||||
<!--异步到文件-->
|
||||
<appender name="asyncFileAppender" class="ch.qos.logback.classic.AsyncAppender">
|
||||
@@ -102,6 +103,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<springProfile name="prod">
|
||||
<root level="debug">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="luceneAppender"/>
|
||||
</root>
|
||||
<logger name="org.springframework" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
|
||||
1241
lms/nladmin-system/nlsso-server/src/main/resources/stopword.dic
Normal file
1241
lms/nladmin-system/nlsso-server/src/main/resources/stopword.dic
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,6 @@ ENV = 'production'
|
||||
|
||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
||||
VUE_APP_BASE_API = 'http://127.0.0.1:8011'
|
||||
VUE_APP_BASE_API = 'http://10.93.41.201:8010'
|
||||
# 如果接口是 http 形式, wss 需要改为 ws
|
||||
VUE_APP_WS_API = 'ws://127.0.0.1:8011'
|
||||
VUE_APP_WS_API = 'ws://10.93.41.201:8010'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
window.g = {
|
||||
dev: {
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8010'
|
||||
VUE_APP_BASE_API: 'http://10.93.41.201:8010'
|
||||
},
|
||||
prod: {
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8010'
|
||||
VUE_APP_BASE_API: 'http://10.93.41.201:8010'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import request from '@/utils/request'
|
||||
export function getLogData(param) {
|
||||
return request({
|
||||
url: 'api/lucene/getAll',
|
||||
method: 'get',
|
||||
method: 'post',
|
||||
data: param
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,102 +1,141 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<Search />
|
||||
<crudOperation />
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="日志级别">
|
||||
<el-select
|
||||
v-model="query.level"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="日志级别"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in levelOptions"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="模糊搜索">
|
||||
<el-input
|
||||
v-model="query.message"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="日志内容"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="链路ID">
|
||||
<el-input
|
||||
v-model="query.tlogTraceId"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入链路ID"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间">
|
||||
<el-date-picker
|
||||
v-model="query.createTime"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="mini" @click="queryData">
|
||||
查询
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<!-- <el-table-column type="selection" width="55"/>-->
|
||||
<!-- <el-table-column v-if="false" prop="id" label="id"/>-->
|
||||
<el-table-column prop="operate" width="50" label="操作" />
|
||||
<el-table-column prop="device_code" label="设备号" />
|
||||
<el-table-column prop="task_code" label="任务编号" />
|
||||
<el-table-column prop="instruct_code" label="指令编号" />
|
||||
<el-table-column prop="method" label="方法" />
|
||||
<el-table-column prop="status_code" label="状态码" />
|
||||
<el-table-column prop="requestparam" label="请求参数" />
|
||||
<el-table-column prop="responseparam" label="返回参数" />
|
||||
<el-table-column prop="logTime" width="170" label="记录时间" />
|
||||
<el-table-column prop="content" width="500" label="内容详情" />
|
||||
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<el-card shadow="hover" style="width: 100%" class="log-warpper">
|
||||
<div style="width: 100%">
|
||||
<div v-for="(log, index) in logs" :key="index">
|
||||
<div style="margin-bottom: 5px; font-size: 14px;" v-html="log" />
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
:page-sizes="[100, 500, 1000]"
|
||||
:page-size.sync="query.size"
|
||||
:total="query.total"
|
||||
:current-page.sync="query.page"
|
||||
style="margin-top: 8px;"
|
||||
layout="total, prev, pager, next, sizes"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Search from './search.vue'
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
import luceneOperation from '@/views/lucene/api/lucene'
|
||||
import { default as AnsiUp } from 'ansi_up'
|
||||
export default {
|
||||
name: 'LuceneLog',
|
||||
components: { Search, pagination, crudOperation },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds: function() {
|
||||
return CRUD({
|
||||
title: '系统参数', url: 'api/lucene/getAll', idField: 'id', sort: 'id,desc',
|
||||
queryOnPresenterCreated: true,
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false
|
||||
},
|
||||
page: {
|
||||
size: 40,
|
||||
total: 0,
|
||||
page: 0
|
||||
},
|
||||
query: {
|
||||
createTime: [new Date(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24)), new Date()]
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
query: { blurry: '123' },
|
||||
permission: {
|
||||
add: ['admin', 'param:add'],
|
||||
edit: ['admin', 'param:edit'],
|
||||
del: ['admin', 'param:del']
|
||||
},
|
||||
|
||||
rules: {}
|
||||
levelOptions: [{
|
||||
value: 'DEBUG',
|
||||
label: 'DEBUG'
|
||||
}, {
|
||||
value: 'INFO',
|
||||
label: 'INFO'
|
||||
}, {
|
||||
value: 'ERROR',
|
||||
label: 'ERROR'
|
||||
}, {
|
||||
value: 'WARN',
|
||||
label: 'WARN'
|
||||
}],
|
||||
rules: {},
|
||||
logs: [],
|
||||
query: {
|
||||
tlogTraceId: '',
|
||||
message: '',
|
||||
page: 0,
|
||||
size: 100,
|
||||
total: 0,
|
||||
createTime: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.queryData()
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
handleSizeChange(val) {
|
||||
this.query.size = val
|
||||
this.queryData()
|
||||
},
|
||||
confirmDelAll() {
|
||||
this.$confirm(`确认清空所有操作日志吗?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.crud.delAllLoading = true
|
||||
delAll('device_execute').then(res => {
|
||||
this.crud.delAllLoading = false
|
||||
this.crud.dleChangePage(1)
|
||||
this.crud.delSuccessNotify()
|
||||
this.crud.toQuery()
|
||||
}).catch(err => {
|
||||
this.crud.delAllLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}).catch(() => {
|
||||
handleCurrentChange(val) {
|
||||
this.query.page = val
|
||||
this.queryData()
|
||||
},
|
||||
queryData() {
|
||||
luceneOperation.getLogData(this.query).then(res => {
|
||||
this.logs = [] // 清空
|
||||
var ansi_up = new AnsiUp()
|
||||
// 数据初始化
|
||||
for (const i in res.content) {
|
||||
this.logs[i] = ansi_up.ansi_to_html(res.content[i])
|
||||
}
|
||||
// this.logs = res.content
|
||||
this.query.total = res.totalElements
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ module.exports = {
|
||||
lintOnSave: process.env.NODE_ENV === 'development',
|
||||
productionSourceMap: false,
|
||||
devServer: {
|
||||
allowedHosts: ['all'],
|
||||
disableHostCheck: true,
|
||||
port: port,
|
||||
open: false,
|
||||
overlay: {
|
||||
|
||||
Reference in New Issue
Block a user