fix:修改台站管理 自建台站类型没有数据问题

This commit is contained in:
xiaoguangbin 2024-11-07 09:28:34 +08:00
parent 00f56418d5
commit 30d88aa5e3
3 changed files with 9 additions and 7 deletions

View File

@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Component
@ -26,11 +27,7 @@ public class StationTypeUtil {
for (StationType stationType:stationTypeList) {
if (StringUtils.isNotBlank(stationType.getMinId()) && StringUtils.isNotBlank(stationType.getMaxId())){
if (stationId>Integer.valueOf(stationType.getMinId()) && stationId<=Integer.valueOf(stationType.getMaxId())){
if (category == 3) {
type = "Car";
} else if (category == 4) {
type = "Ship";
} else {
if (Objects.equals(category, stationType.getCategory())) {
type = stationType.getName();
}
}

View File

@ -19,6 +19,8 @@ public class StationType implements Serializable {
private String maxId;
private Integer category;
private List<StationType> types = new ArrayList<>();
}

View File

@ -60,6 +60,9 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
@Autowired
private StationTypeUtil stationTypeUtil;
@Autowired
private StationType stationType;
private final SpatialContext spatialContext = SpatialContext.GEO;
@Override
@ -133,8 +136,8 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
@Override
public Result findInfo(String stationId, String type) {
Result result = new Result();
if (type.equals("IMS STATION(P)") || type.equals("IMS STATION(G)") || type.equals("NRL")
|| type.equals("Car")|| type.equals("Ship")){
List<String> stationTypes = stationType.getTypes().stream().map(StationType::getName).collect(Collectors.toList());
if (stationTypes.contains(type)){
HashMap<String, GardsStations> stationInfoMap = (HashMap<String, GardsStations>) redisUtil.get("stationInfoMap");
GardsStations stations = stationInfoMap.get(stationId);
if (Objects.nonNull(stations)){