Explorar el Código

feat(app): 新增门店详情信息查询功能

- 新增 IDetailService 接口和 DetailServiceImpl 实现类
- 在 AppSiteMapper 中添加 getPlaceInfo 方法
- 新增 PlaceInfoVO 类用于门店详情信息的返回
- 优化 CommonAppController 中的 getDictItems 方法
- 重构 AppHomeServiceImpl 中的 convertToCoureseVOList 方法
SheepHy hace 2 semanas
padre
commit
3a01ca117a

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.app.controller;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.vo.DictModel;
 import org.jeecg.modules.system.service.impl.SysBaseApiImpl;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -29,7 +30,7 @@ public class CommonAppController {
      */
     @Operation(summary="根据字典code查询字典项")
     @GetMapping("/getDictItems")
-    public List<DictModel> getDictItems(@RequestParam("dictCode") String dictCode) {
-        return sysBaseApi.getDictItems(dictCode);
+    public Result<List<DictModel>> getDictItems(@RequestParam("dictCode") String dictCode) {
+        return Result.OK(sysBaseApi.queryDictItemsByCode(dictCode));
     }
 }

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

@@ -0,0 +1,14 @@
+package org.jeecg.modules.app.service;
+
+import org.jeecg.modules.app.vo.PlaceInfoVO;
+
+public interface IDetailService {
+    /**
+     * @Author SheepHy
+     * @Description 门店详情信息查询
+     * @Date 19:41 2025/7/7
+     * @Param id 门店id
+     * @return PlaceInfoVO {@link PlaceInfoVO}
+     **/
+    PlaceInfoVO getPlaceInfo(String id);
+}

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

@@ -112,7 +112,6 @@ public class AppHomeServiceImpl implements IAppHomeService {
             instructorVO.setCourseList(courseInfoVOS);
             instructorList.add(instructorVO);
         }
-
         // 返回首页数据
         return new HomeVO()
                 .setBannerList(appBanners.stream()
@@ -136,10 +135,10 @@ public class AppHomeServiceImpl implements IAppHomeService {
      **/
     private List<CoureseVO> convertToCoureseVOList(List<AppCourses> appCoureseList) {
         return appCoureseList.stream()
-                .map(courese -> new CoureseVO()
-                        .setId(courese.getId()).setCover(courese.getCover())
-                        .setPriceType(courese.getPriceType())
-                        .setSellingPrice(courese.getSellingPrice()))
+                .map(courses -> new CoureseVO()
+                        .setId(courses.getId()).setCover(courses.getCover())
+                        .setPriceType(courses.getPriceType())
+                        .setSellingPrice(courses.getSellingPrice()))
                 .collect(Collectors.toList());
     }
 

+ 57 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/DetailServiceImpl.java

@@ -0,0 +1,57 @@
+package org.jeecg.modules.app.service.impl;
+
+import org.jeecg.modules.app.service.IDetailService;
+import org.jeecg.modules.app.vo.PlaceInfoVO;
+import org.jeecg.modules.system.app.entity.AppSite;
+import org.jeecg.modules.system.app.mapper.AppCoursesMapper;
+import org.jeecg.modules.system.app.mapper.AppCoursesPriceRulesMapper;
+import org.jeecg.modules.system.app.mapper.AppOrderProductMapper;
+import org.jeecg.modules.system.app.mapper.AppSiteMapper;
+
+import javax.annotation.Resource;
+
+public class DetailServiceImpl implements IDetailService {
+    @Resource
+    private AppSiteMapper appSiteMapper;
+    @Resource
+    private AppCoursesMapper appCoursesMapper;
+    @Resource
+    private AppCoursesPriceRulesMapper appCoursesPriceRulesMapper;
+    @Resource
+    private AppOrderProductMapper appOrderProductMapper;
+
+    @Override
+    public PlaceInfoVO getPlaceInfo(String id) {
+        AppSite appSite = appSiteMapper.selectById(id);
+        PlaceInfoVO placeInfo = appSiteMapper.getPlaceInfo(id);
+        PlaceInfoVO.PlaceInfoMsgVO placeInfoMsgVO = new PlaceInfoVO.PlaceInfoMsgVO();
+//        placeInfoMsgVO.setName(appSite.getName())
+//                .setSales(appSite.getSales())
+        return placeInfo;
+    }
+
+    /**
+     * @return
+     * @Author SheepHy
+     * @Description 查询门店下场地销售次数
+     * @Date 20:02 2025/7/7
+     * @Param
+     **/
+    public int getPlaceSales(String id) {
+//        List<String> ids = appCoursesPriceRulesMapper.selectObjs(
+//                        Wrappers.<AppCoursesPriceRules>lambdaQuery()
+//                                .eq(AppCoursesPriceRules::getCoursesId, id)
+//                                .select(AppCoursesPriceRules::getId)
+//                ).stream()
+//                .map(obj -> (String) obj)
+//                .collect(Collectors.toList());
+//        if (!ids.isEmpty()) {
+//            int totalOrders = appOrderProductMapper.selectCount(
+//                    Wrappers.<AppOrderProduct>lambdaQuery()
+//                            .in(AppOrderProduct::getProductId, ids)
+//            );
+//        }
+//
+        return 0;
+    }
+}

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

@@ -5,6 +5,9 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
+import java.math.BigDecimal;
+import java.util.List;
+
 @Data
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = false)
@@ -12,5 +15,89 @@ import lombok.experimental.Accessors;
 public class PlaceInfoVO {
     @Schema(description = "场地id")
     private String id;
+    @Schema(description = "单位名称(部门名称)")
+    private String name;
+    @Schema(description = "好评率")
+    private BigDecimal goodRate;
+    @Schema(description = "是否营业")
+    private Boolean isOpen;
+    @Schema(description = "封面")
+    private String cover;
+    @Schema(description = "背景图;可能数组")
+    private String backgroundImage;
+    @Schema(description = "地址")
+    private String address;
+    @Schema(description = "类型;0学校 1包场体育馆 2不固定场体育馆")
+    private Integer type;
+    @Schema(description = "设施/信息")
+    private String facility;
+    @Schema(description = "教学日开放时段")
+    private String teachingDay;
+    @Schema(description = "非教学日开放时段")
+    private String noTeachingDay;
+    @Schema(description = "联系电话")
+    private String phone;
+    @Schema(description = "视频")
+    private String video;
+    @Schema(description = "场地简约返回参数")
+    private PlaceInfoMsgVO placeInfoMsgVO;
+    @Schema(description = "教练简约返回参数")
+    private List<InstructorVO> instructorVOList;
+    @Data
+    @Accessors(chain = true)
+    @EqualsAndHashCode(callSuper = false)
+    @Schema(description="场地简约返回参数")
+    public static class PlaceInfoMsgVO{
+        @Schema(description = "场地名称")
+        private String name;
+        @Schema(description = "销售数量")
+        private int sales;
+        @Schema(description = "类目")
+        private List<String> category;
+        @Schema(description = "原价")
+        private BigDecimal originalPrice;
+        @Schema(description = "售价")
+        private BigDecimal sellingPrice;
+    }
+    @Data
+    @Accessors(chain = true)
+    @EqualsAndHashCode(callSuper = false)
+    @Schema(description="课程返回参数")
+    public static class CourseInfoVO{
+        @Schema(description = "场地id")
+        private String id;
+        @Schema(description = "场地名称")
+        private String name;
+        @Schema(description = "课程原价")
+        private BigDecimal originalPrice;
+        @Schema(description = "课程售价")
+        private BigDecimal sellingPrice;
+        @Schema(description = "销售数量")
+        private int sales;
+        @Schema(description = "销售(年)")
+        private int salesYear;
+        @Schema(description = "好评率")
+        private BigDecimal goodRate;
+        @Schema(description = "地址")
+        private String address;
+        @Schema(description = "封面")
+        private String cover;
 
+    }
+    @Data
+    @Accessors(chain = true)
+    @EqualsAndHashCode(callSuper = false)
+    @Schema(description="教练简约返回参数")
+    public static class InstructorVO{
+        @Schema(description = "主键id")
+        private String id;
+        @Schema(description = "教练名称")
+        private String name;
+        @Schema(description = "教练头像")
+        private String avatar;
+        @Schema(description = "擅长说明")
+        private String excelMsg;
+        @Schema(description = "教练数量")
+        private int count;
+    }
 }

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 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.PlaceInfoVO;
 import org.jeecg.modules.app.vo.PlaceVO;
 import org.jeecg.modules.app.vo.SearchVO;
 import org.jeecg.modules.system.app.entity.AppSite;
@@ -35,4 +36,13 @@ public interface AppSiteMapper extends BaseMapper<AppSite> {
      **/
     Page<SearchVO.SearchPlaceVO> convertSearchPlaceVOPage(@Param("page")Page<SearchVO.SearchPlaceVO> page,@Param("searchDTO")SearchDTO searchDTO);
 
+    /**
+     * @Author SheepHy
+     * @Description 门店详情信息查询
+     * @Date 19:41 2025/7/7
+     * @Param id 门店id
+     * @return PlaceInfoVO {@link PlaceInfoVO}
+     **/
+    PlaceInfoVO getPlaceInfo(@Param("id")String id);
+
 }

+ 19 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppSiteMapper.xml

@@ -57,4 +57,23 @@
             ORDER BY  a.good_rate DESC
         </if>
     </select>
+    <select id="getPlaceInfo" resultType="org.jeecg.modules.app.vo.PlaceInfoVO">
+        SELECT
+            a.id,
+            b.depart_name,
+            a.good_rate,
+            a.cover,
+            a.background_image,
+            b.address,
+            a.type,
+            a.facility,
+            a.teaching_day,
+            a.no_teaching_day,
+            b.mobile,
+            a.video
+        FROM
+            nm_site a
+                LEFT JOIN sys_depart b ON a.tenant_id = b.id
+        WHERE a.del_flag = 0 AND a.status = 0 AND a.id = #{id}
+    </select>
 </mapper>