Merge remote-tracking branch 'origin/develop' into develop

develop
Angel 10 months ago
commit ce687ed6fb

@ -45,25 +45,25 @@ public class DevopeDeviceTask {
Page<TJksbglMysql> page = new Page<>(1, 1000); Page<TJksbglMysql> page = new Page<>(1, 1000);
List<TJksbglMysql> resultList = jksbglMysqlService.page(page, queryWrapper).getRecords(); List<TJksbglMysql> resultList = jksbglMysqlService.page(page, queryWrapper).getRecords();
CountDownLatch latch = new CountDownLatch(resultList.size()); // CountDownLatch latch = new CountDownLatch(resultList.size());
ExecutorService DevicePool = Executors.newFixedThreadPool(5); // ExecutorService DevicePool = Executors.newFixedThreadPool(5);
for (TJksbglMysql bean : resultList) { for (TJksbglMysql bean : resultList) {
DevicePool.submit(() -> { // DevicePool.submit(() -> {
cleanJksbInfo(bean); cleanJksbInfo(bean);
logger.info("清洗完成"); logger.info("清洗完成");
latch.countDown(); // latch.countDown();
}); // });
} }
try { // try {
//Wait for all threads to complete // //Wait for all threads to complete
latch.await(); // latch.await();
} catch (InterruptedException e) { // } catch (InterruptedException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
//关闭线程池 // //关闭线程池
DevicePool.shutdown(); // DevicePool.shutdown();
} catch (Exception e) { } catch (Exception e) {
logger.info(StringKit.getTrace(e)); logger.info(StringKit.getTrace(e));
} }

@ -130,10 +130,8 @@ public class TMotorvehicleTask {
TransitVehicleRecord one = vehicleRecordService.getOne(queryWrapper); TransitVehicleRecord one = vehicleRecordService.getOne(queryWrapper);
Date partitionField = one.getPartitionField(); Date partitionField = one.getPartitionField();
maxTime = dateFormat.format(partitionField); maxTime = dateFormat.format(partitionField);
//将maxTime转换为Date对象 //将maxTime转换为Date对象
Date maxDate = dateFormat.parse(maxTime); Date maxDate = dateFormat.parse(maxTime);
//计算2天前的日期 //计算2天前的日期
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(maxDate); calendar.setTime(maxDate);
@ -143,8 +141,7 @@ public class TMotorvehicleTask {
//构造删除条件 //构造删除条件
LambdaQueryWrapper<TransitVehicleRecord> deleteWrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<TransitVehicleRecord> deleteWrapper = Wrappers.lambdaQuery();
deleteWrapper.le(TransitVehicleRecord::getPartitionField, twoDaysAgo); deleteWrapper.le(TransitVehicleRecord::getPartitionField, twoDaysAgo);
// int countTM = vehicleRecordService.count(deleteWrapper); // int countTM = vehicleRecordervice.count(deleteWrapper);
deleteWrapper.last("LIMIT 10000");
boolean result = vehicleRecordService.remove(deleteWrapper); boolean result = vehicleRecordService.remove(deleteWrapper);
if (result) { if (result) {

@ -64,14 +64,14 @@ public class TjksbglTask {
jksbTag = true; jksbTag = true;
int count = countjksb / oncesCounts; int count = countjksb / oncesCounts;
CountDownLatch latch = new CountDownLatch(count); // CountDownLatch latch = new CountDownLatch(count);
ExecutorService jksbPool = Executors.newFixedThreadPool(50); // ExecutorService jksbPool = Executors.newFixedThreadPool(50);
for (int i = 0; i <= count; i++) { for (int i = 0; i <= count; i++) {
Map jksbMap = new HashMap(); Map jksbMap = new HashMap();
jksbMap.put("rowStart", i * oncesCounts); jksbMap.put("rowStart", i * oncesCounts);
jksbMap.put("rowEnd", (i + 1) * oncesCounts); jksbMap.put("rowEnd", (i + 1) * oncesCounts);
jksbPool.submit(() -> { // jksbPool.submit(() -> {
try { try {
List<TJksbglOracle> jksbs = jksbOracleService.getJKsbList(jksbMap); List<TJksbglOracle> jksbs = jksbOracleService.getJKsbList(jksbMap);
for (TJksbglOracle jksb : jksbs) { for (TJksbglOracle jksb : jksbs) {
@ -90,19 +90,19 @@ public class TjksbglTask {
} catch (Exception e) { } catch (Exception e) {
logger.info("jksbs:" + StringKit.getTrace(e)); logger.info("jksbs:" + StringKit.getTrace(e));
} }
latch.countDown(); // latch.countDown();
}); // });
logger.info("jksbMap数据总量:" + countjksb + "," + "当前处理下标:" + jksbMap.get("rowStart") + "/" + jksbMap.get("rowEnd")); logger.info("jksbMap数据总量:" + countjksb + "," + "当前处理下标:" + jksbMap.get("rowStart") + "/" + jksbMap.get("rowEnd"));
} }
try { // try {
// Wait for all threads to complete // // Wait for all threads to complete
latch.await(); // latch.await();
} catch (InterruptedException e) { // } catch (InterruptedException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
// 关闭线程池 // 关闭线程池
jksbPool.shutdown(); // jksbPool.shutdown();
} }
} catch (Exception e) { } catch (Exception e) {

Loading…
Cancel
Save