平台内部配送费的逻辑新增。细节调整默认值
This commit is contained in:
parent
3fbccbfd31
commit
390eca8b63
@ -22,13 +22,21 @@ public interface ShopStoreSameCityTransportService {
|
||||
*/
|
||||
CommonResult deleteShopStoreSameCityTransport(Long transportId);
|
||||
|
||||
/**
|
||||
* 根据店铺 Id 获取同城配送扩展设置列表
|
||||
*
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
List<ShopStoreSameCityTransport> selectShopStoreSameCityTransportList(Long storeId);
|
||||
|
||||
/**
|
||||
* 根据同城配送基础配置自增 Id 获取同城配送扩展设置列表
|
||||
*
|
||||
* @param transportBaseId
|
||||
* @return
|
||||
*/
|
||||
List<ShopStoreSameCityTransport> selectShopStoreSameCityTransportList(Long transportBaseId);
|
||||
List<ShopStoreSameCityTransport> selectShopStoreSameCityTransportListByTransportBaseId(Long transportBaseId);
|
||||
|
||||
/**
|
||||
* 保存同城配送扩展设置列表(存在就更新,不存在就新增)
|
||||
|
||||
@ -282,29 +282,50 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
||||
/**
|
||||
* 根据店铺 Id 获取同城配送设置详情信息
|
||||
*
|
||||
* @param storeId
|
||||
* @param isPlatform
|
||||
* @return
|
||||
* @param storeId 店铺ID
|
||||
* @param isPlatform 是否平台操作标识
|
||||
* @return 同城配送设置详情DTO
|
||||
*/
|
||||
@Override
|
||||
public ShopStoreSameCityTransportBaseDTO getShopStoreSameCityTransportBaseDTOById(Long storeId, Integer isPlatform) {
|
||||
// 参数校验
|
||||
if (storeId == null || storeId <= 0) {
|
||||
logger.warn("获取同城配送设置详情失败:店铺ID无效,storeId={}", storeId);
|
||||
return null;
|
||||
}
|
||||
|
||||
// 店铺基本信息
|
||||
// 获取店铺基本信息
|
||||
ShopStoreBase shopStoreBase = shopStoreBaseService.getShopStoreBaseByStoreId(storeId.intValue());
|
||||
if (shopStoreBase == null) {
|
||||
logger.warn("获取同城配送设置详情失败:店铺基本信息不存在,storeId={}", storeId);
|
||||
return null;
|
||||
}
|
||||
|
||||
// 获取同城配送基础设置记录
|
||||
ShopStoreSameCityTransportBase transportBase = getShopStoreSameCityTransportBaseById(storeId, isPlatform);
|
||||
|
||||
// 如果未找到对应记录,则根据不同角色处理
|
||||
if (transportBase == null) {
|
||||
if (isPlatform == CommonConstant.Enable) {
|
||||
// 平台用户:尝试从商家店铺配送设置中获取记录
|
||||
transportBase = getShopStoreSameCityTransportBaseById(storeId, CommonConstant.Disable2);
|
||||
if (transportBase == null) {
|
||||
logger.warn("获取同城配送设置详情失败:平台和商家配送设置均不存在,storeId={}", storeId);
|
||||
return null;
|
||||
} else {
|
||||
// 复用商家设置,但需要重置平台相关字段
|
||||
transportBase.setIs_platform(CommonConstant.Disable);
|
||||
transportBase.setTransport_base_id(null);
|
||||
transportBase.setStore_id(storeId);
|
||||
logger.debug("平台用户复用商家配送设置,storeId={}", storeId);
|
||||
}
|
||||
} else {
|
||||
// 商家用户:创建默认配送设置
|
||||
transportBase = new ShopStoreSameCityTransportBase();
|
||||
transportBase.setStore_id(storeId);
|
||||
|
||||
transportBase.setIs_platform(isPlatform);
|
||||
// 没有记录时,指定默认值
|
||||
|
||||
// 设置默认值
|
||||
transportBase.setArea_type(1);
|
||||
transportBase.setBasis(1);
|
||||
transportBase.setDistance_base(5);
|
||||
@ -316,26 +337,38 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
||||
transportBase.setWeight_increase_fee(BigDecimal.valueOf(1));
|
||||
transportBase.setStatus(CommonConstant.Enable);
|
||||
|
||||
// 设置时间戳
|
||||
Date now = new Date();
|
||||
transportBase.setCreated_at(now);
|
||||
transportBase.setUpdated_at(transportBase.getCreated_at());
|
||||
transportBase.setUpdated_at(now);
|
||||
|
||||
// 从 shop_store_base 表获取店铺的地址和经纬度
|
||||
// 从店铺基本信息中获取地址和经纬度
|
||||
transportBase.setStore_address(StrUtil.removeAll(shopStoreBase.getStore_area(), "/") + shopStoreBase.getStore_address());
|
||||
transportBase.setStore_longitude(shopStoreBase.getStore_longitude());
|
||||
transportBase.setStore_latitude(shopStoreBase.getStore_latitude());
|
||||
|
||||
logger.debug("为商家创建默认配送设置,storeId={}", storeId);
|
||||
}
|
||||
}
|
||||
|
||||
// 构造返回DTO
|
||||
ShopStoreSameCityTransportBaseDTO shopStoreSameCityTransportBaseDTO = new ShopStoreSameCityTransportBaseDTO();
|
||||
shopStoreSameCityTransportBaseDTO.setTransportBase(transportBase);
|
||||
|
||||
// 多个店铺同城快递运费设置(起送条件+优惠条件)
|
||||
List<ShopStoreSameCityTransport> transportList = shopStoreSameCityTransportService.selectShopStoreSameCityTransportList(transportBase.getStore_id());
|
||||
// 获取配送扩展设置列表
|
||||
List<ShopStoreSameCityTransport> transportList;
|
||||
if (CheckUtil.isEmpty(transportBase.getTransport_base_id())) {
|
||||
transportList = shopStoreSameCityTransportService.selectShopStoreSameCityTransportList(transportBase.getStore_id());
|
||||
} else {
|
||||
transportList = shopStoreSameCityTransportService.selectShopStoreSameCityTransportListByTransportBaseId(transportBase.getTransport_base_id());
|
||||
}
|
||||
shopStoreSameCityTransportBaseDTO.setTransportList(transportList);
|
||||
|
||||
logger.debug("成功获取店铺 {} 的同城配送设置详情", storeId);
|
||||
return shopStoreSameCityTransportBaseDTO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据店铺Id获取同城配送基础运费记录
|
||||
*
|
||||
|
||||
@ -62,6 +62,31 @@ public class ShopStoreSameCityTransportServiceImpl extends BaseServiceImpl<ShopS
|
||||
return CommonResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据同城配送基础配置自增 Id 获取同城配送扩展设置列表
|
||||
*
|
||||
* @param transportBaseId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ShopStoreSameCityTransport> selectShopStoreSameCityTransportListByTransportBaseId(Long transportBaseId) {
|
||||
if (transportBaseId == null || transportBaseId <= 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
QueryWrapper<ShopStoreSameCityTransport> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("transport_base_id", transportBaseId);
|
||||
queryWrapper.eq("status", CommonConstant.Enable);
|
||||
queryWrapper.orderByAsc("transport_id");
|
||||
|
||||
List<ShopStoreSameCityTransport> shopStoreSameCityTransportList = list(queryWrapper);
|
||||
if (CollectionUtil.isEmpty(shopStoreSameCityTransportList)) {
|
||||
shopStoreSameCityTransportList = Collections.emptyList();
|
||||
}
|
||||
|
||||
return shopStoreSameCityTransportList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据同城配送基础配置自增 Id 获取同城配送扩展设置列表
|
||||
*
|
||||
|
||||
10
pom.xml
10
pom.xml
@ -539,11 +539,6 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
@ -571,7 +566,9 @@
|
||||
<goal>build</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
|
||||
</executions>
|
||||
|
||||
<configuration>
|
||||
<!--定义镜像名称-->
|
||||
<imageName>${docker.registry}/mall/${project.artifactId}:${project.version}</imageName>
|
||||
@ -592,7 +589,7 @@
|
||||
<forceTags>true</forceTags>
|
||||
<imageTags>
|
||||
<imageTag>${project.version}</imageTag>
|
||||
<!-- <imageTag>latest</imageTag>-->
|
||||
<imageTag>latest</imageTag>
|
||||
</imageTags>
|
||||
|
||||
<!--定义容器启动命令,注意不能换行-->
|
||||
@ -609,6 +606,7 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user