feat: 优化店铺相关

This commit is contained in:
2026-08-14 11:44:22 +08:00
parent 3322b0542b
commit 8921c6b122
37 changed files with 558 additions and 241 deletions
@@ -222,8 +222,6 @@ FE 打开店铺增量开关
| `order.convert.pdd.full.dlq` | Queue | 全量转换死信 | | `order.convert.pdd.full.dlq` | Queue | 全量转换死信 |
| `order.convert.pdd.inc` | Queue | PDD 增量转换 | | `order.convert.pdd.inc` | Queue | PDD 增量转换 |
| `order.convert.pdd.inc.dlq` | Queue | 增量转换死信 | | `order.convert.pdd.inc.dlq` | Queue | 增量转换死信 |
| `order.convert.pdd` | Queue | **遗留**共用队列(仅排水转发到 full/inc) |
| `order.convert.pdd.dlq` | Queue | 遗留转换死信 |
| `bi.stat.full` | Queue | BI 全日重算 | | `bi.stat.full` | Queue | BI 全日重算 |
| `bi.stat.full.dlq` | Queue | 全量计算死信 | | `bi.stat.full.dlq` | Queue | 全量计算死信 |
| `bi.stat.inc` | Queue | BI 增量 delta 累加 | | `bi.stat.inc` | Queue | BI 增量 delta 累加 |
@@ -235,7 +233,6 @@ RoutingKey:
|-----|----------| |-----|----------|
| `order.convert.pdd.full` | `order.convert.pdd.full` | | `order.convert.pdd.full` | `order.convert.pdd.full` |
| `order.convert.pdd.inc` | `order.convert.pdd.inc` | | `order.convert.pdd.inc` | `order.convert.pdd.inc` |
| `order.convert.pdd` | `order.convert.pdd`(遗留排水) |
| `bi.stat.full` | `bi.stat.full` | | `bi.stat.full` | `bi.stat.full` |
| `bi.stat.inc` | `bi.stat.inc` | | `bi.stat.inc` | `bi.stat.inc` |
@@ -332,7 +329,6 @@ RoutingKey:
| `PddOrderConvertPublisher` | sync 成功后发 `OrderConvertMessage`(full/inc 分队列) | | `PddOrderConvertPublisher` | sync 成功后发 `OrderConvertMessage`(full/inc 分队列) |
| `PddOrderConvertFullConsumer` | 消费 `order.convert.pdd.full`(日锁+信号量) | | `PddOrderConvertFullConsumer` | 消费 `order.convert.pdd.full`(日锁+信号量) |
| `PddOrderConvertIncConsumer` | 消费 `order.convert.pdd.inc`(同店独占) | | `PddOrderConvertIncConsumer` | 消费 `order.convert.pdd.inc`(同店独占) |
| `PddOrderConvertLegacyDrainConsumer` | 旧共用队列排水转发 |
| `PddOrderConvertService` | `channel_pdd_order(+item)` → `ec_order(+item)` | | `PddOrderConvertService` | `channel_pdd_order(+item)` → `ec_order(+item)` |
| `PddOrderStatusMapper` | PDD 状态整型 → 内部 `OrderStatus` | | `PddOrderStatusMapper` | PDD 状态整型 → 内部 `OrderStatus` |
| `PddBiCalcPublisher` | 转换完成后发 `bi.stat.full` / `bi.stat.inc` | | `PddBiCalcPublisher` | 转换完成后发 `bi.stat.full` / `bi.stat.inc` |
@@ -3,8 +3,8 @@
-- 数据来源:pdd.mall.info.get → mall_info_get_response -- 数据来源:pdd.mall.info.get → mall_info_get_response
-- 设计原则: -- 设计原则:
-- 1. 与 ec_shop(内部店铺)分离,本表只存拼多多平台店铺镜像 -- 1. 与 ec_shop(内部店铺)分离,本表只存拼多多平台店铺镜像
-- 2. 不主动 FK 关联 ec_shop;绑定由 ec_shop.platform_code + external_shop_id(= mall_id)维护 -- 2. 不主动 FK 关联 ec_shop;绑定由 ec_shop.platform_code + external_shop_id(= channel_pdd_shop.id)维护
-- 3. 授权后拉取写入本表,再按公司 + 拼多多平台 + mall_id upsert ec_shop -- 3. 授权后写入本表,再把本表主键写入 ec_shop.external_shop_id
-- ======================================== -- ========================================
DROP TABLE IF EXISTS `channel_pdd_shop`; DROP TABLE IF EXISTS `channel_pdd_shop`;
@@ -14,14 +14,14 @@ CREATE TABLE `ec_shop` (
`logo_image_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT 'logo图片ID', `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 则覆盖)', `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 '平台代码(软约定枚举,无平台表)', `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 组合关联平台店铺)', `external_shop_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '外部/平台店铺表主键ID(如 channel_pdd_shop.id;与 platform_code 组合关联)',
`order_inc_sync_enabled` tinyint NOT NULL DEFAULT 0 COMMENT '订单增量同步开关:0关 1开(产品配置,与渠道运行态分离)', `order_inc_sync_enabled` tinyint NOT NULL DEFAULT 0 COMMENT '订单增量同步开关:0关 1开(产品配置,与渠道运行态分离)',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '创建人ID', `create_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '创建人ID',
`update_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '更新人ID', `update_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '更新人ID',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_ec_shop_company_platform_external`(`company_id` ASC, `platform_code` ASC, `external_shop_id` ASC) USING BTREE COMMENT '同一公司同一平台下外部店铺ID唯一(NULL 可重复,手工店)', UNIQUE INDEX `uk_ec_shop_company_platform_external`(`company_id` ASC, `platform_code` ASC, `external_shop_id` ASC) USING BTREE COMMENT '同一公司同一平台下平台店铺主键唯一(NULL 可重复,手工店)',
INDEX `idx_company_id`(`company_id` ASC) USING BTREE, INDEX `idx_company_id`(`company_id` ASC) USING BTREE,
INDEX `idx_platform_code`(`platform_code` ASC) USING BTREE, INDEX `idx_platform_code`(`platform_code` ASC) USING BTREE,
INDEX `idx_ec_shop_order_inc_sync`(`platform_code` ASC, `order_inc_sync_enabled` ASC) USING BTREE COMMENT '增量同步 Job 扫描', INDEX `idx_ec_shop_order_inc_sync`(`platform_code` ASC, `order_inc_sync_enabled` ASC) USING BTREE COMMENT '增量同步 Job 扫描',
@@ -0,0 +1,26 @@
-- ec_shop.external_shop_id:由平台侧业务 ID(如 PDD mall_id)改为平台店铺表主键(如 channel_pdd_shop.id)
-- 1) 拼多多:mall_id → channel_pdd_shop.id
UPDATE `ec_shop` s
INNER JOIN `channel_pdd_shop` cps
ON cps.`company_id` = s.`company_id`
AND s.`platform_code` = 'pdd'
AND s.`external_shop_id` = CAST(cps.`mall_id` AS CHAR)
SET s.`external_shop_id` = CAST(cps.`id` AS CHAR);
-- 2) 无法映射到平台店铺主键的遗留值清空(避免改类型失败 / 脏数据)
UPDATE `ec_shop` s
LEFT JOIN `channel_pdd_shop` cps
ON cps.`id` = CAST(NULLIF(TRIM(s.`external_shop_id`), '') AS UNSIGNED)
SET s.`external_shop_id` = NULL
WHERE s.`external_shop_id` IS NOT NULL
AND TRIM(s.`external_shop_id`) <> ''
AND cps.`id` IS NULL;
-- 3) 列类型改为 bigint,语义为平台店铺表主键
ALTER TABLE `ec_shop`
DROP INDEX `uk_ec_shop_company_platform_external`,
MODIFY COLUMN `external_shop_id` bigint UNSIGNED NULL DEFAULT NULL
COMMENT '外部/平台店铺表主键ID(如 channel_pdd_shop.id;与 platform_code 组合关联)',
ADD UNIQUE INDEX `uk_ec_shop_company_platform_external`(`company_id` ASC, `platform_code` ASC, `external_shop_id` ASC)
USING BTREE COMMENT '同一公司同一平台下平台店铺主键唯一(NULL 可重复,手工店)';
@@ -23,16 +23,6 @@ public final class OrderMqConstants {
public static final String QUEUE_ORDER_CONVERT_PDD_INC = "order.convert.pdd.inc"; public static final String QUEUE_ORDER_CONVERT_PDD_INC = "order.convert.pdd.inc";
public static final String QUEUE_ORDER_CONVERT_PDD_INC_DLQ = "order.convert.pdd.inc.dlq"; public static final String QUEUE_ORDER_CONVERT_PDD_INC_DLQ = "order.convert.pdd.inc.dlq";
/** @deprecated 已拆为 full/inc;保留供旧队列排水 */
@Deprecated
public static final String RK_ORDER_CONVERT_PDD = "order.convert.pdd";
/** @deprecated 已拆为 full/inc;保留供旧队列排水 */
@Deprecated
public static final String QUEUE_ORDER_CONVERT_PDD = "order.convert.pdd";
/** @deprecated */
@Deprecated
public static final String QUEUE_ORDER_CONVERT_PDD_DLQ = "order.convert.pdd.dlq";
public static final String RK_BI_STAT_FULL = "bi.stat.full"; public static final String RK_BI_STAT_FULL = "bi.stat.full";
public static final String QUEUE_BI_STAT_FULL = "bi.stat.full"; public static final String QUEUE_BI_STAT_FULL = "bi.stat.full";
public static final String QUEUE_BI_STAT_FULL_DLQ = "bi.stat.full.dlq"; public static final String QUEUE_BI_STAT_FULL_DLQ = "bi.stat.full.dlq";
@@ -83,27 +83,6 @@ public class RabbitBiConfig {
.with(OrderMqConstants.RK_ORDER_CONVERT_PDD_INC); .with(OrderMqConstants.RK_ORDER_CONVERT_PDD_INC);
} }
/** 旧共用队列:仅排水,新消息不再写入 */
@Bean
public Queue orderConvertPddQueue() {
return QueueBuilder.durable(OrderMqConstants.QUEUE_ORDER_CONVERT_PDD)
.withArgument("x-dead-letter-exchange", "")
.withArgument("x-dead-letter-routing-key", OrderMqConstants.QUEUE_ORDER_CONVERT_PDD_DLQ)
.build();
}
@Bean
public Queue orderConvertPddDlq() {
return QueueBuilder.durable(OrderMqConstants.QUEUE_ORDER_CONVERT_PDD_DLQ).build();
}
@Bean
public Binding orderConvertPddBinding(Queue orderConvertPddQueue, TopicExchange orderTopicExchange) {
return BindingBuilder.bind(orderConvertPddQueue)
.to(orderTopicExchange)
.with(OrderMqConstants.RK_ORDER_CONVERT_PDD);
}
@Bean @Bean
public Queue orderProductAutoCreatePddQueue() { public Queue orderProductAutoCreatePddQueue() {
return QueueBuilder.durable(OrderMqConstants.QUEUE_ORDER_PRODUCT_AUTO_CREATE_PDD) return QueueBuilder.durable(OrderMqConstants.QUEUE_ORDER_PRODUCT_AUTO_CREATE_PDD)
@@ -0,0 +1,41 @@
package top.xyquan.ecomdmbbackend.modules.channel.pdd.auth.model.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 拼多多授权信息(对外展示,不含 token / raw_response)
*/
@Data
@Schema(description = "拼多多授权信息VO")
public class PddAuthVO {
@Schema(description = "授权主键ID")
private Long id;
@Schema(description = "公司ID")
private Long companyId;
@Schema(description = "拼多多授权主体ID(owner_id)")
private String ownerId;
@Schema(description = "access_token 过期时间")
private LocalDateTime expiresAt;
@Schema(description = "refresh_token 过期时间")
private LocalDateTime refreshTokenExpiresAt;
@Schema(description = "授权 scope(JSON 数组字符串)")
private String scope;
@Schema(description = "状态:0=失效 1=正常 2=已撤销")
private Integer status;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "更新时间")
private LocalDateTime updateTime;
}
@@ -181,7 +181,14 @@ public class PddAuthServiceImpl implements PddAuthService {
} }
upsertPddShop(companyId, auth.getId(), mallId, mallInfo, tokenResponse.getOwnerName()); upsertPddShop(companyId, auth.getId(), mallId, mallInfo, tokenResponse.getOwnerName());
bindInternalShop(companyId, userId, shopId, mallId, mallInfo); PddShopPO pddShop = pddShopMapper.selectOne(new LambdaQueryWrapper<PddShopPO>()
.eq(PddShopPO::getCompanyId, companyId)
.eq(PddShopPO::getMallId, mallId)
.last("LIMIT 1"));
if (pddShop == null || pddShop.getId() == null) {
return buildResultHtml(false, "同步拼多多店铺失败");
}
bindInternalShop(companyId, userId, shopId, pddShop.getId(), mallInfo);
String shopName = firstNonBlank( String shopName = firstNonBlank(
mallInfo != null ? mallInfo.getMallName() : null, mallInfo != null ? mallInfo.getMallName() : null,
@@ -326,12 +333,12 @@ public class PddAuthServiceImpl implements PddAuthService {
} }
/** /**
* 将拼多多 mall_id 写入指定内部店铺的 external_shop_id;若已被其他内部店占用则先解绑再改绑。 * 将 channel_pdd_shop 主键写入指定内部店铺的 external_shop_id;若已被其他内部店占用则先解绑再改绑。
*/ */
private void bindInternalShop(Long companyId, private void bindInternalShop(Long companyId,
Long userId, Long userId,
Long shopId, Long shopId,
Long mallId, Long channelPddShopId,
PddMallApiSnapshot mallInfo) { PddMallApiSnapshot mallInfo) {
ShopPO shop = shopMapper.selectById(shopId); ShopPO shop = shopMapper.selectById(shopId);
if (shop == null || !companyId.equals(shop.getCompanyId())) { if (shop == null || !companyId.equals(shop.getCompanyId())) {
@@ -342,13 +349,11 @@ public class PddAuthServiceImpl implements PddAuthService {
throw new BusinessException("内部店铺不是拼多多平台,无法绑定"); throw new BusinessException("内部店铺不是拼多多平台,无法绑定");
} }
String externalShopId = String.valueOf(mallId); // 同一公司+平台下外部店主键唯一:若已被其他内部店占用则解绑
// 同一公司+平台下外部店 ID 唯一:若已被其他内部店占用则解绑
ShopPO occupied = shopMapper.selectOne(new LambdaQueryWrapper<ShopPO>() ShopPO occupied = shopMapper.selectOne(new LambdaQueryWrapper<ShopPO>()
.eq(ShopPO::getCompanyId, companyId) .eq(ShopPO::getCompanyId, companyId)
.eq(ShopPO::getPlatformCode, shop.getPlatformCode()) .eq(ShopPO::getPlatformCode, shop.getPlatformCode())
.eq(ShopPO::getExternalShopId, externalShopId) .eq(ShopPO::getExternalShopId, channelPddShopId)
.ne(ShopPO::getId, shopId) .ne(ShopPO::getId, shopId)
.last("LIMIT 1")); .last("LIMIT 1"));
if (occupied != null) { if (occupied != null) {
@@ -356,10 +361,10 @@ public class PddAuthServiceImpl implements PddAuthService {
.eq(ShopPO::getId, occupied.getId()) .eq(ShopPO::getId, occupied.getId())
.set(ShopPO::getExternalShopId, null) .set(ShopPO::getExternalShopId, null)
.set(ShopPO::getUpdateBy, userId)); .set(ShopPO::getUpdateBy, userId));
log.info("拼多多外部店 {} 从内部店 {} 解绑,改绑至 {}", externalShopId, occupied.getId(), shopId); log.info("拼多多平台店铺 {} 从内部店 {} 解绑,改绑至 {}", channelPddShopId, occupied.getId(), shopId);
} }
shop.setExternalShopId(externalShopId); shop.setExternalShopId(channelPddShopId);
// 无系统内部 logo 时,用授权店铺 logo 填充外链(与商品渠道图口径一致) // 无系统内部 logo 时,用授权店铺 logo 填充外链(与商品渠道图口径一致)
if (shop.getLogoImageId() == null if (shop.getLogoImageId() == null
&& !StringUtils.hasText(shop.getLogoUrl()) && !StringUtils.hasText(shop.getLogoUrl())
@@ -1,35 +0,0 @@
package top.xyquan.ecomdmbbackend.modules.channel.pdd.order.convert.consumer;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;
import top.xyquan.ecomdmbbackend.common.mq.OrderConvertMessage;
import top.xyquan.ecomdmbbackend.common.mq.OrderConvertMode;
import top.xyquan.ecomdmbbackend.common.mq.OrderMqConstants;
/**
* 旧共用队列排水:按 mode 转发到 full/inc 新队列后丢弃本消息。
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class PddOrderConvertLegacyDrainConsumer {
private final RabbitTemplate rabbitTemplate;
@RabbitListener(queues = OrderMqConstants.QUEUE_ORDER_CONVERT_PDD)
public void onMessage(OrderConvertMessage message) {
if (message == null || message.getMode() == null) {
log.warn("旧转换队列消息非法,丢弃: {}", message);
return;
}
String rk = message.getMode() == OrderConvertMode.FULL_DAY
? OrderMqConstants.RK_ORDER_CONVERT_PDD_FULL
: OrderMqConstants.RK_ORDER_CONVERT_PDD_INC;
rabbitTemplate.convertAndSend(OrderMqConstants.EXCHANGE, rk, message);
log.info("旧转换队列已转发 mode={} shopId={} messageId={} -> {}",
message.getMode(), message.getShopId(), message.getMessageId(), rk);
}
}
@@ -40,8 +40,7 @@ public class PddOrderIncrementalSyncJob {
List<ShopPO> shops = shopMapper.selectList(new LambdaQueryWrapper<ShopPO>() List<ShopPO> shops = shopMapper.selectList(new LambdaQueryWrapper<ShopPO>()
.eq(ShopPO::getPlatformCode, PlatformCode.PDD.getCode()) .eq(ShopPO::getPlatformCode, PlatformCode.PDD.getCode())
.eq(ShopPO::getOrderIncSyncEnabled, 1) .eq(ShopPO::getOrderIncSyncEnabled, 1)
.isNotNull(ShopPO::getExternalShopId) .isNotNull(ShopPO::getExternalShopId));
.ne(ShopPO::getExternalShopId, ""));
Set<Long> done = new HashSet<>(); Set<Long> done = new HashSet<>();
for (ShopPO shop : shops) { for (ShopPO shop : shops) {
if (!done.add(shop.getId())) { if (!done.add(shop.getId())) {
@@ -48,19 +48,13 @@ public class PddOrderSyncContextResolver {
if (!PlatformCode.PDD.getCode().equals(shop.getPlatformCode())) { if (!PlatformCode.PDD.getCode().equals(shop.getPlatformCode())) {
throw new BusinessException("仅支持拼多多平台店铺同步订单"); throw new BusinessException("仅支持拼多多平台店铺同步订单");
} }
if (!StringUtils.hasText(shop.getExternalShopId())) { if (shop.getExternalShopId() == null) {
throw new BusinessException("店铺尚未绑定拼多多外部店,请先完成授权"); throw new BusinessException("店铺尚未绑定拼多多外部店,请先完成授权");
} }
Long mallId;
try {
mallId = Long.parseLong(shop.getExternalShopId().trim());
} catch (NumberFormatException e) {
throw new BusinessException("外部店铺 ID 非法: " + shop.getExternalShopId());
}
PddShopPO pddShop = pddShopMapper.selectOne(new LambdaQueryWrapper<PddShopPO>() PddShopPO pddShop = pddShopMapper.selectOne(new LambdaQueryWrapper<PddShopPO>()
.eq(PddShopPO::getId, shop.getExternalShopId())
.eq(PddShopPO::getCompanyId, companyId) .eq(PddShopPO::getCompanyId, companyId)
.eq(PddShopPO::getMallId, mallId)
.last("LIMIT 1")); .last("LIMIT 1"));
if (pddShop == null || pddShop.getPddAuthId() == null) { if (pddShop == null || pddShop.getPddAuthId() == null) {
throw new BusinessException("未找到拼多多店铺授权绑定,请重新授权"); throw new BusinessException("未找到拼多多店铺授权绑定,请重新授权");
@@ -77,7 +71,7 @@ public class PddOrderSyncContextResolver {
.auth(auth) .auth(auth)
.companyId(companyId) .companyId(companyId)
.shopId(shopId) .shopId(shopId)
.mallId(mallId) .mallId(pddShop.getMallId())
.accessToken(auth.getAccessToken()) .accessToken(auth.getAccessToken())
.build(); .build();
} }
@@ -171,8 +171,7 @@ public class PddOrderSyncService {
public List<ShopPO> listBoundPddShops(Long companyId) { public List<ShopPO> listBoundPddShops(Long companyId) {
return shopMapper.selectList(new LambdaQueryWrapper<ShopPO>() return shopMapper.selectList(new LambdaQueryWrapper<ShopPO>()
.eq(ShopPO::getCompanyId, companyId) .eq(ShopPO::getCompanyId, companyId)
.isNotNull(ShopPO::getExternalShopId) .isNotNull(ShopPO::getExternalShopId));
.ne(ShopPO::getExternalShopId, ""));
} }
public PddOrderSyncResultVO syncByConfirmDateForTask(Long companyId, Long shopId, LocalDate day, Long taskId) { public PddOrderSyncResultVO syncByConfirmDateForTask(Long companyId, Long shopId, LocalDate day, Long taskId) {
@@ -60,7 +60,7 @@ public class PddShopController {
return ApiResponse.success("获取成功", result); return ApiResponse.success("获取成功", result);
} }
@Operation(summary = "详情", description = "根据ID获取拼多多店铺详情") @Operation(summary = "详情", description = "根据ID获取拼多多店铺详情(含授权信息,不含 token)")
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
@RequirePermission(value = "biz:pdd:shop:read", description = "查询拼多多店铺详情", allowSuper = true) @RequirePermission(value = "biz:pdd:shop:read", description = "查询拼多多店铺详情", allowSuper = true)
public ApiResponse<PddShopVO> getPddShopDetail(@Parameter(description = "店铺ID") @PathVariable Long id) { public ApiResponse<PddShopVO> getPddShopDetail(@Parameter(description = "店铺ID") @PathVariable Long id) {
@@ -2,6 +2,7 @@ package top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.auth.model.vo.PddAuthVO;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -18,6 +19,9 @@ public class PddShopVO {
@Schema(description = "拼多多授权ID(channel_pdd_auth.id)") @Schema(description = "拼多多授权ID(channel_pdd_auth.id)")
private Long pddAuthId; private Long pddAuthId;
@Schema(description = "关联的拼多多授权信息(有 pddAuthId 时返回,不含 token)")
private PddAuthVO auth;
@Schema(description = "拼多多店铺ID(mall_id)") @Schema(description = "拼多多店铺ID(mall_id)")
private Long mallId; private Long mallId;
@@ -9,6 +9,8 @@ import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.dto.UpdatePddSho
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.po.PddShopPO; import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.po.PddShopPO;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.vo.PddShopVO; import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.vo.PddShopVO;
import java.util.List;
public interface PddShopService extends IService<PddShopPO> { public interface PddShopService extends IService<PddShopPO> {
PddShopVO createPddShop(CreatePddShopDTO createPddShopDTO); PddShopVO createPddShop(CreatePddShopDTO createPddShopDTO);
@@ -20,4 +22,14 @@ public interface PddShopService extends IService<PddShopPO> {
PageResultVO<PddShopVO> getPddShopPage(PageQueryDTO<PddShopFilterDTO> pageQueryDTO); PageResultVO<PddShopVO> getPddShopPage(PageQueryDTO<PddShopFilterDTO> pageQueryDTO);
PddShopVO getPddShopDetail(Long id); PddShopVO getPddShopDetail(Long id);
/** 转为 VO;withAuth=true 时按 pddAuthId 嵌套授权信息(不含 token) */
PddShopVO toVo(PddShopPO shop, boolean withAuth);
List<PddShopVO> toVoList(List<PddShopPO> shops, boolean withAuth);
/** 列表用简要信息(不含描述/类型/授权详情等) */
PddShopVO toBriefVo(PddShopPO shop);
List<PddShopVO> toBriefVoList(List<PddShopPO> shops);
} }
@@ -10,6 +10,9 @@ import top.xyquan.ecomdmbbackend.common.exception.BusinessException;
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO; import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO; import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
import top.xyquan.ecomdmbbackend.common.utils.BeanCopyUtils; import top.xyquan.ecomdmbbackend.common.utils.BeanCopyUtils;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.auth.mapper.PddAuthMapper;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.auth.model.po.PddAuthPO;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.auth.model.vo.PddAuthVO;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.mapper.PddShopMapper; import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.mapper.PddShopMapper;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.dto.CreatePddShopDTO; import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.dto.CreatePddShopDTO;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.dto.PddShopFilterDTO; import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.dto.PddShopFilterDTO;
@@ -20,15 +23,20 @@ import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.service.PddShopService
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext; import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
public class PddShopServiceImpl extends ServiceImpl<PddShopMapper, PddShopPO> implements PddShopService { public class PddShopServiceImpl extends ServiceImpl<PddShopMapper, PddShopPO> implements PddShopService {
private final CurrentUserContext currentUserContext; private final CurrentUserContext currentUserContext;
private final PddAuthMapper pddAuthMapper;
public PddShopServiceImpl(CurrentUserContext currentUserContext) { public PddShopServiceImpl(CurrentUserContext currentUserContext, PddAuthMapper pddAuthMapper) {
this.currentUserContext = currentUserContext; this.currentUserContext = currentUserContext;
this.pddAuthMapper = pddAuthMapper;
} }
@Override @Override
@@ -59,7 +67,7 @@ public class PddShopServiceImpl extends ServiceImpl<PddShopMapper, PddShopPO> im
} }
this.save(shop); this.save(shop);
return convertToVO(shop); return toVo(shop, true);
} }
@Override @Override
@@ -95,7 +103,7 @@ public class PddShopServiceImpl extends ServiceImpl<PddShopMapper, PddShopPO> im
shop.setCompanyId(companyId); shop.setCompanyId(companyId);
this.updateById(shop); this.updateById(shop);
return convertToVO(shop); return toVo(this.getById(id), true);
} }
@Override @Override
@@ -135,9 +143,7 @@ public class PddShopServiceImpl extends ServiceImpl<PddShopMapper, PddShopPO> im
IPage<PddShopPO> page = new Page<>(pageQueryDTO.getPage(), pageQueryDTO.getPageSize()); IPage<PddShopPO> page = new Page<>(pageQueryDTO.getPage(), pageQueryDTO.getPageSize());
IPage<PddShopPO> result = this.page(page, wrapper); IPage<PddShopPO> result = this.page(page, wrapper);
List<PddShopVO> voList = result.getRecords().stream() List<PddShopVO> voList = toBriefVoList(result.getRecords());
.map(this::convertToVO)
.collect(Collectors.toList());
return PageResultVO.create(voList, result.getTotal(), return PageResultVO.create(voList, result.getTotal(),
(int) pageQueryDTO.getPage(), (int) pageQueryDTO.getPageSize()); (int) pageQueryDTO.getPage(), (int) pageQueryDTO.getPageSize());
@@ -149,12 +155,90 @@ public class PddShopServiceImpl extends ServiceImpl<PddShopMapper, PddShopPO> im
if (shop == null) { if (shop == null) {
throw new BusinessException("拼多多店铺不存在"); throw new BusinessException("拼多多店铺不存在");
} }
return convertToVO(shop); Long companyId = currentUserContext.getCurrentCompanyId();
if (!companyId.equals(shop.getCompanyId())) {
throw new BusinessException("拼多多店铺不存在");
}
return toVo(shop, true);
} }
private PddShopVO convertToVO(PddShopPO shop) { @Override
public PddShopVO toVo(PddShopPO shop, boolean withAuth) {
if (shop == null) {
return null;
}
PddShopVO vo = new PddShopVO(); PddShopVO vo = new PddShopVO();
BeanCopyUtils.copyProperties(shop, vo); BeanCopyUtils.copyProperties(shop, vo);
if (withAuth && shop.getPddAuthId() != null) {
vo.setAuth(toAuthVo(pddAuthMapper.selectById(shop.getPddAuthId())));
}
return vo;
}
@Override
public List<PddShopVO> toVoList(List<PddShopPO> shops, boolean withAuth) {
if (shops == null || shops.isEmpty()) {
return List.of();
}
Map<Long, PddAuthVO> authById = Map.of();
if (withAuth) {
Set<Long> authIds = shops.stream()
.map(PddShopPO::getPddAuthId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
if (!authIds.isEmpty()) {
authById = pddAuthMapper.selectBatchIds(authIds).stream()
.collect(Collectors.toMap(PddAuthPO::getId, this::toAuthVo, (a, b) -> a));
}
}
Map<Long, PddAuthVO> finalAuthById = authById;
return shops.stream().map(shop -> {
PddShopVO vo = new PddShopVO();
BeanCopyUtils.copyProperties(shop, vo);
if (withAuth && shop.getPddAuthId() != null) {
vo.setAuth(finalAuthById.get(shop.getPddAuthId()));
}
return vo;
}).collect(Collectors.toList());
}
@Override
public PddShopVO toBriefVo(PddShopPO shop) {
if (shop == null) {
return null;
}
PddShopVO vo = new PddShopVO();
vo.setId(shop.getId());
vo.setCompanyId(shop.getCompanyId());
vo.setMallId(shop.getMallId());
vo.setMallName(shop.getMallName());
vo.setLogo(shop.getLogo());
vo.setPddAuthId(shop.getPddAuthId());
return vo;
}
@Override
public List<PddShopVO> toBriefVoList(List<PddShopPO> shops) {
if (shops == null || shops.isEmpty()) {
return List.of();
}
return shops.stream().map(this::toBriefVo).collect(Collectors.toList());
}
private PddAuthVO toAuthVo(PddAuthPO auth) {
if (auth == null) {
return null;
}
PddAuthVO vo = new PddAuthVO();
vo.setId(auth.getId());
vo.setCompanyId(auth.getCompanyId());
vo.setOwnerId(auth.getOwnerId());
vo.setExpiresAt(auth.getExpiresAt());
vo.setRefreshTokenExpiresAt(auth.getRefreshTokenExpiresAt());
vo.setScope(auth.getScope());
vo.setStatus(auth.getStatus());
vo.setCreateTime(auth.getCreateTime());
vo.setUpdateTime(auth.getUpdateTime());
return vo; return vo;
} }
} }
@@ -4,8 +4,6 @@ import top.xyquan.ecomdmbbackend.common.utils.BeanCopyUtils;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import top.xyquan.ecomdmbbackend.common.exception.BusinessException; import top.xyquan.ecomdmbbackend.common.exception.BusinessException;
import top.xyquan.ecomdmbbackend.modules.ec.importtask.model.po.ImportTaskPO; import top.xyquan.ecomdmbbackend.modules.ec.importtask.model.po.ImportTaskPO;
@@ -36,7 +34,6 @@ import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction; import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -46,8 +43,6 @@ import java.util.stream.Collectors;
@Service @Service
public class ImportTaskProcessorServiceImpl implements ImportTaskProcessorService { public class ImportTaskProcessorServiceImpl implements ImportTaskProcessorService {
private static final Logger log = LoggerFactory.getLogger(ImportTaskProcessorServiceImpl.class);
private final ImportTaskService importTaskService; private final ImportTaskService importTaskService;
private final OrderMapper orderMapper; private final OrderMapper orderMapper;
private final RealtimeSseService realtimeSseService; private final RealtimeSseService realtimeSseService;
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.Select;
import top.xyquan.ecomdmbbackend.modules.ec.order.model.dto.OrderListQueryParam; import top.xyquan.ecomdmbbackend.modules.ec.order.model.dto.OrderListQueryParam;
import top.xyquan.ecomdmbbackend.modules.ec.order.model.po.OrderPO; import top.xyquan.ecomdmbbackend.modules.ec.order.model.po.OrderPO;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -26,7 +26,6 @@ import top.xyquan.ecomdmbbackend.modules.ec.shop.model.po.ShopPO;
import top.xyquan.ecomdmbbackend.modules.ec.order.model.vo.BatchImportResultVO; import top.xyquan.ecomdmbbackend.modules.ec.order.model.vo.BatchImportResultVO;
import top.xyquan.ecomdmbbackend.modules.ec.order.model.vo.OrderItemVO; import top.xyquan.ecomdmbbackend.modules.ec.order.model.vo.OrderItemVO;
import top.xyquan.ecomdmbbackend.modules.ec.order.model.vo.OrderVO; import top.xyquan.ecomdmbbackend.modules.ec.order.model.vo.OrderVO;
import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductSkuVO;
import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductVO; import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductVO;
import top.xyquan.ecomdmbbackend.modules.ec.order.service.OrderService; import top.xyquan.ecomdmbbackend.modules.ec.order.service.OrderService;
import top.xyquan.ecomdmbbackend.modules.ec.order.status.model.enums.OrderStatus; import top.xyquan.ecomdmbbackend.modules.ec.order.status.model.enums.OrderStatus;
@@ -43,10 +42,8 @@ import org.slf4j.Logger;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.time.ZoneId;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -171,8 +168,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderPO> implemen
@Override @Override
@Transactional @Transactional
public void deleteOrder(Long id) { public void deleteOrder(Long id) {
Long companyId = currentUserContext.getCurrentCompanyId();
OrderPO existingOrder = requireOrder(id, companyId);
orderItemMapper.delete(new LambdaQueryWrapper<OrderItemPO>().eq(OrderItemPO::getOrderId, id)); orderItemMapper.delete(new LambdaQueryWrapper<OrderItemPO>().eq(OrderItemPO::getOrderId, id));
this.removeById(id); this.removeById(id);
} }
@@ -278,7 +273,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderPO> implemen
java.math.BigDecimal shippingCost, java.math.BigDecimal otherCost, java.math.BigDecimal shippingCost, java.math.BigDecimal otherCost,
java.time.LocalDateTime startTime, java.time.LocalDateTime endTime) { java.time.LocalDateTime startTime, java.time.LocalDateTime endTime) {
try { try {
ProductSkuPO sku = productSkuService.getById(skuId);
int n = baseMapper.updateCostFields(productCost, shippingCost, otherCost, skuId, startTime, endTime); int n = baseMapper.updateCostFields(productCost, shippingCost, otherCost, skuId, startTime, endTime);
return n; return n;
} catch (Exception ex) { } catch (Exception ex) {
@@ -1,7 +1,6 @@
package top.xyquan.ecomdmbbackend.modules.ec.order.status.support; package top.xyquan.ecomdmbbackend.modules.ec.order.status.support;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import top.xyquan.ecomdmbbackend.modules.ec.order.status.model.enums.OrderStatus;
/** /**
* 解析订单统计状态集合。去表后全局固定,忽略 companyId。 * 解析订单统计状态集合。去表后全局固定,忽略 companyId。
@@ -10,7 +10,6 @@ import top.xyquan.ecomdmbbackend.modules.ec.product.model.po.ProductPO;
import top.xyquan.ecomdmbbackend.modules.ec.product.model.po.ProductSkuPO; import top.xyquan.ecomdmbbackend.modules.ec.product.model.po.ProductSkuPO;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@@ -1,6 +1,5 @@
package top.xyquan.ecomdmbbackend.modules.ec.product.controller; package top.xyquan.ecomdmbbackend.modules.ec.product.controller;
import top.xyquan.ecomdmbbackend.common.utils.BeanCopyUtils;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@@ -30,7 +30,6 @@ import top.xyquan.ecomdmbbackend.modules.sys.file.model.po.SysFilePO;
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext; import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
import top.xyquan.ecomdmbbackend.utils.SysFileUtils; import top.xyquan.ecomdmbbackend.utils.SysFileUtils;
import java.math.BigDecimal;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -61,7 +61,7 @@ public class ShopController {
return ApiResponse.success("店铺删除成功"); return ApiResponse.success("店铺删除成功");
} }
@Operation(summary = "分页获取店铺列表", description = "分页获取店铺列表,支持条件过滤;已绑定外部店时附带对应外部店铺 VO(如 pddShop)") @Operation(summary = "分页获取店铺列表", description = "分页获取店铺列表;已绑定外部店时仅附带渠道店简要信息(id/名称/logo 等),详情请调渠道店铺详情接口")
@PostMapping("/list") @PostMapping("/list")
@RequirePermission(value = "ecom:shop:read", description = "查询店铺列表", allowSuper = true) @RequirePermission(value = "ecom:shop:read", description = "查询店铺列表", allowSuper = true)
public ApiResponse<PageResultVO<ShopVO>> getShopPage( public ApiResponse<PageResultVO<ShopVO>> getShopPage(
@@ -70,6 +70,14 @@ public class ShopController {
return ApiResponse.success("获取店铺列表成功", result); return ApiResponse.success("获取店铺列表成功", result);
} }
@Operation(summary = "店铺详情", description = "根据内部店铺ID获取详情;按 platformCode 嵌套平台店铺简要信息,完整渠道店/授权请再调渠道店铺详情")
@GetMapping("/detail/{id}")
@RequirePermission(value = "ecom:shop:read", description = "查询店铺详情", allowSuper = true)
public ApiResponse<ShopVO> getShopDetail(@Parameter(description = "店铺ID") @PathVariable Long id) {
ShopVO vo = shopService.getShopDetail(id);
return ApiResponse.success("获取成功", vo);
}
@Operation(summary = "上传店铺Logo", description = "上传店铺Logo图片,支持跨公司共享") @Operation(summary = "上传店铺Logo", description = "上传店铺Logo图片,支持跨公司共享")
@PostMapping("/upload-logo") @PostMapping("/upload-logo")
@RequirePermission(value = "ecom:shop:manage", description = "上传店铺Logo", allowSuper = true) @RequirePermission(value = "ecom:shop:manage", description = "上传店铺Logo", allowSuper = true)
@@ -31,8 +31,8 @@ public class CreateShopDTO {
private String platformCode; private String platformCode;
/** /**
* 外部店铺ID(平台侧店铺标识,如拼多多 mall_id) * 外部/平台店铺表主键 ID(如 channel_pdd_shop.id)
*/ */
@Schema(description = "外部店铺ID(平台侧店铺标识,如拼多多 mall_id)", example = "123456789") @Schema(description = "外部/平台店铺表主键ID(如 channel_pdd_shop.id)", example = "1")
private String externalShopId; private Long externalShopId;
} }
@@ -31,8 +31,8 @@ public class UpdateShopDTO {
private String platformCode; private String platformCode;
/** /**
* 外部店铺ID(平台侧店铺标识,如拼多多 mall_id) * 外部/平台店铺表主键 ID(如 channel_pdd_shop.id)
*/ */
@Schema(description = "外部店铺ID(平台侧店铺标识,如拼多多 mall_id)", example = "123456789") @Schema(description = "外部/平台店铺表主键ID(如 channel_pdd_shop.id)", example = "1")
private String externalShopId; private Long externalShopId;
} }
@@ -51,10 +51,10 @@ public class ShopPO {
private String platformCode; private String platformCode;
/** /**
* 外部店铺ID(如拼多多 mall_id;与 platform_code 组合关联平台店铺) * 外部/平台店铺表主键 ID(如 channel_pdd_shop.id;与 platform_code 组合关联)
*/ */
@TableField("external_shop_id") @TableField("external_shop_id")
private String externalShopId; private Long externalShopId;
/** /**
* 订单增量同步开关:0关 1开 * 订单增量同步开关:0关 1开
@@ -44,10 +44,10 @@ public class ShopVO {
private String platformCode; private String platformCode;
/** /**
* 外部店铺ID(平台侧店铺标识,如拼多多 mall_id) * 外部/平台店铺表主键 ID(如 channel_pdd_shop.id)
*/ */
@Schema(description = "外部店铺ID(平台侧店铺标识,如拼多多 mall_id)", example = "123456789") @Schema(description = "外部/平台店铺表主键ID(如 channel_pdd_shop.id)", example = "1")
private String externalShopId; private Long externalShopId;
/** /**
* 关联的拼多多外部店铺(仅 platform=pdd 且已绑定 externalShopId 时有值) * 关联的拼多多外部店铺(仅 platform=pdd 且已绑定 externalShopId 时有值)
@@ -50,6 +50,14 @@ public interface ShopService extends IService<ShopPO> {
*/ */
PageResultVO<ShopVO> getShopPage(PageQueryDTO<ShopFilterDTO> pageQueryDTO); PageResultVO<ShopVO> getShopPage(PageQueryDTO<ShopFilterDTO> pageQueryDTO);
/**
* 店铺详情(按平台编码嵌套平台店铺及授权信息)
*
* @param id 店铺ID
* @return 店铺VO
*/
ShopVO getShopDetail(Long id);
/** /**
* 上传店铺Logo * 上传店铺Logo
* *
@@ -13,6 +13,7 @@ import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.mapper.PddShopMapper; import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.mapper.PddShopMapper;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.po.PddShopPO; import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.po.PddShopPO;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.vo.PddShopVO; import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.vo.PddShopVO;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.service.PddShopService;
import top.xyquan.ecomdmbbackend.modules.ec.product.mapper.ProductMapper; import top.xyquan.ecomdmbbackend.modules.ec.product.mapper.ProductMapper;
import top.xyquan.ecomdmbbackend.modules.ec.platform.model.enums.PlatformCode; import top.xyquan.ecomdmbbackend.modules.ec.platform.model.enums.PlatformCode;
import top.xyquan.ecomdmbbackend.modules.ec.shop.mapper.ShopMapper; import top.xyquan.ecomdmbbackend.modules.ec.shop.mapper.ShopMapper;
@@ -56,17 +57,19 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopPO> implements
private final ShopProductRelationMapper shopProductRelationMapper; private final ShopProductRelationMapper shopProductRelationMapper;
private final ProductSkuService productSkuService; private final ProductSkuService productSkuService;
private final PddShopMapper pddShopMapper; private final PddShopMapper pddShopMapper;
private final PddShopService pddShopService;
public ShopServiceImpl(CurrentUserContext currentUserContext, SysFileService sysFileService, public ShopServiceImpl(CurrentUserContext currentUserContext, SysFileService sysFileService,
ProductMapper productMapper, ProductMapper productMapper,
ShopProductRelationMapper shopProductRelationMapper, ProductSkuService productSkuService, ShopProductRelationMapper shopProductRelationMapper, ProductSkuService productSkuService,
PddShopMapper pddShopMapper) { PddShopMapper pddShopMapper, PddShopService pddShopService) {
this.currentUserContext = currentUserContext; this.currentUserContext = currentUserContext;
this.sysFileService = sysFileService; this.sysFileService = sysFileService;
this.productMapper = productMapper; this.productMapper = productMapper;
this.shopProductRelationMapper = shopProductRelationMapper; this.shopProductRelationMapper = shopProductRelationMapper;
this.productSkuService = productSkuService; this.productSkuService = productSkuService;
this.pddShopMapper = pddShopMapper; this.pddShopMapper = pddShopMapper;
this.pddShopService = pddShopService;
} }
/** /**
@@ -103,8 +106,9 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopPO> implements
// 保存店铺 // 保存店铺
this.save(shop); this.save(shop);
// 转换为VO并返回 ShopVO vo = convertToVO(shop);
return convertToVO(shop); attachExternalShop(vo, shop);
return vo;
} }
/** /**
@@ -148,8 +152,10 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopPO> implements
// 更新店铺 // 更新店铺
this.updateById(shop); this.updateById(shop);
// 转换为VO并返回 ShopPO updated = this.getById(id);
return convertToVO(shop); ShopVO vo = convertToVO(updated);
attachExternalShop(vo, updated);
return vo;
} }
/** /**
@@ -251,20 +257,35 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopPO> implements
if (shop.getPlatformCode() != null && !shop.getPlatformCode().isBlank()) { if (shop.getPlatformCode() != null && !shop.getPlatformCode().isBlank()) {
shopVO.setPlatformName(PlatformCode.labelOf(shop.getPlatformCode())); shopVO.setPlatformName(PlatformCode.labelOf(shop.getPlatformCode()));
} }
return shopVO;
}
private void attachExternalShop(ShopVO shopVO, ShopPO shop) {
if (shopVO == null || shop == null) {
return;
}
if (PLATFORM_CODE_PDD.equals(shop.getPlatformCode()) if (PLATFORM_CODE_PDD.equals(shop.getPlatformCode())
&& shop.getExternalShopId() != null && !shop.getExternalShopId().isBlank()) { && shop.getExternalShopId() != null) {
Long mallId = parseMallId(shop.getExternalShopId()); PddShopPO pddShop = pddShopMapper.selectOne(new LambdaQueryWrapper<PddShopPO>()
if (mallId != null) { .eq(PddShopPO::getId, shop.getExternalShopId())
PddShopPO pddShop = pddShopMapper.selectOne(new LambdaQueryWrapper<PddShopPO>() .eq(PddShopPO::getCompanyId, shop.getCompanyId())
.eq(PddShopPO::getCompanyId, shop.getCompanyId()) .last("LIMIT 1"));
.eq(PddShopPO::getMallId, mallId) if (pddShop != null) {
.last("LIMIT 1")); shopVO.setPddShop(pddShopService.toBriefVo(pddShop));
if (pddShop != null) {
shopVO.setPddShop(convertPddShopToVO(pddShop));
}
} }
} }
return shopVO; }
@Override
public ShopVO getShopDetail(Long id) {
Long companyId = currentUserContext.getCurrentCompanyId();
ShopPO shop = this.getById(id);
if (shop == null || !companyId.equals(shop.getCompanyId())) {
throw new BusinessException("店铺不存在");
}
ShopVO vo = convertToVO(shop);
attachExternalShop(vo, shop);
return vo;
} }
private static void validatePlatformCode(String platformCode) { private static void validatePlatformCode(String platformCode) {
@@ -287,52 +308,35 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopPO> implements
.filter(v -> v.getId() != null) .filter(v -> v.getId() != null)
.collect(Collectors.toMap(ShopVO::getId, Function.identity(), (a, b) -> a)); .collect(Collectors.toMap(ShopVO::getId, Function.identity(), (a, b) -> a));
Map<Long, Long> shopIdToMallId = new HashMap<>(); Map<Long, Long> shopIdToExternalId = new HashMap<>();
for (ShopPO shop : shops) { for (ShopPO shop : shops) {
if (shop.getExternalShopId() == null || shop.getExternalShopId().isBlank()) { if (shop.getExternalShopId() == null) {
continue; continue;
} }
if (!PLATFORM_CODE_PDD.equals(shop.getPlatformCode())) { if (!PLATFORM_CODE_PDD.equals(shop.getPlatformCode())) {
continue; continue;
} }
Long mallId = parseMallId(shop.getExternalShopId()); shopIdToExternalId.put(shop.getId(), shop.getExternalShopId());
if (mallId != null) {
shopIdToMallId.put(shop.getId(), mallId);
}
} }
if (shopIdToMallId.isEmpty()) { if (shopIdToExternalId.isEmpty()) {
return; return;
} }
List<PddShopPO> pddShops = pddShopMapper.selectList(new LambdaQueryWrapper<PddShopPO>() List<PddShopPO> pddShops = pddShopMapper.selectList(new LambdaQueryWrapper<PddShopPO>()
.eq(PddShopPO::getCompanyId, companyId) .eq(PddShopPO::getCompanyId, companyId)
.in(PddShopPO::getMallId, shopIdToMallId.values())); .in(PddShopPO::getId, shopIdToExternalId.values()));
Map<Long, PddShopVO> pddByMallId = pddShops.stream() Map<Long, PddShopVO> pddById = pddShopService.toBriefVoList(pddShops).stream()
.collect(Collectors.toMap(PddShopPO::getMallId, this::convertPddShopToVO, (a, b) -> a)); .collect(Collectors.toMap(PddShopVO::getId, Function.identity(), (a, b) -> a));
shopIdToMallId.forEach((shopId, mallId) -> { shopIdToExternalId.forEach((shopId, externalId) -> {
ShopVO vo = voById.get(shopId); ShopVO vo = voById.get(shopId);
PddShopVO pddShop = pddByMallId.get(mallId); PddShopVO pddShop = pddById.get(externalId);
if (vo != null && pddShop != null) { if (vo != null && pddShop != null) {
vo.setPddShop(pddShop); vo.setPddShop(pddShop);
} }
}); });
} }
private static Long parseMallId(String externalShopId) {
try {
return Long.parseLong(externalShopId.trim());
} catch (NumberFormatException e) {
return null;
}
}
private PddShopVO convertPddShopToVO(PddShopPO pddShop) {
PddShopVO vo = new PddShopVO();
BeanCopyUtils.copyProperties(pddShop, vo);
return vo;
}
/** /**
* 分页获取店铺商品信息 * 分页获取店铺商品信息
*/ */
@@ -0,0 +1,10 @@
import type { PddShopInfo } from '#/api/ecommerce/shop/types';
import { requestClient } from '#/api/request';
/**
* 拼多多渠道店铺详情(含授权信息,不含 token)
*/
export async function getPddShopDetailApi(id: number) {
return requestClient.get<PddShopInfo>(`/channel/pdd/shop/detail/${id}`);
}
@@ -0,0 +1 @@
export * from './apis';
@@ -37,6 +37,13 @@ export async function deleteShopApi(id: number) {
return requestClient.delete(`/ec/shop/delete/${id}`); return requestClient.delete(`/ec/shop/delete/${id}`);
} }
/**
* 店铺详情(含平台店铺及授权信息)
*/
export async function getShopDetailApi(id: number) {
return requestClient.get<ShopVO.Info>(`/ec/shop/detail/${id}`);
}
/** /**
* 上传店铺Logo * 上传店铺Logo
*/ */
@@ -2,31 +2,55 @@
* 店铺相关VO类型定义 * 店铺相关VO类型定义
*/ */
/** 拼多多外部店铺信息(列表关联返回) */ /** 拼多多授权信息(不含 token) */
export interface PddAuthInfo {
/** 授权主键ID */
id: number;
/** 公司ID */
companyId: number;
/** 拼多多授权主体ID(owner_id) */
ownerId?: string;
/** access_token 过期时间 */
expiresAt?: string;
/** refresh_token 过期时间 */
refreshTokenExpiresAt?: string;
/** 授权 scope(JSON 数组字符串) */
scope?: string;
/** 状态:0=失效 1=正常 2=已撤销 */
status?: number;
/** 创建时间 */
createTime?: string;
/** 更新时间 */
updateTime?: string;
}
/** 拼多多外部店铺信息 */
export interface PddShopInfo { export interface PddShopInfo {
/** 主键ID */ /** 主键ID */
id: number; id: number;
/** 公司ID */ /** 公司ID */
companyId: number; companyId?: number;
/** 拼多多授权ID */ /** 拼多多授权ID(列表简要也会带,用于判断是否已授权) */
pddAuthId?: null | number; pddAuthId?: null | number;
/** 关联授权信息(仅详情接口返回) */
auth?: null | PddAuthInfo;
/** 拼多多店铺ID(mall_id) */ /** 拼多多店铺ID(mall_id) */
mallId: number; mallId?: number;
/** 店铺名称 */ /** 店铺名称 */
mallName?: string; mallName?: string;
/** 店铺logo */ /** 店铺logo */
logo?: string; logo?: string;
/** 店铺描述 */ /** 店铺描述(详情) */
mallDesc?: string; mallDesc?: string;
/** 店铺类型:1个人 2企业 3旗舰店 4专卖店 5专营店 6普通店 */ /** 店铺类型(详情) */
merchantType?: number; merchantType?: number;
/** 店铺身份:0厂商 1分销商 2都不是 3都是 */ /** 店铺身份(详情) */
mallCharacter?: number; mallCharacter?: number;
/** 最近一次同步时间 */ /** 最近一次同步时间(详情) */
lastSyncTime?: string; lastSyncTime?: string;
/** 创建时间 */ /** 创建时间(详情) */
createTime?: string; createTime?: string;
/** 更新时间 */ /** 更新时间(详情) */
updateTime?: string; updateTime?: string;
} }
@@ -47,8 +71,8 @@ export namespace ShopVO {
platformCode?: string; platformCode?: string;
/** 平台名称(后端回填) */ /** 平台名称(后端回填) */
platformName?: string; platformName?: string;
/** 外部店铺ID(如拼多多 mall_id) */ /** 外部/平台店铺表主键 ID(如 channel_pdd_shop.id) */
externalShopId?: null | string; externalShopId?: null | number;
/** 关联的拼多多外部店铺(已授权绑定时返回) */ /** 关联的拼多多外部店铺(已授权绑定时返回) */
pddShop?: null | PddShopInfo; pddShop?: null | PddShopInfo;
/** 创建时间 */ /** 创建时间 */
@@ -1,25 +1,136 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from 'vue'; import type { ShopVO } from '#/api/ecommerce/shop/types';
import { computed, onMounted, ref, watch } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import { Descriptions, Spin, Tag, message } from 'ant-design-vue';
import { getShopDetailApi } from '#/api/ecommerce/shop';
import {
getPlatformLabel,
getPlatformTagColor,
} from '#/utils/platform-display';
import PddShopDetailModal from '../list/components/PddShopDetailModal.vue';
defineOptions({ name: 'ShopDetails' }); defineOptions({ name: 'ShopDetails' });
const route = useRoute(); const route = useRoute();
const loading = ref(false);
const shop = ref<null | ShopVO.Info>(null);
const pddShopDetailModalRef = ref<InstanceType<typeof PddShopDetailModal> | null>(
null,
);
const shopId = computed(() => { const shopId = computed(() => {
const id = route.params.id; const id = route.params.id;
return id ? Number(id) : 0; return id ? Number(id) : 0;
}); });
async function loadDetail() {
if (!shopId.value) {
shop.value = null;
return;
}
try {
loading.value = true;
shop.value = await getShopDetailApi(shopId.value);
} catch (error) {
console.error('获取店铺详情失败:', error);
message.error('获取店铺详情失败');
shop.value = null;
} finally {
loading.value = false;
}
}
function openPddShopDetail() {
const pddShopId = shop.value?.pddShop?.id ?? shop.value?.externalShopId;
if (!pddShopId) {
message.warning('暂无平台店铺信息');
return;
}
pddShopDetailModalRef.value?.open(Number(pddShopId), shop.value?.name);
}
onMounted(loadDetail);
watch(shopId, loadDetail);
</script> </script>
<template> <template>
<Page <Page
:title="shopId ? `店铺详情(#${shopId})` : '店铺详情'" :title="shop ? shop.name : shopId ? `店铺详情(#${shopId})` : '店铺详情'"
auto-content-height auto-content-height
content-class="flex min-h-0 flex-1 flex-col bg-[#f8fafc] dark:bg-[hsl(222.34deg_10.43%_12.27%)]" content-class="flex min-h-0 flex-1 flex-col bg-[#f8fafc] p-4 dark:bg-[hsl(222.34deg_10.43%_12.27%)]"
> >
<div class="text-slate-500">店铺详情看板接口已下线。</div> <Spin :spinning="loading">
<div v-if="shop" class="space-y-4 rounded-lg bg-white p-5 dark:bg-[hsl(222.34deg_10.43%_14%)]">
<div class="flex items-start gap-4">
<img
v-if="shop.logo"
:src="shop.logo"
:alt="shop.name"
class="h-20 w-20 rounded-md border border-slate-200 object-cover"
/>
<div class="min-w-0 flex-1 space-y-2">
<div class="text-lg font-semibold">{{ shop.name }}</div>
<div class="flex flex-wrap items-center gap-2">
<Tag
v-if="shop.platformCode"
:color="getPlatformTagColor(shop.platformCode)"
>
{{ getPlatformLabel(shop.platformCode, shop.platformName) }}
</Tag>
<Tag v-else color="default">未设置平台</Tag>
</div>
</div>
</div>
<Descriptions :column="2" bordered size="small" title="基础信息">
<Descriptions.Item label="店铺ID">{{ shop.id }}</Descriptions.Item>
<Descriptions.Item label="平台店铺主键">
{{ shop.externalShopId ?? '-' }}
</Descriptions.Item>
<Descriptions.Item label="创建时间">
{{ shop.createTime || '-' }}
</Descriptions.Item>
<Descriptions.Item label="更新时间">
{{ shop.updateTime || '-' }}
</Descriptions.Item>
</Descriptions>
<div v-if="shop.platformCode === 'pdd'">
<Descriptions :column="2" bordered size="small" title="拼多多平台店铺">
<template v-if="shop.pddShop">
<Descriptions.Item label="店铺名称">
<a class="text-primary" @click="openPddShopDetail">
{{ shop.pddShop.mallName || '-' }}
</a>
</Descriptions.Item>
<Descriptions.Item label="mall_id">
{{ shop.pddShop.mallId }}
</Descriptions.Item>
<Descriptions.Item label="授权">
<Tag :color="shop.pddShop.pddAuthId ? 'success' : 'default'">
{{ shop.pddShop.pddAuthId ? '已绑定' : '未绑定' }}
</Tag>
</Descriptions.Item>
<Descriptions.Item label="详情">
<a class="text-primary" @click="openPddShopDetail">查看完整信息</a>
</Descriptions.Item>
</template>
<Descriptions.Item v-else label="绑定状态" :span="2">
未绑定拼多多平台店铺
</Descriptions.Item>
</Descriptions>
</div>
</div>
<div v-else-if="!loading" class="text-slate-500">店铺不存在或暂无数据</div>
</Spin>
<PddShopDetailModal ref="pddShopDetailModalRef" />
</Page> </Page>
</template> </template>
@@ -5,7 +5,9 @@ import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { Descriptions, Tag } from 'ant-design-vue'; import { Descriptions, Spin, Tag, message } from 'ant-design-vue';
import { getPddShopDetailApi } from '#/api/ecommerce/pdd/shop';
const MERCHANT_TYPE_MAP: Record<number, string> = { const MERCHANT_TYPE_MAP: Record<number, string> = {
1: '个人', 1: '个人',
@@ -23,6 +25,13 @@ const MALL_CHARACTER_MAP: Record<number, string> = {
3: '都是', 3: '都是',
}; };
const AUTH_STATUS_MAP: Record<number, { color: string; label: string }> = {
0: { color: 'error', label: '失效' },
1: { color: 'success', label: '正常' },
2: { color: 'default', label: '已撤销' },
};
const loading = ref(false);
const pddShop = ref<null | PddShopInfo>(null); const pddShop = ref<null | PddShopInfo>(null);
const internalShopName = ref(''); const internalShopName = ref('');
@@ -45,10 +54,34 @@ const mallCharacterLabel = computed(() => {
return MALL_CHARACTER_MAP[character] ?? String(character); return MALL_CHARACTER_MAP[character] ?? String(character);
}); });
function open(shop: PddShopInfo, shopName?: string) { const authStatus = computed(() => {
pddShop.value = shop; const status = pddShop.value?.auth?.status;
if (status == null) {
return pddShop.value?.pddAuthId
? { color: 'success', label: '已绑定' }
: { color: 'default', label: '未绑定' };
}
return AUTH_STATUS_MAP[status] ?? { color: 'default', label: String(status) };
});
async function open(pddShopId: number, shopName?: string) {
if (!pddShopId) {
message.warning('暂无外部店铺详情,请先完成授权同步');
return;
}
internalShopName.value = shopName || ''; internalShopName.value = shopName || '';
pddShop.value = null;
modalApi.open(); modalApi.open();
try {
loading.value = true;
pddShop.value = await getPddShopDetailApi(pddShopId);
} catch (error) {
console.error('获取拼多多店铺详情失败:', error);
message.error('获取拼多多店铺详情失败');
modalApi.close();
} finally {
loading.value = false;
}
} }
defineExpose({ open }); defineExpose({ open });
@@ -56,52 +89,84 @@ defineExpose({ open });
<template> <template>
<Modal title="拼多多外部店铺" content-class="px-5 py-4"> <Modal title="拼多多外部店铺" content-class="px-5 py-4">
<div v-if="pddShop" class="space-y-4"> <Spin :spinning="loading">
<div class="flex items-center gap-3"> <div v-if="pddShop" class="space-y-4">
<img <div class="flex items-center gap-3">
v-if="pddShop.logo" <img
:src="pddShop.logo" v-if="pddShop.logo"
:alt="pddShop.mallName" :src="pddShop.logo"
class="h-14 w-14 rounded-md border border-slate-200 object-cover" :alt="pddShop.mallName"
/> class="h-14 w-14 rounded-md border border-slate-200 object-cover"
<div> />
<div class="text-base font-medium"> <div>
{{ pddShop.mallName || '-' }} <div class="text-base font-medium">
</div> {{ pddShop.mallName || '-' }}
<div v-if="internalShopName" class="mt-1 text-xs text-slate-500"> </div>
内部店铺:{{ internalShopName }} <div v-if="internalShopName" class="mt-1 text-xs text-slate-500">
内部店铺:{{ internalShopName }}
</div>
</div> </div>
</div> </div>
</div>
<Descriptions :column="1" bordered size="small"> <Descriptions :column="1" bordered size="small" title="店铺信息">
<Descriptions.Item label="mall_id"> <Descriptions.Item label="平台店铺主键">
{{ pddShop.mallId }} {{ pddShop.id }}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="授权状态"> <Descriptions.Item label="mall_id">
<Tag :color="pddShop.pddAuthId ? 'success' : 'default'"> {{ pddShop.mallId }}
{{ pddShop.pddAuthId ? '已绑定授权' : '未绑定授权' }} </Descriptions.Item>
</Tag> <Descriptions.Item label="店铺类型">
</Descriptions.Item> {{ merchantTypeLabel }}
<Descriptions.Item label="店铺类型"> </Descriptions.Item>
{{ merchantTypeLabel }} <Descriptions.Item label="店铺身份">
</Descriptions.Item> {{ mallCharacterLabel }}
<Descriptions.Item label="店铺身份"> </Descriptions.Item>
{{ mallCharacterLabel }} <Descriptions.Item label="店铺描述">
</Descriptions.Item> {{ pddShop.mallDesc || '-' }}
<Descriptions.Item label="店铺描述"> </Descriptions.Item>
{{ pddShop.mallDesc || '-' }} <Descriptions.Item label="最近同步">
</Descriptions.Item> {{ pddShop.lastSyncTime || '-' }}
<Descriptions.Item label="最近同步"> </Descriptions.Item>
{{ pddShop.lastSyncTime || '-' }} <Descriptions.Item label="创建时间">
</Descriptions.Item> {{ pddShop.createTime || '-' }}
<Descriptions.Item label="创建时间"> </Descriptions.Item>
{{ pddShop.createTime || '-' }} <Descriptions.Item label="更新时间">
</Descriptions.Item> {{ pddShop.updateTime || '-' }}
<Descriptions.Item label="更新时间"> </Descriptions.Item>
{{ pddShop.updateTime || '-' }} </Descriptions>
</Descriptions.Item>
</Descriptions> <Descriptions :column="1" bordered size="small" title="授权信息">
</div> <Descriptions.Item label="授权状态">
<Tag :color="authStatus.color">{{ authStatus.label }}</Tag>
</Descriptions.Item>
<template v-if="pddShop.auth">
<Descriptions.Item label="授权ID">
{{ pddShop.auth.id }}
</Descriptions.Item>
<Descriptions.Item label="owner_id">
{{ pddShop.auth.ownerId || '-' }}
</Descriptions.Item>
<Descriptions.Item label="Token 过期">
{{ pddShop.auth.expiresAt || '-' }}
</Descriptions.Item>
<Descriptions.Item label="Refresh 过期">
{{ pddShop.auth.refreshTokenExpiresAt || '-' }}
</Descriptions.Item>
<Descriptions.Item label="授权时间">
{{ pddShop.auth.createTime || '-' }}
</Descriptions.Item>
<Descriptions.Item label="更新时间">
{{ pddShop.auth.updateTime || '-' }}
</Descriptions.Item>
</template>
<Descriptions.Item v-else label="授权详情">
未绑定授权
</Descriptions.Item>
</Descriptions>
</div>
<div v-else-if="!loading" class="py-8 text-center text-slate-400">
暂无数据
</div>
</Spin>
</Modal> </Modal>
</template> </template>
@@ -362,11 +362,12 @@ function handleModalSuccess() {
} }
function handleViewExternalShop(record: ShopVO.Info) { function handleViewExternalShop(record: ShopVO.Info) {
if (!record.pddShop) { const pddShopId = record.pddShop?.id ?? record.externalShopId;
if (!pddShopId) {
message.warning('暂无外部店铺详情,请先完成授权同步'); message.warning('暂无外部店铺详情,请先完成授权同步');
return; return;
} }
pddShopDetailModalRef.value?.open(record.pddShop, record.name); pddShopDetailModalRef.value?.open(Number(pddShopId), record.name);
} }
function handleSyncPddOrders(record: ShopVO.Info) { function handleSyncPddOrders(record: ShopVO.Info) {
@@ -477,7 +478,7 @@ onUnmounted(() => {
v-else-if="row.externalShopId" v-else-if="row.externalShopId"
class="text-center text-xs text-slate-500" class="text-center text-xs text-slate-500"
> >
mall_id: {{ row.externalShopId }} 平台店#{{ row.externalShopId }}
</span> </span>
</div> </div>
<span v-else class="text-slate-400">-</span> <span v-else class="text-slate-400">-</span>