|
@@ -0,0 +1,112 @@
|
|
|
|
|
+package com.payment.platform.module.payment.batch.controller;
|
|
|
|
|
+
|
|
|
|
|
+import com.payment.platform.common.response.PageResult;
|
|
|
|
|
+import com.payment.platform.common.response.Result;
|
|
|
|
|
+import com.payment.platform.module.payment.batch.dto.BatchCreateDTO;
|
|
|
|
|
+import com.payment.platform.module.payment.batch.entity.BatchAuthorizeEntity;
|
|
|
|
|
+import com.payment.platform.module.payment.batch.entity.BatchOrderEntity;
|
|
|
|
|
+import com.payment.platform.module.payment.batch.service.AlipayBatchPayService;
|
|
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
|
+import jakarta.validation.Valid;
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/payment/account/batch")
|
|
|
|
|
+@RequiredArgsConstructor
|
|
|
|
|
+public class BatchPayController {
|
|
|
|
|
+
|
|
|
|
|
+ private final AlipayBatchPayService batchPayService;
|
|
|
|
|
+
|
|
|
|
|
+ @PreAuthorize("@perm.hasAny('module_payment:account:authorize')")
|
|
|
|
|
+ @PostMapping("/authorize/apply")
|
|
|
|
|
+ public Result<Map<String, String>> authorizeApply(@RequestBody Map<String, Object> b) {
|
|
|
|
|
+ return Result.ok(batchPayService.authorizeApply(
|
|
|
|
|
+ (String) b.get("enterprise_id"), (String) b.get("participant_id")));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PreAuthorize("@perm.hasAny('module_payment:account:authorize')")
|
|
|
|
|
+ @GetMapping("/authorize/query")
|
|
|
|
|
+ public Result<Map<String, String>> queryAuthorize(
|
|
|
|
|
+ @RequestParam("enterprise_id") String enterpriseId,
|
|
|
|
|
+ @RequestParam("out_biz_no") String outBizNo) {
|
|
|
|
|
+ return Result.ok(batchPayService.queryAuthorize(enterpriseId, outBizNo));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PreAuthorize("@perm.hasAny('module_payment:account:transfer')")
|
|
|
|
|
+ @PostMapping("/create")
|
|
|
|
|
+ public Result<Map<String, Object>> batchCreate(@Valid @RequestBody BatchCreateDTO dto) {
|
|
|
|
|
+ return Result.ok(batchPayService.batchCreate(dto));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PreAuthorize("@perm.hasAny('module_payment:account:transfer')")
|
|
|
|
|
+ @PostMapping("/pay")
|
|
|
|
|
+ public Result<Map<String, String>> renderPay(@RequestBody Map<String, Object> b) {
|
|
|
|
|
+ return Result.ok(batchPayService.renderPay(
|
|
|
|
|
+ (String) b.get("enterprise_id"), (String) b.get("out_batch_no")));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PreAuthorize("@perm.hasAny('module_payment:account:transfer:list')")
|
|
|
|
|
+ @GetMapping("/query")
|
|
|
|
|
+ public Result<Map<String, Object>> batchQuery(
|
|
|
|
|
+ @RequestParam("enterprise_id") String enterpriseId,
|
|
|
|
|
+ @RequestParam("out_batch_no") String outBatchNo) {
|
|
|
|
|
+ return Result.ok(batchPayService.batchQuery(enterpriseId, outBatchNo));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PreAuthorize("@perm.hasAny('module_payment:account:transfer')")
|
|
|
|
|
+ @PostMapping("/close")
|
|
|
|
|
+ public Result<Map<String, String>> batchClose(@RequestBody Map<String, Object> b) {
|
|
|
|
|
+ return Result.ok(batchPayService.batchClose(
|
|
|
|
|
+ (String) b.get("enterprise_id"), (String) b.get("out_batch_no")));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PreAuthorize("@perm.hasAny('module_payment:account:transfer:list')")
|
|
|
|
|
+ @GetMapping("/list")
|
|
|
|
|
+ public Result<PageResult<BatchOrderEntity>> batchList(
|
|
|
|
|
+ @RequestParam(name = "page_no", defaultValue = "1") int pageNo,
|
|
|
|
|
+ @RequestParam(name = "page_size", defaultValue = "20") int pageSize,
|
|
|
|
|
+ @RequestParam(name = "enterprise_id", required = false) String enterpriseId,
|
|
|
|
|
+ @RequestParam(name = "status", required = false) String status,
|
|
|
|
|
+ @RequestParam(name = "start_time", required = false) String startTime,
|
|
|
|
|
+ @RequestParam(name = "end_time", required = false) String endTime) {
|
|
|
|
|
+ return Result.ok(batchPayService.batchList(enterpriseId, status, startTime, endTime, pageNo, pageSize));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PreAuthorize("@perm.hasAny('module_payment:account:transfer:detail')")
|
|
|
|
|
+ @GetMapping("/detail")
|
|
|
|
|
+ public Result<Map<String, Object>> batchDetail(
|
|
|
|
|
+ @RequestParam("enterprise_id") String enterpriseId,
|
|
|
|
|
+ @RequestParam("out_batch_no") String outBatchNo,
|
|
|
|
|
+ @RequestParam(name = "page_no", defaultValue = "1") int pageNo,
|
|
|
|
|
+ @RequestParam(name = "page_size", defaultValue = "20") int pageSize) {
|
|
|
|
|
+ return Result.ok(batchPayService.batchDetail(enterpriseId, outBatchNo, pageNo, pageSize));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PreAuthorize("@perm.hasAny('module_payment:account:transfer:list')")
|
|
|
|
|
+ @GetMapping("/authorize/list")
|
|
|
|
|
+ public Result<PageResult<BatchAuthorizeEntity>> authorizeList(
|
|
|
|
|
+ @RequestParam(name = "page_no", defaultValue = "1") int pageNo,
|
|
|
|
|
+ @RequestParam(name = "page_size", defaultValue = "20") int pageSize,
|
|
|
|
|
+ @RequestParam(name = "enterprise_id", required = false) String enterpriseId) {
|
|
|
|
|
+ return Result.ok(batchPayService.authorizeList(enterpriseId, pageNo, pageSize));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PreAuthorize("@perm.hasAny('module_payment:account:transfer:list')")
|
|
|
|
|
+ @GetMapping("/export")
|
|
|
|
|
+ public void batchExport(
|
|
|
|
|
+ @RequestParam(name = "enterprise_id", required = false) String enterpriseId,
|
|
|
|
|
+ @RequestParam(name = "status", required = false) String status,
|
|
|
|
|
+ @RequestParam(name = "start_time", required = false) String startTime,
|
|
|
|
|
+ @RequestParam(name = "end_time", required = false) String endTime,
|
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
|
+ byte[] bytes = batchPayService.batchExport(enterpriseId, status, startTime, endTime);
|
|
|
|
|
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
|
|
+ response.setHeader("Content-Disposition", "attachment; filename=batch_pay_report.xlsx");
|
|
|
|
|
+ response.getOutputStream().write(bytes);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|