zjk
2026-09-29 54dcf0a82e7490fa58b1c056d5c0b9cb739c2931
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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
        );
    }
}