| | |
| | | import com.tourguide.modules.review.dto.OrderReviewCreateRequest; |
| | | import com.tourguide.modules.review.dto.OrderReviewResponse; |
| | | import com.tourguide.modules.review.service.OrderReviewService; |
| | | import com.tourguide.modules.review.dto.ReviewImageUploadResponse; |
| | | import com.tourguide.modules.review.service.ReviewImageStorageService; |
| | | import com.tourguide.security.AppUserPrincipal; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.security.core.annotation.AuthenticationPrincipal; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.validation.Valid; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * 游客小程序订单评价接口。 |
| | |
| | | @RequestMapping("/api/mini/reviews") |
| | | public class MiniOrderReviewController { |
| | | private final OrderReviewService reviewService; |
| | | public MiniOrderReviewController(OrderReviewService reviewService) { this.reviewService = reviewService; } |
| | | private final ReviewImageStorageService imageStorageService; |
| | | public MiniOrderReviewController(OrderReviewService reviewService, ReviewImageStorageService imageStorageService) { |
| | | this.reviewService = reviewService; |
| | | this.imageStorageService = imageStorageService; |
| | | } |
| | | |
| | | @PostMapping(value = "/images", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public ApiResponse<ReviewImageUploadResponse> uploadImage( |
| | | @AuthenticationPrincipal AppUserPrincipal principal, |
| | | @RequestPart("file") MultipartFile file) { |
| | | return ApiResponse.success(new ReviewImageUploadResponse(imageStorageService.store(file))); |
| | | } |
| | | |
| | | /** |
| | | * 为当前游客本人的已完成订单创建评价,并在成功后重新计算导游平均评分。 |