邀请人列表 条件 添加邀请人 邀请身份 是否有效
This commit is contained in:
@@ -44,10 +44,11 @@ public class DistributionUserController {
|
||||
public CzgResult<Page<InviteUserVO>> getInviteUser(
|
||||
@RequestParam Long id,
|
||||
@RequestParam(required = false) Long shopUserId,
|
||||
@RequestParam(required = false) Long distributionLevelId,
|
||||
@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size) {
|
||||
AssertUtil.isNull(id, "邀请人ID");
|
||||
return CzgResult.success(distributionUserService.getInviteUser(id, shopUserId, page, size));
|
||||
return CzgResult.success(distributionUserService.getInviteUser(id, shopUserId, distributionLevelId, page, size));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -122,7 +122,7 @@ public class UDistributionController {
|
||||
@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size) {
|
||||
AssertUtil.isNull(id, "邀请人ID");
|
||||
return CzgResult.success(distributionUserService.getInviteUser(id, null, page, size));
|
||||
return CzgResult.success(distributionUserService.getInviteUser(id, null, null, page, size));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 分销员:按消费金额升级等级
|
||||
|
||||
@@ -54,5 +54,5 @@ public class InviteUserVO implements Serializable {
|
||||
/**
|
||||
* 是否分销员
|
||||
*/
|
||||
private Integer isDistribution;
|
||||
private String distributionShops;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public interface ShopUserMapper extends BaseMapper<ShopUser> {
|
||||
* @param distributionUserId 分销员ID
|
||||
* @return 分页结果
|
||||
*/
|
||||
List<InviteUserVO> getInviteUser(Long distributionUserId, Long shopUserId);
|
||||
List<InviteUserVO> getInviteUser(Long distributionUserId, Long shopUserId, Long distributionLevelId);
|
||||
|
||||
void updateOneOrTwoAmount(Long userId, Long mainShopId, BigDecimal amount, Integer isOne);
|
||||
|
||||
|
||||
@@ -99,9 +99,9 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<InviteUserVO> getInviteUser(Long distributionUserId, Long shopUserId, Integer page, Integer size) {
|
||||
public Page<InviteUserVO> getInviteUser(Long distributionUserId, Long shopUserId, Long distributionLevelId, Integer page, Integer size) {
|
||||
PageHelper.startPage(page, size);
|
||||
List<InviteUserVO> inviteUser = mapper.getInviteUser(distributionUserId, shopUserId);
|
||||
List<InviteUserVO> inviteUser = mapper.getInviteUser(distributionUserId, shopUserId, distributionLevelId);
|
||||
return PageUtil.convert(new PageInfo<>(inviteUser));
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<mapper namespace="com.czg.service.account.mapper.ShopUserMapper">
|
||||
<update id="incrAccount">
|
||||
update tb_shop_user
|
||||
set amount = COALESCE(amount, 0) + #{money},
|
||||
set amount = COALESCE(amount, 0) + #{money},
|
||||
update_time = #{time}
|
||||
where id = #{id}
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
<select id="selectUserSummary" resultType="com.czg.account.dto.shopuser.ShopUserSummaryDTO">
|
||||
select count(a.id) userTotal, sum(IFNULL(a.amount, 0)) balanceTotal,sum(IFNULL(b.amount,0)) chargeTotal from
|
||||
tb_shop_user as a
|
||||
@@ -58,7 +57,7 @@
|
||||
COUNT(DISTINCT c.id) AS couponNum
|
||||
FROM tb_shop_user AS b
|
||||
LEFT JOIN mk_shop_coupon_record AS c
|
||||
ON c.shop_user_id = b.id
|
||||
ON c.shop_user_id = b.id
|
||||
AND c.`status` = 1
|
||||
AND c.use_start_time < NOW()
|
||||
AND c.use_end_time > NOW()
|
||||
@@ -130,78 +129,78 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPushEventUser" resultType="com.czg.account.entity.ShopUser">
|
||||
SELECT DISTINCT
|
||||
u.id,u.user_id, u.head_img, u.nick_name, u.amount, u.account_points, u.phone,
|
||||
<choose>
|
||||
<!-- 当有筛选条件时才计算订单相关字段 -->
|
||||
<when test="param.orderTimeToday == 1 or param.orderTimeYesterday == 1 or
|
||||
<select id="selectPushEventUser" resultType="com.czg.account.entity.ShopUser">
|
||||
SELECT DISTINCT
|
||||
u.id,u.user_id, u.head_img, u.nick_name, u.amount, u.account_points, u.phone,
|
||||
<choose>
|
||||
<!-- 当有筛选条件时才计算订单相关字段 -->
|
||||
<when test="param.orderTimeToday == 1 or param.orderTimeYesterday == 1 or
|
||||
param.orderTimeTwoWeeks == 1 or param.orderTimeMoreThanTwoWeeks == 1 or
|
||||
param.noOrder == 1 or param.oneOrder == 1 or param.fiveOrder == 1">
|
||||
COUNT(o.id) AS order_count,
|
||||
SUM(CASE WHEN o.trade_day = CURDATE() THEN 1 ELSE 0 END) AS today_orders,
|
||||
SUM(CASE WHEN o.trade_day = CURDATE() - INTERVAL 1 DAY THEN 1 ELSE 0 END) AS yesterday_orders,
|
||||
SUM(CASE WHEN o.trade_day >= CURDATE() - INTERVAL 2 WEEK AND o.trade_day < CURDATE() - INTERVAL 1
|
||||
DAY
|
||||
THEN 1 ELSE 0 END) AS two_weeks_orders,
|
||||
SUM(CASE WHEN o.trade_day < CURDATE() - INTERVAL 2 WEEK THEN 1 ELSE 0 END) AS earlier_orders
|
||||
</when>
|
||||
<!-- 无筛选条件时不计算订单相关字段 -->
|
||||
<otherwise>
|
||||
0 AS order_count,
|
||||
0 AS today_orders,
|
||||
0 AS yesterday_orders,
|
||||
0 AS two_weeks_orders,
|
||||
0 AS earlier_orders
|
||||
</otherwise>
|
||||
</choose>
|
||||
FROM tb_shop_user u
|
||||
<!-- 只有当有筛选条件时才关联order表 -->
|
||||
<if test="param.orderTimeToday == 1 or param.orderTimeYesterday == 1 or
|
||||
COUNT(o.id) AS order_count,
|
||||
SUM(CASE WHEN o.trade_day = CURDATE() THEN 1 ELSE 0 END) AS today_orders,
|
||||
SUM(CASE WHEN o.trade_day = CURDATE() - INTERVAL 1 DAY THEN 1 ELSE 0 END) AS yesterday_orders,
|
||||
SUM(CASE WHEN o.trade_day >= CURDATE() - INTERVAL 2 WEEK AND o.trade_day < CURDATE() - INTERVAL 1
|
||||
DAY
|
||||
THEN 1 ELSE 0 END) AS two_weeks_orders,
|
||||
SUM(CASE WHEN o.trade_day < CURDATE() - INTERVAL 2 WEEK THEN 1 ELSE 0 END) AS earlier_orders
|
||||
</when>
|
||||
<!-- 无筛选条件时不计算订单相关字段 -->
|
||||
<otherwise>
|
||||
0 AS order_count,
|
||||
0 AS today_orders,
|
||||
0 AS yesterday_orders,
|
||||
0 AS two_weeks_orders,
|
||||
0 AS earlier_orders
|
||||
</otherwise>
|
||||
</choose>
|
||||
FROM tb_shop_user u
|
||||
<!-- 只有当有筛选条件时才关联order表 -->
|
||||
<if test="param.orderTimeToday == 1 or param.orderTimeYesterday == 1 or
|
||||
param.orderTimeTwoWeeks == 1 or param.orderTimeMoreThanTwoWeeks == 1 or
|
||||
param.noOrder == 1 or param.oneOrder == 1 or param.fiveOrder == 1">
|
||||
LEFT JOIN `tb_order_info` o ON u.user_id = o.user_id and o.user_id is not null AND o.shop_id = #{shopId}
|
||||
AND o.status = 'done'
|
||||
</if>
|
||||
WHERE u.main_shop_id = #{mainShopId} and u.phone is not null and u.user_id is not null
|
||||
<!-- 性别筛选条件 -->
|
||||
<if test="!(param.sexMan == 1 and param.sexWoman == 1 and param.sexUnknown == 1)
|
||||
LEFT JOIN `tb_order_info` o ON u.user_id = o.user_id and o.user_id is not null AND o.shop_id = #{shopId}
|
||||
AND o.status = 'done'
|
||||
</if>
|
||||
WHERE u.main_shop_id = #{mainShopId} and u.phone is not null and u.user_id is not null
|
||||
<!-- 性别筛选条件 -->
|
||||
<if test="!(param.sexMan == 1 and param.sexWoman == 1 and param.sexUnknown == 1)
|
||||
and (param.sexMan == 1 or param.sexWoman == 1 or param.sexUnknown == 1)">
|
||||
AND
|
||||
<trim prefix="(" suffix=")" prefixOverrides="OR">
|
||||
<if test="param.sexMan == 1">OR u.sex = 1</if>
|
||||
<if test="param.sexWoman == 1">OR u.sex = 0</if>
|
||||
<if test="param.sexUnknown == 1">OR u.sex IS NULL</if>
|
||||
</trim>
|
||||
</if>
|
||||
AND
|
||||
<trim prefix="(" suffix=")" prefixOverrides="OR">
|
||||
<if test="param.sexMan == 1">OR u.sex = 1</if>
|
||||
<if test="param.sexWoman == 1">OR u.sex = 0</if>
|
||||
<if test="param.sexUnknown == 1">OR u.sex IS NULL</if>
|
||||
</trim>
|
||||
</if>
|
||||
|
||||
<!-- 会员状态筛选 -->
|
||||
<if test="param.isVip != null">
|
||||
AND u.is_vip = #{param.isVip}
|
||||
</if>
|
||||
<!-- 会员状态筛选 -->
|
||||
<if test="param.isVip != null">
|
||||
AND u.is_vip = #{param.isVip}
|
||||
</if>
|
||||
|
||||
<if test="param.isRecharge != null">
|
||||
AND u.recharge_count <![CDATA[ ${param.isRecharge == 0 ? '=' : '>'} ]]> 0
|
||||
</if>
|
||||
<!-- 只有当有筛选条件时才需要HAVING子句 -->
|
||||
<if test="param.orderTimeToday == 1 or param.orderTimeYesterday == 1 or
|
||||
<if test="param.isRecharge != null">
|
||||
AND u.recharge_count <![CDATA[ ${param.isRecharge == 0 ? '=' : '>'} ]]> 0
|
||||
</if>
|
||||
<!-- 只有当有筛选条件时才需要HAVING子句 -->
|
||||
<if test="param.orderTimeToday == 1 or param.orderTimeYesterday == 1 or
|
||||
param.orderTimeTwoWeeks == 1 or param.orderTimeMoreThanTwoWeeks == 1 or
|
||||
param.noOrder == 1 or param.oneOrder == 1 or param.fiveOrder == 1">
|
||||
GROUP BY u.id
|
||||
HAVING
|
||||
<trim prefix="(" suffix=")" prefixOverrides="OR">
|
||||
<if test="param.orderTimeToday == 1">OR today_orders > 0</if>
|
||||
<if test="param.orderTimeYesterday == 1">OR yesterday_orders > 0</if>
|
||||
<if test="param.orderTimeTwoWeeks == 1">OR two_weeks_orders > 0</if>
|
||||
<if test="param.orderTimeMoreThanTwoWeeks == 1">OR earlier_orders > 0</if>
|
||||
GROUP BY u.id
|
||||
HAVING
|
||||
<trim prefix="(" suffix=")" prefixOverrides="OR">
|
||||
<if test="param.orderTimeToday == 1">OR today_orders > 0</if>
|
||||
<if test="param.orderTimeYesterday == 1">OR yesterday_orders > 0</if>
|
||||
<if test="param.orderTimeTwoWeeks == 1">OR two_weeks_orders > 0</if>
|
||||
<if test="param.orderTimeMoreThanTwoWeeks == 1">OR earlier_orders > 0</if>
|
||||
|
||||
<if test="param.noOrder == 1">OR order_count = 0</if>
|
||||
<if test="param.oneOrder == 1">OR order_count = 1</if>
|
||||
<if test="param.fiveOrder == 1">OR order_count >= 5</if>
|
||||
</trim>
|
||||
</if>
|
||||
order by u.create_time desc
|
||||
</select>
|
||||
<if test="param.noOrder == 1">OR order_count = 0</if>
|
||||
<if test="param.oneOrder == 1">OR order_count = 1</if>
|
||||
<if test="param.fiveOrder == 1">OR order_count >= 5</if>
|
||||
</trim>
|
||||
</if>
|
||||
order by u.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectAcPushEventUser" resultType="com.czg.account.entity.ShopUser">
|
||||
SELECT DISTINCT
|
||||
@@ -291,11 +290,12 @@
|
||||
dist.status AS status,
|
||||
dist.distribution_level_id AS levelId,
|
||||
dist.distribution_level_name AS levelName,
|
||||
CASE WHEN dist.id IS NOT NULL THEN 1 ELSE 0 END AS isDistribution
|
||||
dist.distribution_shops AS distributionShops
|
||||
FROM `tb_shop_user` as u
|
||||
left join mk_distribution_user dist on u.id = dist.id
|
||||
WHERE u.`distribution_user_id` = #{distributionUserId}
|
||||
<if test="distributionLevelId != null">and dist.distribution_level_id = #{distributionLevelId}</if>
|
||||
<if test="shopUserId != null">and u.id = #{shopUserId}</if>
|
||||
ORDER BY u.`id` DESC
|
||||
ORDER BY u.`invite_time` DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -282,7 +282,15 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
newDistributionUser.setInviteCount(parent.getInviteCount() + 1);
|
||||
MkDistributionConfig mkDistributionConfig = mkDistributionConfigService.getOne(QueryWrapper.create()
|
||||
.eq(MkDistributionConfig::getShopId, parent.getShopId()));
|
||||
if (mkDistributionConfig != null && parent.getIsAssignLevel() == 0) {
|
||||
if ("自主申请".equals(parent.getOpeningMethod()) && parent.getStatus() == 0 && mkDistributionConfig != null) {
|
||||
if (newDistributionUser.getInviteCount() >= mkDistributionConfig.getInviteCount()) {
|
||||
ShopUser parentShopUser1 = new ShopUser();
|
||||
parentShopUser1.setId(shopUser.getId());
|
||||
parentShopUser1.upDistributionShop(param.getShopId(), 1);
|
||||
shopUserService.updateById(parentShopUser1);
|
||||
}
|
||||
}
|
||||
if (mkDistributionConfig != null && !"not_upgrade".equals(mkDistributionConfig.getUpgradeType()) && parent.getIsAssignLevel() == 0) {
|
||||
if ("invite".equals(mkDistributionConfig.getUpgradeType())) {
|
||||
if (mkDistributionConfig.getInviteConsume() == 1) {
|
||||
long count = orderInfoService.count(QueryWrapper.create()
|
||||
@@ -296,8 +304,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
MkDistributionLevelConfig levelConfig = levelConfigService.getOne(QueryWrapper.create()
|
||||
.eq(MkDistributionLevelConfig::getShopId, parent.getShopId())
|
||||
.le(MkDistributionLevelConfig::getInviteCount, newDistributionUser.getInviteCount())
|
||||
.gt(MkDistributionLevelConfig::getId, parent.getDistributionLevelId())
|
||||
.orderBy(MkDistributionLevelConfig::getId).asc().limit(1));
|
||||
.orderBy(MkDistributionLevelConfig::getId).desc().limit(1));
|
||||
if (levelConfig != null) {
|
||||
newDistributionUser.setDistributionLevelId(levelConfig.getId());
|
||||
newDistributionUser.setDistributionLevelName(levelConfig.getName());
|
||||
@@ -392,8 +399,8 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<InviteUserVO> getInviteUser(Long id, Long shopUserId, Integer page, Integer size) {
|
||||
return shopUserService.getInviteUser(id, shopUserId, page, size);
|
||||
public Page<InviteUserVO> getInviteUser(Long id, Long shopUserId, Long distributionLevelId, Integer page, Integer size) {
|
||||
return shopUserService.getInviteUser(id, shopUserId, distributionLevelId, page, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -403,25 +410,39 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
AssertUtil.isNull(param.getId(), "店铺用户ID不能为空");
|
||||
ShopUser shopUser = shopUserService.getById(param.getId());
|
||||
AssertUtil.isNull(shopUser, "店铺用户ID不能为空");
|
||||
boolean isExits = shopUser.checkDistributionShops(param.getShopId().toString());
|
||||
if (isExits) {
|
||||
throw new CzgException("该用户已被添加为分销员,不可重复添加");
|
||||
MkDistributionUser distributionUser = getOne(QueryWrapper.create()
|
||||
.eq(MkDistributionUser::getId, param.getId())
|
||||
.eq(MkDistributionUser::getShopId, param.getShopId()));
|
||||
if (distributionUser != null && distributionUser.getStatus() != 0) {
|
||||
throw new CzgException("该用户已是分销员,不可重复添加");
|
||||
}
|
||||
MkDistributionConfig config = mkDistributionConfigService.getOne(
|
||||
QueryWrapper.create().eq(MkDistributionConfig::getShopId, param.getShopId())
|
||||
.eq(MkDistributionConfig::getIsEnable, 1));
|
||||
AssertUtil.isNull(config, "店铺未配置分销");
|
||||
param.setStatus(0);
|
||||
param.setId(param.getId());
|
||||
param.setUserId(shopUser.getUserId());
|
||||
param.setInviteCode(CzgRandomUtils.randomString(10));
|
||||
if (!"自主申请".equals(param.getOpeningMethod()) || config.getInviteCount() == 0) {
|
||||
initLevel(config, param);
|
||||
}
|
||||
save(param);
|
||||
if (distributionUser != null) {
|
||||
distributionUser.setOpeningMethod("手动添加");
|
||||
distributionUser.setDistributionLevelId(param.getDistributionLevelId());
|
||||
distributionUser.setDistributionLevelName(param.getDistributionLevelName());
|
||||
distributionUser.setStatus(1);
|
||||
saveOrUpdate(distributionUser);
|
||||
}else {
|
||||
param.setStatus(0);
|
||||
param.setId(param.getId());
|
||||
param.setUserId(shopUser.getUserId());
|
||||
param.setInviteCode(CzgRandomUtils.randomString(10));
|
||||
saveOrUpdate(param);
|
||||
}
|
||||
ShopUser shopUser2 = new ShopUser();
|
||||
shopUser2.setId(shopUser.getId());
|
||||
shopUser2.addDistributionShop(param.getShopId());
|
||||
if (param.getStatus() == 0) {
|
||||
shopUser2.upDistributionShop(param.getShopId(), 0);
|
||||
} else {
|
||||
shopUser2.upDistributionShop(param.getShopId(), 1);
|
||||
}
|
||||
shopUserService.updateById(shopUser2);
|
||||
return param;
|
||||
}
|
||||
@@ -523,7 +544,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
addDistributionUser(new MkDistributionUser().setShopId(shopId)
|
||||
.setUserId(shopUserInfo.getUserId())
|
||||
.setId(shopUserInfo.getId()).setOpeningMethod("付费开通"));
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
log.error("分销员开通失败", e);
|
||||
}
|
||||
}
|
||||
@@ -610,18 +631,18 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
log.info("即时分销开始");
|
||||
try {
|
||||
updateShopInfoAmount(currentDistributionUser.getShopId(), rewardAmount.negate(), sourceId, TableValueConstant.DistributionAmountFlow.Type.SUB, "分销扣除");
|
||||
updateIncome(BigDecimal.ZERO, rewardAmount, BigDecimal.ZERO, currentDistributionUser.getId(), shopUser.getUserId(), shopUser.getMainShopId(), currentLevel == 1 ? 1 : 2);
|
||||
updateIncome(BigDecimal.ZERO, rewardAmount, BigDecimal.ZERO, currentDistributionUser.getId(), shopUser.getUserId(), shopUser.getMainShopId(), currentLevel == 1 ? 1 : 2);
|
||||
} catch (Exception e) {
|
||||
mkDistributionFlow.setStatus(TableValueConstant.DistributionFlow.Status.PENDING.getCode());
|
||||
updateIncome(rewardAmount, BigDecimal.ZERO, BigDecimal.ZERO, currentDistributionUser.getId(), shopUser.getUserId(), shopUser.getMainShopId(), currentLevel == 1 ? 1 : 2);
|
||||
updateIncome(rewardAmount, BigDecimal.ZERO, BigDecimal.ZERO, currentDistributionUser.getId(), shopUser.getUserId(), shopUser.getMainShopId(), currentLevel == 1 ? 1 : 2);
|
||||
distributionFlowService.updateById(mkDistributionFlow);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
mkDistributionFlow.setDeliverTime(delayTime);
|
||||
mkDistributionFlow.setStatus(TableValueConstant.DistributionFlow.Status.PENDING.getCode());
|
||||
distributionFlowService.save(mkDistributionFlow);
|
||||
log.info("延时分销开始");
|
||||
updateIncome(rewardAmount, BigDecimal.ZERO, BigDecimal.ZERO, currentDistributionUser.getId(), shopUser.getUserId(), shopUser.getMainShopId(), currentLevel == 1 ? 1 : 2);
|
||||
updateIncome(rewardAmount, BigDecimal.ZERO, BigDecimal.ZERO, currentDistributionUser.getId(), shopUser.getUserId(), shopUser.getMainShopId(), currentLevel == 1 ? 1 : 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -654,7 +675,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
item.setStatus(TableValueConstant.DistributionFlow.Status.SUCCESS.getCode());
|
||||
updateIncome(item.getRewardAmount().negate(), BigDecimal.ZERO, BigDecimal.ZERO, item.getDistributionUserId(), item.getUserId(), item.getShopId(), item.getLevel());
|
||||
distributionFlowService.updateById(item);
|
||||
}else {
|
||||
} else {
|
||||
// 执行扣款
|
||||
updateIncome(BigDecimal.ZERO, item.getRewardAmount().negate(), BigDecimal.ZERO, item.getDistributionUserId(), item.getUserId(), item.getShopId(), item.getLevel());
|
||||
updateShopInfoAmount(item.getShopId(), item.getRewardAmount(), orderId, TableValueConstant.DistributionAmountFlow.Type.REFUND, "分销回退");
|
||||
|
||||
Reference in New Issue
Block a user