This commit is contained in:
PQZ 2025-03-31 17:50:36 +08:00
parent 183e12c805
commit 63b4f6147d
5 changed files with 90 additions and 8 deletions

View File

@ -39,11 +39,23 @@ public interface IMemberCardService extends IService<MemberCard> {
/**
* 查当前会员权益列表
*
* @param userType 用户类型
* @param userId 用户id
* @author vinjor-M
* @date 11:26 2025/3/26
* @param userType 用户类型
* @param userId 用户id
**/
Map<String,Map<String, ViewRightsVO>> selectMemberRights(Long userId, String userType);
**/
Map<String, Map<String, ViewRightsVO>> selectMemberRights(Long userId, String userType);
/**
* 获取报名次数
*
* @param userId 用户id
* @param userType 类型
* @return java.lang.Integer
* @author PQZ
* @date 17:27 2025/3/31
**/
Integer getCardReport(Long userId, String userType);
}

View File

@ -23,5 +23,14 @@ public interface IMemberRightsService extends IService<MemberRights> {
* @author PQZ
* @date 15:45 2025/3/27
**/
void dealRights(Long userId, String userType,List<CardRightsVO> rights);
void dealRights(Long userId, String userType, List<CardRightsVO> rights);
/**
* @param userId 用户id
* @param carId 卡id
* @return java.lang.Integer
* @author PQZ
* @date 17:15 2025/3/31
**/
Integer getReport(Long userId, String carId);
}

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.base.domain.BaseCard;
import com.ruoyi.base.service.IBaseCardService;
import com.ruoyi.base.vo.BaseCardVO;
import com.ruoyi.common.config.DlRightsConfig;
import com.ruoyi.common.core.domain.DlBaseEntity;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.constant.DictConstants;
@ -202,6 +203,35 @@ public class MemberCardServiceImpl extends ServiceImpl<MemberCardMapper, MemberC
return rtnMap;
}
/**
* 获取当日可报名次数
*
* @param userId 用户id
* @param userType 类型
* @return java.lang.Integer
* @author PQZ
* @date 17:27 2025/3/31
**/
@Override
public Integer getCardReport(Long userId, String userType) {
//查询当前用户在当前时间有无正在服役的会员卡
Date time = new Date();
LambdaQueryWrapper<MemberCard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper
.eq(MemberCard::getUserType, userType)
.eq(MemberCard::getUserId, userId)
.eq(DlBaseEntity::getDelFlag, 0)
.lt(MemberCard::getStartDate, time)
.ge(MemberCard::getEndDate, time)
.orderByDesc(DlBaseEntity::getCreateTime);
List<MemberCard> memberCards = list(lambdaQueryWrapper);
if (memberCards.isEmpty()) {
return 0;
} else {
return rightsService.getReport(memberCards.get(0).getUserId(),memberCards.get(0).getCardId());
}
}
/**
* @param memberRightsMap 会员权益map
* @param item 这个权益

View File

@ -1,7 +1,9 @@
package com.ruoyi.member.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.base.vo.CardRightsVO;
import com.ruoyi.common.config.DlRightsConfig;
import com.ruoyi.member.domain.MemberCard;
import com.ruoyi.member.domain.MemberRights;
import com.ruoyi.member.mapper.MemberRightsMapper;
@ -11,6 +13,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 会员权益(定时任务重置剩余值)用户id会员卡id权益对应1Service业务层处理
@ -22,6 +25,8 @@ import java.util.List;
public class MemberRightsServiceImpl extends ServiceImpl<MemberRightsMapper, MemberRights> implements IMemberRightsService {
@Autowired
private MemberRightsMapper memberRightsMapper;
@Autowired
private DlRightsConfig dlRightsConfig;
/**
@ -49,4 +54,30 @@ public class MemberRightsServiceImpl extends ServiceImpl<MemberRightsMapper, Mem
});
saveBatch(saveList);
}
/**
* 查询报名上限
*
* @param userId 用户id
* @param cardId 卡id
* @return java.lang.Integer
* @author PQZ
* @date 17:15 2025/3/31
**/
@Override
public Integer getReport(Long userId, String cardId) {
LambdaQueryWrapper<MemberRights> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper
.eq(MemberRights::getUserId,userId)
.eq(MemberRights::getCardId,cardId);
List<MemberRights> rights = list(lambdaQueryWrapper);
if (rights.isEmpty()){
return dlRightsConfig.getReport();
} else {
List<MemberRights> filterRights = rights.stream()
.filter(item -> "report".equals(item.getRightsCode()))
.collect(Collectors.toList());
return filterRights.get(0).getRemaining();
}
}
}

View File

@ -103,9 +103,9 @@ public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper, MemberU
//名片信息
result.setBusiCards(busiCardService.queryListByUserId(userId));
//积分
result.setReport(pointsService.getBloggerBalance(userId));
//报名上限
result.setPointsBalance(pointsService.getBloggerBalance(userId));
//报名
result.setReport(cardService.getCardReport(userId,"02"));
//地址信息
result.setAddresses(addressService.listByUserId(userId));
//会员开通记录