商品分类 缓存数据
This commit is contained in:
parent
918ee6683c
commit
b59f8cd667
|
|
@ -68,6 +68,8 @@ public class ShopSyncServiceImpl implements ShopSyncService {
|
|||
@Resource
|
||||
private ProdConsRelationService prodConsRelationService;
|
||||
@Resource
|
||||
private ProductRpcService productRpcService;
|
||||
@Resource
|
||||
private ShopUserService shopUserService;
|
||||
@Resource
|
||||
private ShopVendorService vendorService;
|
||||
|
|
@ -158,6 +160,9 @@ public class ShopSyncServiceImpl implements ShopSyncService {
|
|||
syncConsPro(sourceShopId, targetShopId, consInfoMap, proMap);
|
||||
syncVendor(sourceShopId, targetShopId, mainMapList);
|
||||
syncNoticeService.addNotice(targetShopId, sysUserId, "数据同步", JSON.toJSONString(mainMapList), null);
|
||||
categoryMap.forEach((k, v) -> {
|
||||
productRpcService.cleanCategoryProduct(targetShopId, v);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("同步异常", e);
|
||||
throw new CzgException("同步失败");
|
||||
|
|
@ -617,6 +622,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
|
|||
}
|
||||
Map<Long, Product> finalMap = map;
|
||||
for (Long shopId : shopIds) {
|
||||
List<Long> cateGoryIds = new ArrayList<>();
|
||||
List<Map<String, Object>> mainMapList = new ArrayList<>();
|
||||
Map<Long, String> dataMap = new HashMap<>();
|
||||
Product newEntity = BeanUtil.copyProperties(mainEntity, Product.class);
|
||||
|
|
@ -631,6 +637,9 @@ public class ShopSyncServiceImpl implements ShopSyncService {
|
|||
}
|
||||
if (finalMap.containsKey(shopId)) {
|
||||
Product childEntity = finalMap.get(shopId);
|
||||
if (childEntity.getCategoryId() != null) {
|
||||
cateGoryIds.add(childEntity.getCategoryId());
|
||||
}
|
||||
newEntity.setId(childEntity.getId());
|
||||
newEntity.setStartTime(null);
|
||||
newEntity.setEndTime(null);
|
||||
|
|
@ -648,6 +657,9 @@ public class ShopSyncServiceImpl implements ShopSyncService {
|
|||
newEntity.setStockNumber(0);
|
||||
productService.save(newEntity);
|
||||
}
|
||||
if (newEntity.getCategoryId() != null) {
|
||||
cateGoryIds.add(newEntity.getCategoryId());
|
||||
}
|
||||
syncSkuBySourceShop(sourceShopId, shopId, productId, newEntity.getId());
|
||||
if ("package".equals(newEntity.getType()) || "coupon".equals(newEntity.getType())) {
|
||||
syncProductPackageBySourceShop(newEntity, shopId);
|
||||
|
|
@ -655,6 +667,11 @@ public class ShopSyncServiceImpl implements ShopSyncService {
|
|||
dataMap.put(newEntity.getId(), newEntity.getName());
|
||||
buildNotice(mainMapList, "商品变动", 1, "product", dataMap);
|
||||
syncNoticeService.addNotice(shopId, sysUserId, "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
|
||||
if (CollUtil.isNotEmpty(cateGoryIds)) {
|
||||
for (Long cateGoryId : cateGoryIds) {
|
||||
productRpcService.cleanCategoryProduct(shopId, cateGoryId);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("商品同步异常", e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue