vip的相关
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
package com.peanut.modules.sociology.controller;
|
package com.peanut.modules.sociology.controller;
|
||||||
|
|
||||||
|
import com.peanut.common.utils.R;
|
||||||
|
import com.peanut.modules.sociology.service.VipService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -8,6 +11,12 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController("sociologyUser")
|
@RestController("sociologyUser")
|
||||||
@RequestMapping("sociology/user")
|
@RequestMapping("sociology/user")
|
||||||
public class UserController {
|
public class UserController {
|
||||||
|
@Autowired
|
||||||
|
private VipService vipService;
|
||||||
|
|
||||||
|
@RequestMapping("/getVipProductForUser")
|
||||||
|
public R getVipProductForUser(){
|
||||||
|
return vipService.getVipProductForUser();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.peanut.modules.sociology.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.peanut.common.utils.R;
|
||||||
|
import com.peanut.modules.common.entity.VipBuyConfigEntity;
|
||||||
|
|
||||||
|
public interface VipService extends IService<VipBuyConfigEntity> {
|
||||||
|
R getVipProductForUser();
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.peanut.modules.sociology.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.peanut.common.utils.R;
|
||||||
|
import com.peanut.common.utils.ShiroUtils;
|
||||||
|
import com.peanut.modules.common.dao.MyUserDao;
|
||||||
|
import com.peanut.modules.common.dao.VipBuyConfigDao;
|
||||||
|
import com.peanut.modules.common.entity.MyUserEntity;
|
||||||
|
import com.peanut.modules.common.entity.VipBuyConfigEntity;
|
||||||
|
import com.peanut.modules.sociology.service.VipService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service("sociologyUserService")
|
||||||
|
public class VipServiceImpl extends ServiceImpl<VipBuyConfigDao, VipBuyConfigEntity> implements VipService {
|
||||||
|
@Autowired
|
||||||
|
private MyUserDao myUserDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取国学vip商品
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R getVipProductForUser() {
|
||||||
|
int uid = ShiroUtils.getUId();
|
||||||
|
MyUserEntity userEntity = myUserDao.selectById(uid);
|
||||||
|
//获取超v列表
|
||||||
|
LambdaQueryWrapper<VipBuyConfigEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(VipBuyConfigEntity::getType, 1);
|
||||||
|
wrapper.and(r->r.eq(VipBuyConfigEntity::getDateType,0).or(f->f.eq(VipBuyConfigEntity::getDateType,1).lt(VipBuyConfigEntity::getStartTime,new Date()).gt(VipBuyConfigEntity::getEndTime,new Date())));
|
||||||
|
List<VipBuyConfigEntity> vipBuyConfigEntities = this.getBaseMapper().selectList(wrapper);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return R.ok().put("list",vipBuyConfigEntities);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user