Commit 71da311b authored by duanruiming's avatar duanruiming

Merge remote-tracking branch 'origin/master'

parents c6db4ba0 70c81cea
...@@ -888,7 +888,6 @@ public class PlanSendServiceImpl implements PlanSendService { ...@@ -888,7 +888,6 @@ public class PlanSendServiceImpl implements PlanSendService {
if (CollectionUtil.isNotEmpty(afterTime)){ if (CollectionUtil.isNotEmpty(afterTime)){
optPhaseList.clear(); optPhaseList.clear();
for (int i = 0; i < afterTime.size(); i++) { for (int i = 0; i < afterTime.size(); i++) {
if (i == oriPhaseList.size()){ if (i == oriPhaseList.size()){
break; break;
...@@ -913,40 +912,9 @@ public class PlanSendServiceImpl implements PlanSendService { ...@@ -913,40 +912,9 @@ public class PlanSendServiceImpl implements PlanSendService {
} }
optPhaseList.add(optPhase); optPhaseList.add(optPhase);
} }
}else {
optPhaseList = oriPhaseList;
} }
/* List<CrossSchemeStageOptLogPO> crossSchedulesPOList = mapper.convertValue(optView.getContent(), new TypeReference<List<CrossSchemeStageOptLogPO>>() {
});
if (ObjectUtils.isNotEmpty(crossSchedulesPOList)) {
for (int i = 0; i < crossSchedulesPOList.size(); i++) {
if (i == oriPhaseList.size()){
break;
}
CrossSchemeStageOptLogPO optLogPO = crossSchedulesPOList.get(i);
SaveSchemeConfigDTO.PhaseListElement phaseListElement = oriPhaseList.get(i);
SaveSchemeConfigDTO.PhaseListElement optPhase = new SaveSchemeConfigDTO.PhaseListElement();
BeanUtils.copyProperties(phaseListElement,optPhase);
Integer yellowTime = phaseListElement.getYellowTime();
Integer redTime = phaseListElement.getRedTime();
//相位时间
Integer phaseTime = optLogPO.getPhaseTime();
//绿灯时间
int greenTime = phaseTime - yellowTime - redTime;
if (greenTime <= 0){
optPhase.setGreenTime(phaseTime);
optPhase.setYellowTime(0);
optPhase.setRedTime(0);
}else {
optPhase.setGreenTime(greenTime);
}
optPhaseList.add(optPhase);
}
}*/
} }
} }
ringPhasePO.setOriPhaseList(oriPhaseList); ringPhasePO.setOriPhaseList(oriPhaseList);
......
...@@ -239,10 +239,10 @@ public class GreenwaveHistRestServer { ...@@ -239,10 +239,10 @@ public class GreenwaveHistRestServer {
@ApiOperation(httpMethod="GET",value="路口进口【方向级、转向级、车道级】->分粒度指标趋势", notes="") @ApiOperation(httpMethod="GET",value="路口进口【方向级、转向级、车道级】->分粒度指标趋势", notes="")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String",defaultValue = "13MOD0B5SI0"), @ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String",defaultValue = "13MOD0B5SI0"),
@ApiImplicitParam(name = "groupType", value = "时间粒度类型 0:5分钟粒度 1:15分钟粒度 2:30分钟粒度 3:小时粒度 4:天粒度", required = true, dataType = "Integer",defaultValue = "1"), @ApiImplicitParam(name = "groupType", value = "时间粒度类型 0:5分钟粒度 1:15分钟粒度 2:30分钟粒度 3:小时粒度 4:天粒度 5:按时间范围直接做平均【不分粒度】", required = true, dataType = "Integer",defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2024-12-04 00:00:00"), @ApiImplicitParam(name = "startTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2024-12-04 00:00:00"),
@ApiImplicitParam(name = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2024-12-04 23:59:59"), @ApiImplicitParam(name = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2024-12-04 23:59:59"),
@ApiImplicitParam(name = "objectType", value = "统计对象类型 1:方向级指标 2:转向级指标 3:车道级指标", required = true, dataType = "Integer",defaultValue = "1"), @ApiImplicitParam(name = "objectType", value = "统计对象类型 1:方向级指标 2:转向级指标 3:车道级指标 4:路口级指标", required = true, dataType = "Integer",defaultValue = "1"),
}) })
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200, message = "成功", response = CrossLaneDataHistPoExtend.class, @ApiResponse(code = 200, message = "成功", response = CrossLaneDataHistPoExtend.class,
......
...@@ -50,6 +50,9 @@ public class CrossLaneDataHistPoExtend { ...@@ -50,6 +50,9 @@ public class CrossLaneDataHistPoExtend {
@ApiModelProperty(value = "饱和度",notes = "") @ApiModelProperty(value = "饱和度",notes = "")
private Double sturation; private Double sturation;
@ApiModelProperty(value = "服务水平",notes = "")
private String serviceLevel;
@ApiModelProperty(value = "开始时间:yyyy-MM-dd HH:mm:ss", notes = "") @ApiModelProperty(value = "开始时间:yyyy-MM-dd HH:mm:ss", notes = "")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
......
...@@ -14,7 +14,9 @@ import net.wanji.common.utils.tool.DateUtil; ...@@ -14,7 +14,9 @@ import net.wanji.common.utils.tool.DateUtil;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author duanruiming * @author duanruiming
...@@ -47,11 +49,19 @@ public class EventInfoSimplePo implements Serializable { ...@@ -47,11 +49,19 @@ public class EventInfoSimplePo implements Serializable {
@ApiModelProperty(value = "事件持续时长,单位秒") @ApiModelProperty(value = "事件持续时长,单位秒")
private Integer duration; private Integer duration;
@ApiModelProperty(value = "横轴时间轴", notes = "") @ApiModelProperty(value = "事件发生次数")
private String timeAxis; private Integer count=1;
@ApiModelProperty(value = "横轴时间轴start", notes = "")
private String timeAxisStart;
@ApiModelProperty(value = "横轴时间轴end", notes = "")
private String timeAxisEnd;
@ApiModelProperty(value = "纵轴日期 格式:(dd/MM)", notes = "") @ApiModelProperty(value = "纵轴日期 格式:(dd/MM)", notes = "")
private String date; private String date;
@ApiModelProperty(value = "纵轴日期 格式:(dd/MM)", notes = "")
private List<String> dataTimeList = new ArrayList<>();
} }
\ No newline at end of file
...@@ -166,7 +166,7 @@ public class EventServiceImpl implements EventService { ...@@ -166,7 +166,7 @@ public class EventServiceImpl implements EventService {
List<EventInfoSimplePo> list = holoEventMapper.findEventDistribute(params); List<EventInfoSimplePo> list = holoEventMapper.findEventDistribute(params);
//每5分组分组 //每5分组分组
Map<String, List<EventInfoSimplePo>> group = list.stream().collect(Collectors.groupingBy(o -> o.getTimeAxis())); Map<String, List<EventInfoSimplePo>> group = list.stream().collect(Collectors.groupingBy(o -> o.getTimeAxisStart()));
group.forEach((time, valList1) -> { group.forEach((time, valList1) -> {
//5分组内数据按类型分组 //5分组内数据按类型分组
...@@ -189,10 +189,28 @@ public class EventServiceImpl implements EventService { ...@@ -189,10 +189,28 @@ public class EventServiceImpl implements EventService {
po.setDuration(duration); po.setDuration(duration);
po.setStartTime(agoStartTime); po.setStartTime(agoStartTime);
po.setEndTime(currentEndTime); po.setEndTime(currentEndTime);
po.setTimeAxisStart(tmp.getTimeAxisStart());
po.setCount(po.getCount()+1);
//清理合并前的记录 //清理合并前的记录
tmpList.remove(tmp); tmpList.remove(tmp);
} }
} }
//==============周期数据时间范围============================================//
DateTime startAxis = new DateTime(DateTime.parse(po.getTimeAxisStart(), DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")));
DateTime endAxis = new DateTime(po.getEndTime());
int diffNum = Minutes.minutesBetween(startAxis, endAxis).getMinutes();
List<String> dataTimeList = po.getDataTimeList();
for (int i = 0; i <= diffNum; i++) {
DateTime axisDateTime = startAxis.plusMinutes(i * 1);
int m =axisDateTime.getMinuteOfHour();
if (m % 5 == 0 && axisDateTime.isBefore(endAxis)) {
dataTimeList.add(axisDateTime.toString("yyyy-MM-dd HH:mm:ss"));
}
}
po.setTimeAxisEnd(endAxis.toString("yyyy-MM-dd HH:mm:ss"));
po.setDataTimeList(dataTimeList);
//======================================================================//
tmpList.add(po); tmpList.add(po);
tmp = po; tmp = po;
} }
......
...@@ -17,6 +17,7 @@ import net.wanji.databus.po.CrossTurnInfoPO; ...@@ -17,6 +17,7 @@ import net.wanji.databus.po.CrossTurnInfoPO;
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;
import net.wanji.opt.constant.ServiceLevelEnum;
import net.wanji.opt.dao.mapper.GreenwaveHistoryMapper; import net.wanji.opt.dao.mapper.GreenwaveHistoryMapper;
import net.wanji.opt.entity.GreenwaveHist; import net.wanji.opt.entity.GreenwaveHist;
import net.wanji.opt.po.base.CrossLaneDataHistPoExtend; import net.wanji.opt.po.base.CrossLaneDataHistPoExtend;
...@@ -32,6 +33,7 @@ import org.joda.time.format.DateTimeFormatter; ...@@ -32,6 +33,7 @@ import org.joda.time.format.DateTimeFormatter;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
...@@ -330,7 +332,6 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -330,7 +332,6 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
Map<String, List<CrossTurnDataHistPO>> groupByDir = list.stream().collect(Collectors.groupingBy(o -> o.getInDir() + "_" + o.getTurnType(), TreeMap::new, Collectors.toList())); Map<String, List<CrossTurnDataHistPO>> groupByDir = list.stream().collect(Collectors.groupingBy(o -> o.getInDir() + "_" + o.getTurnType(), TreeMap::new, Collectors.toList()));
for (Map.Entry<String, List<CrossTurnDataHistPO>> entry : groupByDir.entrySet()) { for (Map.Entry<String, List<CrossTurnDataHistPO>> entry : groupByDir.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
String[] sps = key.split("_"); String[] sps = key.split("_");
...@@ -389,17 +390,21 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -389,17 +390,21 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
List<Map<String, Object>> allList = new ArrayList<>(); List<Map<String, Object>> allList = new ArrayList<>();
List<CrossLaneDataHistPoExtend> list = greenwaveHistoryMapper.findGreenWaveCrossLaneIndex(params); List<CrossLaneDataHistPoExtend> list = greenwaveHistoryMapper.findGreenWaveCrossLaneIndex(params);
list = list.stream().sorted(Comparator.comparing(o -> o.getStartTime())).collect(Collectors.toList()); list = list.stream().sorted(Comparator.comparing(o -> o.getStartTime())).collect(Collectors.toList());
//按时间分组分组 //按时间分组分组
Map<String, List<CrossLaneDataHistPoExtend>> groupByDir = list.stream().collect(Collectors.groupingBy(o -> o.getCrossId() + "_" + o.getLaneId() + "_" + o.getDirType() + "_" + o.getTurnType(), TreeMap::new, Collectors.toList())); Map<String, List<CrossLaneDataHistPoExtend>> groupByDir = list.stream().collect(Collectors.groupingBy(o -> o.getCrossId() + "_" + o.getLaneId() + "_" + o.getDirType() + "_" + o.getTurnType(), TreeMap::new, Collectors.toList()));
Set<String> hasDataScopeList = new HashSet<>();
for (Map.Entry<String, List<CrossLaneDataHistPoExtend>> entry : groupByDir.entrySet()) { for (Map.Entry<String, List<CrossLaneDataHistPoExtend>> entry : groupByDir.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
String[] sps = key.split("_"); String[] sps = key.split("_");
String laneId = sps[1]; String laneId = sps[1];
String laneNo = laneId.substring(laneId.length() - 2); String laneNo = laneId.substring(laneId.length() - 2);
Integer dirType = Integer.parseInt(sps[2]); Integer dirType = null;
String dirName = null; String dirName = null;
String turnDesc = null; String turnDesc = null;
String dirTurnDesc = null; String dirTurnDesc = null;
...@@ -409,22 +414,28 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -409,22 +414,28 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
if (Objects.equals(3, objectType)) { 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]);
dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType); dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType);
turnDesc = TurnConvertEnum.getDescByKey(Integer.valueOf(sps[3])); turnDesc = TurnConvertEnum.getDescByKey(Integer.valueOf(sps[3]));
dirTurnDesc = dirName + "进口" + turnDesc + laneNo + "车道"; dirTurnDesc = dirName + "进口" + turnDesc + laneNo + "车道";
} else if (Objects.equals(2, objectType)) { } else if (Objects.equals(2, objectType)) {
dirType = Integer.parseInt(sps[2]);
dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType); dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType);
turnDesc = TurnConvertEnum.getDescByKey(Integer.valueOf(sps[3])); turnDesc = TurnConvertEnum.getDescByKey(Integer.valueOf(sps[3]));
dirTurnDesc = dirName + "进口" + turnDesc; dirTurnDesc = dirName + "进口" + turnDesc;
} else if (Objects.equals(1, objectType)) { } else if (Objects.equals(1, objectType)) {
dirType = Integer.parseInt(sps[2]);
dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType); dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType);
dirTurnDesc = dirName + "进口"; dirTurnDesc = dirName + "进口";
} }
hasDataScopeList.add(dirTurnDesc);
//补充缺少时段数据,保留时段字段默认值 //补充缺少时段数据,保留时段字段默认值
List<CrossLaneDataHistPoExtend> value = this.processData(entry, groupType, sortedSet, startTime); List<CrossLaneDataHistPoExtend> value = this.processData(entry, groupType, sortedSet, startTime);
mapList.put("scopeCode", key); mapList.put("scopeCode", key);
mapList.put("scopeName", dirTurnDesc); mapList.put("scopeName", dirTurnDesc);
mapList.put("list", value); mapList.put("list", value);
...@@ -436,6 +447,39 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -436,6 +447,39 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
bo.setScope(objectType); bo.setScope(objectType);
List<String> scopeList = mainlineEvaluateService.bottomMenu(bo); List<String> scopeList = mainlineEvaluateService.bottomMenu(bo);
if (Objects.nonNull(scopeList)) {
//补充一条时段都没有的
for (String scopeName1 : scopeList) {
if (!hasDataScopeList.contains(scopeName1)) {
Map<String, Object> mapList = new HashMap<>();
mapList.put("scopeCode", "");
mapList.put("scopeName", scopeName1);
List<CrossLaneDataHistPoExtend> tmpList = new ArrayList<>();
//补充所有时段字段对象
for (String time : sortedSet) {
CrossLaneDataHistPoExtend po = new CrossLaneDataHistPoExtend();
try {
if (Objects.equals("4", groupType)) {
//天粒度
String st = time + "000000";
po.setStartTime(DateUtil.parse(st, "yyyyMMddHHmmss"));
} else {
String st = startTime.substring(0, startTime.lastIndexOf(" ") + 1) + time + ":00";
po.setStartTime(DateUtil.parse(st, "yyyy-MM-dd HH:mm:ss"));
}
} catch (ParseException e) {
e.printStackTrace();
}
tmpList.add(po);
po.setTimeAxis(time);
}
mapList.put("list", tmpList);
allList.add(mapList);
}
}
}
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("timeList", sortedSet); jsonObject.put("timeList", sortedSet);
jsonObject.put("dataList", allList); jsonObject.put("dataList", allList);
...@@ -586,6 +630,23 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -586,6 +630,23 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
private List<CrossLaneDataHistPoExtend> processData(Map.Entry<String, List<CrossLaneDataHistPoExtend>> entry, String groupType, Set<String> sortedSet, String startTime) { private List<CrossLaneDataHistPoExtend> processData(Map.Entry<String, List<CrossLaneDataHistPoExtend>> entry, String groupType, Set<String> sortedSet, String startTime) {
//按方向排序 //按方向排序
List<CrossLaneDataHistPoExtend> value = entry.getValue().stream().sorted(Comparator.comparing(o -> o.getStartTime())).collect(Collectors.toList()); List<CrossLaneDataHistPoExtend> value = entry.getValue().stream().sorted(Comparator.comparing(o -> o.getStartTime())).collect(Collectors.toList());
//========================路口级服务水平加权平均=================================================================//
String serviceLevelList = value.get(0).getServiceLevel();
StringBuilder serviceLevelBuf = new StringBuilder();
if (serviceLevelList != null) {
Map<String,Long> serviceGroup = Arrays.stream(serviceLevelList.split(",")).collect(Collectors.groupingBy(String::valueOf,Collectors.counting()));
double total = 0;
for (Map.Entry<String, Long> entry1 : serviceGroup.entrySet()) {
String key = entry1.getKey();
total += ServiceLevelEnum.getByType(key).getVal() * entry1.getValue();
}
//服务水平加权平均计算:给服务水平(等级得分*该等级的数量)累加/总数量
int avgService = (int) Math.round(total/value.size());
String avgServiceLevel = ServiceLevelEnum.getByVal(avgService)==null?"A":ServiceLevelEnum.getByVal(avgService).getType();
serviceLevelBuf.append(avgServiceLevel);
}
//有实际数据的时刻点 //有实际数据的时刻点
Set<String> timeList = new HashSet<>(); Set<String> timeList = new HashSet<>();
if (Objects.equals("4", groupType)) { if (Objects.equals("4", groupType)) {
...@@ -613,6 +674,10 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -613,6 +674,10 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
} }
} }
value = value.stream().sorted(Comparator.comparing(CrossLaneDataHistPoExtend::getStartTime)).collect(Collectors.toList()); value = value.stream().sorted(Comparator.comparing(CrossLaneDataHistPoExtend::getStartTime)).collect(Collectors.toList());
//==========================================================================================================//
//时间轴 //时间轴
value.forEach(o -> { value.forEach(o -> {
if (Objects.equals("4", groupType)) { if (Objects.equals("4", groupType)) {
...@@ -622,6 +687,7 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -622,6 +687,7 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
} else { } else {
o.setTimeAxis(DateUtil.formatDate(o.getStartTime(), EsDateIndexUtil.HM_FORMATTER)); o.setTimeAxis(DateUtil.formatDate(o.getStartTime(), EsDateIndexUtil.HM_FORMATTER));
} }
o.setServiceLevel(serviceLevelBuf.toString());
}); });
return value; return value;
......
...@@ -168,6 +168,7 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService { ...@@ -168,6 +168,7 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
String key = entry1.getKey(); String key = entry1.getKey();
total += ServiceLevelEnum.getByType(key).getVal() * entry1.getValue().size(); total += ServiceLevelEnum.getByType(key).getVal() * entry1.getValue().size();
} }
//服务水平加权平均计算:给服务水平(等级得分*该等级的数量)累加/总数量
int avgService = (int) Math.round(total/crossDataHistPOList.size()); int avgService = (int) Math.round(total/crossDataHistPOList.size());
String serviceLevel = ServiceLevelEnum.getByVal(avgService)==null?"A":ServiceLevelEnum.getByVal(avgService).getType(); String serviceLevel = ServiceLevelEnum.getByVal(avgService)==null?"A":ServiceLevelEnum.getByVal(avgService).getType();
......
...@@ -244,7 +244,8 @@ ...@@ -244,7 +244,8 @@
round(AVG(queue_length)) avg_queue_length, round(AVG(queue_length)) avg_queue_length,
round(AVG(stop_times),2) stop_times, round(AVG(stop_times),2) stop_times,
round(AVG(delay_time),2) delay_time, round(AVG(delay_time),2) delay_time,
round(AVG(sturation),4) sturation round(AVG(sturation),4) sturation,
group_concat(service_level) service_level
FROM FROM
( (
SELECT start_time, SELECT start_time,
...@@ -264,18 +265,28 @@ ...@@ -264,18 +265,28 @@
dir_type, dir_type,
null as lane_id, null as lane_id,
null as turn_type, null as turn_type,
null as service_level,
</when> </when>
<!-- 转向级 --> <!-- 转向级 -->
<when test="objectType==2"> <when test="objectType==2">
t.in_dir as dir_type, t.in_dir as dir_type,
t.turn_type, t.turn_type,
null as lane_id, null as lane_id,
null as service_level,
</when> </when>
<!-- 车道级 --> <!-- 车道级 -->
<when test="objectType==3"> <when test="objectType==3">
t.id as lane_id, t.id as lane_id,
t2.dir as dir_type, t2.dir as dir_type,
t2.turn as turn_type, t2.turn as turn_type,
null as service_level,
</when>
<!-- 路口级 -->
<when test="objectType==4">
null as lane_id,
null as dir_type,
null as turn_type,
ifnull(service_level,'A') service_level,
</when> </when>
<otherwise> <otherwise>
</otherwise> </otherwise>
...@@ -300,6 +311,10 @@ ...@@ -300,6 +311,10 @@
FROM t_lane_data_hist t join t_base_lane_info t2 on t.id=t2.id FROM t_lane_data_hist t join t_base_lane_info t2 on t.id=t2.id
</when> </when>
<!-- 路口级 --> <!-- 路口级 -->
<when test="objectType==4">
FROM t_cross_data_hist t
</when>
<otherwise> <otherwise>
</otherwise> </otherwise>
</choose> </choose>
...@@ -324,6 +339,10 @@ ...@@ -324,6 +339,10 @@
<when test="objectType==3"> <when test="objectType==3">
GROUP BY t.cross_id,t.lane_id,t.dir_type,t.turn_type,unit_time GROUP BY t.cross_id,t.lane_id,t.dir_type,t.turn_type,unit_time
</when> </when>
<!-- 路口级 -->
<when test="objectType==4">
GROUP BY t.cross_id,unit_time
</when>
<otherwise> <otherwise>
</otherwise> </otherwise>
</choose> </choose>
......
...@@ -58,13 +58,13 @@ ...@@ -58,13 +58,13 @@
<!-- 空放、失衡、溢出事件分布查询 --> <!-- 空放、失衡、溢出事件分布查询 -->
<select id="findEventDistribute" resultType="net.wanji.opt.po.trend.EventInfoSimplePo"> <select id="findEventDistribute" resultType="net.wanji.opt.po.trend.EventInfoSimplePo">
select cross_id,type as event_type,start_time,end_time, select cross_id,type as event_type,start_time,ifnull(end_time,now()) end_time,
TIMESTAMPDIFF(SECOND,start_time, ifnull(end_time,now())) duration, TIMESTAMPDIFF(SECOND,start_time, ifnull(end_time,now())) duration,
DATE_FORMAT(concat( date( start_time ), ' ', HOUR ( start_time ), ':', floor( MINUTE ( start_time ) / 5 ) * 5 ),'%Y-%m-%d %H:%i:00' ) time_axis DATE_FORMAT(concat( date( start_time ), ' ', HOUR ( start_time ), ':', floor( MINUTE ( start_time ) / 5 ) * 5 ),'%Y-%m-%d %H:%i:00' ) time_axis_start
from t_event_info from t_event_info
where type in ('701', '702','703') where type in ('701', '702','703')
and cross_id=#{crossId} and cross_id=#{crossId}
and start_time > #{startDate} and start_time &lt; #{endDate} and start_time >= #{startDate} and start_time &lt; #{endDate}
</select> </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