|
|
@@ -464,56 +464,57 @@ public class EquipmentServiceImpl implements IEquipmentService {
|
|
|
Equipment e = equipmentMapper.selectOne(new QueryWrapper<Equipment>().eq("code", equipmentFormVO.getCode()));
|
|
|
Equipment equipment = new Equipment();
|
|
|
BeanUtils.copyProperties(equipmentFormVO, equipment);
|
|
|
- if (StringUtils.isNull(e))
|
|
|
- {
|
|
|
- // TODO 获取设备类型字符串查询设备类型库 填充相应的设备类型 id
|
|
|
- // TODO 模糊查询设备流程和页面 填充相应的流程和页面 id 没有命中需返回消息提示无页面
|
|
|
- // 识别设备的PLC
|
|
|
- if (equipmentFormVO.getIpAddress() != null && equipmentFormVO.getPort() != null) {
|
|
|
- Long plcInfoId = plcMap.get(equipmentFormVO.getIpAddress() + ":" + equipmentFormVO.getPort());
|
|
|
- if (plcInfoId != null) {
|
|
|
- equipment.setPlcId(plcInfoId);
|
|
|
- }
|
|
|
+ // TODO 获取设备类型字符串查询设备类型库 填充相应的设备类型 id
|
|
|
+ // TODO 模糊查询设备流程和页面 填充相应的流程和页面 id 没有命中需返回消息提示无页面
|
|
|
+ // 识别设备的PLC
|
|
|
+ if (equipmentFormVO.getIpAddress() != null && equipmentFormVO.getPort() != null) {
|
|
|
+ Long plcInfoId = plcMap.get(equipmentFormVO.getIpAddress() + ":" + equipmentFormVO.getPort());
|
|
|
+ if (plcInfoId != null) {
|
|
|
+ equipment.setPlcId(plcInfoId);
|
|
|
}
|
|
|
- // 识别设备的通信协议
|
|
|
- if (equipmentFormVO.getProtocolCode() != null) {
|
|
|
- Integer protocolId = protocolMap.get(equipmentFormVO.getProtocolCode());
|
|
|
- if (protocolId != null) {
|
|
|
- equipment.setProtocolId(protocolId);
|
|
|
- } else {
|
|
|
- failureMsg.append("<br/>" + failureNum + "、设备 " + equipmentFormVO.getCode() + " 协议Code" + equipmentFormVO.getProtocolCode() + "不存在,请检查!");
|
|
|
- }
|
|
|
+ }
|
|
|
+ // 识别设备的通信协议
|
|
|
+ if (equipmentFormVO.getProtocolCode() != null) {
|
|
|
+ Integer protocolId = protocolMap.get(equipmentFormVO.getProtocolCode());
|
|
|
+ if (protocolId != null) {
|
|
|
+ equipment.setProtocolId(protocolId);
|
|
|
+ } else {
|
|
|
+ failureMsg.append("<br/>" + failureNum + "、设备 " + equipmentFormVO.getCode() + " 协议Code" + equipmentFormVO.getProtocolCode() + "不存在,请检查!");
|
|
|
}
|
|
|
- // 识别设备流程(将 flowCodes 转为 flowIds)
|
|
|
- if (equipmentFormVO.getFlowCodes() != null && !equipmentFormVO.getFlowCodes().trim().isEmpty()) {
|
|
|
- String flowIds = Arrays.stream(equipmentFormVO.getFlowCodes().split(","))
|
|
|
- .map(String::trim)
|
|
|
- .filter(s -> !s.isEmpty())
|
|
|
- .map(flowMap::get)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .map(String::valueOf)
|
|
|
- .collect(Collectors.joining(","));
|
|
|
- if (flowIds.isEmpty()) {
|
|
|
- failureMsg.append("<br/>" + failureNum + "、设备 " + equipmentFormVO.getCode() + " 未识别到任何流程编码,请检查!");
|
|
|
- } else {
|
|
|
- equipment.setFlowIds(flowIds);
|
|
|
- }
|
|
|
+ }
|
|
|
+ // 识别设备流程(将 flowCodes 转为 flowIds)
|
|
|
+ if (equipmentFormVO.getFlowCodes() != null && !equipmentFormVO.getFlowCodes().trim().isEmpty()) {
|
|
|
+ String flowIds = Arrays.stream(equipmentFormVO.getFlowCodes().split(","))
|
|
|
+ .map(String::trim)
|
|
|
+ .filter(s -> !s.isEmpty())
|
|
|
+ .map(flowMap::get)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .map(String::valueOf)
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
+ if (flowIds.isEmpty()) {
|
|
|
+ failureMsg.append("<br/>" + failureNum + "、设备 " + equipmentFormVO.getCode() + " 未识别到任何流程编码,请检查!");
|
|
|
+ } else {
|
|
|
+ equipment.setFlowIds(flowIds);
|
|
|
}
|
|
|
- // 识别设备页面(将 pageCodes 转为 pageIds)
|
|
|
- if (equipmentFormVO.getPageCodes() != null && !equipmentFormVO.getPageCodes().trim().isEmpty()) {
|
|
|
- String pageIds = Arrays.stream(equipmentFormVO.getPageCodes().split(","))
|
|
|
- .map(String::trim)
|
|
|
- .filter(s -> !s.isEmpty())
|
|
|
- .map(pageMap::get)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .map(String::valueOf)
|
|
|
- .collect(Collectors.joining(","));
|
|
|
- if (pageIds.isEmpty()) {
|
|
|
- failureMsg.append("<br/>" + failureNum + "、设备 " + equipmentFormVO.getCode() + " 未识别到任何页面编码,请检查!");
|
|
|
- } else {
|
|
|
- equipment.setPageIds(pageIds);
|
|
|
- }
|
|
|
+ }
|
|
|
+ // 识别设备页面(将 pageCodes 转为 pageIds)
|
|
|
+ if (equipmentFormVO.getPageCodes() != null && !equipmentFormVO.getPageCodes().trim().isEmpty()) {
|
|
|
+ String pageIds = Arrays.stream(equipmentFormVO.getPageCodes().split(","))
|
|
|
+ .map(String::trim)
|
|
|
+ .filter(s -> !s.isEmpty())
|
|
|
+ .map(pageMap::get)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .map(String::valueOf)
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
+ if (pageIds.isEmpty()) {
|
|
|
+ failureMsg.append("<br/>" + failureNum + "、设备 " + equipmentFormVO.getCode() + " 未识别到任何页面编码,请检查!");
|
|
|
+ } else {
|
|
|
+ equipment.setPageIds(pageIds);
|
|
|
}
|
|
|
+ }
|
|
|
+ if (StringUtils.isNull(e))
|
|
|
+ {
|
|
|
+
|
|
|
equipment.setCreateBy(operName);
|
|
|
// equipment.setStatus("0");
|
|
|
equipmentMapper.insert(equipment);
|
|
|
@@ -522,36 +523,6 @@ public class EquipmentServiceImpl implements IEquipmentService {
|
|
|
}
|
|
|
else if (isUpdateSupport)
|
|
|
{
|
|
|
- // 识别设备流程(将 flowCodes 转为 flowIds)
|
|
|
- if (equipmentFormVO.getFlowCodes() != null && !equipmentFormVO.getFlowCodes().trim().isEmpty()) {
|
|
|
- String flowIds = Arrays.stream(equipmentFormVO.getFlowCodes().split(","))
|
|
|
- .map(String::trim)
|
|
|
- .filter(s -> !s.isEmpty())
|
|
|
- .map(flowMap::get)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .map(String::valueOf)
|
|
|
- .collect(Collectors.joining(","));
|
|
|
- if (flowIds.isEmpty()) {
|
|
|
- failureMsg.append("<br/>" + failureNum + "、设备 " + equipmentFormVO.getCode() + " 未识别到任何流程编码,请检查!");
|
|
|
- } else {
|
|
|
- equipment.setFlowIds(flowIds);
|
|
|
- }
|
|
|
- }
|
|
|
- // 识别设备页面(将 pageCodes 转为 pageIds)
|
|
|
- if (equipmentFormVO.getPageCodes() != null && !equipmentFormVO.getPageCodes().trim().isEmpty()) {
|
|
|
- String pageIds = Arrays.stream(equipmentFormVO.getPageCodes().split(","))
|
|
|
- .map(String::trim)
|
|
|
- .filter(s -> !s.isEmpty())
|
|
|
- .map(pageMap::get)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .map(String::valueOf)
|
|
|
- .collect(Collectors.joining(","));
|
|
|
- if (pageIds.isEmpty()) {
|
|
|
- failureMsg.append("<br/>" + failureNum + "、设备 " + equipmentFormVO.getCode() + " 未识别到任何页面编码,请检查!");
|
|
|
- } else {
|
|
|
- equipment.setPageIds(pageIds);
|
|
|
- }
|
|
|
- }
|
|
|
equipment.setCreateBy(operName);
|
|
|
// equipment.setStatus("0");
|
|
|
equipmentMapper.insert(equipment);
|