Просмотр исходного кода

更新goodsHistory保存顺序

hejq 7 лет назад
Родитель
Сommit
820cc77af6

+ 10 - 10
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java

@@ -2772,16 +2772,6 @@ public class ProductServiceImpl implements ProductService {
                 goods.setProductid(productInfo.getId());
             }
         }
-        String type = null;
-        if (null != goods.getId()) {
-            type = GoodsHistory.OperateType.Update.name();
-            goodsHistory = goodsHistoryService.converTGoodsHist(goods, type, false);
-        } else  {
-            type = GoodsHistory.OperateType.PutOn.name();
-            goodsHistory = goodsHistoryService.converTGoodsHist(goods, type, false);
-        }
-        goodsHistory = goodsHistoryService.save(goodsHistory);
-        LOGGER.log("库存操作", "单个物料上传更新库存操作", "操作方式 " + type, goodsHistory.getCode(), goodsHistory.getId());
         final Double minBuyQty = goods.getMinBuyQty();
         // 判断前端传入的分段价格是默认的值还是填写错误
         List<GoodsQtyPrice> qtyPrices = goods.getOriginalPrices();
@@ -2817,6 +2807,16 @@ public class ProductServiceImpl implements ProductService {
             }
         }
         goodsService.setGoodsDefault(goods);
+        String type;
+        if (null != goods.getId()) {
+            type = GoodsHistory.OperateType.Update.name();
+            goodsHistory = goodsHistoryService.converTGoodsHist(goods, type, false);
+        } else  {
+            type = GoodsHistory.OperateType.PutOn.name();
+            goodsHistory = goodsHistoryService.converTGoodsHist(goods, type, false);
+        }
+        goodsHistory = goodsHistoryService.save(goodsHistory);
+        LOGGER.log("库存操作", "单个物料上传更新库存操作", "操作方式 " + type, goodsHistory.getCode(), goodsHistory.getId());
         goods = goodsDao.save(goods);
         LOGGER.log("上架商品", "新增上架商品", "通过卖家中心单个物料上传新增上架商品", goods.getCode(), goods.getId());
     }