增加支付状态接口
This commit is contained in:
parent
3ca0777ea4
commit
a20982eabc
|
|
@ -23,6 +23,12 @@ public interface IFinanceRefundService {
|
|||
*/
|
||||
PageResult<FinanceRefundListVo> list(PageValidate pageValidate, FinanceRefundSearchValidate searchValidate);
|
||||
|
||||
/**
|
||||
* 退款日志
|
||||
*
|
||||
* @param recordId 退款日志ID
|
||||
* @return List<FinanceRefundLogVo>
|
||||
*/
|
||||
List<FinanceRefundLogVo> log(Integer recordId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,6 +87,13 @@ public class FinanceRefundServiceImpl implements IFinanceRefundService {
|
|||
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), iPage.getRecords(), extend);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款日志
|
||||
*
|
||||
* @author fzr
|
||||
* @param recordId 记录ID
|
||||
* @return List<FinanceRefundLogVo>
|
||||
*/
|
||||
@Override
|
||||
public List<FinanceRefundLogVo> log(Integer recordId) {
|
||||
MPJQueryWrapper<RefundLog> mpjQueryWrapper = new MPJQueryWrapper<>();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.mdd.common.plugin.wechat.WxPayDriver;
|
|||
import com.mdd.front.LikeFrontThreadLocal;
|
||||
import com.mdd.front.service.IPayService;
|
||||
import com.mdd.front.validate.PaymentValidate;
|
||||
import com.mdd.front.vo.pay.PayStatusVo;
|
||||
import com.mdd.front.vo.pay.PayWayListVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -40,13 +41,21 @@ public class PayController {
|
|||
@GetMapping("/payWay")
|
||||
@ApiOperation("支付方式")
|
||||
public AjaxResult<PayWayListVo> payWay(@Validated @NotNull(message = "from参数丢失") @RequestParam String from,
|
||||
@Validated @NotNull(message = "orderId参数丢失") @RequestParam Integer orderId) {
|
||||
@Validated @NotNull(message = "orderId参数丢失") @RequestParam Integer orderId) {
|
||||
Integer terminal = LikeFrontThreadLocal.getTerminal();
|
||||
|
||||
PayWayListVo list = iPayService.payWay(from, orderId, terminal);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/payStatus")
|
||||
@ApiOperation(("支付状态"))
|
||||
public AjaxResult<Object> payStatus(@Validated @NotNull(message = "from参数丢失") @RequestParam String from,
|
||||
@Validated @NotNull(message = "orderId参数丢失") @RequestParam Integer orderId) {
|
||||
PayStatusVo vo = iPayService.payStatus(from, orderId);
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/prepay")
|
||||
@ApiOperation("发起支付")
|
||||
public AjaxResult<Object> prepay(@Validated @RequestBody PaymentValidate requestObj) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.mdd.front.service;
|
|||
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.mdd.front.validate.PaymentValidate;
|
||||
import com.mdd.front.vo.pay.PayStatusVo;
|
||||
import com.mdd.front.vo.pay.PayWayInfoVo;
|
||||
import com.mdd.front.vo.pay.PayWayListVo;
|
||||
|
||||
|
|
@ -15,6 +16,7 @@ public interface IPayService {
|
|||
/**
|
||||
* 支付方式
|
||||
*
|
||||
* @author fzr
|
||||
* @param from 场景
|
||||
* @param orderId 订单ID
|
||||
* @param terminal 终端
|
||||
|
|
@ -22,6 +24,16 @@ public interface IPayService {
|
|||
*/
|
||||
PayWayListVo payWay(String from, Integer orderId, Integer terminal);
|
||||
|
||||
/**
|
||||
* 支付状态
|
||||
*
|
||||
* @author fzr
|
||||
* @param from 场景
|
||||
* @param orderId 订单ID
|
||||
* @return PayStatusVo
|
||||
*/
|
||||
PayStatusVo payStatus(String from, Integer orderId);
|
||||
|
||||
/**
|
||||
* 发起支付
|
||||
*
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.mdd.common.entity.user.User;
|
|||
import com.mdd.common.entity.user.UserAuth;
|
||||
import com.mdd.common.enums.LogMoneyEnum;
|
||||
import com.mdd.common.enums.PaymentEnum;
|
||||
import com.mdd.common.exception.OperateException;
|
||||
import com.mdd.common.exception.PaymentException;
|
||||
import com.mdd.common.mapper.log.LogMoneyMapper;
|
||||
import com.mdd.common.mapper.RechargeOrderMapper;
|
||||
|
|
@ -20,6 +21,7 @@ import com.mdd.common.plugin.wechat.request.PaymentRequestV3;
|
|||
import com.mdd.common.util.*;
|
||||
import com.mdd.front.service.IPayService;
|
||||
import com.mdd.front.validate.PaymentValidate;
|
||||
import com.mdd.front.vo.pay.PayStatusVo;
|
||||
import com.mdd.front.vo.pay.PayWayInfoVo;
|
||||
import com.mdd.front.vo.pay.PayWayListVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -95,6 +97,43 @@ public class PayServiceImpl implements IPayService {
|
|||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*
|
||||
* @author fzr
|
||||
* @param from 场景
|
||||
* @param orderId 订单ID
|
||||
* @return PayStatusVo
|
||||
*/
|
||||
@Override
|
||||
public PayStatusVo payStatus(String from, Integer orderId) {
|
||||
PayStatusVo vo = new PayStatusVo();
|
||||
boolean orderExist = false;
|
||||
|
||||
switch (from) {
|
||||
case "recharge":
|
||||
RechargeOrder rechargeOrder = rechargeOrderMapper.selectById(orderId);
|
||||
if (StringUtils.isNotNull(rechargeOrder)) {
|
||||
orderExist = true;
|
||||
vo.setPayStatus(rechargeOrder.getPayStatus());
|
||||
vo.setPayWay(PaymentEnum.getMsgByCode(rechargeOrder.getPayWay()));
|
||||
vo.setOrderId(rechargeOrder.getId());
|
||||
vo.setOrderSn(rechargeOrder.getOrderSn());
|
||||
vo.setOrderAmount(rechargeOrder.getOrderAmount());
|
||||
vo.setPayTime(StringUtils.isNotEmpty(vo.getPayTime()) ? TimeUtils.timestampToDate(vo.getPayTime()) : "");
|
||||
}
|
||||
break;
|
||||
case "order":
|
||||
break;
|
||||
}
|
||||
|
||||
if (!orderExist) {
|
||||
throw new OperateException("订单不存在!");
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起支付
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.mdd.front.vo.pay;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "支付状态Vo")
|
||||
public class PayStatusVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "支付状态: [0=待支付, 1=已支付]")
|
||||
private Integer payStatus;
|
||||
|
||||
@ApiModelProperty(value = "支付状态: [0=待支付, 1=已支付]")
|
||||
private String payWay;
|
||||
|
||||
@ApiModelProperty(value = "支付时间")
|
||||
private String payTime;
|
||||
|
||||
@ApiModelProperty(value = "订单ID")
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
private String orderSn;
|
||||
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue