Merge pull request '支付订单状态变更' (#66) from khy1 into master
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #66
This commit is contained in:
commit
dbf38c1aa4
@ -68,8 +68,9 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode CARD_NOT_EXISTS = new ErrorCode(1_004_020_000, "会员卡类型不存在");
|
ErrorCode CARD_NOT_EXISTS = new ErrorCode(1_004_020_000, "会员卡类型不存在");
|
||||||
ErrorCode MEMBER_USER_NOT_EXISTS = new ErrorCode(1_004_021_000, "会员不存在");
|
ErrorCode MEMBER_USER_NOT_EXISTS = new ErrorCode(1_004_021_000, "会员不存在");
|
||||||
ErrorCode PAID_MEMBER_ORDER_NOT_EXISTS = new ErrorCode(1_004_022_000, "付费会员订单不存在");
|
ErrorCode PAID_MEMBER_ORDER_NOT_EXISTS = new ErrorCode(1_004_022_000, "付费会员订单不存在");
|
||||||
|
|
||||||
ErrorCode PAID_MEMBER_USER_ORDER_NO_NOT_EXISTS = new ErrorCode(1_004_023_000, "生成会员订单号失败,请重新提交");
|
ErrorCode PAID_MEMBER_USER_ORDER_NO_NOT_EXISTS = new ErrorCode(1_004_023_000, "生成会员订单号失败,请重新提交");
|
||||||
|
ErrorCode PAID_MEMBER_USER_NOT_OPEN = new ErrorCode(1_004_021_000, "会员未开通");
|
||||||
|
ErrorCode PAID_MEMBER_USER_PASSED = new ErrorCode(1_004_021_000, "会员已过期");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -101,4 +101,6 @@ public class PaidMemberUserSaveReqVO {
|
|||||||
@Schema(description = "订单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "订单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
|
||||||
|
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private Long payOrderId;
|
||||||
}
|
}
|
@ -41,7 +41,7 @@ public class AppMemberCardTypeController {
|
|||||||
List<PaidMemberCardTypeDO> list = cardService.getCardTypeList(memberUserDO.getActivate());
|
List<PaidMemberCardTypeDO> list = cardService.getCardTypeList(memberUserDO.getActivate());
|
||||||
if(name != null){
|
if(name != null){
|
||||||
//根据用户查询是否有有效期会员的类型列表
|
//根据用户查询是否有有效期会员的类型列表
|
||||||
list = cardService.getCardTypeList2(memberUserDO.getActivate(),name);
|
list = cardService.getCardTypeValidList(memberUserDO.getActivate(),name);
|
||||||
}
|
}
|
||||||
return success(MemberCardTypeConvert.INSTANCE.convertList(list));
|
return success(MemberCardTypeConvert.INSTANCE.convertList(list));
|
||||||
}
|
}
|
||||||
|
@ -145,6 +145,12 @@ public class PaidMemberUserDO extends TenantBaseDO {
|
|||||||
* 订单号
|
* 订单号
|
||||||
*/
|
*/
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 支付订单编号
|
||||||
|
*
|
||||||
|
* 关联 {@link PayOrderDO#getId()}
|
||||||
|
*/
|
||||||
|
private Long payOrderId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -68,7 +68,7 @@ public interface PaidMemberCardTypeService {
|
|||||||
* @param activate
|
* @param activate
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PaidMemberCardTypeDO> getCardTypeList2 (Integer activate,String name);
|
List<PaidMemberCardTypeDO> getCardTypeValidList (Integer activate,String name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public class PaidMemberCardTypeServiceImpl implements PaidMemberCardTypeService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PaidMemberCardTypeDO> getCardTypeList2(Integer activate,String name) {
|
public List<PaidMemberCardTypeDO> getCardTypeValidList(Integer activate,String name) {
|
||||||
List<PaidMemberCardTypeDO> list = new ArrayList<>();
|
List<PaidMemberCardTypeDO> list = new ArrayList<>();
|
||||||
Integer status = 1;
|
Integer status = 1;
|
||||||
if (activate == 2){
|
if (activate == 2){
|
||||||
|
@ -50,12 +50,24 @@ public interface PaidMemberUserService {
|
|||||||
*/
|
*/
|
||||||
PaidMemberUserDO getMemberUser(Long id);
|
PaidMemberUserDO getMemberUser(Long id);
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 判断是否为会员
|
||||||
|
// */
|
||||||
|
// PaidMemberUserDO isValidPaidMember(Integer activate,LocalDateTime cardExpirationTime);
|
||||||
|
|
||||||
int getPriceByTtype(Integer activate, String cardName);
|
int getPriceByTtype(Integer activate, String cardName);
|
||||||
|
|
||||||
LocalDateTime getDeadLineDay(String cardName);
|
LocalDateTime getDeadLineDay(String cardName);
|
||||||
|
|
||||||
PaidMemberUserDO getPaidMemberUserByOrderNo(String orderNO);
|
PaidMemberUserDO getPaidMemberUserByOrderNo(String orderNO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新会员
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void update(@Valid PaidMemberUserDO updateReqVO);
|
||||||
|
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 获得会员分页
|
// * 获得会员分页
|
||||||
|
@ -23,6 +23,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|||||||
import cn.iocoder.yudao.module.member.dal.mysql.user.PaidMemberUserMapper;
|
import cn.iocoder.yudao.module.member.dal.mysql.user.PaidMemberUserMapper;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,12 +42,11 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
|||||||
private PaidMemberCardTypeService memberCardTypeService;
|
private PaidMemberCardTypeService memberCardTypeService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createMemberUser(PaidMemberUserSaveReqVO createReqVO) {
|
public Long createMemberUser(PaidMemberUserSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
PaidMemberUserDO memberUser = BeanUtils.toBean(createReqVO, PaidMemberUserDO.class);
|
PaidMemberUserDO memberUser = BeanUtils.toBean(createReqVO, PaidMemberUserDO.class);
|
||||||
String prefix = String.valueOf('m');
|
|
||||||
memberUser.setOrderNo(generate(prefix));
|
|
||||||
if(getPaidMemberUserByOrderNo(memberUser.getOrderNo()) != null){
|
if(getPaidMemberUserByOrderNo(memberUser.getOrderNo()) != null){
|
||||||
throw exception(PAID_MEMBER_USER_ORDER_NO_NOT_EXISTS);
|
throw exception(PAID_MEMBER_USER_ORDER_NO_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
@ -55,10 +55,10 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
|||||||
return memberUser.getId();
|
return memberUser.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String generate(String prefix){
|
// public String generate(String prefix){
|
||||||
String no = prefix + DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_PATTERN);
|
// String no = prefix + DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_PATTERN);
|
||||||
return no;
|
// return no;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateMemberUser(PaidMemberUserSaveReqVO updateReqVO) {
|
public void updateMemberUser(PaidMemberUserSaveReqVO updateReqVO) {
|
||||||
@ -89,6 +89,20 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
|||||||
return paidMemberUserMapper.selectById(id);
|
return paidMemberUserMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public PaidMemberUserDO isValidPaidMember(Integer activate, LocalDateTime cardExpirationTime) {
|
||||||
|
// if (activate == 0){
|
||||||
|
// throw exception(PAID_MEMBER_USER_NOT_OPEN);
|
||||||
|
// } else if (activate != 0 && cardExpirationTime.isBefore(LocalDateTime.now())) {
|
||||||
|
// throw exception(PAID_MEMBER_USER_PASSED);
|
||||||
|
// }else {
|
||||||
|
// //当前用户为会员
|
||||||
|
// List<PaidMemberUserDO> list = paidMemberUserMapper.selectList(PaidMemberUserDO::getUid,getLoginUserId(),
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPriceByTtype(Integer activate, String cardName) {
|
public int getPriceByTtype(Integer activate, String cardName) {
|
||||||
int price = 0;
|
int price = 0;
|
||||||
@ -108,6 +122,7 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
|||||||
public LocalDateTime getDeadLineDay(String cardName) {
|
public LocalDateTime getDeadLineDay(String cardName) {
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
LocalDateTime deadlineDay;
|
LocalDateTime deadlineDay;
|
||||||
|
//判断是否具有过期时间,该操作为续费
|
||||||
if (cardName.equals("试用")){
|
if (cardName.equals("试用")){
|
||||||
deadlineDay = now.plus(1, ChronoUnit.DAYS);
|
deadlineDay = now.plus(1, ChronoUnit.DAYS);
|
||||||
} else if (cardName.equals("月卡")) {
|
} else if (cardName.equals("月卡")) {
|
||||||
@ -117,7 +132,8 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
|||||||
} else if (cardName.equals("年卡")) {
|
} else if (cardName.equals("年卡")) {
|
||||||
deadlineDay = now.plus(1,ChronoUnit.YEARS);
|
deadlineDay = now.plus(1,ChronoUnit.YEARS);
|
||||||
} else {
|
} else {
|
||||||
deadlineDay = null;
|
//永久设置为一个非常远的的日期
|
||||||
|
deadlineDay = LocalDateTime.of(9999,12,31,23,59,59);
|
||||||
}
|
}
|
||||||
return deadlineDay;
|
return deadlineDay;
|
||||||
}
|
}
|
||||||
@ -128,6 +144,12 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
|||||||
return paidMemberUserDO;
|
return paidMemberUserDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(PaidMemberUserDO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateMemberUserExists(updateReqVO.getId());
|
||||||
|
paidMemberUserMapper.updateById(updateReqVO);
|
||||||
|
}
|
||||||
// @Override
|
// @Override
|
||||||
// public PageResult<PaidMemberUserDO> getMemberUserPage(PaidMemberUserPageReqVO pageReqVO) {
|
// public PageResult<PaidMemberUserDO> getMemberUserPage(PaidMemberUserPageReqVO pageReqVO) {
|
||||||
// return memberUserMapper.selectPage(pageReqVO);
|
// return memberUserMapper.selectPage(pageReqVO);
|
||||||
|
@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.member.service.membercardtype.PaidMemberCardTypeS
|
|||||||
import cn.iocoder.yudao.module.member.service.order.PaidMemberOrderService;
|
import cn.iocoder.yudao.module.member.service.order.PaidMemberOrderService;
|
||||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
import cn.iocoder.yudao.module.member.service.user.PaidMemberUserService;
|
import cn.iocoder.yudao.module.member.service.user.PaidMemberUserService;
|
||||||
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.app.member.vo.AppPaidMemberCreateReqVO;
|
import cn.iocoder.yudao.module.pay.controller.app.member.vo.AppPaidMemberCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.app.member.vo.AppPaidMemberCreateRespVO;
|
import cn.iocoder.yudao.module.pay.controller.app.member.vo.AppPaidMemberCreateRespVO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.app.member.vo.AppPaidMemeberOrderReqDto;
|
import cn.iocoder.yudao.module.pay.controller.app.member.vo.AppPaidMemeberOrderReqDto;
|
||||||
@ -20,6 +21,7 @@ import cn.iocoder.yudao.module.pay.convert.member.PayMemberOrderConvert;
|
|||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
|
||||||
|
import cn.iocoder.yudao.module.pay.dal.redis.no.PayNoRedisDAO;
|
||||||
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
||||||
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
|
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -33,11 +35,14 @@ import javax.annotation.Resource;
|
|||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.Duration;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.addTime;
|
||||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||||
|
import static cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum.WALLET;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserType;
|
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserType;
|
||||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.MEMBER_USER_NOT_EXISTS;
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.MEMBER_USER_NOT_EXISTS;
|
||||||
@ -45,6 +50,7 @@ import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.WALLET_BALANC
|
|||||||
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.WALLET_NOT_FOUND;
|
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.WALLET_NOT_FOUND;
|
||||||
import static cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum.PAYMENT;
|
import static cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum.PAYMENT;
|
||||||
|
|
||||||
|
|
||||||
@Tag(name = "用户 APP - 会员支付")
|
@Tag(name = "用户 APP - 会员支付")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/pay/member")
|
@RequestMapping("/pay/member")
|
||||||
@ -52,6 +58,12 @@ import static cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum.PAYM
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class AppPaidMembeController {
|
public class AppPaidMembeController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员支付的 no 前缀
|
||||||
|
* */
|
||||||
|
private static final String PAID_MEMBER_NO_PREFIX = "M";
|
||||||
|
|
||||||
|
private static final String PAID_MEMBER_USER_SUBJECT = "会员支付购卡";
|
||||||
@Resource
|
@Resource
|
||||||
private MemberUserService memberUserService;
|
private MemberUserService memberUserService;
|
||||||
|
|
||||||
@ -64,6 +76,12 @@ public class AppPaidMembeController {
|
|||||||
@Resource
|
@Resource
|
||||||
private PayWalletService payWalletService;
|
private PayWalletService payWalletService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PayNoRedisDAO noRedisDAO;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PayOrderService payOrderService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建会员支付记录(发起支付)")
|
@Operation(summary = "创建会员支付记录(发起支付)")
|
||||||
public CommonResult<AppPaidMemberCreateRespVO> createcard(@Valid @RequestBody AppPaidMemberCreateReqVO reqVO) {
|
public CommonResult<AppPaidMemberCreateRespVO> createcard(@Valid @RequestBody AppPaidMemberCreateReqVO reqVO) {
|
||||||
@ -76,6 +94,7 @@ public class AppPaidMembeController {
|
|||||||
PaidMemberUserSaveReqVO paidMemberUserSaveReqVO = new PaidMemberUserSaveReqVO();
|
PaidMemberUserSaveReqVO paidMemberUserSaveReqVO = new PaidMemberUserSaveReqVO();
|
||||||
//初始化支付金额,单位为分
|
//初始化支付金额,单位为分
|
||||||
int price = 0;
|
int price = 0;
|
||||||
|
Long payOrderId = null;
|
||||||
if(reqVO.getCardName().equals("试用")){
|
if(reqVO.getCardName().equals("试用")){
|
||||||
BeanUtils.copyProperties(memberUserDO,paidMemberUserSaveReqVO);
|
BeanUtils.copyProperties(memberUserDO,paidMemberUserSaveReqVO);
|
||||||
paidMemberUserSaveReqVO.setId(null);
|
paidMemberUserSaveReqVO.setId(null);
|
||||||
@ -92,6 +111,8 @@ public class AppPaidMembeController {
|
|||||||
//获取试用类型的过期时间
|
//获取试用类型的过期时间
|
||||||
LocalDateTime cardExpirationTime = paidMemberUserService.getDeadLineDay(reqVO.getCardName());
|
LocalDateTime cardExpirationTime = paidMemberUserService.getDeadLineDay(reqVO.getCardName());
|
||||||
paidMemberUserSaveReqVO.setCardExpirationTime(cardExpirationTime);
|
paidMemberUserSaveReqVO.setCardExpirationTime(cardExpirationTime);
|
||||||
|
//设置会员订单号
|
||||||
|
paidMemberUserSaveReqVO.setOrderNo(noRedisDAO.generate(PAID_MEMBER_NO_PREFIX));
|
||||||
//新增会员订单记录
|
//新增会员订单记录
|
||||||
Long id = paidMemberUserService.createMemberUser(paidMemberUserSaveReqVO);
|
Long id = paidMemberUserService.createMemberUser(paidMemberUserSaveReqVO);
|
||||||
//查询新增的会员订单记录
|
//查询新增的会员订单记录
|
||||||
@ -110,37 +131,69 @@ public class AppPaidMembeController {
|
|||||||
String deadlineDay = memberCardService.selectByName(reqVO.getCardName()).getVid();
|
String deadlineDay = memberCardService.selectByName(reqVO.getCardName()).getVid();
|
||||||
paidMemberUserSaveReqVO.setDeadlineDay(deadlineDay);
|
paidMemberUserSaveReqVO.setDeadlineDay(deadlineDay);
|
||||||
paidMemberUserSaveReqVO.setPrice(price);
|
paidMemberUserSaveReqVO.setPrice(price);
|
||||||
paidMemberUserSaveReqVO.setPayType("钱包支付");
|
//设置会员订单号
|
||||||
|
paidMemberUserSaveReqVO.setOrderNo(noRedisDAO.generate(PAID_MEMBER_NO_PREFIX));
|
||||||
//新增会员订单记录
|
//新增会员订单记录
|
||||||
Long id = paidMemberUserService.createMemberUser(paidMemberUserSaveReqVO);
|
Long id = paidMemberUserService.createMemberUser(paidMemberUserSaveReqVO);
|
||||||
//查询新增的会员订单记录
|
//查询新增的会员订单记录
|
||||||
paidMemberUserDO = paidMemberUserService.getMemberUser(id);
|
paidMemberUserDO = paidMemberUserService.getMemberUser(id);
|
||||||
|
// 创建支付订单号
|
||||||
|
payOrderId = payOrderService.createOrder(new PayOrderCreateReqDTO()
|
||||||
|
.setAppId(1L).setUserIp(getClientIP())
|
||||||
|
.setMerchantOrderId(""+paidMemberUserDO.getId())
|
||||||
|
.setSubject(PAID_MEMBER_USER_SUBJECT).setBody("")
|
||||||
|
.setPrice(paidMemberUserDO.getPrice())
|
||||||
|
.setExpireTime(addTime(Duration.ofHours(2L)))); // TODO @芋艿:支付超时时间
|
||||||
|
paidMemberUserDO.setPayOrderId(payOrderId);
|
||||||
|
//跟新支付订单号进付费会员表里
|
||||||
|
paidMemberUserService.update(paidMemberUserDO);
|
||||||
}
|
}
|
||||||
return success(PayMemberOrderConvert.INSTANCE.convert(paidMemberUserDO.getId(),paidMemberUserDO.getOrderNo()
|
return success(PayMemberOrderConvert.INSTANCE.convert(paidMemberUserDO.getId(),payOrderId
|
||||||
,paidMemberUserDO.getCardExpirationTime(),memberUserDO.getActivate()));
|
,paidMemberUserDO.getCardExpirationTime(),memberUserDO.getActivate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @PostMapping("/update")
|
@PostMapping("/update")
|
||||||
// @Operation(summary = "更新会员订单未支付为已支付") // 由 pay-module 支付服务,进行回调,可见 PayNotifyJob
|
@Operation(summary = "更新会员订单未支付为已支付") // 由 pay-module 支付服务,进行回调,可见 PayNotifyJob
|
||||||
// public CommonResult<Boolean> updatePaidMemberUser(@Valid @RequestBody AppPaidMemeberOrderReqDto notifyReqDTO){
|
public CommonResult<Boolean> updatePaidMemberUser(@Valid @RequestBody AppPaidMemeberOrderReqDto notifyReqDTO){
|
||||||
// //获取订单记录
|
//获取当前登录用户信息,并判断用户是否为会员
|
||||||
// PaidMemberUserDO paidMemberUserDO = paidMemberUserService.getMemberUser(notifyReqDTO.getId());
|
MemberUserDO memberUserDO = memberUserService.getUser(getLoginUserId());
|
||||||
//// 校验钱包充值是否可以支付
|
//获取订单记录
|
||||||
// PayWalletDO walletDO = payWalletService.getOrCreateWallet(WebFrameworkUtils.getLoginUserId(),getLoginUserType());
|
PaidMemberUserDO paidMemberUserDO = paidMemberUserService.getMemberUser(notifyReqDTO.getId());
|
||||||
// if(walletDO.getBalance()<paidMemberUserDO.getPrice()){
|
// 获取当前用户钱包信息
|
||||||
// log.error("[updatePaidMemberOrder],updateReqVO({}) 钱包余额不足.");
|
PayWalletDO walletDO = payWalletService.getOrCreateWallet(WebFrameworkUtils.getLoginUserId(),getLoginUserType());
|
||||||
// throw exception(WALLET_BALANCE_NOT_ENOUGH);
|
// 扣减钱包余额
|
||||||
// }
|
payWalletService.reduceWalletBalance
|
||||||
//// 扣减钱包余额
|
(walletDO.getId(),notifyReqDTO.getId(),PAYMENT,paidMemberUserDO.getPrice());
|
||||||
// PayWalletTransactionDO payWalletTransactionDO = payWalletService.reduceWalletBalance
|
//获取支付时间
|
||||||
// (walletDO.getId(),notifyReqDTO.getPayOrderId(),PAYMENT,price);
|
LocalDateTime payTime = LocalDateTime.now();
|
||||||
//
|
paidMemberUserDO.setPayTime(payTime);
|
||||||
//// //更新订单支付状态为已支付
|
//更新会员订单支付状态为已支付
|
||||||
//// paidMemberOrderDO.setPaid(true);
|
paidMemberUserDO.setPaid(true);
|
||||||
//// paidMemberOrderDO.setPayChannel(payOrderDO.getChannelCode());
|
//获取试用类型的过期时间
|
||||||
//// paidMemberOrderService1.updateOrder(paidMemberOrderDO);
|
LocalDateTime cardExpirationTime = paidMemberUserService.getDeadLineDay(notifyReqDTO.getCardName());
|
||||||
// return success(true);
|
paidMemberUserDO.setCardExpirationTime(cardExpirationTime);
|
||||||
// }
|
paidMemberUserDO.setPayChannel(notifyReqDTO.getPayChannel());
|
||||||
|
if (notifyReqDTO.getPayChannel().equals("wallet")){
|
||||||
|
paidMemberUserDO.setPayType("余额");
|
||||||
|
} else if(notifyReqDTO.getPayChannel().startsWith("wx")){
|
||||||
|
paidMemberUserDO.setPayType("微信");
|
||||||
|
} else if (notifyReqDTO.getPayChannel().startsWith("alipay")) {
|
||||||
|
paidMemberUserDO.setPayType("支付宝");
|
||||||
|
} else {
|
||||||
|
paidMemberUserDO.setPayType("模拟支付");
|
||||||
|
}
|
||||||
|
//更新会员订单
|
||||||
|
paidMemberUserService.update(paidMemberUserDO);
|
||||||
|
//设置个人信息的会员状态,0:未开通,1试用,2有效期,3永久
|
||||||
|
if(notifyReqDTO.getCardName().equals("永久")){
|
||||||
|
memberUserDO.setActivate(3);
|
||||||
|
}else {
|
||||||
|
memberUserDO.setActivate(2);
|
||||||
|
}
|
||||||
|
//更新用户会员状态
|
||||||
|
memberUserService.updateUserDo(memberUserDO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,11 @@ public class AppPaidMemberCreateRespVO {
|
|||||||
@Schema(description = "会员支付编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "会员支付编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
// @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "o100")
|
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "o100")
|
||||||
// private Long payOrderId;
|
private Long payOrderId;
|
||||||
|
|
||||||
@Schema(description = "会员订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "m100")
|
// @Schema(description = "会员订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "m100")
|
||||||
private String orderNo;
|
// private String orderNo;
|
||||||
|
|
||||||
@Schema(description = "到期时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024-11-22 09:30:05")
|
@Schema(description = "到期时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024-11-22 09:30:05")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ -22,6 +22,8 @@ public class AppPaidMemeberOrderReqDto {
|
|||||||
@Schema(description = "会员支付编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "会员支付编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "会员卡名称", example = "试用")
|
||||||
|
private String cardName;
|
||||||
|
|
||||||
@Schema(description = "支付渠道", example = "公众号,mini-小程序,h5-网页支付,wechatIos-微信Ios,wechatAndroid-微信Android,alipay-支付包,alipayApp-支付宝App,give-平台赠送")
|
@Schema(description = "支付渠道", example = "公众号,mini-小程序,h5-网页支付,wechatIos-微信Ios,wechatAndroid-微信Android,alipay-支付包,alipayApp-支付宝App,give-平台赠送")
|
||||||
private String payChannel;
|
private String payChannel;
|
||||||
|
@ -13,5 +13,5 @@ public interface PayMemberOrderConvert {
|
|||||||
|
|
||||||
PayMemberOrderConvert INSTANCE = Mappers.getMapper(PayMemberOrderConvert.class);
|
PayMemberOrderConvert INSTANCE = Mappers.getMapper(PayMemberOrderConvert.class);
|
||||||
|
|
||||||
AppPaidMemberCreateRespVO convert(Long id, String orderNo, LocalDateTime cardExpirationTime, Integer activate);
|
AppPaidMemberCreateRespVO convert(Long id, Long payOrderId, LocalDateTime cardExpirationTime, Integer activate);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user