Browse Source

优化

feature-1.1
wuxicheng 3 years ago
parent
commit
a4539275ae
  1. 4
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/BnyerImgApplication.java
  2. 4
      bnyer-services/bnyer-order/src/main/java/com/bnyer/order/BnyerOrderApplication.java
  3. 8
      bnyer-services/bnyer-pay/src/main/java/com/bnyer/pay/design/strategy/AbstractPayStrategy.java

4
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/BnyerImgApplication.java

@ -9,13 +9,13 @@ import org.springframework.scheduling.annotation.EnableAsync;
/** /**
* 系统模块 * 系统模块
* *
* @author penny * @author penny
*/ */
@EnableCustomConfig @EnableCustomConfig
@EnableCustomSwagger2 @EnableCustomSwagger2
@EnableRyFeignClients @EnableRyFeignClients
@SpringBootApplication(scanBasePackages = { "com.bnyer"}) @SpringBootApplication(scanBasePackages = { "com.bnyer.common"})
@EnableAsync @EnableAsync
public class BnyerImgApplication public class BnyerImgApplication
{ {

4
bnyer-services/bnyer-order/src/main/java/com/bnyer/order/BnyerOrderApplication.java

@ -9,13 +9,13 @@ import org.springframework.scheduling.annotation.EnableAsync;
/** /**
* 订单模块 * 订单模块
* *
* @author penny * @author penny
*/ */
@EnableCustomConfig @EnableCustomConfig
@EnableCustomSwagger2 @EnableCustomSwagger2
@EnableRyFeignClients @EnableRyFeignClients
@SpringBootApplication(scanBasePackages = { "com.bnyer" }) @SpringBootApplication(scanBasePackages = { "com.bnyer.common"})
@EnableAsync @EnableAsync
public class BnyerOrderApplication public class BnyerOrderApplication
{ {

8
bnyer-services/bnyer-pay/src/main/java/com/bnyer/pay/design/strategy/AbstractPayStrategy.java

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

Loading…
Cancel
Save