邀请人列表 条件 添加邀请人 邀请身份 是否有效

This commit is contained in:
2025-10-30 17:59:55 +08:00
parent 84d2420c59
commit 86e6714f97
10 changed files with 136 additions and 120 deletions

View File

@@ -171,44 +171,38 @@ public class ShopUser implements Serializable {
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime inviteTime;
/**
* 检查分销店铺是否包含当前店铺
* 添加或更新分销店铺若shopId已存在无论后缀则替换为新的id_后缀否则插入
*
* @param shopId 店铺ID
* @param suffix 新后缀
*/
public boolean checkDistributionShops(String shopId) {
if (distributionShops == null || StrUtil.isEmpty(shopId)) {
return false;
}
// 按逗号分割并检查每个元素是否完全匹配
String[] shopIds = distributionShops.split(",");
for (String id : shopIds) {
if (shopId.equals(id.trim())) {
return true;
}
}
return false;
}
public void addDistributionShop(Long shopId) {
public void upDistributionShop(Long shopId, int suffix) {
if (shopId == null) {
return;
}
String targetId = shopId.toString().trim();
if (targetId.isEmpty()) {
String shopIdStr = shopId.toString().trim();
if (shopIdStr.isEmpty()) {
return;
}
// 解析原有字符串为Set(去重+方便判断)
// 解析原有字符串为Set
Set<String> shopSet = new HashSet<>();
if (distributionShops != null && !distributionShops.trim().isEmpty()) {
for (String id : distributionShops.split(",")) {
String trimmedId = id.trim();
if (!trimmedId.isEmpty()) {
shopSet.add(trimmedId);
for (String idWithSuffix : distributionShops.split(",")) {
String trimmed = idWithSuffix.trim();
if (trimmed.isEmpty()) {
continue;
}
// 判断:如果不是以 "shopId_" 开头的记录,则保留
if (!trimmed.startsWith(shopIdStr + "_")) {
shopSet.add(trimmed);
}
}
}
shopSet.add(targetId);
// 添加新的id_后缀
shopSet.add(shopIdStr + "_" + suffix);
// 重新拼接字符串
distributionShops = String.join(",", shopSet);
}
}

View File

@@ -29,7 +29,7 @@ public interface ShopUserService extends IService<ShopUser> {
/**
* 获取邀请用户列表
*/
Page<InviteUserVO> getInviteUser(Long getDistributionUserId, Long shopUserId, Integer page, Integer size);
Page<InviteUserVO> getInviteUser(Long getDistributionUserId, Long shopUserId, Long distributionLevelId, Integer page, Integer size);
boolean updateInfo(ShopUser shopUser);

View File

@@ -66,7 +66,7 @@ public interface MkDistributionUserService extends IService<MkDistributionUser>
/**
* 获取分销员邀请人分页列表
*/
Page<InviteUserVO> getInviteUser(Long id, Long shopUserId, Integer page, Integer size);
Page<InviteUserVO> getInviteUser(Long id, Long shopUserId, Long distributionLevelId, Integer page, Integer size);
/**
* 分销员:按消费金额升级等级

View File

@@ -54,5 +54,5 @@ public class InviteUserVO implements Serializable {
/**
* 是否分销员
*/
private Integer isDistribution;
private String distributionShops;
}