Commit f39f08bc authored by duanruiming's avatar duanruiming

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

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