feat: 不收几推广费为0的推广记录

This commit is contained in:
2026-08-16 23:13:41 +08:00
parent 50ce131d60
commit b4455a4788
13 changed files with 43 additions and 25 deletions
@@ -3,6 +3,7 @@ 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 jakarta.validation.constraints.Positive;
import lombok.Data;
import java.math.BigDecimal;
@@ -25,6 +26,7 @@ public class BatchImportPddGoodsAdFeeItemDTO {
private String goodsId;
@NotNull(message = "广告费金额不能为空")
@Schema(description = "广告费金额(元)", requiredMode = Schema.RequiredMode.REQUIRED)
@Positive(message = "广告费金额须大于0")
@Schema(description = "广告费金额(元),须大于0", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal feeAmount;
}
@@ -3,6 +3,7 @@ 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 jakarta.validation.constraints.Positive;
import lombok.Data;
import java.math.BigDecimal;
@@ -25,6 +26,7 @@ public class CreatePddGoodsAdFeeDTO {
private LocalDate feeDate;
@NotNull(message = "广告费金额不能为空")
@Schema(description = "广告费金额(元)", requiredMode = Schema.RequiredMode.REQUIRED)
@Positive(message = "广告费金额须大于0")
@Schema(description = "广告费金额(元),须大于0", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal feeAmount;
}
@@ -3,6 +3,7 @@ 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 jakarta.validation.constraints.Positive;
import lombok.Data;
import java.math.BigDecimal;
@@ -25,6 +26,7 @@ public class UpdatePddGoodsAdFeeDTO {
private LocalDate feeDate;
@NotNull(message = "广告费金额不能为空")
@Schema(description = "广告费金额(元)", requiredMode = Schema.RequiredMode.REQUIRED)
@Positive(message = "广告费金额须大于0")
@Schema(description = "广告费金额(元),须大于0", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal feeAmount;
}
@@ -170,8 +170,8 @@ public class PddGoodsAdFeeServiceImpl implements PddGoodsAdFeeService {
if (item.getChannelShopId() == null) {
throw new BusinessException("渠道店铺ID不能为空");
}
if (item.getFeeAmount() == null || item.getFeeAmount().compareTo(BigDecimal.ZERO) < 0) {
throw new BusinessException("广告费金额不能为空且须大于等于0");
if (item.getFeeAmount() == null || item.getFeeAmount().compareTo(BigDecimal.ZERO) <= 0) {
throw new BusinessException("广告费金额须大于0");
}
if (!StringUtils.hasText(item.getGoodsId())) {
throw new BusinessException("商品ID不能为空");
@@ -251,8 +251,8 @@ public class PddGoodsAdFeeServiceImpl implements PddGoodsAdFeeService {
}
private void assertFeeAmount(BigDecimal feeAmount) {
if (feeAmount == null || feeAmount.compareTo(BigDecimal.ZERO) < 0) {
throw new BusinessException("广告费金额不能为空且须大于等于0");
if (feeAmount == null || feeAmount.compareTo(BigDecimal.ZERO) <= 0) {
throw new BusinessException("广告费金额不能为空且须大于0");
}
}
@@ -26,7 +26,7 @@ public class OpenPddGoodsAdFeeController {
@PostMapping("/batch-import")
@RequireOpenScope(value = OpenApiScopeConstants.PDD_GOODS_AD_FEE_IMPORT, description = "批量导入拼多多商品广告费")
@Operation(summary = "批量导入拼多多商品广告费",
description = "每条需 channelShopId、feeDate、goodsId、feeAmount;同店同商品同日覆盖金额")
description = "每条需 channelShopId、feeDate、goodsId、feeAmount(须大于0);同店同商品同日覆盖金额")
public ApiResponse<BatchImportPddGoodsAdFeeResultVO> batchImport(
@Valid @RequestBody BatchImportPddGoodsAdFeeDTO dto) {
return ApiResponse.success("批量导入完成", pddGoodsAdFeeService.batchImport(dto));
@@ -1,18 +1,18 @@
{
"schemaVersion": 1,
"updatedAt": "2026-08-16T14:27:38.290Z",
"updatedAt": "2026-08-16T15:10:28.151Z",
"features": [
{
"id": "pdd-ad-fee",
"name": "拼多多商品推广费同步",
"version": "0.3.9",
"description": "从推广总览读取推广费并同步到 BI(浮窗滚动条统一 thin)",
"version": "0.3.10",
"description": "从推广总览读取推广费并同步到 BI(总花费为 0 不记录)",
"matchUrlPatterns": [
"*://yingxiao.pinduoduo.com/*",
"https://yingxiao.pinduoduo.com/"
],
"entry": "pdd-ad-fee.js",
"sha256": "0ee120f49b6ecbb5c2ed433b087cb2543fad68319183d21c016eb8696e8b417b",
"sha256": "a7f3eb7efc7ccff34e3450b3024bfb591bc953a1d2d1bbd3a3146650e9de36c0",
"executionWorld": "main"
}
]
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long