This commit is contained in:
张良(004796)
2024-03-06 18:30:52 +08:00
parent 7e1f31ed2f
commit 60293b4a70
19 changed files with 404 additions and 4 deletions

View File

@@ -11,4 +11,5 @@ import com.ruoyi.xq.domain.AgreementSetting;
*/
public interface AgreementSettingService extends IService<AgreementSetting> {
AgreementSetting getAgreementSetting();
}

View File

@@ -11,4 +11,9 @@ import com.ruoyi.xq.domain.UserVip;
*/
public interface UserVipService extends IService<UserVip> {
UserVip getUserVip(Long userId, Integer vipType);
UserVip getUserVipNormal(Long userId, Integer vipType);
UserVip getByUserVipMaster(Long userId);
}

View File

@@ -3,6 +3,8 @@ package com.ruoyi.xq.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.xq.domain.VipPrice;
import java.util.List;
/**
* 会员价格设置Service接口
*
@@ -10,4 +12,5 @@ import com.ruoyi.xq.domain.VipPrice;
* @date 2024-03-04
*/
public interface VipPriceService extends IService<VipPrice> {
List<VipPrice> listByVipType(Integer vipType);
}

View File

@@ -16,5 +16,8 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor
@Service
public class AgreementSettingServiceImpl extends ServiceImpl<AgreementSettingMapper,AgreementSetting> implements AgreementSettingService {
@Override
public AgreementSetting getAgreementSetting() {
return this.getById(1);
}
}

View File

@@ -1,12 +1,18 @@
package com.ruoyi.xq.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.xq.domain.UserVip;
import com.ruoyi.xq.enums.vip.VipStatusEnum;
import com.ruoyi.xq.mapper.UserVipMapper;
import com.ruoyi.xq.service.UserVipService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.Comparator;
import java.util.List;
/**
* VIP用户Service业务层处理
*
@@ -17,4 +23,32 @@ import org.springframework.stereotype.Service;
@Service
public class UserVipServiceImpl extends ServiceImpl<UserVipMapper,UserVip> implements UserVipService {
@Override
public UserVip getUserVip(Long userId, Integer vipType){
return this.getOne(Wrappers.lambdaQuery(UserVip.class)
.eq(UserVip::getUserId, userId)
.eq(UserVip::getVipType, vipType)
.last("limit 1"));
}
@Override
public UserVip getUserVipNormal(Long userId, Integer vipType){
return this.getOne(Wrappers.lambdaQuery(UserVip.class)
.eq(UserVip::getUserId, userId)
.eq(UserVip::getVipType, vipType)
.eq(UserVip::getVipStatus, VipStatusEnum.NORMAL.getCode())
.ge(UserVip::getVipTimeout, LocalDateTime.now())
.last("limit 1"));
}
@Override
public UserVip getByUserVipMaster(Long userId){
List<UserVip> userVipList = this.list(Wrappers.lambdaQuery(UserVip.class)
.eq(UserVip::getUserId, userId)
.eq(UserVip::getVipStatus, VipStatusEnum.NORMAL.getCode())
.ge(UserVip::getVipTimeout, LocalDateTime.now()));
return userVipList.stream().max(Comparator.comparing(UserVip::getVipType)).orElse(null);
}
}

View File

@@ -1,5 +1,6 @@
package com.ruoyi.xq.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.xq.domain.VipPrice;
import com.ruoyi.xq.mapper.VipPriceMapper;
@@ -7,6 +8,8 @@ import com.ruoyi.xq.service.VipPriceService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 会员价格设置Service业务层处理
*
@@ -17,4 +20,9 @@ import org.springframework.stereotype.Service;
@Service
public class VipPriceServiceImpl extends ServiceImpl<VipPriceMapper,VipPrice> implements VipPriceService {
@Override
public List<VipPrice> listByVipType(Integer vipType) {
return this.list(Wrappers.lambdaQuery(VipPrice.class).eq(VipPrice::getVipType,vipType)
.orderByAsc(VipPrice::getVipTime));
}
}