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

[fix]
1、 完善预定接口的返回值信息

chenchen 5 сар өмнө
parent
commit
c75ab859e8

+ 6 - 3
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/TourismProjectToWebController.java

@@ -89,9 +89,12 @@ public class TourismProjectToWebController {
     * @return 应答结果对象,包含对象详情。
     */
     @PostMapping("/bookProject")
-    public ResponseResult<Void> bookProject(HttpServletRequest request,@MyRequestBody TourismBookProjectDto tourBookInfoDto) {
-        tourismProjectToWebService.bookProject(request,tourBookInfoDto);
-        return ResponseResult.success();
+    public ResponseResult<Integer> bookProject(HttpServletRequest request,@MyRequestBody TourismBookProjectDto tourBookInfoDto) {
+        Boolean state = tourismProjectToWebService.bookProject(request, tourBookInfoDto);
+        if(!state){
+            return ResponseResult.success(2);
+        }
+        return ResponseResult.success(1);
     }
 
 }

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/app/website/service/TourismProjectToWebService.java

@@ -19,5 +19,5 @@ public interface TourismProjectToWebService {
 
     WebSiteProjectDatePriceVo view(@RequestParam Long projectId);
 
-    void bookProject(HttpServletRequest request, @RequestBody TourismBookProjectDto tourismBookProjectDto);
+    Boolean bookProject(HttpServletRequest request, @RequestBody TourismBookProjectDto tourismBookProjectDto);
 }

+ 2 - 2
application-webadmin/src/main/java/com/tourism/webadmin/app/website/service/impl/TourismProjectToWebServiceImpl.java

@@ -194,7 +194,7 @@ public class TourismProjectToWebServiceImpl implements TourismProjectToWebServic
     }
 
     @Override
-    public void bookProject(HttpServletRequest request,@MyRequestBody TourismBookProjectDto tourBookInfoDto) {
+    public Boolean bookProject(HttpServletRequest request,@MyRequestBody TourismBookProjectDto tourBookInfoDto) {
         //获取用户的手机号
         Long userId = TokenData.takeFromRequest().getUserId();
         TourUser tourUser = tourUserService.getById(userId);
@@ -222,6 +222,6 @@ public class TourismProjectToWebServiceImpl implements TourismProjectToWebServic
                 .add(tourismDatePriceOne.getChildrenPrice().multiply(BigDecimal.valueOf(tourBookInfoDto.getChildrenNumber()))));
         tourBookInfo.setBookIp(IpUtil.getRemoteIpAddress(request));
 
-        tourBookInfoService.saveNew(tourBookInfo);
+        return tourBookInfoService.save(tourBookInfo);
     }
 }