修改上架时间不准确,默认库存同步问题

This commit is contained in:
liyj 2025-10-28 10:47:04 +08:00
parent 6cb3ae2eac
commit e507a3cfab

View File

@ -59,6 +59,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.time.Instant;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
@ -795,7 +796,8 @@ public abstract class SyncBaseThirdSxAbstract{
ShopProductBase shopProductBase = new ShopProductBase(); ShopProductBase shopProductBase = new ShopProductBase();
shopProductBase.setCategoryId(categoryId); shopProductBase.setCategoryId(categoryId);
shopProductBase.setProduct_sale_time(Convert.toDate(DateUtil.current() + 600)); //10分钟 long seconds=System.currentTimeMillis();
shopProductBase.setProduct_sale_time(Date.from(Instant.now().plusSeconds(seconds))); //10分钟
shopProductBase.setStore_id(storeIdInt); shopProductBase.setStore_id(storeIdInt);
shopProductBase.setProduct_number((String) jsonObj.get("product_number")); shopProductBase.setProduct_number((String) jsonObj.get("product_number"));
@ -821,7 +823,7 @@ public abstract class SyncBaseThirdSxAbstract{
} }
BigDecimal stock= jsonObj.getBigDecimal("stock");//库存 BigDecimal stock= jsonObj.getBigDecimal("stock");//库存
if(ObjectUtil.equals(isNegativeAllowed,DicEnum.YESORNO_1.getCode())&&stock.compareTo(BigDecimal.ZERO)<=0){//允许负库存每次都加满就是一直有售卖 if(ObjectUtil.equals(isNegativeAllowed,DicEnum.YESORNO_1.getCode())&&stock.compareTo(BigDecimal.ZERO)<=0){//允许负库存每次都加满就是一直有售卖
stock=new BigDecimal("99"); stock=new BigDecimal("500");
} }
//商品总量 //商品总量
if(ObjectUtil.isNotEmpty(jsonObj.getStr("unit"))&&ObjectUtil.isNotEmpty(jsonObj.getStr("stock")) if(ObjectUtil.isNotEmpty(jsonObj.getStr("unit"))&&ObjectUtil.isNotEmpty(jsonObj.getStr("stock"))
@ -862,7 +864,7 @@ public abstract class SyncBaseThirdSxAbstract{
// ShopProductIndex // ShopProductIndex
ShopProductIndex shopProductIndex = new ShopProductIndex(); ShopProductIndex shopProductIndex = new ShopProductIndex();
shopProductIndex.setProduct_add_time(currentDate.getTime()); shopProductIndex.setProduct_add_time(currentDate.getTime());
shopProductIndex.setProduct_sale_time(DateUtil.current() + 600); //10分钟 shopProductIndex.setProduct_sale_time(seconds);
shopProductIndex.setStore_category_ids(""); // 店铺分类编号(DOT) shopProductIndex.setStore_category_ids(""); // 店铺分类编号(DOT)
shopProductIndex.setProduct_tags("");// 商品标签(DOT) shopProductIndex.setProduct_tags("");// 商品标签(DOT)
shopProductIndex.setBrand_id(0); shopProductIndex.setBrand_id(0);