|
|
@@ -1,85 +1,104 @@
|
|
|
-//package com.zhongshu.card.server.core.controller.openAPI;
|
|
|
-//
|
|
|
-//import com.github.microservice.net.ResultContent;
|
|
|
-//import com.github.microservice.types.payment.PaymentType;
|
|
|
-//import com.zhongshu.card.client.openApi.params.PayParam;
|
|
|
-//import com.zhongshu.card.client.openApi.params.RefundParam;
|
|
|
-//import com.zhongshu.card.server.core.service.pay.BalancePayService;
|
|
|
-//import com.zhongshu.card.server.core.service.pay.ChinaumsSenselessPayService;
|
|
|
-//import com.zhongshu.card.server.core.service.pay.PayAccountService;
|
|
|
-//import io.swagger.v3.oas.annotations.Operation;
|
|
|
-//import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
-//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-//import org.springframework.util.Assert;
|
|
|
-//import org.springframework.web.bind.annotation.*;
|
|
|
-//
|
|
|
-//import javax.validation.Valid;
|
|
|
-//
|
|
|
-//@RestController
|
|
|
-//@RequestMapping("/openAPI/v1/pay")
|
|
|
-//@Tag(name = "openAPI-支付管理")
|
|
|
-//public class PayOpenApiController {
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// BalancePayService balancePayService;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// ChinaumsSenselessPayService chinaumsSenselessPayService;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// PayAccountService payAccountService;
|
|
|
-//
|
|
|
-// @Operation(summary = "查询个人钱包账户余额", description = "查询个人钱包账户余额")
|
|
|
-// @RequestMapping(value = "queryDeviceBindUsers", method = {RequestMethod.GET})
|
|
|
-// public ResultContent<Long> queryUserWallet(@RequestParam("projectOid") String projectOid,
|
|
|
-// @RequestParam("userId") String userId){
|
|
|
-// return balancePayService.queryUserBalance(projectOid, userId);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Operation(summary = "支付", description = "支付")
|
|
|
-// @RequestMapping(value = "pay", method = {RequestMethod.POST})
|
|
|
-// public ResultContent pay(@RequestBody @Valid PayParam param){
|
|
|
-//
|
|
|
-// if (param.getPaymentType()==null){
|
|
|
-// return ResultContent.buildFail("paymentType is null");
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (param.getPaymentType().equals(PaymentType.UserWallet)){
|
|
|
-// return balancePayService.balancePay(param.getProjectOid(), param.getOid(), param.getUserId(), param.getTotal(), param.getOrderNo(), param.getRemark());
|
|
|
-// }else if (param.getPaymentType().equals(PaymentType.UnionFrictionlessPay)){
|
|
|
-// return chinaumsSenselessPayService.senselessPay(param.getProjectOid(), param.getOid(), param.getUserId(), param.getTotal(), param.getOrderNo(), param.getRemark());
|
|
|
-// }
|
|
|
-// return ResultContent.buildFail("参数传入错误,paymentType");
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Operation(summary = "退款", description = "退款")
|
|
|
-// @RequestMapping(value = "refund", method = {RequestMethod.POST})
|
|
|
-// public ResultContent refund(@RequestBody @Valid RefundParam param){
|
|
|
-// if (param.getPaymentType()==null){
|
|
|
-// return ResultContent.buildFail("paymentType is null");
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (param.getPaymentType().equals(PaymentType.UserWallet)){
|
|
|
-// return balancePayService.refund(param.getProjectOid(), param.getOid(), param.getUserId(), param.getOrderNo(), param.getTotal(), param.getRemark());
|
|
|
-// }else if (param.getPaymentType().equals(PaymentType.UnionFrictionlessPay)){
|
|
|
-// return chinaumsSenselessPayService.refund(param.getProjectOid(), param.getOid(), param.getUserId(), param.getTotal(), param.getOrderNo(), param.getRefundOrderNo(), param.getRemark(), param.getTargetOrderId());
|
|
|
-// }
|
|
|
-// return ResultContent.buildFail("参数传入错误,paymentType");
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 退款结果查询
|
|
|
-// */
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 查询账本
|
|
|
-// */
|
|
|
-//// public ResultContent queryGeneralLedger(String projectOid, String oid, String userId) {
|
|
|
-//// payAccountService.get
|
|
|
-//// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// *
|
|
|
-// */
|
|
|
-//// public
|
|
|
-//}
|
|
|
+package com.zhongshu.card.server.core.controller.openAPI;
|
|
|
+
|
|
|
+import com.github.microservice.net.ResultContent;
|
|
|
+import com.github.microservice.pay.client.model.ledger.TransactionLogModel;
|
|
|
+import com.github.microservice.pay.client.model.ledger.transaction.TransactionLogAggregateRetModel;
|
|
|
+import com.github.microservice.types.payment.PaymentType;
|
|
|
+import com.zhongshu.card.client.model.pay.*;
|
|
|
+import com.zhongshu.card.client.openApi.RefundQueryParam;
|
|
|
+import com.zhongshu.card.client.openApi.params.PayParam;
|
|
|
+import com.zhongshu.card.client.openApi.params.RefundParam;
|
|
|
+import com.zhongshu.card.server.core.model.pay.UnionFrictionlessPayFinishModel;
|
|
|
+import com.zhongshu.card.server.core.service.openAPI.PayOpenApiService;
|
|
|
+import com.zhongshu.card.server.core.service.pay.BalancePayService;
|
|
|
+import com.zhongshu.card.server.core.service.pay.ChinaumsSenselessPayService;
|
|
|
+import com.zhongshu.card.server.core.service.pay.PayAccountService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.util.Assert;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/openAPI/v1/pay")
|
|
|
+@Tag(name = "openAPI-支付管理")
|
|
|
+public class PayOpenApiController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PayOpenApiService payOpenApiService;
|
|
|
+
|
|
|
+ @Operation(summary = "查询个人钱包账户余额", description = "查询个人钱包账户余额")
|
|
|
+ @RequestMapping(value = "queryWallet", method = {RequestMethod.GET})
|
|
|
+ public ResultContent<Long> queryWallet(@RequestParam("projectOid") String projectOid,
|
|
|
+ @RequestParam("userId") String userId){
|
|
|
+ return payOpenApiService.queryWallet(projectOid, userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "余额支付", description = "余额支付")
|
|
|
+ @RequestMapping(value = "walletPay", method = {RequestMethod.POST})
|
|
|
+ public ResultContent<List<TransactionLogModel>> walletPay(@RequestBody PayParam param){
|
|
|
+ return payOpenApiService.walletPay(param.getProjectOid(), param.getOid(), param.getUserId(), param.getTotal(), param.getOrderNo(), param.getRemark());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "余额支付退款", description = "余额支付退款")
|
|
|
+ @RequestMapping(value = "walletRefund", method = {RequestMethod.POST})
|
|
|
+ public ResultContent<List<TransactionLogModel>> walletRefund(@RequestBody RefundParam param){
|
|
|
+ return payOpenApiService.walletRefund(param.getProjectOid(), param.getOid(), param.getUserId(), param.getTotal(), param.getOrderNo(), param.getRemark());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "充值记录查询", description = "充值记录查询")
|
|
|
+ @RequestMapping(value = "rechargeQuery", method = {RequestMethod.POST})
|
|
|
+ public ResultContent<QueryRechargeOrderModel> rechargeQuery(@RequestBody QueryRechargeParam param){
|
|
|
+ return payOpenApiService.rechargeQuery(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询银联无感支付签约状态
|
|
|
+ */
|
|
|
+ @Operation(summary = "查询银联无感支付签约状态", description = "查询银联无感支付签约状态")
|
|
|
+ @RequestMapping(value = "unionSenselessSignQuery", method = {RequestMethod.GET})
|
|
|
+ public ResultContent<ChinaumsSenselessUserSignInfoModel> unionSenselessSignQuery(@RequestParam("projectOid") String projectOid,
|
|
|
+ @RequestParam("userId") String userId){
|
|
|
+ return payOpenApiService.unionSenselessSignQuery(projectOid, userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "银联无感支付签约", description = "银联无感支付签约")
|
|
|
+ @RequestMapping(value = "unionSenselessSign", method = {RequestMethod.POST})
|
|
|
+ public ResultContent<Object> unionSenselessSign(@RequestBody UnionApplySignParam param){
|
|
|
+ return payOpenApiService.unionSenselessSign(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "银联无感支付扣费", description = "银联无感支付扣费")
|
|
|
+ @RequestMapping(value = "unionSenselessPay", method = {RequestMethod.POST})
|
|
|
+ public ResultContent<Object> unionSenselessPay(@RequestBody PayParam param){
|
|
|
+ return payOpenApiService.unionSenselessPay(param.getProjectOid(), param.getOid(), param.getUserId(), param.getTotal(), param.getOrderNo(), param.getRemark());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "银联无感支付退款", description = "银联无感支付退款")
|
|
|
+ @RequestMapping(value = "unionSenselessRefund", method = {RequestMethod.POST})
|
|
|
+ public ResultContent<Object> unionSenselessRefund(@RequestBody RefundParam param){
|
|
|
+ return payOpenApiService.unionSenselessRefund(param.getProjectOid(), param.getOid(), param.getUserId(), param.getTotal(), param.getOrderNo(), param.getRefundOrderNo(), param.getRemark(), param.getTargetOrderId());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "银联无感支付退款查询", description = "银联无感支付退款查询")
|
|
|
+ @RequestMapping(value = "unionSenselessRefundQuery", method = {RequestMethod.POST})
|
|
|
+ public ResultContent<UnionFrictionlessPayFinishModel> unionSenselessRefundQuery(@RequestBody RefundQueryParam param){
|
|
|
+ return payOpenApiService.unionSenselessRefundQuery(param.getProjectOid(), param.getOid(), param.getUserId(), param.getRefundOrderNo());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户流水查询
|
|
|
+ */
|
|
|
+ @Operation(summary = "查询用户流水-分页查询", description = "查询用户流水-分页查询")
|
|
|
+ @RequestMapping(value = {"queryTransLog"}, method = {RequestMethod.POST})
|
|
|
+ public ResultContent<TransactionLogAggregateRetModel> queryTransLog(@RequestBody QueryTransLogParam param){
|
|
|
+ Pageable pageable = PageRequest.of(param.getNumber(), param.getSize());
|
|
|
+ return payOpenApiService.queryTransLog(pageable, param);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|