|
@@ -166,12 +166,10 @@ public class MobileServiceImpl implements IMobileService {
|
|
// 这里查询数据
|
|
// 这里查询数据
|
|
List<EleTotalHelp> sumTotalList = fadMessageConfDao.findTerminalEleTotalList(help.getTerminalId(),help.getStartTime(),help.getEndTime()+DateTimeUtils.ONE_DAY);
|
|
List<EleTotalHelp> sumTotalList = fadMessageConfDao.findTerminalEleTotalList(help.getTerminalId(),help.getStartTime(),help.getEndTime()+DateTimeUtils.ONE_DAY);
|
|
Map<String,Integer> res = new HashMap<>();
|
|
Map<String,Integer> res = new HashMap<>();
|
|
- Set<String> keys = new HashSet<>();
|
|
|
|
sumTotalList.forEach(s->{
|
|
sumTotalList.forEach(s->{
|
|
// 处理时间
|
|
// 处理时间
|
|
if(s.getCreateTime() == null) return;
|
|
if(s.getCreateTime() == null) return;
|
|
String key = DateTimeUtils.formatDate(new Date(s.getCreateTime()), DateTimeUtils.FORMAT_YMD);
|
|
String key = DateTimeUtils.formatDate(new Date(s.getCreateTime()), DateTimeUtils.FORMAT_YMD);
|
|
- keys.add(key);
|
|
|
|
int inc = calEle(s.getEndEle(), s.getStartEle());
|
|
int inc = calEle(s.getEndEle(), s.getStartEle());
|
|
if(res.containsKey(key)){
|
|
if(res.containsKey(key)){
|
|
res.put(key,res.get(key)+inc);
|
|
res.put(key,res.get(key)+inc);
|
|
@@ -179,10 +177,19 @@ public class MobileServiceImpl implements IMobileService {
|
|
res.put(key,inc);
|
|
res.put(key,inc);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ // 处理数据
|
|
|
|
+ List<String> keys = new ArrayList<>();
|
|
|
|
+ long startTime = help.getStartTime();
|
|
|
|
+ long endTime = help.getEndTime();
|
|
|
|
+ while (startTime <= endTime){
|
|
|
|
+ keys.add(DateTimeUtils.formatDate(new Date(startTime), DateTimeUtils.FORMAT_YMD));
|
|
|
|
+ startTime += DateTimeUtils.ONE_DAY;
|
|
|
|
+ }
|
|
List<EleHelp> list = new ArrayList<>();
|
|
List<EleHelp> list = new ArrayList<>();
|
|
- for(String key:keys){
|
|
|
|
- Integer integer = res.get(key);
|
|
|
|
- list.add(new EleHelp(key,integer));
|
|
|
|
|
|
+ int size = keys.size();
|
|
|
|
+ for(int i=0;i<size;i++){
|
|
|
|
+ String key = keys.get(i);
|
|
|
|
+ list.add(new EleHelp(key,res.get(key)));
|
|
}
|
|
}
|
|
return RespWrapper.makeSuccessResp(list);
|
|
return RespWrapper.makeSuccessResp(list);
|
|
}
|
|
}
|