Commit 95e80f36 authored by zhoushiguang's avatar zhoushiguang

场景事件数量输出调整

parent 93adae10
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -33,11 +34,15 @@ public class EventStatisticPo {
private String timeAxis;
@ApiModelProperty(value = "事件方向集合", notes = "",hidden = true)
@JSONField(serialize = false)
private String dirs;
@ApiModelProperty(value = "每个方向发生的次数", notes = "")
private Map<String,Long> dirEventCount;
@ApiModelProperty(value = "每个方向发生的次数集合", notes = "")
private List<Map<String,Object>> dirEventCountList;
@ApiModelProperty(value = "进口道方向",notes = "")
private Map<String,String> dirWkt;
}
......@@ -43,13 +43,13 @@ public class GreenwaveCrossTrendPo extends TrackableEntity {
private BigDecimal cordFlow;
@ApiModelProperty(value = "非协调方向停车次数")
private BigDecimal unCordStopTimes;
private BigDecimal stopTimes;
@ApiModelProperty(value = "非协调方向排队(米)")
private BigDecimal unCordQueueLength;
private BigDecimal queueLength;
@ApiModelProperty(value = "非协调方向流量")
private BigDecimal unCordFlow;
private BigDecimal flow;
@ApiModelProperty(value = "开始时间:yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
......
......@@ -120,19 +120,23 @@ public class EventServiceImpl implements EventService {
if (po != null) {
String dirs = po.getDirs();
Map<String, Long> countMap = null;
List<Map<String, Object>> list = new ArrayList<>();
if (Objects.nonNull(dirs)) {
String[] sps = dirs.split(",");
List<Map<String, Object>> list = new ArrayList<>();
//统计每个方向发生的次数
Map<String, Long> countMap = Arrays.stream(sps).collect(Collectors.groupingBy(String::valueOf, Collectors.counting()));
countMap = Arrays.stream(sps).collect(Collectors.groupingBy(String::valueOf, Collectors.counting()));
countMap.entrySet().forEach(o -> {
Map<String, Object> map = new HashMap<>();
map.put("dir", o.getKey());
map.put("count", o.getValue());
list.add(map);
});
po.setDirEventCount(countMap);
}
po.setDirEventCount(countMap);
po.setDirEventCountList(list);
QueryWrapper<BaseRidInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("end_cross_id", crossId);
......@@ -145,6 +149,7 @@ public class EventServiceImpl implements EventService {
group.forEach((k, v) -> {
dirWkt.put(k, v.get(0));
});
po.setDirs(null);
po.setDirWkt(dirWkt);
}
return po;
......
......@@ -181,9 +181,9 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
String flow = sps[3];
if (Objects.equals("1",type)) {
//非协调方向
po.setUnCordFlow(new BigDecimal(flow));
po.setUnCordQueueLength(new BigDecimal(queueLength));
po.setUnCordStopTimes(new BigDecimal(stopTimes));
po.setFlow(new BigDecimal(flow));
po.setQueueLength(new BigDecimal(queueLength));
po.setStopTimes(new BigDecimal(stopTimes));
} else if (Objects.equals("2",type)){
//协调方向
po.setCordFlow(new BigDecimal(flow));
......
......@@ -70,7 +70,7 @@
<!-- 查看路口事件数量 -->
<select id="findCrossEventCount" resultType="net.wanji.opt.po.base.EventStatisticPo">
select type as event_type,count(*) event_count,group_concat(distinct dir) dirs,b.label as event_type_desc
select cross_id, type as event_type,count(*) event_count,group_concat(dir) dirs,b.label as event_type_desc
from t_event_info a left join t_config_event_category b on a.type=b.event_type
where 1=1
<if test="crossId !=null and crossId !=''">
......@@ -82,7 +82,7 @@
<if test="startDate!=null and endDate !=''">
and start_time > #{startDate} and start_time &lt; #{endDate}
</if>
GROUP BY type
GROUP BY cross_id,type
</select>
......
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