diff --git a/src/main/java/com/greenorange/promotion/controller/projectSettlement/ProjectSettlementController.java b/src/main/java/com/greenorange/promotion/controller/projectSettlement/ProjectSettlementController.java index 8989a5f..9277af1 100644 --- a/src/main/java/com/greenorange/promotion/controller/projectSettlement/ProjectSettlementController.java +++ b/src/main/java/com/greenorange/promotion/controller/projectSettlement/ProjectSettlementController.java @@ -75,6 +75,7 @@ public class ProjectSettlementController { + /** * 小程序端用户根据推广码申请记录id查询结算记录 * @param commonRequest 项目结算记录添加请求体 diff --git a/src/main/java/com/greenorange/promotion/controller/projectSettlement/WithdrawalApplyController.java b/src/main/java/com/greenorange/promotion/controller/projectSettlement/WithdrawalApplyController.java index 0c774bc..7c83db1 100644 --- a/src/main/java/com/greenorange/promotion/controller/projectSettlement/WithdrawalApplyController.java +++ b/src/main/java/com/greenorange/promotion/controller/projectSettlement/WithdrawalApplyController.java @@ -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 queryWithdrawalCondition(HttpServletRequest request) { + Long userId = (Long) request.getAttribute("userId"); + LambdaQueryWrapper userMainInfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); + userMainInfoLambdaQueryWrapper.eq(UserMainInfo::getUserId, userId); + UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper); + LambdaQueryWrapper 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 addWithdrawalApply(@Valid @RequestBody WithdrawalApplyAddRequest withdrawalApplyAddRequest, HttpServletRequest request) { Long userId = (Long) request.getAttribute("userId"); + LambdaQueryWrapper 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); @@ -104,7 +145,7 @@ public class WithdrawalApplyController { // @SysLog(title = "提现申请记录管理", content = "小程序端用户查询资金变动记录") public BaseResponse queryFundsChangeByUserId(HttpServletRequest request) { Long userId = (Long) request.getAttribute("userId"); - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(UserMainInfo::getUserId, userId); UserMainInfo userMainInfo = userMainInfoService.getOne(lambdaQueryWrapper); FundsItemVO fundsItemVO = commonService.copyProperties(userMainInfo, FundsItemVO.class); diff --git a/src/main/java/com/greenorange/promotion/model/entity/WithdrawalApply.java b/src/main/java/com/greenorange/promotion/model/entity/WithdrawalApply.java index 9d1766a..b448511 100644 --- a/src/main/java/com/greenorange/promotion/model/entity/WithdrawalApply.java +++ b/src/main/java/com/greenorange/promotion/model/entity/WithdrawalApply.java @@ -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; + /** * 是否删除 */ diff --git a/src/main/java/com/greenorange/promotion/model/vo/userAccount/UserAccountConditionVO.java b/src/main/java/com/greenorange/promotion/model/vo/userAccount/UserAccountConditionVO.java new file mode 100644 index 0000000..19c3b2c --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/vo/userAccount/UserAccountConditionVO.java @@ -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; + +} diff --git a/src/main/java/com/greenorange/promotion/model/vo/withdrawalApply/WithdrawalApplyVO.java b/src/main/java/com/greenorange/promotion/model/vo/withdrawalApply/WithdrawalApplyVO.java index d45e56b..c0ec8f0 100644 --- a/src/main/java/com/greenorange/promotion/model/vo/withdrawalApply/WithdrawalApplyVO.java +++ b/src/main/java/com/greenorange/promotion/model/vo/withdrawalApply/WithdrawalApplyVO.java @@ -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; + /** * 提现金额 */