win代码上传

detached
zouyiqing 2024-01-29 15:11:49 +08:00
parent 2eb74912e9
commit 36209c007d
5 changed files with 82 additions and 77 deletions

View File

@ -86,6 +86,10 @@
sortable: true
},
{
field: 'radarLocation',
title: '工位',
},
{
field: 'ladleNumber',
title: '包号/架号'
},

View File

@ -24,7 +24,6 @@ public class SocketUtil {
System.out.println("雷达:" + radarIp + "===" + radarLocation + ": 连接异常:{}" + connected);
dataResponse.setStatus(0);
dataResponse.setData(null);
return dataResponse;
}
InputStream inputStream = socket.getInputStream(); // 获取输入流
@ -32,6 +31,8 @@ public class SocketUtil {
byte[] buffer = new byte[available];
inputStream.read(buffer, 0, available);
String hex = new BigInteger(1, buffer).toString(16);
dataResponse.setStatus(1);
RadarStatusWebSocket.sendToAll(JSON.toJSONString(dataResponse));
if (!"0".equals(hex)) {
hex = "0" + hex;
List<Integer> decimal = new ArrayList<>();
@ -41,11 +42,10 @@ public class SocketUtil {
decimal.add(s);
}
dataResponse.setData(decimal);
dataResponse.setStatus(1);
return dataResponse;
}
dataResponse.setStatus(1);
RadarStatusWebSocket.sendToAll(JSON.toJSONString(dataResponse));
} catch (Exception e) {
System.out.println("读取数据异常:" + radarIp);
}

View File

@ -16,8 +16,7 @@ import org.springframework.stereotype.Service;
import java.net.Socket;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.*;
import java.util.stream.Collectors;
@Service
@ -59,8 +58,11 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
CompletableFuture.runAsync(() -> {
while (StringUtils.equals("0",radarDelMap.get(radar.getId()))) {
long start = System.currentTimeMillis();
task(radar, socket);
System.out.println("雷达ip =====" + radar.getRadarIp());
System.out.println("耗时时间: " + (System.currentTimeMillis() - start));
// System.out.println("雷达ip =====" + radar.getRadarIp());
}
});
} catch (Exception e) {
@ -71,14 +73,13 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
}
private void task(SysRadar radar, Socket socket) {
try {
// long start = System.currentTimeMillis();
Map<String, List<Integer>> pulse4Number = new HashMap<>();
int count = 0;
int consecutiveZeros = 0;
long start = System.currentTimeMillis();
// long start = System.currentTimeMillis();
List<SysDiscern> discernList = new ArrayList<>();
// socket连接成功返回数据
@ -105,6 +106,7 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
}
} else {
count++;
System.out.println("天线:=== " + number + "雷达============" + radar.getRadarIp() + " 峰值为: " + data.getData().get(7) + "次数: ===" + count);
pulse4Values.add(data.getData().get(7));
}
}
@ -115,8 +117,6 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
// 雷达数据返回封装类赋值
ModbusResponse modbusResponse = getModbusResponse(data);
String tag = modbusResponse.getTagId();
// 雷达原始数据对象
PrimaryRadarData primaryRadarData = new PrimaryRadarData();
@ -151,11 +151,12 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
primaryRadarData.setRadarIp(radar.getRadarIp());
}
if (modbusResponse.getValue4() != null && modbusResponse.getValue4() != 0) {
CompletableFuture.runAsync(() -> {
primaryRadarDataService.insertPrimaryRadarData(primaryRadarData);
} else {
});
}
System.out.println("耗时时间: " + (System.currentTimeMillis() - start) );
// System.out.println("耗时时间: " + (System.currentTimeMillis() - start));
} catch (Exception e) {
}
}

View File

@ -48,11 +48,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into sys_primary_radar_data(
<if test="id != null and id != 0">id,</if>
<if test="tagId != null and tagId != ''">tag_id,</if>
<if test="value1 != null and value1 != ''">value1,</if>
<if test="value2 != null and value2 != ''">value2,</if>
<if test="value3 != null and value3 != ''">value3,</if>
<if test="value4 != null and value4 != ''">value4,</if>
<if test="value5 != null and value5 != ''">value5,</if>
value1,
value2,
value3,
value4,
value5,
<if test="baseLine != null and baseLine != ''">base_line,</if>
<if test="queryFre != null ">query_fre,</if>
<if test="number != null and number != ''">number,</if>
@ -66,11 +66,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)values(
<if test="id != null and id != 0">#{id},</if>
<if test="tagId != null and tagId != ''">#{tagId},</if>
<if test="value1 != null and value1 != ''">#{value1},</if>
<if test="value2 != null and value2 != ''">#{value2},</if>
<if test="value3 != null and value3 != ''">#{value3},</if>
<if test="value4 != null and value4 != ''">#{value4},</if>
<if test="value5 != null and value5 != ''">#{value5},</if>
#{value1},
#{value2},
#{value3},
#{value4},
#{value5},
<if test="baseLine != null and baseLine != ''">#{baseLine},</if>
<if test="queryFre != null">#{queryFre},</if>
<if test="number != null and number != ''">#{number},</if>

View File

@ -117,9 +117,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteRadarByIds">
delete from sys_radar where id in (#{ids})
</delete>
<update id="deleteRadarByIds">
update sys_radar set del_flag = 1 where id in (#{ids})
</update>