|
@@ -0,0 +1,139 @@
|
|
|
+package com.zswl.cloud.springBtach.server.core.controller;
|
|
|
+
|
|
|
+import com.github.microservice.auth.client.constant.AuthConstant;
|
|
|
+import com.github.microservice.auth.client.content.ResultContent;
|
|
|
+import com.github.microservice.auth.security.annotations.ResourceAuth;
|
|
|
+import com.github.microservice.auth.security.type.AuthType;
|
|
|
+import com.zhongshu.payment.client.model.Pages;
|
|
|
+import com.zhongshu.payment.client.model.order.AdminSeachOrderModel;
|
|
|
+import com.zhongshu.payment.client.model.order.v2.ApplicantRefundParam2Model;
|
|
|
+import com.zhongshu.payment.client.model.order.v2.RefundParam2Model;
|
|
|
+import com.zhongshu.payment.client.model.order.v2.TransferModel;
|
|
|
+import com.zhongshu.payment.client.model.payment.CloseResponsetModel;
|
|
|
+import com.zhongshu.payment.client.model.payment.CreateResponseModel;
|
|
|
+import com.zhongshu.payment.client.model.payment.QueryRequestModel;
|
|
|
+import com.zhongshu.payment.client.model.payment.zswl.CreatePaymentModel;
|
|
|
+import com.zswl.cloud.springBtach.server.core.service.PaymentService;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.log4j.Log4j2;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+
|
|
|
+@Log4j2
|
|
|
+@RestController
|
|
|
+@RequestMapping("pay")
|
|
|
+public class PaymentController {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PaymentService paymentServer;
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("创建支付订单")
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @RequestMapping(value = "creatPayOrder", method = RequestMethod.POST)
|
|
|
+ public ResultContent<CreateResponseModel> creatPayOrder(@RequestBody CreatePaymentModel createPaymentModel) {
|
|
|
+ return paymentServer.creatPayOrder(createPaymentModel);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("查询订单状态")
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @RequestMapping(value = "query/{orderNo}", method = RequestMethod.GET)
|
|
|
+ public ResultContent<QueryRequestModel> query(@PathVariable("orderNo") String orderNo) {
|
|
|
+ return paymentServer.query(orderNo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("退款申请")
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @RequestMapping(value = "applicantRefund", method = RequestMethod.POST)
|
|
|
+ public ResultContent refund(@RequestBody @Valid ApplicantRefundParam2Model applicantRefundParamModel) {
|
|
|
+ return paymentServer.applicantRefund(applicantRefundParamModel);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("取消退款")
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @RequestMapping(value = "unRefund", method = RequestMethod.POST)
|
|
|
+ public ResultContent unRefund(@RequestBody @Valid ApplicantRefundParam2Model applicantRefundParam2Model) {
|
|
|
+ return paymentServer.unRefund(applicantRefundParam2Model);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("退款审核")
|
|
|
+ @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform)
|
|
|
+ @ResourceAuth(value = "admin", type = AuthType.Enterprise)
|
|
|
+ @ResourceAuth(value = "admin", type = AuthType.Project)
|
|
|
+ @RequestMapping(value = "auditRefund", method = RequestMethod.POST)
|
|
|
+ public ResultContent auditRefund(@RequestBody @Valid RefundParam2Model refundParam2Model) {
|
|
|
+ return paymentServer.auditRefund(refundParam2Model);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("关闭订单")
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @RequestMapping(value = "close/{orderNo}", method = RequestMethod.GET)
|
|
|
+ public ResultContent<CloseResponsetModel> close(@PathVariable("orderNo") String orderNo) {
|
|
|
+ return paymentServer.close(orderNo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("获取分账信息")
|
|
|
+ @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform)
|
|
|
+ @ResourceAuth(value = "admin", type = AuthType.Enterprise)
|
|
|
+ @ResourceAuth(value = "admin", type = AuthType.Project)
|
|
|
+ @RequestMapping(value = "transfer/{orderNo}", method = RequestMethod.GET)
|
|
|
+ public ResultContent<TransferModel> transfer(@PathVariable("orderNo") String orderNo) {
|
|
|
+ return paymentServer.transfer(orderNo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("获取分账信息")
|
|
|
+ @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform)
|
|
|
+ @ResourceAuth(value = "admin", type = AuthType.Enterprise)
|
|
|
+ @ResourceAuth(value = "admin", type = AuthType.Project)
|
|
|
+ @RequestMapping(value = "transfer/list", method = RequestMethod.GET)
|
|
|
+ public ResultContent<TransferModel> transferList(@RequestBody @Valid AdminSeachOrderModel adminSeachOrderModel) {
|
|
|
+ Pageable page = page(adminSeachOrderModel);
|
|
|
+ return paymentServer.transferList(adminSeachOrderModel, page);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("查询提现金额")
|
|
|
+ @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform)
|
|
|
+ @ResourceAuth(value = "admin", type = AuthType.Enterprise)
|
|
|
+ @ResourceAuth(value = "admin", type = AuthType.Project)
|
|
|
+ @RequestMapping(value = "account/getDetail", method = RequestMethod.GET)
|
|
|
+ public ResultContent getDetail() {
|
|
|
+ return paymentServer.getDetail();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("提现")
|
|
|
+ @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform)
|
|
|
+ @ResourceAuth(value = "admin", type = AuthType.Enterprise)
|
|
|
+ @ResourceAuth(value = "admin", type = AuthType.Project)
|
|
|
+ @RequestMapping(value = "account/withdrawals", method = RequestMethod.GET)
|
|
|
+ public ResultContent withdrawals() {
|
|
|
+ return paymentServer.withdrawals();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private Pageable page(Pages page) {
|
|
|
+ try {
|
|
|
+
|
|
|
+ return PageRequest.of(page.getPage(), page.getSize());
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ log.info("PageUtile.page异常:{}", e.getMessage());
|
|
|
+
|
|
|
+ }
|
|
|
+ return PageRequest.of(0, 20);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|