|
@@ -3,9 +3,9 @@ package com.sd.wln.service.impl;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
-import com.ruoyi.common.annotation.LogicIgnore;
|
|
|
import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
+import com.ruoyi.framework.mybatis.holder.LogicHolder;
|
|
|
import com.sd.business.entity.sku.po.Sku;
|
|
|
import com.sd.business.entity.sku.po.SkuClassify;
|
|
|
import com.sd.business.entity.sku.po.SkuSpec;
|
|
@@ -39,7 +39,6 @@ public class WlnSkuServiceImpl implements WlnSkuService {
|
|
|
@Autowired
|
|
|
private SkuSpecService skuSpecService;
|
|
|
|
|
|
- @LogicIgnore
|
|
|
@Override
|
|
|
public boolean syncSkuClassify() {
|
|
|
List<JSONObject> list;
|
|
@@ -53,7 +52,10 @@ public class WlnSkuServiceImpl implements WlnSkuService {
|
|
|
}
|
|
|
|
|
|
// 查询数据库sku分类
|
|
|
+ LogicHolder.setLogicHolder(new LogicHolder());
|
|
|
List<SkuClassify> mysqlSkuClassifyList = skuClassifyService.list();
|
|
|
+ LogicHolder.clear();
|
|
|
+
|
|
|
Map<String, SkuClassify> skuClassifyMap = mysqlSkuClassifyList.stream()
|
|
|
.collect(Collectors.toMap(SkuClassify::getWlnCatagoryId, Function.identity()));
|
|
|
|
|
@@ -87,7 +89,6 @@ public class WlnSkuServiceImpl implements WlnSkuService {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- @LogicIgnore
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public boolean syncSku() {
|
|
@@ -106,6 +107,8 @@ public class WlnSkuServiceImpl implements WlnSkuService {
|
|
|
}
|
|
|
} while (size >= 200);
|
|
|
|
|
|
+ LogicHolder.setLogicHolder(new LogicHolder());
|
|
|
+
|
|
|
// 产品分类map
|
|
|
Map<String, Long> skuClassifyMap = skuClassifyService.mapKV(SkuClassify::getWlnCatagoryId, BaseIdPo::getId, null);
|
|
|
|
|
@@ -116,6 +119,8 @@ public class WlnSkuServiceImpl implements WlnSkuService {
|
|
|
Map<Long, Map<String, SkuSpec>> specMap = skuSpecService.list().stream().collect(
|
|
|
Collectors.groupingBy(SkuSpec::getSkuId, Collectors.toMap(SkuSpec::getWlnUid, Function.identity())));
|
|
|
|
|
|
+ LogicHolder.clear();
|
|
|
+
|
|
|
List<Sku> newSkuList = new ArrayList<>();
|
|
|
List<SkuSpec> newSkuSpecList = new ArrayList<>();
|
|
|
|
|
@@ -142,7 +147,6 @@ public class WlnSkuServiceImpl implements WlnSkuService {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private Sku createSku(JSONObject wlnSku, Map<String, Long> skuClassifyMap) {
|
|
|
String catagoryId = wlnSku.getString("catagory_id");
|
|
|
Long skuClassifyId = skuClassifyMap.get(catagoryId);
|