mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:19:19 +08:00
feat: 新增拼多多店铺日推广费和开放接口
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
-- ========================================
|
||||
-- 拼多多商品广告费/推广费(按日)数据库设计
|
||||
--
|
||||
-- 设计原则:
|
||||
-- 1. 与 ec_promotion_fee(内部经营推广费)分离,本表存渠道侧按日统计原始/同步数据
|
||||
-- 2. 广告费维度跟随 channel_pdd_goods(SPU),用 goods_id(+ channel_shop_id)关联商品
|
||||
-- 3. 统计粒度为「渠道店铺商品 × 自然日」一条;同日重复同步按唯一键覆盖/幂等写入
|
||||
-- 4. 金额单位:元(decimal),与 ec_promotion_fee.fee_amount 一致;后续若接口以分为单位需入库前换算
|
||||
-- 5. channel_shop_id = channel_pdd_shop.id(非 ec_shop.id);mall_id 为拼多多侧店铺号
|
||||
-- ========================================
|
||||
|
||||
DROP TABLE IF EXISTS `channel_pdd_goods_ad_fee_daily`;
|
||||
CREATE TABLE `channel_pdd_goods_ad_fee_daily` (
|
||||
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`company_id` bigint UNSIGNED NOT NULL COMMENT '公司ID',
|
||||
`channel_shop_id` bigint UNSIGNED NOT NULL COMMENT '渠道店铺ID(channel_pdd_shop.id,非 ec_shop.id)',
|
||||
`mall_id` bigint UNSIGNED NOT NULL COMMENT '拼多多店铺ID(mall_id)',
|
||||
`goods_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '拼多多商品ID(goods_id,对应 channel_pdd_goods.goods_id)',
|
||||
`fee_date` date NOT NULL COMMENT '广告费统计日期(自然日)',
|
||||
`fee_amount` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '当日广告费金额(元)',
|
||||
`raw_response` json NULL COMMENT '原始报文/扩展指标 JSON(点击、曝光等可先落于此)',
|
||||
`last_sync_time` datetime NOT NULL COMMENT '最近一次同步时间',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '入库时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_channel_pdd_goods_ad_fee_daily`(`channel_shop_id` ASC, `goods_id` ASC, `fee_date` ASC) USING BTREE,
|
||||
INDEX `idx_channel_pdd_goods_ad_fee_company_date`(`company_id` ASC, `fee_date` ASC) USING BTREE,
|
||||
INDEX `idx_channel_pdd_goods_ad_fee_goods_date`(`goods_id` ASC, `fee_date` ASC) USING BTREE,
|
||||
INDEX `idx_channel_pdd_goods_ad_fee_sync`(`last_sync_time` ASC) USING BTREE,
|
||||
CONSTRAINT `fk_channel_pdd_goods_ad_fee_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_channel_pdd_goods_ad_fee_channel_shop` FOREIGN KEY (`channel_shop_id`) REFERENCES `channel_pdd_shop` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '拼多多-商品广告费按日统计表' ROW_FORMAT = Dynamic;
|
||||
@@ -0,0 +1,53 @@
|
||||
-- 拼多多商品广告费按日表 + 菜单/权限/开放 scope(幂等)
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `channel_pdd_goods_ad_fee_daily` (
|
||||
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`company_id` bigint UNSIGNED NOT NULL COMMENT '公司ID',
|
||||
`channel_shop_id` bigint UNSIGNED NOT NULL COMMENT '渠道店铺ID(channel_pdd_shop.id,非 ec_shop.id)',
|
||||
`mall_id` bigint UNSIGNED NOT NULL COMMENT '拼多多店铺ID(mall_id)',
|
||||
`goods_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '拼多多商品ID(goods_id,对应 channel_pdd_goods.goods_id)',
|
||||
`fee_date` date NOT NULL COMMENT '广告费统计日期(自然日)',
|
||||
`fee_amount` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '当日广告费金额(元)',
|
||||
`raw_response` json NULL COMMENT '原始报文/扩展指标 JSON(点击、曝光等可先落于此)',
|
||||
`last_sync_time` datetime NOT NULL COMMENT '最近一次同步时间',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '入库时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_channel_pdd_goods_ad_fee_daily`(`channel_shop_id` ASC, `goods_id` ASC, `fee_date` ASC) USING BTREE,
|
||||
INDEX `idx_channel_pdd_goods_ad_fee_company_date`(`company_id` ASC, `fee_date` ASC) USING BTREE,
|
||||
INDEX `idx_channel_pdd_goods_ad_fee_goods_date`(`goods_id` ASC, `fee_date` ASC) USING BTREE,
|
||||
INDEX `idx_channel_pdd_goods_ad_fee_sync`(`last_sync_time` ASC) USING BTREE,
|
||||
CONSTRAINT `fk_channel_pdd_goods_ad_fee_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_channel_pdd_goods_ad_fee_channel_shop` FOREIGN KEY (`channel_shop_id`) REFERENCES `channel_pdd_shop` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '拼多多-商品广告费按日统计表' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- 权限
|
||||
INSERT INTO `sys_permission` (`parent_id`, `code`, `name`, `type`, `status`, `remark`, `sort_order`)
|
||||
SELECT (SELECT id FROM `sys_permission` WHERE `code` = 'biz:pdd' LIMIT 1), 'biz:pdd:ad-fee:read', '拼多多商品广告费查看', 'api', 1, '', 366
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'biz:pdd:ad-fee:read');
|
||||
|
||||
INSERT INTO `sys_permission` (`parent_id`, `code`, `name`, `type`, `status`, `remark`, `sort_order`)
|
||||
SELECT (SELECT id FROM `sys_permission` WHERE `code` = 'biz:pdd' LIMIT 1), 'biz:pdd:ad-fee:manage', '拼多多商品广告费管理', 'api', 1, '维护/批量导入广告费', 367
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'biz:pdd:ad-fee:manage');
|
||||
|
||||
INSERT INTO `sys_permission` (`parent_id`, `code`, `name`, `type`, `status`, `remark`, `sort_order`)
|
||||
SELECT (SELECT id FROM `sys_permission` WHERE `code` = 'MODULE:open' LIMIT 1), 'open:scope:pdd_goods_ad_fee:import', '开放-拼多多商品广告费导入', 'api', 1, 'POST /open/v1/channel/pdd/goods/adfee/batch-import', 70
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'open:scope:pdd_goods_ad_fee:import');
|
||||
|
||||
INSERT INTO `sys_permission` (`parent_id`, `code`, `name`, `type`, `status`, `remark`, `sort_order`)
|
||||
SELECT (SELECT id FROM `sys_permission` WHERE `code` = 'MODULE:open' LIMIT 1), 'open:scope:pdd_shop:read', '开放-拼多多渠道店铺查询', 'api', 1, 'POST /open/v1/channel/pdd/shop/list', 80
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'open:scope:pdd_shop:read');
|
||||
|
||||
-- 菜单
|
||||
INSERT INTO `sys_menu` (`parent_id`, `super`, `name`, `title`, `path`, `component`, `redirect`, `icon`, `type`, `visible`, `status`, `keep_alive`, `order`)
|
||||
SELECT m.id, 0, '拼多多商品广告费', '商品广告费', '/pdd/goods-ad-fee', '/channel/pdd/goods-ad-fee/index', '', 'lucide:megaphone', 'menu', 1, 1, 0, 3
|
||||
FROM `sys_menu` m
|
||||
WHERE m.`name` = '拼多多'
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_menu` x WHERE x.`name` = '拼多多商品广告费')
|
||||
LIMIT 1;
|
||||
|
||||
INSERT IGNORE INTO `sys_menu_permission` (`menu_id`, `permission_id`)
|
||||
SELECT m.id, p.id
|
||||
FROM `sys_menu` m
|
||||
JOIN `sys_permission` p ON p.code IN ('biz:pdd:ad-fee:read', 'biz:pdd:ad-fee:manage')
|
||||
WHERE m.name = '拼多多商品广告费';
|
||||
@@ -0,0 +1,4 @@
|
||||
-- 开放接口:拼多多渠道店铺列表 scope
|
||||
INSERT INTO `sys_permission` (`parent_id`, `code`, `name`, `type`, `status`, `remark`, `sort_order`)
|
||||
SELECT (SELECT id FROM `sys_permission` WHERE `code` = 'MODULE:open' LIMIT 1), 'open:scope:pdd_shop:read', '开放-拼多多渠道店铺查询', 'api', 1, 'POST /open/v1/channel/pdd/shop/list', 80
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'open:scope:pdd_shop:read');
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import top.xyquan.ecomdmbbackend.common.annotation.RequirePermission;
|
||||
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
|
||||
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
|
||||
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.BatchImportPddGoodsAdFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.CreatePddGoodsAdFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.PddGoodsAdFeeFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.UpdatePddGoodsAdFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.vo.BatchImportPddGoodsAdFeeResultVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.vo.PddGoodsAdFeeVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.service.PddGoodsAdFeeService;
|
||||
|
||||
@Tag(name = "拼多多-商品广告费", description = "拼多多商品按日广告费增删改查")
|
||||
@RestController
|
||||
@RequestMapping("/api/channel/pdd/goods/adfee")
|
||||
@RequiredArgsConstructor
|
||||
public class PddGoodsAdFeeController {
|
||||
|
||||
private final PddGoodsAdFeeService pddGoodsAdFeeService;
|
||||
|
||||
@Operation(summary = "创建")
|
||||
@PostMapping("/create")
|
||||
@RequirePermission(value = "biz:pdd:ad-fee:manage", description = "创建拼多多商品广告费", allowSuper = true)
|
||||
public ApiResponse<PddGoodsAdFeeVO> create(@Valid @RequestBody CreatePddGoodsAdFeeDTO dto) {
|
||||
return ApiResponse.success("创建成功", pddGoodsAdFeeService.create(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新")
|
||||
@PutMapping("/update/{id}")
|
||||
@RequirePermission(value = "biz:pdd:ad-fee:manage", description = "更新拼多多商品广告费", allowSuper = true)
|
||||
public ApiResponse<PddGoodsAdFeeVO> update(
|
||||
@Parameter(description = "记录ID") @PathVariable Long id,
|
||||
@Valid @RequestBody UpdatePddGoodsAdFeeDTO dto) {
|
||||
return ApiResponse.success("更新成功", pddGoodsAdFeeService.update(id, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@RequirePermission(value = "biz:pdd:ad-fee:manage", description = "删除拼多多商品广告费", allowSuper = true)
|
||||
public ApiResponse<Void> delete(@Parameter(description = "记录ID") @PathVariable Long id) {
|
||||
pddGoodsAdFeeService.delete(id);
|
||||
return ApiResponse.success("删除成功");
|
||||
}
|
||||
|
||||
@Operation(summary = "详情")
|
||||
@GetMapping("/detail/{id}")
|
||||
@RequirePermission(value = "biz:pdd:ad-fee:read", description = "查询拼多多商品广告费详情", allowSuper = true)
|
||||
public ApiResponse<PddGoodsAdFeeVO> detail(@Parameter(description = "记录ID") @PathVariable Long id) {
|
||||
return ApiResponse.success("获取成功", pddGoodsAdFeeService.getDetail(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页列表")
|
||||
@PostMapping("/list")
|
||||
@RequirePermission(value = "biz:pdd:ad-fee:read", description = "查询拼多多商品广告费列表", allowSuper = true)
|
||||
public ApiResponse<PageResultVO<PddGoodsAdFeeVO>> list(
|
||||
@Valid @RequestBody PageQueryDTO<PddGoodsAdFeeFilterDTO> pageQueryDTO) {
|
||||
return ApiResponse.success("获取成功", pddGoodsAdFeeService.getPage(pageQueryDTO));
|
||||
}
|
||||
|
||||
@Operation(summary = "批量导入/覆盖", description = "按 goods_id+日期 upsert,店铺从商品表反查")
|
||||
@PostMapping("/batch-import")
|
||||
@RequirePermission(value = "biz:pdd:ad-fee:manage", description = "批量导入拼多多商品广告费", allowSuper = true)
|
||||
public ApiResponse<BatchImportPddGoodsAdFeeResultVO> batchImport(
|
||||
@Valid @RequestBody BatchImportPddGoodsAdFeeDTO dto) {
|
||||
return ApiResponse.success("批量导入完成", pddGoodsAdFeeService.batchImport(dto));
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.po.PddGoodsAdFeeDailyPO;
|
||||
|
||||
@Mapper
|
||||
public interface PddGoodsAdFeeDailyMapper extends BaseMapper<PddGoodsAdFeeDailyPO> {
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "批量导入拼多多商品广告费")
|
||||
public class BatchImportPddGoodsAdFeeDTO {
|
||||
|
||||
@NotEmpty(message = "广告费记录不能为空")
|
||||
@Valid
|
||||
@Schema(description = "广告费记录列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<BatchImportPddGoodsAdFeeItemDTO> items;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@Schema(description = "批量导入拼多多商品广告费单条")
|
||||
public class BatchImportPddGoodsAdFeeItemDTO {
|
||||
|
||||
@NotNull(message = "渠道店铺ID不能为空")
|
||||
@Schema(description = "渠道店铺ID(channel_pdd_shop.id)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long channelShopId;
|
||||
|
||||
@NotNull(message = "统计日期不能为空")
|
||||
@Schema(description = "广告费统计日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDate feeDate;
|
||||
|
||||
@NotBlank(message = "商品ID不能为空")
|
||||
@Schema(description = "拼多多商品ID(goods_id)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String goodsId;
|
||||
|
||||
@NotNull(message = "广告费金额不能为空")
|
||||
@Schema(description = "广告费金额(元)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal feeAmount;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@Schema(description = "创建拼多多商品广告费")
|
||||
public class CreatePddGoodsAdFeeDTO {
|
||||
|
||||
@NotNull(message = "渠道店铺ID不能为空")
|
||||
@Schema(description = "渠道店铺ID(channel_pdd_shop.id)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long channelShopId;
|
||||
|
||||
@NotBlank(message = "商品ID不能为空")
|
||||
@Schema(description = "拼多多商品ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String goodsId;
|
||||
|
||||
@NotNull(message = "统计日期不能为空")
|
||||
@Schema(description = "广告费统计日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDate feeDate;
|
||||
|
||||
@NotNull(message = "广告费金额不能为空")
|
||||
@Schema(description = "广告费金额(元)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal feeAmount;
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@Schema(description = "拼多多商品广告费过滤条件")
|
||||
public class PddGoodsAdFeeFilterDTO {
|
||||
|
||||
@Schema(description = "渠道店铺ID(channel_pdd_shop.id)")
|
||||
private Long channelShopId;
|
||||
|
||||
@Schema(description = "拼多多商品ID")
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "统计日期起")
|
||||
private LocalDate feeDateStart;
|
||||
|
||||
@Schema(description = "统计日期止")
|
||||
private LocalDate feeDateEnd;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@Schema(description = "更新拼多多商品广告费")
|
||||
public class UpdatePddGoodsAdFeeDTO {
|
||||
|
||||
@NotNull(message = "渠道店铺ID不能为空")
|
||||
@Schema(description = "渠道店铺ID(channel_pdd_shop.id)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long channelShopId;
|
||||
|
||||
@NotBlank(message = "商品ID不能为空")
|
||||
@Schema(description = "拼多多商品ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String goodsId;
|
||||
|
||||
@NotNull(message = "统计日期不能为空")
|
||||
@Schema(description = "广告费统计日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDate feeDate;
|
||||
|
||||
@NotNull(message = "广告费金额不能为空")
|
||||
@Schema(description = "广告费金额(元)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal feeAmount;
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("channel_pdd_goods_ad_fee_daily")
|
||||
public class PddGoodsAdFeeDailyPO {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField("company_id")
|
||||
private Long companyId;
|
||||
|
||||
/** 渠道店铺ID(channel_pdd_shop.id) */
|
||||
@TableField("channel_shop_id")
|
||||
private Long channelShopId;
|
||||
|
||||
@TableField("mall_id")
|
||||
private Long mallId;
|
||||
|
||||
@TableField("goods_id")
|
||||
private String goodsId;
|
||||
|
||||
@TableField("fee_date")
|
||||
private LocalDate feeDate;
|
||||
|
||||
@TableField("fee_amount")
|
||||
private BigDecimal feeAmount;
|
||||
|
||||
@TableField("raw_response")
|
||||
private String rawResponse;
|
||||
|
||||
@TableField("last_sync_time")
|
||||
private LocalDateTime lastSyncTime;
|
||||
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "拼多多商品广告费批量导入结果")
|
||||
public class BatchImportPddGoodsAdFeeResultVO {
|
||||
|
||||
private Integer totalCount;
|
||||
private Integer successCount;
|
||||
private Integer failureCount;
|
||||
private List<Long> successIds;
|
||||
private List<ImportFailureRecord> failureRecords;
|
||||
|
||||
@Data
|
||||
@Schema(description = "导入失败记录")
|
||||
public static class ImportFailureRecord {
|
||||
private Integer rowNumber;
|
||||
private Long channelShopId;
|
||||
private String goodsId;
|
||||
private String failureReason;
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Schema(description = "拼多多商品广告费 VO")
|
||||
public class PddGoodsAdFeeVO {
|
||||
|
||||
private Long id;
|
||||
private Long companyId;
|
||||
private Long channelShopId;
|
||||
private String channelShopName;
|
||||
private Long mallId;
|
||||
private String goodsId;
|
||||
private String goodsName;
|
||||
private LocalDate feeDate;
|
||||
private BigDecimal feeAmount;
|
||||
private LocalDateTime lastSyncTime;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.service;
|
||||
|
||||
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
|
||||
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.BatchImportPddGoodsAdFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.CreatePddGoodsAdFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.PddGoodsAdFeeFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.UpdatePddGoodsAdFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.vo.BatchImportPddGoodsAdFeeResultVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.vo.PddGoodsAdFeeVO;
|
||||
|
||||
public interface PddGoodsAdFeeService {
|
||||
|
||||
PddGoodsAdFeeVO create(CreatePddGoodsAdFeeDTO dto);
|
||||
|
||||
PddGoodsAdFeeVO update(Long id, UpdatePddGoodsAdFeeDTO dto);
|
||||
|
||||
void delete(Long id);
|
||||
|
||||
PddGoodsAdFeeVO getDetail(Long id);
|
||||
|
||||
PageResultVO<PddGoodsAdFeeVO> getPage(PageQueryDTO<PddGoodsAdFeeFilterDTO> pageQueryDTO);
|
||||
|
||||
/**
|
||||
* 按 channelShopId + goods_id + fee_date + fee_amount 批量写入(存在则覆盖金额)。
|
||||
*/
|
||||
BatchImportPddGoodsAdFeeResultVO batchImport(BatchImportPddGoodsAdFeeDTO dto);
|
||||
}
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
import top.xyquan.ecomdmbbackend.common.exception.BusinessException;
|
||||
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
|
||||
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
|
||||
import top.xyquan.ecomdmbbackend.common.utils.BeanCopyUtils;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.mapper.PddGoodsAdFeeDailyMapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.BatchImportPddGoodsAdFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.BatchImportPddGoodsAdFeeItemDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.CreatePddGoodsAdFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.PddGoodsAdFeeFilterDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.UpdatePddGoodsAdFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.po.PddGoodsAdFeeDailyPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.vo.BatchImportPddGoodsAdFeeResultVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.vo.PddGoodsAdFeeVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.service.PddGoodsAdFeeService;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.mapper.PddGoodsMapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.model.po.PddGoodsPO;
|
||||
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.utils.CurrentUserContext;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PddGoodsAdFeeServiceImpl implements PddGoodsAdFeeService {
|
||||
|
||||
private final PddGoodsAdFeeDailyMapper adFeeMapper;
|
||||
private final PddShopMapper pddShopMapper;
|
||||
private final PddGoodsMapper pddGoodsMapper;
|
||||
private final CurrentUserContext currentUserContext;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PddGoodsAdFeeVO create(CreatePddGoodsAdFeeDTO dto) {
|
||||
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||
PddShopPO shop = requireOwnedShop(dto.getChannelShopId(), companyId);
|
||||
assertGoodsInShop(companyId, shop.getId(), dto.getGoodsId());
|
||||
assertUnique(shop.getId(), dto.getGoodsId(), dto.getFeeDate(), null);
|
||||
assertFeeAmount(dto.getFeeAmount());
|
||||
|
||||
PddGoodsAdFeeDailyPO po = new PddGoodsAdFeeDailyPO();
|
||||
po.setCompanyId(companyId);
|
||||
po.setChannelShopId(shop.getId());
|
||||
po.setMallId(shop.getMallId());
|
||||
po.setGoodsId(dto.getGoodsId().trim());
|
||||
po.setFeeDate(dto.getFeeDate());
|
||||
po.setFeeAmount(dto.getFeeAmount());
|
||||
po.setLastSyncTime(LocalDateTime.now());
|
||||
adFeeMapper.insert(po);
|
||||
return toVo(po);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PddGoodsAdFeeVO update(Long id, UpdatePddGoodsAdFeeDTO dto) {
|
||||
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||
PddGoodsAdFeeDailyPO existing = requireOwnedRecord(id, companyId);
|
||||
PddShopPO shop = requireOwnedShop(dto.getChannelShopId(), companyId);
|
||||
assertGoodsInShop(companyId, shop.getId(), dto.getGoodsId());
|
||||
assertUnique(shop.getId(), dto.getGoodsId(), dto.getFeeDate(), id);
|
||||
assertFeeAmount(dto.getFeeAmount());
|
||||
|
||||
existing.setChannelShopId(shop.getId());
|
||||
existing.setMallId(shop.getMallId());
|
||||
existing.setGoodsId(dto.getGoodsId().trim());
|
||||
existing.setFeeDate(dto.getFeeDate());
|
||||
existing.setFeeAmount(dto.getFeeAmount());
|
||||
existing.setLastSyncTime(LocalDateTime.now());
|
||||
adFeeMapper.updateById(existing);
|
||||
return toVo(existing);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Long id) {
|
||||
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||
requireOwnedRecord(id, companyId);
|
||||
adFeeMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PddGoodsAdFeeVO getDetail(Long id) {
|
||||
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||
return toVo(requireOwnedRecord(id, companyId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResultVO<PddGoodsAdFeeVO> getPage(PageQueryDTO<PddGoodsAdFeeFilterDTO> pageQueryDTO) {
|
||||
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||
PddGoodsAdFeeFilterDTO filters =
|
||||
pageQueryDTO.getFilters() != null ? pageQueryDTO.getFilters() : new PddGoodsAdFeeFilterDTO();
|
||||
|
||||
LambdaQueryWrapper<PddGoodsAdFeeDailyPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PddGoodsAdFeeDailyPO::getCompanyId, companyId);
|
||||
if (filters.getChannelShopId() != null) {
|
||||
wrapper.eq(PddGoodsAdFeeDailyPO::getChannelShopId, filters.getChannelShopId());
|
||||
}
|
||||
if (StringUtils.hasText(filters.getGoodsId())) {
|
||||
wrapper.eq(PddGoodsAdFeeDailyPO::getGoodsId, filters.getGoodsId().trim());
|
||||
}
|
||||
if (filters.getFeeDateStart() != null) {
|
||||
wrapper.ge(PddGoodsAdFeeDailyPO::getFeeDate, filters.getFeeDateStart());
|
||||
}
|
||||
if (filters.getFeeDateEnd() != null) {
|
||||
wrapper.le(PddGoodsAdFeeDailyPO::getFeeDate, filters.getFeeDateEnd());
|
||||
}
|
||||
wrapper.orderByDesc(PddGoodsAdFeeDailyPO::getFeeDate)
|
||||
.orderByDesc(PddGoodsAdFeeDailyPO::getId);
|
||||
|
||||
Page<PddGoodsAdFeeDailyPO> page = new Page<>(pageQueryDTO.getPage(), pageQueryDTO.getPageSize());
|
||||
IPage<PddGoodsAdFeeDailyPO> result = adFeeMapper.selectPage(page, wrapper);
|
||||
List<PddGoodsAdFeeVO> records = enrich(result.getRecords());
|
||||
return PageResultVO.create(records, result.getTotal(),
|
||||
(int) pageQueryDTO.getPage(), (int) pageQueryDTO.getPageSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BatchImportPddGoodsAdFeeResultVO batchImport(BatchImportPddGoodsAdFeeDTO dto) {
|
||||
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||
List<BatchImportPddGoodsAdFeeItemDTO> items = dto.getItems();
|
||||
|
||||
BatchImportPddGoodsAdFeeResultVO result = new BatchImportPddGoodsAdFeeResultVO();
|
||||
result.setTotalCount(items.size());
|
||||
result.setSuccessIds(new ArrayList<>());
|
||||
result.setFailureRecords(new ArrayList<>());
|
||||
|
||||
int success = 0;
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
BatchImportPddGoodsAdFeeItemDTO item = items.get(i);
|
||||
int rowNumber = i + 1;
|
||||
try {
|
||||
Long id = upsertByChannelShopAndGoods(companyId, item);
|
||||
result.getSuccessIds().add(id);
|
||||
success++;
|
||||
} catch (Exception e) {
|
||||
BatchImportPddGoodsAdFeeResultVO.ImportFailureRecord failure =
|
||||
new BatchImportPddGoodsAdFeeResultVO.ImportFailureRecord();
|
||||
failure.setRowNumber(rowNumber);
|
||||
failure.setChannelShopId(item.getChannelShopId());
|
||||
failure.setGoodsId(item.getGoodsId());
|
||||
failure.setFailureReason(e.getMessage() != null ? e.getMessage() : "导入失败");
|
||||
result.getFailureRecords().add(failure);
|
||||
}
|
||||
}
|
||||
result.setSuccessCount(success);
|
||||
result.setFailureCount(items.size() - success);
|
||||
return result;
|
||||
}
|
||||
|
||||
private Long upsertByChannelShopAndGoods(Long companyId, BatchImportPddGoodsAdFeeItemDTO item) {
|
||||
if (item.getChannelShopId() == null) {
|
||||
throw new BusinessException("渠道店铺ID不能为空");
|
||||
}
|
||||
if (item.getFeeAmount() == null || item.getFeeAmount().compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new BusinessException("广告费金额不能为空且须大于等于0");
|
||||
}
|
||||
if (!StringUtils.hasText(item.getGoodsId())) {
|
||||
throw new BusinessException("商品ID不能为空");
|
||||
}
|
||||
if (item.getFeeDate() == null) {
|
||||
throw new BusinessException("统计日期不能为空");
|
||||
}
|
||||
|
||||
PddShopPO shop = requireOwnedShop(item.getChannelShopId(), companyId);
|
||||
String goodsId = item.getGoodsId().trim();
|
||||
assertGoodsInShop(companyId, shop.getId(), goodsId);
|
||||
|
||||
PddGoodsAdFeeDailyPO existing = adFeeMapper.selectOne(new LambdaQueryWrapper<PddGoodsAdFeeDailyPO>()
|
||||
.eq(PddGoodsAdFeeDailyPO::getChannelShopId, shop.getId())
|
||||
.eq(PddGoodsAdFeeDailyPO::getGoodsId, goodsId)
|
||||
.eq(PddGoodsAdFeeDailyPO::getFeeDate, item.getFeeDate())
|
||||
.last("LIMIT 1"));
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (existing != null) {
|
||||
existing.setFeeAmount(item.getFeeAmount());
|
||||
existing.setMallId(shop.getMallId());
|
||||
existing.setLastSyncTime(now);
|
||||
adFeeMapper.updateById(existing);
|
||||
return existing.getId();
|
||||
}
|
||||
|
||||
PddGoodsAdFeeDailyPO po = new PddGoodsAdFeeDailyPO();
|
||||
po.setCompanyId(companyId);
|
||||
po.setChannelShopId(shop.getId());
|
||||
po.setMallId(shop.getMallId());
|
||||
po.setGoodsId(goodsId);
|
||||
po.setFeeDate(item.getFeeDate());
|
||||
po.setFeeAmount(item.getFeeAmount());
|
||||
po.setLastSyncTime(now);
|
||||
adFeeMapper.insert(po);
|
||||
return po.getId();
|
||||
}
|
||||
|
||||
private PddShopPO requireOwnedShop(Long channelShopId, Long companyId) {
|
||||
PddShopPO shop = pddShopMapper.selectById(channelShopId);
|
||||
if (shop == null || !Objects.equals(shop.getCompanyId(), companyId)) {
|
||||
throw new BusinessException("渠道店铺不存在或无权访问");
|
||||
}
|
||||
return shop;
|
||||
}
|
||||
|
||||
private PddGoodsAdFeeDailyPO requireOwnedRecord(Long id, Long companyId) {
|
||||
PddGoodsAdFeeDailyPO po = adFeeMapper.selectById(id);
|
||||
if (po == null || !Objects.equals(po.getCompanyId(), companyId)) {
|
||||
throw new BusinessException("广告费记录不存在或无权访问");
|
||||
}
|
||||
return po;
|
||||
}
|
||||
|
||||
private void assertGoodsInShop(Long companyId, Long channelShopId, String goodsId) {
|
||||
Long count = pddGoodsMapper.selectCount(new LambdaQueryWrapper<PddGoodsPO>()
|
||||
.eq(PddGoodsPO::getCompanyId, companyId)
|
||||
.eq(PddGoodsPO::getShopId, channelShopId)
|
||||
.eq(PddGoodsPO::getGoodsId, goodsId.trim()));
|
||||
if (count == null || count == 0) {
|
||||
throw new BusinessException("该渠道店铺下不存在商品 goods_id=" + goodsId);
|
||||
}
|
||||
}
|
||||
|
||||
private void assertUnique(Long channelShopId, String goodsId, java.time.LocalDate feeDate, Long excludeId) {
|
||||
LambdaQueryWrapper<PddGoodsAdFeeDailyPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PddGoodsAdFeeDailyPO::getChannelShopId, channelShopId)
|
||||
.eq(PddGoodsAdFeeDailyPO::getGoodsId, goodsId.trim())
|
||||
.eq(PddGoodsAdFeeDailyPO::getFeeDate, feeDate);
|
||||
if (excludeId != null) {
|
||||
wrapper.ne(PddGoodsAdFeeDailyPO::getId, excludeId);
|
||||
}
|
||||
if (adFeeMapper.selectCount(wrapper) > 0) {
|
||||
throw new BusinessException("该商品在该日期已有广告费记录");
|
||||
}
|
||||
}
|
||||
|
||||
private void assertFeeAmount(BigDecimal feeAmount) {
|
||||
if (feeAmount == null || feeAmount.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new BusinessException("广告费金额不能为空且须大于等于0");
|
||||
}
|
||||
}
|
||||
|
||||
private List<PddGoodsAdFeeVO> enrich(List<PddGoodsAdFeeDailyPO> records) {
|
||||
if (records == null || records.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
Set<Long> shopIds = new HashSet<>();
|
||||
Set<String> goodsIds = new HashSet<>();
|
||||
for (PddGoodsAdFeeDailyPO po : records) {
|
||||
shopIds.add(po.getChannelShopId());
|
||||
goodsIds.add(po.getGoodsId());
|
||||
}
|
||||
|
||||
Map<Long, String> shopNameMap = new HashMap<>();
|
||||
if (!shopIds.isEmpty()) {
|
||||
List<PddShopPO> shops = pddShopMapper.selectBatchIds(shopIds);
|
||||
for (PddShopPO shop : shops) {
|
||||
shopNameMap.put(shop.getId(), shop.getMallName());
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> goodsNameMap = new HashMap<>();
|
||||
if (!goodsIds.isEmpty()) {
|
||||
List<PddGoodsPO> goodsList = pddGoodsMapper.selectList(new LambdaQueryWrapper<PddGoodsPO>()
|
||||
.eq(PddGoodsPO::getCompanyId, currentUserContext.getCurrentCompanyId())
|
||||
.in(PddGoodsPO::getGoodsId, goodsIds));
|
||||
for (PddGoodsPO goods : goodsList) {
|
||||
goodsNameMap.putIfAbsent(goods.getGoodsId(), goods.getGoodsName());
|
||||
}
|
||||
}
|
||||
|
||||
return records.stream().map(po -> {
|
||||
PddGoodsAdFeeVO vo = toVoPlain(po);
|
||||
vo.setChannelShopName(shopNameMap.get(po.getChannelShopId()));
|
||||
vo.setGoodsName(goodsNameMap.get(po.getGoodsId()));
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private PddGoodsAdFeeVO toVo(PddGoodsAdFeeDailyPO po) {
|
||||
return enrich(List.of(po)).get(0);
|
||||
}
|
||||
|
||||
private PddGoodsAdFeeVO toVoPlain(PddGoodsAdFeeDailyPO po) {
|
||||
PddGoodsAdFeeVO vo = new PddGoodsAdFeeVO();
|
||||
BeanCopyUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -15,6 +15,8 @@ public final class OpenApiScopeConstants {
|
||||
public static final String PROMOTION_FEE_READ = "open:scope:promotion_fee:read";
|
||||
public static final String IMPORT_TASK_READ = "open:scope:import_task:read";
|
||||
public static final String META_READ = "open:scope:meta:read";
|
||||
public static final String PDD_GOODS_AD_FEE_IMPORT = "open:scope:pdd_goods_ad_fee:import";
|
||||
public static final String PDD_SHOP_READ = "open:scope:pdd_shop:read";
|
||||
|
||||
public static final List<String> ALL = List.of(
|
||||
ORDER_IMPORT,
|
||||
@@ -22,7 +24,9 @@ public final class OpenApiScopeConstants {
|
||||
PROMOTION_FEE_IMPORT,
|
||||
PROMOTION_FEE_READ,
|
||||
IMPORT_TASK_READ,
|
||||
META_READ
|
||||
META_READ,
|
||||
PDD_GOODS_AD_FEE_IMPORT,
|
||||
PDD_SHOP_READ
|
||||
);
|
||||
|
||||
private OpenApiScopeConstants() {
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.open.api.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.xyquan.ecomdmbbackend.common.annotation.RequireOpenScope;
|
||||
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.dto.BatchImportPddGoodsAdFeeDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.model.vo.BatchImportPddGoodsAdFeeResultVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.adfee.service.PddGoodsAdFeeService;
|
||||
import top.xyquan.ecomdmbbackend.modules.open.api.constants.OpenApiScopeConstants;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/open/v1/channel/pdd/goods/adfee")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "开放接口-拼多多商品广告费", description = "API Key 认证,批量写入按日广告费")
|
||||
public class OpenPddGoodsAdFeeController {
|
||||
|
||||
private final PddGoodsAdFeeService pddGoodsAdFeeService;
|
||||
|
||||
@PostMapping("/batch-import")
|
||||
@RequireOpenScope(value = OpenApiScopeConstants.PDD_GOODS_AD_FEE_IMPORT, description = "批量导入拼多多商品广告费")
|
||||
@Operation(summary = "批量导入拼多多商品广告费",
|
||||
description = "每条需 channelShopId、feeDate、goodsId、feeAmount;同店同商品同日覆盖金额")
|
||||
public ApiResponse<BatchImportPddGoodsAdFeeResultVO> batchImport(
|
||||
@Valid @RequestBody BatchImportPddGoodsAdFeeDTO dto) {
|
||||
return ApiResponse.success("批量导入完成", pddGoodsAdFeeService.batchImport(dto));
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.open.api.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.xyquan.ecomdmbbackend.common.annotation.RequireOpenScope;
|
||||
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
|
||||
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
|
||||
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
|
||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.dto.PddShopFilterDTO;
|
||||
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.open.api.constants.OpenApiScopeConstants;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/open/v1/channel/pdd/shop")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "开放接口-拼多多渠道店铺", description = "API Key 认证,查询本公司渠道店铺")
|
||||
public class OpenPddShopController {
|
||||
|
||||
private final PddShopService pddShopService;
|
||||
|
||||
@PostMapping("/list")
|
||||
@RequireOpenScope(value = OpenApiScopeConstants.PDD_SHOP_READ, description = "查询拼多多渠道店铺列表")
|
||||
@Operation(summary = "分页查询拼多多渠道店铺", description = "镜像 POST /channel/pdd/shop/list,返回 id(channel_shop_id)、mallId、mallName 等")
|
||||
public ApiResponse<PageResultVO<PddShopVO>> getPddShopPage(
|
||||
@Valid @RequestBody PageQueryDTO<PddShopFilterDTO> pageQueryDTO) {
|
||||
PageResultVO<PddShopVO> result = pddShopService.getPddShopPage(pageQueryDTO);
|
||||
return ApiResponse.success("获取渠道店铺列表成功", result);
|
||||
}
|
||||
}
|
||||
@@ -129,6 +129,14 @@ INSERT INTO `sys_permission` (`id`, `parent_id`, `code`, `name`, `type`, `status
|
||||
SELECT 3611, (SELECT id FROM `sys_permission` WHERE `code` = 'biz:pdd' LIMIT 1), 'biz:pdd:goods:manage', '拼多多商品管理', 'api', 1, '同步/维护拼多多商品', 365
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'biz:pdd:goods:manage');
|
||||
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `code`, `name`, `type`, `status`, `remark`, `sort_order`)
|
||||
SELECT 3612, (SELECT id FROM `sys_permission` WHERE `code` = 'biz:pdd' LIMIT 1), 'biz:pdd:ad-fee:read', '拼多多商品广告费查看', 'api', 1, '', 366
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'biz:pdd:ad-fee:read');
|
||||
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `code`, `name`, `type`, `status`, `remark`, `sort_order`)
|
||||
SELECT 3613, (SELECT id FROM `sys_permission` WHERE `code` = 'biz:pdd' LIMIT 1), 'biz:pdd:ad-fee:manage', '拼多多商品广告费管理', 'api', 1, '维护/批量导入广告费', 367
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'biz:pdd:ad-fee:manage');
|
||||
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `code`, `name`, `type`, `status`, `remark`, `sort_order`)
|
||||
SELECT 4100, (SELECT id FROM `sys_permission` WHERE `code` = 'MODULE:data' LIMIT 1), 'data:import-group', '数据导入', 'module', 1, '', 400
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'data:import-group');
|
||||
@@ -161,6 +169,14 @@ INSERT INTO `sys_permission` (`id`, `parent_id`, `code`, `name`, `type`, `status
|
||||
SELECT 5206, (SELECT id FROM `sys_permission` WHERE `code` = 'MODULE:open' LIMIT 1), 'open:scope:meta:read', '开放-元数据查询', 'api', 1, 'shop/order-status/promotion-fee-type 等元数据', 60
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'open:scope:meta:read');
|
||||
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `code`, `name`, `type`, `status`, `remark`, `sort_order`)
|
||||
SELECT 5207, (SELECT id FROM `sys_permission` WHERE `code` = 'MODULE:open' LIMIT 1), 'open:scope:pdd_goods_ad_fee:import', '开放-拼多多商品广告费导入', 'api', 1, 'POST /open/v1/channel/pdd/goods/adfee/batch-import', 70
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'open:scope:pdd_goods_ad_fee:import');
|
||||
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `code`, `name`, `type`, `status`, `remark`, `sort_order`)
|
||||
SELECT 5208, (SELECT id FROM `sys_permission` WHERE `code` = 'MODULE:open' LIMIT 1), 'open:scope:pdd_shop:read', '开放-拼多多渠道店铺查询', 'api', 1, 'POST /open/v1/channel/pdd/shop/list', 80
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'open:scope:pdd_shop:read');
|
||||
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `code`, `name`, `type`, `status`, `remark`, `sort_order`)
|
||||
SELECT 1101, (SELECT id FROM `sys_permission` WHERE `code` = 'system:menu' LIMIT 1), 'system:menu:read', '菜单查看', 'api', 1, '系统管理-菜单查看', 14
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `code` = 'system:menu:read');
|
||||
@@ -393,6 +409,10 @@ INSERT INTO `sys_menu` (`id`, `parent_id`, `super`, `name`, `title`, `path`, `co
|
||||
SELECT 12034, (SELECT id FROM `sys_menu` WHERE `name` = '拼多多' LIMIT 1), 0, '拼多多商品', '商品', '/pdd/goods', '/channel/pdd/goods/index', '', 'lucide:package', 'menu', 1, 1, 0, 2
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `name` = '拼多多商品');
|
||||
|
||||
INSERT INTO `sys_menu` (`id`, `parent_id`, `super`, `name`, `title`, `path`, `component`, `redirect`, `icon`, `type`, `visible`, `status`, `keep_alive`, `order`)
|
||||
SELECT 12035, (SELECT id FROM `sys_menu` WHERE `name` = '拼多多' LIMIT 1), 0, '拼多多商品广告费', '商品广告费', '/pdd/goods-ad-fee', '/channel/pdd/goods-ad-fee/index', '', 'lucide:megaphone', 'menu', 1, 1, 0, 3
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `name` = '拼多多商品广告费');
|
||||
|
||||
INSERT INTO `sys_menu` (`id`, `parent_id`, `super`, `name`, `title`, `path`, `component`, `redirect`, `icon`, `type`, `visible`, `status`, `keep_alive`, `order`)
|
||||
SELECT 12031, NULL, 0, '淘宝', '淘宝', '', '', '', 'ri:taobao-fill', 'menu', 1, 1, 0, 0
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `name` = '淘宝');
|
||||
@@ -538,6 +558,9 @@ SELECT m.id, p.id FROM `sys_menu` m JOIN `sys_permission` p ON p.code IN ('biz:p
|
||||
INSERT IGNORE INTO `sys_menu_permission` (`menu_id`, `permission_id`)
|
||||
SELECT m.id, p.id FROM `sys_menu` m JOIN `sys_permission` p ON p.code IN ('biz:pdd:goods:read', 'biz:pdd:goods:manage') WHERE m.name = '拼多多商品';
|
||||
|
||||
INSERT IGNORE INTO `sys_menu_permission` (`menu_id`, `permission_id`)
|
||||
SELECT m.id, p.id FROM `sys_menu` m JOIN `sys_permission` p ON p.code IN ('biz:pdd:ad-fee:read', 'biz:pdd:ad-fee:manage') WHERE m.name = '拼多多商品广告费';
|
||||
|
||||
INSERT IGNORE INTO `sys_menu_permission` (`menu_id`, `permission_id`)
|
||||
SELECT m.id, p.id FROM `sys_menu` m JOIN `sys_permission` p ON p.code LIKE 'ecom:product:%' WHERE m.name = '商品管理';
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { PddGoodsAdFeeDTO, PddGoodsAdFeeVO } from './types';
|
||||
|
||||
export async function getPddGoodsAdFeePageApi(
|
||||
params: PageQueryDTO<PddGoodsAdFeeDTO.Filters>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<PddGoodsAdFeeVO.Info>>(
|
||||
'/channel/pdd/goods/adfee/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
export async function getPddGoodsAdFeeDetailApi(id: number) {
|
||||
return requestClient.get<PddGoodsAdFeeVO.Info>(
|
||||
`/channel/pdd/goods/adfee/detail/${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function createPddGoodsAdFeeApi(data: PddGoodsAdFeeDTO.Create) {
|
||||
return requestClient.post<PddGoodsAdFeeVO.Info>(
|
||||
'/channel/pdd/goods/adfee/create',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function updatePddGoodsAdFeeApi(
|
||||
id: number,
|
||||
data: PddGoodsAdFeeDTO.Update,
|
||||
) {
|
||||
return requestClient.put<PddGoodsAdFeeVO.Info>(
|
||||
`/channel/pdd/goods/adfee/update/${id}`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function deletePddGoodsAdFeeApi(id: number) {
|
||||
return requestClient.delete<void>(`/channel/pdd/goods/adfee/delete/${id}`);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export type { PddGoodsAdFeeDTO, PddGoodsAdFeeVO } from './types';
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* 拼多多商品广告费 DTO / VO
|
||||
*/
|
||||
export namespace PddGoodsAdFeeDTO {
|
||||
export interface Filters {
|
||||
channelShopId?: number;
|
||||
goodsId?: string;
|
||||
feeDateStart?: string;
|
||||
feeDateEnd?: string;
|
||||
}
|
||||
|
||||
export interface Create {
|
||||
channelShopId: number;
|
||||
goodsId: string;
|
||||
feeDate: string;
|
||||
feeAmount: number;
|
||||
}
|
||||
|
||||
export interface Update {
|
||||
channelShopId: number;
|
||||
goodsId: string;
|
||||
feeDate: string;
|
||||
feeAmount: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace PddGoodsAdFeeVO {
|
||||
export interface Info {
|
||||
id: number;
|
||||
companyId?: number;
|
||||
channelShopId: number;
|
||||
channelShopName?: string;
|
||||
mallId?: number;
|
||||
goodsId: string;
|
||||
goodsName?: string;
|
||||
feeDate: string;
|
||||
feeAmount: number;
|
||||
lastSyncTime?: string;
|
||||
createTime?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
}
|
||||
+292
@@ -0,0 +1,292 @@
|
||||
<script setup lang="ts">
|
||||
import type {
|
||||
PddGoodsAdFeeDTO,
|
||||
PddGoodsAdFeeVO,
|
||||
} from '#/api/channel/pdd/goods-ad-fee';
|
||||
import type { PddShopVO } from '#/api/channel/pdd/shop';
|
||||
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
|
||||
import type { Dayjs } from 'dayjs';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { DatePicker, Form, InputNumber, message, Select } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
createPddGoodsAdFeeApi,
|
||||
updatePddGoodsAdFeeApi,
|
||||
} from '#/api/channel/pdd/goods-ad-fee';
|
||||
import { getPddGoodsPageApi } from '#/api/channel/pdd/goods';
|
||||
import { getPddShopPageApi } from '#/api/channel/pdd/shop';
|
||||
|
||||
defineOptions({ name: 'GoodsAdFeeFormModal' });
|
||||
|
||||
interface Props {
|
||||
open: boolean;
|
||||
adFeeData?: null | PddGoodsAdFeeVO.Info;
|
||||
presetChannelShopId?: number | null;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
presetChannelShopId: null,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:open': [value: boolean];
|
||||
success: [];
|
||||
cancel: [];
|
||||
}>();
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
draggable: true,
|
||||
class: 'w-[640px]',
|
||||
destroyOnClose: false,
|
||||
onCancel() {
|
||||
handleCancel();
|
||||
},
|
||||
onConfirm() {
|
||||
void handleOk();
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
emit('update:open', false);
|
||||
resetFormData();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const formRef = ref();
|
||||
const isEdit = ref(false);
|
||||
|
||||
type FormState = {
|
||||
channelShopId?: number;
|
||||
goodsId?: string;
|
||||
feeDate?: Dayjs;
|
||||
feeAmount?: number;
|
||||
};
|
||||
|
||||
const formData = ref<FormState>({
|
||||
channelShopId: undefined,
|
||||
goodsId: undefined,
|
||||
feeDate: undefined,
|
||||
feeAmount: undefined,
|
||||
});
|
||||
|
||||
const rules = {
|
||||
channelShopId: [
|
||||
{ required: true, message: '请选择渠道店铺', trigger: 'change' },
|
||||
],
|
||||
goodsId: [{ required: true, message: '请输入商品ID', trigger: 'blur' }],
|
||||
feeAmount: [
|
||||
{ required: true, message: '请输入广告费金额', trigger: 'blur' },
|
||||
],
|
||||
feeDate: [{ required: true, message: '请选择统计日期', trigger: 'change' }],
|
||||
} as any;
|
||||
|
||||
const shopOptions = ref<{ label: string; value: number }[]>([]);
|
||||
const shopLoading = ref(false);
|
||||
const goodsOptions = ref<{ label: string; value: string }[]>([]);
|
||||
const goodsLoading = ref(false);
|
||||
|
||||
async function loadShops() {
|
||||
shopLoading.value = true;
|
||||
try {
|
||||
const result = await getPddShopPageApi({
|
||||
page: 1,
|
||||
pageSize: 500,
|
||||
filters: {},
|
||||
});
|
||||
shopOptions.value = (result.records ?? []).map((s: PddShopVO.Info) => ({
|
||||
label: s.mallName
|
||||
? `${s.mallName}${s.mallId != null ? ` (${s.mallId})` : ''}`
|
||||
: `店铺 #${s.id}`,
|
||||
value: s.id,
|
||||
}));
|
||||
} catch {
|
||||
shopOptions.value = [];
|
||||
} finally {
|
||||
shopLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadGoodsOptions(channelShopId?: number) {
|
||||
if (!channelShopId) {
|
||||
goodsOptions.value = [];
|
||||
return;
|
||||
}
|
||||
goodsLoading.value = true;
|
||||
try {
|
||||
const result = await getPddGoodsPageApi({
|
||||
page: 1,
|
||||
pageSize: 500,
|
||||
filters: { shopId: channelShopId },
|
||||
});
|
||||
goodsOptions.value = (result.records ?? []).map((g) => ({
|
||||
label: g.goodsName
|
||||
? `${g.goodsName} (${g.goodsId})`
|
||||
: String(g.goodsId),
|
||||
value: String(g.goodsId),
|
||||
}));
|
||||
} catch {
|
||||
goodsOptions.value = [];
|
||||
} finally {
|
||||
goodsLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function resetFormData() {
|
||||
formData.value = {
|
||||
channelShopId: undefined,
|
||||
goodsId: undefined,
|
||||
feeDate: undefined,
|
||||
feeAmount: undefined,
|
||||
};
|
||||
formRef.value?.resetFields?.();
|
||||
}
|
||||
|
||||
function fillForm() {
|
||||
if (props.adFeeData) {
|
||||
isEdit.value = true;
|
||||
formData.value = {
|
||||
channelShopId: props.adFeeData.channelShopId,
|
||||
goodsId: props.adFeeData.goodsId,
|
||||
feeDate: props.adFeeData.feeDate
|
||||
? dayjs(props.adFeeData.feeDate)
|
||||
: undefined,
|
||||
feeAmount: props.adFeeData.feeAmount,
|
||||
};
|
||||
void loadGoodsOptions(props.adFeeData.channelShopId);
|
||||
modalApi.setState({ title: '编辑商品广告费' });
|
||||
} else {
|
||||
isEdit.value = false;
|
||||
formData.value = {
|
||||
channelShopId: props.presetChannelShopId ?? undefined,
|
||||
goodsId: undefined,
|
||||
feeDate: undefined,
|
||||
feeAmount: undefined,
|
||||
};
|
||||
void loadGoodsOptions(props.presetChannelShopId ?? undefined);
|
||||
modalApi.setState({ title: '新增商品广告费' });
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
async (open) => {
|
||||
if (open) {
|
||||
modalApi.open();
|
||||
await loadShops();
|
||||
await nextTick();
|
||||
fillForm();
|
||||
} else {
|
||||
modalApi.close();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
() => formData.value.channelShopId,
|
||||
(shopId, prev) => {
|
||||
if (shopId === prev) return;
|
||||
if (!isEdit.value) {
|
||||
formData.value.goodsId = undefined;
|
||||
}
|
||||
void loadGoodsOptions(shopId);
|
||||
},
|
||||
);
|
||||
|
||||
function handleCancel() {
|
||||
emit('cancel');
|
||||
emit('update:open', false);
|
||||
modalApi.close();
|
||||
}
|
||||
|
||||
async function handleOk() {
|
||||
try {
|
||||
await formRef.value?.validate();
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
const payload: PddGoodsAdFeeDTO.Create = {
|
||||
channelShopId: formData.value.channelShopId!,
|
||||
goodsId: String(formData.value.goodsId).trim(),
|
||||
feeDate: formData.value.feeDate!.format('YYYY-MM-DD'),
|
||||
feeAmount: Number(formData.value.feeAmount),
|
||||
};
|
||||
|
||||
modalApi.setState({ confirmLoading: true });
|
||||
try {
|
||||
if (isEdit.value && props.adFeeData?.id) {
|
||||
await updatePddGoodsAdFeeApi(props.adFeeData.id, payload);
|
||||
message.success('更新成功');
|
||||
} else {
|
||||
await createPddGoodsAdFeeApi(payload);
|
||||
message.success('创建成功');
|
||||
}
|
||||
emit('success');
|
||||
emit('update:open', false);
|
||||
modalApi.close();
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '保存失败');
|
||||
} finally {
|
||||
modalApi.setState({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal>
|
||||
<Form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="rules"
|
||||
:label-col="{ span: 6 }"
|
||||
:wrapper-col="{ span: 16 }"
|
||||
class="py-2"
|
||||
>
|
||||
<Form.Item label="渠道店铺" name="channelShopId">
|
||||
<Select
|
||||
v-model:value="formData.channelShopId"
|
||||
show-search
|
||||
allow-clear
|
||||
:options="shopOptions"
|
||||
:loading="shopLoading"
|
||||
option-filter-prop="label"
|
||||
placeholder="请选择渠道店铺"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label="商品" name="goodsId">
|
||||
<Select
|
||||
v-model:value="formData.goodsId"
|
||||
show-search
|
||||
allow-clear
|
||||
:options="goodsOptions"
|
||||
:loading="goodsLoading"
|
||||
option-filter-prop="label"
|
||||
placeholder="请先选店铺,再选商品"
|
||||
:disabled="!formData.channelShopId"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label="统计日期" name="feeDate">
|
||||
<DatePicker
|
||||
v-model:value="formData.feeDate"
|
||||
class="w-full"
|
||||
value-format=""
|
||||
placeholder="选择日期"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label="广告费金额" name="feeAmount">
|
||||
<InputNumber
|
||||
v-model:value="formData.feeAmount"
|
||||
class="w-full"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="元"
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</template>
|
||||
+240
@@ -0,0 +1,240 @@
|
||||
<script setup lang="ts">
|
||||
import type { PddShopVO } from '#/api/channel/pdd/shop';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Empty,
|
||||
Input,
|
||||
message,
|
||||
Spin,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { getPddShopPageApi } from '#/api/channel/pdd/shop';
|
||||
|
||||
defineOptions({ name: 'PddShopSidebarList' });
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
selectedShopId?: number;
|
||||
showAddAction?: boolean;
|
||||
}>(),
|
||||
{
|
||||
selectedShopId: undefined,
|
||||
showAddAction: true,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:selectedShopId': [id: number | undefined];
|
||||
select: [shop: PddShopVO.Info | null];
|
||||
addForShop: [shopId: number];
|
||||
}>();
|
||||
|
||||
const StoreIcon = createIconifyIcon('lucide:store');
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
|
||||
const shopSearchName = ref('');
|
||||
const shops = ref<PddShopVO.Info[]>([]);
|
||||
const shopsLoading = ref(false);
|
||||
const shopPagination = ref({ current: 1, pageSize: 20, total: 0 });
|
||||
|
||||
const shopTotalPages = computed(() => {
|
||||
const { total, pageSize } = shopPagination.value;
|
||||
return Math.max(1, Math.ceil(total / pageSize) || 1);
|
||||
});
|
||||
|
||||
const allSelected = computed(() => props.selectedShopId === undefined);
|
||||
|
||||
async function searchShops(resetPage = false) {
|
||||
if (resetPage) {
|
||||
shopPagination.value.current = 1;
|
||||
}
|
||||
shopsLoading.value = true;
|
||||
try {
|
||||
const result = await getPddShopPageApi({
|
||||
page: shopPagination.value.current,
|
||||
pageSize: shopPagination.value.pageSize,
|
||||
filters: {
|
||||
mallName: shopSearchName.value || undefined,
|
||||
},
|
||||
});
|
||||
shops.value = result.records ?? [];
|
||||
shopPagination.value.total = result.total ?? 0;
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取渠道店铺列表失败');
|
||||
shops.value = [];
|
||||
} finally {
|
||||
shopsLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function resetShopSearch() {
|
||||
shopSearchName.value = '';
|
||||
void searchShops(true);
|
||||
}
|
||||
|
||||
function goShopPage(page: number) {
|
||||
const next = Math.min(shopTotalPages.value, Math.max(1, page));
|
||||
if (next === shopPagination.value.current) return;
|
||||
shopPagination.value.current = next;
|
||||
void searchShops();
|
||||
}
|
||||
|
||||
function selectAll() {
|
||||
emit('update:selectedShopId', undefined);
|
||||
emit('select', null);
|
||||
}
|
||||
|
||||
function selectShop(shop: PddShopVO.Info) {
|
||||
emit('update:selectedShopId', shop.id);
|
||||
emit('select', shop);
|
||||
}
|
||||
|
||||
function handleAdd(shopId: number) {
|
||||
const shop = shops.value.find((s) => s.id === shopId) ?? null;
|
||||
emit('update:selectedShopId', shopId);
|
||||
if (shop) {
|
||||
emit('select', shop);
|
||||
}
|
||||
emit('addForShop', shopId);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void searchShops();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card
|
||||
class="flex h-full w-[320px] shrink-0 flex-col overflow-hidden"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: '8px',
|
||||
minHeight: 0,
|
||||
minWidth: 0,
|
||||
overflow: 'hidden',
|
||||
padding: '12px',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="flex items-center gap-2 text-base font-semibold">
|
||||
<StoreIcon class="h-4 w-4" />
|
||||
渠道店铺
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<div class="flex min-w-0 shrink-0 items-center gap-2">
|
||||
<Input
|
||||
v-model:value="shopSearchName"
|
||||
placeholder="店铺名称"
|
||||
allow-clear
|
||||
class="min-w-0 flex-1"
|
||||
@press-enter="searchShops(true)"
|
||||
/>
|
||||
<Button type="primary" class="shrink-0" @click="searchShops(true)">
|
||||
搜索
|
||||
</Button>
|
||||
<Button class="shrink-0" @click="resetShopSearch">重置</Button>
|
||||
</div>
|
||||
|
||||
<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="min-h-0 flex-1 overflow-y-auto">
|
||||
<Card
|
||||
size="small"
|
||||
:body-style="{ padding: '10px 12px' }"
|
||||
class="mb-2 cursor-pointer !shadow-none hover:border-primary"
|
||||
:class="allSelected ? 'border-primary bg-primary/5' : undefined"
|
||||
@click="selectAll"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<span class="min-w-0 truncate text-sm font-medium">全部店铺</span>
|
||||
<span class="shrink-0 text-xs text-muted-foreground">全部记录</span>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Spin :spinning="shopsLoading">
|
||||
<Empty
|
||||
v-if="!shopsLoading && shops.length === 0"
|
||||
class="py-8"
|
||||
description="暂无渠道店铺"
|
||||
/>
|
||||
<template v-else>
|
||||
<Card
|
||||
v-for="shop in shops"
|
||||
:key="shop.id"
|
||||
size="small"
|
||||
:body-style="{ padding: '10px 12px' }"
|
||||
class="group mb-2 cursor-pointer !shadow-none last:mb-0 hover:border-primary"
|
||||
:class="
|
||||
selectedShopId === shop.id
|
||||
? 'border-primary bg-primary/5'
|
||||
: undefined
|
||||
"
|
||||
@click="selectShop(shop)"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="truncate text-sm font-medium">
|
||||
{{ shop.mallName || `店铺 #${shop.id}` }}
|
||||
</div>
|
||||
<div
|
||||
v-if="shop.mallId != null"
|
||||
class="mt-1 text-xs text-muted-foreground"
|
||||
>
|
||||
mall_id: {{ shop.mallId }}
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
v-if="showAddAction"
|
||||
type="link"
|
||||
size="small"
|
||||
class="!h-7 shrink-0 !px-1 !text-xs opacity-80 group-hover:opacity-100"
|
||||
@click.stop="handleAdd(shop.id)"
|
||||
>
|
||||
<PlusIcon class="mr-0.5 inline h-3.5 w-3.5" />
|
||||
添加
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
</template>
|
||||
</Spin>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-2 flex w-full min-w-0 shrink-0 items-center justify-between gap-2"
|
||||
>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="shopPagination.current <= 1 || shopsLoading"
|
||||
@click="goShopPage(shopPagination.current - 1)"
|
||||
>
|
||||
上一页
|
||||
</Button>
|
||||
<span
|
||||
class="min-w-0 flex-1 truncate text-center text-xs text-muted-foreground"
|
||||
>
|
||||
{{ shopPagination.current }} / {{ shopTotalPages }}
|
||||
<span class="ml-1 opacity-70">({{ shopPagination.total }})</span>
|
||||
</span>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="
|
||||
shopPagination.current >= shopTotalPages || shopsLoading
|
||||
"
|
||||
@click="goShopPage(shopPagination.current + 1)"
|
||||
>
|
||||
下一页
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -0,0 +1,358 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { PddGoodsAdFeeVO } from '#/api/channel/pdd/goods-ad-fee';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
DatePicker,
|
||||
Flex,
|
||||
Input,
|
||||
message,
|
||||
Popconfirm,
|
||||
Space,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deletePddGoodsAdFeeApi,
|
||||
getPddGoodsAdFeePageApi,
|
||||
} from '#/api/channel/pdd/goods-ad-fee';
|
||||
|
||||
import GoodsAdFeeFormModal from './components/GoodsAdFeeFormModal.vue';
|
||||
import PddShopSidebarList from './components/PddShopSidebarList.vue';
|
||||
|
||||
defineOptions({ name: 'PddGoodsAdFeeManagement' });
|
||||
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
const selectedShopId = ref<number | undefined>(undefined);
|
||||
const selectedShopName = ref<string | undefined>(undefined);
|
||||
|
||||
const formModalVisible = ref(false);
|
||||
const currentAdFeeData = ref<null | PddGoodsAdFeeVO.Info>(null);
|
||||
const presetChannelShopId = ref<number | null>(null);
|
||||
|
||||
const searchForm = ref({
|
||||
goodsId: undefined as string | undefined,
|
||||
feeDateStart: undefined as string | undefined,
|
||||
feeDateEnd: undefined as string | undefined,
|
||||
});
|
||||
|
||||
const selectedShopLabel = computed(() => {
|
||||
if (selectedShopId.value == null) {
|
||||
return '全部店铺';
|
||||
}
|
||||
return selectedShopName.value || `店铺 #${selectedShopId.value}`;
|
||||
});
|
||||
|
||||
function onShopSelect(shop: { id: number; mallName?: string } | null) {
|
||||
if (!shop) {
|
||||
selectedShopId.value = undefined;
|
||||
selectedShopName.value = undefined;
|
||||
return;
|
||||
}
|
||||
selectedShopId.value = shop.id;
|
||||
selectedShopName.value = shop.mallName;
|
||||
}
|
||||
|
||||
function handleAddForShop(shopId: number) {
|
||||
currentAdFeeData.value = null;
|
||||
presetChannelShopId.value = shopId;
|
||||
formModalVisible.value = true;
|
||||
}
|
||||
|
||||
const gridOptions: VxeGridProps<PddGoodsAdFeeVO.Info> = {
|
||||
columns: [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 56,
|
||||
title: '序号',
|
||||
},
|
||||
{
|
||||
field: 'channelShopName',
|
||||
title: '渠道店铺',
|
||||
minWidth: 140,
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
field: 'goodsName',
|
||||
title: '商品',
|
||||
minWidth: 180,
|
||||
showOverflow: 'tooltip' as const,
|
||||
slots: { default: 'goods' },
|
||||
},
|
||||
{
|
||||
title: '广告费金额',
|
||||
minWidth: 110,
|
||||
slots: { default: 'feeAmount' },
|
||||
},
|
||||
{
|
||||
field: 'feeDate',
|
||||
title: '统计日期',
|
||||
minWidth: 110,
|
||||
},
|
||||
{
|
||||
field: 'lastSyncTime',
|
||||
title: '最近同步',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 140,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
height: '100%',
|
||||
border: true,
|
||||
stripe: true,
|
||||
rowConfig: { isHover: true },
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
toolbarConfig: {
|
||||
custom: true,
|
||||
refresh: true,
|
||||
zoom: true,
|
||||
},
|
||||
data: [],
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
pageSizes: [10, 20, 50, 100],
|
||||
layouts: [
|
||||
'PrevJump',
|
||||
'PrevPage',
|
||||
'Number',
|
||||
'NextPage',
|
||||
'NextJump',
|
||||
'Sizes',
|
||||
'FullJump',
|
||||
'Total',
|
||||
] as (
|
||||
| 'FullJump'
|
||||
| 'NextJump'
|
||||
| 'NextPage'
|
||||
| 'Number'
|
||||
| 'PrevJump'
|
||||
| 'PrevPage'
|
||||
| 'Sizes'
|
||||
| 'Total'
|
||||
)[],
|
||||
},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }) => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params: PageQueryDTO<{
|
||||
channelShopId?: number;
|
||||
goodsId?: string;
|
||||
feeDateStart?: string;
|
||||
feeDateEnd?: string;
|
||||
}> = {
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
filters: {
|
||||
channelShopId: selectedShopId.value,
|
||||
goodsId: searchForm.value.goodsId || undefined,
|
||||
feeDateStart: searchForm.value.feeDateStart || undefined,
|
||||
feeDateEnd: searchForm.value.feeDateEnd || undefined,
|
||||
},
|
||||
};
|
||||
const data = await getPddGoodsAdFeePageApi(params);
|
||||
return { items: data.records, total: data.total };
|
||||
} catch {
|
||||
message.error('获取商品广告费列表失败');
|
||||
return { items: [], total: 0 };
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
function refreshTable() {
|
||||
gridApi?.reload();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
showSearchForm: false,
|
||||
tableTitle: '广告费记录',
|
||||
});
|
||||
|
||||
watch(selectedShopId, () => {
|
||||
gridApi.reload();
|
||||
});
|
||||
|
||||
function resetModalPreset() {
|
||||
presetChannelShopId.value = null;
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
currentAdFeeData.value = null;
|
||||
resetModalPreset();
|
||||
formModalVisible.value = true;
|
||||
}
|
||||
|
||||
function handleEdit(record: PddGoodsAdFeeVO.Info) {
|
||||
resetModalPreset();
|
||||
currentAdFeeData.value = record;
|
||||
formModalVisible.value = true;
|
||||
}
|
||||
|
||||
async function handleDelete(id: number) {
|
||||
try {
|
||||
await deletePddGoodsAdFeeApi(id);
|
||||
message.success('删除成功');
|
||||
refreshTable();
|
||||
} catch {
|
||||
message.error('删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
function handleFormSuccess() {
|
||||
resetModalPreset();
|
||||
refreshTable();
|
||||
}
|
||||
|
||||
function handleFormCancel() {
|
||||
resetModalPreset();
|
||||
formModalVisible.value = false;
|
||||
}
|
||||
|
||||
const formatAmount = (amount: number) => `¥${Number(amount || 0).toFixed(2)}`;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="商品广告费" :auto-content-height="true">
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
左侧选择拼多多渠道店铺筛选右侧按日广告费;未选店铺时展示全部记录。可在店铺行快捷新增。
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-2 h-4 w-4" />
|
||||
新增广告费
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<Flex gap="middle" class="h-full min-h-0 overflow-hidden">
|
||||
<PddShopSidebarList
|
||||
:selected-shop-id="selectedShopId"
|
||||
@select="onShopSelect"
|
||||
@add-for-shop="handleAddForShop"
|
||||
/>
|
||||
|
||||
<Card
|
||||
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">广告费记录</span>
|
||||
</template>
|
||||
<template #extra>
|
||||
<Space wrap size="small" class="max-w-[min(100%,42rem)]">
|
||||
<Input
|
||||
v-model:value="searchForm.goodsId"
|
||||
allow-clear
|
||||
placeholder="goods_id"
|
||||
class="w-[140px]"
|
||||
@press-enter="() => refreshTable()"
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.feeDateStart"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="开始"
|
||||
class="w-[118px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<span class="text-muted-foreground">—</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.feeDateEnd"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="结束"
|
||||
class="w-[118px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<div
|
||||
class="shrink-0 border-t border-border px-4 py-2 text-xs text-muted-foreground"
|
||||
>
|
||||
当前:{{ selectedShopLabel }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-0 sm:px-3 sm:pb-3"
|
||||
>
|
||||
<Grid :loading="loading" class="h-full min-h-0">
|
||||
<template #toolbar-tools>
|
||||
<span class="text-xs text-muted-foreground">
|
||||
使用上方 goods_id 与日期筛选
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #feeAmount="{ row }">
|
||||
<span class="font-semibold text-red-600">
|
||||
{{ formatAmount(row.feeAmount) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #goods="{ row }">
|
||||
<div>
|
||||
<div>{{ row.goodsName || '—' }}</div>
|
||||
<div class="text-xs text-muted-foreground">
|
||||
{{ row.goodsId }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条广告费记录吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
</div>
|
||||
</Card>
|
||||
</Flex>
|
||||
|
||||
<GoodsAdFeeFormModal
|
||||
v-model:open="formModalVisible"
|
||||
:ad-fee-data="currentAdFeeData"
|
||||
:preset-channel-shop-id="presetChannelShopId"
|
||||
@success="handleFormSuccess"
|
||||
@cancel="handleFormCancel"
|
||||
/>
|
||||
</Page>
|
||||
</template>
|
||||
Reference in New Issue
Block a user