后台商家和旅游团地址选择后回显

This commit is contained in:
2026-03-29 15:25:56 +08:00
parent f3e626050b
commit b15c8e82d0
7 changed files with 68 additions and 41 deletions

View File

@@ -43,10 +43,11 @@ public class MerchantFlagshipStoreEntity extends BaseEntity {
*/
@Schema(description = "地址id")
private Long regionsId;
private String regionName;
/**
* 完整详细地址文本
* 详细地址
*/
@Schema(description = "完整详细地址文本")
@Schema(description = "详细地址")
private String fullAddress;
/**
* 地理坐标 POINT(经度,纬度),用于地图定位和距离计算
@@ -87,6 +88,10 @@ public class MerchantFlagshipStoreEntity extends BaseEntity {
@Schema(description = "商家详细介绍")
private String storeDescription;
private Long provinceId;
private Long cityId;
public void setLocation(double longitude, double latitude) {
this.location = new org.locationtech.jts.geom.GeometryFactory()

View File

@@ -131,5 +131,10 @@ public class TourProductEntity extends BaseEntity {
@Schema(description = "评分,范围0.00~5.00")
private BigDecimal rating;
private Long provinceId;
private Long cityId;
}

View File

@@ -17,7 +17,6 @@ import org.springblade.modules.common.pojo.entity.MerchantFlagshipStoreEntity;
public class MerchantFlagshipStoreVO extends MerchantFlagshipStoreEntity {
private Long area;
private String addressDetail;
}

View File

@@ -42,6 +42,4 @@ public class TourProductVO extends TourProductEntity {
@Serial
private static final long serialVersionUID = 1L;
private Long city;
}

View File

@@ -42,11 +42,11 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
@Override
public boolean saveStore(MerchantFlagshipStoreVO storeVO) {
if (storeVO.getArea() == null){
if (storeVO.getRegionsId() == null){
throw new ServiceException("请选择地址");
}
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getArea());
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getRegionsId());
if (regionsInfo == null){
throw new ServiceException("请选择正确的地址");
}
@@ -57,7 +57,10 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
store.setLocation(locationDTO.getLongitude() , locationDTO.getLatitude());
store.setRegionsId(regionsInfo.getId());
store.setFullAddress(regionsInfo.getFullName() + storeVO.getAddressDetail());
store.setProvinceId(storeVO.getProvinceId());
store.setCityId(storeVO.getCityId());
store.setFullAddress( storeVO.getFullAddress());
store.setRegionName( regionsInfo.getFullName());
store.setStoreName(storeVO.getStoreName());
store.setContactPhone(storeVO.getContactPhone());
@@ -74,11 +77,11 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
@Override
public boolean updateStore(MerchantFlagshipStoreVO storeVO) {
if (storeVO.getArea() == null) {
if (storeVO.getRegionsId() == null) {
throw new ServiceException("请选择地址");
}
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getArea());
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getRegionsId());
if (regionsInfo == null) {
throw new ServiceException("请选择正确的地址");
}
@@ -89,7 +92,10 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
store.setLocation(locationDTO.getLongitude(), locationDTO.getLatitude());
store.setRegionsId(regionsInfo.getId());
store.setFullAddress(regionsInfo.getFullName() + storeVO.getAddressDetail());
store.setProvinceId(storeVO.getProvinceId());
store.setCityId(storeVO.getCityId());
store.setFullAddress( storeVO.getFullAddress());
store.setRegionName( regionsInfo.getFullName());
store.setId(storeVO.getId());
store.setStoreName(storeVO.getStoreName());

View File

@@ -47,11 +47,11 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
throw new ServiceException("评分在0.1在5.0之间");
}
if (tourProduct.getCity() == null){
if (tourProduct.getCityId() == null){
throw new ServiceException("请选择地址");
}
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCity());
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCityId());
if (regionsInfo == null){
throw new ServiceException("请选择正确的地址");
}
@@ -63,7 +63,9 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
tourProductEntity.setThumbnailUrl(tourProduct.getThumbnailUrl());
tourProductEntity.setMainImageUrl(tourProduct.getMainImageUrl());
tourProductEntity.setDetailImages(tourProduct.getDetailImages());
tourProductEntity.setCityName(regionsInfo.getName());
tourProductEntity.setCityName(regionsInfo.getFullName());
tourProductEntity.setProvinceId(tourProduct.getProvinceId());
tourProductEntity.setCityId(tourProduct.getCityId());
tourProductEntity.setDurationDays(tourProduct.getDurationDays());
tourProductEntity.setDurationNights(tourProduct.getDurationNights());
tourProductEntity.setBasePrice(tourProduct.getBasePrice());
@@ -95,10 +97,10 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
}
if (tourProduct.getCity() == null){
if (tourProduct.getCityId() == null){
throw new ServiceException("请选择地址");
}
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCity());
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCityId());
if (regionsInfo == null){
throw new ServiceException("请选择正确的地址");
}
@@ -110,7 +112,9 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
tourProductEntity.setThumbnailUrl(tourProduct.getThumbnailUrl());
tourProductEntity.setMainImageUrl(tourProduct.getMainImageUrl());
tourProductEntity.setDetailImages(tourProduct.getDetailImages());
tourProductEntity.setCityName(regionsInfo.getName());
tourProductEntity.setCityName(regionsInfo.getFullName());
tourProductEntity.setProvinceId(tourProduct.getProvinceId());
tourProductEntity.setCityId(tourProduct.getCityId());
tourProductEntity.setDurationDays(tourProduct.getDurationDays());
tourProductEntity.setDurationNights(tourProduct.getDurationNights());
tourProductEntity.setBasePrice(tourProduct.getBasePrice());