refactor(pay): 提现
parent
a17b4667db
commit
583d90f42d
|
@ -1,15 +1,14 @@
|
|||
package com.mcwl.web.controller.myInvitation;
|
||||
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.myInvitation.domain.Invitation;
|
||||
import com.mcwl.myInvitation.domain.dto.EarningsDisplayDto;
|
||||
import com.mcwl.myInvitation.service.InvitationService;
|
||||
import com.mcwl.myInvitation.domain.vo.EarningsDisplayVO;
|
||||
import com.mcwl.system.domain.dto.WithdrawalPageRes;
|
||||
import com.mcwl.system.service.ISysUserPayAccountLogService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -121,9 +120,9 @@ public class InvitationController {
|
|||
*/
|
||||
@PostMapping("withdrawalRecord")
|
||||
@ApiOperation(value = "提现记录")
|
||||
public TableDataInfo withdrawalRecord(@Valid @RequestBody PageDomain pageDomain) {
|
||||
public TableDataInfo withdrawalRecord(@Valid @RequestBody WithdrawalPageRes withdrawalPageRes) {
|
||||
|
||||
return sysUserPayAccountLogService.getWithdrawalRecord(pageDomain);
|
||||
return sysUserPayAccountLogService.getWithdrawalRecord(withdrawalPageRes);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,9 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
|
@ -171,8 +173,9 @@ public class AliPayController extends BaseController {
|
|||
@ApiOperation(value = "提现")
|
||||
public R<String> fetch(@Valid
|
||||
@NotNull(message = "提现金额不能为空")
|
||||
Double amount) throws Exception {
|
||||
if (amount < 0.1) {
|
||||
@Pattern(regexp = "^(0|(?!0\\d)[1-9]\\d*)(\\.\\d{2})?$", message = "金额格式错误(必须保留两位小数)")
|
||||
String amount) throws Exception {
|
||||
if (Double.parseDouble(amount) < 0.1) {
|
||||
return R.fail("提现金额最小为0.1");
|
||||
}
|
||||
|
||||
|
|
|
@ -99,14 +99,6 @@ spring:
|
|||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
time-between-eviction-runs: 6000
|
||||
#ai配置
|
||||
ai:
|
||||
dashscope:
|
||||
base-url: https://api.deepseek.com/chat/completions
|
||||
api-key: sk-5d1f611b6ba74b90ae9e3dff5aaa508a
|
||||
chat:
|
||||
options:
|
||||
model: deepseek-chat
|
||||
|
||||
|
||||
# token配置
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.mcwl.system.domain.dto;
|
||||
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 提现明细分页请求对象
|
||||
*/
|
||||
@ApiModel(description = "提现明细分页请求对象")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WithdrawalPageRes extends PageDomain {
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@ import com.mcwl.common.core.page.PageDomain;
|
|||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.system.domain.SysUserPayAccount;
|
||||
import com.mcwl.system.domain.SysUserPayAccountLog;
|
||||
import com.mcwl.system.domain.dto.WithdrawalPageRes;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
|
@ -18,8 +19,8 @@ public interface ISysUserPayAccountLogService extends IService<SysUserPayAccount
|
|||
|
||||
/**
|
||||
* 当前用户的提现记录
|
||||
* @param pageDomain 分页参数
|
||||
* @param withdrawalPageRes 分页参数
|
||||
* @return TableDataInfo
|
||||
*/
|
||||
TableDataInfo getWithdrawalRecord(PageDomain pageDomain);
|
||||
TableDataInfo getWithdrawalRecord(WithdrawalPageRes withdrawalPageRes);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.mcwl.common.core.page.TableDataInfo;
|
|||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.system.domain.SysUserPayAccount;
|
||||
import com.mcwl.system.domain.SysUserPayAccountLog;
|
||||
import com.mcwl.system.domain.dto.WithdrawalPageRes;
|
||||
import com.mcwl.system.mapper.SysUserPayAccountLogMapper;
|
||||
import com.mcwl.system.mapper.SysUserPayAccountMapper;
|
||||
import com.mcwl.system.service.ISysUserPayAccountLogService;
|
||||
|
@ -17,6 +18,8 @@ import com.mcwl.system.service.ISysUserPayAccountService;
|
|||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 用户提现
|
||||
*/
|
||||
|
@ -25,16 +28,20 @@ public class SysUserPayAccountLogServiceImpl extends ServiceImpl<SysUserPayAccou
|
|||
|
||||
/**
|
||||
* 当前用户的提现记录
|
||||
* @param pageDomain 分页参数
|
||||
* @param withdrawalPageRes 分页参数
|
||||
* @return TableDataInfo
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo getWithdrawalRecord(PageDomain pageDomain) {
|
||||
Page<SysUserPayAccountLog> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
public TableDataInfo getWithdrawalRecord(WithdrawalPageRes withdrawalPageRes) {
|
||||
|
||||
Long userId = withdrawalPageRes.getUserId();
|
||||
userId = Objects.isNull(userId) ? SecurityUtils.getUserId() : userId;
|
||||
|
||||
Page<SysUserPayAccountLog> page = new Page<>(withdrawalPageRes.getPageNum(), withdrawalPageRes.getPageSize());
|
||||
|
||||
baseMapper.selectPage(page, new LambdaQueryWrapper<SysUserPayAccountLog>()
|
||||
.select(SysUserPayAccountLog::getAmount, SysUserPayAccountLog::getAccount, SysUserPayAccountLog::getCreateTime)
|
||||
.eq(SysUserPayAccountLog::getUserId, SecurityUtils.getUserId()));
|
||||
.eq(SysUserPayAccountLog::getUserId, userId));
|
||||
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(HttpStatus.SUCCESS);
|
||||
|
|
Loading…
Reference in New Issue