1.热门城市列表信息添加国际热门城市信息。
This commit is contained in:
parent
faf24581d9
commit
5f6a7103f7
|
@ -0,0 +1,15 @@
|
|||
package com.chint.application.dtos;
|
||||
|
||||
import com.chint.application.dtos.response.LocationRes;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HotCityResponseDto {
|
||||
|
||||
private List<LocationRes> internationalCitys; //热门国际城市
|
||||
|
||||
private List<LocationRes> internalCitys; //热门国内城市
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.chint.application.out;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.chint.application.dtos.HotCityResponseDto;
|
||||
import com.chint.application.dtos.LocationParam;
|
||||
import com.chint.application.dtos.response.LocationRes;
|
||||
import com.chint.domain.aggregates.order.Location;
|
||||
|
@ -64,7 +65,7 @@ public class LocationController {
|
|||
|
||||
@ApiOperation("获取热门城市")
|
||||
@PostMapping("/getHotCities")
|
||||
public Result<List<LocationRes>> getHotCities() {
|
||||
public Result<HotCityResponseDto> getHotCities() {
|
||||
|
||||
List<String> city = HotCityTag.citys;
|
||||
|
||||
|
@ -77,7 +78,23 @@ public class LocationController {
|
|||
.stream()
|
||||
.map(location -> BeanUtil.copyProperties(location, LocationRes.class)).toList();
|
||||
}
|
||||
return Result.Success(SUCCESS, locationRes);
|
||||
|
||||
|
||||
List<String> internationalCitys = HotCityTag.internationalCitys;
|
||||
List<LocationRes> internationalLocationRes = null;
|
||||
|
||||
List<Location> internationalLocations = locationRepository.findHotIntnationalCitiesByCityName(internationalCitys);
|
||||
if (internationalLocations != null && !internationalLocations.isEmpty()) {
|
||||
internationalLocationRes = internationalLocations
|
||||
.stream()
|
||||
.map(location -> BeanUtil.copyProperties(location, LocationRes.class)).toList();
|
||||
}
|
||||
|
||||
HotCityResponseDto dto = new HotCityResponseDto();
|
||||
dto.setInternalCitys(locationRes);
|
||||
dto.setInternationalCitys(internationalLocationRes);
|
||||
|
||||
return Result.Success(SUCCESS, dto);
|
||||
|
||||
}
|
||||
}
|
|
@ -6,9 +6,10 @@ import java.util.List;
|
|||
|
||||
public class HotCityTag {
|
||||
|
||||
// public static final HashMap<String, String> cityMap;
|
||||
public static final List<String> citys;
|
||||
|
||||
public static final List<String> internationalCitys;
|
||||
|
||||
static {
|
||||
citys = new ArrayList<>();
|
||||
|
||||
|
@ -24,6 +25,25 @@ public class HotCityTag {
|
|||
citys.add("杭州");
|
||||
citys.add("温州");
|
||||
|
||||
internationalCitys = new ArrayList<>();
|
||||
internationalCitys.add("北美洲_美国_纽约州_纽约_");
|
||||
internationalCitys.add("北美洲_美国_内华达州_拉斯维加斯_");
|
||||
internationalCitys.add("北美洲_美国_伊利诺伊州_芝加哥_");
|
||||
internationalCitys.add("北美洲_美国_华盛顿哥伦比亚特区_华盛顿_");
|
||||
internationalCitys.add("欧洲_英国_英格兰_伦敦_");
|
||||
internationalCitys.add("欧洲_德国_拜恩(巴伐利亚)_慕尼黑_");
|
||||
internationalCitys.add("欧洲_西班牙_加泰罗尼亚_巴塞罗那_");
|
||||
internationalCitys.add("欧洲_德国_柏林_柏林_");
|
||||
internationalCitys.add("北美洲_美国_纽约州_阿姆斯特丹_");
|
||||
internationalCitys.add("欧洲_法国_法兰西岛_巴黎_");
|
||||
internationalCitys.add("欧洲_西班牙_马德里_马德里_");
|
||||
internationalCitys.add("欧洲_葡萄牙_特茹河谷里斯本_里斯本_");
|
||||
internationalCitys.add("欧洲_奥地利_维也纳_维也纳_");
|
||||
internationalCitys.add("亚洲_日本_东京都_东京_");
|
||||
internationalCitys.add("欧洲_挪威_奥斯陆市_奥斯陆_");
|
||||
internationalCitys.add("北美洲_美国_加利福尼亚州_旧金山_");
|
||||
internationalCitys.add("亚洲_新加坡_新加坡_新加坡_");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,5 +25,9 @@ public interface LocationRepository {
|
|||
|
||||
List<Location> findHotCitiesByCityName(List<String> locationNames);
|
||||
|
||||
List<Location> findHotIntnationalCitiesByCityName(List<String> locationNames);
|
||||
|
||||
List<Location> findByNameList(List<Long> locationIds);
|
||||
|
||||
|
||||
}
|
|
@ -87,4 +87,19 @@ public class LocationRepositoryImpl implements LocationRepository {
|
|||
public List<Location> findHotCitiesByCityName(List<String> locationNames) {
|
||||
return jdbcLocationRepository.findByLocationNameInAndLocationPathContainingAndLevel(locationNames,"3106_1_",3);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Location> findHotIntnationalCitiesByCityName(List<String> locationNames){
|
||||
List<Location> hotCities =
|
||||
jdbcLocationRepository.findByLocationPathNameInAndLevel(locationNames,3);
|
||||
return hotCities;
|
||||
}
|
||||
|
||||
|
||||
// public List<Location> findHotIntnationalCitiesByCityName(List<String> locationNames) {
|
||||
// List<Location> hotCities =
|
||||
// jdbcLocationRepository.findByLocationPathNameAndLevel(locationNames,3);
|
||||
// return hotCities;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -27,7 +27,13 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
|
|||
|
||||
List<Location> findByLocationNameIn(Collection<String> locationName);
|
||||
|
||||
List<Location> findByLocationNameInAndLocationPathContainingAndLevel(Collection<String> locationName, String locationPath, Integer level);
|
||||
|
||||
List<Location> findByLocationIdIn(Collection<Long> locationId);
|
||||
|
||||
List<Location> findByLocationNameInAndLocationPathContainingAndLevel(Collection<String> locationName,
|
||||
String locationPath,
|
||||
Integer level);
|
||||
|
||||
List<Location> findByLocationPathNameInAndLevel(Collection<String> locationPathName,Integer level);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue