增加调试接口
This commit is contained in:
parent
f65cb3747b
commit
edb34516b4
@ -23,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -148,7 +149,8 @@ public abstract class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
private Map<String, Map<String, Map<String, Object>>> queryHistoryCurveValues(Long irn, Date startTime, Date endTime, String interval, String fill, List<String> attributes) {
|
||||
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start("prepare resources");
|
||||
String iotModelCode = sysIotModelFieldMapper.queryModelCodeByDeviceId(irn);
|
||||
Map<String, Object> highSpeedFieldMap = highIotFieldMap.get(iotModelCode);
|
||||
Map<String, Object> lowSpeedFieldMap = lowIotFieldMap.get(iotModelCode);
|
||||
@ -167,11 +169,15 @@ public abstract class DataServiceImpl implements DataService {
|
||||
calField.add(field);
|
||||
}
|
||||
}
|
||||
stopWatch.stop();
|
||||
stopWatch.start("HighSpeedValues");
|
||||
Map<String, Map<String, Map<String, Object>>> result = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(highSpeedField)) {
|
||||
Map<String, Map<String, Map<String, Object>>> highHistoryCurve = tdEngineService.fetchHighHistoryCurve(irn, startTime, endTime, interval, highSpeedField);
|
||||
result.putAll(highHistoryCurve);
|
||||
}
|
||||
stopWatch.stop();
|
||||
stopWatch.start("LowSpeedValues");
|
||||
if (!CollectionUtils.isEmpty(lowSpeedField)) {
|
||||
Map<String, Map<String, Map<String, Object>>> lowHistoryCurve = tdEngineService.fetchLowHistoryCurve(irn, startTime, endTime, interval, lowSpeedField);
|
||||
if (result.get(irn.toString()) == null) {
|
||||
@ -180,6 +186,8 @@ public abstract class DataServiceImpl implements DataService {
|
||||
result.get(irn.toString()).putAll(lowHistoryCurve.get(irn.toString()));
|
||||
}
|
||||
}
|
||||
stopWatch.stop();
|
||||
stopWatch.start("CalculateValues");
|
||||
if (!CollectionUtils.isEmpty(calField)){
|
||||
ListUtil.page(calField,COMMIT_COUNT,list -> {
|
||||
for (String item : list){
|
||||
@ -192,6 +200,8 @@ public abstract class DataServiceImpl implements DataService {
|
||||
}
|
||||
});
|
||||
}
|
||||
stopWatch.stop();
|
||||
log.debug("查询历史数据耗时: {}", stopWatch.prettyPrint());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user