|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
+import com.ruoyi.common.core.domain.BasePo;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.framework.mybatis.holder.LogicHolder;
|
|
|
import com.sd.business.entity.sku.po.Sku;
|
|
@@ -95,12 +96,18 @@ public class WlnSkuServiceImpl implements WlnSkuService {
|
|
|
}
|
|
|
|
|
|
private void syncSku() {
|
|
|
+ Sku tempSku = skuService.getOne(q -> q.orderByDesc(BasePo::getUpdateTime));
|
|
|
+ Long modifyTime = 965381503L;
|
|
|
+ if (tempSku != null) {
|
|
|
+ modifyTime = tempSku.getUpdateTime().getTime() + 1;
|
|
|
+ }
|
|
|
+
|
|
|
int page = 1;
|
|
|
int size;
|
|
|
List<JSONObject> wlnSkuList = new ArrayList<>();
|
|
|
do {
|
|
|
try {
|
|
|
- List<JSONObject> itemList = WlnUtil.getSkuList(page, 200);
|
|
|
+ List<JSONObject> itemList = WlnUtil.getSkuList(page, 200, modifyTime);
|
|
|
page++;
|
|
|
size = itemList.size();
|
|
|
wlnSkuList.addAll(itemList);
|
|
@@ -108,7 +115,11 @@ public class WlnSkuServiceImpl implements WlnSkuService {
|
|
|
log.error("sku同步失败", e);
|
|
|
throw new ServiceException("sku同步失败");
|
|
|
}
|
|
|
- } while (size >= 200);
|
|
|
+ } while (size == 200);
|
|
|
+
|
|
|
+ if (wlnSkuList.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
LogicHolder.setLogicHolder(true);
|
|
|
|
|
@@ -119,8 +130,7 @@ public class WlnSkuServiceImpl implements WlnSkuService {
|
|
|
Map<String, Sku> skuMap = skuService.mapKEntity(Sku::getWlnUid, null);
|
|
|
|
|
|
// 产品规格map
|
|
|
- Map<Long, Map<String, SkuSpec>> specMap = skuSpecService.list(q -> q.isNotNull(SkuSpec::getWlnUid))
|
|
|
- .stream()
|
|
|
+ Map<Long, Map<String, SkuSpec>> specMap = skuSpecService.list(q -> q.isNotNull(SkuSpec::getWlnUid)).stream()
|
|
|
.collect(Collectors.groupingBy(SkuSpec::getSkuId, Collectors.toMap(SkuSpec::getWlnUid, Function.identity())));
|
|
|
|
|
|
LogicHolder.clear();
|