修复了接口(小程序端用户提现申请)

This commit is contained in:
2025-06-11 09:18:11 +08:00
parent 21dbba9ffc
commit 8ad84afcfe
5 changed files with 137 additions and 4 deletions

View File

@ -75,6 +75,7 @@ public class ProjectSettlementController {
/**
* 小程序端用户根据推广码申请记录id查询结算记录
* @param commonRequest 项目结算记录添加请求体

View File

@ -5,19 +5,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.greenorange.promotion.annotation.RequiresPermission;
import com.greenorange.promotion.annotation.SysLog;
import com.greenorange.promotion.common.BaseResponse;
import com.greenorange.promotion.common.ErrorCode;
import com.greenorange.promotion.common.ResultUtils;
import com.greenorange.promotion.constant.UserConstant;
import com.greenorange.promotion.exception.ThrowUtils;
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.entity.*;
import com.greenorange.promotion.model.vo.fundsChange.FundsChangeVO;
import com.greenorange.promotion.model.vo.fundsChange.FundsItemVO;
import com.greenorange.promotion.model.vo.userAccount.UserAccountConditionVO;
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.UserAccountService;
import com.greenorange.promotion.service.settle.WithdrawalApplyService;
import com.greenorange.promotion.service.userInfo.UserInfoService;
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -56,6 +59,36 @@ public class WithdrawalApplyController {
@Resource
private UserMainInfoService userMainInfoService;
@Resource
private UserInfoService userInfoService;
@Resource
private UserAccountService userAccountService;
/**
* 小程序端用户查询账户提现状况
* @return 提现申请记录id
*/
@PostMapping("query/condition")
@Operation(summary = "小程序端用户查询账户提现状况", description = "参数权限管理员方法名queryWithdrawalCondition")
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
public BaseResponse<UserAccountConditionVO> queryWithdrawalCondition(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
userMainInfoLambdaQueryWrapper.eq(UserMainInfo::getUserId, userId);
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
LambdaQueryWrapper<UserAccount> userAccountLambdaQueryWrapper = new LambdaQueryWrapper<>();
userAccountLambdaQueryWrapper.eq(UserAccount::getUserId, userId);
UserAccount userAccount = userAccountService.getOne(userAccountLambdaQueryWrapper);
String bankCardNumber = userAccount == null ? "" : userAccount.getBankCardNumber();
UserAccountConditionVO userAccountConditionVO = UserAccountConditionVO.builder()
.currentBalance(userMainInfo.getCurrentBalance())
.bankCardNumber(bankCardNumber)
.build();
return ResultUtils.success(userAccountConditionVO);
}
/**
* 小程序端用户申请提现
@ -68,9 +101,17 @@ public class WithdrawalApplyController {
// @SysLog(title = "提现申请记录管理", content = "小程序端用户申请提现")
public BaseResponse<Long> addWithdrawalApply(@Valid @RequestBody WithdrawalApplyAddRequest withdrawalApplyAddRequest, HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
LambdaQueryWrapper<UserAccount> userAccountLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserAccount::getUserId, userId, userAccountService);
UserAccount userAccount = userAccountService.getOne(userAccountLambdaQueryWrapper);
ThrowUtils.throwIf(userAccount == null, ErrorCode.OPERATION_ERROR, "请先绑定银行卡");
BigDecimal withdrawnAmount = withdrawalApplyAddRequest.getWithdrawnAmount();
WithdrawalApply withdrawalApply = WithdrawalApply.builder()
.withdrawnAmount(withdrawnAmount)
.cardHolder(userAccount.getCardHolder())
.idCardNumber(userAccount.getIdCardNumber())
.phoneNumber(userAccount.getPhoneNumber())
.bankCardNumber(userAccount.getBankCardNumber())
.openBank(userAccount.getOpenBank())
.userId(userId)
.build();
withdrawalApplyService.save(withdrawalApply);

View File

@ -44,6 +44,31 @@ public class WithdrawalApply implements Serializable {
*/
private Long userId;
/**
* 持卡人
*/
private String cardHolder;
/**
* 身份证号
*/
private String idCardNumber;
/**
* 手机号
*/
private String phoneNumber;
/**
* 银行卡号
*/
private String bankCardNumber;
/**
* 开户银行
*/
private String openBank;
/**
* 是否删除
*/

View File

@ -0,0 +1,36 @@
package com.greenorange.promotion.model.vo.userAccount;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Schema(description = "用户账户情况 视图对象")
public class UserAccountConditionVO implements Serializable {
/**
* 当前余额
*/
@Schema(description = "当前余额", example = "10.00")
private BigDecimal currentBalance;
/**
* 银行卡号
*/
@Schema(description = "银行卡号", example = "5105105105105100")
private String bankCardNumber;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -20,6 +20,36 @@ public class WithdrawalApplyVO implements Serializable {
@Schema(description = "提现申请记录ID", example = "1")
private Long id;
/**
* 持卡人
*/
@Schema(description = "持卡人", example = "chenxinzhi")
private String cardHolder;
/**
* 身份证号
*/
@Schema(description = "身份证号", example = "110101199001011234")
private String idCardNumber;
/**
* 手机号
*/
@Schema(description = "手机号", example = "15888610253")
private String phoneNumber;
/**
* 银行卡号
*/
@Schema(description = "银行卡号", example = "5105105105105100")
private String bankCardNumber;
/**
* 开户银行
*/
@Schema(description = "开户银行", example = "中国工商银行")
private String openBank;
/**
* 提现金额
*/