会员支付
This commit is contained in:
parent
caaca7b318
commit
bdbcae287c
@ -12,8 +12,7 @@ public interface PaidMemberOrderConvert {
|
||||
|
||||
PaidMemberOrderConvert INSTANCE = Mappers.getMapper(PaidMemberOrderConvert.class);
|
||||
|
||||
PaidMemberOrderDO convert(Long uid, String cardName, Integer type,
|
||||
String payChannel, BigDecimal price, LocalDateTime payTime,
|
||||
PaidMemberOrderDO convert(Long uid, String cardName, Integer type, BigDecimal price, LocalDateTime payTime,
|
||||
String deadlineDay,LocalDateTime cardExpirationTime,BigDecimal originalPrice);
|
||||
|
||||
}
|
||||
|
@ -62,13 +62,6 @@ public interface PaidMemberCardTypeService {
|
||||
*/
|
||||
List<PaidMemberCardTypeDO> getCardTypeList (Integer activate);
|
||||
|
||||
/**
|
||||
* 根据发起的订单type确定试用、有效期、永久的会员卡
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
PaidMemberCardTypeDO selectMemberCardType(Integer type, BigDecimal price);
|
||||
|
||||
|
||||
/**
|
||||
* 根据会员卡名查询
|
||||
|
@ -92,25 +92,6 @@ public class PaidMemberCardTypeServiceImpl implements PaidMemberCardTypeService
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaidMemberCardTypeDO selectMemberCardType(Integer type, BigDecimal price) {
|
||||
PaidMemberCardTypeDO paidMemberCardTypeDO = new PaidMemberCardTypeDO();
|
||||
PaidMemberUserDO paidMemberUserDO = paidMemberUserService01.getMemberUser(getLoginUserId());
|
||||
if(type == 0){
|
||||
paidMemberCardTypeDO =cardMapper.selectOne(new LambdaQueryWrapperX<PaidMemberCardTypeDO>()
|
||||
.eqIfPresent(PaidMemberCardTypeDO::getName,"试用"));
|
||||
} else if (type == 1 && paidMemberUserDO == null) {
|
||||
paidMemberCardTypeDO =cardMapper.selectOne(new LambdaQueryWrapperX<PaidMemberCardTypeDO>()
|
||||
.eqIfPresent(PaidMemberCardTypeDO::getOriginalPrice,price));
|
||||
} else if (type == 1 && paidMemberUserDO != null) {
|
||||
paidMemberCardTypeDO =cardMapper.selectOne(new LambdaQueryWrapperX<PaidMemberCardTypeDO>()
|
||||
.eqIfPresent(PaidMemberCardTypeDO::getSpecialPrice,price));
|
||||
} else if (type == 2) {
|
||||
paidMemberCardTypeDO =cardMapper.selectOne(new LambdaQueryWrapperX<PaidMemberCardTypeDO>()
|
||||
.eqIfPresent(PaidMemberCardTypeDO::getName,"永久"));
|
||||
}
|
||||
return paidMemberCardTypeDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaidMemberCardTypeDO selectByName(String cardName) {
|
||||
|
@ -61,7 +61,7 @@ public interface PaidMemberOrderService {
|
||||
* @return 编号
|
||||
*/
|
||||
BigDecimal createMemberRecord(Long userId, Integer userType, String userIp,
|
||||
BigDecimal price, Integer type);
|
||||
Integer type,String cardName);
|
||||
|
||||
/**
|
||||
* 创建付费会员订单
|
||||
|
@ -87,14 +87,14 @@ public class PaidMemberOrderServiceImpl implements PaidMemberOrderService {
|
||||
|
||||
@Override
|
||||
public BigDecimal createMemberRecord(Long userId, Integer userType, String userIp,
|
||||
BigDecimal price, Integer type) {
|
||||
Integer type, String cardName) {
|
||||
//定义一个支付金额
|
||||
BigDecimal payPrice = null;
|
||||
BigDecimal gitBalance = BigDecimal.valueOf(0);//赠送余额,权益规则还未定
|
||||
|
||||
if(Objects.nonNull(type)){
|
||||
PaidMemberUserDO paidMemberUserDO = paidMemberUserService.getMemberUser(getLoginUserId());
|
||||
PaidMemberCardTypeDO paidMemberCardTypeDO =typeService.selectMemberCardType(type,price);
|
||||
PaidMemberCardTypeDO paidMemberCardTypeDO =typeService.selectByName(cardName);
|
||||
if(paidMemberCardTypeDO.getName().equals("试用")){
|
||||
payPrice = paidMemberCardTypeDO.getOriginalPrice();
|
||||
}else if (paidMemberUserDO != null){
|
||||
|
@ -68,7 +68,6 @@ public class AppPaidMembeOrderController {
|
||||
private PaidMemberCardTypeService cardService;
|
||||
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建会员支付记录(发起支付)")
|
||||
public CommonResult<AppPaidMemberOrderRespVO> createcard(@Valid @RequestBody AppPaidMemberOrderReqVO reqVO) {
|
||||
@ -99,14 +98,14 @@ public class AppPaidMembeOrderController {
|
||||
|
||||
//获得支付金额
|
||||
BigDecimal payPrice = paidMemberOrderService1.createMemberRecord(getLoginUserId(),
|
||||
getLoginUserType(),getClientIP(),reqVO.getPrice(),reqVO.getType());
|
||||
getLoginUserType(),getClientIP(),reqVO.getType(),reqVO.getCardName());
|
||||
BigDecimal p = payPrice.multiply(new BigDecimal("100"));
|
||||
Integer payPriceInt = p.intValue();
|
||||
BigDecimal originalPrice = cardService.selectByName(reqVO.getCardName()).getOriginalPrice();
|
||||
// PayWalletDO walletDO = memberWalletService.getOrCreateWallet(getLoginUserId(),getLoginUserType());
|
||||
//订单对象赋值
|
||||
PaidMemberOrderDO paidMemberOrderDO = PaidMemberOrderConvert.INSTANCE.convert(getLoginUserId(),
|
||||
reqVO.getCardName(),reqVO.getType(),reqVO.getPayChannel(),reqVO.getPrice(),payTime,deadlineDay,cardExpirationTime,originalPrice);
|
||||
reqVO.getCardName(),reqVO.getType(),reqVO.getPrice(),payTime,deadlineDay,cardExpirationTime,originalPrice);
|
||||
paidMemberOrderService1.createOrder(paidMemberOrderDO);
|
||||
Long payOrderId = payOrderService01.createOrder(new PayOrderCreateReqDTO()
|
||||
.setAppId(1L).setUserIp(getClientIP())
|
||||
|
Loading…
Reference in New Issue
Block a user