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

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, -- [主键]
store_name VARCHAR(255) NOT NULL, -- 商家全称
contact_phone VARCHAR(20), -- 商家联系电话
province_id int8 NOT NULL,
city_id int8 NOT NULL,
regions_id int8 NOT NULL,
region_name text NOT NULL, -- 地区名
full_address text NOT NULL, -- 详细地址
location geometry(Point, 4326) NOT NULL, -- 门店经纬度坐标(用于地图打点和距离计算)
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.store_name 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.region_name 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.main_image_url IS '商家主图';
@@ -204,33 +210,35 @@ CREATE TABLE tour_product
(
id int8 NOT NULL PRIMARY KEY, -- 主键ID
product_name varchar(100) NOT NULL, -- 产品名称 (如:恩施硒茶文化之旅)
sub_title varchar(255) DEFAULT NULL, -- 副标题/亮点 (如:4天3晚 | 研学之旅)
thumbnail_url text DEFAULT NULL, -- 缩略图
sub_title varchar(255) DEFAULT NULL, -- 副标题/亮点 (如:4天3晚 | 研学之旅)
thumbnail_url text DEFAULT NULL, -- 缩略图
main_image_url text[] DEFAULT '{}'::text[], -- 商家主图 (数组)
detail_images text[] DEFAULT '{}'::text[], -- 详情展示多图 (数组)
city_name varchar(50) DEFAULT NULL, -- 目的地城市名称
duration_days int4 DEFAULT NULL, -- 行程天数
duration_nights int4 DEFAULT NULL, -- 住宿晚数
city_name varchar(50) DEFAULT NULL, -- 目的地城市名称
duration_days int4 DEFAULT NULL, -- 行程天数
duration_nights int4 DEFAULT NULL, -- 住宿晚数
base_price decimal(10, 2) NOT NULL, -- 基础起售价
adult_price decimal(10, 2) DEFAULT NULL, -- 成人单价
child_price decimal(10, 2) DEFAULT NULL, -- 儿童单价
elderly_price decimal(10, 2) DEFAULT NULL, -- 老年人单价
min_people int4 DEFAULT 1, -- 最小成团人数
max_people int4 DEFAULT 9999, -- 最大接待人数
is_recommended int4 DEFAULT 0, -- 是否推荐
require_id_card int4 DEFAULT 0, -- 是否强制身份证
require_passport int4 DEFAULT 0, -- 是否强制护照
require_hk_macau_pass int4 DEFAULT 0, -- 是否强制港澳通行证
description text DEFAULT NULL, -- 产品详情描述
visit_count int4 DEFAULT 0, -- 已成团次数/销量
rating decimal(3, 2) DEFAULT 0.00, -- 用户评分
create_user int8 NULL, -- 创建人ID
create_dept int8 NULL, -- 创建部门ID
create_time timestamp(6) NULL, -- 创建时间
update_user int8 NULL, -- 修改人ID
update_time timestamp(6) NULL, -- 修改时间
status int4 NULL DEFAULT 1, -- 状态:0=下架,1=上架
is_deleted int4 DEFAULT 0 NULL -- 是否已删除:0=未删除,1=已删除
adult_price decimal(10, 2) DEFAULT NULL, -- 成人单价
child_price decimal(10, 2) DEFAULT NULL, -- 儿童单价
elderly_price decimal(10, 2) DEFAULT NULL, -- 老年人单价
min_people int4 DEFAULT 1, -- 最小成团人数
max_people int4 DEFAULT 9999, -- 最大接待人数
is_recommended int4 DEFAULT 0, -- 是否推荐
require_id_card int4 DEFAULT 0, -- 是否强制身份证
require_passport int4 DEFAULT 0, -- 是否强制护照
require_hk_macau_pass int4 DEFAULT 0, -- 是否强制港澳通行证
description text DEFAULT NULL, -- 产品详情描述
visit_count int4 DEFAULT 0, -- 已成团次数/销量
rating decimal(3, 2) DEFAULT 0.00, -- 用户评分
province_id int8 NOT NULL,
city_id int8 NOT NULL,
create_user int8 NULL, -- 创建人ID
create_dept int8 NULL, -- 创建部门ID
create_time timestamp(6) NULL, -- 创建时间
update_user int8 NULL, -- 修改人ID
update_time timestamp(6) NULL, -- 修改时间
status int4 NULL DEFAULT 1, -- 状态:0=下架,1=上架
is_deleted int4 DEFAULT 0 NULL -- 是否已删除:0=未删除,1=已删除
);
-- 添加表注释
@@ -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.visit_count 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_dept IS '创建部门ID';
COMMENT ON COLUMN tour_product.create_time IS '创建时间';

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());