车辆删除修改,设备修改

develop
hanrenchun 10 months ago
parent a3bd93932d
commit 4a27474382

@ -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));
} }

@ -144,7 +144,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 = vehicleRecordService.count(deleteWrapper);
deleteWrapper.last("LIMIT 10000"); deleteWrapper.last("LIMIT 1000");
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