mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 19:06:49 +08:00
Merge branch 'stat' of https://codeup.aliyun.com/6265f483e4166464dc2f9c14/boeu/baseservers into stat
This commit is contained in:
@@ -293,5 +293,10 @@ public interface ICourseService {
|
||||
List<Course> ids(List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 查询出三条关联兴趣爱好的数据
|
||||
* */
|
||||
List<Course> userHobbyList(String aid);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -923,6 +924,31 @@ public class CourseServiceImpl implements ICourseService {
|
||||
return courses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Course> userHobbyList(String aid) {
|
||||
List<Course> courses = new ArrayList<>();
|
||||
if(StringUtil.isNotBlank(aid)){
|
||||
String sql="select ref_id from boe_user_hobby where aid='"+aid+"'";
|
||||
List<Object> list = courseDao.sqlFindList(sql);
|
||||
//课程id集合
|
||||
List<String> strings = new ArrayList<>();
|
||||
for (Object o:list) {
|
||||
strings.add((String) o);
|
||||
}
|
||||
QueryBuilder builder = QueryBuilder.from(Course.class);
|
||||
builder.setPageSize(3);
|
||||
List<IFieldFilter> iFieldFilters = new ArrayList<>();
|
||||
iFieldFilters.add(FieldFilters.in("sysType1",strings));
|
||||
iFieldFilters.add(FieldFilters.in("sysType2",strings));
|
||||
iFieldFilters.add(FieldFilters.in("sysType3",strings));
|
||||
builder.addFilter(FieldFilters.or(iFieldFilters));
|
||||
courses=courseDao.findList(builder.builder());
|
||||
}
|
||||
return courses;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countWaitAudit(String aid) {
|
||||
//查询待审核的课程
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
package com.xboe.school.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
import com.xboe.module.article.entity.Article;
|
||||
import com.xboe.module.article.service.IArticleService;
|
||||
import com.xboe.module.boecase.service.ICasesService;
|
||||
import com.xboe.module.course.dto.CourseQueryDto;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.course.entity.CourseTeacher;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.qa.entity.Question;
|
||||
import com.xboe.module.qa.service.IQuestionService;
|
||||
import com.xboe.school.vo.CasesVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -31,6 +39,8 @@ import com.xboe.system.user.service.IUserService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 门户首页接口
|
||||
*
|
||||
@@ -49,6 +59,9 @@ public class PortalIndexApi extends ApiBaseController{
|
||||
@Autowired
|
||||
IQuestionService questionService;
|
||||
|
||||
@Resource
|
||||
ICourseService courseService;
|
||||
|
||||
/**
|
||||
* 首页案例数据
|
||||
* @return
|
||||
@@ -121,4 +134,51 @@ public class PortalIndexApi extends ApiBaseController{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*推荐课程
|
||||
* */
|
||||
@PostMapping("/courselist")
|
||||
public JsonResponse<PageList<Course>> courseList(Pagination pager, CourseQueryDto dto){
|
||||
|
||||
dto.setPublish(true);
|
||||
dto.setYearFilter(true);
|
||||
PageList<Course> coursePageList = courseService.findSimplePage(pager.getPageIndex(), pager.getPageSize(),dto);
|
||||
|
||||
String aid = this.getCurrent().getAccountId();
|
||||
List<Course> courses = courseService.userHobbyList(aid);
|
||||
|
||||
//计算下标,
|
||||
int i=0;
|
||||
if(!courses.isEmpty()){
|
||||
for (Course c:courses) {
|
||||
coursePageList.getList().set(i,c);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
//提取教师信息
|
||||
List<String> ids=new ArrayList<String>();
|
||||
|
||||
|
||||
for(Course c :coursePageList.getList()) {
|
||||
ids.add(c.getId());
|
||||
}
|
||||
List<CourseTeacher> teachers = courseService.findTeachersByCourseIds(ids);
|
||||
//注意对于多个教师的情况,这里只是设置第一个教师
|
||||
for(Course c :coursePageList.getList()) {
|
||||
for(CourseTeacher ct : teachers) {
|
||||
if(ct.getCourseId().equals(c.getId())) {
|
||||
c.setSysCreateAid(ct.getTeacherId());
|
||||
c.setSysCreateBy(ct.getTeacherName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return success(coursePageList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user