Commit 80366e8f authored by zhoushiguang's avatar zhoushiguang

方向级指标、转向级指标、车道级指标 统一接口

parent 2c7f0154
...@@ -58,12 +58,13 @@ public class EsDateIndexUtil { ...@@ -58,12 +58,13 @@ public class EsDateIndexUtil {
unitTime = 30; unitTime = 30;
}else if (Objects.equals(TimeGranularityEnum.ONE_HOUR, timeGranularityEnum)) { }else if (Objects.equals(TimeGranularityEnum.ONE_HOUR, timeGranularityEnum)) {
unitTime = 60; unitTime = 60;
}else if (Objects.equals(TimeGranularityEnum.ONE_DAY, timeGranularityEnum)) {
unitTime = 24*60*60;
} }
for (int i = 0; i <= diffNum; i=i+unitTime) { for (int i = 0; i <= diffNum; i=i+unitTime) {
String format = start.plusMinutes(i).toString(dateFormat); String format = start.plusMinutes(i).toString(dateFormat);
indexList.add(format); indexList.add(format);
} }
return indexList; return indexList;
} }
......
...@@ -208,6 +208,34 @@ public class GreenwaveHistRestServer { ...@@ -208,6 +208,34 @@ public class GreenwaveHistRestServer {
} }
@GetMapping("/findGreenWaveCrossObjectIndex")
@ApiOperation(httpMethod="GET",value="路口方向级、转向级、车道级->分粒度指标趋势", notes="")
@ApiImplicitParams({
@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 = "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-05 00:00:00"),
@ApiImplicitParam(name = "objectType", value = "统计对象类型 1:方向级指标 2:转向级指标 3:车道级指标", required = true, dataType = "Integer",defaultValue = "1"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = GreenwaveHist.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject findGreenWaveCrossObjectIndex(String crossId, String startTime, String endTime,String groupType,Integer objectType) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
JSONObject list = greenwaveHistProvider.findGreenWaveCrossLaneIndex(crossId,startTime,endTime,groupType,objectType);
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@GetMapping("/findGreenWaveCrossIndex") @GetMapping("/findGreenWaveCrossIndex")
@ApiOperation(httpMethod="GET",value="绿波路口级->分粒度指标趋势", notes="") @ApiOperation(httpMethod="GET",value="绿波路口级->分粒度指标趋势", notes="")
@ApiImplicitParams({ @ApiImplicitParams({
......
...@@ -6,6 +6,7 @@ import net.wanji.databus.po.CrossDataHistPO; ...@@ -6,6 +6,7 @@ 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.opt.entity.GreenwaveHist; import net.wanji.opt.entity.GreenwaveHist;
import net.wanji.opt.po.base.CrossLaneDataHistPoExtend;
import net.wanji.opt.vo.GreenWaveRunStateVO; import net.wanji.opt.vo.GreenWaveRunStateVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -70,5 +71,13 @@ public interface GreenwaveHistoryMapper extends BaseInterfaceMapper<GreenwaveHis ...@@ -70,5 +71,13 @@ public interface GreenwaveHistoryMapper extends BaseInterfaceMapper<GreenwaveHis
*/ */
List<CrossTurnDataHistPO> findGreenWaveCrossTurnIndex(Map<String,Object> params); List<CrossTurnDataHistPO> findGreenWaveCrossTurnIndex(Map<String,Object> params);
/**
* 路口车道指标趋势数据据
* @param params
* @return
*/
List<CrossLaneDataHistPoExtend> findGreenWaveCrossLaneIndex(Map<String,Object> params);
} }
package net.wanji.opt.po.base;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.databus.po.CrossLaneDataHistPO;
import java.util.Date;
/**
* @author fengyi
* @date 2024/12/24
* @description
*/
@Data
public class CrossLaneDataHistPoExtend extends CrossLaneDataHistPO {
//车道ID
@ApiModelProperty(value = "车道ID", notes = "")
private String laneId;
//方向
@ApiModelProperty(value = "方向", notes = "")
private Integer dirType;
//转向功能
@ApiModelProperty(value = "转向功能", notes = "")
private Integer turnType;
//交通指数
@ApiModelProperty(value = "交通指数", notes = "")
private Double trafficIndex;
//最大排队长度
@ApiModelProperty(value = "最大排队长度", notes = "")
private Integer maxQueueLength;
//最小排队长度
@ApiModelProperty(value = "最小排队长度", notes = "")
private Integer minQueueLength;
//平均排队长度
@ApiModelProperty(value = "平均排队长度", notes = "")
private Integer avgQueueLength;
@ApiModelProperty(value = "开始时间:yyyy-MM-dd HH:mm:ss", notes = "")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
public Date startTime;
}
...@@ -91,4 +91,16 @@ public interface GreenwaveHistProvider extends BaseDubboInterface<GreenwaveHist> ...@@ -91,4 +91,16 @@ public interface GreenwaveHistProvider extends BaseDubboInterface<GreenwaveHist>
* @throws DubboProviderException * @throws DubboProviderException
*/ */
JSONObject findGreenWaveCrossTurnIndex(String crossId, String startTime, String endTime, String groupType) throws DubboProviderException; JSONObject findGreenWaveCrossTurnIndex(String crossId, String startTime, String endTime, String groupType) throws DubboProviderException;
/**
* 路口转向级不同时间粒度指标分析
* @param crossId
* @param startTime
* @param endTime
* @param groupType
* @param objectType 1:路口方向 2
* @return
* @throws DubboProviderException
*/
JSONObject findGreenWaveCrossLaneIndex(String crossId, String startTime, String endTime, String groupType,Integer objectType) throws DubboProviderException;
} }
...@@ -14,11 +14,14 @@ import net.wanji.databus.po.CrossDataHistPO; ...@@ -14,11 +14,14 @@ 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.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.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.service.GreenwaveHistProvider; import net.wanji.opt.service.GreenwaveHistProvider;
import net.wanji.opt.service.MainlineEvaluateService;
import net.wanji.opt.vo.GreenWaveRunStateVO; import net.wanji.opt.vo.GreenWaveRunStateVO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService; import org.apache.dubbo.config.annotation.DubboService;
...@@ -60,6 +63,8 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -60,6 +63,8 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
@Resource @Resource
private GreenwaveHistoryMapper greenwaveHistoryMapper; private GreenwaveHistoryMapper greenwaveHistoryMapper;
@Resource
private MainlineEvaluateService mainlineEvaluateService;
@Override @Override
public BaseInterfaceMapper<GreenwaveHist> getBaseInterfaceMapper() { public BaseInterfaceMapper<GreenwaveHist> getBaseInterfaceMapper() {
...@@ -350,7 +355,7 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -350,7 +355,7 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
//按方向排序 //按方向排序
List<CrossTurnDataHistPO> value = entry.getValue().stream().sorted(Comparator.comparing(o -> o.getStartTime())).collect(Collectors.toList()); List<CrossTurnDataHistPO> value = entry.getValue().stream().sorted(Comparator.comparing(o -> o.getStartTime())).collect(Collectors.toList());
//有实际数据的时刻点 //有实际数据的时刻点
Set<String> timeList = value.stream().map(po->DateUtil.formatDate(po.getStartTime(), "HH:mm")).collect(Collectors.toSet()); Set<String> timeList = value.stream().map(po->DateUtil.formatDate(po.getStartTime(), EsDateIndexUtil.YMD_HM_FORMATTER)).collect(Collectors.toSet());
//补充缺少时段数据,保留时段字段默认值 //补充缺少时段数据,保留时段字段默认值
for (String timeSec : sortedSet) { for (String timeSec : sortedSet) {
if (!timeList.contains(timeSec)) { if (!timeList.contains(timeSec)) {
...@@ -377,20 +382,108 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -377,20 +382,108 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
jsonObject.put("dataList", allList); jsonObject.put("dataList", allList);
jsonObject.put("dirList", groupByDir.keySet()); jsonObject.put("dirList", groupByDir.keySet());
return jsonObject; return jsonObject;
} }
/** @Override
* 获取随机数 public JSONObject findGreenWaveCrossLaneIndex(String crossId, String startTime, String endTime, String groupType,Integer objectType) throws DubboProviderException {
* Map<String, Object> params = new HashMap<>();
* @param max params.put("crossId", crossId);
* @param min params.put("startDate", startTime);
* @return params.put("endDate", endTime);
*/ params.put("groupType", groupType);
public static int getRandomValue(int max, int min) { params.put("objectType", objectType);
Random random = new Random();
int num = random.nextInt(max + 1 - min) + min; //存放时段
return num; Set<String> sortedSet = new TreeSet<>();
//===========================根据开始、结束时间输出完整时刻点=================================================//
DateTime start = DateTime.parse(startTime, DateTimeFormat.forPattern(EsDateIndexUtil.YMD_HM_FORMATTER));
DateTime end = DateTime.parse(endTime, DateTimeFormat.forPattern(EsDateIndexUtil.YMD_HM_FORMATTER));
if (Objects.equals("0", groupType)) {
sortedSet.addAll(EsDateIndexUtil.getTimeScopeList(start, end, TimeGranularityEnum.FIVE_MINUTE,EsDateIndexUtil.YMD_HM_FORMATTER));
} else if (Objects.equals("1", groupType)) {
sortedSet.addAll(EsDateIndexUtil.getTimeScopeList(start, end, TimeGranularityEnum.FIFTEEN_MINUTE,EsDateIndexUtil.YMD_HM_FORMATTER));
} else if (Objects.equals("2", groupType)) {
sortedSet.addAll(EsDateIndexUtil.getTimeScopeList(start, end, TimeGranularityEnum.THIRTY_MINUTE,EsDateIndexUtil.YMD_HM_FORMATTER));
} else if (Objects.equals("3", groupType)) {
sortedSet.addAll(EsDateIndexUtil.getTimeScopeList(start, end, TimeGranularityEnum.ONE_HOUR,EsDateIndexUtil.YMD_HM_FORMATTER));
}else if (Objects.equals("4", groupType)) {
sortedSet.addAll(EsDateIndexUtil.getTimeScopeList(start, end, TimeGranularityEnum.ONE_DAY,EsDateIndexUtil.YMD_HM_FORMATTER));
}
//======================================================================================================//
//存放所有进口数据
List<Map<String, Object>> allList = new ArrayList<>();
List<CrossLaneDataHistPoExtend> list = greenwaveHistoryMapper.findGreenWaveCrossLaneIndex(params);
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()));
for (Map.Entry<String, List<CrossLaneDataHistPoExtend>> entry : groupByDir.entrySet()) {
String key = entry.getKey();
String[] sps = key.split("_");
String laneId = sps[1];
String laneNo = laneId.substring(laneId.length()-2) ;
Integer dirType = Integer.parseInt(sps[2]);
String dirName = null;
String turnDesc = null;
String dirTurnDesc = null;
Map<String, Object> mapList = new HashMap<>();
if (Objects.equals(3,objectType)) {
mapList.put("laneId",laneId);
mapList.put("laneNo",laneNo);
dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType);
turnDesc = TurnConvertEnum.getDescByKey(Integer.valueOf(sps[3]));
dirTurnDesc = dirName + "进口" + turnDesc + laneNo + "车道";
}else if (Objects.equals(2,objectType)) {
dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType);
turnDesc = TurnConvertEnum.getDescByKey(Integer.valueOf(sps[3]));
dirTurnDesc = dirName + "进口" + turnDesc;
} else if (Objects.equals(1,objectType)) {
dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType);
dirTurnDesc = dirName + "进口";
}
//按方向排序
List<CrossLaneDataHistPoExtend> value = entry.getValue().stream().sorted(Comparator.comparing(o -> o.getStartTime())).collect(Collectors.toList());
//有实际数据的时刻点
Set<String> timeList = value.stream().map(po->DateUtil.formatDate(po.getStartTime(), EsDateIndexUtil.YMD_HM_FORMATTER)).collect(Collectors.toSet());
//补充缺少时段数据,保留时段字段默认值
for (String timeSec : sortedSet) {
if (!timeList.contains(timeSec)) {
CrossLaneDataHistPoExtend tmp = new CrossLaneDataHistPoExtend();
tmp.setStartTime(DateTime.parse(timeSec,DateTimeFormat.forPattern(EsDateIndexUtil.YMD_HM_FORMATTER)).toDate());
value.add(tmp);
}
}
value = value.stream().sorted(Comparator.comparing(CrossLaneDataHistPoExtend::getStartTime)).collect(Collectors.toList());
mapList.put("scopeCode", key);
mapList.put("scopeName", dirTurnDesc);
mapList.put("list", value);
allList.add(mapList);
}
BottomMenuBO bo = new BottomMenuBO();
bo.setCrossId(crossId);
bo.setScope(objectType);
List<String> scopeList = mainlineEvaluateService.bottomMenu(bo);
JSONObject jsonObject = new JSONObject();
jsonObject.put("timeList", sortedSet.stream().map(o->o.substring(o.indexOf(" ")+1,o.lastIndexOf(":"))));
jsonObject.put("dataList", allList);
jsonObject.put("scopeList", scopeList);
return jsonObject;
} }
} }
...@@ -94,6 +94,47 @@ ...@@ -94,6 +94,47 @@
GROUP BY t.cross_id, DATE_FORMAT(start_time, '%Y-%m-%d %H:%i:00') GROUP BY t.cross_id, DATE_FORMAT(start_time, '%Y-%m-%d %H:%i:00')
; ;
</select> </select>
<!-- 绿波路口级指标趋势,支持按5分钟、15分钟粒度、30分钟粒度、1小时粒度汇聚 -->
<select id="findGreenWaveCrossIndex" resultMap="net.wanji.databus.dao.mapper.CrossDataHistMapper.BaseResultMap">
SELECT MIN(start_time) start_time,
cross_id,
AVG(traffic_index) traffic_index,
SUM(flow) flow,
round(AVG(speed),2) speed,
MAX(queue_length) queue_length,
round(AVG(stop_times),2) stop_times,
round(AVG(delay_time),0) delay_time,
round(AVG(sturation),4) sturation
FROM
(
SELECT start_time,
(case
when #{groupType}=1 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 900)
when #{groupType}=2 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 1800)
when #{groupType}=3 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 3600)
end
) unit_time,
cross_id,
(traffic_index) traffic_index,
(flow) flow,
(speed) speed,
(queue_length) queue_length,
(stop_times) stop_times,
(delay_time) delay_time,
(sturation) sturation
FROM t_cross_data_hist t
where 1=1
<if test="crossId!=null and crossId !=''">
and cross_id = #{crossId}
</if>
<if test="startDate !=null and endDate !=null">
AND start_time >= #{startDate} and start_time &lt; #{endDate}
</if>
) t
GROUP BY t.cross_id,unit_time
</select>
<!-- 绿波路口方向级指标趋势,支持按5分钟粒度、15分钟粒度、30分钟粒度、1小时粒度汇聚 --> <!-- 绿波路口方向级指标趋势,支持按5分钟粒度、15分钟粒度、30分钟粒度、1小时粒度汇聚 -->
<select id="findGreenWaveCrossDirIndex" <select id="findGreenWaveCrossDirIndex"
resultMap="net.wanji.databus.dao.mapper.CrossDirDataHistMapper.BaseResultMap"> resultMap="net.wanji.databus.dao.mapper.CrossDirDataHistMapper.BaseResultMap">
...@@ -138,11 +179,11 @@ ...@@ -138,11 +179,11 @@
GROUP BY t.cross_id,t.dir_type,unit_time GROUP BY t.cross_id,t.dir_type,unit_time
</select> </select>
<!-- 绿波路口向级指标趋势,支持按5分钟粒度、15分钟粒度、30分钟粒度、1小时粒度汇聚 --> <!-- 绿波路口向级指标趋势,支持按5分钟粒度、15分钟粒度、30分钟粒度、1小时粒度汇聚 -->
<select id="findGreenWaveCrossTurnIndex" <select id="findGreenWaveCrossTurnIndex"
resultMap="net.wanji.databus.dao.mapper.CrossTurnDataHistMapper.BaseResultMap"> resultMap="net.wanji.databus.dao.mapper.CrossTurnDataHistMapper.BaseResultMap">
SELECT MIN(start_time) start_time, SELECT MIN(start_time) start_time,
cross_id, cross_id crossId,
in_dir, in_dir,
turn_type, turn_type,
round(AVG(traffic_index),2) traffic_index, round(AVG(traffic_index),2) traffic_index,
...@@ -184,47 +225,108 @@ ...@@ -184,47 +225,108 @@
GROUP BY t.cross_id,t.in_dir,t.turn_type,unit_time GROUP BY t.cross_id,t.in_dir,t.turn_type,unit_time
</select> </select>
<!-- 绿波路口车道级指标趋势,支持按5分钟粒度、15分钟粒度、30分钟粒度、1小时粒度汇聚 -->
<!-- 绿波路口级指标趋势,支持按5分钟、15分钟粒度、30分钟粒度、1小时粒度汇聚 --> <select id="findGreenWaveCrossLaneIndex"
<select id="findGreenWaveCrossIndex" resultMap="net.wanji.databus.dao.mapper.CrossDataHistMapper.BaseResultMap"> resultType="net.wanji.opt.po.base.CrossLaneDataHistPoExtend">
SELECT MIN(start_time) start_time, SELECT MIN(start_time) start_time ,
cross_id, cross_id ,
AVG(traffic_index), lane_id ,
dir_type ,
turn_type ,
SUM(flow) flow, SUM(flow) flow,
round(AVG(speed),2) speed, round(AVG(speed),2) speed,
MAX(queue_length) queue_length, MAX(queue_length) max_queue_length,
MIN(queue_length) min_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),0) delay_time, round(AVG(delay_time),2) delay_time,
round(AVG(sturation),4) sturation round(AVG(sturation),4) sturation
FROM FROM
( (
SELECT start_time, SELECT start_time,
(case (case
when #{groupType}=1 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 900) when #{groupType}=0 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)))
when #{groupType}=2 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 1800) when #{groupType}=1 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 900)
when #{groupType}=3 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 3600) when #{groupType}=2 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 1800)
end when #{groupType}=3 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 3600)
) unit_time, end
cross_id, ) unit_time,
(traffic_index) traffic_index, t.cross_id,
(flow) flow, <choose>
(speed) speed, <!-- 方向级 -->
(queue_length) queue_length, <when test="objectType==1">
(stop_times) stop_times, dir_type,
(delay_time) delay_time, null as lane_id,
(sturation) sturation null as turn_type,
FROM t_cross_data_hist t </when>
where 1=1 <!-- 转向级 -->
<if test="crossId!=null and crossId !=''"> <when test="objectType==2">
and cross_id = #{crossId} t.in_dir as dir_type,
</if> t.turn_type,
<if test="startDate !=null and endDate !=null"> null as lane_id,
AND start_time >= #{startDate} and start_time &lt; #{endDate} </when>
</if> <!-- 车道级 -->
<when test="objectType==3">
t.id as lane_id,
t2.dir as dir_type,
t2.sort as turn_type,
</when>
<otherwise>
</otherwise>
</choose>
flow,
speed,
queue_length,
stop_times,
delay_time,
sturation
<choose>
<!-- 方向级 -->
<when test="objectType==1">
FROM t_cross_dir_data_hist t
</when>
<!-- 转向级 -->
<when test="objectType==2">
FROM t_cross_turn_data_hist t
</when>
<!-- 车道级 -->
<when test="objectType==3">
FROM t_lane_data_hist t join t_base_lane_info t2 on t.id=t2.id
</when>
<!-- 路口级 -->
<otherwise>
</otherwise>
</choose>
where 1=1
<if test="crossId!=null and crossId !=''">
and t.cross_id = #{crossId}
</if>
<if test="startDate !=null and endDate !=null">
AND start_time >= #{startDate} and start_time &lt; #{endDate}
</if>
) t ) t
GROUP BY t.cross_id,unit_time <choose>
<!-- 方向级 -->
<when test="objectType==1">
GROUP BY t.cross_id,t.dir_type,unit_time
</when>
<!-- 转向级 -->
<when test="objectType==2">
GROUP BY t.cross_id,t.dir_type,t.turn_type,unit_time
</when>
<!-- 车道级 -->
<when test="objectType==3">
GROUP BY t.cross_id,t.lane_id,t.dir_type,t.turn_type,unit_time
</when>
<otherwise>
</otherwise>
</choose>
</select> </select>
<!-- 查看干线拥堵运行状态 --> <!-- 查看干线拥堵运行状态 -->
<select id="findGreenWaveRunState" resultType="net.wanji.opt.vo.GreenWaveRunStateVO"> <select id="findGreenWaveRunState" resultType="net.wanji.opt.vo.GreenWaveRunStateVO">
select type as state,count(*) count, select type as state,count(*) count,
......
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