Commit 2c828685 authored by duanruiming's avatar duanruiming

[add] 策略查询优化

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