|
@@ -8,6 +8,7 @@ import com.comtika.safe.dao.message.FadMessageConfDao;
|
|
import com.comtika.safe.entity.mobile.CommonHelp;
|
|
import com.comtika.safe.entity.mobile.CommonHelp;
|
|
import com.comtika.safe.entity.mobile.EleTotalHelp;
|
|
import com.comtika.safe.entity.mobile.EleTotalHelp;
|
|
import com.comtika.safe.entity.mobile.EleTotalQueryHelp;
|
|
import com.comtika.safe.entity.mobile.EleTotalQueryHelp;
|
|
|
|
+import com.comtika.safe.entity.mobile.help.EleHelp;
|
|
import com.comtika.safe.entity.safe.TerminalNewestData;
|
|
import com.comtika.safe.entity.safe.TerminalNewestData;
|
|
import com.comtika.safe.service.mobile.IMobileService;
|
|
import com.comtika.safe.service.mobile.IMobileService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -165,10 +166,12 @@ 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);
|
|
@@ -176,9 +179,15 @@ public class MobileServiceImpl implements IMobileService {
|
|
res.put(key,inc);
|
|
res.put(key,inc);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- return RespWrapper.makeSuccessResp(res);
|
|
|
|
|
|
+ List<EleHelp> list = new ArrayList<>();
|
|
|
|
+ for(String key:keys){
|
|
|
|
+ Integer integer = res.get(key);
|
|
|
|
+ list.add(new EleHelp(key,integer));
|
|
|
|
+ }
|
|
|
|
+ return RespWrapper.makeSuccessResp(list);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
private int calEle(Integer end,Integer start){
|
|
private int calEle(Integer end,Integer start){
|
|
if(end == null) end = 0;
|
|
if(end == null) end = 0;
|
|
if(start == null) start = 0;
|
|
if(start == null) start = 0;
|