Commit e7f03570 authored by duanruiming's avatar duanruiming

[add] 优化绿波干线优化时间-逻辑优化版本

parent 4b0f54cf
......@@ -475,6 +475,13 @@ public class StrategyControlServiceImpl implements StrategyControlService {
for (Map.Entry<Integer, List<StrategyGreenOptHistEntity>> entry : listMap.entrySet()) {
Integer greenId = entry.getKey();
List<StrategyGreenOptHistEntity> value = entry.getValue();
// 策略正常结束
StrategyGreenOptHistEntity last = value.get(0);
if (Objects.nonNull(last) && Objects.equals(-1, last.getControlMethod())) {
Date parse = DateUtil.parse(last.getControlTime(), "yyyy-MM-dd HH:mm:ss");
long controlLong = parse.getTime();
endTime = controlLong;
}
for (StrategyGreenOptHistEntity entity : value) {
if (Objects.equals(0 , entity.getDirType())) {
continue;
......@@ -483,24 +490,14 @@ public class StrategyControlServiceImpl implements StrategyControlService {
Integer controlMethod = entity.getControlMethod();
Date parse = DateUtil.parse(controlTime, "yyyy-MM-dd HH:mm:ss");
long controlLong = parse.getTime();
// 优化次数:去掉-1, 剩余记录总数
long temp = endTime;
if (Objects.equals(-1, controlMethod)) {
endTime = parse.getTime();
continue;
} else {
// 优化次数:去掉-1, 剩余记录总数 当前情况未考虑多次启动停止
if (!Objects.equals(-1, controlMethod)) {
greenOptCount += 1;
// 最新数据与当前数据比较,小于30min
if (endTime - controlLong < 30 * 60 * 1000) {
temp = endTime;
endTime = current;
} else {
temp = endTime;
endTime = controlLong;
}
long temp = endTime;
int offset = (int) ((temp - controlLong) / 1000);
greenOptTime += offset;
}
int offset = (int) ((temp - controlLong) / 1000);
greenOptTime += offset;
endTime = controlLong;
}
}
}
......
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