package com.tcm.training.admin.trade.controller;
|
|
import com.tcm.training.admin.common.ApiResponse;
|
import com.tcm.training.admin.common.PageResponse;
|
import com.tcm.training.admin.trade.service.PaymentFlowAppService;
|
import com.tcm.training.admin.trade.vo.PaymentFlowListItemVO;
|
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.validation.annotation.Validated;
|
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.servlet.http.HttpServletResponse;
|
import java.io.IOException;
|
import java.time.LocalDateTime;
|
|
@Validated
|
@RestController
|
@RequestMapping({"/api/v1", "/api"})
|
public class PaymentFlowController {
|
|
private final PaymentFlowAppService paymentFlowAppService;
|
|
public PaymentFlowController(PaymentFlowAppService paymentFlowAppService) {
|
this.paymentFlowAppService = paymentFlowAppService;
|
}
|
|
@GetMapping("/payment-flows")
|
public ApiResponse<PageResponse<PaymentFlowListItemVO>> page(
|
@RequestParam(defaultValue = "1") int page,
|
@RequestParam(defaultValue = "10") int pageSize,
|
@RequestParam(required = false) String flowNo,
|
@RequestParam(required = false) String businessOrderNo,
|
@RequestParam(required = false) String userPhone,
|
@RequestParam(required = false) String productKeyword,
|
@RequestParam(required = false) String businessType,
|
@RequestParam(required = false) String paymentMethod,
|
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime tradeFrom,
|
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime tradeTo) {
|
return ApiResponse.ok(paymentFlowAppService.pagePaymentFlows(
|
page, pageSize, flowNo, businessOrderNo, userPhone, productKeyword, businessType,
|
paymentMethod, tradeFrom, tradeTo
|
));
|
}
|
|
@GetMapping("/payment-flows/export")
|
public void export(HttpServletResponse response,
|
@RequestParam(required = false) String flowNo,
|
@RequestParam(required = false) String businessOrderNo,
|
@RequestParam(required = false) String userPhone,
|
@RequestParam(required = false) String productKeyword,
|
@RequestParam(required = false) String businessType,
|
@RequestParam(required = false) String paymentMethod,
|
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime tradeFrom,
|
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime tradeTo) throws IOException {
|
paymentFlowAppService.exportPaymentFlows(
|
response, flowNo, businessOrderNo, userPhone, productKeyword, businessType,
|
paymentMethod, tradeFrom, tradeTo
|
);
|
}
|
}
|