|
@@ -9,6 +9,7 @@ import org.jeecg.modules.app.vo.*;
|
|
import org.jeecg.modules.system.app.entity.AppBanner;
|
|
import org.jeecg.modules.system.app.entity.AppBanner;
|
|
import org.jeecg.modules.system.app.entity.AppCourses;
|
|
import org.jeecg.modules.system.app.entity.AppCourses;
|
|
import org.jeecg.modules.system.app.entity.AppInstructor;
|
|
import org.jeecg.modules.system.app.entity.AppInstructor;
|
|
|
|
+import org.jeecg.modules.system.app.entity.AppSearchHot;
|
|
import org.jeecg.modules.system.app.mapper.*;
|
|
import org.jeecg.modules.system.app.mapper.*;
|
|
import org.jeecg.modules.system.entity.SysDepart;
|
|
import org.jeecg.modules.system.entity.SysDepart;
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
@@ -43,6 +44,8 @@ public class AppHomeServiceImpl implements IAppHomeService {
|
|
private AppCategoryMapper appCategoryMapper;
|
|
private AppCategoryMapper appCategoryMapper;
|
|
@Resource
|
|
@Resource
|
|
private AppGameMapper appGameMapper;
|
|
private AppGameMapper appGameMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private AppSearchHotMapper appSearchHotMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public HomeVO homeInfo() {
|
|
public HomeVO homeInfo() {
|
|
@@ -164,6 +167,18 @@ public class AppHomeServiceImpl implements IAppHomeService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Object search(SearchDTO searchDTO) {
|
|
public Object search(SearchDTO searchDTO) {
|
|
|
|
+ AppSearchHot appSearchHot = appSearchHotMapper.selectOne(Wrappers.<AppSearchHot>lambdaQuery()
|
|
|
|
+ .eq(AppSearchHot::getSearchContent, searchDTO.getKeyword())
|
|
|
|
+ .last("LIMIT 1"));
|
|
|
|
+ if(null == appSearchHot){
|
|
|
|
+ appSearchHotMapper.insert(new AppSearchHot()
|
|
|
|
+ .setSearchContent(searchDTO.getKeyword())
|
|
|
|
+ .setSearchCount(1)
|
|
|
|
+ .setIsActive(1)
|
|
|
|
+ .setIsRecommend(0));
|
|
|
|
+ }else {
|
|
|
|
+ appSearchHotMapper.updateById(appSearchHot.setSearchCount(appSearchHot.getSearchCount() + 1));
|
|
|
|
+ }
|
|
switch (searchDTO.getVenueType().charAt(0)) {
|
|
switch (searchDTO.getVenueType().charAt(0)) {
|
|
case '0':
|
|
case '0':
|
|
return convertSearchPlaceVOPage(searchDTO);
|
|
return convertSearchPlaceVOPage(searchDTO);
|
|
@@ -172,10 +187,17 @@ public class AppHomeServiceImpl implements IAppHomeService {
|
|
case '2':
|
|
case '2':
|
|
return convertSearchCompetitionVOPage(searchDTO);
|
|
return convertSearchCompetitionVOPage(searchDTO);
|
|
case '3':
|
|
case '3':
|
|
- return new Page<>();
|
|
|
|
|
|
+ return convertSearchInstructorVOPage(searchDTO);
|
|
}
|
|
}
|
|
return new Page<>();
|
|
return new Page<>();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<AppSearchHot> getHotSearch() {
|
|
|
|
+ return appSearchHotMapper.selectList(Wrappers.<AppSearchHot>lambdaQuery()
|
|
|
|
+ .last("LIMIT 10").orderByDesc(AppSearchHot::getSearchCount));
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @Author SheepHy
|
|
* @Author SheepHy
|
|
* @Description 全局搜索场地分页查询
|
|
* @Description 全局搜索场地分页查询
|
|
@@ -212,10 +234,12 @@ public class AppHomeServiceImpl implements IAppHomeService {
|
|
**/
|
|
**/
|
|
private List<String> getCategoryName(String categoryId) {
|
|
private List<String> getCategoryName(String categoryId) {
|
|
List<String> list = new ArrayList<>();
|
|
List<String> list = new ArrayList<>();
|
|
- String[] split = categoryId.split(",");
|
|
|
|
- Arrays.stream(split).forEach(id -> {
|
|
|
|
- list.add(appCategoryMapper.selectById(id).getName());
|
|
|
|
- });
|
|
|
|
|
|
+ if(null != categoryId){
|
|
|
|
+ String[] split = categoryId.split(",");
|
|
|
|
+ Arrays.stream(split).forEach(id -> {
|
|
|
|
+ list.add(appCategoryMapper.selectById(id).getName());
|
|
|
|
+ });
|
|
|
|
+ }
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -257,12 +281,26 @@ public class AppHomeServiceImpl implements IAppHomeService {
|
|
* @Author SheepHy
|
|
* @Author SheepHy
|
|
* @Description //TODO
|
|
* @Description //TODO
|
|
* @Date 14:43 2025/7/7
|
|
* @Date 14:43 2025/7/7
|
|
- * @Param
|
|
|
|
- * @return
|
|
|
|
|
|
+ * @Param searchDTO {@link SearchDTO}
|
|
|
|
+ * @return Page<SearchVO.SearchInstructorVO>
|
|
**/
|
|
**/
|
|
private Page<SearchVO.SearchInstructorVO> convertSearchInstructorVOPage(SearchDTO searchDTO) {
|
|
private Page<SearchVO.SearchInstructorVO> convertSearchInstructorVOPage(SearchDTO searchDTO) {
|
|
Page<SearchVO.SearchInstructorVO> page = new Page<>(searchDTO.getCurrent(), searchDTO.getSize());
|
|
Page<SearchVO.SearchInstructorVO> page = new Page<>(searchDTO.getCurrent(), searchDTO.getSize());
|
|
-// Page<SearchVO.SearchInstructorVO> searchInstructorVOPage = appInstructorMapper.convertSearchInstructorVOPage(page, searchDTO);
|
|
|
|
- return page;
|
|
|
|
|
|
+ Page<SearchVO.SearchInstructorVO> searchInstructorVOPage = appInstructorMapper.convertSearchInstructorVOPage(page, searchDTO);
|
|
|
|
+ searchInstructorVOPage.getRecords().forEach(instructorVO -> {
|
|
|
|
+ // 获取该教练的课程(最多取2个)
|
|
|
|
+ List<AppCourses> courses = appCoursesMapper.selectList(
|
|
|
|
+ Wrappers.<AppCourses>lambdaQuery().eq(AppCourses::getUserId, instructorVO.getUserId()).last("LIMIT 2"));
|
|
|
|
+ List<SearchVO.SearchCoursesVO> courseInfoVOS = courses.stream()
|
|
|
|
+ .map(course -> {
|
|
|
|
+ SearchVO.SearchCoursesVO vo = new SearchVO.SearchCoursesVO();
|
|
|
|
+ BeanUtils.copyProperties(vo, course);
|
|
|
|
+ return vo;
|
|
|
|
+ })
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ instructorVO.setKm(0.0)
|
|
|
|
+ .setCourseList(courseInfoVOS);
|
|
|
|
+ });
|
|
|
|
+ return searchInstructorVOPage;
|
|
}
|
|
}
|
|
}
|
|
}
|