|
@@ -3,6 +3,7 @@ package org.jeecg.modules.app.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import org.jeecg.modules.app.dto.GetPlaceListDTO;
|
|
|
+import org.jeecg.modules.app.dto.SearchDTO;
|
|
|
import org.jeecg.modules.app.service.IAppHomeService;
|
|
|
import org.jeecg.modules.app.vo.*;
|
|
|
import org.jeecg.modules.system.app.entity.AppBanner;
|
|
@@ -142,18 +143,13 @@ public class AppHomeServiceImpl implements IAppHomeService {
|
|
|
Page<PlaceVO> page = new Page<>(getPlaceListDTO.getCurrent(), getPlaceListDTO.getSize());
|
|
|
Page<PlaceVO> placeList = appSiteMapper.getPlaceList(page, getPlaceListDTO.getVenueType());
|
|
|
placeList.getRecords().forEach(placeVO -> {
|
|
|
- List<String> list = new ArrayList<>();
|
|
|
- String[] split = placeVO.getCategoryId().split(",");
|
|
|
- Arrays.stream(split).forEach(id -> {
|
|
|
- list.add(appCategoryMapper.selectById(id).getName());
|
|
|
- });
|
|
|
//todo 待申请第三方地图接口
|
|
|
placeVO.setKm(0.0)
|
|
|
- .setCategory(list);
|
|
|
+ .setCategory(getCategoryName(placeVO.getCategoryId()));
|
|
|
});
|
|
|
- if(getPlaceListDTO.getVenueType().equals("1")
|
|
|
- || getPlaceListDTO.getVenueType().equals("2")
|
|
|
- || getPlaceListDTO.getVenueType().equals("3")){
|
|
|
+ if(getPlaceListDTO.getVenueType().equals("0-2")
|
|
|
+ || getPlaceListDTO.getVenueType().equals("1-1")
|
|
|
+ || getPlaceListDTO.getVenueType().equals("2-1")){
|
|
|
// 按 km 升序排序(从近到远)
|
|
|
placeList.getRecords().sort((p1, p2) -> {
|
|
|
Double km1 = p1.getKm();
|
|
@@ -163,4 +159,79 @@ public class AppHomeServiceImpl implements IAppHomeService {
|
|
|
}
|
|
|
return placeList;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object search(SearchDTO searchDTO) {
|
|
|
+ switch (searchDTO.getVenueType().charAt(0)) {
|
|
|
+ case '0':
|
|
|
+ return convertSearchPlaceVOPage(searchDTO);
|
|
|
+ case '1':
|
|
|
+ return convertSearchTrainVOPage(searchDTO);
|
|
|
+ case '2':
|
|
|
+ return new Page<>();
|
|
|
+ case '3':
|
|
|
+ return new Page<>();
|
|
|
+ }
|
|
|
+ return new Page<>();
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 全局搜索场地分页查询
|
|
|
+ * @Date 11:05 2025/7/7
|
|
|
+ * @Param searchDTO {@link SearchDTO}
|
|
|
+ * @return Page<SearchVO.SearchPlaceVO>
|
|
|
+ **/
|
|
|
+ private Page<SearchVO.SearchPlaceVO> convertSearchPlaceVOPage(SearchDTO searchDTO) {
|
|
|
+ Page<SearchVO.SearchPlaceVO> page = new Page<>(searchDTO.getCurrent(), searchDTO.getSize());
|
|
|
+ Page<SearchVO.SearchPlaceVO> searchPlaceVOPage = appSiteMapper.convertSearchPlaceVOPage(page, searchDTO);
|
|
|
+ searchPlaceVOPage.getRecords().forEach(placeVO -> {
|
|
|
+ //todo 待申请第三方地图接口
|
|
|
+ placeVO.setKm(0.0)
|
|
|
+ .setCategory(getCategoryName(placeVO.getCategoryId()));
|
|
|
+ });
|
|
|
+ if(searchDTO.getVenueType().equals("0-2")
|
|
|
+ || searchDTO.getVenueType().equals("1-1")
|
|
|
+ || searchDTO.getVenueType().equals("2-1")){
|
|
|
+ // 按 km 升序排序(searchDTO)
|
|
|
+ searchPlaceVOPage.getRecords().sort((p1, p2) -> {
|
|
|
+ Double km1 = p1.getKm();
|
|
|
+ Double km2 = p2.getKm();
|
|
|
+ return km1.compareTo(km2);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return searchPlaceVOPage;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 根据类目ID获取完整的类目名称
|
|
|
+ * @Date 13:31 2025/7/7
|
|
|
+ * @Param categoryId 类目ID
|
|
|
+ * @return List<String>
|
|
|
+ **/
|
|
|
+ private List<String> getCategoryName(String categoryId) {
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ String[] split = categoryId.split(",");
|
|
|
+ Arrays.stream(split).forEach(id -> {
|
|
|
+ list.add(appCategoryMapper.selectById(id).getName());
|
|
|
+ });
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 培训课程分页查询
|
|
|
+ * @Date 13:37 2025/7/7
|
|
|
+ * @Param
|
|
|
+ * @return
|
|
|
+ **/
|
|
|
+ private Page<SearchVO.SearchTrainVO> convertSearchTrainVOPage(SearchDTO searchDTO) {
|
|
|
+ Page<SearchVO.SearchTrainVO> page = new Page<>(searchDTO.getCurrent(), searchDTO.getSize());
|
|
|
+ Page<SearchVO.SearchTrainVO> searchTrainVOPage = appCoureseMapper.convertSearchTrainVOPage(page, searchDTO);
|
|
|
+ searchTrainVOPage.getRecords().forEach(trainVO -> {
|
|
|
+ //todo 待申请第三方地图接口
|
|
|
+ trainVO.setKm(0.0);
|
|
|
+ });
|
|
|
+ return searchTrainVOPage;
|
|
|
+ }
|
|
|
+
|
|
|
}
|