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

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

@@ -6,7 +6,10 @@ CREATE TABLE merchant_flagship_store
id int8 NOT NULL PRIMARY KEY, -- [主键] id int8 NOT NULL PRIMARY KEY, -- [主键]
store_name VARCHAR(255) NOT NULL, -- 商家全称 store_name VARCHAR(255) NOT NULL, -- 商家全称
contact_phone VARCHAR(20), -- 商家联系电话 contact_phone VARCHAR(20), -- 商家联系电话
province_id int8 NOT NULL,
city_id int8 NOT NULL,
regions_id int8 NOT NULL, regions_id int8 NOT NULL,
region_name text NOT NULL, -- 地区名
full_address text NOT NULL, -- 详细地址 full_address text NOT NULL, -- 详细地址
location geometry(Point, 4326) NOT NULL, -- 门店经纬度坐标(用于地图打点和距离计算) location geometry(Point, 4326) NOT NULL, -- 门店经纬度坐标(用于地图打点和距离计算)
thumbnail_url text, -- 缩略图 thumbnail_url text, -- 缩略图
@@ -28,7 +31,10 @@ COMMENT ON TABLE merchant_flagship_store IS '商家旗舰店信息表';
COMMENT ON COLUMN merchant_flagship_store.id IS '主键 ID'; COMMENT ON COLUMN merchant_flagship_store.id IS '主键 ID';
COMMENT ON COLUMN merchant_flagship_store.store_name IS '店铺名字'; COMMENT ON COLUMN merchant_flagship_store.store_name IS '店铺名字';
COMMENT ON COLUMN merchant_flagship_store.contact_phone IS '商家联系电话'; COMMENT ON COLUMN merchant_flagship_store.contact_phone IS '商家联系电话';
COMMENT ON COLUMN merchant_flagship_store.province_id IS '省份id';
COMMENT ON COLUMN merchant_flagship_store.city_id IS '城市id';
COMMENT ON COLUMN merchant_flagship_store.regions_id IS '地址id'; COMMENT ON COLUMN merchant_flagship_store.regions_id IS '地址id';
COMMENT ON COLUMN merchant_flagship_store.region_name IS '地区名';
COMMENT ON COLUMN merchant_flagship_store.full_address IS '完整详细地址'; COMMENT ON COLUMN merchant_flagship_store.full_address IS '完整详细地址';
COMMENT ON COLUMN merchant_flagship_store.location IS '地理坐标 POINT(经度,纬度),用于地图定位和距离计算'; COMMENT ON COLUMN merchant_flagship_store.location IS '地理坐标 POINT(经度,纬度),用于地图定位和距离计算';
COMMENT ON COLUMN merchant_flagship_store.main_image_url IS '商家主图'; COMMENT ON COLUMN merchant_flagship_store.main_image_url IS '商家主图';
@@ -224,6 +230,8 @@ CREATE TABLE tour_product
description text DEFAULT NULL, -- 产品详情描述 description text DEFAULT NULL, -- 产品详情描述
visit_count int4 DEFAULT 0, -- 已成团次数/销量 visit_count int4 DEFAULT 0, -- 已成团次数/销量
rating decimal(3, 2) DEFAULT 0.00, -- 用户评分 rating decimal(3, 2) DEFAULT 0.00, -- 用户评分
province_id int8 NOT NULL,
city_id int8 NOT NULL,
create_user int8 NULL, -- 创建人ID create_user int8 NULL, -- 创建人ID
create_dept int8 NULL, -- 创建部门ID create_dept int8 NULL, -- 创建部门ID
create_time timestamp(6) NULL, -- 创建时间 create_time timestamp(6) NULL, -- 创建时间
@@ -259,6 +267,8 @@ COMMENT ON COLUMN tour_product.require_hk_macau_pass IS '是否强制港澳通
COMMENT ON COLUMN tour_product.description IS '产品详情描述'; COMMENT ON COLUMN tour_product.description IS '产品详情描述';
COMMENT ON COLUMN tour_product.visit_count IS '已成团次数/销量'; COMMENT ON COLUMN tour_product.visit_count IS '已成团次数/销量';
COMMENT ON COLUMN tour_product.rating IS '用户评分'; COMMENT ON COLUMN tour_product.rating IS '用户评分';
COMMENT ON COLUMN tour_product.province_id IS '省份id';
COMMENT ON COLUMN tour_product.city_id IS '城市id';
COMMENT ON COLUMN tour_product.create_user IS '创建人ID'; COMMENT ON COLUMN tour_product.create_user IS '创建人ID';
COMMENT ON COLUMN tour_product.create_dept IS '创建部门ID'; COMMENT ON COLUMN tour_product.create_dept IS '创建部门ID';
COMMENT ON COLUMN tour_product.create_time IS '创建时间'; COMMENT ON COLUMN tour_product.create_time IS '创建时间';

View File

@@ -43,10 +43,11 @@ public class MerchantFlagshipStoreEntity extends BaseEntity {
*/ */
@Schema(description = "地址id") @Schema(description = "地址id")
private Long regionsId; private Long regionsId;
private String regionName;
/** /**
* 完整详细地址文本 * 详细地址
*/ */
@Schema(description = "完整详细地址文本") @Schema(description = "详细地址")
private String fullAddress; private String fullAddress;
/** /**
* 地理坐标 POINT(经度,纬度),用于地图定位和距离计算 * 地理坐标 POINT(经度,纬度),用于地图定位和距离计算
@@ -87,6 +88,10 @@ public class MerchantFlagshipStoreEntity extends BaseEntity {
@Schema(description = "商家详细介绍") @Schema(description = "商家详细介绍")
private String storeDescription; private String storeDescription;
private Long provinceId;
private Long cityId;
public void setLocation(double longitude, double latitude) { public void setLocation(double longitude, double latitude) {
this.location = new org.locationtech.jts.geom.GeometryFactory() 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") @Schema(description = "评分,范围0.00~5.00")
private BigDecimal rating; 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 { public class MerchantFlagshipStoreVO extends MerchantFlagshipStoreEntity {
private Long area;
private String addressDetail; private String addressDetail;
} }

View File

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

View File

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

View File

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