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));