Commit 142c9b32 authored by zhoushiguang's avatar zhoushiguang

场景事件数据格式调整

parent 70c81cea
......@@ -168,11 +168,14 @@ public class EventServiceImpl implements EventService {
//每5分组分组
Map<String, List<EventInfoSimplePo>> group = list.stream().collect(Collectors.groupingBy(o -> o.getTimeAxisStart()));
List<EventInfoSimplePo> tmpList = new ArrayList<>();
List<String> dataserList = new ArrayList<>();
group.forEach((time, valList1) -> {
//5分组内数据按类型分组
Map<String, List<EventInfoSimplePo>> groupByType = valList1.stream().collect(Collectors.groupingBy(o -> o.getEventType()));
List<EventInfoSimplePo> tmpList = new ArrayList<>();
//List<EventInfoSimplePo> tmpList = new ArrayList<>();
groupByType.forEach((type, valList2) -> {
EventInfoSimplePo tmp = null;
......@@ -190,7 +193,7 @@ public class EventServiceImpl implements EventService {
po.setStartTime(agoStartTime);
po.setEndTime(currentEndTime);
po.setTimeAxisStart(tmp.getTimeAxisStart());
po.setCount(po.getCount()+1);
po.setCount(po.getCount() + 1);
//清理合并前的记录
tmpList.remove(tmp);
}
......@@ -203,7 +206,7 @@ public class EventServiceImpl implements EventService {
List<String> dataTimeList = po.getDataTimeList();
for (int i = 0; i <= diffNum; i++) {
DateTime axisDateTime = startAxis.plusMinutes(i * 1);
int m =axisDateTime.getMinuteOfHour();
int m = axisDateTime.getMinuteOfHour();
if (m % 5 == 0 && axisDateTime.isBefore(endAxis)) {
dataTimeList.add(axisDateTime.toString("yyyy-MM-dd HH:mm:ss"));
}
......@@ -215,13 +218,16 @@ public class EventServiceImpl implements EventService {
tmp = po;
}
});
Map<String, Object> map = new HashMap<>();
map.put("timeAxis", time);
map.put("statusByDateList", tmpList);
retList.add(map);
});
Set<String> timeList = group.keySet();
tmpList.forEach(po -> {
String axis = DateUtil.formatDate(po.getStartTime(), "M/d") + "," + DateUtil.formatDate(po.getStartTime(), "HH:mm") +","+ po.getEventType();
dataserList.add(axis);
});
Map<String, Object> map = new HashMap<>();
map.put("statusByDateList", tmpList);
map.put("dataser", dataserList);
retList.add(map);
// Set<String> timeList = group.keySet();
//补充缺少时段数据,保留时段字段默认值
// for (String timeSec : sortedSet) {
// if (!timeList.contains(timeSec)) {
......@@ -232,9 +238,9 @@ public class EventServiceImpl implements EventService {
// }
// }
List<Map<String, Object>> sortList = retList.stream().sorted(Comparator.comparing(o -> o.get("timeAxis").toString())).collect(Collectors.toList());
// List<Map<String, Object>> sortList = retList.stream().sorted(Comparator.comparing(o -> o.get("timeAxis").toString())).collect(Collectors.toList());
return sortList;
return retList;
}
......
......@@ -10,10 +10,13 @@ import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.mapper.BaseInterfaceMapper;
import net.wanji.common.gts.Tools;
import net.wanji.common.utils.tool.DateUtil;
import net.wanji.databus.dao.mapper.BaseCrossInfoMapper;
import net.wanji.databus.po.BaseCrossInfoPO;
import net.wanji.databus.po.CrossDataHistPO;
import net.wanji.databus.po.CrossDirDataHistPO;
import net.wanji.databus.po.CrossTurnDataHistPO;
import net.wanji.databus.po.CrossTurnInfoPO;
import net.wanji.databus.po.TBaseCrossInfo;
import net.wanji.opt.bo.BottomMenuBO;
import net.wanji.opt.common.EsDateIndexUtil;
import net.wanji.opt.common.enums.TimeGranularityEnum;
......@@ -68,6 +71,10 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
@Resource
private MainlineEvaluateService mainlineEvaluateService;
@Resource
BaseCrossInfoMapper baseCrossInfoMapper
;
@Override
public BaseInterfaceMapper<GreenwaveHist> getBaseInterfaceMapper() {
return this.greenwaveHistoryMapper;
......@@ -410,8 +417,10 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
String dirTurnDesc = null;
Map<String, Object> mapList = new HashMap<>();
if (Objects.equals(3, objectType)) {
if (Objects.equals(4,objectType)){
TBaseCrossInfo tBaseCrossInfo = baseCrossInfoMapper.selectByPrimaryKey(sps[0]);
dirTurnDesc = tBaseCrossInfo.getName();
}else if (Objects.equals(3, objectType)) {
mapList.put("laneId", laneId);
mapList.put("laneNo", laneNo);
dirType = Integer.parseInt(sps[2]);
......
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