Commit e74c8b79 authored by lizhichao's avatar lizhichao

去空格

parent 586be965
......@@ -56,6 +56,7 @@ public class UDPServerHandler extends SimpleChannelInboundHandler<DatagramPacket
throw new Exception("接收数据异常,请联系管理员查看设备上传数据!");
}
logger.info("udp接收上传数据:" + bufStr);
bufStr=bufStr.trim();
//上传数据入库并处理报警信息
List<TDeviceReportData> dataList = saveReportDataAndDealAlarmInfo(bufStr);
//报警信息处理
......@@ -72,6 +73,7 @@ public class UDPServerHandler extends SimpleChannelInboundHandler<DatagramPacket
* @param bufStr 上报数据
*/
private List<TDeviceReportData> saveReportDataAndDealAlarmInfo(String bufStr) {
List<TDeviceReportData> datas = new ArrayList<>();
//单组数据上报
if(!bufStr.contains("@")){
......@@ -168,10 +170,11 @@ public class UDPServerHandler extends SimpleChannelInboundHandler<DatagramPacket
private TDeviceReportData assembleSaveInfo(String reportData){
String[] data = reportData.split("/");
TDeviceReportData tDeviceReportData = new TDeviceReportData();
tDeviceReportData.setDeviceNum(data[0]);
tDeviceReportData.setDeviceStatus(data[1]);
tDeviceReportData.setDeviceStatusDescribe(deviceStatus(data[1]));
tDeviceReportData.setDevicePotency(data[2]);
tDeviceReportData.setDeviceNum(data[0].trim());
tDeviceReportData.setDeviceStatus(data[1].trim());
tDeviceReportData.setDeviceStatusDescribe(deviceStatus(data[1].trim()));
tDeviceReportData.setDevicePotency(data[2].trim().indexOf(".")==0?"0"+data[2].trim():data[2].trim());
return tDeviceReportData;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment