Commit 2c828685 authored by duanruiming's avatar duanruiming

[add] 策略查询优化

parent 023c4b35
...@@ -351,6 +351,10 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -351,6 +351,10 @@ public class StrategyControlServiceImpl implements StrategyControlService {
strategyControlDataEntity.setTime(null); strategyControlDataEntity.setTime(null);
strategyControlDataEntity.setStatus(status); strategyControlDataEntity.setStatus(status);
strategyControlDataEntity.setCrossName(baseCrossInfoPO.getName()); strategyControlDataEntity.setCrossName(baseCrossInfoPO.getName());
strategyControlDataEntity.setOptMethod("效率提升");
if (Objects.equals(1, status)) {
strategyControlDataEntity.setOptMethod("均衡调控");
}
String location = baseCrossInfoPO.getLocationStr(); String location = baseCrossInfoPO.getLocationStr();
location = location.replace("POINT(", "").replace(" ", ",").replace(")", ""); location = location.replace("POINT(", "").replace(" ", ",").replace(")", "");
strategyControlDataEntity.setWkt(location); strategyControlDataEntity.setWkt(location);
...@@ -1106,6 +1110,7 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -1106,6 +1110,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try { try {
ObjectMapper instance = JacksonUtils.getInstance(); ObjectMapper instance = JacksonUtils.getInstance();
StrategyNameCrossVO strategyNameCrossVO = new StrategyNameCrossVO();
// 通过当前时间获取当前日计划编号 // 通过当前时间获取当前日计划编号
Integer currentDailyPlanId = 1; Integer currentDailyPlanId = 1;
String currentStrategyNo = ""; String currentStrategyNo = "";
...@@ -1158,7 +1163,9 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -1158,7 +1163,9 @@ public class StrategyControlServiceImpl implements StrategyControlService {
if (currentTime.after(startHourDate) && currentTime.before(endHourDate)) { if (currentTime.after(startHourDate) && currentTime.before(endHourDate)) {
currentStrategyNo = strategyNo; currentStrategyNo = strategyNo;
} }
strategyNoList.add(strategyNo); if (StringUtils.isNotBlank(strategyNo)) {
strategyNoList.add(strategyNo);
}
} }
} }
} }
...@@ -1167,7 +1174,9 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -1167,7 +1174,9 @@ public class StrategyControlServiceImpl implements StrategyControlService {
// 通过策略编号获取策略名称 // 通过策略编号获取策略名称
LambdaQueryWrapper<StrategyFactoryEntity> factoryQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StrategyFactoryEntity> factoryQuery = new LambdaQueryWrapper<>();
factoryQuery.in(StrategyFactoryEntity::getStrategyNo, strategyNoList); if (!CollectionUtils.isEmpty(strategyNoList)) {
factoryQuery.in(StrategyFactoryEntity::getStrategyNo, strategyNoList);
}
List<StrategyFactoryEntity> factoryEntities = strategyFactoryMapper.selectList(factoryQuery); List<StrategyFactoryEntity> factoryEntities = strategyFactoryMapper.selectList(factoryQuery);
String currentName = ""; String currentName = "";
List<String> strategyNames = new ArrayList<>(); List<String> strategyNames = new ArrayList<>();
...@@ -1183,15 +1192,22 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -1183,15 +1192,22 @@ public class StrategyControlServiceImpl implements StrategyControlService {
} }
} }
StrategyNameCrossVO strategyNameCrossVO = new StrategyNameCrossVO(); if (StringUtils.isNotBlank(currentName)) {
strategyNameCrossVO.setCurrentName(currentName); strategyNameCrossVO.setCurrentName(currentName);
} else {
StrategyFactoryEntity strategyFactoryEntity = factoryEntities.get(0);
String company = strategyFactoryEntity.getCompany();
String strategyName = strategyFactoryEntity.getStrategyName();
String method = strategyFactoryEntity.getMethod();
String name = String.join("-", company, method, strategyName);
strategyNameCrossVO.setCurrentName(name);
}
strategyNameCrossVO.setStrategyNames(strategyNames); strategyNameCrossVO.setStrategyNames(strategyNames);
return jsonViewObject.success(strategyNameCrossVO);
} }
return jsonViewObject.success(strategyNameCrossVO);
} catch (Exception e) { } catch (Exception e) {
log.error("策略管理-路口详情-优化策略查询, {}", e); log.error("策略管理-路口详情-优化策略查询, {}", e);
return jsonViewObject.fail("策略管理-路口详情-优化策略查询失败"); return jsonViewObject.fail("策略管理-路口详情-优化策略查询失败");
} }
return jsonViewObject.fail("策略管理-路口详情-优化策略查询失败");
} }
} }
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