Merge pull request '会员回显' (#67) from khy1 into master
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #67
This commit is contained in:
root 2024-10-23 21:12:23 +08:00
commit c613b2e3c1
11 changed files with 46 additions and 31 deletions

View File

@ -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;
}

View File

@ -34,15 +34,11 @@ public class AppMemberCardTypeController {
@GetMapping("/list")
@Operation(summary = "获得会员卡类型列表")
public CommonResult<List<AppMemberCardTypeRespVO>> list(@RequestParam(value = "name",required = false) String name) {
public CommonResult<List<AppMemberCardTypeRespVO>> list() {
/** 查询状态为启用的会员卡类型列表 */
MemberUserDO memberUserDO = userService.getUser(getLoginUserId());
/** 根据用户查询是否有试用会员的类型列表 */
List<PaidMemberCardTypeDO> list = cardService.getCardTypeList(memberUserDO.getActivate());
if(name != null){
//根据用户查询是否有有效期会员的类型列表
list = cardService.getCardTypeValidList(memberUserDO.getActivate(),name);
}
return success(MemberCardTypeConvert.INSTANCE.convertList(list));
}

View File

@ -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<AppMemberUserInfoRespVO> 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")

View File

@ -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 {

View File

@ -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);

View File

@ -151,6 +151,10 @@ public class PaidMemberUserDO extends TenantBaseDO {
* 关联 {@link PayOrderDO#getId()}
*/
private Long payOrderId;
/**
* 会员类型
*/
private String payMemberType;
}

View File

@ -62,13 +62,6 @@ public interface PaidMemberCardTypeService {
*/
List<PaidMemberCardTypeDO> getCardTypeList (Integer activate);
/**
* 根据用户是否使用有效期会员
* 查询会员类型列表
* @param activate
* @return
*/
List<PaidMemberCardTypeDO> getCardTypeValidList (Integer activate,String name);

View File

@ -81,28 +81,15 @@ public class PaidMemberCardTypeServiceImpl implements PaidMemberCardTypeService
public List<PaidMemberCardTypeDO> getCardTypeList(Integer activate) {
List<PaidMemberCardTypeDO> 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<PaidMemberCardTypeDO> getCardTypeValidList(Integer activate,String name) {
List<PaidMemberCardTypeDO> list = new ArrayList<>();
Integer status = 1;
if (activate == 2){
list = cardMapper.selectList(new LambdaQueryWrapperX<PaidMemberCardTypeDO>()
.eqIfPresent(PaidMemberCardTypeDO::getStatus,status)
.neIfPresent(PaidMemberCardTypeDO::getName,name)
.neIfPresent(PaidMemberCardTypeDO::getName,"试用")
.orderByAsc(PaidMemberCardTypeDO::getId));
}
return list;
}
@Override

View File

@ -68,6 +68,8 @@ public interface PaidMemberUserService {
*/
void update(@Valid PaidMemberUserDO updateReqVO);
PaidMemberUserDO getPaidMemberUserByUid(Long uid);
// /**
// * 获得会员分页

View File

@ -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<PaidMemberUserDO> list = paidMemberUserMapper.selectList(
new LambdaQueryWrapperX<PaidMemberUserDO>().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<PaidMemberUserDO> getMemberUserPage(PaidMemberUserPageReqVO pageReqVO) {
// return memberUserMapper.selectPage(pageReqVO);

View File

@ -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<Boolean> 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);
}