Commit 4df3927b authored by duanruiming's avatar duanruiming

[add] 绿波流量绿信比折线图;事件占比1%y优化;

parent f39f08bc
...@@ -2021,7 +2021,7 @@ public class TrendServiceImpl implements TrendService { ...@@ -2021,7 +2021,7 @@ public class TrendServiceImpl implements TrendService {
private int getRate(int count, int size) { private int getRate(int count, int size) {
float temp = count / (float) size * 100; float temp = count / (float) size * 100;
temp = temp < 1 ? 0 : temp; temp = temp <= 1 ? 1 : temp;
int rate = Math.round(temp); int rate = Math.round(temp);
return rate; return rate;
} }
......
...@@ -198,8 +198,9 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService { ...@@ -198,8 +198,9 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
// 如果路口没有绿波,获取当前绿波最大的一条数据 // 如果路口没有绿波,获取当前绿波最大的一条数据
LambdaQueryWrapper<StrategyGreenOptHistEntity> queryWrapperMaxId = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StrategyGreenOptHistEntity> queryWrapperMaxId = new LambdaQueryWrapper<>();
queryWrapperMaxId.eq(StrategyGreenOptHistEntity::getGreenId, greenId); queryWrapperMaxId.eq(StrategyGreenOptHistEntity::getGreenId, greenId);
queryWrapperMaxId.ge(StrategyGreenOptHistEntity::getControlMethod, 1); queryWrapperMaxId.eq(StrategyGreenOptHistEntity::getControlMethod, 1);
queryWrapperMaxId.ge(StrategyGreenOptHistEntity::getControlTime, startOfDay.minusDays(1)); // 查询最近三天内的优化记录
queryWrapperMaxId.ge(StrategyGreenOptHistEntity::getControlTime, startOfDay.minusDays(3));
queryWrapperMaxId.orderByDesc(StrategyGreenOptHistEntity::getControlTime); queryWrapperMaxId.orderByDesc(StrategyGreenOptHistEntity::getControlTime);
queryWrapperMaxId.last("limit 1"); queryWrapperMaxId.last("limit 1");
entities = strategyGreenOptHistMapper.selectList(queryWrapperMaxId); entities = strategyGreenOptHistMapper.selectList(queryWrapperMaxId);
......
...@@ -679,8 +679,7 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -679,8 +679,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
Integer currentAlgo = entity.getCurrentAlgo(); Integer currentAlgo = entity.getCurrentAlgo();
Date issueTime = entity.getIssueTime(); Date issueTime = entity.getIssueTime();
Date current = new Date(); Date current = new Date();
Integer duration = entity.getDuration(); Integer duration = Objects.nonNull(entity.getDuration()) ? entity.getDuration() : 0;
// 计算结束时间 // 计算结束时间
if (Objects.nonNull(issueTime)) { if (Objects.nonNull(issueTime)) {
if (Objects.equals(2, currentAlgo) && current.getTime() - issueTime.getTime() - duration * 1000 > 0) { if (Objects.equals(2, currentAlgo) && current.getTime() - issueTime.getTime() - duration * 1000 > 0) {
......
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