Commit dc14d54b by 向延琳

fix:线程之间传递不变的对象

1 parent 22e90371
...@@ -219,18 +219,11 @@ public class DashboardService extends AbstractCommonService { ...@@ -219,18 +219,11 @@ public class DashboardService extends AbstractCommonService {
stopWatch.stop(); stopWatch.stop();
log.info("{} 耗时:{} ms", "看板统计信息 - sn查询", stopWatch.getLastTaskTimeMillis()); log.info("{} 耗时:{} ms", "看板统计信息 - sn查询", stopWatch.getLastTaskTimeMillis());
AlarmTrackRecQueryDTO query = new AlarmTrackRecQueryDTO();
query.setSns(sns);
query.setStartTime(DateUtil.getTodayFirstDateTimeStr());
query.setEndTime(DateUtil.getTodayLastDateTimeStr());
query.setAlarmType(Constants.ALARM_TYPE_POWER_OFF);
//断电报警 //断电报警
CompletableFuture<Integer> powerOffFutureFuture = CompletableFuture.supplyAsync(() -> getPowerOffCount(query)); CompletableFuture<Integer> powerOffFutureFuture = CompletableFuture.supplyAsync(() -> getPowerOffCount(sns));
//光感报警 //光感报警
query.setAlarmType(Constants.ALARM_TYPE_LIGHT); CompletableFuture<Integer> lightFutureFuture = CompletableFuture.supplyAsync(() -> getLightCount(sns));
CompletableFuture<Integer> lightFutureFuture = CompletableFuture.supplyAsync(() -> getLightCount(query));
//围栏报警 //围栏报警
stopWatch.start(); stopWatch.start();
...@@ -257,9 +250,14 @@ public class DashboardService extends AbstractCommonService { ...@@ -257,9 +250,14 @@ public class DashboardService extends AbstractCommonService {
/** /**
* 今日光感 * 今日光感
*/ */
private Integer getLightCount(AlarmTrackRecQueryDTO query) { private Integer getLightCount(List<String> sns) {
StopWatch stopWatch = new StopWatch(); StopWatch stopWatch = new StopWatch();
stopWatch.start(); stopWatch.start();
AlarmTrackRecQueryDTO query = new AlarmTrackRecQueryDTO();
query.setSns(sns);
query.setStartTime(DateUtil.getTodayFirstDateTimeStr());
query.setEndTime(DateUtil.getTodayLastDateTimeStr());
query.setAlarmType(Constants.ALARM_TYPE_LIGHT);
Integer lightCount = remoteAlarmService.getAlarmCount(query); Integer lightCount = remoteAlarmService.getAlarmCount(query);
stopWatch.stop(); stopWatch.stop();
log.info("{} 耗时:{} ms", "看板统计信息 - 今日光感报警查询", stopWatch.getLastTaskTimeMillis()); log.info("{} 耗时:{} ms", "看板统计信息 - 今日光感报警查询", stopWatch.getLastTaskTimeMillis());
...@@ -269,9 +267,14 @@ public class DashboardService extends AbstractCommonService { ...@@ -269,9 +267,14 @@ public class DashboardService extends AbstractCommonService {
/** /**
* 今日断电报警 * 今日断电报警
*/ */
private Integer getPowerOffCount(AlarmTrackRecQueryDTO query) { private Integer getPowerOffCount(List<String> sns) {
StopWatch stopWatch = new StopWatch(); StopWatch stopWatch = new StopWatch();
stopWatch.start(); stopWatch.start();
AlarmTrackRecQueryDTO query = new AlarmTrackRecQueryDTO();
query.setSns(sns);
query.setStartTime(DateUtil.getTodayFirstDateTimeStr());
query.setEndTime(DateUtil.getTodayLastDateTimeStr());
query.setAlarmType(Constants.ALARM_TYPE_POWER_OFF);
Integer powerOffCount = remoteAlarmService.getAlarmCount(query); Integer powerOffCount = remoteAlarmService.getAlarmCount(query);
stopWatch.stop(); stopWatch.stop();
log.info("{} 耗时:{} ms", "看板统计信息 - 今日断电报警", stopWatch.getLastTaskTimeMillis()); log.info("{} 耗时:{} ms", "看板统计信息 - 今日断电报警", stopWatch.getLastTaskTimeMillis());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!