mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 01:19:19 +08:00
feat: 授权店铺内部店铺无logo自动同步
This commit is contained in:
+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