|
|
@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -75,11 +76,9 @@ public class WithdrawalApplyController {
|
|
|
|
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
|
|
|
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
|
|
|
public BaseResponse<UserAccountConditionVO> queryWithdrawalCondition(HttpServletRequest request) {
|
|
|
|
public BaseResponse<UserAccountConditionVO> queryWithdrawalCondition(HttpServletRequest request) {
|
|
|
|
Long userId = (Long) request.getAttribute("userId");
|
|
|
|
Long userId = (Long) request.getAttribute("userId");
|
|
|
|
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
|
|
|
|
userMainInfoLambdaQueryWrapper.eq(UserMainInfo::getUserId, userId);
|
|
|
|
|
|
|
|
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
|
|
|
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
|
|
|
LambdaQueryWrapper<UserAccount> userAccountLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
LambdaQueryWrapper<UserAccount> userAccountLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserAccount::getUserId, userId, userAccountService);
|
|
|
|
userAccountLambdaQueryWrapper.eq(UserAccount::getUserId, userId);
|
|
|
|
|
|
|
|
UserAccount userAccount = userAccountService.getOne(userAccountLambdaQueryWrapper);
|
|
|
|
UserAccount userAccount = userAccountService.getOne(userAccountLambdaQueryWrapper);
|
|
|
|
String bankCardNumber = userAccount == null ? "" : userAccount.getBankCardNumber();
|
|
|
|
String bankCardNumber = userAccount == null ? "" : userAccount.getBankCardNumber();
|
|
|
|
UserAccountConditionVO userAccountConditionVO = UserAccountConditionVO.builder()
|
|
|
|
UserAccountConditionVO userAccountConditionVO = UserAccountConditionVO.builder()
|
|
|
@ -115,6 +114,21 @@ public class WithdrawalApplyController {
|
|
|
|
.userId(userId)
|
|
|
|
.userId(userId)
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
withdrawalApplyService.save(withdrawalApply);
|
|
|
|
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());
|
|
|
|
return ResultUtils.success(withdrawalApply.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -131,6 +145,7 @@ public class WithdrawalApplyController {
|
|
|
|
Long userId = (Long) request.getAttribute("userId");
|
|
|
|
Long userId = (Long) request.getAttribute("userId");
|
|
|
|
List<WithdrawalApply> withdrawalApplyList = commonService.findByFieldEqTargetField(WithdrawalApply::getUserId, userId, withdrawalApplyService);
|
|
|
|
List<WithdrawalApply> withdrawalApplyList = commonService.findByFieldEqTargetField(WithdrawalApply::getUserId, userId, withdrawalApplyService);
|
|
|
|
List<WithdrawalApplyVO> withdrawalApplyVOS = commonService.convertList(withdrawalApplyList, WithdrawalApplyVO.class);
|
|
|
|
List<WithdrawalApplyVO> withdrawalApplyVOS = commonService.convertList(withdrawalApplyList, WithdrawalApplyVO.class);
|
|
|
|
|
|
|
|
Collections.reverse(withdrawalApplyVOS);
|
|
|
|
return ResultUtils.success(withdrawalApplyVOS);
|
|
|
|
return ResultUtils.success(withdrawalApplyVOS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -145,12 +160,12 @@ public class WithdrawalApplyController {
|
|
|
|
// @SysLog(title = "提现申请记录管理", content = "小程序端用户查询资金变动记录")
|
|
|
|
// @SysLog(title = "提现申请记录管理", content = "小程序端用户查询资金变动记录")
|
|
|
|
public BaseResponse<FundsItemVO> queryFundsChangeByUserId(HttpServletRequest request) {
|
|
|
|
public BaseResponse<FundsItemVO> queryFundsChangeByUserId(HttpServletRequest request) {
|
|
|
|
Long userId = (Long) request.getAttribute("userId");
|
|
|
|
Long userId = (Long) request.getAttribute("userId");
|
|
|
|
LambdaQueryWrapper<UserMainInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
|
|
|
|
lambdaQueryWrapper.eq(UserMainInfo::getUserId, userId);
|
|
|
|
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
|
|
|
UserMainInfo userMainInfo = userMainInfoService.getOne(lambdaQueryWrapper);
|
|
|
|
|
|
|
|
FundsItemVO fundsItemVO = commonService.copyProperties(userMainInfo, FundsItemVO.class);
|
|
|
|
FundsItemVO fundsItemVO = commonService.copyProperties(userMainInfo, FundsItemVO.class);
|
|
|
|
List<FundsChange> fundsChangeList = commonService.findByFieldEqTargetField(FundsChange::getUserId, userId, fundsChangeService);
|
|
|
|
List<FundsChange> fundsChangeList = commonService.findByFieldEqTargetField(FundsChange::getUserId, userId, fundsChangeService);
|
|
|
|
List<FundsChangeVO> fundsChangeVOS = commonService.convertList(fundsChangeList, FundsChangeVO.class);
|
|
|
|
List<FundsChangeVO> fundsChangeVOS = commonService.convertList(fundsChangeList, FundsChangeVO.class);
|
|
|
|
|
|
|
|
Collections.reverse(fundsChangeVOS);
|
|
|
|
fundsItemVO.setFundsChangeVOList(fundsChangeVOS);
|
|
|
|
fundsItemVO.setFundsChangeVOList(fundsChangeVOS);
|
|
|
|
return ResultUtils.success(fundsItemVO);
|
|
|
|
return ResultUtils.success(fundsItemVO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|