会员支付(试用)

This commit is contained in:
khy 2024-10-21 19:19:44 +08:00
parent bdbcae287c
commit 89b94e856b
4 changed files with 31 additions and 1 deletions

View File

@ -84,4 +84,10 @@ public interface PaidMemberOrderService {
*/
LocalDateTime getDeadLineDay(String cardName);
/**
* 根据id获取对应的会员订单
*/
PaidMemberOrderDO getPaidMemeberOrder(Long id);
}

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.membercardtype.PaidMemberCa
import cn.iocoder.yudao.module.member.dal.dataobject.user.PaidMemberUserDO;
import cn.iocoder.yudao.module.member.service.membercardtype.PaidMemberCardTypeService;
import cn.iocoder.yudao.module.member.service.user.PaidMemberUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -32,6 +33,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
*/
@Service
@Validated
@Slf4j
public class PaidMemberOrderServiceImpl implements PaidMemberOrderService {
@Resource
@ -135,4 +137,14 @@ public class PaidMemberOrderServiceImpl implements PaidMemberOrderService {
return deadlineDay;
}
@Override
public PaidMemberOrderDO getPaidMemeberOrder(Long id) {
PaidMemberOrderDO paidMemberOrderDO = paidMemberOrderMapper.selectById(id);
if (paidMemberOrderDO == null){
log.error("[getPaidMemeberOrder][会员支付订单记录不存在,会员支付订单记录 id({})]",id);
throw exception(PAID_MEMBER_ORDER_NOT_EXISTS);
}
return paidMemberOrderDO;
}
}

View File

@ -74,8 +74,15 @@ public class AppPaidMembeOrderController {
MemberUserDO memberUserDO = userService1.getUser(getLoginUserId());
PaidMemberUserSaveReqVO paidMemberUserSaveReqVO = new PaidMemberUserSaveReqVO();
// 判断当前用户是否选择过试用会员
if(memberUserDO.getActivate() == 0 && memberUserDO != null){
if(memberUserDO.getActivate() == 0 && memberUserDO != null && reqVO.getCardName().equals("试用")){
//试用会员
memberUserDO.setActivate(CommonStatusEnum.DISABLE.getStatus());
}else if(reqVO.getCardName().equals("永久")){
//永久会员
memberUserDO.setActivate(3);
}else {
//有效期会员
memberUserDO.setActivate(2);
}
// 若不是会员则往会员表插入数据
if(memberUserService1.getMemberUser(memberUserDO.getId()) == null){

View File

@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.pay.controller.app.member.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "用户 APP - 会员支付 Resp VO")
@Data
public class AppPaidMemberOrderRespVO {
@ -12,4 +14,7 @@ public class AppPaidMemberOrderRespVO {
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "o100")
private Long payOrderId;
@Schema(description = "到期时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime cardExpirationTime;
}