| | |
| | | |
| | | import com.tourguide.common.api.ApiResponse; |
| | | import com.tourguide.common.api.PageResponse; |
| | | import com.tourguide.modules.order.dto.AdminOrderRefundRequest; |
| | | import com.tourguide.modules.order.dto.TourOrderResponse; |
| | | import com.tourguide.modules.order.service.TourOrderService; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.validation.Valid; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | |
| | | @RequestParam(defaultValue = "10") long size, |
| | | @RequestParam(required = false) String keyword, |
| | | @RequestParam(required = false) Long visitorId, |
| | | @RequestParam(required = false) Long guideId, |
| | | @RequestParam(required = false) String scenicName, |
| | | @RequestParam(required = false) String status, |
| | | @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate, |
| | | @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate) { |
| | | return ApiResponse.success(orderService.page(page, size, keyword, visitorId, scenicName, status, startDate, endDate)); |
| | | return ApiResponse.success(orderService.page(page, size, keyword, visitorId, guideId, scenicName, status, startDate, endDate)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 对指定可退款订单执行全额退款登记,并生成退款单号和退款时间。 |
| | | * 对指定可退款订单执行指定金额退款登记,并生成退款单号和退款时间。 |
| | | * 已取消、已退款或当前状态不可退款的订单会被业务层拒绝。 |
| | | * |
| | | * @param id 订单主键 |
| | | * @return 退款后的订单详情 |
| | | */ |
| | | @PutMapping("/{id}/refund") |
| | | public ApiResponse<TourOrderResponse> refund(@PathVariable Long id) { |
| | | return ApiResponse.success(orderService.refund(id)); |
| | | public ApiResponse<TourOrderResponse> refund(@PathVariable Long id, |
| | | @Valid @RequestBody AdminOrderRefundRequest request) { |
| | | return ApiResponse.success(orderService.refund(id, request.getRefundAmount())); |
| | | } |
| | | } |