Commit e4681840 authored by duanruiming's avatar duanruiming

[add] 策略库查询优化;AI绿波优化列表查询

parent 8b4fb5d5
...@@ -594,8 +594,8 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -594,8 +594,8 @@ public class StrategyControlServiceImpl implements StrategyControlService {
} }
} }
} }
Collections.sort(results, Comparator.comparingInt(StrategyControlDataExt::getStatus).reversed());
results.stream().distinct().sorted(Comparator.comparing(StrategyControlDataExt::getStatus).reversed()).collect(Collectors.toList()); results.stream().distinct().collect(Collectors.toList());
return results; return results;
} }
...@@ -619,10 +619,11 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -619,10 +619,11 @@ public class StrategyControlServiceImpl implements StrategyControlService {
currentAlgo = null; currentAlgo = null;
} }
if (Objects.isNull(currentAlgo)) { // 0无策略
if (Objects.isNull(currentAlgo) || Objects.equals(0, currentAlgo)) {
ext.setOptStatus("正常"); ext.setOptStatus("正常");
ext.setOptMethod("畅通"); ext.setOptMethod("畅通");
} else if (Objects.equals(1, currentAlgo)) { } else if (Objects.equals(2, currentAlgo)) {
ext.setOptStatus("优化中"); ext.setOptStatus("优化中");
ext.setOptMethod("均衡调控"); ext.setOptMethod("均衡调控");
} else { } else {
...@@ -1044,6 +1045,7 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -1044,6 +1045,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
LambdaQueryWrapper<StrategyFactoryEntity> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StrategyFactoryEntity> queryWrapper = new LambdaQueryWrapper<>();
if (Objects.isNull(vo)) { if (Objects.isNull(vo)) {
queryWrapper.orderByDesc(StrategyFactoryEntity::getId);
List<StrategyFactoryEntity> result = strategyFactoryMapper.selectList(queryWrapper); List<StrategyFactoryEntity> result = strategyFactoryMapper.selectList(queryWrapper);
jsonViewObject.success(result); jsonViewObject.success(result);
} else { } else {
...@@ -1063,6 +1065,7 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -1063,6 +1065,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
if (StringUtils.isNotBlank(vo.getCompany())) { if (StringUtils.isNotBlank(vo.getCompany())) {
queryWrapper.eq(StrategyFactoryEntity::getCompany, vo.getCompany()); queryWrapper.eq(StrategyFactoryEntity::getCompany, vo.getCompany());
} }
queryWrapper.orderByDesc(StrategyFactoryEntity::getId);
Page<StrategyFactoryEntity> result = strategyFactoryMapper.selectPage(page, queryWrapper); Page<StrategyFactoryEntity> result = strategyFactoryMapper.selectPage(page, queryWrapper);
jsonViewObject.success(result); jsonViewObject.success(result);
} }
...@@ -1080,7 +1083,7 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -1080,7 +1083,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
queryWrapper.eq(StrategyFactoryEntity::getStrategyNo, entity.getStrategyNo()); queryWrapper.eq(StrategyFactoryEntity::getStrategyNo, entity.getStrategyNo());
List<StrategyFactoryEntity> entities = strategyFactoryMapper.selectList(queryWrapper); List<StrategyFactoryEntity> entities = strategyFactoryMapper.selectList(queryWrapper);
if (Objects.nonNull(entities) && entities.size() > 0) { if (Objects.nonNull(entities) && entities.size() > 0) {
return jsonViewObject.fail("策略编号重复"); return jsonViewObject.success("策略编号重复, 请修改策略编号");
} }
strategyFactoryMapper.insert(entity); strategyFactoryMapper.insert(entity);
} }
......
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