Commit ae02b901 authored by zhouleilei's avatar zhouleilei

Merge remote-tracking branch 'origin/master'

parents ca067886 c6c0433d
......@@ -58,12 +58,13 @@ public class EsDateIndexUtil {
unitTime = 30;
}else if (Objects.equals(TimeGranularityEnum.ONE_HOUR, timeGranularityEnum)) {
unitTime = 60;
}else if (Objects.equals(TimeGranularityEnum.ONE_DAY, timeGranularityEnum)) {
unitTime = 24*60*60;
}
for (int i = 0; i <= diffNum; i=i+unitTime) {
String format = start.plusMinutes(i).toString(dateFormat);
indexList.add(format);
}
return indexList;
}
......
......@@ -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")
@ApiOperation(httpMethod="GET",value="绿波路口级->分粒度指标趋势", notes="")
@ApiImplicitParams({
......
......@@ -6,6 +6,7 @@ import net.wanji.databus.po.CrossDataHistPO;
import net.wanji.databus.po.CrossDirDataHistPO;
import net.wanji.databus.po.CrossTurnDataHistPO;
import net.wanji.opt.entity.GreenwaveHist;
import net.wanji.opt.po.base.CrossLaneDataHistPoExtend;
import net.wanji.opt.vo.GreenWaveRunStateVO;
import org.apache.ibatis.annotations.Param;
......@@ -70,5 +71,13 @@ public interface GreenwaveHistoryMapper extends BaseInterfaceMapper<GreenwaveHis
*/
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>
* @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;
import net.wanji.databus.po.CrossDirDataHistPO;
import net.wanji.databus.po.CrossTurnDataHistPO;
import net.wanji.databus.po.CrossTurnInfoPO;
import net.wanji.opt.bo.BottomMenuBO;
import net.wanji.opt.common.EsDateIndexUtil;
import net.wanji.opt.common.enums.TimeGranularityEnum;
import net.wanji.opt.dao.mapper.GreenwaveHistoryMapper;
import net.wanji.opt.entity.GreenwaveHist;
import net.wanji.opt.po.base.CrossLaneDataHistPoExtend;
import net.wanji.opt.service.GreenwaveHistProvider;
import net.wanji.opt.service.MainlineEvaluateService;
import net.wanji.opt.vo.GreenWaveRunStateVO;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService;
......@@ -60,6 +63,8 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
@Resource
private GreenwaveHistoryMapper greenwaveHistoryMapper;
@Resource
private MainlineEvaluateService mainlineEvaluateService;
@Override
public BaseInterfaceMapper<GreenwaveHist> getBaseInterfaceMapper() {
......@@ -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());
//有实际数据的时刻点
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) {
if (!timeList.contains(timeSec)) {
......@@ -377,20 +382,108 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
jsonObject.put("dataList", allList);
jsonObject.put("dirList", groupByDir.keySet());
return jsonObject;
}
/**
* 获取随机数
*
* @param max
* @param min
* @return
*/
public static int getRandomValue(int max, int min) {
Random random = new Random();
int num = random.nextInt(max + 1 - min) + min;
return num;
@Override
public JSONObject findGreenWaveCrossLaneIndex(String crossId, String startTime, String endTime, String groupType,Integer objectType) throws DubboProviderException {
Map<String, Object> params = new HashMap<>();
params.put("crossId", crossId);
params.put("startDate", startTime);
params.put("endDate", endTime);
params.put("groupType", groupType);
params.put("objectType", objectType);
//存放时段
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;
}
}
......@@ -452,9 +452,9 @@ public class TrendServiceImpl implements TrendService {
abnormalCrossDetailVO.setCrossStopTimes(crossDataRealtimePO.getStopTimes());
abnormalCrossDetailVO.setSpeed(crossDataRealtimePO.getSpeed());
Double sturation = crossDataRealtimePO.getSturation();
abnormalCrossDetailVO.setSturation((double) Math.round(sturation) * 100);
String serviceLevel = CrossUtil.getServiceLevel(sturation);
abnormalCrossDetailVO.setServiceLevel(serviceLevel);
abnormalCrossDetailVO.setSturation((int)(sturation * 100));
//String serviceLevel = CrossUtil.getServiceLevel(sturation);
abnormalCrossDetailVO.setServiceLevel(crossDataRealtimePO.getServiceLevel());
abnormalCrossDetailVO.setHourFlow(crossDataRealtimePO.getFlow() * 12);
BigDecimal bigDecimal = BigDecimal.valueOf(crossDataRealtimePO.getTrafficIndex()).setScale(2, RoundingMode.HALF_UP);
abnormalCrossDetailVO.setCongestionIndex(bigDecimal);
......
......@@ -120,9 +120,14 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
int end = (int) (System.currentTimeMillis() / 1000) + 300;
List<CrossDirDataHistPO> dirDataHistPOS = crossDirDataHistMapper.selectDirDataList(crossId, dirList, start, end);
if (!CollectionUtils.isEmpty(dirDataHistPOS)) {
Map<Integer, List<CrossDirDataHistPO>> dirHistMap = dirDataHistPOS.stream().collect(Collectors.groupingBy(CrossDirDataHistPO::getDirType));
Integer dir = null;
for (Map.Entry<Integer, List<CrossDirDataHistPO>> entry : dirHistMap.entrySet()) {
dir = entry.getKey();
List<CrossDirDataHistPO> value = entry.getValue();
Double greenTimeRatio = 0.0;
List<GreenBeltKeyCrossFlowTimeVO.Detail> details = new ArrayList<>();
for (CrossDirDataHistPO dirDataHistPO : dirDataHistPOS) {
for (CrossDirDataHistPO dirDataHistPO : value) {
GreenBeltKeyCrossFlowTimeVO.Detail detail = new GreenBeltKeyCrossFlowTimeVO.Detail();
detail.setCrossId(crossId);
String crossName = baseCrossInfoCache.getCrossName(crossId);
......@@ -140,34 +145,29 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
}
if (StringUtils.equalsIgnoreCase(crossId, optResult.getCrossId()) && Objects.equals(curDir, dirType)
&& dirDataHistPO.getStartTime().getTime() == optResult.getStartTime().getTime()) {
detail.setGreenTimeRatio(optResult.getGreenTimeRatio());
greenTimeRatio = optResult.getGreenTimeRatio();
detail.setGreenTimeRatio(optResult.getGreenTimeRatio() * 100);
greenTimeRatio = optResult.getGreenTimeRatio() * 100;
}
}
details.add(detail);
}
if (!CollectionUtils.isEmpty(details)) {
Map<String, List<GreenBeltKeyCrossFlowTimeVO.Detail>> dirMap = details.stream().collect(Collectors.groupingBy(GreenBeltKeyCrossFlowTimeVO.Detail::getDir));
for (Map.Entry<String, List<GreenBeltKeyCrossFlowTimeVO.Detail>> entry : dirMap.entrySet()) {
String dir = entry.getKey();
GreenBeltKeyCrossFlowTimeVO greenBeltKeyCrossFlowTimeVO = new GreenBeltKeyCrossFlowTimeVO();
List<GreenBeltKeyCrossFlowTimeVO.Detail> value = entry.getValue();
String crossName = "";
if (!CollectionUtils.isEmpty(value)) {
GreenBeltKeyCrossFlowTimeVO.Detail detail = value.get(0);
GreenBeltKeyCrossFlowTimeVO.Detail detail = details.get(0);
crossName = detail.getCrossName();
}
greenBeltKeyCrossFlowTimeVO.setCrossName(crossName);
greenBeltKeyCrossFlowTimeVO.setDirName(GreenBeltDirEnum.getInDirName(Integer.valueOf(dir)));
List<GreenBeltKeyCrossFlowTimeVO.Detail> collect = value.stream().sorted(Comparator.comparing(GreenBeltKeyCrossFlowTimeVO.Detail::getStartTime)).collect(Collectors.toList());
List<GreenBeltKeyCrossFlowTimeVO.Detail> collect = details.stream().sorted(Comparator.comparing(GreenBeltKeyCrossFlowTimeVO.Detail::getStartTime)).collect(Collectors.toList());
greenBeltKeyCrossFlowTimeVO.setDetailList(collect);
results.add(greenBeltKeyCrossFlowTimeVO);
}
}
}
// 关键路口历史数据
return results;
} catch (Exception e) {
log.error("绿波关键路口流量绿信比查询异常:", e);
......
package net.wanji.opt.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -21,10 +22,13 @@ public class AbnormalCrossDetailVO {
@ApiModelProperty(value = "路口状态:0正常;1失衡;2拥堵;3溢出")
private Integer crossStatus;
@ApiModelProperty(value = "最大排队")
@JsonSerialize(using = net.wanji.common.framework.DoubleSerialize.class)
private Double crossQueueLength;
@ApiModelProperty(value = "流率")
@JsonSerialize(using = net.wanji.common.framework.DoubleSerialize.class)
private Double crossFlowRate;
@ApiModelProperty(value = "平均停车次数")
@JsonSerialize(using = net.wanji.common.framework.DoubleSerialize.class)
private Double crossStopTimes;
@ApiModelProperty(value = "拥堵指数")
private BigDecimal congestionIndex;
......@@ -35,9 +39,10 @@ public class AbnormalCrossDetailVO {
@ApiModelProperty(value = "方向实时数据")
private List<DirDataElement> dirData;
@ApiModelProperty(value = "平均速度")
@JsonSerialize(using = net.wanji.common.framework.DoubleSerialize.class)
private Double speed;
@ApiModelProperty(value = "饱和度")
private Double sturation;
private Integer sturation;
@ApiModelProperty(value = "路口服务水平")
private String serviceLevel;
@ApiModelProperty(value = "小时流量")
......
......@@ -94,6 +94,47 @@
GROUP BY t.cross_id, DATE_FORMAT(start_time, '%Y-%m-%d %H:%i:00')
;
</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小时粒度汇聚 -->
<select id="findGreenWaveCrossDirIndex"
resultMap="net.wanji.databus.dao.mapper.CrossDirDataHistMapper.BaseResultMap">
......@@ -138,11 +179,11 @@
GROUP BY t.cross_id,t.dir_type,unit_time
</select>
<!-- 绿波路口向级指标趋势,支持按5分钟粒度、15分钟粒度、30分钟粒度、1小时粒度汇聚 -->
<!-- 绿波路口向级指标趋势,支持按5分钟粒度、15分钟粒度、30分钟粒度、1小时粒度汇聚 -->
<select id="findGreenWaveCrossTurnIndex"
resultMap="net.wanji.databus.dao.mapper.CrossTurnDataHistMapper.BaseResultMap">
SELECT MIN(start_time) start_time,
cross_id,
cross_id crossId,
in_dir,
turn_type,
round(AVG(traffic_index),2) traffic_index,
......@@ -184,47 +225,108 @@
GROUP BY t.cross_id,t.in_dir,t.turn_type,unit_time
</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),
<!-- 绿波路口车道级指标趋势,支持按5分钟粒度、15分钟粒度、30分钟粒度、1小时粒度汇聚 -->
<select id="findGreenWaveCrossLaneIndex"
resultType="net.wanji.opt.po.base.CrossLaneDataHistPoExtend">
SELECT MIN(start_time) start_time ,
cross_id ,
lane_id ,
dir_type ,
turn_type ,
SUM(flow) flow,
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(delay_time),0) delay_time,
round(AVG(delay_time),2) delay_time,
round(AVG(sturation),4) sturation
FROM
(
SELECT start_time,
(case
when #{groupType}=0 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)))
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
t.cross_id,
<choose>
<!-- 方向级 -->
<when test="objectType==1">
dir_type,
null as lane_id,
null as turn_type,
</when>
<!-- 转向级 -->
<when test="objectType==2">
t.in_dir as dir_type,
t.turn_type,
null as lane_id,
</when>
<!-- 车道级 -->
<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 cross_id = #{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
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 id="findGreenWaveRunState" resultType="net.wanji.opt.vo.GreenWaveRunStateVO">
select type as state,count(*) count,
......
......@@ -26,6 +26,10 @@ public enum DataBrainControlModeEnum {
SELF_ADAPTION(20, 23, "单点自适应控制"),
LINE_COORDINATE(21, 31, "线协调控制"),
REGION_COORDINATE(21, 41, "区域协调控制"),
MANUAL_CONTROL(31, 51, "手动控制"),
MANUAL_LOCK(31, 52, "手动控制-锁定阶段"),
MANUAL_TEMP_SCHEME(31, 53, "手动控制-指定方案"),
MANUAL_LOCK_CHANNEL(31, 54, "手动控制-锁定通道"),
TEMP_PLAN(255, 53, "临时方案");
private Integer wjControl;
......
......@@ -16,7 +16,8 @@ import java.util.Map;
@ApiModel(value = "LightsStatusVO", description = "实时灯态信息实体")
public class LightsStatusVO extends BaseCrossInfo {
@ApiModelProperty(value = "运行模式 `2=手动锁定当前相位`,`3=手动全红`,`4=手动黄闪`,`5=手动关灯`," +
"`6=全红闪控制`,`7=全黄控制`,`8=正常按计划运行`,`9=手动步进控制`,`10=自动步进控制`,`11=恢复时间表`,`255=临时控制方案`")
"`6=全红闪控制`,`7=全黄控制`,`8=正常按计划运行`,`9=手动步进控制`,`10=自动步进控制`,`11=恢复时间表`," +
"`20=单点自适应控制`,`21=绿波协调`,`31=手动控制`,`255=临时控制方案`")
private String runMode;
@ApiModelProperty(value = "控制模式")
private String controlMode;
......
......@@ -18,7 +18,8 @@ import java.util.List;
@ApiModel(value = "LightsStatusVO2", description = "实时灯态信息实体版本2")
public class LightsStatusVO2 extends BaseCrossInfo {
@ApiModelProperty(value = "运行模式 `2=手动锁定当前相位`,`3=手动全红`,`4=手动黄闪`,`5=手动关灯`," +
"`6=全红闪控制`,`7=全黄控制`,`8=正常按计划运行`,`9=手动步进控制`,`10=自动步进控制`,`11=恢复时间表`,`20=单点自适应控制`,`21=绿波协调`,`255=临时控制方案`")
"`6=全红闪控制`,`7=全黄控制`,`8=正常按计划运行`,`9=手动步进控制`,`10=自动步进控制`,`11=恢复时间表`," +
"`20=单点自适应控制`,`21=绿波协调`,`31=手动控制`,`255=临时控制方案`")
private String runMode;
@ApiModelProperty(value = "控制模式")
private String controlMode;
......
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