模板调整

This commit is contained in:
xy
2024-11-28 16:30:05 +08:00
parent 0c2954b8ba
commit b5267c24f4
2 changed files with 4 additions and 4 deletions

View File

@@ -39,7 +39,6 @@ public class AccessApplicationRunner implements ApplicationRunner {
private final DictTreeFeignClient dictTreeFeignClient;
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
ExecutorService executor = Executors.newFixedThreadPool(10);
private static final long ACCESS_TIME = 60L;
@Override
@@ -49,6 +48,7 @@ public class AccessApplicationRunner implements ApplicationRunner {
log.info("系统重启,所有符合条件的装置全部接入!");
List<CsEquipmentDeliveryPO> list = csEquipmentDeliveryService.getOnlineDev();
if (CollUtil.isNotEmpty(list)) {
ExecutorService executor = Executors.newFixedThreadPool(10);
// 将任务平均分配给10个子列表
List<List<CsEquipmentDeliveryPO>> subLists = new ArrayList<>();
int partitionSize = list.size() / 10;
@@ -57,7 +57,6 @@ public class AccessApplicationRunner implements ApplicationRunner {
int end = (i == 9) ? list.size() : start + partitionSize;
subLists.add(list.subList(start, end));
}
// 创建一个ExecutorService来处理这些任务
List<Future<Void>> futures = new ArrayList<>();
// 提交任务给线程池执行
@@ -81,10 +80,10 @@ public class AccessApplicationRunner implements ApplicationRunner {
}
// 关闭ExecutorService
executor.shutdown();
scheduler.shutdown();
}
};
scheduler.schedule(task,ACCESS_TIME,TimeUnit.SECONDS);
scheduler.shutdown();
}
public void accessDev(List<CsEquipmentDeliveryPO> list) {

View File

@@ -65,6 +65,7 @@ public class StatServiceImpl implements IStatService {
dataArrayParam.setId(appAutoDataMessage.getId());
dataArrayParam.setDid(appAutoDataMessage.getDid());
dataArrayParam.setCldId(appAutoDataMessage.getMsg().getClDid());
dataArrayParam.setIdx(appAutoDataMessage.getMsg().getDsNameIdx());
List<AppAutoDataMessage.DataArray> list = appAutoDataMessage.getMsg().getDataArray();
//获取监测点id
String lineId = null;
@@ -113,7 +114,7 @@ public class StatServiceImpl implements IStatService {
default:
break;
}
String key = AppRedisKey.DEV_MODEL.concat(dataArrayParam.getId() + dataArrayParam.getDid() + dataArrayParam.getCldId() + dataArrayParam.getStatMethod());
String key = AppRedisKey.DEV_MODEL.concat(dataArrayParam.getId() + dataArrayParam.getDid() + dataArrayParam.getCldId() + dataArrayParam.getStatMethod() + dataArrayParam.getIdx());
Object object = redisUtil.getObjectByKey(key);
List<CsDataArray> dataArrayList;
if (Objects.isNull(object)){