feat:
1. 用户个人信息优化,增加不同类型的流水查询入口
This commit is contained in:
@@ -3,11 +3,13 @@ package org.springblade.modules.common.service;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户商城积分表 服务类
|
||||
@@ -32,4 +34,6 @@ public interface ICommonUserPointService extends BaseService<CommonUserPointEnti
|
||||
void spendPointsForLottery(BigDecimal amount, Long userId);
|
||||
|
||||
void spendPointForOrder(CommonUserOrderEntity order);
|
||||
|
||||
List<CommonUserPointLogEntity> queryLogsByUserId(Long userId, Integer size);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.springblade.modules.common.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
@@ -11,6 +12,7 @@ import org.springblade.modules.common.event.GrantUserPointEvent;
|
||||
import org.springblade.modules.common.event.SpendUserPointEvent;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
|
||||
import org.springblade.modules.common.mapper.CommonUserPointMapper;
|
||||
import org.springblade.modules.common.service.ICommonUserPointLogService;
|
||||
@@ -22,6 +24,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.springblade.modules.common.eums.BusinessModule.LOTTERY;
|
||||
@@ -119,5 +122,15 @@ public class CommonUserPointServiceImpl extends BaseServiceImpl<CommonUserPointM
|
||||
throw new ServiceException("消费用户积分失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonUserPointLogEntity> queryLogsByUserId(Long userId, Integer size) {
|
||||
return userPointLogService.list(Wrappers.lambdaQuery(CommonUserPointLogEntity.class)
|
||||
.eq(CommonUserPointLogEntity::getUserId, userId)
|
||||
.eq(CommonUserPointLogEntity::getIsDeleted, 0)
|
||||
.orderByDesc(CommonUserPointLogEntity::getId)
|
||||
.last("limit " + size)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -185,4 +185,11 @@ public class MarketInfoController extends BladeController {
|
||||
return R.data(summaryService.selectListByUserId(userId));
|
||||
}
|
||||
|
||||
@GetMapping("/user-flow-list")
|
||||
@ApiOperationSupport(order = 14)
|
||||
@Operation(summary = "用户水流查询", description = "传入id,type")
|
||||
public R<List<MarketUserFlowVO>> userFlowList(@RequestParam Long id, @RequestParam Integer type) {
|
||||
return R.data(marketInfoService.userFlowList(id, type));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,11 +7,13 @@ import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
|
||||
import org.springblade.modules.api.vo.MarketUserBenefitPointLogVO;
|
||||
import org.springblade.modules.api.vo.MarketUserCashCouponLogVO;
|
||||
import org.springblade.modules.api.vo.MarketUserCommissionLogVO;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
||||
import org.springblade.modules.market.pojo.dto.MarketBenefitPointApiDTO;
|
||||
import org.springblade.modules.market.pojo.dto.MarketCashCouponApiDTO;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketCashCouponLogEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUserCommissionLogEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketUserFlowVO;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
|
||||
import java.util.List;
|
||||
@@ -37,4 +39,20 @@ public interface MarketUserMarketInfoConvert {
|
||||
MarketUserCashCouponLogVO convertMarketCashCouponLogVO(MarketCashCouponLogEntity marketCashCouponLogEntity);
|
||||
|
||||
MarketUserCommissionLogVO convertMarketUserCommissionLogVO(MarketUserCommissionLogEntity marketUserCommissionLogEntity);
|
||||
|
||||
MarketUserFlowVO convertCommonUserPointLogEntityToFLowVO(CommonUserPointLogEntity commonUserPointLogEntity);
|
||||
|
||||
List<MarketUserFlowVO> convertCommonUserPointLogEntityListToFLowVOList(List<CommonUserPointLogEntity> commonUserPointLogEntityList);
|
||||
|
||||
MarketUserFlowVO convertMarketBenefitPointLogEntityToFLowVO(MarketBenefitPointLogEntity marketBenefitPointLogEntity);
|
||||
|
||||
List<MarketUserFlowVO> convertMarketBenefitPointLogEntityListToFLowVOList(List<MarketBenefitPointLogEntity> marketBenefitPointLogEntityList);
|
||||
|
||||
MarketUserFlowVO convertMarketUserCommissionLogEntityToFLowVO(MarketUserCommissionLogEntity marketUserCommissionLogEntity);
|
||||
|
||||
List<MarketUserFlowVO> convertMarketUserCommissionLogEntityListToFLowVOList(List<MarketUserCommissionLogEntity> marketUserCommissionLogEntityList);
|
||||
|
||||
MarketUserFlowVO convertMarketCashCouponLogEntityToFLowVO(MarketCashCouponLogEntity marketCashCouponLogEntity);
|
||||
|
||||
List<MarketUserFlowVO> convertMarketCashCouponLogEntityListToFLowVOList(List<MarketCashCouponLogEntity> marketCashCouponLogEntityList);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.springblade.modules.market.eums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum UserFlowType {
|
||||
|
||||
USER_POINT(1, "用户积分"),
|
||||
BENEFIT_POINT(2, "福利积分"),
|
||||
COMMISSION(3, "佣金"),
|
||||
CASH_COUPON(4, "现金券");
|
||||
|
||||
private final int code;
|
||||
|
||||
private final String desc;
|
||||
|
||||
UserFlowType(int code, String desc){
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static UserFlowType getByCode(int code) {
|
||||
for (UserFlowType type : values()) {
|
||||
if (type.getCode() == code) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.springblade.modules.market.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class MarketUserFlowVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
private BigDecimal lastAmount;
|
||||
|
||||
private Date statisticalDate;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@@ -2,8 +2,10 @@
|
||||
package org.springblade.modules.market.service;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
||||
import org.springblade.modules.market.pojo.dto.MarketBenefitPointApiDTO;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketBenefitPointVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
@@ -50,4 +52,7 @@ public interface IMarketBenefitPointService extends BaseService<MarketBenefitPoi
|
||||
|
||||
int addBenefitPointBatch(List<MarketBenefitPointEntity> teamBenefitPointList);
|
||||
|
||||
List<MarketBenefitPointLogEntity> queryLogsByUserId(Long userId, Integer size);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,13 @@ package org.springblade.modules.market.service;
|
||||
|
||||
import org.springblade.modules.market.pojo.dto.MarketCashCouponApiDTO;
|
||||
import org.springblade.modules.market.pojo.entity.MarketCashCouponEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketCashCouponLogEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketCashCouponVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户现金券表 服务类
|
||||
*
|
||||
@@ -40,4 +43,8 @@ public interface IMarketCashCouponService extends BaseService<MarketCashCouponEn
|
||||
*/
|
||||
Boolean deductCashCoupon(MarketCashCouponApiDTO dto);
|
||||
|
||||
|
||||
List<MarketCashCouponLogEntity> queryLogsByUserId(Long userId, Integer size);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketInfoVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.modules.market.pojo.vo.MarketUserFlowVO;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -67,4 +68,6 @@ public interface IMarketInfoService extends BaseService<MarketInfoEntity> {
|
||||
MarketDirectInfoApiVO selectParent(Long userId);
|
||||
|
||||
List<Long> selectIdsByPid(Long pid);
|
||||
|
||||
List<MarketUserFlowVO> userFlowList(Long id, Integer type);
|
||||
}
|
||||
|
||||
@@ -27,10 +27,13 @@ package org.springblade.modules.market.service;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUserCommissionEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUserCommissionLogEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketUserCommissionVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户佣金表 服务类
|
||||
*
|
||||
@@ -49,4 +52,6 @@ public interface IMarketUserCommissionService extends BaseService<MarketUserComm
|
||||
|
||||
|
||||
void earnedCommissionByUserOrder(CommonUserOrderEntity order, Long userId);
|
||||
|
||||
List<MarketUserCommissionLogEntity> queryLogsByUserId(Long userId, Integer size);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.exception.OptimisticLockException;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
||||
import org.springblade.modules.market.convert.MarketUserMarketInfoConvert;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
import org.springblade.modules.market.pojo.dto.MarketBenefitPointApiDTO;
|
||||
@@ -182,6 +183,16 @@ public class MarketBenefitPointServiceImpl extends BaseServiceImpl<MarketBenefit
|
||||
return this.baseMapper.addBenefitPointBatch(teamBenefitPointList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MarketBenefitPointLogEntity> queryLogsByUserId(Long userId, Integer size) {
|
||||
return benefitPointLogService.list(Wrappers.lambdaQuery(MarketBenefitPointLogEntity.class)
|
||||
.eq(MarketBenefitPointLogEntity::getUserId, userId)
|
||||
.eq(MarketBenefitPointLogEntity::getIsDeleted, 0)
|
||||
.orderByDesc(MarketBenefitPointLogEntity::getId)
|
||||
.last("limit " + size)
|
||||
);
|
||||
}
|
||||
|
||||
@Recover
|
||||
public boolean recover(OptimisticLockException ex, Long from, Long to, BigDecimal amount) {
|
||||
log.error("重试失败,from: [{}], to: [{}], amount: [{}] , ex: [{}]", from, to, amount ,ex.getMessage());
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.springblade.modules.market.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
@@ -32,6 +33,7 @@ import org.springblade.modules.market.convert.MarketUserMarketInfoConvert;
|
||||
import org.springblade.modules.market.pojo.dto.MarketCashCouponApiDTO;
|
||||
import org.springblade.modules.market.pojo.entity.MarketCashCouponEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketCashCouponLogEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUserCommissionLogEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketCashCouponVO;
|
||||
import org.springblade.modules.market.mapper.MarketCashCouponMapper;
|
||||
import org.springblade.modules.market.service.IMarketCashCouponLogService;
|
||||
@@ -43,6 +45,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户现金券表 服务实现类
|
||||
@@ -110,5 +113,15 @@ public class MarketCashCouponServiceImpl extends BaseServiceImpl<MarketCashCoupo
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MarketCashCouponLogEntity> queryLogsByUserId(Long userId, Integer size) {
|
||||
return cashCouponLogService.list(Wrappers.lambdaQuery(MarketCashCouponLogEntity.class)
|
||||
.eq(MarketCashCouponLogEntity::getUserId, userId)
|
||||
.eq(MarketCashCouponLogEntity::getIsDeleted, 0)
|
||||
.orderByDesc(MarketCashCouponLogEntity::getId)
|
||||
.last("limit " + size)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -43,13 +43,17 @@ import org.springblade.modules.api.response.remote.VerifyIDCardData;
|
||||
import org.springblade.modules.api.response.remote.RemoteResponse;
|
||||
import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
|
||||
import org.springblade.modules.auth.provider.UserType;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
||||
import org.springblade.modules.market.convert.MarketUserMarketInfoConvert;
|
||||
import org.springblade.modules.market.eums.IDCardVerifyStatus;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
|
||||
import org.springblade.modules.common.service.ICommonUserPointService;
|
||||
import org.springblade.modules.market.eums.UserFlowType;
|
||||
import org.springblade.modules.market.pojo.dto.MarketInfoSummaryDTO;
|
||||
import org.springblade.modules.market.pojo.entity.*;
|
||||
import org.springblade.modules.market.pojo.vo.MarketInfoVO;
|
||||
import org.springblade.modules.market.mapper.MarketInfoMapper;
|
||||
import org.springblade.modules.market.pojo.vo.MarketUserFlowVO;
|
||||
import org.springblade.modules.market.service.*;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
@@ -59,10 +63,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.springblade.common.cache.MarketInfoCache.REAL_NAME;
|
||||
@@ -217,4 +218,38 @@ public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, Mar
|
||||
public List<Long> selectIdsByPid(Long pid) {
|
||||
return baseMapper.selectIdsByPid(pid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MarketUserFlowVO> userFlowList(Long id, Integer type) {
|
||||
List<MarketUserFlowVO> voList = new ArrayList<>();
|
||||
switch (Objects.requireNonNull(UserFlowType.getByCode(type))) {
|
||||
case USER_POINT -> {
|
||||
List<CommonUserPointLogEntity> commonUserPointLogEntities = userPointService.queryLogsByUserId(id, 50);
|
||||
if (!commonUserPointLogEntities.isEmpty()) {
|
||||
voList = MarketUserMarketInfoConvert.INSTANCE.convertCommonUserPointLogEntityListToFLowVOList(commonUserPointLogEntities);
|
||||
}
|
||||
}
|
||||
case BENEFIT_POINT -> {
|
||||
List<MarketBenefitPointLogEntity> marketBenefitPointLogEntityList = benefitPointService.queryLogsByUserId(id, 50);
|
||||
if (!marketBenefitPointLogEntityList.isEmpty()) {
|
||||
voList = MarketUserMarketInfoConvert.INSTANCE.convertMarketBenefitPointLogEntityListToFLowVOList(marketBenefitPointLogEntityList);
|
||||
}
|
||||
}
|
||||
case COMMISSION -> {
|
||||
List<MarketUserCommissionLogEntity> marketUserCommissionLogEntityList = commissionService.queryLogsByUserId(id, 50);
|
||||
if (!marketUserCommissionLogEntityList.isEmpty()) {
|
||||
voList = MarketUserMarketInfoConvert.INSTANCE.convertMarketUserCommissionLogEntityListToFLowVOList(marketUserCommissionLogEntityList);
|
||||
}
|
||||
}
|
||||
case CASH_COUPON -> {
|
||||
List<MarketCashCouponLogEntity> marketCashCouponLogEntityList = cashCouponService.queryLogsByUserId(id, 50);
|
||||
if (!marketCashCouponLogEntityList.isEmpty()) {
|
||||
voList = MarketUserMarketInfoConvert.INSTANCE.convertMarketCashCouponLogEntityListToFLowVOList(marketCashCouponLogEntityList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -26,13 +26,16 @@
|
||||
package org.springblade.modules.market.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.jsonwebtoken.lang.Assert;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.modules.common.eums.UserCommissionFlowType;
|
||||
import org.springblade.modules.common.event.EarnedCommissionEvent;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUserCommissionEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUserCommissionLogEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketUserCommissionVO;
|
||||
import org.springblade.modules.market.mapper.MarketUserCommissionMapper;
|
||||
import org.springblade.modules.market.service.IMarketUserCommissionLogService;
|
||||
@@ -44,6 +47,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import static org.springblade.modules.common.eums.BusinessModule.SELF_OPERATED_MALL;
|
||||
|
||||
@@ -87,6 +91,16 @@ public class MarketUserCommissionServiceImpl extends BaseServiceImpl<MarketUserC
|
||||
throw new ServiceException("直推人奖励佣金失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MarketUserCommissionLogEntity> queryLogsByUserId(Long userId, Integer size) {
|
||||
return commissionLogService.list(Wrappers.lambdaQuery(MarketUserCommissionLogEntity.class)
|
||||
.eq(MarketUserCommissionLogEntity::getUserId, userId)
|
||||
.eq(MarketUserCommissionLogEntity::getIsDeleted, 0)
|
||||
.orderByDesc(MarketUserCommissionLogEntity::getId)
|
||||
.last("limit " + size)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user