Compare commits

...

2 Commits

Author SHA1 Message Date
0beaed16ba Merge pull request '会员支付' (#58) from khy1 into master
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #58
2024-10-21 16:03:45 +08:00
khy
bdbcae287c 会员支付 2024-10-21 16:01:06 +08:00
6 changed files with 6 additions and 34 deletions

View File

@ -12,8 +12,7 @@ public interface PaidMemberOrderConvert {
PaidMemberOrderConvert INSTANCE = Mappers.getMapper(PaidMemberOrderConvert.class); PaidMemberOrderConvert INSTANCE = Mappers.getMapper(PaidMemberOrderConvert.class);
PaidMemberOrderDO convert(Long uid, String cardName, Integer type, PaidMemberOrderDO convert(Long uid, String cardName, Integer type, BigDecimal price, LocalDateTime payTime,
String payChannel, BigDecimal price, LocalDateTime payTime,
String deadlineDay,LocalDateTime cardExpirationTime,BigDecimal originalPrice); String deadlineDay,LocalDateTime cardExpirationTime,BigDecimal originalPrice);
} }

View File

@ -62,13 +62,6 @@ public interface PaidMemberCardTypeService {
*/ */
List<PaidMemberCardTypeDO> getCardTypeList (Integer activate); List<PaidMemberCardTypeDO> getCardTypeList (Integer activate);
/**
* 根据发起的订单type确定试用有效期永久的会员卡
* @param type
* @return
*/
PaidMemberCardTypeDO selectMemberCardType(Integer type, BigDecimal price);
/** /**
* 根据会员卡名查询 * 根据会员卡名查询

View File

@ -92,25 +92,6 @@ public class PaidMemberCardTypeServiceImpl implements PaidMemberCardTypeService
return list; 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 @Override
public PaidMemberCardTypeDO selectByName(String cardName) { public PaidMemberCardTypeDO selectByName(String cardName) {

View File

@ -61,7 +61,7 @@ public interface PaidMemberOrderService {
* @return 编号 * @return 编号
*/ */
BigDecimal createMemberRecord(Long userId, Integer userType, String userIp, BigDecimal createMemberRecord(Long userId, Integer userType, String userIp,
BigDecimal price, Integer type); Integer type,String cardName);
/** /**
* 创建付费会员订单 * 创建付费会员订单

View File

@ -87,14 +87,14 @@ public class PaidMemberOrderServiceImpl implements PaidMemberOrderService {
@Override @Override
public BigDecimal createMemberRecord(Long userId, Integer userType, String userIp, public BigDecimal createMemberRecord(Long userId, Integer userType, String userIp,
BigDecimal price, Integer type) { Integer type, String cardName) {
//定义一个支付金额 //定义一个支付金额
BigDecimal payPrice = null; BigDecimal payPrice = null;
BigDecimal gitBalance = BigDecimal.valueOf(0);//赠送余额权益规则还未定 BigDecimal gitBalance = BigDecimal.valueOf(0);//赠送余额权益规则还未定
if(Objects.nonNull(type)){ if(Objects.nonNull(type)){
PaidMemberUserDO paidMemberUserDO = paidMemberUserService.getMemberUser(getLoginUserId()); PaidMemberUserDO paidMemberUserDO = paidMemberUserService.getMemberUser(getLoginUserId());
PaidMemberCardTypeDO paidMemberCardTypeDO =typeService.selectMemberCardType(type,price); PaidMemberCardTypeDO paidMemberCardTypeDO =typeService.selectByName(cardName);
if(paidMemberCardTypeDO.getName().equals("试用")){ if(paidMemberCardTypeDO.getName().equals("试用")){
payPrice = paidMemberCardTypeDO.getOriginalPrice(); payPrice = paidMemberCardTypeDO.getOriginalPrice();
}else if (paidMemberUserDO != null){ }else if (paidMemberUserDO != null){

View File

@ -68,7 +68,6 @@ public class AppPaidMembeOrderController {
private PaidMemberCardTypeService cardService; private PaidMemberCardTypeService cardService;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建会员支付记录(发起支付)") @Operation(summary = "创建会员支付记录(发起支付)")
public CommonResult<AppPaidMemberOrderRespVO> createcard(@Valid @RequestBody AppPaidMemberOrderReqVO reqVO) { public CommonResult<AppPaidMemberOrderRespVO> createcard(@Valid @RequestBody AppPaidMemberOrderReqVO reqVO) {
@ -99,14 +98,14 @@ public class AppPaidMembeOrderController {
//获得支付金额 //获得支付金额
BigDecimal payPrice = paidMemberOrderService1.createMemberRecord(getLoginUserId(), BigDecimal payPrice = paidMemberOrderService1.createMemberRecord(getLoginUserId(),
getLoginUserType(),getClientIP(),reqVO.getPrice(),reqVO.getType()); getLoginUserType(),getClientIP(),reqVO.getType(),reqVO.getCardName());
BigDecimal p = payPrice.multiply(new BigDecimal("100")); BigDecimal p = payPrice.multiply(new BigDecimal("100"));
Integer payPriceInt = p.intValue(); Integer payPriceInt = p.intValue();
BigDecimal originalPrice = cardService.selectByName(reqVO.getCardName()).getOriginalPrice(); BigDecimal originalPrice = cardService.selectByName(reqVO.getCardName()).getOriginalPrice();
// PayWalletDO walletDO = memberWalletService.getOrCreateWallet(getLoginUserId(),getLoginUserType()); // PayWalletDO walletDO = memberWalletService.getOrCreateWallet(getLoginUserId(),getLoginUserType());
//订单对象赋值 //订单对象赋值
PaidMemberOrderDO paidMemberOrderDO = PaidMemberOrderConvert.INSTANCE.convert(getLoginUserId(), 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); paidMemberOrderService1.createOrder(paidMemberOrderDO);
Long payOrderId = payOrderService01.createOrder(new PayOrderCreateReqDTO() Long payOrderId = payOrderService01.createOrder(new PayOrderCreateReqDTO()
.setAppId(1L).setUserIp(getClientIP()) .setAppId(1L).setUserIp(getClientIP())