Commit f39f08bc authored by duanruiming's avatar duanruiming

[add] 路口优化列表优化状态优化;策略保存优化运行计划删除逻辑

parent 102acda8
...@@ -679,10 +679,15 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -679,10 +679,15 @@ 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();
// 优化时间大于5分钟,默认优化完 // 计算结束时间
if (Objects.nonNull(issueTime) && current.getTime() - issueTime.getTime() > 5 * 60 * 1000) { if (Objects.nonNull(issueTime)) {
currentAlgo = null; if (Objects.equals(2, currentAlgo) && current.getTime() - issueTime.getTime() - duration * 1000 > 0) {
currentAlgo = null;
} else if (current.getTime() - issueTime.getTime() > 10 * 1000) {
currentAlgo = null;
}
} }
// 0无策略 // 0无策略
...@@ -835,6 +840,7 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -835,6 +840,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
StrategyControlDetailList.ExecutePlan executePlan = plans.get(0); StrategyControlDetailList.ExecutePlan executePlan = plans.get(0);
LambdaQueryWrapper<StrategyPlanInfoEntity> planDel = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StrategyPlanInfoEntity> planDel = new LambdaQueryWrapper<>();
planDel.eq(StrategyPlanInfoEntity::getCrossId, executePlan.getCrossId()); planDel.eq(StrategyPlanInfoEntity::getCrossId, executePlan.getCrossId());
strategyPlanInfoMapper.delete(planDel);
for (StrategyControlDetailList.ExecutePlan plan : plans) { for (StrategyControlDetailList.ExecutePlan plan : plans) {
StrategyPlanInfoEntity planInfoEntity = new StrategyPlanInfoEntity(); StrategyPlanInfoEntity planInfoEntity = new StrategyPlanInfoEntity();
planInfoEntity.setPlanId(plan.getPlanId()); planInfoEntity.setPlanId(plan.getPlanId());
...@@ -845,7 +851,6 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -845,7 +851,6 @@ public class StrategyControlServiceImpl implements StrategyControlService {
planInfoEntity.setCompany(plan.getCompany()); planInfoEntity.setCompany(plan.getCompany());
planInfoEntity.setName(plan.getName()); planInfoEntity.setName(plan.getName());
planInfoEntity.setPlanDetails(mapper.writeValueAsString(plan.getPlanDetails())); planInfoEntity.setPlanDetails(mapper.writeValueAsString(plan.getPlanDetails()));
strategyPlanInfoMapper.delete(planDel);
strategyPlanInfoMapper.insert(planInfoEntity); strategyPlanInfoMapper.insert(planInfoEntity);
} }
} }
......
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