会员回显
This commit is contained in:
parent
a4cc10ccb9
commit
a35f333ec2
@ -103,4 +103,7 @@ public class PaidMemberUserSaveReqVO {
|
|||||||
|
|
||||||
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private Long payOrderId;
|
private Long payOrderId;
|
||||||
|
|
||||||
|
@Schema(description = "会员类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String payMemberType;
|
||||||
}
|
}
|
@ -34,15 +34,11 @@ public class AppMemberCardTypeController {
|
|||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获得会员卡类型列表")
|
@Operation(summary = "获得会员卡类型列表")
|
||||||
public CommonResult<List<AppMemberCardTypeRespVO>> list(@RequestParam(value = "name",required = false) String name) {
|
public CommonResult<List<AppMemberCardTypeRespVO>> list() {
|
||||||
/** 查询状态为启用的会员卡类型列表 */
|
/** 查询状态为启用的会员卡类型列表 */
|
||||||
MemberUserDO memberUserDO = userService.getUser(getLoginUserId());
|
MemberUserDO memberUserDO = userService.getUser(getLoginUserId());
|
||||||
/** 根据用户查询是否有试用会员的类型列表 */
|
/** 根据用户查询是否有试用会员的类型列表 */
|
||||||
List<PaidMemberCardTypeDO> list = cardService.getCardTypeList(memberUserDO.getActivate());
|
List<PaidMemberCardTypeDO> list = cardService.getCardTypeList(memberUserDO.getActivate());
|
||||||
if(name != null){
|
|
||||||
//根据用户查询是否有有效期会员的类型列表
|
|
||||||
list = cardService.getCardTypeValidList(memberUserDO.getActivate(),name);
|
|
||||||
}
|
|
||||||
return success(MemberCardTypeConvert.INSTANCE.convertList(list));
|
return success(MemberCardTypeConvert.INSTANCE.convertList(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.memberCode.MemberCodeDo;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.transferlog.TransferLogDO;
|
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.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.dal.mysql.memberCode.MemberCodeMapper;
|
||||||
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
||||||
import cn.iocoder.yudao.module.member.service.afterverification.AfterVerificationService;
|
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.transfer.TransferService;
|
||||||
import cn.iocoder.yudao.module.member.service.transferlog.TransferLogService;
|
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.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.dal.dataobject.brokerage.BrokerageUserDO;
|
||||||
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService;
|
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -78,13 +80,16 @@ public class AppMemberUserController {
|
|||||||
private MemberPointRecordService pointRecordService;
|
private MemberPointRecordService pointRecordService;
|
||||||
@Resource
|
@Resource
|
||||||
private MemberCodeMapper memberCodeMapper;
|
private MemberCodeMapper memberCodeMapper;
|
||||||
|
@Resource
|
||||||
|
private PaidMemberUserService paidMemberUserService;
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得基本信息")
|
@Operation(summary = "获得基本信息")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
public CommonResult<AppMemberUserInfoRespVO> getUserInfo() {
|
public CommonResult<AppMemberUserInfoRespVO> getUserInfo() {
|
||||||
MemberUserDO user = userService.getUser(getLoginUserId());
|
MemberUserDO user = userService.getUser(getLoginUserId());
|
||||||
MemberLevelDO level = levelService.getLevel(user.getLevelId());
|
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")
|
@PutMapping("/update")
|
||||||
|
@ -41,6 +41,12 @@ public class AppMemberUserInfoRespVO {
|
|||||||
@Schema(description = "是否成为推广员", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
@Schema(description = "是否成为推广员", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||||
private Boolean brokerageEnabled;
|
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 - 会员等级")
|
@Schema(description = "用户 App - 会员等级")
|
||||||
@Data
|
@Data
|
||||||
public static class Level {
|
public static class Level {
|
||||||
|
@ -15,6 +15,7 @@ import org.mapstruct.Mapping;
|
|||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ public interface MemberUserConvert {
|
|||||||
@Mapping(source = "bean.id", target = "id"),
|
@Mapping(source = "bean.id", target = "id"),
|
||||||
@Mapping(source = "bean.experience", target = "experience")
|
@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);
|
MemberUserRespDTO convert2(MemberUserDO bean);
|
||||||
|
|
||||||
|
@ -151,6 +151,10 @@ public class PaidMemberUserDO extends TenantBaseDO {
|
|||||||
* 关联 {@link PayOrderDO#getId()}
|
* 关联 {@link PayOrderDO#getId()}
|
||||||
*/
|
*/
|
||||||
private Long payOrderId;
|
private Long payOrderId;
|
||||||
|
/**
|
||||||
|
* 会员类型
|
||||||
|
*/
|
||||||
|
private String payMemberType;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -62,13 +62,6 @@ public interface PaidMemberCardTypeService {
|
|||||||
*/
|
*/
|
||||||
List<PaidMemberCardTypeDO> getCardTypeList (Integer activate);
|
List<PaidMemberCardTypeDO> getCardTypeList (Integer activate);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户是否使用有效期会员
|
|
||||||
* 查询会员类型列表
|
|
||||||
* @param activate
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<PaidMemberCardTypeDO> getCardTypeValidList (Integer activate,String name);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,28 +81,15 @@ public class PaidMemberCardTypeServiceImpl implements PaidMemberCardTypeService
|
|||||||
public List<PaidMemberCardTypeDO> getCardTypeList(Integer activate) {
|
public List<PaidMemberCardTypeDO> getCardTypeList(Integer activate) {
|
||||||
List<PaidMemberCardTypeDO> list = new ArrayList<>();
|
List<PaidMemberCardTypeDO> list = new ArrayList<>();
|
||||||
Integer status = 1;
|
Integer status = 1;
|
||||||
if(activate == 1){
|
if(activate == 0){
|
||||||
list = cardMapper.selectListByIsActivate(status);
|
list = cardMapper.selectListByStatus(status);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
list = cardMapper.selectListByStatus(status);
|
list = cardMapper.selectListByIsActivate(status);
|
||||||
}
|
}
|
||||||
return list;
|
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
|
@Override
|
||||||
|
@ -68,6 +68,8 @@ public interface PaidMemberUserService {
|
|||||||
*/
|
*/
|
||||||
void update(@Valid PaidMemberUserDO updateReqVO);
|
void update(@Valid PaidMemberUserDO updateReqVO);
|
||||||
|
|
||||||
|
PaidMemberUserDO getPaidMemberUserByUid(Long uid);
|
||||||
|
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 获得会员分页
|
// * 获得会员分页
|
||||||
|
@ -3,8 +3,10 @@ package cn.iocoder.yudao.module.member.service.user;
|
|||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
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.dal.dataobject.user.MemberUserDO;
|
||||||
import cn.iocoder.yudao.module.member.service.membercardtype.PaidMemberCardTypeService;
|
import cn.iocoder.yudao.module.member.service.membercardtype.PaidMemberCardTypeService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -150,6 +152,18 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
|||||||
validateMemberUserExists(updateReqVO.getId());
|
validateMemberUserExists(updateReqVO.getId());
|
||||||
paidMemberUserMapper.updateById(updateReqVO);
|
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
|
// @Override
|
||||||
// public PageResult<PaidMemberUserDO> getMemberUserPage(PaidMemberUserPageReqVO pageReqVO) {
|
// public PageResult<PaidMemberUserDO> getMemberUserPage(PaidMemberUserPageReqVO pageReqVO) {
|
||||||
// return memberUserMapper.selectPage(pageReqVO);
|
// return memberUserMapper.selectPage(pageReqVO);
|
||||||
|
@ -97,6 +97,7 @@ public class AppPaidMembeController {
|
|||||||
Long payOrderId = null;
|
Long payOrderId = null;
|
||||||
if(reqVO.getCardName().equals("试用")){
|
if(reqVO.getCardName().equals("试用")){
|
||||||
BeanUtils.copyProperties(memberUserDO,paidMemberUserSaveReqVO);
|
BeanUtils.copyProperties(memberUserDO,paidMemberUserSaveReqVO);
|
||||||
|
paidMemberUserSaveReqVO.setPayMemberType(reqVO.getCardName());
|
||||||
paidMemberUserSaveReqVO.setId(null);
|
paidMemberUserSaveReqVO.setId(null);
|
||||||
paidMemberUserSaveReqVO.setUid(memberUserDO.getId());
|
paidMemberUserSaveReqVO.setUid(memberUserDO.getId());
|
||||||
paidMemberUserSaveReqVO.setPrice(price);
|
paidMemberUserSaveReqVO.setPrice(price);
|
||||||
@ -124,6 +125,7 @@ public class AppPaidMembeController {
|
|||||||
else {
|
else {
|
||||||
BeanUtils.copyProperties(memberUserDO,paidMemberUserSaveReqVO);
|
BeanUtils.copyProperties(memberUserDO,paidMemberUserSaveReqVO);
|
||||||
paidMemberUserSaveReqVO.setId(null);
|
paidMemberUserSaveReqVO.setId(null);
|
||||||
|
paidMemberUserSaveReqVO.setPayMemberType(reqVO.getCardName());
|
||||||
paidMemberUserSaveReqVO.setUid(memberUserDO.getId());
|
paidMemberUserSaveReqVO.setUid(memberUserDO.getId());
|
||||||
//获取实际支付金额(判断是否为会员有无优惠价)
|
//获取实际支付金额(判断是否为会员有无优惠价)
|
||||||
price = paidMemberUserService.getPriceByTtype(memberUserDO.getActivate(),reqVO.getCardName());
|
price = paidMemberUserService.getPriceByTtype(memberUserDO.getActivate(),reqVO.getCardName());
|
||||||
@ -153,7 +155,7 @@ public class AppPaidMembeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@Operation(summary = "更新会员订单未支付为已支付") // 由 pay-module 支付服务,进行回调,可见 PayNotifyJob
|
@Operation(summary = "余额支付")
|
||||||
public CommonResult<Boolean> updatePaidMemberUser(@Valid @RequestBody AppPaidMemeberOrderReqDto notifyReqDTO){
|
public CommonResult<Boolean> updatePaidMemberUser(@Valid @RequestBody AppPaidMemeberOrderReqDto notifyReqDTO){
|
||||||
//获取当前登录用户信息,并判断用户是否为会员
|
//获取当前登录用户信息,并判断用户是否为会员
|
||||||
MemberUserDO memberUserDO = memberUserService.getUser(getLoginUserId());
|
MemberUserDO memberUserDO = memberUserService.getUser(getLoginUserId());
|
||||||
@ -192,6 +194,8 @@ public class AppPaidMembeController {
|
|||||||
}
|
}
|
||||||
//更新用户会员状态
|
//更新用户会员状态
|
||||||
memberUserService.updateUserDo(memberUserDO);
|
memberUserService.updateUserDo(memberUserDO);
|
||||||
|
// return success(PayMemberOrderConvert.INSTANCE.convert(paidMemberUserDO.getId(),payOrderId
|
||||||
|
// ,paidMemberUserDO.getCardExpirationTime(),memberUserDO.getActivate()));
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user