完成了小程序端查询资金明细接口

This commit is contained in:
chen-xin-zhi 2025-06-03 11:33:38 +08:00
parent ea3e6e8853
commit c5867e7017
3 changed files with 62 additions and 2 deletions

View File

@ -10,12 +10,15 @@ import com.greenorange.promotion.constant.UserConstant;
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyAddRequest;
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyQueryRequest;
import com.greenorange.promotion.model.entity.FundsChange;
import com.greenorange.promotion.model.entity.UserMainInfo;
import com.greenorange.promotion.model.entity.WithdrawalApply;
import com.greenorange.promotion.model.vo.fundsChange.FundsChangeVO;
import com.greenorange.promotion.model.vo.fundsChange.FundsItemVO;
import com.greenorange.promotion.model.vo.withdrawalApply.WithdrawalApplyVO;
import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.settle.FundsChangeService;
import com.greenorange.promotion.service.settle.WithdrawalApplyService;
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
@ -50,6 +53,9 @@ public class WithdrawalApplyController {
@Resource
private CommonService commonService;
@Resource
private UserMainInfoService userMainInfoService;
/**
* 小程序端用户申请提现
@ -96,11 +102,16 @@ public class WithdrawalApplyController {
@Operation(summary = "小程序端用户查询资金变动记录", description = "参数权限管理员方法名queryFundsChangeByUserId")
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
// @SysLog(title = "提现申请记录管理", content = "小程序端用户查询资金变动记录")
public BaseResponse<List<FundsChangeVO>> queryFundsChangeByUserId(HttpServletRequest request) {
public BaseResponse<FundsItemVO> queryFundsChangeByUserId(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
LambdaQueryWrapper<UserMainInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(UserMainInfo::getUserId, userId);
UserMainInfo userMainInfo = userMainInfoService.getOne(lambdaQueryWrapper);
FundsItemVO fundsItemVO = commonService.copyProperties(userMainInfo, FundsItemVO.class);
List<FundsChange> fundsChangeList = commonService.findByFieldEqTargetField(FundsChange::getUserId, userId, fundsChangeService);
List<FundsChangeVO> fundsChangeVOS = commonService.convertList(fundsChangeList, FundsChangeVO.class);
return ResultUtils.success(fundsChangeVOS);
fundsItemVO.setFundsChangeVOList(fundsChangeVOS);
return ResultUtils.success(fundsItemVO);
}

View File

@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 资金变动记录 视图对象
@ -38,6 +39,12 @@ public class FundsChangeVO implements Serializable {
@Schema(description = "当前金额(变动后的总金额)", example = "0.34")
private BigDecimal currentAmount;
/**
* 创建时间
*/
@Schema(description = "创建时间", example = "2023-02-01 09:09:09")
private Date createTime;
@Serial
private static final long serialVersionUID = 1L;

View File

@ -0,0 +1,42 @@
package com.greenorange.promotion.model.vo.fundsChange;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 资金明细 视图对象
*/
@Data
@Schema(description = "资金明细 视图对象")
public class FundsItemVO implements Serializable {
/**
* 当前余额
*/
@Schema(description = "当前余额", example = "10.00")
private BigDecimal currentBalance;
/**
* 提现中的金额
*/
@Schema(description = "提现中的金额", example = "15.00")
private BigDecimal withdrawalAmount;
/**
* 已提现的金额
*/
@Schema(description = "已提现的金额", example = "20.00")
private BigDecimal withdrawnAmount;
/**
* 资金明细变动记录列表
*/
@Schema(description = "资金明细变动记录列表")
private List<FundsChangeVO> fundsChangeVOList;
}