|
@@ -48,7 +48,6 @@ import java.util.concurrent.TimeUnit;
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class WxApiService {
|
|
|
- private static final Vector<String> TRADE_NOS_BETWEEN_QUERY = new Vector<>();
|
|
|
private final WxApiDao dao;
|
|
|
private final InpatientDao yjjDao;
|
|
|
private final SpringRetryService retryService;
|
|
@@ -187,16 +186,12 @@ public class WxApiService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public boolean tradeNoBetweenQuery(String tradeNo) {
|
|
|
- return TRADE_NOS_BETWEEN_QUERY.contains(tradeNo);
|
|
|
- }
|
|
|
-
|
|
|
@Async("asyncTask")
|
|
|
public CompletableFuture<ResultVo<String>> queryOrderState(String tradeNo) throws Exception {
|
|
|
- while (tradeNoBetweenQuery(tradeNo)) {
|
|
|
+ while (TradeVectorUtil.tradeNoBetweenQuery(tradeNo)) {
|
|
|
TimeUnit.SECONDS.sleep(1);
|
|
|
}
|
|
|
- TRADE_NOS_BETWEEN_QUERY.add(tradeNo);
|
|
|
+ TradeVectorUtil.add(tradeNo);
|
|
|
JSONObject obj = retryService.queryOrderStateFromTencent(tradeNo);
|
|
|
dao.incrementQueryTimesByTradeNo(tradeNo);
|
|
|
String tradeState = obj.getString("trade_state");
|
|
@@ -221,11 +216,11 @@ public class WxApiService {
|
|
|
saveRet = ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未识别到的订单类型,请联系服务中心。");
|
|
|
break;
|
|
|
}
|
|
|
- TRADE_NOS_BETWEEN_QUERY.remove(tradeNo);
|
|
|
+ TradeVectorUtil.remove(tradeNo);
|
|
|
return CompletableFuture.completedFuture(saveRet);
|
|
|
}
|
|
|
String message = updatePayStatusByTradeState(tradeState, tradeNo);
|
|
|
- TRADE_NOS_BETWEEN_QUERY.remove(tradeNo);
|
|
|
+ TradeVectorUtil.remove(tradeNo);
|
|
|
return CompletableFuture.completedFuture(ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, message));
|
|
|
}
|
|
|
|