|
|
|
@@ -1,6 +1,7 @@
|
|
|
|
package com.peanut.modules.sociology.service.impl;
|
|
|
|
package com.peanut.modules.sociology.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
@@ -10,9 +11,12 @@ import com.peanut.common.utils.ShiroUtils;
|
|
|
|
import com.peanut.modules.book.service.ShopProductService;
|
|
|
|
import com.peanut.modules.book.service.ShopProductService;
|
|
|
|
import com.peanut.modules.common.dao.*;
|
|
|
|
import com.peanut.modules.common.dao.*;
|
|
|
|
import com.peanut.modules.common.entity.*;
|
|
|
|
import com.peanut.modules.common.entity.*;
|
|
|
|
|
|
|
|
import com.peanut.modules.common.service.CourseMedicineService;
|
|
|
|
|
|
|
|
import com.peanut.modules.common.service.CourseToMedicineService;
|
|
|
|
import com.peanut.modules.common.service.MyUserService;
|
|
|
|
import com.peanut.modules.common.service.MyUserService;
|
|
|
|
import com.peanut.modules.common.service.UserVipService;
|
|
|
|
import com.peanut.modules.common.service.UserVipService;
|
|
|
|
import com.peanut.modules.common.to.ParamTo;
|
|
|
|
import com.peanut.modules.common.to.ParamTo;
|
|
|
|
|
|
|
|
import com.peanut.modules.master.service.CourseMedicalService;
|
|
|
|
import com.peanut.modules.sociology.service.CourseService;
|
|
|
|
import com.peanut.modules.sociology.service.CourseService;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
@@ -52,6 +56,10 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|
|
|
private UserVipDao userVipDao;
|
|
|
|
private UserVipDao userVipDao;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private UserCourseBuyLogDao userCourseBuyLogDao;
|
|
|
|
private UserCourseBuyLogDao userCourseBuyLogDao;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private CourseToMedicineService courseToMedicineService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private CourseMedicineService courseMedicineService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据标签获取课程列表
|
|
|
|
//根据标签获取课程列表
|
|
|
|
@@ -117,7 +125,14 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|
|
|
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper);
|
|
|
|
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper);
|
|
|
|
return courseEntityPage;
|
|
|
|
return courseEntityPage;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public CourseMedicine getCourseMedicinePid(int medicineId){
|
|
|
|
|
|
|
|
CourseMedicine courseMedicine = courseMedicineService.getById(medicineId);
|
|
|
|
|
|
|
|
if(courseMedicine.getPid()==0){
|
|
|
|
|
|
|
|
return courseMedicine;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
return getCourseMedicinePid(courseMedicine.getPid());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> getCourseDetail(Integer id) {
|
|
|
|
public Map<String, Object> getCourseDetail(Integer id) {
|
|
|
|
Map<String, Object> flag = new HashMap<>();
|
|
|
|
Map<String, Object> flag = new HashMap<>();
|
|
|
|
@@ -163,6 +178,26 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryWrapper<CourseToMedicine> courseToMedicineWrapper = new QueryWrapper<CourseToMedicine>();
|
|
|
|
|
|
|
|
courseToMedicineWrapper.eq("course_id",course.getId());
|
|
|
|
|
|
|
|
List<CourseToMedicine> courseToMedicineList = courseToMedicineService.list(courseToMedicineWrapper);
|
|
|
|
|
|
|
|
String content = course.getContent();
|
|
|
|
|
|
|
|
List<Integer> medicinePids = new ArrayList<>();
|
|
|
|
|
|
|
|
for (CourseToMedicine courseToMedicine:courseToMedicineList){
|
|
|
|
|
|
|
|
CourseMedicine courseMedicine = getCourseMedicinePid(courseToMedicine.getMedicalId());
|
|
|
|
|
|
|
|
if(medicinePids.contains(courseMedicine.getId())){
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(courseMedicine!=null && courseMedicine.getId()==1){
|
|
|
|
|
|
|
|
content = content+"<img src=\"https://ehh-public-01.oss-cn-beijing.aliyuncs.com/image/zhong-yi-xue-ke-cheng-biao.jpg\"/>";
|
|
|
|
|
|
|
|
}else if(courseMedicine!=null && courseMedicine.getId()==74){
|
|
|
|
|
|
|
|
content = content+"<img src=\"https://ehh-public-01.oss-cn-beijing.aliyuncs.com/image/hui-tong-ke-cheng-biao.jpg\"/>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(courseMedicine!=null){
|
|
|
|
|
|
|
|
medicinePids.add(courseMedicine.getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
course.setContent(content);
|
|
|
|
flag.put("course",course);
|
|
|
|
flag.put("course",course);
|
|
|
|
//课程关联商品
|
|
|
|
//课程关联商品
|
|
|
|
if (StringUtils.isNotEmpty(course.getRelationProductIds())){
|
|
|
|
if (StringUtils.isNotEmpty(course.getRelationProductIds())){
|
|
|
|
|