add lucene \ udw
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
<!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 -->
|
||||
<jna.version>5.9.0</jna.version>
|
||||
<configuration.version>1.9</configuration.version>
|
||||
<lucene.version>8.2.0</lucene.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -406,6 +407,41 @@
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
<version>1.21</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Lucence核心包 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-highlighter</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-analyzers-common</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.magese</groupId>
|
||||
<artifactId>ik-analyzer</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--支持中文分词 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-analyzers-smartcn</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<!-- Lucene查询解析包 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-queryparser</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
1=magic 2=NDC 3=XZ 4=ZHEDA
|
||||
@@ -64,11 +64,11 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "NDC在线连接";
|
||||
return "1楼NDC在线连接";
|
||||
}
|
||||
|
||||
public void autoRun() throws IOException {
|
||||
System.out.println("NDCAgv链接开始");
|
||||
System.out.println("1楼NDCAgv链接开始");
|
||||
ParamService ParamService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
@@ -85,8 +85,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
s = new Socket(ip, port);
|
||||
dos = new DataOutputStream(s.getOutputStream());
|
||||
dis = new DataInputStream(s.getInputStream());
|
||||
System.out.println("NDCAgv链接成功");
|
||||
log.info("NDCAgv链接成功");
|
||||
System.out.println("1楼NDCAgv链接成功");
|
||||
log.info("1楼NDCAgv链接成功");
|
||||
while (bConnected) {
|
||||
int count = dis.read(b);
|
||||
|
||||
@@ -131,9 +131,9 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
if (ikey != 0) {
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
}
|
||||
// if (ObjectUtil.isEmpty(inst)){
|
||||
// inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
// }
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(link_inst)) {
|
||||
link_flag = true;
|
||||
@@ -160,18 +160,28 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
//任务完毕
|
||||
//(无车id及状态)
|
||||
else if (phase == 0x0A) {
|
||||
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
instructionService.finish(inst.getInstruction_id());
|
||||
} else {
|
||||
log.warn("指令号:{},未反馈wms任务完成,因为agv上报指令号查询指令为空!");
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
String agvcar = inst.getCarno();
|
||||
Device agvDevice = deviceAppService.findDeviceByCode(agvcar);
|
||||
if (agvDevice != null) {
|
||||
if (agvDevice.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) agvDevice.getDeviceDriver();
|
||||
agvNdcOneDeviceDriver.setInstruction(null);
|
||||
}
|
||||
}
|
||||
instructionService.finish(inst.getInstruction_id());
|
||||
}
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
log.info("指令号:{},已反馈agv任务完成!");
|
||||
|
||||
}
|
||||
//请求删除任务
|
||||
//(需要WCS反馈)
|
||||
else if (phase == 0x30) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0);
|
||||
|
||||
}
|
||||
//任务删除确认
|
||||
//(需要WCS反馈)
|
||||
@@ -187,8 +197,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x67) {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27]));
|
||||
if (phase == 0x67 || phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 ) {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19]));
|
||||
} else {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
|
||||
}
|
||||
@@ -210,8 +220,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("Agv链接异常");
|
||||
log.info("Agv链接异常");
|
||||
System.out.println("OneAgv链接异常");
|
||||
log.info("OneAgv链接异常");
|
||||
log.error("agv连接出现异常:{}", e);
|
||||
logServer.deviceExecuteLog("1", "", "", "agv异常" + e.getMessage());
|
||||
logServer.deviceExecuteLog("1", "", "", "agv异常" + e);
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.nl.acs.device_driver.basedriver.agv.ndcone;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -18,16 +16,17 @@ import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDevic
|
||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.LokiLog;
|
||||
import org.nl.acs.log.LokiLogType;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.impl.TaskServiceImpl;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
@@ -43,37 +42,44 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements DeviceDriver {
|
||||
public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor {
|
||||
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
int agvaddr = 0;
|
||||
int agvaddr_copy = 0;
|
||||
int weight = 0;
|
||||
String device_code = "";
|
||||
int phase = 0;
|
||||
|
||||
String error_type = "agv_error_type";
|
||||
String error_code = "0";
|
||||
int x = 0; //x坐标
|
||||
int y = 0; //y坐标
|
||||
int angle = 0; //角度
|
||||
int electric_qty = 0; //电量
|
||||
int status = 0; //三色灯状态
|
||||
int error = 0; //车辆故障
|
||||
|
||||
int last_x = 0;
|
||||
int last_y = 0;
|
||||
int last_angle = 0;
|
||||
int last_electric_qty = 0;
|
||||
int last_status = 0;
|
||||
int error = 0;
|
||||
int last_error = 0;
|
||||
String error_message = "";
|
||||
|
||||
@LokiLog(type = LokiLogType.ACS_TO_LMS)
|
||||
private synchronized void setErrorInfo(int error, String error_code, String error_message) {
|
||||
this.error = error;
|
||||
this.error_code = error_code;
|
||||
this.error_message = error_message;
|
||||
}
|
||||
|
||||
private Instruction instruction;
|
||||
|
||||
int mode = 2;
|
||||
|
||||
// @LokiLog(type = LokiLogType.AGV)
|
||||
public synchronized void processSocket(int[] arr) throws Exception {
|
||||
device_code = this.getDeviceCode();
|
||||
byte[] data = null;
|
||||
@@ -86,6 +92,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "接收agv上报信息:" + "phase--" + phase + " index--" + index + " 指令号--" + ikey + " 站点号--" + agvaddr + " 车号--" + carno);
|
||||
Instruction link_inst = null;
|
||||
List<Instruction> insts = null;
|
||||
Instruction inst = null;
|
||||
@@ -95,10 +102,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
|
||||
}
|
||||
if (ikey != 0) {
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
if (phase != 0x67 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74 && phase != 0x75) {
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
this.instruction = inst;
|
||||
}
|
||||
// if (ObjectUtil.isEmpty(inst)){
|
||||
// inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
// }
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(link_inst)) {
|
||||
link_flag = true;
|
||||
@@ -109,13 +119,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
String emptyNum = null;
|
||||
String device_code = null;
|
||||
|
||||
if (phase == 0x67) {
|
||||
//故障信息
|
||||
if (arr[18] * 256 + arr[19] == 0) {
|
||||
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
// if (phase == 0x67) {
|
||||
// //故障信息
|
||||
// if (arr[18] * 256 + arr[19] == 0) {
|
||||
//
|
||||
// }
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// }
|
||||
|
||||
//普通站点
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
@@ -124,12 +134,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//
|
||||
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||
|
||||
|
||||
//分配 车id
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x02) {
|
||||
inst.setCarno(String.valueOf(carno));
|
||||
instructionService.update(inst);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + "反馈:" + data);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈车号:" + carno + ",指令号:" + ikey);
|
||||
|
||||
//到达取货点
|
||||
//(需要WCS反馈)
|
||||
@@ -169,28 +180,31 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
return;
|
||||
}
|
||||
|
||||
Object reqWms = device.getExtraValue().get("reqWms");
|
||||
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("vehicle_code", inst.getVehicle_code());
|
||||
map.put("status", "1");
|
||||
map.put("device_code", inst.getStart_point_code());
|
||||
map.put("task_code", inst.getTask_code());
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
if (resp.getInteger("status") == 200) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code());
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms取货申请成功,wms不允许agv申请取货,未反馈agv允许取货", inst.getInstruction_code());
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code());
|
||||
log.info("请求取货条件不满足待机有货");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.info("请求取货条件不满足待机有货");
|
||||
}
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
//取货完毕
|
||||
@@ -230,29 +244,41 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
return;
|
||||
}
|
||||
|
||||
Object reqWms = device.getExtraValue().get("reqWms");
|
||||
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("vehicle_code", inst.getVehicle_code());
|
||||
map.put("status", "2");
|
||||
map.put("device_code", inst.getStart_point_code());
|
||||
map.put("task_code", inst.getTask_code());
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
if (resp.getInteger("status") == 200) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
log.info("指令号:{},acs反馈wms取货完成成功,wms允许agv取货完成,已反馈agv取货完成", inst.getInstruction_code());
|
||||
} else {
|
||||
log.warn("指令号:{},acs反馈wms取货完成成功,wms不允许agv取货完成,未反馈agv取货完成", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code());
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (siemensConveyorDeviceDriver.getTo_command() == 2) {
|
||||
log.info("取货完成请求离开,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command());
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.info("取货完成请求离开下发输送信号,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command());
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "2");
|
||||
list.add(map);
|
||||
siemensConveyorDeviceDriver.writing(list);
|
||||
siemensConveyorDeviceDriver.writing(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(data)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
|
||||
}
|
||||
//到达放货点
|
||||
//(需要WCS反馈)
|
||||
@@ -287,29 +313,18 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
Object reqWms = device.getExtraValue().get("reqWms");
|
||||
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("vehicle_code", inst.getVehicle_code());
|
||||
map.put("status", "3");
|
||||
map.put("device_code", inst.getNext_point_code());
|
||||
map.put("task_code", inst.getTask_code());
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
if (resp.getInteger("status") == 200) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms放货申请成功,wms不允许agv申请放货,未反馈agv允许放货", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
//放货完毕
|
||||
//(需要WCS反馈)
|
||||
@@ -345,24 +360,18 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info("未找到编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
Object reqWms = device.getExtraValue().get("reqWms");
|
||||
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("vehicle_code", inst.getVehicle_code());
|
||||
map.put("status", "4");
|
||||
map.put("device_code", inst.getNext_point_code());
|
||||
map.put("task_code", inst.getTask_code());
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//到达位置点
|
||||
@@ -372,18 +381,92 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
agvaddr_copy = agvaddr;
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else if (phase == 0x50) {//进入交通灯区域
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else if (phase == 0x51) {//离开交通灯区域
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else if (phase == 0x67) {//agv异常
|
||||
if (ikey == 0) {
|
||||
this.setErrorInfo(ikey, "0", "正常");
|
||||
} else {
|
||||
Map<String, String> error = ErrorUtil.getAgvErrorMsg(ikey);
|
||||
String code = error.get("code");
|
||||
String info = error.get("info");
|
||||
this.setErrorInfo(ikey, code, info);
|
||||
}
|
||||
if (error != last_error) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(this.getDevice().getDevice_code());
|
||||
dto.setError_code(String.valueOf(error_code));
|
||||
dto.setError_info(error_message);
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
last_error = error;
|
||||
} else if (phase == 0x70) {
|
||||
//x坐标
|
||||
x = ikey;
|
||||
} else if (phase == 0x71) {
|
||||
//y坐标
|
||||
y = ikey;
|
||||
} else if (phase == 0x72) {
|
||||
//车辆角度
|
||||
angle = ikey;
|
||||
} else if (phase == 0x73) {
|
||||
//agv电量
|
||||
electric_qty = ikey;
|
||||
} else if (phase == 0x74) {
|
||||
//三色灯状态
|
||||
status = ikey;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
|
||||
OneNDCSocketConnectionAutoRun.write(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String Bytes2HexString(byte[] b) {
|
||||
String ret = "";
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
String hex = Integer.toHexString(b[i] & 0xFF);
|
||||
if (hex.length() == 1) {
|
||||
hex = '0' + hex;
|
||||
}
|
||||
ret += hex.toUpperCase();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
//agv编码
|
||||
jo.put("car_no", this.getDevice().getDevice_code());
|
||||
//agv名称
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
//x坐标
|
||||
jo.put("x", this.getX());
|
||||
//y坐标
|
||||
jo.put("y", this.getY());
|
||||
//角度
|
||||
jo.put("angle", this.getAngle());
|
||||
//电量
|
||||
jo.put("electricity", this.getElectric_qty());
|
||||
String status_name = this.status == 1 ? "关机" : this.status == 2 ? "工作中" : this.status == 3 ? "交通管制" : this.status == 4 ? "任务等待" : this.status == 5 ? "充电中" : this.status == 6 ? "故障中" : this.status == 7 ? "电量低" : "正常";
|
||||
//agv状态
|
||||
jo.put("status_name", status_name);
|
||||
//任务号
|
||||
jo.put("task_code", ObjectUtil.isEmpty(instruction) ? "0" : instruction.getTask_code());
|
||||
//异常
|
||||
jo.put("fault", this.getError_message());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.nl.acs.device_driver.basedriver.agv.utils;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* AGV系统类型 1:Magvic 2:NDC 3:先知 4:浙大
|
||||
*/
|
||||
public enum AgvSystemEnum {
|
||||
Maigic(1, "Maigic", "Maigic系统"),
|
||||
NDC(2, "NDC", "NDC系统"),
|
||||
XianGong(3, "XianGong", "仙工系统"),
|
||||
ZheDa(4, "ZheDa", "浙大系统");
|
||||
|
||||
//索引
|
||||
private int index;
|
||||
//编码
|
||||
private String code;
|
||||
//名字
|
||||
private String name;
|
||||
//描述
|
||||
private String desc;
|
||||
|
||||
// 构造方法
|
||||
AgvSystemEnum(int index, String code, String name) {
|
||||
this.index = index;
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
|
||||
}
|
||||
|
||||
public static JSONArray getList() {
|
||||
JSONArray arr = new JSONArray();
|
||||
JSONObject json = new JSONObject();
|
||||
for (AgvSystemEnum em : AgvSystemEnum.values()) {
|
||||
json.put("code", em.getCode());
|
||||
json.put("name", em.getName());
|
||||
arr.add(json);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static String getName(String code) {
|
||||
for (AgvSystemEnum c : AgvSystemEnum.values()) {
|
||||
if (c.code == code) {
|
||||
return c.name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
@Autowired
|
||||
LogService logServer;
|
||||
|
||||
@Value("${acsTowms.token}")
|
||||
//@Value("${acsTowms.token}")
|
||||
public String token;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
package org.nl.acs.history;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.nl.modules.system.domain.Dict;
|
||||
import org.nl.modules.system.service.DictDetailService;
|
||||
import org.nl.modules.system.service.DictService;
|
||||
import org.nl.modules.system.service.dto.DictDetailDto;
|
||||
import org.nl.modules.system.service.impl.DictDetailServiceImpl;
|
||||
import org.nl.modules.system.service.impl.DictServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: geng by
|
||||
* @createDate: 2023/3/15
|
||||
*/
|
||||
public class ErrorUtil {
|
||||
|
||||
public static ConcurrentHashMap<String, List<DictDetailDto>> dictMap = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
public static String getDictDetail(String type, String error_code) {
|
||||
getDict();
|
||||
List<DictDetailDto> dictDetailDtos = dictMap.get(type);
|
||||
String detail = null;
|
||||
if (ObjectUtil.isNotEmpty(dictDetailDtos)) {
|
||||
for (int i = 0; i < dictDetailDtos.size(); i++) {
|
||||
DictDetailDto dictDetailDto = dictDetailDtos.get(i);
|
||||
String value = dictDetailDto.getValue();
|
||||
String label = dictDetailDto.getLabel();
|
||||
if (StrUtil.equals(value, error_code)) {
|
||||
detail = label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return detail == null ? "字典表未配置对应的报警信息" : detail;
|
||||
}
|
||||
|
||||
public static Map<Integer, String> getDictDetailByName(String type) {
|
||||
getDict();
|
||||
List<DictDetailDto> dictDetailDtos = dictMap.get(type);
|
||||
Map<Integer, String> map = new HashMap<>();
|
||||
if (ObjectUtil.isNotEmpty(dictDetailDtos)) {
|
||||
List<DictDetailDto> dtos = dictDetailDtos
|
||||
.stream()
|
||||
.filter(dictDetailDto -> !dictDetailDto.getValue().equals("0"))
|
||||
.filter(dictDetailDto -> !dictDetailDto.getValue().equals("-1"))
|
||||
.collect(Collectors.toList());
|
||||
dtos.forEach(dictDetailDto -> map.put(Integer.parseInt(dictDetailDto.getValue()), dictDetailDto.getLabel()));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public static void getDict() {
|
||||
if (ObjectUtil.isEmpty(dictMap)) {
|
||||
DictDetailService dictDetailService = SpringContextHolder.getBean(DictDetailServiceImpl.class);
|
||||
DictService dictService = SpringContextHolder.getBean(DictServiceImpl.class);
|
||||
List<Dict> dictDtos = dictService.queryAll();
|
||||
for (int i = 0; i < dictDtos.size(); i++) {
|
||||
Dict dictDto = dictDtos.get(i);
|
||||
dictMap.put(dictDto.getName(), getDict(dictDto.getName(), t -> {
|
||||
return dictDetailService.getDictByName(t);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<DictDetailDto> getDict(String name, Function<String, List<DictDetailDto>> f) {
|
||||
return f.apply(name);
|
||||
}
|
||||
|
||||
public static Map<String, String> getAgvErrorMsg(Integer ageErrorNum) {
|
||||
Map<Integer, String> agvMap = getDictDetailByName("agv_error_type");
|
||||
Integer[] keys = agvMap.keySet().toArray(new Integer[0]);
|
||||
String message = "";
|
||||
String code = "";
|
||||
out:
|
||||
for (int i = 1; i < 1 << keys.length; i++) {
|
||||
int sum = 0;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuffer sbCode = new StringBuffer();
|
||||
inner:
|
||||
for (int j = 0; j < keys.length; j++) {
|
||||
if ((i & 1 << j) != 0) {
|
||||
sum += keys[j];
|
||||
sb.append(agvMap.get(keys[j])).append(",");
|
||||
sbCode.append(keys[j]).append(",");
|
||||
}
|
||||
}
|
||||
if (sum == ageErrorNum) {
|
||||
code = sbCode.toString();
|
||||
message = sb.toString();
|
||||
break out;
|
||||
}
|
||||
}
|
||||
Map<String, String> map = new HashMap<>();
|
||||
String info = replace(message);
|
||||
code = replace(code);
|
||||
map.put("code", StrUtil.isEmpty(code) ? "-1" : code);
|
||||
map.put("info", StrUtil.isEmpty(info) ? "AGV上报报警代码有误" : info);
|
||||
return map;
|
||||
}
|
||||
|
||||
public static String replace(String message) {
|
||||
if (StrUtil.isEmpty(message)) {
|
||||
return null;
|
||||
}
|
||||
if (message.endsWith(",")) {
|
||||
return message.substring(0, message.length() - 1);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
package org.nl.acs.history.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author gengby
|
||||
* @date 2023-03-15
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "设备报警记录管理")
|
||||
@RequestMapping("/api/deviceErrorLog")
|
||||
@Slf4j
|
||||
public class DeviceErrorLogController {
|
||||
|
||||
private final DeviceErrorLogService acsDeviceErrorLogService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备报警记录")
|
||||
@ApiOperation("查询设备报警记录")
|
||||
//@PreAuthorize("@el.check('acsDeviceErrorLog:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(acsDeviceErrorLogService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增设备报警记录")
|
||||
@ApiOperation("新增设备报警记录")
|
||||
//@PreAuthorize("@el.check('acsDeviceErrorLog:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody DeviceErrorLogDto dto){
|
||||
acsDeviceErrorLogService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备报警记录")
|
||||
@ApiOperation("修改设备报警记录")
|
||||
//@PreAuthorize("@el.check('acsDeviceErrorLog:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody DeviceErrorLogDto dto){
|
||||
acsDeviceErrorLogService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除设备报警记录")
|
||||
@ApiOperation("删除设备报警记录")
|
||||
//@PreAuthorize("@el.check('acsDeviceErrorLog:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
acsDeviceErrorLogService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出设备报警记录")
|
||||
@ApiOperation("导出设备报警记录")
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('acsDeviceErrorLog:list')")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
acsDeviceErrorLogService.download(acsDeviceErrorLogService.queryAll(whereJson), response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
|
||||
package org.nl.acs.history.service;
|
||||
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author gengby
|
||||
* @date 2023-03-15
|
||||
**/
|
||||
public interface DeviceErrorLogService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<AcsDeviceErrorLogDto>
|
||||
*/
|
||||
List<DeviceErrorLogDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param error_log_uuid ID
|
||||
* @return AcsDeviceErrorLog
|
||||
*/
|
||||
DeviceErrorLogDto findById(String error_log_uuid);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return AcsDeviceErrorLog
|
||||
*/
|
||||
DeviceErrorLogDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(DeviceErrorLogDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(DeviceErrorLogDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param dtos 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<DeviceErrorLogDto> dtos, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.acs.history.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author gengby
|
||||
* @date 2023-03-15
|
||||
**/
|
||||
@Data
|
||||
public class DeviceErrorLogDto implements Serializable {
|
||||
|
||||
/** 报警日志标识 */
|
||||
private String error_log_uuid;
|
||||
|
||||
/** 设备编码 */
|
||||
private String device_code;
|
||||
|
||||
/** 报警编码 */
|
||||
private String error_code;
|
||||
|
||||
/** 报警信息 */
|
||||
private String error_info;
|
||||
|
||||
/** 报警时间 */
|
||||
private String error_time;
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
|
||||
package org.nl.acs.history.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author gengby
|
||||
* @description 服务实现
|
||||
* @date 2023-03-15
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DeviceErrorLogServiceImpl implements DeviceErrorLogService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String error_code = MapUtil.getStr(whereJson, "error_code");
|
||||
String error_info = MapUtil.getStr(whereJson, "error_info");
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
String where = "1 = 1 ";
|
||||
if (StrUtil.isNotEmpty(device_code)) {
|
||||
where += "and device_code like '%" + device_code + "%'";
|
||||
}
|
||||
if (StrUtil.isNotEmpty(error_code)) {
|
||||
where += "and error_code like '%" + error_code + "%'";
|
||||
}
|
||||
if (StrUtil.isNotEmpty(error_info)) {
|
||||
where += "and error_info like '%" + error_info + "%'";
|
||||
}
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "error_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceErrorLogDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<DeviceErrorLogDto> list = arr.toJavaList(DeviceErrorLogDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceErrorLogDto findById(String error_log_uuid) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
JSONObject json = wo.query("error_log_uuid ='" + error_log_uuid + "'").uniqueResult(0);
|
||||
final DeviceErrorLogDto obj = (DeviceErrorLogDto) JSONObject.toJavaObject(json, DeviceErrorLogDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceErrorLogDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
final DeviceErrorLogDto obj = (DeviceErrorLogDto) JSONObject.toJavaObject(json, DeviceErrorLogDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(DeviceErrorLogDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setError_log_uuid(IdUtil.simpleUUID());
|
||||
dto.setDevice_code(dto.getDevice_code());
|
||||
dto.setError_code(dto.getError_code());
|
||||
dto.setError_info(dto.getError_info());
|
||||
dto.setError_time(now);
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(DeviceErrorLogDto dto) {
|
||||
DeviceErrorLogDto entity = this.findById(dto.getError_log_uuid());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_error_log");
|
||||
for (String error_log_uuid : ids) {
|
||||
wo.delete("error_log_uuid = '" + error_log_uuid + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<DeviceErrorLogDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (DeviceErrorLogDto acsDeviceErrorLog : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("设备编码", acsDeviceErrorLog.getDevice_code());
|
||||
map.put("报警编码", acsDeviceErrorLog.getError_code());
|
||||
map.put("报警信息", acsDeviceErrorLog.getError_info());
|
||||
map.put("报警时间", acsDeviceErrorLog.getError_time());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -14,10 +15,12 @@ import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.MagicAgvService;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
import org.nl.acs.agv.server.ZheDaAgvService;
|
||||
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.agv.utils.AgvSystemEnum;
|
||||
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
||||
@@ -45,6 +48,7 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -81,6 +85,15 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
TaskService taskService;
|
||||
@Autowired
|
||||
AcsToLiKuService acsToLiKuService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
MagicAgvService magicAgvService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
XianGongAgvService xianGongAgvService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
ZheDaAgvService zheDaAgvService;
|
||||
|
||||
@Override
|
||||
public void autoInitial() {
|
||||
@@ -362,19 +375,51 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (ObjectUtil.isEmpty(route)) {
|
||||
throw new BadRequestException("未查询到相关路由!");
|
||||
}
|
||||
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
|
||||
|
||||
try {
|
||||
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).toString(), AgvSystemEnum.Maigic.getCode())) {
|
||||
HttpResponse result = magicAgvService.sendAgvInstToMagic(dto);
|
||||
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||
dto.setSend_status("2");
|
||||
} else {
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).toString(), AgvSystemEnum.NDC.getCode())) {
|
||||
ndcAgvService.sendAgvInstToNDC("1",dto);
|
||||
dto.setSend_status("1");
|
||||
|
||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).toString(), AgvSystemEnum.XianGong.getCode())) {
|
||||
if (StrUtil.equals(task.getRequest_again_success(), "1")) {
|
||||
//追加订单
|
||||
HttpResponse result = xianGongAgvService.sendOrderSequencesToXZ(dto);
|
||||
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||
dto.setSend_status("2");
|
||||
} else {
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
} else {
|
||||
//创建订单序列
|
||||
HttpResponse result = xianGongAgvService.sendOrderSequencesToXZ(dto);
|
||||
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||
dto.setSend_status("2");
|
||||
} else {
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status("2");
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status("2");
|
||||
e.printStackTrace();
|
||||
log.error("");
|
||||
}
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
instructions.add(dto);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
package org.nl.acs.udw.rest;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.udw.service.UdwManageService;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
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 java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "内存点位管理")
|
||||
@RequestMapping("/api/udw")
|
||||
@Slf4j
|
||||
public class UdwManagerController {
|
||||
|
||||
private final UdwManageService udwManageService;
|
||||
|
||||
// @GetMapping
|
||||
// @Log("查询内存点位")
|
||||
// @ApiOperation("查询内存点位")
|
||||
// @SaIgnore
|
||||
// public ResponseEntity<Object> query(@RequestParam JSONObject whereJson) {
|
||||
// return new ResponseEntity<>(udwManageService.queryByConditions(whereJson), HttpStatus.OK);
|
||||
// }
|
||||
|
||||
@GetMapping
|
||||
@Log("查询内存点位")
|
||||
@ApiOperation("查询内存点位")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('device:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(udwManageService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,10 @@ package org.nl.acs.udw.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.udw.dto.UdwDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface UdwManageService {
|
||||
/**
|
||||
@@ -13,4 +15,14 @@ public interface UdwManageService {
|
||||
* @return
|
||||
*/
|
||||
List<UdwDto> queryByConditions(JSONObject where);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,157 @@
|
||||
package org.nl.acs.udw.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.udw.UnifiedData;
|
||||
import org.nl.acs.udw.UnifiedDataAccessorFactory;
|
||||
import org.nl.acs.udw.dto.UdwDto;
|
||||
import org.nl.acs.udw.service.UdwManageService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class UdwManagerServiceImpl implements UdwManageService {
|
||||
|
||||
public UdwManagerServiceImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UdwDto> queryByConditions(JSONObject where) {
|
||||
return null;
|
||||
String unified_key = null;
|
||||
String keys = null;
|
||||
|
||||
UnifiedDataUnit unifiedDataUnit = UnifiedDataAccessorFactory.getUnifiedDataAppService().getUnifiedDataUnit(unified_key);
|
||||
if (unifiedDataUnit == null) {
|
||||
return null;
|
||||
} else {
|
||||
String key;
|
||||
UdwDto udwDto;
|
||||
Map storage;
|
||||
ArrayList udwDtos;
|
||||
Iterator var14;
|
||||
if (keys != null) {
|
||||
storage = unifiedDataUnit.getStorage();
|
||||
udwDtos = new ArrayList();
|
||||
var14 = storage.keySet().iterator();
|
||||
|
||||
while(var14.hasNext()) {
|
||||
key = (String)var14.next();
|
||||
if (key.indexOf(keys) != -1) {
|
||||
udwDto = new UdwDto();
|
||||
udwDto.setUnified_key(unified_key);
|
||||
udwDto.setKey(key);
|
||||
udwDto.setValue(((UnifiedData)storage.get(key)).getValue());
|
||||
udwDtos.add(udwDto);
|
||||
}
|
||||
}
|
||||
|
||||
return udwDtos;
|
||||
} else {
|
||||
storage = unifiedDataUnit.getStorage();
|
||||
udwDtos = new ArrayList();
|
||||
var14 = storage.keySet().iterator();
|
||||
|
||||
while(var14.hasNext()) {
|
||||
key = (String)var14.next();
|
||||
udwDto = new UdwDto();
|
||||
udwDto.setUnified_key(unified_key);
|
||||
udwDto.setKey(key);
|
||||
udwDto.setValue(((UnifiedData)storage.get(key)).getValue());
|
||||
udwDtos.add(udwDto);
|
||||
}
|
||||
|
||||
return udwDtos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
|
||||
String unified_key = (String) whereJson.get("unified_key");
|
||||
String keys = (String) whereJson.get("code");
|
||||
if(StrUtil.isEmpty(unified_key))
|
||||
{
|
||||
unified_key = "opc_value";
|
||||
}
|
||||
// String unified_key = (String) whereJson.get("unified_key");
|
||||
// String code = (String) whereJson.get("code");
|
||||
|
||||
// unified_key = whereJson.get("key").toString();
|
||||
// keys = whereJson.get("value").toString();
|
||||
|
||||
|
||||
//[[{"column":"unified_key","value":"cached","compareType":"equals","columnType":"object"}]]
|
||||
UnifiedDataUnit unifiedDataUnit = UnifiedDataAccessorFactory.getUnifiedDataAppService().getUnifiedDataUnit(unified_key);
|
||||
if (unifiedDataUnit == null) {
|
||||
return null;
|
||||
} else {
|
||||
String key;
|
||||
UdwDto udwDto;
|
||||
Map storage;
|
||||
ArrayList udwDtos;
|
||||
Iterator var14;
|
||||
if (keys != null) {
|
||||
storage = unifiedDataUnit.getStorage();
|
||||
udwDtos = new ArrayList();
|
||||
var14 = storage.keySet().iterator();
|
||||
|
||||
while(var14.hasNext()) {
|
||||
key = (String)var14.next();
|
||||
if (key.indexOf(keys) != -1) {
|
||||
udwDto = new UdwDto();
|
||||
udwDto.setUnified_key(unified_key);
|
||||
udwDto.setKey(key);
|
||||
udwDto.setValue(((UnifiedData)storage.get(key)).getValue());
|
||||
udwDtos.add(udwDto);
|
||||
}
|
||||
}
|
||||
|
||||
Integer currentPageNumber = page.getPageNumber() + 1;
|
||||
Integer pageMaxSize = page.getPageSize();
|
||||
|
||||
List orderbyDtoList = (List) udwDtos.stream().skip((currentPageNumber - 1) * pageMaxSize)
|
||||
.limit(pageMaxSize)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("content", orderbyDtoList);
|
||||
jo.put("totalElements", udwDtos.size());
|
||||
|
||||
return jo;
|
||||
} else {
|
||||
storage = unifiedDataUnit.getStorage();
|
||||
udwDtos = new ArrayList();
|
||||
var14 = storage.keySet().iterator();
|
||||
|
||||
while(var14.hasNext()) {
|
||||
key = (String)var14.next();
|
||||
udwDto = new UdwDto();
|
||||
udwDto.setUnified_key(unified_key);
|
||||
udwDto.setKey(key);
|
||||
udwDto.setValue(((UnifiedData)storage.get(key)).getValue());
|
||||
udwDtos.add(udwDto);
|
||||
}
|
||||
Integer currentPageNumber = page.getPageNumber() + 1;
|
||||
Integer pageMaxSize = page.getPageSize();
|
||||
|
||||
List orderbyDtoList = (List) udwDtos.stream().skip((currentPageNumber - 1) * pageMaxSize)
|
||||
.limit(pageMaxSize)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("content", orderbyDtoList);
|
||||
jo.put("totalElements", udwDtos.size());
|
||||
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.modules.logging;
|
||||
|
||||
import ch.qos.logback.core.PropertyDefinerBase;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
// 通过实现logback的PropertyDefinerBase方法,动态定义logback配置中的变量
|
||||
@Component
|
||||
public class DeviceCodeDir extends PropertyDefinerBase {
|
||||
|
||||
String deviceCodeDir = "";
|
||||
public void setPropertyValue(String deviceCode) {
|
||||
deviceCodeDir = deviceCode ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyValue() {
|
||||
if (deviceCodeDir == ""){
|
||||
deviceCodeDir = "默认";
|
||||
}
|
||||
return "默认";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package org.nl.modules.lucene.common;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.TextField;
|
||||
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.springframework.beans.factory.annotation.Value;
|
||||
import org.wltea.analyzer.lucene.IKAnalyzer;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* lucene索引器
|
||||
*/
|
||||
public class Indexer {
|
||||
/**
|
||||
* 写索引实例
|
||||
*/
|
||||
private IndexWriter writer;
|
||||
|
||||
public IndexWriter getWriter() {
|
||||
return writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造方法,实例化IndexWriter
|
||||
* @param indexDir
|
||||
* @throws Exception
|
||||
*/
|
||||
public Indexer(String indexDir) throws Exception {
|
||||
Directory dir = FSDirectory.open(Paths.get(indexDir));
|
||||
//标准分词器,会自动去掉空格啊,is a the等单词
|
||||
// Analyzer analyzer = new StandardAnalyzer();
|
||||
Analyzer analyzer = new IKAnalyzer();
|
||||
//将标准分词器配到写索引的配置中
|
||||
IndexWriterConfig config = new IndexWriterConfig(analyzer);
|
||||
//实例化写索引对象
|
||||
writer = new IndexWriter(dir, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 索引指定目录下的所有文件
|
||||
* @param dataDir
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int indexAll(String dataDir) throws Exception {
|
||||
// 获取该路径下的所有文件
|
||||
File[] files = new File(dataDir).listFiles();
|
||||
if (null != files) {
|
||||
for (File file : files) {
|
||||
//调用下面的indexFile方法,对每个文件进行索引
|
||||
indexFile(file);
|
||||
}
|
||||
}
|
||||
//返回索引的文件数
|
||||
// return writer.numDocs();
|
||||
return writer.numRamDocs();
|
||||
}
|
||||
|
||||
/**
|
||||
* 索引指定的文件
|
||||
* @param file
|
||||
* @throws Exception
|
||||
*/
|
||||
private void indexFile(File file) throws Exception {
|
||||
System.out.println("索引文件的路径:" + file.getCanonicalPath());
|
||||
//调用下面的getDocument方法,获取该文件的document
|
||||
Document doc = getDocument(file);
|
||||
//添加索引文档
|
||||
//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添加到索引中
|
||||
writer.addDocument(doc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文档,文档里再设置每个字段,就类似于数据库中的一行记录
|
||||
* @param file
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private Document getDocument(File file) throws Exception {
|
||||
Document doc = new Document();
|
||||
//开始添加字段
|
||||
//添加内容
|
||||
doc.add(new TextField("contents", new FileReader(file)));
|
||||
//添加文件名,并把这个字段存到索引文件里
|
||||
doc.add(new TextField("fileName", file.getName(), Field.Store.YES));
|
||||
//添加文件路径
|
||||
doc.add(new TextField("fullPath", file.getCanonicalPath(), Field.Store.YES));
|
||||
return doc;
|
||||
}
|
||||
public Document json2Doc(String strDoc) {
|
||||
Document doc = new Document();
|
||||
JSONObject jsonDoc = JSONObject.parseObject(strDoc);
|
||||
Set<String> keys = jsonDoc.keySet();
|
||||
for (String key : keys) {
|
||||
doc.add(new TextField(key, jsonDoc.getString(key), Field.Store.YES));
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
public void addLogIndex(String msg) throws IOException {
|
||||
//步骤一:创建Directory对象,用于指定索引库的位置 RAMDirectory内存
|
||||
Directory directory = FSDirectory.open(new File("D:\\lucene\\index").toPath());
|
||||
//步骤二:创建一个IndexWriter对象,用于写索引
|
||||
// Analyzer analyzer = new StandardAnalyzer();
|
||||
IndexWriter indexWriter=new IndexWriter(directory,new IndexWriterConfig(new IKAnalyzer(false)));
|
||||
// indexWriter.deleteAll();//清理所有索引库
|
||||
// IndexWriter indexWriter=new IndexWriter(directory,new IndexWriterConfig(new StandardAnalyzer()));
|
||||
//记录索引开始时间
|
||||
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);
|
||||
//记录索引结束时间
|
||||
long endTime = System.currentTimeMillis();
|
||||
System.out.println("建立索引"+ "共耗时" + (endTime-startTime) + "毫秒");
|
||||
indexWriter.commit();
|
||||
//步骤八:关闭资源
|
||||
indexWriter.close();
|
||||
System.out.println("建立索引成功-----关闭资源");
|
||||
}
|
||||
//系统的日志文件路径
|
||||
@Value("${logging.file.path}")
|
||||
private String logUrl;
|
||||
|
||||
public static void main(String[] args)throws IOException {
|
||||
//步骤一:创建Directory对象,用于指定索引库的位置 RAMDirectory内存
|
||||
Directory directory = FSDirectory.open(new File("D:\\lucene\\index").toPath());
|
||||
//步骤二:创建一个IndexWriter对象,用于写索引
|
||||
// Analyzer analyzer = new StandardAnalyzer();
|
||||
IndexWriter indexWriter=new IndexWriter(directory,new IndexWriterConfig(new IKAnalyzer(false)));
|
||||
|
||||
indexWriter.deleteAll();//清理所有索引库
|
||||
// IndexWriter indexWriter=new IndexWriter(directory,new IndexWriterConfig(new StandardAnalyzer()));
|
||||
//记录索引开始时间
|
||||
long startTime = System.currentTimeMillis();
|
||||
//步骤三:读取磁盘中文件,对应每一个文件创建一个文档对象
|
||||
File file=new File("D:\\testlog");
|
||||
//步骤四:获取文件列表
|
||||
File[] files = file.listFiles();
|
||||
for (File item:files) {
|
||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(item));
|
||||
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);
|
||||
}
|
||||
}
|
||||
//记录索引结束时间
|
||||
long endTime = System.currentTimeMillis();
|
||||
System.out.println("建立索引"+ "共耗时" + (endTime-startTime) + "毫秒");
|
||||
indexWriter.commit();
|
||||
//步骤八:关闭资源
|
||||
indexWriter.close();
|
||||
System.out.println("建立索引成功-----关闭资源");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.nl.modules.lucene.common;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.apache.lucene.index.CorruptIndexException;
|
||||
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.nl.modules.lucene.config.UrlConfig;
|
||||
import org.wltea.analyzer.lucene.IKAnalyzer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class LuceneIndexWriter {
|
||||
private static IndexWriter indexWriter;
|
||||
|
||||
static {
|
||||
try {
|
||||
Directory directory = FSDirectory.open(new File(UrlConfig.luceneUrl).toPath());
|
||||
IndexWriterConfig config = new IndexWriterConfig(new IKAnalyzer());
|
||||
indexWriter = new IndexWriter(directory, config);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
/**当当前线程结束时,自动关闭IndexWriter,使用Runtime对象*/
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
closeIndexWriter();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/**在线程结束时,自动关闭IndexWriter*/
|
||||
public static IndexWriter getIndexWriter() {
|
||||
return indexWriter;
|
||||
}
|
||||
/**关闭IndexWriter
|
||||
* @throws IOException
|
||||
* @throws CorruptIndexException */
|
||||
public static void closeIndexWriter() throws Exception {
|
||||
if(indexWriter != null) {
|
||||
indexWriter.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
indexWriter.deleteAll();
|
||||
}
|
||||
|
||||
public static String getDate(String timeString) throws ParseException {
|
||||
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");//格式化后的时间
|
||||
return timeString;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package org.nl.modules.lucene.common;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.search.*;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.FSDirectory;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* lucene查询器
|
||||
*/
|
||||
@Slf4j
|
||||
public class Searcher {
|
||||
|
||||
public static Map<String, Object> search(String indexDir, String ext,Map 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);
|
||||
|
||||
//记录索引开始时间
|
||||
long startTime = System.currentTimeMillis();
|
||||
// 实际上Lucene本身不支持分页。因此我们需要自己进行逻辑分页。我们要准备分页参数:
|
||||
int pageSize = Integer.parseInt(whereJson.get("size").toString());// 每页条数
|
||||
int pageNum = Integer.parseInt(whereJson.get("page").toString());// 当前页码
|
||||
int start = pageNum * pageSize;// 当前页的起始条数
|
||||
int end = start + pageSize;// 当前页的结束条数(不能包含)
|
||||
// 创建排序对象,需要排序字段SortField,参数:字段的名称、字段的类型、是否反转如果是false,升序。true降序
|
||||
Sort sort = new Sort(new SortField("logTime", 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");
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
calendar.set(1970, 0, 1);
|
||||
if (startDate == null){
|
||||
startDate = DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH:mm:ss.SSS");
|
||||
}else{
|
||||
startDate = LuceneIndexWriter.getDate(startDate);
|
||||
}
|
||||
if (endDate == null){
|
||||
endDate = DateUtil.format(new DateTime(),"yyyy-MM-dd HH:mm:ss.SSS");
|
||||
} else {
|
||||
endDate = LuceneIndexWriter.getDate(endDate);
|
||||
}
|
||||
TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", 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")+"*"));
|
||||
booleanQueryBuilder.add(query, 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);
|
||||
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());
|
||||
}
|
||||
reader.close();
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("content", array);
|
||||
jo.put("totalElements", docs.totalHits.value);
|
||||
return jo;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String indexDir = "D:\\lucene\\index";
|
||||
//查询这个字符串
|
||||
String q = "07.832";
|
||||
Map whereJson = null;
|
||||
try {
|
||||
search(indexDir, q,whereJson);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.nl.modules.lucene.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @deprecated 设置静态参数初始化
|
||||
*/
|
||||
@Configuration
|
||||
public class StaticConfig {
|
||||
//日志索引目录
|
||||
@Value("${lucene.index.path}")
|
||||
private String luceneDir;
|
||||
|
||||
@Bean
|
||||
public int initStatic() {
|
||||
UrlConfig.setLuceneUrl(luceneDir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.nl.modules.lucene.config;
|
||||
|
||||
public class UrlConfig {
|
||||
public static String luceneUrl;
|
||||
|
||||
public static String getLuceneUrl() {
|
||||
return luceneUrl;
|
||||
}
|
||||
|
||||
public static void setLuceneUrl(String luceneUrl) {
|
||||
UrlConfig.luceneUrl = luceneUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.modules.lucene.enums;
|
||||
|
||||
public enum LogTypeEnum {
|
||||
DEVICE_LOG("设备日志"),
|
||||
INTERFACE_LOG("接口日志");
|
||||
|
||||
private String desc;
|
||||
|
||||
LogTypeEnum(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.nl.modules.lucene.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.lucene.service.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 java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "日志检索")
|
||||
@RequestMapping("/api/lucene")
|
||||
@Slf4j
|
||||
public class LuceneController {
|
||||
|
||||
private final LuceneService luceneService;
|
||||
|
||||
@GetMapping("/labels/values")
|
||||
@ApiOperation("获取标签")
|
||||
public ResponseEntity<Object> labelsValues() {
|
||||
return new ResponseEntity<>(luceneService.getLabelsValues(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.nl.modules.lucene.service;
|
||||
|
||||
|
||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface LuceneExecuteLogService {
|
||||
/**
|
||||
* 设备光电变化实时光电信号
|
||||
*
|
||||
* @param device_code 设备编号
|
||||
* @param key plc信号
|
||||
* @param value plc信号值
|
||||
*/
|
||||
void deviceItemValue(String device_code, String key, String value);
|
||||
|
||||
/**
|
||||
* 设备执行日志,会保留历史记录
|
||||
*
|
||||
* @param luceneLogDto 日志结果对象
|
||||
*/
|
||||
void deviceExecuteLog(LuceneLogDto luceneLogDto);
|
||||
|
||||
/**
|
||||
* 接口日志,会保留历史记录
|
||||
*
|
||||
* @param luceneLogDto 日志结果对象
|
||||
*/
|
||||
void interfaceExecuteLog(LuceneLogDto luceneLogDto) throws IOException;
|
||||
|
||||
/**
|
||||
* 设备执行日志,会保留历史记录
|
||||
*
|
||||
* @param name 日志名称
|
||||
* @param message 日志信息
|
||||
*/
|
||||
void extLog(String name, String message);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.modules.lucene.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public interface LuceneService {
|
||||
/**
|
||||
* 获取labels和values树
|
||||
* @return
|
||||
*/
|
||||
JSONArray getLabelsValues();
|
||||
|
||||
/**
|
||||
* 获取数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> getAll(Map whereJson, Pageable page);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package org.nl.modules.lucene.service.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@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:否 */
|
||||
private String is_delete;
|
||||
|
||||
/* 创建者 */
|
||||
private String create_by;
|
||||
|
||||
/* 创建时间 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 String last_home,
|
||||
final String home) {
|
||||
super();
|
||||
this.device_code = device_code;
|
||||
this.content = "信号 ["
|
||||
+ opc_server_code + "."
|
||||
+ opc_plc_code + "."
|
||||
+ device_code + "."
|
||||
+ to_home + "] 发生变更 "
|
||||
+ last_home + " -> "
|
||||
+ home;
|
||||
}
|
||||
|
||||
public LuceneLogDto(final String device_code, final String remark) {
|
||||
super();
|
||||
this.device_code = device_code;
|
||||
this.content = "设备 ["
|
||||
+ device_code
|
||||
+ "] : "
|
||||
+ remark;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package org.nl.modules.lucene.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.StringField;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.nl.modules.lucene.common.LuceneIndexWriter;
|
||||
import org.nl.modules.lucene.enums.LogTypeEnum;
|
||||
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author jlm
|
||||
* @description 服务实现
|
||||
* @date 2023-04-11
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class LuceneExecuteLogServiceImpl implements LuceneExecuteLogService {
|
||||
|
||||
@Override
|
||||
public void deviceItemValue(String device_code, String key, String value) {
|
||||
String now = DateUtil.now();
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void deviceExecuteLog(LuceneLogDto luceneLogDto) {
|
||||
luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc());
|
||||
addIndex(luceneLogDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void interfaceExecuteLog(LuceneLogDto luceneLogDto) throws IOException {
|
||||
luceneLogDto.setLogType(LogTypeEnum.INTERFACE_LOG.getDesc());
|
||||
addIndex(luceneLogDto);
|
||||
}
|
||||
|
||||
private void addIndex(LuceneLogDto luceneLogDto) throws IOException {
|
||||
IndexWriter indexWriter = LuceneIndexWriter.getIndexWriter();
|
||||
//创建一个Document对象
|
||||
Document document = new Document();
|
||||
try {
|
||||
//记录索引开始时间
|
||||
long startTime = System.currentTimeMillis();
|
||||
//向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));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(luceneLogDto.getMethod())) {
|
||||
document.add(new StringField("method", luceneLogDto.getMethod(), Field.Store.YES));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(luceneLogDto.getStatus_code())) {
|
||||
document.add(new StringField("status_code", luceneLogDto.getStatus_code(), Field.Store.YES));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(luceneLogDto.getRequestparam())) {
|
||||
document.add(new StringField("requestparam", luceneLogDto.getRequestparam(), Field.Store.YES));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(luceneLogDto.getResponseparam())) {
|
||||
document.add(new StringField("responseparam", luceneLogDto.getResponseparam(), Field.Store.YES));
|
||||
}
|
||||
document.add(new StringField("logType", luceneLogDto.getLogType(), Field.Store.YES));
|
||||
document.add(new StringField("logTime", DateUtil.format(new DateTime(), "yyyy-MM-dd HH:mm:ss.SSS"), Field.Store.YES));
|
||||
indexWriter.addDocument(document);
|
||||
//记录索引结束时间
|
||||
long endTime = System.currentTimeMillis();
|
||||
log.info("建立索引共耗时{}毫秒", endTime - startTime);
|
||||
indexWriter.commit();
|
||||
MDC.put("DEVICECODE", luceneLogDto.getDevice_code());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void extLog(String name, String message) {
|
||||
try {
|
||||
MDC.put(name, name);
|
||||
log.info("{}", message);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
MDC.remove(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package org.nl.modules.lucene.service.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;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.lucene.common.Searcher;
|
||||
import org.nl.modules.lucene.service.LuceneService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class LuceneServiceImpl implements LuceneService {
|
||||
|
||||
@Value("${loki.url}")
|
||||
private String lokiUrl;
|
||||
|
||||
@Value("${loki.systemName}")
|
||||
private String systemName;
|
||||
|
||||
//日志索引目录
|
||||
@Value("${lucene.index.path}")
|
||||
private String luceneUrl;
|
||||
|
||||
/**
|
||||
* 获取labels和values树
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JSONArray getLabelsValues() {
|
||||
JSONArray result = new JSONArray();
|
||||
// 获取所有标签
|
||||
String labelString = HttpUtil.get(lokiUrl + "/labels", CharsetUtil.CHARSET_UTF_8);
|
||||
JSONObject parse = (JSONObject) JSONObject.parse(labelString);
|
||||
JSONArray labels = parse.getJSONArray("data");
|
||||
for (int i=0; i<labels.size(); i++) {
|
||||
// 获取标签下的所有值
|
||||
String valueString = HttpUtil.get(lokiUrl + "/label/" + labels.getString(i) + "/values", CharsetUtil.CHARSET_UTF_8);
|
||||
JSONObject parse2 = (JSONObject) JSONObject.parse(valueString);
|
||||
JSONArray values = parse2.getJSONArray("data");
|
||||
JSONArray children = new JSONArray();
|
||||
// 组成树形状态 两级
|
||||
for (int j=0; j<values.size(); j++) {
|
||||
JSONObject leaf = new JSONObject();
|
||||
leaf.put("label", values.getString(j));
|
||||
leaf.put("value", values.getString(j));
|
||||
children.add(leaf);
|
||||
}
|
||||
|
||||
JSONObject node = new JSONObject();
|
||||
node.put("label", labels.getString(i));
|
||||
node.put("value", labels.getString(i));
|
||||
node.put("children", children);
|
||||
result.add(node);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAll(Map whereJson, Pageable page) {
|
||||
JSONObject jo = new JSONObject();
|
||||
try {
|
||||
JSONObject jsonObject = (JSONObject) Searcher.search(luceneUrl, "", whereJson);
|
||||
JSONArray array = jsonObject.getJSONArray("content");
|
||||
int totalElements = Integer.parseInt(jsonObject.get("totalElements").toString());
|
||||
jo.put("content", array);
|
||||
jo.put("totalElements", totalElements);
|
||||
} catch (Exception e) {
|
||||
log.error("索引查询为空", e);
|
||||
throw new NullPointerException("索引查询为空");
|
||||
}
|
||||
|
||||
return jo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,9 +27,9 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
* @author Zheng Jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
public interface DictService {
|
||||
|
||||
/**
|
||||
@@ -47,6 +47,8 @@ public interface DictService {
|
||||
*/
|
||||
List<DictDto> queryAll(DictQueryCriteria dict);
|
||||
|
||||
List<Dict> queryAll();
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
|
||||
@@ -36,9 +36,9 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
* @author Zheng Jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = "dict")
|
||||
@@ -60,6 +60,12 @@ public class DictServiceImpl implements DictService {
|
||||
return dictMapper.toDto(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dict> queryAll() {
|
||||
List<Dict> list = dictRepository.findAll();
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(Dict resources) {
|
||||
|
||||
Binary file not shown.
@@ -1,24 +1,14 @@
|
||||
server:
|
||||
port: 8010
|
||||
tomcat:
|
||||
accept-count: 1000
|
||||
max-connections: 10000
|
||||
max-threads: 800
|
||||
min-spare-threads: 100
|
||||
#配置数据源
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:lzhl_one_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_one_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:zdlb_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:P@ssw0rd}
|
||||
# password: ${DB_PWD:Root.123456}
|
||||
password: ${DB_PWD:123456}
|
||||
|
||||
password: ${DB_PWD:Root.123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
@@ -136,8 +126,11 @@ file:
|
||||
avatarMaxSize: 5
|
||||
logging:
|
||||
file:
|
||||
path: D:\acs_log
|
||||
path: D:\log\ACS
|
||||
config: classpath:logback-spring.xml
|
||||
lucene:
|
||||
index:
|
||||
path: D:\lucene\index
|
||||
|
||||
# Sa-Token配置
|
||||
sa-token:
|
||||
@@ -160,5 +153,5 @@ sa-token:
|
||||
token-prefix: Bearer
|
||||
|
||||
loki:
|
||||
url: http://127.0.0.1:3100/loki/api/v1
|
||||
url: http://localhost:3100/loki/api/v1
|
||||
systemName: acs
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
server:
|
||||
port: 8010
|
||||
tomcat:
|
||||
accept-count: 1000
|
||||
max-connections: 10000
|
||||
max-threads: 800
|
||||
min-spare-threads: 100
|
||||
#配置数据源
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.4.210}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
@@ -19,9 +14,11 @@ spring:
|
||||
# 最小连接数
|
||||
min-idle: 15
|
||||
# 最大连接数
|
||||
max-active: 60
|
||||
max-active: 30
|
||||
# 超时时间(以秒数为单位)
|
||||
remove-abandoned-timeout: 180
|
||||
# 获取连接超时时间
|
||||
max-wait: 5000
|
||||
max-wait: 3000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
@@ -41,11 +38,8 @@ spring:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
# 控制台管理用户名和密码
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
login-username: admin
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
@@ -58,12 +52,11 @@ spring:
|
||||
multi-statement-allow: true
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:9}
|
||||
database: ${REDIS_DB:2}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
|
||||
# 登录相关配置
|
||||
login:
|
||||
# 登录缓存
|
||||
@@ -82,7 +75,7 @@ login:
|
||||
heigth: 36
|
||||
# 内容长度
|
||||
length: 2
|
||||
# 字体名称,为空则使用默认字体,如遇到线上乱码,设置其他字体即可
|
||||
# 字体名称,为空则使用默认字体
|
||||
font-name:
|
||||
# 字体大小
|
||||
font-size: 25
|
||||
@@ -94,36 +87,29 @@ jwt:
|
||||
token-start-with: Bearer
|
||||
# 必须使用最少88位的Base64对该令牌进行编码
|
||||
base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
|
||||
# 令牌过期时间 此处单位/毫秒 ,默认2小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
||||
token-validity-in-seconds: 7200000
|
||||
# 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
||||
token-validity-in-seconds: 14400000
|
||||
# 在线用户key
|
||||
online-key: online-token-
|
||||
# 验证码
|
||||
code-key: code-key-
|
||||
# token 续期检查时间范围(默认30分钟,单位默认毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
|
||||
# token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
|
||||
detect: 1800000
|
||||
# 续期时间范围,默认 1小时,这里单位毫秒
|
||||
# 续期时间范围,默认1小时,单位毫秒
|
||||
renew: 3600000
|
||||
|
||||
#是否允许生成代码,生产环境设置为false
|
||||
generator:
|
||||
enabled: true
|
||||
|
||||
#是否开启 swagger-ui
|
||||
swagger:
|
||||
enabled: true
|
||||
|
||||
# IP 本地解析
|
||||
ip:
|
||||
local-parsing: true
|
||||
|
||||
#是否允许生成代码,生产环境设置为false
|
||||
generator:
|
||||
enabled: false
|
||||
|
||||
#如果生产环境要开启swagger,需要配置请求地址
|
||||
#springfox:
|
||||
# documentation:
|
||||
# swagger:
|
||||
# v2:
|
||||
# host: # 接口域名或外网ip
|
||||
|
||||
#是否开启 swagger-ui
|
||||
swagger:
|
||||
enabled: false
|
||||
|
||||
# 文件存储路径
|
||||
file:
|
||||
mac:
|
||||
@@ -140,8 +126,11 @@ file:
|
||||
avatarMaxSize: 5
|
||||
logging:
|
||||
file:
|
||||
path: D:\acs_log
|
||||
path: D:\log\acs
|
||||
config: classpath:logback-spring.xml
|
||||
lucene:
|
||||
index:
|
||||
path: D:\lucene\index
|
||||
|
||||
# Sa-Token配置
|
||||
sa-token:
|
||||
@@ -164,5 +153,5 @@ sa-token:
|
||||
token-prefix: Bearer
|
||||
|
||||
loki:
|
||||
url: http://localhost:3100/loki/api/v1
|
||||
url: http://192.168.4.210:3100/loki/api/v1
|
||||
systemName: acs
|
||||
|
||||
@@ -44,7 +44,7 @@ rsa:
|
||||
private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
|
||||
logging:
|
||||
file:
|
||||
path: D:\acs_log
|
||||
path: C:\log\wms
|
||||
config: classpath:logback-spring.xml
|
||||
# sa-token白名单配置
|
||||
security:
|
||||
@@ -78,5 +78,3 @@ security:
|
||||
- /api/localStorage/pictures
|
||||
# 参数
|
||||
- /api/param/getValueByCode
|
||||
acsTowms:
|
||||
token: Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJiZTVmOGZiZDcyMWU0NGFiODRlOGI4NTE4ODE5OWM0ZiIsImF1dGgiOiJ1c2VyOmxpc3QsbW9uaXRvcjpsaXN0Iiwic3ViIjoiYWNzIn0.JGga-TcIHTt76KT_m_7bt-fxdBUdwdRfRjXzwLyPLVLLPoOSXbVPbf2q6vcV-fh33r2wyrBEleWYVPOEvjrZMw
|
||||
|
||||
@@ -13,4 +13,5 @@ delete from acs_task_feedback;
|
||||
delete from sys_quartz_log;
|
||||
delete from acs_storage_cell;
|
||||
update acs_stage_actor set device_code='',image_name ='1';
|
||||
update sys_code_rule_detail set current_value=0;
|
||||
update sys_code_rule_detail set current_value=0;
|
||||
update stage set stage_data = null;
|
||||
34
acs/nladmin-system/src/main/resources/log/Lucene.xml
Normal file
34
acs/nladmin-system/src/main/resources/log/Lucene.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<define name="DEVICECODE" class="org.nl.modules.logging.DeviceCodeDir"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE_LUCENE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/lucene/${DEVICECODE}/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.modules.lucene.service.impl.LuceneExecuteLogServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="FILE_LUCENE"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -21,27 +21,13 @@ https://juejin.cn/post/6844903775631572999
|
||||
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!--引入默认的一些设置-->
|
||||
<!-- <include resource="log/AutoCreateInst.xml"/>
|
||||
<include resource="log/QueryAgvTaskStatus.xml"/>
|
||||
<include resource="log/AgvFeedbackServiceImpl.xml"/>
|
||||
<include resource="log/AgvLeaveServlet.xml"/>
|
||||
<include resource="log/AcsToErp.xml"/>
|
||||
<include resource="log/AcsToWms.xml"/>
|
||||
<include resource="log/WmsToAcs.xml"/>
|
||||
<include resource="log/QueryXZAgvTaskStatus.xml"/>
|
||||
-->
|
||||
<!-- <include resource="log/QueryMagicAgvDeviceStatus.xml"/>-->
|
||||
<!--FILE 10开始+1-->
|
||||
<include resource="log/OneNDCSocketConnectionAutoRun.xml"/>
|
||||
<include resource="log/AgvNdcOneDeviceDriver.xml"/>
|
||||
<include resource="log/AcsToLk.xml"/>
|
||||
<include resource="log/LkToAcs.xml"/>
|
||||
<include resource="log/AutoCreateInst.xml"/>
|
||||
<include resource="log/AcsToWms.xml"/>
|
||||
<include resource="log/WmsToAcs.xml"/>
|
||||
<include resource="log/OneNDCSocketConnectionAutoRun.xml"/>
|
||||
<include resource="log/Lucene.xml"/>
|
||||
<include resource="log/OpcUtil.xml"/>
|
||||
|
||||
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
@@ -49,7 +35,6 @@ https://juejin.cn/post/6844903775631572999
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
@@ -92,37 +77,16 @@ https://juejin.cn/post/6844903775631572999
|
||||
</format>
|
||||
</appender>
|
||||
|
||||
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>error</level>
|
||||
</filter>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/ERROR/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>20GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<!--开发环境:打印控制台-->
|
||||
<springProfile name="dev">
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
<appender-ref ref="lokiAppender"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</root>
|
||||
<!--logmanage -->
|
||||
<logger name="org.nl.acs.log.service.impl.DeviceExecuteLogServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="jdbc.resultsettable" level="ERROR" additivity="false">
|
||||
@@ -163,49 +127,52 @@ https://juejin.cn/post/6844903775631572999
|
||||
</logger>
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
<!--生产环境:打印控制台和输出到文件-->
|
||||
<springProfile name="prod">
|
||||
<root level="info">
|
||||
<appender-ref ref="ERROR"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</root>
|
||||
<!--logmanage -->
|
||||
<logger name="org.nl.acs.log.service.impl.DeviceExecuteLogServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="jdbc.resultsettable" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="org.openscada.opc.lib.da.Server" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<!--logmanage -->
|
||||
|
||||
|
||||
<logger name="jdbc.audit" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="jdbc.resultset" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="springfox.documentation" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="jdbc.sqlonly" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="jdbc.sqltiming" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="org.jinterop" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
</springProfile>
|
||||
</configuration>
|
||||
|
||||
27
acs/nladmin-ui/src/api/acs/history/acsDeviceErrorLog.js
Normal file
27
acs/nladmin-ui/src/api/acs/history/acsDeviceErrorLog.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/deviceErrorLog',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/deviceErrorLog/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/deviceErrorLog',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
28
acs/nladmin-ui/src/api/acs/history/udwData.js
Normal file
28
acs/nladmin-ui/src/api/acs/history/udwData.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/task',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/task/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/task',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { edit, del }
|
||||
|
||||
145
acs/nladmin-ui/src/views/acs/history/deviceErrorInfo/index.vue
Normal file
145
acs/nladmin-ui/src/views/acs/history/deviceErrorInfo/index.vue
Normal file
@@ -0,0 +1,145 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<label class="el-form-item-label">设备编码</label>
|
||||
<el-input
|
||||
v-model="query.device_code"
|
||||
clearable
|
||||
placeholder="设备编码"
|
||||
style="width: 185px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<el-input
|
||||
v-model="query.error_code"
|
||||
clearable
|
||||
placeholder="报警编码"
|
||||
style="width: 185px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<el-input
|
||||
v-model="query.error_info"
|
||||
clearable
|
||||
placeholder="报警信息"
|
||||
style="width: 185px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<date-range-picker
|
||||
v-model="query.error_time"
|
||||
start-placeholder="error_timeStart"
|
||||
end-placeholder="error_timeStart"
|
||||
class="date-item"
|
||||
/>
|
||||
<rrOperation :crud="crud" />
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="500px"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="small"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="device_code" label="设备编码" />
|
||||
<el-table-column prop="error_code" label="报警编码" />
|
||||
<el-table-column prop="error_info" label="报警信息" />
|
||||
<el-table-column prop="error_time" label="报警时间" />
|
||||
<el-table-column
|
||||
v-permission="['admin','acsDeviceErrorLog:edit','acsDeviceErrorLog:del']"
|
||||
label="操作"
|
||||
width="150px"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
:disabled-edit="true"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudAcsDeviceErrorLog from '@/api/acs/history/acsDeviceErrorLog'
|
||||
|
||||
const defaultForm = { error_log_uuid: null, device_code: null, error_code: null, error_info: null, error_time: null }
|
||||
export default {
|
||||
name: 'DeviceErrorLog',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '设备报警记录',
|
||||
url: 'api/deviceErrorLog',
|
||||
idField: 'error_log_uuid',
|
||||
sort: 'error_log_uuid,desc',
|
||||
crudMethod: { ...crudAcsDeviceErrorLog },
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
add: ['admin', 'deviceErrorLog:add'],
|
||||
edit: ['admin', 'deviceErrorLog:edit'],
|
||||
del: ['admin', 'adeviceErrorLog:del']
|
||||
},
|
||||
rules: {},
|
||||
queryTypeOptions: [
|
||||
{ key: 'device_code', display_name: '设备编码' },
|
||||
{ key: 'error_code', display_name: '报警编码' },
|
||||
{ key: 'error_info', display_name: '报警信息' }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
181
acs/nladmin-ui/src/views/acs/history/udwData/index.vue
Normal file
181
acs/nladmin-ui/src/views/acs/history/udwData/index.vue
Normal file
@@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-select
|
||||
v-model="form.unified_key"
|
||||
placeholder="unified_key"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
clearable
|
||||
filterable
|
||||
size="small">
|
||||
<el-option v-for="(item,index) in unified_key" :key="index" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-model="query.code"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="编号"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="500px"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
||||
<el-form-item label="unified_key">
|
||||
<el-input v-model="form.unified_key" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="编号">
|
||||
<el-input v-model="form.key" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="值">
|
||||
<el-input v-model="form.value" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="small"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="unified_key" label="unified_key" />
|
||||
<el-table-column prop="key" label="编号" />
|
||||
<el-table-column prop="value" label="值" />
|
||||
<el-table-column
|
||||
v-permission="['admin','instruction:edit','instruction:del']"
|
||||
fixed="left"
|
||||
label="操作"
|
||||
width="150px"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button slot="right" size="mini" style="margin-left: -1px;margin-right: 2px" type="text" @click="dialogFormVisible = true">
|
||||
查询历史
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<!--弹窗设置设备与图标绑定与角度-->
|
||||
<el-dialog title="历史" :visible.sync="dialogFormVisible" width="35%">
|
||||
<el-form :model="form" size="small">
|
||||
<el-form-item label="unified_key" prop="unified_key" label-width="100px">
|
||||
<el-input v-model="form.unified_key" :disabled="true" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="code" prop="key" label-width="100px">
|
||||
<el-input v-model="form.key" :disabled="true" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudUdwData from '@/api/acs/history/udwData'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import { getDicts } from '@/api/system/dict'
|
||||
|
||||
const defaultForm = {
|
||||
unified_key: '',
|
||||
key: null,
|
||||
value: null,
|
||||
last_modify_date: null
|
||||
}
|
||||
export default {
|
||||
dicts: [],
|
||||
name: 'UdwData',
|
||||
components: { pagination, crudOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '数据源',
|
||||
url: 'api/udw/',
|
||||
idField: 'key',
|
||||
sort: 'key',
|
||||
query: {},
|
||||
crudMethod: { ...crudUdwData },
|
||||
optShow: {
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
unified_key: [
|
||||
{
|
||||
value: '1',
|
||||
label: 'opc_value'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: 'cached'
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: 'socket'
|
||||
}
|
||||
],
|
||||
permission: {
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
rules: {
|
||||
},
|
||||
form: {
|
||||
unified_key: 'opc_value',
|
||||
key: null,
|
||||
value: null,
|
||||
last_modify_date: null
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
getDicts().then(data => {
|
||||
this.dicts = data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-dropdown-link {
|
||||
cursor: pointer;
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.el-icon-arrow-down {
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
18
acs/nladmin-ui/src/views/monitor/lucene/api/lucene.js
Normal file
18
acs/nladmin-ui/src/views/monitor/lucene/api/lucene.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getLogData(param) {
|
||||
return request({
|
||||
url: 'api/lucene/getAll',
|
||||
method: 'get',
|
||||
data: param
|
||||
})
|
||||
}
|
||||
|
||||
export function labelsValues() {
|
||||
return request({
|
||||
url: 'api/loki/labels/values',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default { getLogData, labelsValues }
|
||||
@@ -1,20 +1,8 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<Search/>
|
||||
<crudOperation>
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:loading="crud.delAllLoading"
|
||||
@click="confirmDelAll()"
|
||||
>
|
||||
清空
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<Search />
|
||||
<crudOperation />
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
@@ -24,15 +12,22 @@
|
||||
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="resource_name" label="资源号"/>
|
||||
<el-table-column prop="create_datetime" label="创建时间"/>
|
||||
<el-table-column prop="content" label="内容详情"/>
|
||||
<!-- <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="设备号" min-width="130" show-overflow-tooltip/>
|
||||
<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/>
|
||||
<pagination />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -43,14 +38,13 @@ import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import { delAll } from '@/api/acs/lucene/log'
|
||||
|
||||
const start = new Date()
|
||||
export default {
|
||||
name: 'LuceneLog',
|
||||
components: { Search, pagination, crudOperation },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
cruds: function() {
|
||||
return CRUD({
|
||||
title: '系统参数', url: 'api/lucene', idField: 'id', sort: 'id,desc',
|
||||
title: '系统参数', url: 'api/lucene/getAll', idField: 'id', sort: 'id,desc',
|
||||
queryOnPresenterCreated: true,
|
||||
optShow: {
|
||||
add: false,
|
||||
@@ -64,7 +58,7 @@ export default {
|
||||
page: 0
|
||||
},
|
||||
query: {
|
||||
createTime: [start.setTime(start.getTime() - 3600 * 1000 * 0.5), new Date()]
|
||||
createTime: [new Date(new Date().setTime(new Date().getTime() - 3600 * 1000)), new Date(new Date().setTime(new Date().getTime() + 3600 * 1000))]
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1,10 +1,50 @@
|
||||
<template>
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-input
|
||||
v-model="query.device_code"
|
||||
clearable
|
||||
size="small"
|
||||
placeholder="请输入你要搜索的设备号"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
/>
|
||||
<el-input
|
||||
v-model="query.method"
|
||||
clearable
|
||||
size="small"
|
||||
placeholder="请输入你要搜索的方法名"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
/>
|
||||
<el-input
|
||||
v-model="query.status_code"
|
||||
clearable
|
||||
size="small"
|
||||
placeholder="请输入你要搜索的状态码"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
/>
|
||||
<el-input
|
||||
v-model="query.requestparam"
|
||||
clearable
|
||||
size="small"
|
||||
placeholder="请输入你要搜索的请求参数"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
/>
|
||||
<el-input
|
||||
v-model="query.responseparam"
|
||||
clearable
|
||||
size="small"
|
||||
placeholder="请输入你要搜索的返回参数"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
/>
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
clearable
|
||||
size="small"
|
||||
placeholder="请输入你要搜索的内容"
|
||||
placeholder="请输入你要搜索的内容详情"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
/>
|
||||
@@ -16,12 +56,13 @@
|
||||
v-model="query.createTime"
|
||||
type="datetimerange"
|
||||
:picker-options="pickerOptions"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
align="right"
|
||||
/>
|
||||
<rrOperation/>
|
||||
<rrOperation />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user