mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-29 18:51:53 +08:00
会员详情,查询钱包信息
This commit is contained in:
parent
6b7f071988
commit
be6399238b
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.wallet;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.PayWalletRespVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.PayWalletUserReqVO;
|
||||
import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
||||
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 用户钱包")
|
||||
@RestController
|
||||
@RequestMapping("/pay/wallet")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class PayWalletController {
|
||||
|
||||
@Resource
|
||||
private PayWalletService payWalletService;
|
||||
|
||||
@GetMapping("/user-wallet")
|
||||
@PreAuthorize("@ss.hasPermission('pay:wallet:query')")
|
||||
@Operation(summary = "获得用户钱包明细")
|
||||
public CommonResult<PayWalletRespVO> getByUser(PayWalletUserReqVO reqVO) {
|
||||
PayWalletDO wallet = payWalletService.getWalletByUserIdAndType(reqVO.getUserId(), reqVO.getUserType());
|
||||
return success(PayWalletConvert.INSTANCE.convert02(wallet));
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 用户钱包 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class PayWalletBaseVO {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20020")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "用户类型不能为空")
|
||||
private Byte userType;
|
||||
|
||||
@Schema(description = "余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "余额,单位分不能为空")
|
||||
private Integer balance;
|
||||
|
||||
@Schema(description = "累计支出,单位分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "累计支出,单位分不能为空")
|
||||
private Integer totalExpense;
|
||||
|
||||
@Schema(description = "累计充值,单位分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "累计充值,单位分不能为空")
|
||||
private Integer totalRecharge;
|
||||
|
||||
@Schema(description = "冻结金额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "20737")
|
||||
@NotNull(message = "冻结金额,单位分不能为空")
|
||||
private Integer freezePrice;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 用户钱包 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayWalletRespVO extends PayWalletBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29528")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 用户钱包明细 Request VO")
|
||||
@Data
|
||||
public class PayWalletUserReqVO {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "用户类型不能为空")
|
||||
@InEnum(value = UserTypeEnum.class, message = "用户类型必须是 {value}")
|
||||
private Integer userType;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.pay.convert.wallet;
|
||||
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.PayWalletRespVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
||||
import org.mapstruct.Mapper;
|
||||
@ -11,4 +12,6 @@ public interface PayWalletConvert {
|
||||
PayWalletConvert INSTANCE = Mappers.getMapper(PayWalletConvert.class);
|
||||
|
||||
AppPayWalletRespVO convert(PayWalletDO bean);
|
||||
|
||||
PayWalletRespVO convert02(PayWalletDO wallet);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public interface PayWalletService {
|
||||
|
||||
/**
|
||||
* 获取钱包信息
|
||||
*
|
||||
* <p>
|
||||
* 如果不存在,则创建钱包。由于用户注册时候不会创建钱包
|
||||
*
|
||||
* @param userId 用户编号
|
||||
@ -81,8 +81,18 @@ public interface PayWalletService {
|
||||
|
||||
/**
|
||||
* 解冻钱包余额
|
||||
*
|
||||
* @param id 钱包编号
|
||||
* @param price 解冻金额
|
||||
*/
|
||||
void unFreezePrice(Long id, Integer price);
|
||||
|
||||
/**
|
||||
* 获得用户的钱包明细
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param userType 用户类型
|
||||
* @return 用户的钱包明细
|
||||
*/
|
||||
PayWalletDO getWalletByUserIdAndType(Long userId, Integer userType);
|
||||
}
|
||||
|
@ -195,4 +195,9 @@ public class PayWalletServiceImpl implements PayWalletService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayWalletDO getWalletByUserIdAndType(Long userId, Integer userType) {
|
||||
return walletMapper.selectByUserIdAndType(userId, userType);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user