判断逻辑更改
parent
074326ce6a
commit
ad8f487866
|
|
@ -6,9 +6,9 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://39.104.15.118:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: Orderfood@2022
|
||||
password: 12345678
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
Application Version: ${ruoyi.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// _ooOoo_ //
|
||||
// o8888888o //
|
||||
// 88" . "88 //
|
||||
// (| ^_^ |) //
|
||||
// O\ = /O //
|
||||
// ____/`---'\____ //
|
||||
// .' \\| |// `. //
|
||||
// / \\||| : |||// \ //
|
||||
// / _||||| -:- |||||- \ //
|
||||
// | | \\\ - /// | | //
|
||||
// | \_| ''\---/'' | | //
|
||||
// \ .-\__ `-` ___/-. / //
|
||||
// ___`. .' /--.--\ `. . ___ //
|
||||
// ."" '< `.___\_<|>_/___.' >'"". //
|
||||
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
|
||||
// \ \ `-. \_ __\ /__ _/ .-` / / //
|
||||
// ========`-.____`-.___\_____/___.-`____.-'======== //
|
||||
// `=---=' //
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
||||
// 佛祖保佑 永不宕机 永无BUG //
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -30,7 +30,6 @@ public class SocketUtil {
|
|||
byte[] buffer = new byte[available];
|
||||
inputStream.read(buffer, 0, available);
|
||||
|
||||
// System.out.println("雷达:" + radarIp + "===" + radarLocation + ": 连接异常:{}" );
|
||||
|
||||
|
||||
String hex = new BigInteger(1, buffer).toString(16);
|
||||
|
|
@ -48,14 +47,11 @@ public class SocketUtil {
|
|||
}
|
||||
dataResponse.setStatus(1);
|
||||
|
||||
System.out.println("雷达ip " + radarIp+ radarId + radarLocation + "成功");
|
||||
|
||||
RadarStatusWebSocket.sendToAll(JSON.toJSONString(dataResponse));
|
||||
return dataResponse;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// System.out.println("读取数据异常:" + radarIp);
|
||||
}
|
||||
|
||||
dataResponse.setRadarIp(radarIp);
|
||||
|
|
|
|||
|
|
@ -8,16 +8,22 @@ import com.ruoyi.common.utils.bean.BeanUtils;
|
|||
import com.ruoyi.common.utils.bean.ModbusResponse;
|
||||
import com.ruoyi.system.service.*;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.sql.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.*;
|
||||
|
|
@ -39,62 +45,82 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
@Autowired
|
||||
private ISysDiscernService discernService;
|
||||
|
||||
@Autowired
|
||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||
|
||||
private static Map<String, SysIdentifier> identifierHashMap = new HashMap<>();
|
||||
public static CopyOnWriteArrayList<String> allRadar = new CopyOnWriteArrayList<>();
|
||||
|
||||
|
||||
private Map<Long, String> radarDelMap = new HashMap<>();
|
||||
private static Map<Long, String> radarDelMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
List<SysRadar> radarList = service.selectRadarList(new SysRadar());
|
||||
// List<SysIdentifier> sysIdentifiers = identifierService.selectAllIdentifierList();
|
||||
// Map<String, SysIdentifier> identifierHashMap = new HashMap<>();
|
||||
// if (CollectionUtils.isNotEmpty(sysIdentifiers)){
|
||||
// identifierHashMap = sysIdentifiers.stream().collect(Collectors.toMap(SysIdentifier::getIdentifierId, Function.identity()));
|
||||
// }
|
||||
CompletableFuture.runAsync(() -> {
|
||||
radarWebSocket(radarList);
|
||||
});
|
||||
List<SysIdentifier> sysIdentifiers = identifierService.selectAllIdentifierList();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(sysIdentifiers)) {
|
||||
|
||||
for (SysIdentifier sysIdentifier : sysIdentifiers) {
|
||||
if (StringUtils.isNotBlank(sysIdentifier.getIdentifierId())) {
|
||||
identifierHashMap.put(sysIdentifier.getIdentifierId(), sysIdentifier);
|
||||
}
|
||||
if (StringUtils.isNotBlank(sysIdentifier.getIdentifierTwo())) {
|
||||
identifierHashMap.put(sysIdentifier.getIdentifierTwo(), sysIdentifier);
|
||||
}
|
||||
if (StringUtils.isNotBlank(sysIdentifier.getIdentifierThree())) {
|
||||
identifierHashMap.put(sysIdentifier.getIdentifierThree(), sysIdentifier);
|
||||
}
|
||||
if (StringUtils.isNotBlank(sysIdentifier.getIdentifierFour())) {
|
||||
identifierHashMap.put(sysIdentifier.getIdentifierFour(), sysIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void radarWebSocket(List<SysRadar> radarList) {
|
||||
// System.out.println(" 雷达集合:::" + radarList);
|
||||
CompletableFuture.runAsync(() -> {
|
||||
radarWebSocket(radarList, identifierHashMap);
|
||||
}, threadPoolTaskExecutor);
|
||||
}
|
||||
|
||||
private void radarWebSocket(List<SysRadar> radarList, Map<String, SysIdentifier> identifierHashMap) {
|
||||
ArrayList<Socket> list = Lists.newArrayList();
|
||||
for (SysRadar radar : radarList) {
|
||||
try {
|
||||
Socket socket = new Socket(radar.getRadarIp(), 23);
|
||||
list.add(socket);
|
||||
allRadar.add(radar.getRadarIp());
|
||||
radarDelMap.put(radar.getId(), "0");
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
task(radar, socket);
|
||||
});
|
||||
CompletableFuture<Void> voidCompletableFuture = CompletableFuture.runAsync(() -> {
|
||||
task(radar, socket, identifierHashMap);
|
||||
}, threadPoolTaskExecutor);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void task(SysRadar radar, Socket socket) {
|
||||
private void task(SysRadar radar, Socket socket, Map<String, SysIdentifier> identifierHashMap) {
|
||||
long noDataStart = System.currentTimeMillis();
|
||||
long noDataEnd = noDataStart;
|
||||
long start = noDataStart;
|
||||
int consecutiveZeros = 0;
|
||||
int readCount = 1;
|
||||
|
||||
Map<String, List<PrimaryRadarData>> map = new HashMap<>();
|
||||
|
||||
Map<String ,Long> timeMap = new HashMap();
|
||||
|
||||
Map<String, Long> timeMap = new HashMap<>();
|
||||
while (StringUtils.equals("0", radarDelMap.get(radar.getId()))) {
|
||||
|
||||
try {
|
||||
|
||||
// socket连接成功返回数据
|
||||
DataResponse data = SocketUtil.getData(socket, radar.getRadarLocation(), radar.getRadarIp(), radar.getRadarId());
|
||||
if (Objects.nonNull(data.getData())){
|
||||
if (readCount == 2) {
|
||||
timeMap.put("noDataStart", System.currentTimeMillis());
|
||||
}
|
||||
if (consecutiveZeros == 0) {
|
||||
timeMap.put("zero", System.currentTimeMillis());
|
||||
}
|
||||
// 没数据返回data.data == null
|
||||
long current = System.currentTimeMillis();
|
||||
if (Objects.isNull(data.getData())) {
|
||||
|
|
@ -103,7 +129,6 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
if (current - noDataStart >= 2000) {
|
||||
// todo:存数据
|
||||
if (CollectionUtils.isNotEmpty(map.get(getMapKey(radar)))) {
|
||||
System.out.println("连续两秒没收到数据:开始存储........" + "开始时间为:" + timeMap.get("noDataStart") + "结束时间为:" + current);
|
||||
if (readCount > 1) {
|
||||
saveData(radar, map, readCount, timeMap.get("noDataStart"), current);
|
||||
timeMap.put("noDataStart", System.currentTimeMillis());
|
||||
|
|
@ -113,31 +138,30 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
map.remove(getMapKey(radar));
|
||||
noDataStart = current;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
SysRadar sysRadar = service.selectRadarByRadarId(radar.getRadarId(), radar.getRadarIp());
|
||||
if (sysRadar != null) { // 雷达数据返回封装类赋值
|
||||
// SysRadar sysRadar = service.selectRadarByRadarId(radar.getRadarId(), radar.getRadarIp());
|
||||
// if (sysRadar != null) { // 雷达数据返回封装类赋值
|
||||
ModbusResponse modbusResponse = getModbusResponse(data);
|
||||
String tag = modbusResponse.getTagId();
|
||||
timeMap.put("start", data.getTime());
|
||||
// 雷达原始数据对象
|
||||
PrimaryRadarData primaryRadarData = new PrimaryRadarData();
|
||||
// 拷贝封装类属性到雷达原始数据对象
|
||||
BeanUtils.copyProperties(modbusResponse, primaryRadarData);
|
||||
primaryRadarData.setRadarIp(radar.getRadarIp());
|
||||
// if (primaryRadarData.getNumber()==(Integer.parseInt(radar.getRadarNum()))) {
|
||||
primaryRadarData.setStationCode(radar.getStationCode());
|
||||
// }else if (Objects.equals(radar.getRadarId(), data.getData().get(0))){
|
||||
// primaryRadarData.setStationCode(radar.getStationCode());
|
||||
// }
|
||||
|
||||
primaryRadarData.setRadarId(data.getData().get(0));
|
||||
primaryRadarData.setRadarLocation(radar.getRadarLocation());
|
||||
List<PrimaryRadarData> dataList = map.get(getMapKey(radar));
|
||||
//判断读取数据中是否携带标签
|
||||
if (!"0".equals(modbusResponse.getTagId())) {
|
||||
consecutiveZeros = 0;
|
||||
// 根据标签去数据库查询标签列表
|
||||
SysIdentifier sysIdentifier = identifierService.selectIdentifierByTag(tag);
|
||||
SysIdentifier sysIdentifier = identifierHashMap.get(tag);
|
||||
//判断数据库查询结果是否有数据
|
||||
|
||||
if (sysIdentifier != null) {
|
||||
// 有数据将查询到的标识器配置属性放进原始数据对象
|
||||
primaryRadarData.setLadleNumber(sysIdentifier.getLadleNumber());
|
||||
|
|
@ -158,34 +182,51 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
// readCount = 1;
|
||||
// }
|
||||
// start = System.currentTimeMillis();
|
||||
//
|
||||
// }
|
||||
// dataList.clear();
|
||||
// dataList.add(primaryRadarData);
|
||||
// }
|
||||
if (modbusResponse.getNumber() == 1) {
|
||||
if (!StringUtils.equals(modbusResponse.getTagId(), dataList.get(dataList.size() - 1).getTagId())
|
||||
&& !StringUtils.equals("0", dataList.get(dataList.size() - 1).getTagId())
|
||||
&& Objects.equals(primaryRadarData.getRadarId(), dataList.get(dataList.size() - 1).getRadarId())
|
||||
&& Objects.equals(primaryRadarData.getRadarIp(), dataList.get(dataList.size() - 1).getRadarIp())) {
|
||||
// todo:存数据
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
Long dataStart = timeMap.get("noDataStart");
|
||||
System.out.println("突然读到另一个标签:开始存储........"
|
||||
+ "此次雷达id====" + primaryRadarData.getRadarId() + "上次雷达id====" + primaryRadarData.getRadarId()
|
||||
+ "此次雷达ip为:====" + primaryRadarData.getRadarIp()+ "上次雷达ip为 =====" + dataList.get(dataList.size() - 1).getRadarIp() + dataStart + "结束时间为:" + currentTimeMillis);
|
||||
saveData(radar, map, readCount, data.getTime()-1, currentTimeMillis);
|
||||
+ "此次雷达ip为:====" + primaryRadarData.getRadarIp() + "上次雷达ip为 =====" + dataList.get(dataList.size() - 1).getRadarIp()
|
||||
+ "此次雷达标签号为:====" + modbusResponse.getTagId() + "此次雷达标签号为:====" + dataList.get(dataList.size() - 1).getTagId()
|
||||
+ data.getTime() + "结束时间为:" + currentTimeMillis);
|
||||
saveData(radar, map, readCount, timeMap.get("noDataStart"), currentTimeMillis);
|
||||
dataList.clear();
|
||||
timeMap.put("noDataStart", System.currentTimeMillis());
|
||||
map.remove(getMapKey(radar));
|
||||
dataList.add(primaryRadarData);
|
||||
readCount = 1;
|
||||
}
|
||||
readCount++;
|
||||
List<Date> readTime = map.get(getMapKey(radar))
|
||||
.stream().map(PrimaryRadarData::getCreateTime).collect(Collectors.toList());
|
||||
if (readTime.get(0) != null) {
|
||||
readTime.set(0, new Date(System.currentTimeMillis()));
|
||||
}
|
||||
if (modbusResponse.getNumber() == 2){
|
||||
if (!StringUtils.equals(modbusResponse.getTagId(), dataList.get(dataList.size() - 1).getTagId())
|
||||
&& !StringUtils.equals("0", dataList.get(dataList.size() - 1).getTagId())
|
||||
&& Objects.equals(primaryRadarData.getRadarId(), dataList.get(dataList.size() - 1).getRadarId())
|
||||
&& Objects.equals(primaryRadarData.getRadarIp(), dataList.get(dataList.size() - 1).getRadarIp())) {
|
||||
// todo:存数据
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
System.out.println("突然读到另一个标签:开始存储........"
|
||||
+ "此次雷达id====" + primaryRadarData.getRadarId() + "上次雷达id====" + primaryRadarData.getRadarId()
|
||||
+ "此次雷达ip为:====" + primaryRadarData.getRadarIp() + "上次雷达ip为 =====" + dataList.get(dataList.size() - 1).getRadarIp()
|
||||
+ "此次雷达标签号为:====" + modbusResponse.getTagId() + "此次雷达标签号为:====" + dataList.get(dataList.size() - 1).getTagId()
|
||||
+ data.getTime() + "结束时间为:" + currentTimeMillis);
|
||||
saveData(radar, map, readCount, timeMap.get("noDataStart"), currentTimeMillis);
|
||||
dataList.clear();
|
||||
timeMap.put("noDataStart", System.currentTimeMillis());
|
||||
map.remove(getMapKey(radar));
|
||||
dataList.add(primaryRadarData);
|
||||
readCount = 1;
|
||||
}
|
||||
}
|
||||
readCount++;
|
||||
|
||||
if (!Objects.equals(data.getData().get(0), dataList.get(dataList.size() - 1).getRadarId())) {
|
||||
long end = System.currentTimeMillis();
|
||||
|
|
@ -201,34 +242,31 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
}
|
||||
|
||||
}
|
||||
consecutiveZeros = 0;
|
||||
|
||||
} else {
|
||||
Long dataStart = timeMap.get("noDataStart");
|
||||
//连续10次读取标签号为0
|
||||
consecutiveZeros++;
|
||||
if (10 == consecutiveZeros) {
|
||||
if (100 == consecutiveZeros) {
|
||||
// todo:存数据
|
||||
long nullTime = System.currentTimeMillis();
|
||||
|
||||
System.out.println("连续10次读取标签号为0:开始存储........" + "开始时间为:" + dataStart + "结束时间为:" + noDataStart);
|
||||
saveData(radar, map, readCount, data.getTime(), noDataStart);
|
||||
// System.out.println("连续10次读取标签号为0:开始存储........" + radar + map + readCount + "开始时间为:" + timeMap.get("zero") + "结束时间为:" + noDataStart);
|
||||
saveData(radar, map, readCount, timeMap.get("zero"), noDataStart);
|
||||
readCount = 1;
|
||||
map.remove(getMapKey(radar));
|
||||
timeMap.remove("noDataStart");
|
||||
timeMap.put("noDataStart", System.currentTimeMillis());
|
||||
dataList.clear();
|
||||
consecutiveZeros = 0;
|
||||
}
|
||||
|
||||
// 没有配置过将铁包号置空
|
||||
primaryRadarData.setLadleNumber(null);
|
||||
primaryRadarData.setRadarIp(radar.getRadarIp());
|
||||
}
|
||||
CompletableFuture.runAsync(() -> {
|
||||
primaryRadarDataService.insertPrimaryRadarData(primaryRadarData);
|
||||
});
|
||||
}, threadPoolTaskExecutor);
|
||||
noDataStart = current;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -266,7 +304,7 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
tsanaRadar.setTimeBegin(sqlStart);
|
||||
tsanaRadar.setTimeEnd(sqlEnd);
|
||||
tsanaRadar.setTimeCount(count);
|
||||
oracleInsert(tsanaRadar);
|
||||
oracleInsert(tsanaRadar, radar);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -274,14 +312,14 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
}
|
||||
|
||||
|
||||
private static String getMapKey(SysRadar radar) {
|
||||
private String getMapKey(SysRadar radar) {
|
||||
return radar.getRadarIp() + "-" + radar.getRadarNum() + "-" + radar.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRadar(List<SysRadar> radarList) {
|
||||
List<SysRadar> filterDataList = radarList.stream().filter(item -> !allRadar.contains(item.getRadarIp())).collect(Collectors.toList());
|
||||
radarWebSocket(filterDataList);
|
||||
radarWebSocket(filterDataList, identifierHashMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -295,7 +333,7 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
* @param data
|
||||
* @return ModbusResponse
|
||||
*/
|
||||
private static SysDiscern copyDataToDiscern(PrimaryRadarData data) {
|
||||
private SysDiscern copyDataToDiscern(PrimaryRadarData data) {
|
||||
SysDiscern discern = new SysDiscern();
|
||||
discern.setTagId(data.getTagId());
|
||||
discern.setValue4(data.getValue4());
|
||||
|
|
@ -309,7 +347,7 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
* @param data
|
||||
* @return ModbusResponse
|
||||
*/
|
||||
public static ModbusResponse getModbusResponse(DataResponse data) {
|
||||
public ModbusResponse getModbusResponse(DataResponse data) {
|
||||
ModbusResponse modbusResponse = new ModbusResponse();
|
||||
modbusResponse.setRadarNum(data.getData().get(0).toString());
|
||||
modbusResponse.setTagId(data.getData().get(3).toString());
|
||||
|
|
@ -325,7 +363,9 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
}
|
||||
|
||||
|
||||
private static void oracleInsert(TsanaRadar tsanaRadar) {
|
||||
private void oracleInsert(TsanaRadar tsanaRadar, SysRadar radar) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
|
||||
Connection connection = null;
|
||||
PreparedStatement preparedStatement = null;
|
||||
try {
|
||||
|
|
@ -335,37 +375,21 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
String user = "radartest";
|
||||
String password = "radartest";
|
||||
connection = DriverManager.getConnection(url, user, password);
|
||||
System.out.println(" ============= 连接数据库成功 ==========");
|
||||
// ====================================================雷达编号, 标签编号, 工位代号, 标签号, 开始时间, 结束时间, 读取次数
|
||||
String insertStatement = "INSERT INTO xccb.TS_ANARADAR (RADARCODE, LABELCODE, LOCATIONIP , LABELNUM , TIMEBEGIN , TIMEEND , TIMECOUNT) VALUES (?, ?, ?, ?, to_date(?,'yyyy-mm-dd hh24:mi:ss'), to_date(?,'yyyy-mm-dd hh24:mi:ss'), ?)";
|
||||
|
||||
|
||||
System.out.println("insertStatement = " + insertStatement);
|
||||
preparedStatement = connection.prepareStatement(insertStatement);
|
||||
System.out.println("SQL语句初始化完成");
|
||||
preparedStatement.setString(1, tsanaRadar.getRadarCode());
|
||||
System.out.println("=======RadarCode初始化完成=======" + tsanaRadar.getRadarCode());
|
||||
preparedStatement.setString(2, tsanaRadar.getLabelCode());
|
||||
System.out.println("=======LabelCode初始化完成=======" + tsanaRadar.getLabelCode());
|
||||
preparedStatement.setString(3, tsanaRadar.getLocationIp());
|
||||
System.out.println("=======LocationIp初始化完成=======" + tsanaRadar.getLocationIp());
|
||||
preparedStatement.setString(4, tsanaRadar.getLabelNum());
|
||||
System.out.println("=======LabelNum语句初始化完成=======" + tsanaRadar.getLabelNum());
|
||||
preparedStatement.setString(5, tsanaRadar.getTimeBegin());
|
||||
System.out.println("=======TimeBegin语句初始化完成=======" + tsanaRadar.getTimeBegin());
|
||||
preparedStatement.setString(6, tsanaRadar.getTimeEnd());
|
||||
System.out.println("=======TimeEnd语句初始化完成=======" + tsanaRadar.getTimeEnd());
|
||||
preparedStatement.setInt(7, tsanaRadar.getTimeCount());
|
||||
System.out.println("=======TimeCount初始化完成=======" + tsanaRadar.getTimeCount());
|
||||
System.out.println("准备执行新增操作.........");
|
||||
int i = preparedStatement.executeUpdate();
|
||||
if (i == 0) {
|
||||
System.out.println("新增数据成功,新增数量: = " + i);
|
||||
} else {
|
||||
System.out.println("新增数据,新增数量: " + i);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("新增失败。。。。。。");
|
||||
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
// 关闭连接和statement
|
||||
|
|
@ -384,5 +408,15 @@ public class RadarRealTimeDataServiceImpl implements RadarRealTimeDataService, I
|
|||
}
|
||||
}
|
||||
}
|
||||
}, threadPoolTaskExecutor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
LocalDate twoDaysAgo = currentDate.minusDays(2);
|
||||
System.out.println(twoDaysAgo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue