分销修改

This commit is contained in:
张松
2025-10-28 13:42:24 +08:00
parent f83945f8f5
commit 4b8fc8a15c
8 changed files with 60 additions and 27 deletions

View File

@@ -430,7 +430,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
// 上上级分销员
if (distributionUser.getParentId() != null) {
MkDistributionUser parent = getOne(new QueryWrapper().eq(MkDistributionUser::getId, distributionUser.getParentId()));
if (parent == null) {
return;
}
@@ -523,7 +523,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
BigDecimal fee = withdrawFlowDTO.getAmount().multiply(BigDecimal.valueOf(0.08));
BigDecimal finalAmount = withdrawFlowDTO.getAmount().subtract(fee);
MkDistributionWithdrawFlow withdrawFlow = new MkDistributionWithdrawFlow().setShopId(withdrawFlowDTO.getShopId()).setShopUserId(shopUserInfo.getId())
MkDistributionWithdrawFlow withdrawFlow = new MkDistributionWithdrawFlow().setShopId(withdrawFlowDTO.getShopId()).setUserId(userId)
.setAmount(finalAmount).setServiceFee(fee).setBillNo(IdUtil.simpleUUID()).setStatus(TableValueConstant.DistributionWithdrawFlow.Status.PENDING.getCode());
JSONObject jsonObject = appWxService.transferBalance(userInfo.getWechatOpenId(), userInfo.getRealName(), finalAmount, "提现", withdrawFlow.getBillNo());
withdrawFlow.setPackageInfo(jsonObject.getString("package_info"));
@@ -531,9 +531,8 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
}
@Override
public Map<String, Object> withdrawDetail(long userId, Long shopId, Long id) {
ShopUser shopUserInfo = shopUserService.getShopUserInfo(shopId, userId);
MkDistributionWithdrawFlow flow = withdrawFlowService.getOne(new QueryWrapper().eq(MkDistributionWithdrawFlow::getId, id).eq(MkDistributionWithdrawFlow::getShopUserId, shopUserInfo.getId()));
public Map<String, Object> withdrawDetail(long userId, Long id) {
MkDistributionWithdrawFlow flow = withdrawFlowService.getOne(new QueryWrapper().eq(MkDistributionWithdrawFlow::getId, id).eq(MkDistributionWithdrawFlow::getUserId, userId));
AssertUtil.isNull(flow, "提现记录不存在");
AssertUtil.isTrue(TableValueConstant.DistributionWithdrawFlow.Status.FINISH.getCode().equals(flow.getStatus()), "已经提现");

View File

@@ -1,8 +1,10 @@
package com.czg.service.market.service.impl;
import cn.hutool.core.util.StrUtil;
import com.czg.account.entity.ShopUser;
import com.czg.account.entity.UserInfo;
import com.czg.account.service.ShopUserService;
import com.czg.market.dto.MkDistributionWithdrawFlowDTO;
import com.czg.utils.MyQueryWrapper;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
@@ -10,10 +12,11 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.market.entity.MkDistributionWithdrawFlow;
import com.czg.market.service.MkDistributionWithdrawFlowService;
import com.czg.service.market.mapper.MkDistributionWithdrawFlowMapper;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
/**
* 提现记录表 服务层实现。
*
@@ -26,8 +29,34 @@ public class MkDistributionWithdrawFlowServiceImpl extends ServiceImpl<MkDistrib
private ShopUserService shopUserService;
@Override
public Page<MkDistributionWithdrawFlow> pageInfo(long userId, Long shopId) {
ShopUser shopUserInfo = shopUserService.getShopUserInfo(shopId, userId);
return page(PageUtil.buildPage(), new QueryWrapper().eq(MkDistributionWithdrawFlow::getShopUserId, shopUserInfo.getId()));
public Page<MkDistributionWithdrawFlow> pageInfo(long userId) {
return page(PageUtil.buildPage(), new QueryWrapper().eq(MkDistributionWithdrawFlow::getUserId, userId));
}
@Override
public Page<MkDistributionWithdrawFlow> withdrawPageInfo(Long shopId, Long userId, LocalDateTime startTime, LocalDateTime endTime, String key) {
QueryWrapper queryWrapper = new MyQueryWrapper()
.selectAll(MkDistributionWithdrawFlow.class)
.leftJoin(UserInfo.class).on(UserInfo::getId, MkDistributionWithdrawFlow::getUserId)
.select(UserInfo::getNickName, UserInfo::getPhone)
.eq(MkDistributionWithdrawFlow::getShopId, shopId).eq(MkDistributionWithdrawFlow::getUserId, userId)
.ge(MkDistributionWithdrawFlow::getCreateTime, startTime)
.le(MkDistributionWithdrawFlow::getCreateTime, endTime);
if (StrUtil.isNotBlank(key)){
queryWrapper.and(and -> {
and.or(or -> {
or.like(ShopUser::getId, key);
});
and.or(or -> {
or.like(ShopUser::getNickName, key);
});
and.or(or -> {
or.like(ShopUser::getPhone, key);
});
});
}
return page(PageUtil.buildPage(), queryWrapper);
}
}