ソースを参照

Merge remote-tracking branch 'origin/master'

lix 2 週間 前
コミット
5cdec7494c
12 ファイル変更160 行追加40 行削除
  1. 0 14
      national-motion-base-core/src/main/java/org/jeecg/config/NoSwaggerExpand.java
  2. 0 4
      national-motion-base-core/src/main/java/org/jeecg/config/SwaggerExpandAspect.java
  3. 1 0
      national-motion-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  4. 28 2
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/AppHomeController.java
  5. 1 1
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/CommonAppController.java
  6. 10 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/IAppHomeService.java
  7. 47 9
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/AppHomeServiceImpl.java
  8. 16 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/PlaceInfoVO.java
  9. 8 2
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/SearchVO.java
  10. 3 3
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppSearchHot.java
  11. 12 4
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/AppInstructorMapper.java
  12. 34 1
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppInstructorMapper.xml

+ 0 - 14
national-motion-base-core/src/main/java/org/jeecg/config/NoSwaggerExpand.java

@@ -1,14 +0,0 @@
-package org.jeecg.config;
-
-import java.lang.annotation.*;
-
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.PARAMETER})
-public @interface NoSwaggerExpand {
-
-    /**
-     * default swagger expand disable
-     */
-    boolean expand() default false;
-}

+ 0 - 4
national-motion-base-core/src/main/java/org/jeecg/config/SwaggerExpandAspect.java

@@ -1,4 +0,0 @@
-package org.jeecg.config;
-
-public class SwaggerExpandAspect {
-}

+ 1 - 0
national-motion-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -100,6 +100,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/auth/2step-code", "anon");//登录验证码
         filterChainDefinitionMap.put("/sys/common/static/**", "anon");//图片预览 &下载文件不限制token
         filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");//pdf预览
+        filterChainDefinitionMap.put("/app/home/**", "anon");//APP首页接口
 
         filterChainDefinitionMap.put("/app/user/**", "anon");//小程序相关
 

+ 28 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/AppHomeController.java

@@ -6,14 +6,15 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.config.NoSwaggerExpand;
 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.service.IUserService;
 import org.jeecg.modules.app.vo.HomeVO;
 import org.jeecg.modules.app.vo.MsgInfoVO;
 import org.jeecg.modules.app.vo.MsgVO;
 import org.jeecg.modules.app.vo.PlaceVO;
