diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/vo/PaidMemberUserSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/vo/PaidMemberUserSaveReqVO.java index 850e384..9f09793 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/vo/PaidMemberUserSaveReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/vo/PaidMemberUserSaveReqVO.java @@ -103,4 +103,7 @@ public class PaidMemberUserSaveReqVO { @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED) private Long payOrderId; + + @Schema(description = "会员类型", requiredMode = Schema.RequiredMode.REQUIRED) + private String payMemberType; } \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/AppMemberCardTypeController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/AppMemberCardTypeController.java index 5b96de1..d009e45 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/AppMemberCardTypeController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/AppMemberCardTypeController.java @@ -34,15 +34,11 @@ public class AppMemberCardTypeController { @GetMapping("/list") @Operation(summary = "获得会员卡类型列表") - public CommonResult> list(@RequestParam(value = "name",required = false) String name) { + public CommonResult> list() { /** 查询状态为启用的会员卡类型列表 */ MemberUserDO memberUserDO = userService.getUser(getLoginUserId()); /** 根据用户查询是否有试用会员的类型列表 */ List list = cardService.getCardTypeList(memberUserDO.getActivate()); - if(name != null){ - //根据用户查询是否有有效期会员的类型列表 - list = cardService.getCardTypeValidList(memberUserDO.getActivate(),name); - } return success(MemberCardTypeConvert.INSTANCE.convertList(list)); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java index d1eb7dd..ded14dd 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java @@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO; import cn.iocoder.yudao.module.member.dal.dataobject.memberCode.MemberCodeDo; import cn.iocoder.yudao.module.member.dal.dataobject.transferlog.TransferLogDO; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; +import cn.iocoder.yudao.module.member.dal.dataobject.user.PaidMemberUserDO; import cn.iocoder.yudao.module.member.dal.mysql.memberCode.MemberCodeMapper; import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum; import cn.iocoder.yudao.module.member.service.afterverification.AfterVerificationService; @@ -32,6 +33,7 @@ import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService; import cn.iocoder.yudao.module.member.service.transfer.TransferService; import cn.iocoder.yudao.module.member.service.transferlog.TransferLogService; import cn.iocoder.yudao.module.member.service.user.MemberUserService; +import cn.iocoder.yudao.module.member.service.user.PaidMemberUserService; import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO; import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService; import io.swagger.v3.oas.annotations.Operation; @@ -78,13 +80,16 @@ public class AppMemberUserController { private MemberPointRecordService pointRecordService; @Resource private MemberCodeMapper memberCodeMapper; + @Resource + private PaidMemberUserService paidMemberUserService; @GetMapping("/get") @Operation(summary = "获得基本信息") @PreAuthenticated public CommonResult getUserInfo() { MemberUserDO user = userService.getUser(getLoginUserId()); MemberLevelDO level = levelService.getLevel(user.getLevelId()); - return success(MemberUserConvert.INSTANCE.convert(user, level)); + PaidMemberUserDO paidMemberUserDO = paidMemberUserService.getPaidMemberUserByUid(getLoginUserId()); + return success(MemberUserConvert.INSTANCE.convert(user, level,paidMemberUserDO.getPayMemberType(),paidMemberUserDO.getCardExpirationTime())); } @PutMapping("/update") diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java index cac56a4..7a13f20 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java @@ -41,6 +41,12 @@ public class AppMemberUserInfoRespVO { @Schema(description = "是否成为推广员", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") private Boolean brokerageEnabled; + @Schema(description = "会员名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "季卡") + private String cardName; + + @Schema(description = "会员名称", requiredMode = Schema.RequiredMode.REQUIRED) + private String cardExpirationTime; + @Schema(description = "用户 App - 会员等级") @Data public static class Level { diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/user/MemberUserConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/user/MemberUserConvert.java index eaa5ab5..c1de086 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/user/MemberUserConvert.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/user/MemberUserConvert.java @@ -15,6 +15,7 @@ import org.mapstruct.Mapping; import org.mapstruct.Mappings; import org.mapstruct.factory.Mappers; +import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -34,7 +35,7 @@ public interface MemberUserConvert { @Mapping(source = "bean.id", target = "id"), @Mapping(source = "bean.experience", target = "experience") }) - AppMemberUserInfoRespVO convert(MemberUserDO bean, MemberLevelDO level); + AppMemberUserInfoRespVO convert(MemberUserDO bean, MemberLevelDO level, String cardName, LocalDateTime cardExpirationTime); MemberUserRespDTO convert2(MemberUserDO bean); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/user/PaidMemberUserDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/user/PaidMemberUserDO.java index f875f9c..bbdd0f9 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/user/PaidMemberUserDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/user/PaidMemberUserDO.java @@ -151,6 +151,10 @@ public class PaidMemberUserDO extends TenantBaseDO { * 关联 {@link PayOrderDO#getId()} */ private Long payOrderId; + /** + * 会员类型 + */ + private String payMemberType; } \ 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/membercardtype/PaidMemberCardTypeService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeService.java index f7c8c64..f6c27c2 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeService.java @@ -62,13 +62,6 @@ public interface PaidMemberCardTypeService { */ List getCardTypeList (Integer activate); - /** - * 根据用户是否使用有效期会员 - * 查询会员类型列表 - * @param activate - * @return - */ - List getCardTypeValidList (Integer activate,String name); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeServiceImpl.java index 7a3ab0e..7f2fa99 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeServiceImpl.java @@ -81,28 +81,15 @@ public class PaidMemberCardTypeServiceImpl implements PaidMemberCardTypeService public List getCardTypeList(Integer activate) { List list = new ArrayList<>(); Integer status = 1; - if(activate == 1){ - list = cardMapper.selectListByIsActivate(status); + if(activate == 0){ + list = cardMapper.selectListByStatus(status); } else { - list = cardMapper.selectListByStatus(status); + list = cardMapper.selectListByIsActivate(status); } return list; } - @Override - public List getCardTypeValidList(Integer activate,String name) { - List list = new ArrayList<>(); - Integer status = 1; - if (activate == 2){ - list = cardMapper.selectList(new LambdaQueryWrapperX() - .eqIfPresent(PaidMemberCardTypeDO::getStatus,status) - .neIfPresent(PaidMemberCardTypeDO::getName,name) - .neIfPresent(PaidMemberCardTypeDO::getName,"试用") - .orderByAsc(PaidMemberCardTypeDO::getId)); - } - return list; - } @Override diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/PaidMemberUserService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/PaidMemberUserService.java index c8c2de2..e10025f 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/PaidMemberUserService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/PaidMemberUserService.java @@ -68,6 +68,8 @@ public interface PaidMemberUserService { */ void update(@Valid PaidMemberUserDO updateReqVO); + PaidMemberUserDO getPaidMemberUserByUid(Long uid); + // /** // * 获得会员分页 diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/PaidMemberUserServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/PaidMemberUserServiceImpl.java index d45fd8f..8c6f45b 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/PaidMemberUserServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/PaidMemberUserServiceImpl.java @@ -3,8 +3,10 @@ package cn.iocoder.yudao.module.member.service.user; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; import cn.iocoder.yudao.framework.common.util.date.DateUtils; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; import cn.iocoder.yudao.module.member.service.membercardtype.PaidMemberCardTypeService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -150,6 +152,18 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService { validateMemberUserExists(updateReqVO.getId()); paidMemberUserMapper.updateById(updateReqVO); } + + @Override + public PaidMemberUserDO getPaidMemberUserByUid(Long uid) { + List list = paidMemberUserMapper.selectList( + new LambdaQueryWrapperX().eq(PaidMemberUserDO::getUid,uid) + .orderByDesc(PaidMemberUserDO::getId)); + if(list.isEmpty()){ + throw exception(MEMBER_USER_NOT_EXISTS); + } + PaidMemberUserDO paidMemberUserDO = list.get(0); + return paidMemberUserDO; + } // @Override // public PageResult getMemberUserPage(PaidMemberUserPageReqVO pageReqVO) { // return memberUserMapper.selectPage(pageReqVO); diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/AppPaidMembeController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/AppPaidMembeController.java index 9e2df10..11de3ff 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/AppPaidMembeController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/member/AppPaidMembeController.java @@ -97,6 +97,7 @@ public class AppPaidMembeController { Long payOrderId = null; if(reqVO.getCardName().equals("试用")){ BeanUtils.copyProperties(memberUserDO,paidMemberUserSaveReqVO); + paidMemberUserSaveReqVO.setPayMemberType(reqVO.getCardName()); paidMemberUserSaveReqVO.setId(null); paidMemberUserSaveReqVO.setUid(memberUserDO.getId()); paidMemberUserSaveReqVO.setPrice(price); @@ -124,6 +125,7 @@ public class AppPaidMembeController { else { BeanUtils.copyProperties(memberUserDO,paidMemberUserSaveReqVO); paidMemberUserSaveReqVO.setId(null); + paidMemberUserSaveReqVO.setPayMemberType(reqVO.getCardName()); paidMemberUserSaveReqVO.setUid(memberUserDO.getId()); //获取实际支付金额(判断是否为会员有无优惠价) price = paidMemberUserService.getPriceByTtype(memberUserDO.getActivate(),reqVO.getCardName()); @@ -153,7 +155,7 @@ public class AppPaidMembeController { } @PostMapping("/update") - @Operation(summary = "更新会员订单未支付为已支付") // 由 pay-module 支付服务,进行回调,可见 PayNotifyJob + @Operation(summary = "余额支付") public CommonResult updatePaidMemberUser(@Valid @RequestBody AppPaidMemeberOrderReqDto notifyReqDTO){ //获取当前登录用户信息,并判断用户是否为会员 MemberUserDO memberUserDO = memberUserService.getUser(getLoginUserId()); @@ -192,6 +194,8 @@ public class AppPaidMembeController { } //更新用户会员状态 memberUserService.updateUserDo(memberUserDO); +// return success(PayMemberOrderConvert.INSTANCE.convert(paidMemberUserDO.getId(),payOrderId +// ,paidMemberUserDO.getCardExpirationTime(),memberUserDO.getActivate())); return success(true); }