diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/impl/AddressServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/impl/AddressServiceImpl.java index d709a88..c6bf135 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/impl/AddressServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/impl/AddressServiceImpl.java @@ -200,7 +200,7 @@ public class AddressServiceImpl extends CommonServiceImpl AGVDeviceStatus = new HashMap(); + private static final String my_separator = "-"; + @Override public Map findAllAgvFromCache() { return AGVDeviceStatus; @@ -94,7 +96,7 @@ public class AgvServiceImpl implements AgvService { public static void main(String[] args) { String address = "L1-01-01"; - if (address.indexOf("-") > 0) { + if (address.indexOf(my_separator) > 0) { String str = address.substring(address.indexOf("-"), address.length()); address = address.substring(0, address.indexOf("-")); } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java index f9e79f9..cfd44a8 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java @@ -192,7 +192,7 @@ public class MagicAgvServiceImpl implements MagicAgvService { destinationOrder.put("locationName", locationName); //机器人在工作站要执行的操作 destinationOrder.put("operation", operation); - if (propertiesType.equals("1")) {//取货前等待、取货后等待 + if ("1".equals(propertiesType)) {//取货前等待、取货后等待 //pro 1 进入离开等待 if ("1".equals(pro)) { @@ -251,7 +251,7 @@ public class MagicAgvServiceImpl implements MagicAgvService { destinationOrder.put("properties", properties); } - } else if (propertiesType.equals("2")) {//Spin转动 + } else if ("2".equals(propertiesType)) {//Spin转动 JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "global_spin_angle");//坐标系类型,global_spin_angle为全局坐标系 @@ -262,14 +262,14 @@ public class MagicAgvServiceImpl implements MagicAgvService { pro2.put("value", "0");//弧度值,如0 properties.add(pro2); destinationOrder.put("properties", properties); - } else if (propertiesType.equals("3")) {//JackUnload,Jackload不操作 + } else if ("3".equals(propertiesType)) {//JackUnload,Jackload不操作 JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "recognize");//固定值 pro1.put("value", "false");//固定值 properties.add(pro1); destinationOrder.put("properties", properties); - } else if (propertiesType.equals("4")) { + } else if ("4".equals(propertiesType)) { JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "robot_spin_angle");//坐标系类型,robot_spin_angle为机器人坐标系 diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index 2fc165f..23d3f83 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java @@ -332,8 +332,9 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { String nextAddress = inst.getNext_device_code(); Device startdevice = deviceAppService.findDeviceByCode(startAddress); Device nextdevice = deviceAppService.findDeviceByCode(nextAddress); - break; + default: + break; } orderjo.put("destinations", ja); @@ -369,14 +370,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { destinationOrder.put("locationName", locationName); //机器人在工作站要执行的操作 destinationOrder.put("operation", operation); - if (propertiesType.equals("1")) {//Wait请求是否继续 + if ("1".equals(propertiesType)) {//Wait请求是否继续 JSONArray properties = new JSONArray(); JSONObject pro2 = new JSONObject(); pro2.put("key", "device:queryAtExecuted");//固定值 pro2.put("value", pro + ":wait");//pro为wait请求的标识,一般用点位拼接的字符串 properties.add(pro2); destinationOrder.put("properties", properties); - } else if (propertiesType.equals("2")) {//Spin转动 + } else if ("2".equals(propertiesType)) {//Spin转动 JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "global_spin_angle");//坐标系类型,global_spin_angle为全局坐标系 @@ -387,14 +388,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { pro2.put("value", "0");//弧度值,如0 properties.add(pro2); destinationOrder.put("properties", properties); - } else if (propertiesType.equals("3")) {//JackUnload,Jackload不操作 + } else if ("3".equals(propertiesType)) {//JackUnload,Jackload不操作 JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "recognize");//固定值 pro1.put("value", "false");//固定值 properties.add(pro1); destinationOrder.put("properties", properties); - } else if (propertiesType.equals("4")) { + } else if ("4".equals(propertiesType)) { JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "robot_spin_angle");//坐标系类型,robot_spin_angle为机器人坐标系 @@ -405,7 +406,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { pro2.put("value", "0");//弧度值,如0 properties.add(pro2); destinationOrder.put("properties", properties); - } else if (propertiesType.equals("5")) {//Wait请求是否继续 + } else if ("5".equals(propertiesType)) {//Wait请求是否继续 JSONArray properties = new JSONArray(); JSONObject pro2 = new JSONObject(); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java index 2ad3d42..24cefe5 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java @@ -45,7 +45,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { String task_type = inst.getInstruction_type(); jo.put("deadline", AgvUtil.getNextDay(1)); //判断是否追加任务 - if (task_type.equals("3") || task_type.equals("4")) { + if ("3".equals(task_type) || "4".equals(task_type)) { jo.put("complete", "false"); } else { jo.put("complete", "true"); @@ -53,9 +53,9 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { jo.put("task_code", inst.getInstruction_code()); //根据任务,下发指令类型 JSONArray destinations = new JSONArray(); - if (task_type.equals("3")) { + if ("3".equals(task_type)) { destinations.add(destination(start_point_code, "Wait", "5", "1")); - } else if (task_type.equals("4")) { + } else if ("4".equals(task_type)) { destinations.add(destination(start_point_code, "Load", "1", "1")); destinations.add(destination(next_point_code, "Wait", "5", "1")); } else { @@ -73,7 +73,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { //不同楼层下发不同的agv系统 - if (task_type.equals("1")) { + if ("1".equals(task_type)) { agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + inst.getInstruction_code(); } else { agvurl = agvurl2 + ":" + agvport2 + "/v1/transportOrders/" + inst.getInstruction_code(); @@ -98,11 +98,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { String agvurl = ""; String agvport = ""; - if (type.equals("1")) { + if ("1".equals(type)) { agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); } - if (type.equals("2")) { + if ("2".equals(type)) { agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue(); agvport = paramService.findByCode(AcsConfig.AGVPORT2).getValue(); } @@ -147,7 +147,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; //取货的进入前等待和离开等待 - if (action.equals("Load")) { + if ("Load".equals(action)) { if ("EntryRequired".equals(type)) { //豪凯自动线对接位 @@ -172,7 +172,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { } } //等待点等待 - if (action.equals("Wait")) { + if ("Wait".equals(action)) { if ("Wait".equals(type)) { JSONObject jo = new JSONObject(); jo.put("task_code", inst.getInstruction_code()); @@ -239,7 +239,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { } } //放货的进入前等待和离开等待 - if (action.equals("Unload")) { + if ("Unload".equals(action)) { if ("EntryRequired".equals(type)) { if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver(); @@ -262,7 +262,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { if (is_feedback) { requestjo.put("task_code", jobno); requestjo.put("operation", action); - if (type.equals("entryRequired") || type.equals("EntryRequired")) { + if ("entryRequired".equals(type) || "EntryRequired".equals(type)) { requestjo.put("entryRequired", "true"); } else { requestjo.put("pauseOnStation", "true"); @@ -273,7 +273,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - if (inst.getInstruction_type().equals("4")) { + if ("4".equals(inst.getInstruction_type())) { agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue(); } agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + jobno + "/interact"; @@ -332,7 +332,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { destinationOrder.put("locationName", locationName); //机器人在工作站要执行的操作 destinationOrder.put("operation", operation); - if (propertiesType.equals("1")) {//取货前等待、取货后等待 + if ("1".equals(propertiesType)) {//取货前等待、取货后等待 //pro 1 进入离开等待 if ("1".equals(pro)) { @@ -384,7 +384,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { destinationOrder.put("properties", properties); } - } else if (propertiesType.equals("2")) {//Spin转动 + } else if ("2".equals(propertiesType)) {//Spin转动 JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "global_spin_angle");//坐标系类型,global_spin_angle为全局坐标系 @@ -395,14 +395,14 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { pro2.put("value", "0");//弧度值,如0 properties.add(pro2); destinationOrder.put("properties", properties); - } else if (propertiesType.equals("3")) {//JackUnload,Jackload不操作 + } else if ("3".equals(propertiesType)) {//JackUnload,Jackload不操作 JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "recognize");//固定值 pro1.put("value", "false");//固定值 properties.add(pro1); destinationOrder.put("properties", properties); - } else if (propertiesType.equals("4")) { + } else if ("4".equals(propertiesType)) { JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "robot_spin_angle");//坐标系类型,robot_spin_angle为机器人坐标系 @@ -413,7 +413,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { pro2.put("value", "0");//弧度值,如0 properties.add(pro2); destinationOrder.put("properties", properties); - } else if (propertiesType.equals("5")) {//在该点进行等待 + } else if ("5".equals(propertiesType)) {//在该点进行等待 JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "Wait"); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/enums/ErrorType.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/enums/ErrorType.java new file mode 100644 index 0000000..3366558 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/enums/ErrorType.java @@ -0,0 +1,23 @@ +package org.nl.acs.device.enums; + +public enum ErrorType { + AGV_ERROR("agv_error_type","AGV错误类型"), + CONVEYOR_ERROR("conveyor_error_type","输送机错误类型"), + STACKER_ERROR("stacker_error_type","堆垛机错误类型"), + STATION_ERROR("station_error_type","货台错误类型"), + RGV_ERROR("rgv_error_type","有轨制导搬运车辆错误类型"), + AGV_SYSTEM_ERROR("agv_system_error_type","AGV系统错误类型"); + + private String errorType; + + private String errorTypeName; + + ErrorType(String errorType, String errorTypeName) { + this.errorType = errorType; + this.errorTypeName = errorTypeName; + } + + public String getErrorType() { + return errorType; + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceExtraServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceExtraServiceImpl.java index 0b28256..94c6ec6 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceExtraServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceExtraServiceImpl.java @@ -230,7 +230,7 @@ public class DeviceExtraServiceImpl extends CommonServiceImpl" + error); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java index 563d9dd..4c7feb8 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java @@ -128,7 +128,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc Iterator> it = itemValues.entrySet().iterator(); - ItemValue p2[]; + ItemValue[] p2; p2 = new ItemValue[itemValues.size()]; int i = 0; while (it.hasNext()) { @@ -147,7 +147,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc Iterator> it = itemValues.entrySet().iterator(); - ItemValue p2[]; + ItemValue[] p2; p2 = new ItemValue[itemValues.size()]; int i = 0; while (it.hasNext()) { diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java index 260060b..d8e0d3e 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java @@ -1,6 +1,8 @@ package org.nl.acs.device_driver.stacker.standard_stacker; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; @@ -9,6 +11,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.domain.Device; import org.nl.acs.device.enums.DeviceType; +import org.nl.acs.device.enums.ErrorType; import org.nl.acs.device.service.DeviceExtraService; import org.nl.acs.device.service.impl.DeviceExtraServiceImpl; import org.nl.acs.device_driver.DeviceDriver; @@ -17,6 +20,10 @@ import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.history.ErrorUtil; +import org.nl.acs.history.domain.AcsDeviceErrorLog; +import org.nl.acs.history.service.DeviceErrorLogService; +import org.nl.acs.history.service.dto.DeviceErrorLogDto; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -54,6 +61,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class); @Autowired DeviceExtraService deviceExtraService = SpringContextHolder.getBean(DeviceExtraServiceImpl.class); + @Autowired + DeviceErrorLogService errorLogServer = SpringContextHolder.getBean("acsDeviceErrorLogServiceImpl"); //心跳 Integer heartbeat = 0; @@ -242,6 +251,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } if (!error.equals(last_error)) { if (0 != error) { + DeviceErrorLogDto acsDeviceErrorLog = new DeviceErrorLogDto(); + acsDeviceErrorLog.setDevice_code(this.device_code); + acsDeviceErrorLog.setError_code(String.valueOf(error)); + String errorInfo = ErrorUtil.getDictDetail(ErrorType.STACKER_ERROR.getErrorType(), String.valueOf(error)); + acsDeviceErrorLog.setError_info(errorInfo); + errorLogServer.create(acsDeviceErrorLog); } logServer.deviceItemValue(this.device_code, "mode", String.valueOf(error)); logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error); @@ -620,13 +635,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme map.put("to_task", inst.getInstruction_code()); if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) { - if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z")) ) { + if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z"))) { map.put("to_x", startDevice.getExtraValue().get("z")); } - if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("x")) ) { + if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("x"))) { map.put("to_z", startDevice.getExtraValue().get("x")); } - if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("y")) ) { + if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("y"))) { map.put("to_y", startDevice.getExtraValue().get("y")); } } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 954f283..5809336 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -783,35 +783,35 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) put_device_json.get("storage_code"); } if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) { - String str[] = start_point_code.split("-"); + String[] str = start_point_code.split("-"); start_device_code = str[0]; } else { start_device_code = start_point_code; } if (StrUtil.isNotEmpty(next_point_code) && next_point_code.indexOf("-") > 0) { - String str[] = next_point_code.split("-"); + String[] str = next_point_code.split("-"); next_device_code = str[0]; } else { next_device_code = next_point_code; } if (StrUtil.isNotEmpty(start_point_code2) && start_point_code2.indexOf("-") > 0) { - String str[] = start_point_code2.split("-"); + String[] str = start_point_code2.split("-"); start_device_code2 = str[0]; } else { start_device_code2 = start_point_code2; } if (StrUtil.isNotEmpty(next_point_code2) && next_point_code2.indexOf("-") > 0) { - String str[] = next_point_code2.split("-"); + String[] str = next_point_code2.split("-"); next_device_code2 = str[0]; } else { next_device_code2 = next_point_code2; } if (StrUtil.isNotEmpty(put_point_code) && put_point_code.indexOf("-") > 0) { - String str[] = put_point_code.split("-"); + String[] str = put_point_code.split("-"); put_device_code = str[0]; } else { put_device_code = put_point_code; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java new file mode 100644 index 0000000..0590d17 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java @@ -0,0 +1,142 @@ +package org.nl.acs.history; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import org.nl.config.SpringContextHolder; +import org.nl.system.service.dict.ISysDictService; +import org.nl.system.service.dict.dao.Dict; +import org.nl.system.service.dict.dto.DictDetailDto; +import org.nl.system.service.dict.impl.SysDictServiceImpl; + +import java.util.Comparator; +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> dictMap = new ConcurrentHashMap<>(); + + + public static String getDictDetail(String type, String error_code) { + getDict(); + List dictDetailDtos = dictMap.get(type); + String detail = null; + if (ObjectUtil.isNotEmpty(dictDetailDtos)) { + for (int i = 0; i < dictDetailDtos.size(); i++) { + Dict 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 getDictDetailByName(String type) { + getDict(); + List dictDetailDtos = dictMap.get(type); + Map map = new HashMap<>(); + if (ObjectUtil.isNotEmpty(dictDetailDtos)) { + List 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)) { + ISysDictService dictDetailService = SpringContextHolder.getBean(SysDictServiceImpl.class); + //DictService dictService = SpringContextHolder.getBean(DictServiceImpl.class); + List dictDtos = dictDetailService.queryAll(); + for (int i = 0; i < dictDtos.size(); i++) { + Dict dictDto = dictDtos.get(i); + dictMap.put(dictDto.getName(), getDict(dictDto.getName(), dictDetailService::getDictByName)); + } + } + } + + public static List getDict(String name, Function> f) { + return f.apply(name); + } + + public static Map getAgvErrorMsg(Integer agvErrorNum) { + String code; + String message; + + if (agvErrorNum == 0) { + code = "0"; + message = "正常"; + } else if (agvErrorNum < 0) { + code = "-1"; + message = "AGV上报报警代码有误"; + } else { + Map agvMap = getDictDetailByName("agv_error_type"); + if (agvMap.isEmpty()) { + code = "-1"; + message = "字典表未配置 [agv_error_type]"; + } else { + List> errors = agvMap.entrySet().stream().filter(e -> e.getKey() > 0).sorted(Comparator.comparingInt(Map.Entry::getKey)).collect(Collectors.toList()); + + if (errors.isEmpty()) { + code = "-1"; + message = "字典表 [agv_error_type] 配置有误"; + } else if (agvErrorNum >= (int) Math.pow(2, errors.get(errors.size() - 1).getKey())) { + code = "-1"; + message = "AGV上报报警代码有误"; + } else { + int index = 0; + StringBuilder errorCode = new StringBuilder(); + StringBuilder errorMessage = new StringBuilder(); + for (int i = agvErrorNum; i != 0; i = i >> 1) { + if (index == errors.size()) { + errorCode.setLength(0); + errorCode.append("-1"); + errorMessage.setLength(0); + errorMessage.append("字典表 [agv_error_type] 配置有误"); + break; + } + if (i % 2 == 1) { + errorCode.append(errors.get(index).getKey()).append(","); + errorMessage.append(errors.get(index).getValue()).append(","); + } + index++; + } + code = errorCode.toString(); + message = errorMessage.toString(); + } + } + } + + Map map = new HashMap<>(); + map.put("code", replace(code)); + map.put("info", replace(message)); + return map; + } + + public static String replace(String message) { + if (StrUtil.isEmpty(message)) { + return null; + } + if (message.endsWith(",") || message.endsWith(",")) { + return message.substring(0, message.length() - 1); + } + return message; + } + +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/domain/AcsDeviceErrorLog.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/domain/AcsDeviceErrorLog.java new file mode 100644 index 0000000..6d571f9 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/domain/AcsDeviceErrorLog.java @@ -0,0 +1,39 @@ +package org.nl.acs.history.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@Builder +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +@TableName("acs_device_error_log") +public class AcsDeviceErrorLog implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "设备报警记录标识") + @TableId(type = IdType.ASSIGN_ID) + private String error_log_uuid; + + @ApiModelProperty(value = "设备编码") + private String device_code; + + @ApiModelProperty(value = "错误码") + private String error_code; + + @ApiModelProperty(value = "错误信息") + private String error_info; + + @ApiModelProperty(value = "错误时间") + private String error_time; + + +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/rest/DeviceErrorLogController.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/rest/DeviceErrorLogController.java new file mode 100644 index 0000000..0b24d88 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/rest/DeviceErrorLogController.java @@ -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.common.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 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 create(@Validated @RequestBody DeviceErrorLogDto dto){ + acsDeviceErrorLogService.create(dto); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改设备报警记录") + @ApiOperation("修改设备报警记录") + //@PreAuthorize("@el.check('acsDeviceErrorLog:edit')") + public ResponseEntity update(@Validated @RequestBody DeviceErrorLogDto dto){ + acsDeviceErrorLogService.update(dto); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除设备报警记录") + @ApiOperation("删除设备报警记录") + //@PreAuthorize("@el.check('acsDeviceErrorLog:del')") + @DeleteMapping + public ResponseEntity 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); + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/DeviceErrorLogService.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/DeviceErrorLogService.java new file mode 100644 index 0000000..9415241 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/DeviceErrorLogService.java @@ -0,0 +1,76 @@ + +package org.nl.acs.history.service; + +import org.nl.acs.common.base.CommonService; +import org.nl.acs.history.domain.AcsDeviceErrorLog; +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 extends CommonService { + + /** + * 查询数据分页 + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map queryAll(Map whereJson, Pageable page); + + /** + * 查询所有数据不分页 + * @param whereJson 条件参数 + * @return List + */ + List 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 dtos, HttpServletResponse response) throws IOException; +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/dto/DeviceErrorLogDto.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/dto/DeviceErrorLogDto.java new file mode 100644 index 0000000..ff53838 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/dto/DeviceErrorLogDto.java @@ -0,0 +1,31 @@ +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 static final long serialVersionUID = 1L; + + /** 报警日志标识 */ + private String error_log_uuid; + + /** 设备编码 */ + private String device_code; + + /** 报警编码 */ + private String error_code; + + /** 报警信息 */ + private String error_info; + + /** 报警时间 */ + private String error_time; +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/impl/DeviceErrorLogServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/impl/DeviceErrorLogServiceImpl.java new file mode 100644 index 0000000..d297a0b --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/impl/DeviceErrorLogServiceImpl.java @@ -0,0 +1,153 @@ + +package org.nl.acs.history.service.impl; + + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; +import org.nl.acs.common.base.impl.CommonServiceImpl; +import org.nl.acs.history.domain.AcsDeviceErrorLog; +import org.nl.acs.history.service.DeviceErrorLogService; +import org.nl.acs.history.service.dto.DeviceErrorLogDto; +import org.nl.acs.history.service.mapper.AcsDeviceErrorLogMapper; +import org.nl.acs.utils.PageUtil; +import org.nl.common.exception.BadRequestException; +import org.nl.common.utils.FileUtil; +import org.nl.common.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +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.*; + +/** + * @author gengby + * @description 服务实现 + * @date 2023-03-15 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class DeviceErrorLogServiceImpl extends CommonServiceImpl implements DeviceErrorLogService { + + @Autowired + private AcsDeviceErrorLogMapper acsDeviceErrorLogMapper; + + @Override + public Map queryAll(Map whereJson, Pageable page1) { + LambdaQueryWrapper wrapper = getAcsDeviceErrorLogLambdaQueryWrapper(whereJson); + IPage objectIPage = PageUtil.toMybatisPage(page1); + IPage acsDeviceErrorLogIPage = acsDeviceErrorLogMapper.selectPage(objectIPage, wrapper); + List records = acsDeviceErrorLogIPage.getRecords(); + long total = acsDeviceErrorLogIPage.getTotal(); + HashMap json = new HashMap<>(); + json.put("content", records); + json.put("totalElements", total); + return json; + } + + @NotNull + private LambdaQueryWrapper getAcsDeviceErrorLogLambdaQueryWrapper(Map whereJson) { + String device_code = MapUtil.getStr(whereJson, "device_code"); + String error_code = MapUtil.getStr(whereJson, "error_code"); + String error_info = MapUtil.getStr(whereJson, "error_info"); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (StrUtil.isNotEmpty(device_code)) { + wrapper.like(AcsDeviceErrorLog::getDevice_code, device_code); + } + if (StrUtil.isNotEmpty(error_code)) { + wrapper.like(AcsDeviceErrorLog::getError_code, error_code); + } + if (StrUtil.isNotEmpty(error_info)) { + wrapper.like(AcsDeviceErrorLog::getError_info, error_info); + } + return wrapper; + } + + @Override + public List queryAll(Map whereJson) { + LambdaQueryWrapper wrapper = getAcsDeviceErrorLogLambdaQueryWrapper(whereJson); + List list = list(wrapper); + return BeanUtil.copyToList(list, DeviceErrorLogDto.class); + } + + @Override + public DeviceErrorLogDto findById(String error_log_uuid) { + AcsDeviceErrorLog one = getOne(Wrappers.lambdaQuery(AcsDeviceErrorLog.class).eq(AcsDeviceErrorLog::getError_log_uuid, 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 BeanUtil.copyProperties(one, DeviceErrorLogDto.class); + } + + @Override + public DeviceErrorLogDto findByCode(String code) { + AcsDeviceErrorLog one = getOne(Wrappers.lambdaQuery(AcsDeviceErrorLog.class).eq(AcsDeviceErrorLog::getDevice_code, 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 BeanUtil.copyProperties(one, DeviceErrorLogDto.class); + } + + @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); + acsDeviceErrorLogMapper.insert(BeanUtil.copyProperties(dto, AcsDeviceErrorLog.class)); + } + + @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(); + updateById(BeanUtil.copyProperties(dto, AcsDeviceErrorLog.class)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(String[] ids) { + if (ids == null || ids.length == 0) {throw new BadRequestException("被删除或无权限,操作失败!");} + for (String id : ids) { + this.removeById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (DeviceErrorLogDto acsDeviceErrorLog : all) { + Map 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); + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/mapper/AcsDeviceErrorLogMapper.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/mapper/AcsDeviceErrorLogMapper.java new file mode 100644 index 0000000..007ec6e --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/service/mapper/AcsDeviceErrorLogMapper.java @@ -0,0 +1,9 @@ +package org.nl.acs.history.service.mapper; + +import org.nl.acs.common.base.CommonMapper; +import org.nl.acs.history.domain.AcsDeviceErrorLog; +import org.springframework.stereotype.Repository; + +@Repository +public interface AcsDeviceErrorLogMapper extends CommonMapper { +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/route/service/impl/RouteLineServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/route/service/impl/RouteLineServiceImpl.java index 579a5aa..383d87c 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/route/service/impl/RouteLineServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/route/service/impl/RouteLineServiceImpl.java @@ -71,7 +71,7 @@ public class RouteLineServiceImpl extends CommonServiceImpl routeLines = new HashMap(); Map deviceCoordinate = null;//用来确定设备在 路由二维数组中的坐标 - Map routeChart[][] = null;//路由二维数组 + Map[][] routeChart = null;//路由二维数组 List routePlansList = new ArrayList<>(); // private final RedisUtils redisUtils; private final RouteLineMapper routeLineMapper; @@ -431,7 +431,7 @@ public class RouteLineServiceImpl extends CommonServiceImpl { /** * 条件查询任务和指令 * @param whereJson - * @param page * @return */ List getTaskAndInst(Map whereJson); /** * 导出任务树形记录 - * @param taskAndInst * @param response */ void downloadTaskTreeLogging(List list, HttpServletResponse response) throws IOException; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 3680619..3c51cdb 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.XianGongAgvService; import org.nl.acs.auto.initial.ApplicationAutoInitial; @@ -1681,33 +1682,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme @Override public List getTaskAndInst(Map whereJson) { - String task_code = (String) whereJson.get("task_code"); - String vehicle_code = (String) whereJson.get("vehicle_code"); - String material_type = (String) whereJson.get("material_type"); - String status = (String) whereJson.get("status"); - String point_code = (String) whereJson.get("point_code"); - String create_time = (String) whereJson.get("createTime"); - String end_time = (String) whereJson.get("end_time"); - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (!StrUtil.isEmpty(task_code)) { - wrapper.eq(Task::getTask_code, task_code); - } - if (!StrUtil.isEmpty(vehicle_code)) { - wrapper.like(Task::getVehicle_code, vehicle_code); - } - if (!StrUtil.isEmpty(material_type)) { - wrapper.eq(Task::getMaterial, material_type); - } - if (!StrUtil.isEmpty(status)) { - wrapper.eq(Task::getTask_status, status); - } - if (!StrUtil.isEmpty(point_code)) { - wrapper.and(task -> task.like(Task::getStart_point_code, point_code).or().like(Task::getNext_point_code, point_code)); - } - if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) { - wrapper.between(Task::getCreate_time, create_time, end_time); - } + LambdaQueryWrapper wrapper = getTaskLambdaQueryWrapper(whereJson); List taskList = taskMapper.selectList(wrapper); List array = new ArrayList<>(); if (CollUtil.isNotEmpty(taskList) && taskList.size() > 0) { @@ -1752,6 +1727,38 @@ public class TaskServiceImpl extends CommonServiceImpl impleme return array; } + @NotNull + private LambdaQueryWrapper getTaskLambdaQueryWrapper(Map whereJson) { + String task_code = (String) whereJson.get("task_code"); + String vehicle_code = (String) whereJson.get("vehicle_code"); + String material_type = (String) whereJson.get("material_type"); + String status = (String) whereJson.get("status"); + String point_code = (String) whereJson.get("point_code"); + String create_time = (String) whereJson.get("createTime"); + String end_time = (String) whereJson.get("end_time"); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (!StrUtil.isEmpty(task_code)) { + wrapper.eq(Task::getTask_code, task_code); + } + if (!StrUtil.isEmpty(vehicle_code)) { + wrapper.like(Task::getVehicle_code, vehicle_code); + } + if (!StrUtil.isEmpty(material_type)) { + wrapper.eq(Task::getMaterial, material_type); + } + if (!StrUtil.isEmpty(status)) { + wrapper.eq(Task::getTask_status, status); + } + if (!StrUtil.isEmpty(point_code)) { + wrapper.and(task -> task.like(Task::getStart_point_code, point_code).or().like(Task::getNext_point_code, point_code)); + } + if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) { + wrapper.between(Task::getCreate_time, create_time, end_time); + } + return wrapper; + } + @Override public void downloadTaskTreeLogging(List taskAndInst, HttpServletResponse response) throws IOException { List> list = new ArrayList<>(); @@ -1799,33 +1806,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme @Override public List getTaskList(Map whereJson) { - String task_code = (String) whereJson.get("task_code"); - String vehicle_code = (String) whereJson.get("vehicle_code"); - String material_type = (String) whereJson.get("material_type"); - String status = (String) whereJson.get("status"); - String point_code = (String) whereJson.get("point_code"); - String create_time = (String) whereJson.get("createTime"); - String end_time = (String) whereJson.get("end_time"); - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (!StrUtil.isEmpty(task_code)) { - wrapper.eq(Task::getTask_code, task_code); - } - if (!StrUtil.isEmpty(vehicle_code)) { - wrapper.like(Task::getVehicle_code, vehicle_code); - } - if (!StrUtil.isEmpty(material_type)) { - wrapper.eq(Task::getMaterial, material_type); - } - if (!StrUtil.isEmpty(status)) { - wrapper.eq(Task::getTask_status, status); - } - if (!StrUtil.isEmpty(point_code)) { - wrapper.and(task -> task.like(Task::getStart_point_code, point_code).or().like(Task::getNext_point_code, point_code)); - } - if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) { - wrapper.between(Task::getCreate_time, create_time, end_time); - } + LambdaQueryWrapper wrapper = getTaskLambdaQueryWrapper(whereJson); List taskList = taskMapper.selectList(wrapper); List array = new ArrayList<>(); if (CollUtil.isNotEmpty(taskList) && taskList.size() > 0) { diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/DateUtil.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/DateUtil.java index 7eda5fe..f299950 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/DateUtil.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/DateUtil.java @@ -222,7 +222,7 @@ public class DateUtil { String hour = "00"; String minute = "00"; String second = "00"; - if (value != null && !value.trim().equals("")) { + if (value != null && !"".equals(value.trim())) { int v_int = Integer.valueOf(value); hour = v_int / 3600 + "";//获得小时; minute = v_int % 3600 / 60 + "";//获得小时; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/common/domain/query/BaseQuery.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/common/domain/query/BaseQuery.java index 71ccd84..143bcd0 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/common/domain/query/BaseQuery.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/common/domain/query/BaseQuery.java @@ -54,7 +54,7 @@ public class BaseQuery { Type[] types = ((ParameterizedTypeImpl) this.getClass().getGenericSuperclass()).getActualTypeArguments(); Map columnMap = LambdaUtils.getColumnMap((Class) types[0]); json.forEach((key, vel) -> { - if (vel != null && !key.equals("doP")){ + if (vel != null && !"doP".equals(key)){ QParam qParam = doP.get(key); if (qParam != null){ QueryTEnum.build(qParam.type,wrapper,qParam.k,vel); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/FileUtil.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/FileUtil.java index ec10aa5..7942bf7 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/FileUtil.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/FileUtil.java @@ -210,10 +210,10 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { File file = new File(tempPath); BigExcelWriter writer = ExcelUtil.getBigWriter(file); // 一次性写出内容,使用默认样式,强制输出标题 - for (Object item : list) { - writer.writeRow(item, true); - } - SXSSFSheet sheet = (SXSSFSheet)writer.getSheet(); + + writer.write(list, true); + + SXSSFSheet sheet = (SXSSFSheet) writer.getSheet(); //上面需要强转SXSSFSheet 不然没有trackAllColumnsForAutoSizing方法 sheet.trackAllColumnsForAutoSizing(); //列宽自适应 diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/dto/DictDetailDto.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/dto/DictDetailDto.java new file mode 100644 index 0000000..5019335 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/dto/DictDetailDto.java @@ -0,0 +1,41 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.nl.system.service.dict.dto; + +import lombok.Getter; +import lombok.Setter; +import org.nl.common.base.BaseDTO; + +import java.io.Serializable; + +/** +* @author Zheng Jie +* @date 2019-04-10 +*/ +@Getter +@Setter +public class DictDetailDto extends BaseDTO implements Serializable { + + private Long id; + + private DictSmallDto dict; + + private String label; + + private String value; + + private Integer dictSort; +} \ No newline at end of file diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/dto/DictSmallDto.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/dto/DictSmallDto.java new file mode 100644 index 0000000..5264b08 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/dto/DictSmallDto.java @@ -0,0 +1,32 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.nl.system.service.dict.dto; + +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** +* @author Zheng Jie +* @date 2019-04-10 +*/ +@Getter +@Setter +public class DictSmallDto implements Serializable { + + private Long id; +} diff --git a/acs/nladmin-ui/src/views/acs/history/deviceErrorInfo/index.vue b/acs/nladmin-ui/src/views/acs/history/deviceErrorInfo/index.vue new file mode 100644 index 0000000..e91906a --- /dev/null +++ b/acs/nladmin-ui/src/views/acs/history/deviceErrorInfo/index.vue @@ -0,0 +1,249 @@ + + + + +