Ver Fonte

feat(product): minQuantity DTO 字段映射 + 多商品下单产品级校验

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
iwt há 1 mês atrás
pai
commit
11d3e7fc4d

+ 2 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/ProductDTO.java

@@ -19,6 +19,7 @@ public class ProductDTO {
     private Integer price;
     private Integer memberPrice;
     private Integer stock;
+    private Integer minQuantity;
     private Integer salesCount;
     private String productType;
     private Long vendorId;
@@ -75,6 +76,7 @@ public class ProductDTO {
         }
         d.memberPrice = p.getMemberPrice();
         d.stock = p.getStock();
+        d.minQuantity = p.getMinQuantity();
         d.salesCount = p.getSalesCount();
         d.productType = p.getProductType();
         d.vendorId = p.getVendorId();

+ 6 - 2
cfc-backend/src/main/java/com/etotem/cfc/service/ProductOrderService.java

@@ -522,8 +522,12 @@ public class ProductOrderService {
             }
         } catch (Exception e) {
             log.error("同步AfterSalesRequest状态失败: orderNo={}, status={}", orderNo, status, e);
-        }
-    }
+                }
+                // 产品级最小购买数量检查
+                if (item.getSkuId() == null && product.getMinQuantity() != null && item.getQuantity() < product.getMinQuantity()) {
+                    return Result.error(product.getName() + " 最低需购买" + product.getMinQuantity() + "件");
+                }
+            }
 
     public Result<List<ProductOrderDTO>> myOrders(Long buyerId, String status) {
         return myOrders(buyerId, status, null);