mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 03:09:19 +08:00
feat: 授权店铺内部店铺无logo自动同步
This commit is contained in:
@@ -12,6 +12,7 @@ CREATE TABLE `ec_shop` (
|
||||
`company_id` bigint UNSIGNED NOT NULL COMMENT '所属公司ID',
|
||||
`name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '店铺名称',
|
||||
`logo_image_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT 'logo图片ID',
|
||||
`logo_url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'logo外链URL(渠道授权等;查询时有 logo_image_id 则覆盖)',
|
||||
`platform_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '平台代码(软约定枚举,无平台表)',
|
||||
`external_shop_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '外部店铺ID(如拼多多 mall_id;与 platform_code 组合关联平台店铺)',
|
||||
`order_inc_sync_enabled` tinyint NOT NULL DEFAULT 0 COMMENT '订单增量同步开关:0关 1开(产品配置,与渠道运行态分离)',
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- 店铺 logo 外链:系统上传仍用 logo_image_id;查询时有 id 则覆盖 url;授权无内部图时回填
|
||||
ALTER TABLE `ec_shop`
|
||||
ADD COLUMN `logo_url` varchar(512) NULL DEFAULT NULL COMMENT 'logo外链URL(渠道授权等;查询时有 logo_image_id 则覆盖)' AFTER `logo_image_id`;
|
||||
+8
-8
@@ -181,7 +181,7 @@ public class PddAuthServiceImpl implements PddAuthService {
|
||||
}
|
||||
|
||||
upsertPddShop(companyId, auth.getId(), mallId, mallInfo, tokenResponse.getOwnerName());
|
||||
bindInternalShop(companyId, userId, shopId, mallId, mallInfo, tokenResponse.getOwnerName());
|
||||
bindInternalShop(companyId, userId, shopId, mallId, mallInfo);
|
||||
|
||||
String shopName = firstNonBlank(
|
||||
mallInfo != null ? mallInfo.getMallName() : null,
|
||||
@@ -332,8 +332,7 @@ public class PddAuthServiceImpl implements PddAuthService {
|
||||
Long userId,
|
||||
Long shopId,
|
||||
Long mallId,
|
||||
PddMallApiSnapshot mallInfo,
|
||||
String ownerName) {
|
||||
PddMallApiSnapshot mallInfo) {
|
||||
ShopPO shop = shopMapper.selectById(shopId);
|
||||
if (shop == null || !companyId.equals(shop.getCompanyId())) {
|
||||
throw new BusinessException("授权关联的内部店铺不存在或不属于当前公司");
|
||||
@@ -361,11 +360,12 @@ public class PddAuthServiceImpl implements PddAuthService {
|
||||
}
|
||||
|
||||
shop.setExternalShopId(externalShopId);
|
||||
String mallName = firstNonBlank(
|
||||
mallInfo != null ? mallInfo.getMallName() : null,
|
||||
ownerName);
|
||||
if (StringUtils.hasText(mallName)) {
|
||||
shop.setName(mallName);
|
||||
// 无系统内部 logo 时,用授权店铺 logo 填充外链(与商品渠道图口径一致)
|
||||
if (shop.getLogoImageId() == null
|
||||
&& !StringUtils.hasText(shop.getLogoUrl())
|
||||
&& mallInfo != null
|
||||
&& StringUtils.hasText(mallInfo.getLogo())) {
|
||||
shop.setLogoUrl(mallInfo.getLogo().trim());
|
||||
}
|
||||
shop.setUpdateBy(userId);
|
||||
shopMapper.updateById(shop);
|
||||
|
||||
+6
@@ -38,6 +38,12 @@ public class ShopPO {
|
||||
@TableField("logo_image_id")
|
||||
private Long logoImageId;
|
||||
|
||||
/**
|
||||
* logo 外链 URL(渠道授权等;查询时有 logo_image_id 则覆盖)
|
||||
*/
|
||||
@TableField("logo_url")
|
||||
private String logoUrl;
|
||||
|
||||
/**
|
||||
* 平台代码(软约定,见 PlatformCode)
|
||||
*/
|
||||
|
||||
+2
-2
@@ -32,9 +32,9 @@ public class ShopVO {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* logo URL
|
||||
* logo URL(有 logo_image_id 时为系统文件访问地址,否则为 logo_url 外链)
|
||||
*/
|
||||
@Schema(description = "logo URL", example = "https://example.com/logo.jpg")
|
||||
@Schema(description = "logo URL(有系统文件 id 时覆盖外链)", example = "https://example.com/logo.jpg")
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
|
||||
+8
-1
@@ -238,8 +238,15 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopPO> implements
|
||||
ShopVO shopVO = new ShopVO();
|
||||
BeanCopyUtils.copyProperties(shop, shopVO);
|
||||
|
||||
// 有系统文件 id 则覆盖;否则用渠道外链 logo_url(与商品 mainImage 口径一致)
|
||||
if (shop.getLogoImageId() != null) {
|
||||
shopVO.setLogo(sysFileService.getFileAccessUrl(shop.getLogoImageId()));
|
||||
String accessUrl = sysFileService.getFileAccessUrl(shop.getLogoImageId());
|
||||
if (accessUrl != null && !accessUrl.isBlank()) {
|
||||
shopVO.setLogo(accessUrl);
|
||||
}
|
||||
}
|
||||
if (shopVO.getLogo() == null || shopVO.getLogo().isBlank()) {
|
||||
shopVO.setLogo(shop.getLogoUrl());
|
||||
}
|
||||
if (shop.getPlatformCode() != null && !shop.getPlatformCode().isBlank()) {
|
||||
shopVO.setPlatformName(PlatformCode.labelOf(shop.getPlatformCode()));
|
||||
|
||||
Reference in New Issue
Block a user