Commit 3b121d60 authored by duanruiming's avatar duanruiming

代码逻辑优化

parent 78dd84d7
...@@ -24,7 +24,6 @@ import net.wanji.opt.vo.AIOptResultVO; ...@@ -24,7 +24,6 @@ import net.wanji.opt.vo.AIOptResultVO;
import net.wanji.opt.vo.CrossEventListPO; import net.wanji.opt.vo.CrossEventListPO;
import net.wanji.opt.vo.CrossOptResult; import net.wanji.opt.vo.CrossOptResult;
import net.wanji.opt.vo.CrossStatusCountVO; import net.wanji.opt.vo.CrossStatusCountVO;
import org.apache.curator.drivers.EventTrace;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -73,6 +72,12 @@ public class CrossIndexServiceImpl implements CrossIndexService { ...@@ -73,6 +72,12 @@ public class CrossIndexServiceImpl implements CrossIndexService {
@Override @Override
public CrossDataRealtimePO crossIndex(CrossIdBO crossIdBO) { public CrossDataRealtimePO crossIndex(CrossIdBO crossIdBO) {
CrossDataRealtimePO crossDataRealtimePO = crossDataRealtimeMapper.selectByCrossId(crossIdBO.getCrossId()); CrossDataRealtimePO crossDataRealtimePO = crossDataRealtimeMapper.selectByCrossId(crossIdBO.getCrossId());
if (Objects.nonNull(crossDataRealtimePO)) {
Double trafficIndex = crossDataRealtimePO.getTrafficIndex();
if (trafficIndex < 1.0) {
crossDataRealtimePO.setTrafficIndex(1.0);
}
}
return crossDataRealtimePO; return crossDataRealtimePO;
} }
......
package net.wanji.opt.service.impl; package net.wanji.opt.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
...@@ -305,6 +304,10 @@ public class TrendServiceImpl implements TrendService { ...@@ -305,6 +304,10 @@ public class TrendServiceImpl implements TrendService {
//} //}
// 坐标格式转换 // 坐标格式转换
for (AbnormalCrossListVO abnormalCrossListVO : abnormalCrossListVOList) { for (AbnormalCrossListVO abnormalCrossListVO : abnormalCrossListVOList) {
Double trafficIndex = abnormalCrossListVO.getTrafficIndex();
if (trafficIndex < 1) {
abnormalCrossListVO.setTrafficIndex(1.0);
}
String locationStr = abnormalCrossListVO.getLocationStr(); String locationStr = abnormalCrossListVO.getLocationStr();
double[] lonLat = CrossUtil.getLonLat(locationStr); double[] lonLat = CrossUtil.getLonLat(locationStr);
List<Double> location = new ArrayList<>(); List<Double> location = new ArrayList<>();
......
...@@ -125,7 +125,9 @@ public class CrossServiceImpl implements CrossService { ...@@ -125,7 +125,9 @@ public class CrossServiceImpl implements CrossService {
cd.setQueueLength(c.getAvgQueueLength()); cd.setQueueLength(c.getAvgQueueLength());
cd.setLaneNo(c.getLaneNo()); cd.setLaneNo(c.getLaneNo());
cd.setFlow(c.getFlow()); cd.setFlow(c.getFlow());
if (c.getFlow() < 0) {
cd.setFlow(0);
}
results.add(cd); results.add(cd);
} }
......
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
when #{groupType}=0 then start_time when #{groupType}=0 then start_time
when #{groupType}=1 then dt_15min when #{groupType}=1 then dt_15min
when #{groupType}=2 then dt_30min when #{groupType}=2 then dt_30min
when #{groupType}=3 then dt when #{groupType}=3 then dt_60min
when #{groupType}=4 then DATE_FORMAT(start_time,'%Y-%m-%d 00:00:00' ) when #{groupType}=4 then DATE_FORMAT(start_time,'%Y-%m-%d 00:00:00' )
else DATE_FORMAT(start_time,'%Y-01-01 00:00:00') else DATE_FORMAT(start_time,'%Y-01-01 00:00:00')
end end
......
...@@ -301,7 +301,7 @@ ...@@ -301,7 +301,7 @@
<select id="getPlanConfigData" parameterType="map" <select id="getPlanConfigData" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo"> resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
SELECT SELECT
id,daily_plan_id,week_execute,daily_plan_details,cross_id id,daily_plan_id,week_execute,daily_plan_details,cross_id, switch_status
FROM FROM
t_strategy_priority_daily_info t_strategy_priority_daily_info
WHERE WHERE
......
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