This commit is contained in:
wangjinlei
2024-04-30 09:17:58 +08:00
parent 97e9aecd68
commit 871fc79cca
8 changed files with 34 additions and 8 deletions

View File

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
import com.peanut.config.Constants;
@@ -831,7 +830,7 @@ public class BuyOrderController {
* @param totalPrice
* @return
*/
private boolean usePeanutCoin(MyUserEntity user, BigDecimal totalPrice,boolean sj_check,boolean scqq_check,boolean wylq_check,boolean prescript_b_check) {
private boolean usePeanutCoin(MyUserEntity user, BigDecimal totalPrice, boolean sj_check, boolean scqq_check, boolean wylq_check, boolean prescript_b_check) {
if (user.getPeanutCoin().compareTo(totalPrice) >= 0) {
user.setPeanutCoin(user.getPeanutCoin().subtract(totalPrice));
if (sj_check){

View File

@@ -355,7 +355,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
public Page<BuyOrder> orderList(BuyOrderListRequestVo requestVo) {
MPJLambdaWrapper<BuyOrder> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(BuyOrder.class);
wrapper.leftJoin(MyUserEntity.class,MyUserEntity::getId,BuyOrder::getUserId);
wrapper.leftJoin(MyUserEntity.class, MyUserEntity::getId,BuyOrder::getUserId);
wrapper.eq(StringUtils.isNotBlank(requestVo.getOrderStatus()),BuyOrder::getOrderStatus,requestVo.getOrderStatus());
wrapper.eq(BuyOrder::getOrderType,"order");
wrapper.gt(requestVo.getStartTime()!=null,BuyOrder::getCreateTime,requestVo.getStartTime());

View File

@@ -436,7 +436,7 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
public boolean checkUserTelOrEmail(MyUserEntity user) {
LambdaQueryWrapper<MyUserEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.ne(MyUserEntity::getId,user.getId());
wrapper.and(l->l.eq(StringUtils.isNotBlank(user.getTel()),MyUserEntity::getTel,user.getTel()).or().eq(StringUtils.isNotBlank(user.getEmail()),MyUserEntity::getEmail,user.getEmail()));
wrapper.and(l->l.eq(StringUtils.isNotBlank(user.getTel()), MyUserEntity::getTel,user.getTel()).or().eq(StringUtils.isNotBlank(user.getEmail()), MyUserEntity::getEmail,user.getEmail()));
MyUserEntity one = getOne(wrapper);
return one == null;
}

View File

@@ -34,4 +34,6 @@ public class CourseEntity {
private List<CourseCatalogueEntity> courseCatalogueEntityList;
@TableField(exist = false)
private Integer bindId;
@TableField(exist = false)
private Date endTime;
}

View File

@@ -37,7 +37,7 @@ public class UserVipController {
public R listByPage(@RequestBody Map<String, Object> params) {
MPJLambdaWrapper<UserVip> wrapper = new MPJLambdaWrapper();
wrapper.selectAll(UserVip.class);
wrapper.leftJoin(MyUserEntity.class,MyUserEntity::getId, UserVip::getUserId);
wrapper.leftJoin(MyUserEntity.class, MyUserEntity::getId, UserVip::getUserId);
if (params.containsKey("userName")&& StringUtils.isNotEmpty(params.get("userName").toString())) {
wrapper.eq(MyUserEntity::getName,params.get("userName"));
}

View File

@@ -134,4 +134,10 @@ public class CourseController {
return R.ok().put("video",courseCatalogueChapterVideoEntity);
}
@RequestMapping("/getMyCourse")
public R getMyCourse(@RequestBody Map<String,Integer> map){
List<CourseEntity> courses = courseService.getMyCourse(map.get("type"));
return R.ok().put("courses",courses);
}
}

View File

@@ -22,5 +22,5 @@ public interface CourseService extends IService<CourseEntity> {
Map<String, Object> getCourseDetail(Integer id);
List<CourseEntity> getMyCourse(int type);
}

View File

@@ -7,22 +7,24 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.ShiroUtils;
import com.peanut.modules.common.dao.*;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.service.MyUserService;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.sociology.service.CourseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Slf4j
@Service("sociologyCourseService")
public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> implements CourseService {
@Autowired
private MyUserService userService;
@Autowired
private UserToCourseDao userToCourseDao;
@Autowired
@@ -99,6 +101,23 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
return flag;
}
@Override
public List getMyCourse(int type) {
Integer uId = ShiroUtils.getUId();
MyUserEntity userEntity = userService.getById(uId);
if(userEntity.getVip()!="0"){
}
MPJLambdaWrapper<UserCourseBuyEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.select(UserCourseBuyEntity::getEndTime);
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,UserCourseBuyEntity::getCourseId);
wrapper.eq(UserCourseBuyEntity::getUserId,uId);
wrapper.gt(UserCourseBuyEntity::getEndTime,new Date());
List<CourseEntity> courseEntities = userCourseBuyDao.selectJoinList(CourseEntity.class, wrapper);
return courseEntities;
}
private Integer catalogueCompletion(CourseCatalogueEntity c){
List<CourseCatalogueChapterEntity> courseCatalogueChapterEntities = courseCatalogueChapterDao.selectList(new LambdaQueryWrapper<CourseCatalogueChapterEntity>().eq(CourseCatalogueChapterEntity::getCatalogueId, c.getId()));
Integer act = 0;