shopUser 增加 是否是分销员的标识
会员等级
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.czg.account.entity;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
@@ -12,8 +13,9 @@ import lombok.experimental.Accessors;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 商户储值会员 实体类。
|
||||
@@ -22,7 +24,6 @@ import java.time.LocalDateTime;
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_user")
|
||||
@@ -157,7 +158,7 @@ public class ShopUser implements Serializable {
|
||||
//邀请人上级累计收益/二级分润
|
||||
private BigDecimal twoIncome;
|
||||
// 是否分销员
|
||||
private Integer isDistribution;
|
||||
private String distributionShops;
|
||||
|
||||
@Column(ignore = true)
|
||||
private String memberName;
|
||||
@@ -167,4 +168,44 @@ public class ShopUser implements Serializable {
|
||||
@Column(ignore = true)
|
||||
private Integer isMemberPrice;
|
||||
|
||||
|
||||
/**
|
||||
* 检查分销店铺是否包含当前店铺
|
||||
*/
|
||||
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) {
|
||||
if (shopId == null) {
|
||||
return;
|
||||
}
|
||||
String targetId = shopId.toString().trim();
|
||||
if (targetId.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 解析原有字符串为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);
|
||||
}
|
||||
}
|
||||
}
|
||||
shopSet.add(targetId);
|
||||
distributionShops = String.join(",", shopSet);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user