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

This commit is contained in:
liyj 2025-10-28 10:47:04 +08:00
parent 21ae722873
commit 072bf26b12

View File

@ -59,6 +59,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@ -795,7 +796,8 @@ public abstract class SyncBaseThirdSxAbstract{
ShopProductBase shopProductBase = new ShopProductBase();
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.setProduct_number((String) jsonObj.get("product_number"));
@ -821,7 +823,7 @@ public abstract class SyncBaseThirdSxAbstract{
}
BigDecimal stock= jsonObj.getBigDecimal("stock");//库存
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"))
@ -862,7 +864,7 @@ public abstract class SyncBaseThirdSxAbstract{
// ShopProductIndex
ShopProductIndex shopProductIndex = new ShopProductIndex();
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.setProduct_tags("");// 商品标签(DOT)
shopProductIndex.setBrand_id(0);