Commit 29b884c4 authored by duanruiming's avatar duanruiming

[update] review-提取方法,降低复杂度

parent 24e9ddb3
......@@ -1932,6 +1932,23 @@ public class TrendServiceImpl implements TrendService {
float temp = value.size() / (float) crossDataHistPOS.size() * 100;
temp = temp < 1 ? 0 : temp;
int rate = Math.round(temp);
setStatusTimeRate(crossStatusTimeRateVO, status, rate);
}
}
} catch (Exception e) {
log.error("交通状态时间比例异常:", e);
throw new OptServiceException(e);
}
return crossStatusTimeRateVO;
}
/**
* 设置状态时间比例
* @param crossStatusTimeRateVO
* @param status
* @param rate
*/
private static void setStatusTimeRate(CrossStatusTimeRateVO crossStatusTimeRateVO, Integer status, int rate) {
if (status == 0) {
crossStatusTimeRateVO.setUnblockedTimeRate(rate);
}
......@@ -1948,13 +1965,6 @@ public class TrendServiceImpl implements TrendService {
crossStatusTimeRateVO.setPhaseEmptyTimeRate(rate);
}
}
}
} catch (Exception e) {
log.error("交通状态时间比例异常:", e);
throw new OptServiceException(e);
}
return crossStatusTimeRateVO;
}
@Override
public List<TableQueryVO.CycleDataElement> laneTrafficIndex(CommonCrossIdDateTimeVO crossIdDateTimeVO) throws Exception {
......
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