|
|
|
@ -16,6 +16,7 @@ import java.nio.file.Files; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.nio.file.Paths; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@Service |
|
|
|
@ -54,23 +55,23 @@ public class SettingService { |
|
|
|
Protocol protocol = request.getProtocol(); |
|
|
|
|
|
|
|
if (protocol == Protocol.OPC_UA){ |
|
|
|
OpcUaField opcUaField = request.getOpcUaField(); |
|
|
|
if(opcUaField != null){ |
|
|
|
finalJsonMap.put("OPC_UA", Arrays.asList(opcUaField)); |
|
|
|
List<OpcUaField> opcUaField = request.getOpcUaField(); |
|
|
|
if(opcUaField != null && !opcUaField.isEmpty()){ |
|
|
|
finalJsonMap.put("OPC_UA", opcUaField); |
|
|
|
} |
|
|
|
} |
|
|
|
else if(protocol == Protocol.MODBUS){ |
|
|
|
ModbusField modbusField = request.getModbusField(); |
|
|
|
if(modbusField != null){ |
|
|
|
finalJsonMap.put("MODBUS", Arrays.asList(modbusField)); |
|
|
|
List<ModbusField> modbusField = request.getModbusField(); |
|
|
|
if(modbusField != null && !modbusField.isEmpty()){ |
|
|
|
finalJsonMap.put("MODBUS", modbusField); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(request.getCanInput() == CanInput.On){ |
|
|
|
CanField canField = request.getCanField(); |
|
|
|
if(canField != null){ |
|
|
|
finalJsonMap.put("CAN", Arrays.asList(canField)); |
|
|
|
List<CanField> canField = request.getCanField(); |
|
|
|
if(canField != null && !canField.isEmpty()){ |
|
|
|
finalJsonMap.put("CAN", canField); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|