Browse Source

refactor(app): 优化订单相关接口

- 修改 IOrderService接口,将 previewOrderPlaceGymnasiumChartered 方法的参数类型从 List<String> 改为 String
- 更新 OrderController 中的 API 路径和请求方法:
  - /previewOrderPlaceGymnasiumChartered 从 POST 改为 GET
  - /createOrderPlaceSchool 从 POST改为 GET
- 修改 OrderServiceImpl 中的 previewOrderPlaceGymnasiumChartered 方法实现,支持逗号分隔的字符串参数
- 优化 API 参数命名,使用 rulesId 替代 courseId
SheepHy 1 week ago
parent
commit
42e859c472

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

@@ -7,14 +7,16 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.app.service.IOrderService;
 import org.jeecg.modules.app.vo.OrderVO;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import java.util.Date;
-import java.util.List;
 
 @Slf4j
-@Tag(name = "订单相关接口")
+@Tag(name = "APP订单相关接口")
 @RestController
 @RequestMapping("/app/order")
 public class OrderController {
@@ -69,8 +71,8 @@ public class OrderController {
      * @return OrderVO.PreviewOrderPlaceGymnasiumChartered {@link OrderVO.PreviewOrderPlaceGymnasiumChartered}
      **/
     @Operation(summary="体育馆包场-预览页")
-    @PostMapping("/previewOrderPlaceGymnasiumChartered")
-    public Result<OrderVO.PreviewOrderPlaceGymnasiumChartered> previewOrderPlaceGymnasiumChartered(@RequestParam("courseId") @Schema(description = "课程ID")List<String> rulesId){
+    @GetMapping("/previewOrderPlaceGymnasiumChartered")
+    public Result<OrderVO.PreviewOrderPlaceGymnasiumChartered> previewOrderPlaceGymnasiumChartered(@RequestParam("rulesId") @Schema(description = "场次IDS多个逗号拼接")String rulesId){
         return Result.ok(appOrderService.previewOrderPlaceGymnasiumChartered(rulesId));
     }
 
@@ -82,7 +84,7 @@ public class OrderController {
      * @return OrderVO.createOrderPlaceSchool
      **/
     @Operation(summary="学校场地预约-创建")
-    @PostMapping("/createOrderPlaceSchool")
+    @GetMapping("/createOrderPlaceSchool")
     public Result<OrderVO.createOrderPlaceSchool> createOrderPlaceSchool(@RequestParam("rulesId") @Schema(description = "场次IDS多个逗号拼接")String rulesId,
                                                                          @RequestParam("userIds") @Schema(description = "使用用户IDS多个逗号拼接")String userIds){
         return Result.ok(appOrderService.createOrderPlaceSchool(rulesId, userIds));

+ 1 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/IOrderService.java

@@ -3,7 +3,6 @@ package org.jeecg.modules.app.service;
 import org.jeecg.modules.app.vo.OrderVO;
 
 import java.util.Date;
-import java.util.List;
 
 public interface IOrderService {
 
@@ -50,5 +49,5 @@ public interface IOrderService {
      * @Param placeId
      * @return OrderVO.PreviewOrderPlaceGymnasiumChartered {@link OrderVO.PreviewOrderPlaceGymnasiumChartered}
      **/
-    OrderVO.PreviewOrderPlaceGymnasiumChartered previewOrderPlaceGymnasiumChartered(List<String> rulesId);
+    OrderVO.PreviewOrderPlaceGymnasiumChartered previewOrderPlaceGymnasiumChartered(String rulesId);
 }

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

@@ -127,7 +127,8 @@ public class OrderServiceImpl implements IOrderService {
     }
 
     @Override
-    public OrderVO.PreviewOrderPlaceGymnasiumChartered previewOrderPlaceGymnasiumChartered(List<String> rulesId) {
+    public OrderVO.PreviewOrderPlaceGymnasiumChartered previewOrderPlaceGymnasiumChartered(String rulesId) {
+        List<String> list = Arrays.asList(rulesId.split(","));
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         OrderVO.PreviewOrderPlaceGymnasiumChartered result = new OrderVO.PreviewOrderPlaceGymnasiumChartered();
         List<AppSitePriceRules> priceRules = appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery()
@@ -142,7 +143,7 @@ public class OrderServiceImpl implements IOrderService {
         if (sitePlace == null) {
             throw new IllegalStateException("关联场地不存在");
         }
-        List<OrderVO.PreviewOrderTimePeriod> timePeriod = appSitePriceRulesMapper.previewOrderPlaceGymnasiumChartered(rulesId);
+        List<OrderVO.PreviewOrderTimePeriod> timePeriod = appSitePriceRulesMapper.previewOrderPlaceGymnasiumChartered(list);
         SysDepart depart = sysDepartMapper.selectOne(Wrappers.<SysDepart>lambdaQuery()
                 .eq(SysDepart::getOrgCode, sitePlace.getOrgCode()));
         return result.setTimePeriod(timePeriod)