diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java index e776132..e720c1c 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java @@ -9,15 +9,15 @@ public class LogMessageConstant { /** * 标签 */ - public final static String LABEL = "label"; + public final static String FIELD_LABEL = "label"; /** * 时间 */ - public final static String SORT_NAME = "time"; + public final static String FIELD_SORT_NAME = "time"; /** * IP */ - public final static String IP = "ip"; + public final static String FIELD_IP = "ip"; /** * 级别 */ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LuceneAppender.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LuceneAppender.java index 48d037c..d342c3a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LuceneAppender.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LuceneAppender.java @@ -73,17 +73,17 @@ public class LuceneAppender extends AppenderBase { throw new RuntimeException(e); } String formattedDateTime = DateUtil.format(new java.util.Date(timeStamp), "yyyy-MM-dd HH:mm:ss.SSS"); - doc.add(new LongPoint(LogMessageConstant.SORT_NAME, timeStamp)); - doc.add(new NumericDocValuesField(LogMessageConstant.SORT_NAME, timeStamp)); + doc.add(new LongPoint(LogMessageConstant.FIELD_SORT_NAME, timeStamp)); + doc.add(new NumericDocValuesField(LogMessageConstant.FIELD_SORT_NAME, timeStamp)); 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.IP, ipAddress)); + doc.add(new StoredField(LogMessageConstant.FIELD_IP, ipAddress)); doc.add(new StoredField(LogMessageConstant.FIELD_THREAD, event.getThreadName())); if (ObjectUtil.isNotEmpty(mdcPropertyMap) && ObjectUtil.isNotEmpty(mdcPropertyMap.get(LogMessageConstant.FIELD_TRACEID))) { String traceId = mdcPropertyMap.get(LogMessageConstant.FIELD_TRACEID); doc.add(new StringField(LogMessageConstant.FIELD_TRACEID, traceId, Field.Store.YES)); - doc.add(new StringField(LogMessageConstant.LABEL, ObjectUtil.isNotEmpty(mdcPropertyMap.get("tag_name")) + doc.add(new StringField(LogMessageConstant.FIELD_LABEL, ObjectUtil.isNotEmpty(mdcPropertyMap.get("tag_name")) ? mdcPropertyMap.get("tag_name") : "-", Field.Store.YES)); } else { // 定义正则表达式,匹配17位数字 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/Searcher.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/Searcher.java index 8fb0631..2565dcd 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/Searcher.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/Searcher.java @@ -51,7 +51,7 @@ public class Searcher { // 当前页的结束条数(不能包含) int end = start + pageSize; // 创建排序对象,需要排序字段SortField,参数:字段的名称、字段的类型、是否反转如果是false,升序。true降序 - Sort sort = new Sort(new SortField(LogMessageConstant.SORT_NAME, SortField.Type.LONG, true)); + Sort sort = new Sort(new SortField(LogMessageConstant.FIELD_SORT_NAME, SortField.Type.LONG, true)); TopDocs docs = null; BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder(); @@ -86,6 +86,12 @@ public class Searcher { whereJson.getString(LogMessageConstant.FIELD_TRACEID).trim())); booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); } + if (ObjectUtil.isNotEmpty(whereJson.get(LogMessageConstant.FIELD_LABEL))) { + //查询解析器 + TermQuery termQuery = new TermQuery(new Term(LogMessageConstant.FIELD_LABEL, + whereJson.getString(LogMessageConstant.FIELD_LABEL).trim())); + booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); + } if (ObjectUtil.isNotEmpty(whereJson.get(LogMessageConstant.FIELD_LEVEL))) { //查询解析器 TermQuery termQuery = new TermQuery(new Term(LogMessageConstant.FIELD_LEVEL, @@ -101,9 +107,9 @@ public class Searcher { for (ScoreDoc scoreDoc : scoreDocs) { Document doc = reader.document(scoreDoc.doc); - String logInfo = LogMessageConstant.COLOR_CYAN + doc.get(LogMessageConstant.LABEL) + + String logInfo = LogMessageConstant.COLOR_CYAN + doc.get(LogMessageConstant.FIELD_LABEL) + LogMessageConstant.COLOR_RESET + " - " + - LogMessageConstant.COLOR_BLUE + doc.get(LogMessageConstant.IP) + + LogMessageConstant.COLOR_BLUE + doc.get(LogMessageConstant.FIELD_IP) + LogMessageConstant.COLOR_RESET + " - " + LogMessageConstant.COLOR_YELLOW + doc.get(LogMessageConstant.FIELD_TRACEID) + LogMessageConstant.COLOR_RESET + " - " + diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/lucence/LuceneController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/lucence/LuceneController.java index 18fd431..410ae6a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/lucence/LuceneController.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/lucence/LuceneController.java @@ -29,4 +29,15 @@ public class LuceneController { public ResponseEntity get(@RequestBody JSONObject whereJson) { return new ResponseEntity<>(luceneService.getAll(whereJson), HttpStatus.OK); } + + @PostMapping("/getTagName") + public ResponseEntity getTagName() { + return new ResponseEntity<>(luceneService.getTagName(), HttpStatus.OK); + } + + @PostMapping("/deleteAllLog") + public ResponseEntity deleteAllLog() { + luceneService.deleteAllLog(); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/lucene/LuceneService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/lucene/LuceneService.java index 984ed1e..5d74f0f 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/lucene/LuceneService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/lucene/LuceneService.java @@ -2,6 +2,7 @@ package org.nl.system.service.lucene; import com.alibaba.fastjson.JSONObject; +import java.util.List; import java.util.Map; /** @@ -18,4 +19,12 @@ public interface LuceneService { * @return Map */ Map getAll(JSONObject whereJson); + + /** + * 获取枚举的标签名称 + * @return + */ + List getTagName(); + + void deleteAllLog(); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/lucene/impl/LuceneServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/lucene/impl/LuceneServiceImpl.java index 1e8aaea..184083d 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/lucene/impl/LuceneServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/lucene/impl/LuceneServiceImpl.java @@ -3,12 +3,19 @@ package org.nl.system.service.lucene.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.search.MatchAllDocsQuery; +import org.nl.config.lucene.LuceneAppender; import org.nl.config.lucene.Searcher; import org.nl.system.service.lucene.LuceneService; +import org.nl.wms.sch.task_manage.enums.TagNameEnum; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; import java.util.Map; @@ -39,4 +46,23 @@ public class LuceneServiceImpl implements LuceneService { return jo; } + @Override + public List getTagName() { + List res = new ArrayList<>(); + for (TagNameEnum nameEnum : TagNameEnum.values()) { + res.add(nameEnum.getTag()); + } + return res; + } + + @SneakyThrows + @Override + public void deleteAllLog() { + IndexWriter writer = LuceneAppender.indexWriter; + // 创建一个匹配所有文档的查询 + MatchAllDocsQuery query = new MatchAllDocsQuery(); + writer.deleteDocuments(query); + writer.commit(); + } + } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/ISysParamService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/ISysParamService.java index 8a2a61a..5c795eb 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/ISysParamService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/ISysParamService.java @@ -1,5 +1,6 @@ package org.nl.system.service.param; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import org.nl.common.domain.query.PageQuery; @@ -25,7 +26,7 @@ public interface ISysParamService extends IService { * @param page 分页信息 * @return */ - Page queryPage(Map whereJson, PageQuery page); + IPage queryPage(Map whereJson, PageQuery page); /** * 创建参数 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java index 9946c5b..afcdd78 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java @@ -9,6 +9,7 @@ import com.alicp.jetcache.anno.CacheUpdate; import com.alicp.jetcache.anno.Cached; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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; @@ -42,11 +43,15 @@ public class SysParamServiceImpl extends ServiceImpl impl private SysParamMapper paramMapper; @Override - public Page queryPage(Map whereJson, PageQuery page) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.orderBy(true, true, "create_time"); - Page paramPage = paramMapper.selectPage(page.build(), queryWrapper); - return paramPage; + public IPage queryPage(Map whereJson, PageQuery page) { + String code = ObjectUtil.isNotEmpty(whereJson.get("code")) + ? whereJson.get("code").toString() : null; + IPage pages = new Page<>(page.getPage() + 1, page.getSize()); + LambdaQueryWrapper lam = new QueryWrapper().lambda(); + lam.like(ObjectUtil.isNotEmpty(code), Param::getCode, code) + .orderByAsc(Param::getCreate_time); + paramMapper.selectPage(pages, lam); + return pages; } @Override diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/brick/service/impl/MdBaseBrickInfoServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/brick/service/impl/MdBaseBrickInfoServiceImpl.java index d4c3bda..d189cf6 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/brick/service/impl/MdBaseBrickInfoServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/brick/service/impl/MdBaseBrickInfoServiceImpl.java @@ -17,6 +17,7 @@ import org.nl.wms.ext.mes.service.WmsToMesService; import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService; import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.util.Map; @@ -29,6 +30,7 @@ import java.util.Set; **/ @Slf4j @Service +@Lazy public class MdBaseBrickInfoServiceImpl extends ServiceImpl implements IMdBaseBrickInfoService { @Autowired diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 683ed78..eddb63f 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -703,10 +703,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { taskResponse.setMessage("静置完成"); taskResponse.setWeight(one.getMaterial_weight().toString()); taskResponse.setMudBatch(one.getPcsn()); - // 泥料数据删除 + // todo: 泥料数据删除 List list = requestMaterialRecordService.list(new LambdaQueryWrapper() - .eq(PdmBdRequestMaterialRecord::getDevice_code, productionTask.getPoint_code()) - .eq(PdmBdRequestMaterialRecord::getWorkorder_id, productionTask.getWorkorder_code()) + .eq(PdmBdRequestMaterialRecord::getDevice_code, yjDeviceCode) + .eq(ObjectUtil.isNotEmpty(productionTask), PdmBdRequestMaterialRecord::getWorkorder_id, productionTask.getWorkorder_code()) .eq(PdmBdRequestMaterialRecord::getIs_delete, false) .eq(PdmBdRequestMaterialRecord::getIs_finish, true) .orderByAsc(PdmBdRequestMaterialRecord::getCreate_time)); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSaveProductionInfo.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSaveProductionInfo.java index 4b7cc86..9ee2938 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSaveProductionInfo.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSaveProductionInfo.java @@ -11,6 +11,7 @@ import org.nl.wms.ext.mes.service.dto.MesSemiProductionInfo; import org.nl.wms.sch.task_manage.GeneralDefinition; import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @@ -25,6 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger; @Slf4j @Component @Order(value = 1) +@Lazy public class AutoSaveProductionInfo { @Autowired private WmsToMesService wmsToMesService; diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java index ee43602..459ada5 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java @@ -39,6 +39,7 @@ import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum; import org.nl.wms.util.CommonUtils; import org.nl.wms.util.TaskUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -54,6 +55,7 @@ import java.util.Set; **/ @Slf4j @Service +@Lazy public class PdmBdWorkorderServiceImpl extends ServiceImpl implements IPdmBdWorkorderService { @Autowired diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java index 9c01f6b..1cead08 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java @@ -154,7 +154,8 @@ public class SchBaseTaskServiceImpl extends ServiceImpl lam = new LambdaQueryWrapper<>(); lam.eq(SchBaseTask::getConfig_code, config_code) .eq(SchBaseTask::getTask_status, status.getCode()) - .ne(SchBaseTask::getIs_delete, true); + .ne(SchBaseTask::getIs_delete, true) + .orderByAsc(SchBaseTask::getCreate_time); List schBaseTasks = schBaseTaskMapper.selectList(lam); return schBaseTasks; diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/enums/TagNameEnum.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/enums/TagNameEnum.java new file mode 100644 index 0000000..b151ffd --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/enums/TagNameEnum.java @@ -0,0 +1,27 @@ +package org.nl.wms.sch.task_manage.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @Author: lyd + * @Description: 日志标签枚举 + * @Date: 2023/12/28 + */ +@Getter +@AllArgsConstructor +public enum TagNameEnum { + /** + * LMS系统 + */ + LMS("LMS系统"), + /** + * 物料同步 + */ + MATERIAL_SYNCHRONIZATION("物料同步"), + /** + * 标记符号 + */ + MARK_SYMBOL("-"); + private final String tag; +} diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml index 61ebd08..2b31635 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml @@ -58,7 +58,6 @@ spring: enabled: true # 是否启用 dynamictp,默认true enabledBanner: false # 是否启用 控制台banner,默认true enabledCollect: true # 是否开启监控指标采集,默认true - enabled-banner: false collectorTypes: logging,test_collect # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer logPath: C:\log\lms # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置 monitorInterval: 8 @@ -67,7 +66,7 @@ spring: corePoolSize: 100 maximumPoolSize: 200 keepAliveTime: 60 - runTimeout: 200 + runTimeout: 10000 queueTimeout: 100 notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - type: change diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml b/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml index 3849727..c534be8 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml @@ -71,9 +71,9 @@ https://juejin.cn/post/6844903775631572999 - + diff --git a/lms/nladmin-ui/src/views/lucene/api/lucene.js b/lms/nladmin-ui/src/views/lucene/api/lucene.js index 08f00a5..833ccf1 100644 --- a/lms/nladmin-ui/src/views/lucene/api/lucene.js +++ b/lms/nladmin-ui/src/views/lucene/api/lucene.js @@ -8,6 +8,19 @@ export function getLogData(param) { }) } +export function getTagName() { + return request({ + url: 'api/lucene/getTagName', + method: 'post' + }) +} +export function deleteAllLog() { + return request({ + url: 'api/lucene/deleteAllLog', + method: 'post' + }) +} + export function labelsValues() { return request({ url: 'api/loki/labels/values', @@ -15,4 +28,4 @@ export function labelsValues() { }) } -export default { getLogData, labelsValues } +export default { getLogData, labelsValues, getTagName, deleteAllLog } diff --git a/lms/nladmin-ui/src/views/lucene/index.vue b/lms/nladmin-ui/src/views/lucene/index.vue index cd250b1..cbd1665 100644 --- a/lms/nladmin-ui/src/views/lucene/index.vue +++ b/lms/nladmin-ui/src/views/lucene/index.vue @@ -8,13 +8,28 @@ label-width="90px" label-suffix=":" > + + + + + @@ -37,6 +53,7 @@ clearable size="mini" placeholder="请输入链路ID" + style="width: 240px;" /> @@ -52,6 +69,9 @@ 查询 + + 删除 + @@ -80,6 +100,7 @@