+import org.jeecg.modules.system.app.entity.AppSearchHot;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -68,7 +69,32 @@ public class AppHomeController {
      **/
     @PostMapping("/getPlaceList")
     @Operation(summary = "场地列表查询 词典CODE:venue_type")
-    public Result<Page<PlaceVO>> getPlaceList(@NoSwaggerExpand @RequestBody @Schema(description = "查询参数") GetPlaceListDTO getPlaceListDTO){
+    public Result<Page<PlaceVO>> getPlaceList(@RequestBody(required = true) GetPlaceListDTO getPlaceListDTO){
         return Result.ok(appHomeService.getPlaceList(getPlaceListDTO));
     }
+
+    /**
+     * @Author SheepHy
+     * @Description 全局搜索
+     * @Date 10:37 2025/7/4
+     * @Param
+     * @return
+     **/
+    @PostMapping("/search")
+    @Operation(summary = "全局搜索 词典CODE:search_type")
+    public Result<Object> search(@RequestBody SearchDTO searchDTO){
+        return Result.ok(appHomeService.search(searchDTO));
+    }
+
+    /**
+     * @Author SheepHy
+     * @Description 热词查询
+     * @Date 17:12 2025/7/7
+     * @return List<AppSearchHot>
+     **/
+    @GetMapping("/getHotSearch")
+    @Operation(summary = "热词查询")
+    public Result<List<AppSearchHot>> getHotSearch(){
+        return Result.ok(appHomeService.getHotSearch());
+    }
 }

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/CommonAppController.java

@@ -27,7 +27,7 @@ public class CommonAppController {
      * @param dictCode 要查询的key
      * @return
      */
-    @Operation(description="根据字典code查询字典项")
+    @Operation(summary="根据字典code查询字典项")
     @GetMapping("/getDictItems")
     public List<DictModel> getDictItems(@RequestParam("dictCode") String dictCode) {
         return sysBaseApi.getDictItems(dictCode);

+ 10 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/IAppHomeService.java

@@ -6,6 +6,9 @@ import org.jeecg.modules.app.dto.SearchDTO;
 import org.jeecg.modules.app.vo.AppBannerVO;
 import org.jeecg.modules.app.vo.HomeVO;
 import org.jeecg.modules.app.vo.PlaceVO;
+import org.jeecg.modules.system.app.entity.AppSearchHot;
+
+import java.util.List;
 
 public interface IAppHomeService {
 
@@ -35,4 +38,11 @@ public interface IAppHomeService {
      **/
     Object search(SearchDTO searchDTO);
 
+    /**
+     * @Author SheepHy
+     * @Description 热词查询
+     * @Date 17:12 2025/7/7
+     * @return List<AppSearchHot>
+     **/
+    List<AppSearchHot> getHotSearch();
 }

+ 47 - 9
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/AppHomeServiceImpl.java

@@ -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.AppCourses;
 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.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
@@ -43,6 +44,8 @@ public class AppHomeServiceImpl implements IAppHomeService {
     private AppCategoryMapper appCategoryMapper;
     @Resource
     private AppGameMapper appGameMapper;
+    @Resource
+    private AppSearchHotMapper appSearchHotMapper;
 
     @Override
     public HomeVO homeInfo() {
@@ -164,6 +167,18 @@ public class AppHomeServiceImpl implements IAppHomeService {
 
     @Override
     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)) {
             case '0':
                     return convertSearchPlaceVOPage(searchDTO);
@@ -172,10 +187,17 @@ public class AppHomeServiceImpl implements IAppHomeService {
             case '2':
                     return convertSearchCompetitionVOPage(searchDTO);
             case '3':
-                    return new Page<>();
+                    return convertSearchInstructorVOPage(searchDTO);
         }
         return new Page<>();
     }
+
+    @Override
+    public List<AppSearchHot> getHotSearch() {
+        return appSearchHotMapper.selectList(Wrappers.<AppSearchHot>lambdaQuery()
+                .last("LIMIT 10").orderByDesc(AppSearchHot::getSearchCount));
+    }
+
     /**
      * @Author SheepHy
      * @Description 全局搜索场地分页查询
@@ -212,10 +234,12 @@ public class AppHomeServiceImpl implements IAppHomeService {
      **/
     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());
-        });
+        if(null != categoryId){
+            String[] split = categoryId.split(",");
+            Arrays.stream(split).forEach(id -> {
+                list.add(appCategoryMapper.selectById(id).getName());
+            });
+        }
         return list;
     }
 
@@ -257,12 +281,26 @@ public class AppHomeServiceImpl implements IAppHomeService {
      * @Author SheepHy
      * @Description //TODO 
      * @Date 14:43 2025/7/7
-     * @Param
-     * @return 
+     * @Param searchDTO {@link SearchDTO}
+     * @return Page<SearchVO.SearchInstructorVO>
      **/
     private Page<SearchVO.SearchInstructorVO> convertSearchInstructorVOPage(SearchDTO searchDTO) {
         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;
     }
 }

+ 16 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/PlaceInfoVO.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.app.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@Schema(description="场地详情返回参数")
+public class PlaceInfoVO {
+    @Schema(description = "场地id")
+    private String id;
+
+}

+ 8 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/SearchVO.java

@@ -38,6 +38,8 @@ public class SearchVO{
         private String orgName;
         @Schema(description = "擅长说明")
         private String excelMsg;
+        @Schema(description = "km")
+        private double km;
         @Schema(description = "教学理念")
         private String teachingPhilosophy;
         @Schema(description = "好评率")
@@ -45,9 +47,13 @@ public class SearchVO{
         @Schema(description = "订单数")
         private String orderCount;
         @Schema(description = "授课人数")
-        private String teachingCount;
+        private String classesNumber;
+        @Schema(description = "课程列表ID")
+        private String categoryId;
+        @Schema(hidden = true)
+        private String userId;
         @Schema(description = "课程列表")
-        private List<CourseInfoVO> courseList;
+        private List<SearchCoursesVO> courseList;
     }
     @Data
     @Accessors(chain = true)

+ 3 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppSearchHot.java

@@ -28,13 +28,13 @@ public class AppSearchHot implements Serializable {
     @Schema(description = "id")
     private String id;
     @Schema(description = "搜索次数")
-    private String searchCount;
+    private int searchCount;
     @Schema(description = "搜索内容")
     private String searchContent;
     @Schema(description = "是否启用")
-    private String isActive;
+    private int isActive;
     @Schema(description = "是否推荐")
-    private String isRecommend;
+    private int isRecommend;
     @Schema(description = "关联分类ID")
     private String categoryId;
     @Schema(description = "最后一次搜索用户ID")

+ 12 - 4
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/AppInstructorMapper.java

@@ -1,10 +1,11 @@
 package org.jeecg.modules.system.app.mapper;
 
-import java.util.List;
-
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.app.dto.SearchDTO;
+import org.jeecg.modules.app.vo.SearchVO;
 import org.jeecg.modules.system.app.entity.AppInstructor;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**
  * @Description: 教练表
@@ -13,5 +14,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @Version: V1.0
  */
 public interface AppInstructorMapper extends BaseMapper<AppInstructor> {
-
+    /**
+     * @Author SheepHy
+     * @Description //TODO
+     * @Date 14:43 2025/7/7
+     * @Param searchDTO {@link SearchDTO}
+     * @return Page<SearchVO.SearchInstructorVO>
+     **/
+    Page<SearchVO.SearchInstructorVO> convertSearchInstructorVOPage(@Param("page")Page<SearchVO.SearchInstructorVO> page,@Param("searchDTO")SearchDTO searchDTO);
 }

+ 34 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppInstructorMapper.xml

@@ -1,5 +1,38 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.system.app.mapper.AppInstructorMapper">
-
+    <select id="convertSearchInstructorVOPage" resultType="org.jeecg.modules.app.vo.SearchVO$SearchInstructorVO">
+        SELECT
+            a.id,
+            b.realname AS name,
+            b.avatar,
+            c.depart_name AS orgName,
+            a.excel_msg,
+            a.teaching_philosophy,
+            a.good_rate,
+            a.classes_number,
+            b.id AS userId,
+            COUNT( DISTINCT d.user_id, c2.id ) AS orderCount
+        FROM
+            nm_instructor a
+                LEFT JOIN sys_user b ON a.user_id = b.id
+                LEFT JOIN sys_depart c ON b.org_code = c.org_code
+                LEFT JOIN nm_courses d ON a.user_id = d.user_id
+                LEFT JOIN nm_order_product c2 ON d.user_id = c2.product_id
+        WHERE 1=1
+        <if test="searchDTO.keyword != null and searchDTO.keyword == ''">
+            AND (b.realname LIKE CONCAT('%',#{searchDTO.keyword},'%') OR c.depart_name LIKE CONCAT('%',#{searchDTO.keyword},'%'))
+        </if>
+        GROUP BY
+            a.id,
+            b.realname,
+            b.avatar,
+            userId,
+            c.depart_name,
+            a.excel_msg,
+            a.teaching_philosophy,
+            a.good_rate,
+            a.classes_number
+        ORDER BY orderCount DESC
+    </select>
 </mapper>