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

View File

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

View File

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