From 9d809221eb4debba088ac2e56e63315b7596a30b Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期二, 16 九月 2025 14:50:41 +0800
Subject: [PATCH] 解决图片显示问题和实物商品与虚拟商品中不包含礼品卡时去除优惠卷id和名称

---
 framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java
index 2cda83b..531cdd9 100644
--- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java
+++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java
@@ -164,17 +164,23 @@
     @ApiModelProperty(value = "棰勫敭缁撴潫鏃堕棿")
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Date preSaleEndDate;
 
     @ApiModelProperty(value = "棰勫敭寮�濮嬫椂闂�")
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Date preSaleBeginDate;
     @ApiModelProperty(value = "鎶芥垚姣斾緥")
     private BigDecimal commission;
 
     @ApiModelProperty(value = "鍟嗗搧鎺掑簭")
     private Integer goodsSort;
+
+    @ApiModelProperty(value ="琛ㄧず铏氭嫙鍟嗗搧绫诲瀷 鐜版湁绫诲瀷锛欳OUPON浼樻儬鍔�")
+    private String virtualGoodsType;
+
     public Goods() {
     }
 
@@ -192,6 +198,13 @@
         this.mobileIntro = goodsOperationDTO.getMobileIntro();
         this.goodsVideo = goodsOperationDTO.getGoodsVideo();
         this.price = goodsOperationDTO.getPrice();
+        this.virtualGoodsType = goodsOperationDTO.getVirtualGoodsType();
+
+        //涓嶆槸棰勫敭鍟嗗搧棰勫敭鏃堕棿缃┖
+        if (!GoodsSalesModeEnum.PRESALE.name().equals(goodsOperationDTO.getSalesModel())) {
+            goodsOperationDTO.setPreSaleBeginDate(null);
+            goodsOperationDTO.setPreSaleEndDate(null);
+        }
         this.preSaleEndDate = goodsOperationDTO.getPreSaleEndDate();
         this.preSaleBeginDate = goodsOperationDTO.getPreSaleBeginDate();
         this.commission =  goodsOperationDTO.getCommission();
@@ -223,6 +236,12 @@
             if (!sku.containsKey("quantity") || StringUtil.isEmpty(sku.get("quantity").toString()) || Convert.toInt(sku.get("quantity").toString()) < 0) {
                 throw new ServiceException(ResultCode.GOODS_SKU_QUANTITY_ERROR);
             }
+            //娌℃湁浼樻儬鍗风殑鍟嗗搧闇�瑕佺Щ闄や紭鎯犲嵎淇℃伅
+            Object couponId = sku.get("couponId");
+            if (couponId == null || StringUtil.isEmpty(couponId.toString())) {
+                sku.remove("couponId");
+                sku.remove("couponName");
+            }
             sku.values().forEach(i -> {
                 if (CharSequenceUtil.isBlank(i.toString())) {
                     throw new ServiceException(ResultCode.MUST_HAVE_GOODS_SKU_VALUE);

--
Gitblit v1.8.0