Эх сурвалжийг харах

feat(app): 优化课程和场地相关功能

- 在 CourseInfoVO 中添加教练相关信息
- 优化场地列表查询,增加票务判断逻辑
- 调整课程详情查询 SQL
- 新增 OrderController 和 OrderServiceImpl
SheepHy 2 долоо хоног өмнө
parent
commit
23d82c69d4

+ 4 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/OrderController.java

@@ -0,0 +1,4 @@
+package org.jeecg.modules.app.controller;
+
+public class OrderController {
+}

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

@@ -43,6 +43,10 @@ public class AppHomeServiceImpl implements IAppHomeService {
     @Resource
     private AppGameMapper appGameMapper;
     @Resource
+    private AppSitePlaceMapper appSitePlaceMapper;
+    @Resource
+    private AppSitePriceRulesMapper appSitePriceRulesMapper;
+    @Resource
     private AppSearchHotMapper appSearchHotMapper;
     @Resource
     private AppGamePriceRulesMapper appGamePriceRulesMapper;
@@ -155,8 +159,22 @@ 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 -> {
+            boolean ticketWhether = false;
+            List<AppSitePriceRules> appSitePriceRules = new ArrayList<>();
+            appSitePlaceMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery()
+                    .eq(AppSitePlace::getSiteId, placeVO.getId())
+                    .eq(AppSitePlace::getDelFlag,0)
+                    .eq(AppSitePlace::getStatus,0)).forEach(appSitePlace -> {
+                appSitePriceRules.addAll(appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery()
+                        .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())
+                        .eq(AppSitePriceRules::getDelFlag, 0)
+                        .eq(AppSitePriceRules::getStatus, 0)
+                        .ne(AppSitePriceRules::getInventory, 0)));
+            });
+            if(!appSitePriceRules.isEmpty()) ticketWhether = true;
             placeVO.setKm(PositionUtil.calculateDistance(getPlaceListDTO.getLatitude(), getPlaceListDTO.getLongitude(), placeVO.getLatitude().doubleValue(), placeVO.getLongitude().doubleValue()))
-                    .setCategory(getCategoryName(placeVO.getCategoryId()));
+                    .setCategory(getCategoryName(placeVO.getCategoryId()))
+                    .setTicketWhether(ticketWhether);
         });
         if(getPlaceListDTO.getVenueType().equals("0-2")
                 || getPlaceListDTO.getVenueType().equals("1-1")

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

@@ -106,6 +106,7 @@ public class DetailServiceImpl implements IDetailService {
             BeanUtils.copyProperties(appCourses,courseDetailVO);
             courseDetailVOList.add(courseDetailVO);
         });
+
         courseInfoVO.setCourseDetail(courseDetailVOList);
         return courseInfoVO;
     }

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

@@ -0,0 +1,10 @@
+package org.jeecg.modules.app.service.impl;
+
+import lombok.extern.log4j.Log4j2;
+import org.jeecg.modules.app.service.IOrderService;
+import org.springframework.stereotype.Service;
+
+@Service
+@Log4j2
+public class OrderServiceImpl implements IOrderService {
+}

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

@@ -52,6 +52,12 @@ public class CourseInfoVO {
     private String reminder;
     @Schema(description = "课程明细")
     private List<CourseDetailVO> courseDetail;
+    @Schema(description = "主键id")
+    private String instructorId;
+    @Schema(description = "教练名称")
+    private String instructorName;
+    @Schema(description = "教练头像")
+    private String instructorAvatar;
 
     @Data
     @Accessors(chain = true)

+ 11 - 5
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppCoursesMapper.xml

@@ -39,7 +39,7 @@
     <select id="getCourseInfo" resultType="org.jeecg.modules.app.vo.CourseInfoVO">
         SELECT
             a.id,
-            a.name,
+            a.NAME,
             a.original_price,
             a.selling_price,
             a.cover,
@@ -52,18 +52,21 @@
             a.end_time,
             COUNT( c.id ) AS classHour,
             a.limit_num,
-            a.reminder
+            a.reminder,
+            a.user_id AS instructorId,
+            d.username AS instructorName,
+            d.avatar AS instructorAvatar
         FROM
             nm_courses a
                 LEFT JOIN nm_site b ON a.site_id = b.id
-                LEFT JOIN nm_courses_price_rules c ON a.id = c.courses_id
+                LEFT JOIN nm_courses_price_rules c ON a.id = c.courses_id LEFT JOIN sys_user d ON d.id = a.user_id
         WHERE
             a.STATUS = 0
           AND a.del_flag = 0
           AND a.id = #{id}
         GROUP BY
             a.id,
-            a.name,
+            a.NAME,
             a.original_price,
             a.selling_price,
             a.cover,
@@ -72,6 +75,9 @@
             a.start_time,
             a.end_time,
             a.limit_num,
-            a.reminder;
+            a.reminder,
+            instructorId,
+            instructorName,
+            instructorAvatar;
     </select>
 </mapper>

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

@@ -9,15 +9,7 @@
             a.address,
             a.category_id,
             a.latitude,
-            a.longitude,
-            CASE
-                WHEN EXISTS (
-                    SELECT SUM(inventory)
-                    FROM nm_site_peice_rules
-                    WHERE site_id = a.id
-                ) THEN 1
-                ELSE 0
-                END AS ticketWhether
+            a.longitude
         FROM nm_site a LEFT JOIN sys_depart b ON a.tenant_id = b.id WHERE 1=1
         <if test="venueType != null and venueType == '0-1'">
             ORDER BY a.good_rate DESC