Commit 0f68cb81 authored by caotao's avatar caotao

场站图钉接口缺失逻辑补充

parent e2ff0cf5
...@@ -42,7 +42,7 @@ public interface StationBasicMapper extends BaseMapper<StationBasic> { ...@@ -42,7 +42,7 @@ public interface StationBasicMapper extends BaseMapper<StationBasic> {
); );
//获取场站列表信息 //获取场站列表信息
List<StationRecordInfo> getStationList(@Param("areaCode")String areaCode); List<StationRecordInfo> getStationList(@Param("regionId")String regionId);
int deleteStationCoordinateByStationid (@Param("sequence_nbr") Long sequence_nbr ); int deleteStationCoordinateByStationid (@Param("sequence_nbr") Long sequence_nbr );
int getStationPersonByStationID (@Param("sequence_nbr") String sequence_nbr ); int getStationPersonByStationID (@Param("sequence_nbr") String sequence_nbr );
......
...@@ -128,8 +128,8 @@ ...@@ -128,8 +128,8 @@
LEFT JOIN station_coordinate ON station_basic.sequence_nbr = station_coordinate.station_id LEFT JOIN station_coordinate ON station_basic.sequence_nbr = station_coordinate.station_id
GROUP BY GROUP BY
( station_basic.sequence_nbr )) ( station_basic.sequence_nbr ))
<if test="areaCode != null and areaCode != ''"> <if test="regionId != null and regionId != ''">
AND station_basic.area_code like concat('%',#{areaCode},'%') AND station_basic.belong_area like concat('%',#{regionId},'%')
</if> </if>
</select> </select>
<select id="getStationPersonByStationID" resultType="int"> <select id="getStationPersonByStationID" resultType="int">
......
...@@ -35,4 +35,8 @@ public class RegionServiceImpl extends BaseService<RegionDto,Region,RegionMapper ...@@ -35,4 +35,8 @@ public class RegionServiceImpl extends BaseService<RegionDto,Region,RegionMapper
public Region getRegionByRegionCode ( String regionCode){ public Region getRegionByRegionCode ( String regionCode){
return this.getOne(new QueryWrapper<Region>().eq("REGION_CODE",regionCode)); return this.getOne(new QueryWrapper<Region>().eq("REGION_CODE",regionCode));
} }
//根据regionName获取regionCode
public Region getRegionCodeByRegionName(String regionName) {
return this.getOne(new QueryWrapper<Region>().like("REGION_NAME",regionName).eq("LEVEL",1));
}
} }
\ No newline at end of file
...@@ -55,6 +55,8 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio ...@@ -55,6 +55,8 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio
IndicatorServiceImpl indicatorServiceImpl; IndicatorServiceImpl indicatorServiceImpl;
@Autowired @Autowired
RegionServiceImpl regionServiceImpl; RegionServiceImpl regionServiceImpl;
@Autowired
MapRegionServiceImpl mapRegionServiceImpl;
private final String CZLX = "CZLX"; private final String CZLX = "CZLX";
/** /**
...@@ -272,26 +274,47 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio ...@@ -272,26 +274,47 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio
} }
public List<StationInfoDto> getStationList(String areaCode, String type) { public List<StationInfoDto> getStationList(String areaCode, String type) {
List<StationInfoDto> stationInfoDtoList = new LinkedList<>(); List<StationInfoDto> stationInfoDtoList = new LinkedList<>();
List<Indicator> indicatorList= indicatorServiceImpl.getIndicatorByType(type); List<StationRecordInfo> list = new ArrayList<>();
List<StationRecordInfo> list = stationBasicMapper.getStationList(areaCode); List<Indicator> indicatorList = indicatorServiceImpl.getIndicatorByType(type);
if(list.isEmpty()){ if (areaCode != null) {
MapRegion mapRegion = mapRegionServiceImpl.getOne(new QueryWrapper<MapRegion>().eq("name", areaCode));
if (mapRegion != null) {
ArrayList<String> provinces = mapRegion.getProvince();
if (!provinces.isEmpty()) {
for (int i = 0; i < provinces.size(); i++) {
Region region = regionServiceImpl.getRegionCodeByRegionName(provinces.get(i));
if (region != null && region.getRegionCode() != null) {
list.addAll(stationBasicMapper.getStationList(String.valueOf(region.getRegionCode())));
}
}
}
} else {
Region region = regionServiceImpl.getRegionCodeByRegionName(areaCode);
if (region != null && region.getRegionCode() != null) {
list = stationBasicMapper.getStationList(String.valueOf(region.getRegionCode()));
}
}
}
if (list.isEmpty()) {
return stationInfoDtoList; return stationInfoDtoList;
}else{ } else {
list.forEach(stationRecordInfo ->{ list.forEach(stationRecordInfo -> {
StationInfoDto stationInfoDto =new StationInfoDto(); StationInfoDto stationInfoDto = new StationInfoDto();
stationInfoDto.setStationName(stationRecordInfo.getStationName()); stationInfoDto.setStationName(stationRecordInfo.getStationName());
stationInfoDto.setType(stationRecordInfo.getStationType()); stationInfoDto.setType(stationRecordInfo.getStationType());
//url 暂时写死
stationInfoDto.setUrl("https://tse4-mm.cn.bing.net/th/id/OIP-C.ySnewoc464X4Aecg9jl03AAAAA?w=162&h=180&c=7&r=0&o=5&pid=1.7"); stationInfoDto.setUrl("https://tse4-mm.cn.bing.net/th/id/OIP-C.ySnewoc464X4Aecg9jl03AAAAA?w=162&h=180&c=7&r=0&o=5&pid=1.7");
stationInfoDto.setJumpPath(stationRecordInfo.getJumpPath()); stationInfoDto.setJumpPath(stationRecordInfo.getJumpPath());
if(stationRecordInfo.getBelongArea()!=null){ if (stationRecordInfo.getBelongArea() != null) {
stationInfoDto.setRegion(this.getProviceName(stationRecordInfo.getBelongArea())); stationInfoDto.setRegion(this.getProviceName(stationRecordInfo.getBelongArea()));
} }
ArrayList<Double> arrayList=MapUtils.geoTo3d(Double.valueOf(stationRecordInfo.getLongitude()),Double.valueOf(stationRecordInfo.getLaitude())); ArrayList<Double> arrayList = MapUtils.geoTo3d(Double.valueOf(stationRecordInfo.getLongitude()), Double.valueOf(stationRecordInfo.getLaitude()));
stationInfoDto.setTitlePos(arrayList); stationInfoDto.setTitlePos(arrayList);
stationInfoDto.setIndicatorData(indicatorList); stationInfoDto.setIndicatorData(indicatorList);
stationInfoDtoList.add(stationInfoDto); stationInfoDtoList.add(stationInfoDto);
} ); });
} }
return stationInfoDtoList; return stationInfoDtoList;
} }
...@@ -300,13 +323,13 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio ...@@ -300,13 +323,13 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio
return stationBasicMapper.getStationPersonByStationID(id); return stationBasicMapper.getStationPersonByStationID(id);
} }
public String getProviceName (String belongArea){ public String getProviceName(String belongArea) {
String proviceName = "湖北"; String proviceName = "湖北";
if(belongArea!=null){ if (belongArea != null) {
String [] strings = belongArea.replace("[","").replace("]","").split(","); String[] strings = belongArea.replace("[", "").replace("]", "").split(",");
if(strings.length>0){ if (strings.length > 0) {
Region region =regionServiceImpl.getRegionByRegionCode(strings[0]); Region region = regionServiceImpl.getRegionByRegionCode(strings[0]);
proviceName = region.getRegionName().replace("省","").replace("市",""); proviceName = region.getRegionName().replace("省", "").replace("市", "");
} }
} }
return proviceName; return proviceName;
......
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