迁移数据增加妇幼生殖,我的课程修改
This commit is contained in:
@@ -567,6 +567,7 @@ public class UserController {
|
||||
case 7: type = "国学vip";break;
|
||||
case 8: type = "心理学vip";break;
|
||||
case 9: type = "中西汇通vip";break;
|
||||
case 10: type = "妇幼生殖vip";break;
|
||||
}
|
||||
uvSb.append(type + "-开始时间" + DateUtil.format(uv.getStartTime(),"yyyy-MM-dd HH:mm:ss")
|
||||
+ "结束时间" + DateUtil.format(uv.getEndTime(),"yyyy-MM-dd HH:mm:ss") + "\n");
|
||||
|
||||
@@ -187,26 +187,43 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
||||
.stream().map(UserCourseBuyEntity::getCourseId).collect(Collectors.toList());
|
||||
if (list.size()>0&&buyList.size()>0){
|
||||
wrapper.and(t->t.in(CourseToMedicine::getMedicalId,list).or().in(CourseToMedicine::getCourseId,buyList));
|
||||
}else {
|
||||
if (list.size()>0){
|
||||
wrapper.in(CourseToMedicine::getMedicalId,list);
|
||||
}else if (buyList.size()>0){
|
||||
wrapper.in(CourseToMedicine::getCourseId,buyList);
|
||||
}else {
|
||||
return new Page<>();
|
||||
}else if (list.size()>0){
|
||||
wrapper.in(CourseToMedicine::getMedicalId,list);
|
||||
}else if (buyList.size()>0){
|
||||
wrapper.in(CourseToMedicine::getCourseId,buyList);
|
||||
}
|
||||
long page = Long.parseLong(param.get("page").toString());
|
||||
int limit = Integer.parseInt(param.get("limit").toString());
|
||||
Page<CourseEntity> courseEntityPage;
|
||||
List<CourseEntity> courseEntities;
|
||||
if (list.size()>0||buyList.size()>0){
|
||||
if (StringUtils.isNotEmpty(param.get("medicalId").toString())){
|
||||
wrapper.eq(CourseToMedicine::getMedicalId,param.get("medicalId"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(param.get("title").toString())){
|
||||
wrapper.like(CourseEntity::getTitle,param.get("title"));
|
||||
}
|
||||
wrapper.distinct();
|
||||
wrapper.selectAll(CourseEntity.class);
|
||||
wrapper.orderByAsc(CourseEntity::getSort);
|
||||
courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(page, limit), CourseEntity.class, wrapper);
|
||||
courseEntities = courseEntityPage.getRecords();
|
||||
}else {
|
||||
courseEntityPage = new Page<>(page, limit);
|
||||
courseEntities = new ArrayList<>();
|
||||
}
|
||||
if (StringUtils.isNotEmpty(param.get("medicalId").toString())){
|
||||
wrapper.eq(CourseToMedicine::getMedicalId,param.get("medicalId"));
|
||||
if(courseEntities.size()<limit){
|
||||
Map<String, Object> sociologyParam = new HashMap<>(param);
|
||||
if (list.size()==0&&buyList.size()==0){
|
||||
//无医学课程,直接查国学分页
|
||||
}else {
|
||||
sociologyParam.put("page", 1);
|
||||
sociologyParam.put("limit", limit - courseEntities.size());
|
||||
sociologyParam.put("excludeIds", courseEntities.stream().map(CourseEntity::getId).collect(Collectors.toList()));
|
||||
}
|
||||
courseEntities.addAll(getUserSociologyCourse(sociologyParam));
|
||||
courseEntityPage.setRecords(courseEntities);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(param.get("title").toString())){
|
||||
wrapper.like(CourseEntity::getTitle,param.get("title"));
|
||||
}
|
||||
wrapper.distinct();
|
||||
wrapper.selectAll(CourseEntity.class);
|
||||
wrapper.orderByAsc(CourseEntity::getSort);
|
||||
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(Long.parseLong(param.get("page").toString()), Long.parseLong(param.get("limit").toString())), CourseEntity.class, wrapper);
|
||||
List<CourseEntity> courseEntities = courseEntityPage.getRecords();
|
||||
for (CourseEntity co:courseEntities){
|
||||
int i = studyingDao.selectCount(new LambdaQueryWrapper<UserCourseStudying>()
|
||||
.eq(UserCourseStudying::getCourseId,co.getId())
|
||||
@@ -245,7 +262,49 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
||||
}
|
||||
return courseEntityPage;
|
||||
}
|
||||
public List<CourseEntity> getUserSociologyCourse(Map<String, Object> param){
|
||||
|
||||
log.info("=======getUserSociologyCourse===in====",param);
|
||||
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.rightJoin(CourseToSociologyEntity.class,CourseToSociologyEntity::getCourseId,CourseEntity::getId);
|
||||
//开通的会员下的课程
|
||||
List list = new ArrayList<>();//通过顶级标签获取最下层标签
|
||||
if (userVipService.isSociologyVip(ShiroUtils.getUId())){
|
||||
userVipService.bottomLabel(7,list);
|
||||
}
|
||||
//购买的课程
|
||||
List buyList = userCourseBuyDao.selectList(new LambdaQueryWrapper<UserCourseBuyEntity>()
|
||||
.eq(UserCourseBuyEntity::getUserId,ShiroUtils.getUId()))
|
||||
.stream().map(UserCourseBuyEntity::getCourseId).collect(Collectors.toList());
|
||||
if (list.size()>0&&buyList.size()>0){
|
||||
wrapper.and(t->t.in(CourseToSociologyEntity::getSociologyId,list).or().in(CourseToSociologyEntity::getCourseId,buyList));
|
||||
}else {
|
||||
if (list.size()>0){
|
||||
wrapper.in(CourseToSociologyEntity::getSociologyId,list);
|
||||
}else if (buyList.size()>0){
|
||||
wrapper.in(CourseToSociologyEntity::getCourseId,buyList);
|
||||
}else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(param.get("medicalId").toString())){
|
||||
wrapper.eq(CourseToSociologyEntity::getSociologyId,param.get("medicalId"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(param.get("title").toString())){
|
||||
wrapper.like(CourseEntity::getTitle,param.get("title"));
|
||||
}
|
||||
if (param.get("excludeIds") != null){
|
||||
List excludeIds = (List) param.get("excludeIds");
|
||||
if (excludeIds.size()>0){
|
||||
wrapper.notIn(CourseEntity::getId,excludeIds);
|
||||
}
|
||||
}
|
||||
wrapper.distinct();
|
||||
wrapper.selectAll(CourseEntity.class);
|
||||
wrapper.orderByAsc(CourseEntity::getSort);
|
||||
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(Long.parseLong(param.get("page").toString()), Long.parseLong(param.get("limit").toString())), CourseEntity.class, wrapper);
|
||||
return courseEntityPage.getRecords();
|
||||
}
|
||||
@Override
|
||||
public List getCourseExpire(Map<String, Object> param) {
|
||||
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
|
||||
Reference in New Issue
Block a user