|
|
|
@ -7,15 +7,14 @@ import com.bnyer.common.core.constant.RedisKeyConstant; |
|
|
|
import com.bnyer.common.core.enums.EnumPayType; |
|
|
|
import com.bnyer.common.redis.service.RedissonService; |
|
|
|
import com.bnyer.pay.bean.dto.PayNotifyCheckDto; |
|
|
|
import com.bnyer.pay.service.PayInfoService; |
|
|
|
import com.bnyer.pay.bean.vo.PayInfoDetailsVo; |
|
|
|
import com.bnyer.pay.service.PayInfoService; |
|
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayNotifyV3Response; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.redisson.api.RLock; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
|
|
import java.util.Objects; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author :WXC |
|
|
|
@ -45,7 +44,7 @@ public abstract class AbstractPayStrategy implements IPayStrategy { |
|
|
|
String resultMsg = ""; |
|
|
|
RLock rLock = redissonService.getRLock(RedisKeyConstant.PAY_NOTIFY_LOCK_KEY + checkDto.getPayId()); |
|
|
|
try{ |
|
|
|
if(rLock.tryLock(2L, 10L, TimeUnit.SECONDS)){ |
|
|
|
if(rLock.tryLock()){ |
|
|
|
PayInfoDetailsVo payInfoDetailsVo = payInfoService.queryPayInfoDetails(checkDto.getPayId()); |
|
|
|
log.info("查询到支付订单信息为:{}", JSON.toJSONString(payInfoDetailsVo)); |
|
|
|
//订单中的金额
|
|
|
|
@ -67,8 +66,7 @@ public abstract class AbstractPayStrategy implements IPayStrategy { |
|
|
|
resultMsg = buildNotifyCheckResultMsg(checkDto.getPayType(),false,"trade fail"); |
|
|
|
} |
|
|
|
}catch (Exception e){ |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("回调结果校验失败,支付单号:{}",checkDto.getPayId()); |
|
|
|
log.error("回调结果校验失败,支付单号:{},error:{}",checkDto.getPayId(),e.getMessage()); |
|
|
|
resultMsg = buildNotifyCheckResultMsg(checkDto.getPayType(),false,"trade fail"); |
|
|
|
}finally { |
|
|
|
rLock.unlock(); |
|
|
|
|