付款回调
This commit is contained in:
parent
866a701f31
commit
fc6eecc821
|
|
@ -47,10 +47,10 @@ public interface FinancialMasterMapper {
|
||||||
/**
|
/**
|
||||||
* 支付成功
|
* 支付成功
|
||||||
*
|
*
|
||||||
* @param paymentId 支付ID
|
* @param id ID
|
||||||
* @param payType 支付渠道
|
* @param payType 支付渠道
|
||||||
*/
|
*/
|
||||||
void paySucceeded(@Param(value = "paymentId") String paymentId, @Param(value = "payType") int payType);
|
void paySucceeded(@Param(value = "id") Long id, @Param(value = "payType") int payType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付成功
|
* 支付成功
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import com.ghy.payment.service.FinancialMasterService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
@ -97,9 +98,17 @@ public class FinancialMasterServiceImpl implements FinancialMasterService {
|
||||||
payType = -1;
|
payType = -1;
|
||||||
logger.error("paymentId[{}] Unknown payChannel [{}]!", paymentId, payChannel);
|
logger.error("paymentId[{}] Unknown payChannel [{}]!", paymentId, payChannel);
|
||||||
}
|
}
|
||||||
FinancialMaster financialMaster = financialMasterMapper.selectByPaymentId(paymentId);
|
PaymentDTO paymentDTO = paymentMapper.selectById(paymentId);
|
||||||
financialMasterMapper.updateOrderStatus(financialMaster.getOrderMasterCode(), PayStatus.PAID.getCode());
|
String orderMasterCode = paymentDTO.getOrderNo().split("_")[0];
|
||||||
financialMasterMapper.paySucceeded(paymentId, payType);
|
FinancialMaster param = new FinancialMaster();
|
||||||
|
param.setOrderMasterCode(orderMasterCode);
|
||||||
|
List<FinancialMaster> result = financialMasterMapper.selectFinancialMasterList(param);
|
||||||
|
if(!CollectionUtils.isEmpty(result)){
|
||||||
|
financialMasterMapper.updateOrderStatus(result.get(0).getOrderMasterCode(), PayStatus.PAID.getCode());
|
||||||
|
financialMasterMapper.paySucceeded(result.get(0).getId(), payType);
|
||||||
|
}else {
|
||||||
|
logger.error("原单不存在!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -112,12 +112,7 @@ public class PayCallbackService implements CallBackService {
|
||||||
String status = payment.getStatus();
|
String status = payment.getStatus();
|
||||||
financialMasterService.insertPayment(payment);
|
financialMasterService.insertPayment(payment);
|
||||||
|
|
||||||
if (AdapayStatusEnum.succeeded.code.equals(status)) {
|
if (!AdapayStatusEnum.succeeded.code.equals(status)) {
|
||||||
FinancialMaster update = new FinancialMaster();
|
|
||||||
update.setOrderMasterCode(payment.getOrderNo().split("_")[0]);
|
|
||||||
update.setPaymentId(payment.getId());
|
|
||||||
financialMasterService.updateFinancialMaster(update);
|
|
||||||
} else {
|
|
||||||
logger.warn("发起支付失败 : {}", response.toJSONString());
|
logger.warn("发起支付失败 : {}", response.toJSONString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@
|
||||||
pay_type = #{payType},
|
pay_type = #{payType},
|
||||||
pay_time = SYSDATE(),
|
pay_time = SYSDATE(),
|
||||||
update_time = SYSDATE()
|
update_time = SYSDATE()
|
||||||
WHERE payment_id = #{paymentId}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateOrderStatus">
|
<update id="updateOrderStatus">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue