消息通知

This commit is contained in:
wangw 2025-04-10 10:38:03 +08:00
parent a5e2ab26e3
commit 666b0f481e
3 changed files with 27 additions and 27 deletions

View File

@ -12,7 +12,7 @@ public interface ShopSyncService {
* @param sourceShopId 源店铺ID
* @param targetShopId 目标店铺ID
*/
void sync(Long sourceShopId, Long targetShopId);
void sync(Long sourceShopId, Long targetShopId, Long sysUserId);
/**
* 同步单位新增/修改字段/逻辑删除 不包含删除 将源店铺的单位同步到 开了同步商品开关的子店铺
@ -20,7 +20,7 @@ public interface ShopSyncService {
* @param sourceShopId 主店ID
* @param unitId 主店单位Id
*/
void syncUnitBySourceShop(Long sourceShopId, Long unitId);
void syncUnitBySourceShop(Long sourceShopId, Long unitId, Long sysUserId);
/**
* 同步规格新增/修改字段/逻辑删除 不包含删除 将源店铺的规格同步到 开了同步商品开关的子店铺
@ -28,7 +28,7 @@ public interface ShopSyncService {
* @param sourceShopId 主店ID
* @param specId 主店规格Id
*/
void syncSpecBySourceShop(Long sourceShopId, Long specId);
void syncSpecBySourceShop(Long sourceShopId, Long specId, Long sysUserId);
/**
* 同步分类新增/修改字段/逻辑删除 不包含删除 将源店铺的分类同步到 开了同步商品开关的子店铺
@ -36,7 +36,7 @@ public interface ShopSyncService {
* @param sourceShopId 主店ID
* @param categoryId 主店分类Id
*/
void syncCategoryBySourceShop(Long sourceShopId, Long categoryId);
void syncCategoryBySourceShop(Long sourceShopId, Long categoryId, Long sysUserId);
/**
* 同步商品 会同步Sku新增/修改字段/逻辑删除 不包含删除 将源店铺的商品同步到 开了同步商品开关的子店铺
@ -44,7 +44,7 @@ public interface ShopSyncService {
* @param sourceShopId 主店ID
* @param productId 主店商品Id
*/
void syncProductBySourceShop(Long sourceShopId, Long productId);
void syncProductBySourceShop(Long sourceShopId, Long productId, Long sysUserId);
/**
* 同步分组 新增/修改字段/逻辑删除 不包含删除 将源店铺的分组同步到 开了同步商品开关的子店铺
@ -52,7 +52,7 @@ public interface ShopSyncService {
* @param sourceShopId 主店ID
* @param groupId 主店分组Id
*/
void syncGroupBySourceShop(Long sourceShopId, Long groupId);
void syncGroupBySourceShop(Long sourceShopId, Long groupId, Long sysUserId);
/**
* 同步耗材分组 新增/修改字段/逻辑删除 不包含删除 将源店铺的耗材分组同步到 开了同步耗材开关的子店铺
@ -60,7 +60,7 @@ public interface ShopSyncService {
* @param sourceShopId 主店ID
* @param consGroupId 主店耗材分组Id
*/
void syncConsGroupBySourceShop(Long sourceShopId, Long consGroupId);
void syncConsGroupBySourceShop(Long sourceShopId, Long consGroupId, Long sysUserId);
/**
* 同步耗材信息新增/修改字段/逻辑删除 不包含删除 将源店铺的耗材信息同步到 开了同步耗材开关的子店铺
@ -68,7 +68,7 @@ public interface ShopSyncService {
* @param sourceShopId 主店ID
* @param consInfoId 主店ID
*/
void syncConsInfoBySourceShop(Long sourceShopId, Long consInfoId);
void syncConsInfoBySourceShop(Long sourceShopId, Long consInfoId, Long sysUserId);
/**
* 同步商品绑定耗材关联关系 开了同步耗材开关的子店铺
@ -76,5 +76,5 @@ public interface ShopSyncService {
* @param sourceShopId 主店ID
* @param sourceProdId 主店商品ID
*/
void syncConsProBySourceShop(Long sourceShopId, Long sourceProdId);
void syncConsProBySourceShop(Long sourceShopId, Long sourceProdId, Long sysUserId);
}

View File

@ -108,7 +108,7 @@ public class ShopBranchServiceImpl implements ShopBranchService {
shopConfigMapper.update(branchConfig);
ThreadUtil.execAsync(() -> {
// 同步商品和耗材
shopSyncService.sync(shopId, branchShop.getId());
shopSyncService.sync(shopId, branchShop.getId(), StpKit.USER.getLoginIdAsLong());
});
ThreadUtil.execAsync(() -> {
// 同步会员信息

View File

@ -119,7 +119,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
@Override
@Transactional(rollbackFor = Exception.class)
public void sync(Long sourceShopId, Long targetShopId) {
public void sync(Long sourceShopId, Long targetShopId, Long sysUserId) {
Map<Long, Long> unitMap;
Map<Long, Long> specMap;
Map<Long, Long> categoryMap;
@ -160,7 +160,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
Map<Long, Long> consInfoMap = syncConsInfo(sourceShopId, targetShopId, conGroupMap);
buildNotice(mainMapList, "耗材信息同步", consInfoMap.size(), null);
syncConsPro(sourceShopId, targetShopId, consInfoMap, proMap);
syncNoticeService.addNotice(targetShopId, StpKit.USER.getLoginIdAsLong(), "数据同步", JSON.toJSONString(mainMapList), null);
syncNoticeService.addNotice(targetShopId, sysUserId, "数据同步", JSON.toJSONString(mainMapList), null);
}
/**
@ -211,7 +211,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
@Override
@Transactional(rollbackFor = Exception.class)
public void syncUnitBySourceShop(Long sourceShopId, Long unitId) {
public void syncUnitBySourceShop(Long sourceShopId, Long unitId, Long sysUserId) {
AssertUtil.isNull(unitId, "{}不能为空", "单位ID");
Set<Long> shopIds = checkSourceShopInfo(sourceShopId, 1);
if (CollUtil.isEmpty(shopIds)) {
@ -242,7 +242,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
}
unitDataMap.put(newUnit.getId(), newUnit.getName());
buildNotice(mainMapList, "单位变动", 1, unitDataMap);
syncNoticeService.addNotice(shopId, StpKit.USER.getLoginIdAsLong(), "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newUnit));
syncNoticeService.addNotice(shopId, sysUserId, "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newUnit));
});
}
@ -271,7 +271,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
@Override
@Transactional(rollbackFor = Exception.class)
public void syncSpecBySourceShop(Long sourceShopId, Long specId) {
public void syncSpecBySourceShop(Long sourceShopId, Long specId, Long sysUserId) {
AssertUtil.isNull(specId, "{}不能为空", "规格ID");
Set<Long> shopIds = checkSourceShopInfo(sourceShopId, 1);
if (CollUtil.isEmpty(shopIds)) {
@ -301,7 +301,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
}
dataMap.put(newEntity.getId(), newEntity.getName());
buildNotice(mainMapList, "规格变动", 1, dataMap);
syncNoticeService.addNotice(shopId, StpKit.USER.getLoginIdAsLong(), "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
syncNoticeService.addNotice(shopId, sysUserId, "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
});
}
@ -355,7 +355,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
@Override
@Transactional(rollbackFor = Exception.class)
public void syncCategoryBySourceShop(Long sourceShopId, Long categoryId) {
public void syncCategoryBySourceShop(Long sourceShopId, Long categoryId, Long sysUserId) {
AssertUtil.isNull(categoryId, "{}不能为空", "分类ID");
Set<Long> shopIds = checkSourceShopInfo(sourceShopId, 1);
if (CollUtil.isEmpty(shopIds)) {
@ -393,7 +393,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
}
dataMap.put(newEntity.getId(), newEntity.getName());
buildNotice(mainMapList, "分类变动", 1, dataMap);
syncNoticeService.addNotice(shopId, StpKit.USER.getLoginIdAsLong(), "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
syncNoticeService.addNotice(shopId, sysUserId, "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
}
}
@ -430,7 +430,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
@Override
@Transactional(rollbackFor = Exception.class)
public void syncProductBySourceShop(Long sourceShopId, Long productId) {
public void syncProductBySourceShop(Long sourceShopId, Long productId, Long sysUserId) {
AssertUtil.isNull(productId, "{}不能为空", "商品ID");
Set<Long> shopIds = checkSourceShopInfo(sourceShopId, 1);
if (CollUtil.isEmpty(shopIds)) {
@ -484,7 +484,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
}
dataMap.put(newEntity.getId(), newEntity.getName());
buildNotice(mainMapList, "商品变动", 1, dataMap);
syncNoticeService.addNotice(shopId, StpKit.USER.getLoginIdAsLong(), "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
syncNoticeService.addNotice(shopId, sysUserId, "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
}
}
@ -520,7 +520,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
@Override
@Transactional(rollbackFor = Exception.class)
public void syncGroupBySourceShop(Long sourceShopId, Long groupId) {
public void syncGroupBySourceShop(Long sourceShopId, Long groupId, Long sysUserId) {
AssertUtil.isNull(groupId, "{}不能为空", "分组ID");
Set<Long> shopIds = checkSourceShopInfo(sourceShopId, 1);
if (CollUtil.isEmpty(shopIds)) {
@ -555,7 +555,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
}
dataMap.put(newEntity.getId(), newEntity.getName());
buildNotice(mainMapList, "分组变动", 1, dataMap);
syncNoticeService.addNotice(shopId, StpKit.USER.getLoginIdAsLong(), "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
syncNoticeService.addNotice(shopId, sysUserId, "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
if (CollUtil.isEmpty(groupRelationMap)) {
List<ProdGroupRelation> oldProdGroup = prodGroupRelationService.queryChain().eq(ProdGroupRelation::getProdGroupId, newEntity.getId()).list();
if (CollUtil.isEmpty(oldProdGroup)) {
@ -727,7 +727,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
@Override
@Transactional(rollbackFor = Exception.class)
public void syncConsGroupBySourceShop(Long sourceShopId, Long consGroupId) {
public void syncConsGroupBySourceShop(Long sourceShopId, Long consGroupId, Long sysUserId) {
AssertUtil.isNull(consGroupId, "{}不能为空", "耗材分组ID");
Set<Long> shopIds = checkSourceShopInfo(sourceShopId, 2);
if (CollUtil.isEmpty(shopIds)) {
@ -757,7 +757,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
}
dataMap.put(newEntity.getId(), newEntity.getName());
buildNotice(mainMapList, "耗材分组变动", 1, dataMap);
syncNoticeService.addNotice(shopId, StpKit.USER.getLoginIdAsLong(), "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
syncNoticeService.addNotice(shopId, sysUserId, "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
});
}
@ -787,7 +787,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
@Override
@Transactional(rollbackFor = Exception.class)
public void syncConsInfoBySourceShop(Long sourceShopId, Long consInfoId) {
public void syncConsInfoBySourceShop(Long sourceShopId, Long consInfoId, Long sysUserId) {
AssertUtil.isNull(consInfoId, "{}不能为空", "耗材ID");
Set<Long> shopIds = checkSourceShopInfo(sourceShopId, 2);
if (CollUtil.isEmpty(shopIds)) {
@ -823,7 +823,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
}
dataMap.put(newEntity.getId(), newEntity.getConName());
buildNotice(mainMapList, "耗材信息变动", 1, dataMap);
syncNoticeService.addNotice(shopId, StpKit.USER.getLoginIdAsLong(), "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
syncNoticeService.addNotice(shopId, sysUserId, "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity));
}
}
@ -841,7 +841,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
@Override
@Transactional(rollbackFor = Exception.class)
public void syncConsProBySourceShop(Long sourceShopId, Long sourceProdId) {
public void syncConsProBySourceShop(Long sourceShopId, Long sourceProdId, Long sysUserId) {
AssertUtil.isNull(sourceProdId, "{}不能为空", "商品ID");
Set<Long> shopIds = checkSourceShopInfo(sourceShopId, 2);
if (CollUtil.isEmpty(shopIds)) {