|
|
@@ -95,10 +95,23 @@ public class PayCallService extends SuperService {
|
|
|
if (orderType != OrderState.WAIT_PAYMENT) {
|
|
|
return ResultContent.buildFail(String.format("订单不能支付:%s", orderType.getRemark()));
|
|
|
}
|
|
|
+
|
|
|
// 得到用户所有的支付渠道,依次尝试扣款
|
|
|
- List<PaymentType> paymentTypes = payOrderSettingService.getUserPayment(entity.getUserId(), entity.getProjectOid());
|
|
|
+ ResultContent<List<PaymentType>> resultContent = payOrderSettingService.getUserPayment(entity.getUserId(), entity.getProjectOid());
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
+ String msg = resultContent.getMsg();
|
|
|
+ entity.setPaymentStatus("支付失败");
|
|
|
+ entity.setIsPaySuccess(Boolean.FALSE);
|
|
|
+ entity.setPayRemark(msg);
|
|
|
+ entity.setOrderType(OrderState.PAID_ERROR);
|
|
|
+ entity.setIsPaid(Boolean.TRUE);
|
|
|
+ expenseFlowDao.save(entity);
|
|
|
+ return ResultContent.buildFail(msg);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<PaymentType> paymentTypes = resultContent.getContent();
|
|
|
if (ObjectUtils.isEmpty(paymentTypes)) {
|
|
|
- String msg = "项目无支付渠道";
|
|
|
+ String msg = "用户暂无开启支付渠道";
|
|
|
entity.setPaymentStatus("支付失败");
|
|
|
entity.setIsPaySuccess(Boolean.FALSE);
|
|
|
entity.setPayRemark(msg);
|
|
|
@@ -107,6 +120,7 @@ public class PayCallService extends SuperService {
|
|
|
expenseFlowDao.save(entity);
|
|
|
return ResultContent.buildFail(msg);
|
|
|
}
|
|
|
+
|
|
|
log.info("开始时间:{}", DateUtils.paresTime(System.currentTimeMillis(), DateUtils.patternyyyySSS));
|
|
|
log.info("开始支付: {} {}", entity.getPaymentNo(), paymentTypes);
|
|
|
int maxTime = 2 * 1000;
|
|
|
@@ -151,9 +165,9 @@ public class PayCallService extends SuperService {
|
|
|
entity.setIsPaySuccess(Boolean.FALSE);
|
|
|
entity.setPayRemark(msg);
|
|
|
entity.setOrderType(OrderState.PAID_ERROR);
|
|
|
- entity.setIsPaid(Boolean.TRUE);
|
|
|
- expenseFlowDao.save(entity);
|
|
|
}
|
|
|
+ entity.setIsPaid(Boolean.TRUE);
|
|
|
+ expenseFlowDao.save(entity);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -606,7 +620,7 @@ public class PayCallService extends SuperService {
|
|
|
expenseFlow.setRefundTransactionIds(resultContent.getContent());
|
|
|
}
|
|
|
refundRecordService.markState(param.getRefundOrderId(), RefundState.Refunded, resultContent.getContent());
|
|
|
- } else if (refundStatus.equals("FAIL")){
|
|
|
+ } else if (refundStatus.equals("FAIL")) {
|
|
|
orderNoInfoService.markSuccess(paymentNo);
|
|
|
// 退款失败
|
|
|
expenseFlow.setIsRefund(Boolean.TRUE);
|
|
|
@@ -681,6 +695,12 @@ public class PayCallService extends SuperService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 支付类型转换,主要是:WeChat -> UserWallet
|
|
|
+ *
|
|
|
+ * @param paymentType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public PaymentType turnPaymentType(PaymentType paymentType) {
|
|
|
if (paymentType != null && paymentType == PaymentType.WeChat) {
|
|
|
return PaymentType.UserWallet;
|