Commit dd2a909a authored by zhaowenhao's avatar zhaowenhao

Merge remote-tracking branch 'origin/dev-wuhan' into dev-wuhan

# Conflicts:
#	signal-feign-service/src/main/resources/application-demo.properties
#	signal-utc-service/src/main/java/net/wanji/utc/config/RedisConfig.java
parents 71aa5287 eb220b3d
utc.service.url=http://fuzhujuece-signal-utc-service:32000/utc
utc.dt.service.url=http://10.102.1.182:39002/utc-dt
utc.hisense.service.url=http://10.102.1.182:39003/utc-hisense
control.url=http://10.102.1.182:32001/web
utc.service.url=http://192.168.208.43:32000/utc
utc.dt.service.url=http://192.168.208.43:39002/utc-dt
utc.hisense.service.url=http://192.168.208.43:39003/utc-hisense
control.url=http://192.168.208.43:32001/web
......@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.enums.CrossStatusEnum;
import net.wanji.common.enums.TurnConvertEnum;
......@@ -157,6 +158,9 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
.sum();
double saturation = sumA / sumB;
if (Double.isNaN(saturation)){
saturation = 0.0;
}
String serviceLevel = CrossUtil.getServiceLevel(saturation);
vo.setServiceLevel(serviceLevel);
......@@ -307,7 +311,9 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
//2. 查询路口统计表 t_cross_data_hist
List<RunningEvaluateIndexStatusVO> runningEvaluateIndexStatusVOS = buildRes(bo, crossId, status);
runningEvaluateStatusVO.setRunningEvaluateIndexStatusVOList(runningEvaluateIndexStatusVOS);
if (runningEvaluateIndexStatusVOS.isEmpty()){
runningEvaluateStatusVO.setContent("没有查询到相关数据");
}
//3. 获取问题列表
// 路口级别全量数据
List<MetricHistDTO> crossDTOList = crossDataHistMapper.selectMetricHistDTO2(
......@@ -831,9 +837,14 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
List<RunningEvaluateScopeTreeVO.TurnVO> res = new ArrayList<>();
List<CrossTurnInfoPO> crossTurnInfoPOList = baseCrossTurnInfoMapper.selectByCrossIdAndDir(crossId, dir);
Map<String, Boolean> m = Maps.newHashMap();
for (CrossTurnInfoPO crossTurnInfoPO : crossTurnInfoPOList) {
RunningEvaluateScopeTreeVO.TurnVO turnVO = new RunningEvaluateScopeTreeVO.TurnVO();
String turnType = crossTurnInfoPO.getTurnType();
if (m.get(turnType) != null){
continue;
}
m.put(turnType, true);
turnVO.setTurn(turnType);
List<RunningEvaluateScopeTreeVO.LaneVO> laneVOList = buildLaneVOList(crossId, dir, turnType);
turnVO.setChild(laneVOList);
......@@ -960,6 +971,12 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
res.add(vo);
}
if (res != null && res.size() ==1){
Double index = res.get(0).getIndex();
if (index == 0.0){
res.clear();
}
}
return res;
}
......
......@@ -72,7 +72,7 @@ public class CrossingDirectionQueryVO {
@ApiModelProperty(value = "最大排队")
@ExcelProperty("最大排队")
private double queueLength;
private int queueLength;
@ApiModelProperty(value = "平均停车次数")
@ExcelProperty("平均停车次数")
......@@ -194,7 +194,7 @@ public class CrossingDirectionQueryVO {
@ApiModelProperty(value = "平均排队长度")
@ExcelProperty("平均排队长度")
private double avgQueueLength;
private int avgQueueLength;
@ApiModelProperty(value = "绿灯有效利用率")
@ExcelProperty("绿灯有效利用率")
......
......@@ -72,7 +72,7 @@ public class CrossingQueryVO {
@ApiModelProperty(value = "最大排队")
@ExcelProperty("最大排队")
private double queueLength;
private int queueLength;
@ApiModelProperty(value = "平均停车次数")
@ExcelProperty("平均停车次数")
......@@ -198,7 +198,7 @@ public class CrossingQueryVO {
@ApiModelProperty(value = "平均排队长度")
@ExcelProperty("平均排队长度")
private double avgQueueLength;
private int avgQueueLength;
@ApiModelProperty(value = "绿灯有效利用率")
@ExcelProperty("绿灯有效利用率")
......
......@@ -84,7 +84,7 @@ public class CrossingTurnQueryVO {
@ApiModelProperty(value = "最大排队")
@ExcelProperty("最大排队")
private double queueLength;
private int queueLength;
@ApiModelProperty(value = "平均停车次数")
@ExcelProperty("平均停车次数")
......@@ -206,7 +206,7 @@ public class CrossingTurnQueryVO {
@ApiModelProperty(value = "平均排队长度")
@ExcelProperty("平均排队长度")
private double avgQueueLength;
private int avgQueueLength;
@ApiModelProperty(value = "绿灯有效利用率")
@ExcelProperty("绿灯有效利用率")
......
......@@ -20,4 +20,6 @@ public class RunningEvaluateStatusVO {
@ApiModelProperty(value = "时间列表")
private List<String> timeList;
//提示无数据
private String content;
}
......@@ -136,7 +136,7 @@ public class TableQueryVO {
@ApiModelProperty(value = "最大排队")
@ExcelProperty("最大排队")
private double queueLength;
private int queueLength;
@ApiModelProperty(value = "平均延误")
@ExcelProperty("平均延误")
......@@ -266,7 +266,7 @@ public class TableQueryVO {
@ApiModelProperty(value = "平均排队长度")
@ExcelProperty("平均排队长度")
private double avgQueueLength;
private int avgQueueLength;
@ApiModelProperty(value = "绿灯有效利用率")
@ExcelProperty("绿灯有效利用率")
......
spring:
profiles:
active: docker
\ No newline at end of file
#docker是武汉环境,demo是北京环境
active: demo
\ No newline at end of file
......@@ -167,6 +167,11 @@
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
</dependency>
<dependency>
<groupId>net.jodah</groupId>
<artifactId>expiringmap</artifactId>
<version>0.5.10</version>
</dependency>
</dependencies>
<build>
......
......@@ -119,7 +119,11 @@ public class RedisConfig extends CachingConfigurerSupport {
@Bean
public Jedis jedis() {
Jedis jedis = new Jedis(redisHost, redisPort);
if (password != null && !"".equals(password)) {
jedis.auth(password);
}else {
jedis.auth("Wanji300552");
}
return jedis;
}
......
package net.wanji.utc.dto.twinspat;
import lombok.Data;
import java.util.List;
/**
* 路口信息
*/
@Data
public class Intersection {
// 路口id (这个id需要与库表中路口id要映射)
private int nodeId;
private List<Phase> phases;
}
\ No newline at end of file
package net.wanji.utc.dto.twinspat;
import lombok.Data;
/**
* 相位信息
* 解释名词:
* 相位是指在一个信号灯周期中,某一组特定方向的交通流获得通行权(如绿灯)的状态。
* “相位”就是信号灯在某个时间段内允许某些方向车辆通行的一种状态。
* “当前相位”是指当前正在运行的信号灯状态,决定了哪些方向可以通行、哪些需要等待。
*
*/
@Data
public class Phase {
private String id; // 唯一值 phaseId + "_" + laneId
private int phaseId; // 相位ID [1-16], 控制一个灯组
private int laneId; // 车道编号
private int state; // 转向(灯组状态 [参考表E.3])
private int importDirect; // 进口方向 [参考表E.2]
private int turn; // 车道转向
private int light; // 信号灯颜色 [0..8]
private int limitEndTime; // 信号灯倒计时, 单位:秒
private String log; // 经度
private String lat; // 纬度
private float angle; // 信号灯角度
}
\ No newline at end of file
package net.wanji.utc.dto.twinspat;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import java.util.List;
/**
* 孪生专用信号灯数据
*/
@Data
public class WHSpatData {
private String rsuId;//要配映射路口id
private int msgCnt;
private long timestamp;
private String uuid;
private String msgType;
/**
* 路口列表
*/
private List<Intersection> intersections;
public static void main(String[] args) {
String json = "{\"intersections\":[{\"nodeId\":15,\"phases\":[{\"angle\":261.0,\"id\":\"4_1\",\"importDirect\":0,\"laneId\":1,\"lat\":\"30.4518233\",\"light\":3,\"limitEndTime\":28,\"log\":\"114.0926314\",\"phaseId\":4,\"state\":4},{\"angle\":261.0,\"id\":\"4_2\",\"importDirect\":0,\"laneId\":2,\"lat\":\"30.4518180\",\"light\":3,\"limitEndTime\":28,\"log\":\"114.0925986\",\"phaseId\":4,\"state\":4},{\"angle\":348.0,\"id\":\"66_1\",\"importDirect\":4,\"laneId\":1,\"lat\":\"30.4516888\",\"light\":3,\"limitEndTime\":5,\"log\":\"114.0930230\",\"phaseId\":66,\"state\":2},{\"angle\":348.0,\"id\":\"65_3\",\"importDirect\":4,\"laneId\":3,\"lat\":\"30.4517495\",\"light\":4,\"limitEndTime\":2,\"log\":\"114.0930097\",\"phaseId\":65,\"state\":1},{\"angle\":348.0,\"id\":\"65_2\",\"importDirect\":4,\"laneId\":2,\"lat\":\"30.4517189\",\"light\":4,\"limitEndTime\":2,\"log\":\"114.0930162\",\"phaseId\":65,\"state\":1},{\"angle\":91.0,\"id\":\"132_1\",\"importDirect\":8,\"laneId\":1,\"lat\":\"30.4511704\",\"light\":3,\"limitEndTime\":28,\"log\":\"114.0927570\",\"phaseId\":132,\"state\":4},{\"angle\":91.0,\"id\":\"132_2\",\"importDirect\":8,\"laneId\":2,\"lat\":\"30.4511697\",\"light\":3,\"limitEndTime\":28,\"log\":\"114.0927937\",\"phaseId\":132,\"state\":4},{\"angle\":169.0,\"id\":\"194_1\",\"importDirect\":12,\"laneId\":1,\"lat\":\"30.4515106\",\"light\":3,\"limitEndTime\":5,\"log\":\"114.0924748\",\"phaseId\":194,\"state\":2},{\"angle\":169.0,\"id\":\"193_2\",\"importDirect\":12,\"laneId\":2,\"lat\":\"30.4514799\",\"light\":4,\"limitEndTime\":2,\"log\":\"114.0924808\",\"phaseId\":193,\"state\":1},{\"angle\":170.0,\"id\":\"193_3\",\"importDirect\":12,\"laneId\":3,\"lat\":\"30.4514491\",\"light\":4,\"limitEndTime\":2,\"log\":\"114.0924865\",\"phaseId\":193,\"state\":1}]}],\"msgCnt\":92,\"msgType\":\"spat\",\"rsuId\":\"R-081507\",\"timestamp\":1746685493855,\"uuid\":\"R-081507_1746685493855\"}";
WHSpatData whSpatData = JSONObject.parseObject(json, WHSpatData.class);
System.out.println(whSpatData);
}
}
package net.wanji.utc.util;
/**
* 灯态的16个方向转换为8个方向类型
* 注:用于计算空放
*/
public class DirectionConverter {
/**
* 将0~15的进口方向编号转换为1~8的方向类型
* @param directionCode 0~15的输入方向编号
* @return 1~8的输出方向类型
*/
public static int convertDirection(int directionCode) {
if (directionCode < 0 || directionCode > 15) {
throw new IllegalArgumentException("directionCode must be between 0 and 15");
}
switch (directionCode) {
case 15:
case 0:
return 1; // 北
case 1:
case 2:
return 2; // 东北
case 3:
case 4:
return 3; // 东
case 5:
case 6:
return 4; // 东南
case 7:
case 8:
return 5; // 南
case 9:
case 10:
return 6; // 西南
case 11:
case 12:
return 7; // 西
case 13:
case 14:
return 8; // 西北
}
return 0; // 未知方向
}
public static void main(String[] args) {
for (int i = 0; i <= 15; i++) {
System.out.println("Input: " + i + " → Output: " + convertDirection(i));
}
}
}
package net.wanji.utc.util;
/**
* 灯态车道转向映射器
*/
public class TurnDirectionMapper {
// 定义映射关系,索引为源头转向值,值为目标转向值
private static final int[] DIRECTION_MAP = {
1, // 源头值 0 -> 目标值 1(左转)
2, // 源头值 1 -> 目标值 2(直行)
1, // 源头值 2 -> 目标值 1(左转)
5, // 源头值 3 -> 目标值 5(直左)
3, // 源头值 4 -> 目标值 3(右转)
6, // 源头值 5 -> 目标值 6(直右)
8, // 源头值 6 -> 目标值 8(左右)
7, // 源头值 7 -> 目标值 7(左直右)
4, // 源头值 8 -> 目标值 4(掉头)
10, // 源头值 9 -> 目标值 10(直行掉头)
9, // 源头值 10 -> 目标值 9(左转掉头)
12, // 源头值 11 -> 目标值 12(左直掉头)
11, // 源头值 12 -> 目标值 11(右转掉头)
13, // 源头值 13 -> 目标值 13(直右掉头)
15, // 源头值 14 -> 目标值 15(左右掉头)
14 // 源头值 15 -> 目标值 14(左直右掉头)
};
/**
* 转换源头转向值到目标转向值
*
* @param sourceValue 源头转向值 (0-15)
* @return 目标转向值 (1-15)
*/
public static int mapToTargetValue(int sourceValue) {
if (sourceValue < 0 || sourceValue >= DIRECTION_MAP.length) {
throw new IllegalArgumentException("非法源头转向值: " + sourceValue);
}
return DIRECTION_MAP[sourceValue];
}
public static void main(String[] args) {
for (int i = 0; i < 16; i++) {
System.out.println("源头值 " + i + " 映射的目标值为: " + mapToTargetValue(i));
}
}
}
spring:
profiles:
active: dev
\ No newline at end of file
#demo 北京环境
active: demo
\ No newline at end of file
......@@ -24,7 +24,7 @@ public class LightsStatusVO extends BaseCrossInfo {
private String phasePlanId;
@ApiModelProperty(value = "方案开始时间", notes = "目前没有用到")
private String schemeStartTime;
@ApiModelProperty(value = "相位周期剩余时长")
@ApiModelProperty(value = "周期剩余时长")
private Integer cycleCountDown;
@ApiModelProperty(value = "相位周期剩余时长")
private Integer cyclePhaseCountDown;
......
......@@ -148,7 +148,7 @@
AND t2.cross_id = #{crossId}
</if>
and t2.start_time <![CDATA[ >= ]]> #{startStamp}
and t2.start_time <![CDATA[ <= ]]> #{endStamp}
and t2.start_time <![CDATA[ < ]]> #{endStamp}
GROUP BY
t2.cross_id,
startTime
......
......@@ -178,7 +178,7 @@
</foreach>
</if>
and t1.start_time <![CDATA[ >= ]]> #{startStamp}
and t1.start_time <![CDATA[ <= ]]> #{endStamp}
and t1.start_time <![CDATA[ < ]]> #{endStamp}
GROUP BY
t2.id,
t2.dir,
......
......@@ -133,7 +133,7 @@
)
</if>
and t2.start_time <![CDATA[ >= ]]> #{startStamp}
and t2.start_time <![CDATA[ <= ]]> #{endStamp}
and t2.start_time <![CDATA[ < ]]> #{endStamp}
GROUP BY
t1.cross_id,
t2.in_dir,
......
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