diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/tm/TmPayService.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/tm/TmPayService.java index 9816d3c3..9a06f034 100644 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/tm/TmPayService.java +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/tm/TmPayService.java @@ -53,7 +53,7 @@ public class TmPayService { */ public RefundInfo refund(RefundAble refundAble) { HashMap body = new HashMap<>(); - body.put("refundFee", String.valueOf(refundAble.refundAmount())); + body.put("refundFee", String.valueOf(refundAble.refundAmount().getTotal())); body.put("terminalType", "1"); body.put("outTradeId", refundAble.refundOutTradeNo()); body.put("shopId", config.getShopId()); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/domain/vo/PayResultVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/domain/vo/PayResultVO.java index 5fff27eb..dc82beb1 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/domain/vo/PayResultVO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/domain/vo/PayResultVO.java @@ -21,6 +21,9 @@ public class PayResultVO { @ApiModelProperty("信息") private String msg; + @ApiModelProperty("渠道信息") + private Object channelInfo; + public static PayResultVO fail(String msg) { PayResultVO vo = new PayResultVO(); vo.setMsg(msg); @@ -34,4 +37,11 @@ public class PayResultVO { vo.setSuccess(true); return vo; } + public static PayResultVO success(LocalDateTime payTime, Object channelInfo) { + PayResultVO vo = new PayResultVO(); + vo.setPayTime(payTime); + vo.setSuccess(true); + vo.setChannelInfo(channelInfo); + return vo; + } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/mapper/PayBillMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/mapper/PayBillMapper.xml index f4f20180..834acdf6 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/mapper/PayBillMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/mapper/PayBillMapper.xml @@ -37,6 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and spb.status = #{query.status} and spb.create_time >= #{query.startCreateTime} and spb.create_time <= #{query.endCreateTime} + + and spb.status in + + #{item} + + and spb.bst_id in diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/PayBillService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/PayBillService.java index 00237071..979c31b5 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/PayBillService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/PayBillService.java @@ -5,6 +5,7 @@ import com.ruoyi.ss.payBill.domain.PayBillQuery; import com.ruoyi.ss.payBill.domain.PayBillVO; import com.ruoyi.ss.payBill.domain.dto.PayBillRefundDTO; import com.ruoyi.ss.payBill.domain.vo.DoPayVO; +import com.ruoyi.ss.payBill.domain.vo.PayResultVO; import com.ruoyi.ss.refund.domain.RefundVO; import java.time.LocalDateTime; @@ -133,4 +134,9 @@ public interface PayBillService * @param count 最大次数 */ void refreshPayResultMaxCount(PayBillVO pay, long delay, TimeUnit timeUnit, int count); + + /** + * 查询支付结果 + */ + PayResultVO getPayResult(String payNo); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/impl/PayBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/impl/PayBillServiceImpl.java index ed32df0a..0959cc26 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/impl/PayBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/impl/PayBillServiceImpl.java @@ -489,6 +489,12 @@ public class PayBillServiceImpl implements PayBillService } } + @Override + public PayResultVO getPayResult(String payNo) { + PayBillVO bill = selectByPayNo(payNo); + return getPayResult(bill); + } + private boolean closeById(Long payId) { if (payId == null) { return false; @@ -518,7 +524,7 @@ public class PayBillServiceImpl implements PayBillService Transaction transaction = wxPayService.queryOrderByOutTradeNo(bill.getPayNo()); boolean success = WxPayUtil.isSuccess(transaction); if (success) { - return PayResultVO.success(DateUtils.toLocalDateTimeByISO(transaction.getSuccessTime())); + return PayResultVO.success(DateUtils.toLocalDateTimeByISO(transaction.getSuccessTime()), transaction); } else { return PayResultVO.fail("暂未支付成功"); } @@ -526,7 +532,7 @@ public class PayBillServiceImpl implements PayBillService // 通联微信支付 Map result = sybPayService.queryOrderByOutTradeNo(bill.getPayNo()); if (SybTrxStatus.isSuccess(result)) { - return PayResultVO.success(DateUtils.toLocalDate(result.get("fintime"), "yyyyMMddHHmmss")); + return PayResultVO.success(DateUtils.toLocalDate(result.get("fintime"), "yyyyMMddHHmmss"), result); } else { return PayResultVO.fail("暂未支付成功"); } @@ -534,7 +540,7 @@ public class PayBillServiceImpl implements PayBillService // 太米微信支付 TmTradeInfo result = tmPayService.orderQuery(bill.getPayNo()); if (result != null && TmPayStatus.isSuccess(result.getPayStatus())) { - return PayResultVO.success(DateUtils.toLocalDateTime(result.getPayTime(), "yyyy-MM-dd")); // TODO 支付时间 + return PayResultVO.success(DateUtils.toLocalDateTime(result.getPayTime(), "yyyy-MM-dd HH:mm:ss"), result); // TODO 支付时间 } else { return PayResultVO.fail("暂未支付成功"); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/refund/service/impl/RefundServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/refund/service/impl/RefundServiceImpl.java index 93c9abec..5983da8f 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/refund/service/impl/RefundServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/refund/service/impl/RefundServiceImpl.java @@ -218,7 +218,7 @@ public class RefundServiceImpl implements RefundService // 太米退款是同步通知,直接处理退款成功 scheduledExecutorService.schedule(() -> { handleRefundSuccess(refund.getRefundNo()); - }, 0, TimeUnit.SECONDS); + }, 10, TimeUnit.SECONDS); } else { throw new ServiceException("当前支付方式不支持退款"); diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppPayBillController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppPayBillController.java index c508d194..88b8d559 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppPayBillController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppPayBillController.java @@ -5,10 +5,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.ss.payBill.service.PayBillService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * @author wjh @@ -27,4 +24,9 @@ public class AppPayBillController extends BaseController { return toAjax(payBillService.refreshPayResult(payNo)); } + @GetMapping("/payResult") + public AjaxResult payResult(@RequestParam String payNo) { + return success(payBillService.getPayResult(payNo)); + } + }