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

(小程序端用户查询资金变动记录)
This commit is contained in:
2025-06-11 10:46:09 +08:00
parent 8ad84afcfe
commit ddad249dea
4 changed files with 41 additions and 7 deletions

View File

@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
@ -75,11 +76,9 @@ public class WithdrawalApplyController {
@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);
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
LambdaQueryWrapper<UserAccount> userAccountLambdaQueryWrapper = new LambdaQueryWrapper<>();
userAccountLambdaQueryWrapper.eq(UserAccount::getUserId, userId);
LambdaQueryWrapper<UserAccount> userAccountLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserAccount::getUserId, userId, userAccountService);
UserAccount userAccount = userAccountService.getOne(userAccountLambdaQueryWrapper);
String bankCardNumber = userAccount == null ? "" : userAccount.getBankCardNumber();
UserAccountConditionVO userAccountConditionVO = UserAccountConditionVO.builder()
@ -115,6 +114,21 @@ public class WithdrawalApplyController {
.userId(userId)
.build();
withdrawalApplyService.save(withdrawalApply);
// 修改个人主要信息
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
userMainInfo.setWithdrawalAmount(userMainInfo.getWithdrawalAmount().add(withdrawnAmount));
userMainInfo.setCurrentBalance(userMainInfo.getCurrentBalance().subtract(withdrawnAmount));
userMainInfoService.updateById(userMainInfo);
// 添加资金明细记录
FundsChange fundsChange = FundsChange.builder()
.projectName("用户提现")
.changeAmount(withdrawnAmount.negate())
.currentAmount(userMainInfo.getCurrentBalance())
.userId(userId)
.projectSettlementId(0L)
.build();
fundsChangeService.save(fundsChange);
return ResultUtils.success(withdrawalApply.getId());
}
@ -131,6 +145,7 @@ public class WithdrawalApplyController {
Long userId = (Long) request.getAttribute("userId");
List<WithdrawalApply> withdrawalApplyList = commonService.findByFieldEqTargetField(WithdrawalApply::getUserId, userId, withdrawalApplyService);
List<WithdrawalApplyVO> withdrawalApplyVOS = commonService.convertList(withdrawalApplyList, WithdrawalApplyVO.class);
Collections.reverse(withdrawalApplyVOS);
return ResultUtils.success(withdrawalApplyVOS);
}
@ -145,12 +160,12 @@ public class WithdrawalApplyController {
// @SysLog(title = "提现申请记录管理", content = "小程序端用户查询资金变动记录")
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);
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
FundsItemVO fundsItemVO = commonService.copyProperties(userMainInfo, FundsItemVO.class);
List<FundsChange> fundsChangeList = commonService.findByFieldEqTargetField(FundsChange::getUserId, userId, fundsChangeService);
List<FundsChangeVO> fundsChangeVOS = commonService.convertList(fundsChangeList, FundsChangeVO.class);
Collections.reverse(fundsChangeVOS);
fundsItemVO.setFundsChangeVOList(fundsChangeVOS);
return ResultUtils.success(fundsItemVO);
}

View File

@ -29,6 +29,12 @@ public class FundsChangeAddRequest implements Serializable {
@Schema(description = "项目名称", example = "饿了么-超吃卡")
private String projectName;
/**
* 项目明细名称
*/
@Schema(description = "项目明细名称", example = "2.9元购买30元券包")
private String projectDetailName;
/**
* 变动金额
*/

View File

@ -8,6 +8,7 @@ import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -35,6 +36,11 @@ public class FundsChange implements Serializable {
*/
private String projectName;
/**
* 项目明细名称
*/
private String projectDetailName;
/**
* 变动金额
*/

View File

@ -1,6 +1,7 @@
package com.greenorange.promotion.model.vo.fundsChange;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.io.Serial;
@ -27,6 +28,12 @@ public class FundsChangeVO implements Serializable {
@Schema(description = "项目名称", example = "饿了么-超吃卡")
private String projectName;
/**
* 项目明细名称
*/
@Schema(description = "项目明细名称", example = "2.9元购买30元券包")
private String projectDetailName;
/**
* 变动金额
*/