Commit 947575df authored by tangwei's avatar tangwei

修改异步方法

parent 66f81852
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMonitorFanIndicator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -21,11 +22,11 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Autowired
MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
@Override
public void UpdateMonitorFanIndicator(List<IndexDto> list) {
monitorFanIndicatorregionMapper.UpdateMonitorFanIndicator(list);
}
}
......@@ -13,6 +13,7 @@ import org.influxdb.dto.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
......@@ -71,7 +72,7 @@ public class StationDataTaskImpl {
}
@Async("jxiopAsyncExecutor")
public void getIndexDto(DeviceDto deviceDto) {
public List<IndexDto> getIndexDto(DeviceDto deviceDto) {
//每个分机的指标数据
List<IndexDto> list = null;
......@@ -89,21 +90,24 @@ public class StationDataTaskImpl {
}
}
return list;
}
@Async("jxiopAsyncExecutor")
public void UpdateMonitorFanIndicator(List<IndexDto> list){
if(list!=null&&list.size()>0){
//对数据切片处理 默认创建
if(stationSection>list.size()||!isok){
monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list);
}else{
//进行分片处理
List<List<IndexDto>> listfp= Lists.partition(list,list.size()%stationSection);
for (List<IndexDto> indexDtos : listfp) {
//每个分级信息处理
monitorFanIndicatorImpl.UpdateMonitorFanIndicator(indexDtos);
}
}
if(stationSection>list.size()||!isok){
monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list);
}else{
//进行分片处理
List<List<IndexDto>> listfp= Lists.partition(list,list.size()%stationSection);
for (List<IndexDto> indexDtos : listfp) {
//每个分级信息处理
monitorFanIndicatorImpl.UpdateMonitorFanIndicator(indexDtos);
}
}
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.tasks;
import com.yeejoin.amos.boot.module.jxiop.api.dto.DeviceDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationTaksDto;
import com.yeejoin.amos.boot.module.jxiop.api.service.IStationDataTask;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.StationDataTaskImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -33,7 +33,8 @@ public class StationDataTask {
List<DeviceDto> listDeviceDto= stationDataTask.getListDevice(stationTaksDto);
if(listDeviceDto!=null&&listDeviceDto.size()>0){
for (DeviceDto deviceDto : listDeviceDto) {
stationDataTask.getIndexDto(deviceDto);
List<IndexDto> listIndexDto = stationDataTask.getIndexDto(deviceDto);
stationDataTask.UpdateMonitorFanIndicator(listIndexDto);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment