Commit 142c9b32 authored by zhoushiguang's avatar zhoushiguang

场景事件数据格式调整

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