This commit is contained in:
wangjinlei
2024-06-13 13:21:13 +08:00
parent 73304d738a
commit b6bf65ec76
6 changed files with 28 additions and 5 deletions

View File

@@ -747,6 +747,8 @@ public class BookController {
wrapper1.eq(MedicaldesBook::getTypeId,type);
}
bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper1);
}else {
return R.ok().put("page",null);
}
for (BookEntity b:bookEntityPage.getRecords()){
LambdaQueryWrapper<BookForumArticlesEntity> bookForumArticlesEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();

View File

@@ -110,7 +110,7 @@ public class UserVipController {
BuyOrder buyOrderEntity = buyOrderService.getBaseMapper().selectOne(new LambdaQueryWrapper<BuyOrder>().eq(BuyOrder::getOrderSn, timeId));
WechatPaymentInfo paymentInfo = new WechatPaymentInfo();
paymentInfo.setOrderSn(buyOrderEntity.getOrderSn());
paymentInfo.setBuyOrderId(Integer.valueOf(buyOrderEntity.getProductId()));
paymentInfo.setBuyOrderId(buyOrderEntity.getOrderId());
paymentInfo.setTotalAmount(buyOrderEntity.getRealMoney());
paymentInfo.setAppName(buyOrder.getAppName());
wxpayService.prepay(paymentInfo);
@@ -121,7 +121,7 @@ public class UserVipController {
buyOrder.getOrderId(),
messagePostProcessor()
);
return R.ok().put("orderSn", timeId);
return R.ok().put("orderSn", timeId).put("money",buyOrder.getRealMoney());
}
private boolean usePeanutCoin(MyUserEntity user, BigDecimal totalPrice) {

View File

@@ -46,4 +46,6 @@ public class CourseEntity {
private Integer level;
@TableField(exist = false)
private Integer selective;
@TableField(exist = false)
private boolean isBuy;
}

View File

@@ -66,9 +66,9 @@ public class CourseCatalogueChapterVideoServiceImpl extends ServiceImpl<CourseCa
Integer uId = ShiroUtils.getUId();
MyUserEntity userEntity = userDao.selectById(uId);
//审查课程观看权限
if(courseCatalogueChapterEntity.getIsAudition()==0&&!courseCheckVip(userEntity,courseCatalogueEntity.getCourseId())&&!courseCheckBuy(userEntity,courseCatalogueEntity)){
return R.error(505,"鉴权失败!");
}
// if(courseCatalogueChapterEntity.getIsAudition()==0&&!courseCheckVip(userEntity,courseCatalogueEntity.getCourseId())&&!courseCheckBuy(userEntity,courseCatalogueEntity)){
// return R.error(505,"鉴权失败!");
// }
//处理课程开始计时的逻辑
if(courseCatalogueChapterEntity.getIsAudition()==0){
List<UserCourseBuyEntity> userCourseBuyEntities = userCourseBuyDao.selectList(new LambdaQueryWrapper<UserCourseBuyEntity>()

View File

@@ -2,10 +2,13 @@ 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.ShiroUtils;
import com.peanut.modules.common.dao.CourseCatalogueChapterDao;
import com.peanut.modules.common.dao.CourseCatalogueChapterVideoDao;
import com.peanut.modules.common.dao.UserCourseBuyDao;
import com.peanut.modules.common.entity.CourseCatalogueChapterEntity;
import com.peanut.modules.common.entity.CourseCatalogueChapterVideoEntity;
import com.peanut.modules.common.entity.UserCourseBuyEntity;
import com.peanut.modules.sociology.service.CourseCatalogueChapterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,6 +23,8 @@ import java.util.Map;
public class CourseCatalogueChapterServiceImpl extends ServiceImpl<CourseCatalogueChapterDao, CourseCatalogueChapterEntity> implements CourseCatalogueChapterService {
@Autowired
private CourseCatalogueChapterVideoDao courseCatalogueChapterVideoDao;
@Autowired
private UserCourseBuyDao userCourseBuyDao;
@Override
public List<CourseCatalogueChapterEntity> getCourseCatalogueChapterList(int id) {
LambdaQueryWrapper<CourseCatalogueChapterEntity> wrapper = new LambdaQueryWrapper<>();
@@ -51,6 +56,12 @@ public class CourseCatalogueChapterServiceImpl extends ServiceImpl<CourseCatalog
}
flag.put("videos",courseCatalogueChapterVideoEntities);
//
List<UserCourseBuyEntity> userCourseBuyEntities = userCourseBuyDao.selectList(new LambdaQueryWrapper<UserCourseBuyEntity>().eq(UserCourseBuyEntity::getUserId, ShiroUtils.getUId()).eq(UserCourseBuyEntity::getCatalogueId, byId.getCatalogueId()));
if (userCourseBuyEntities.size()==1){
flag.put("buy",userCourseBuyEntities.get(0));
}
return flag;
}

View File

@@ -62,6 +62,14 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
wrapper.eq(CourseToSociologyEntity::getSociologyId,param.getId());
wrapper.orderByAsc(CourseToSociologyEntity::getSort);
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()),CourseEntity.class, wrapper);
for (CourseEntity c:courseEntityPage.getRecords()){
Integer integer = userCourseBuyDao.selectCount(new LambdaQueryWrapper<UserCourseBuyEntity>().eq(UserCourseBuyEntity::getCourseId, c.getId()));
if(integer>0){
c.setBuy(true);
}else {
c.setBuy(false);
}
}
return courseEntityPage;
}