From 89b94e856b35e4b71cb507d261fa00dc178fa38c Mon Sep 17 00:00:00 2001 From: khy <2908249413@qq.com> Date: Mon, 21 Oct 2024 19:19:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=E6=94=AF=E4=BB=98(=E8=AF=95?= =?UTF-8?q?=E7=94=A8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/service/order/PaidMemberOrderService.java | 6 ++++++ .../service/order/PaidMemberOrderServiceImpl.java | 12 ++++++++++++ .../app/member/AppPaidMembeOrderController.java | 9 ++++++++- .../app/member/vo/AppPaidMemberOrderRespVO.java | 5 +++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/order/PaidMemberOrderService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/order/PaidMemberOrderService.java index 93b6981..62c9384 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/order/PaidMemberOrderService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/order/PaidMemberOrderService.java @@ -84,4 +84,10 @@ public interface PaidMemberOrderService { */ LocalDateTime getDeadLineDay(String cardName); + + /** + * 根据id获取对应的会员订单 + */ + PaidMemberOrderDO getPaidMemeberOrder(Long id); + } \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/order/PaidMemberOrderServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/order/PaidMemberOrderServiceImpl.java index 96bec75..7312a9d 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/order/PaidMemberOrderServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/order/PaidMemberOrderServiceImpl.java @@ -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; + } + } \ No newline at end of file diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/AppPaidMembeOrderController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/AppPaidMembeOrderController.java index d9818d8..3f14799 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/AppPaidMembeOrderController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/AppPaidMembeOrderController.java @@ -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){ diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/vo/AppPaidMemberOrderRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/vo/AppPaidMemberOrderRespVO.java index 76f6066..e431c02 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/vo/AppPaidMemberOrderRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/vo/AppPaidMemberOrderRespVO.java @@ -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; }