|
|
@@ -180,18 +180,21 @@ public class WithdrawApplyService {
|
|
|
}
|
|
|
|
|
|
@Async
|
|
|
- public void fixCharge() {
|
|
|
- withdrawApplyRepo.findByStatusAndAmountLessThanEqual(WithdrawStatus.SUCCESS, new BigDecimal("1000"))
|
|
|
- .parallelStream().forEach(apply -> {
|
|
|
- try {
|
|
|
- UserBankCard bankCard = userBankCardRepo.findByUserId(apply.getUserId())
|
|
|
- .stream().findFirst()
|
|
|
- .orElseThrow(new BusinessException("未绑卡"));
|
|
|
- JSONObject res = sandPayService.transfer(snowflakeIdWorker.nextId() + "", bankCard.getRealName(),
|
|
|
- bankCard.getBankNo(), new BigDecimal("6"));
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("fixCharge", e);
|
|
|
- }
|
|
|
- });
|
|
|
+ public void fixCharge() throws ExecutionException, InterruptedException {
|
|
|
+ new ForkJoinPool(5).submit(() -> {
|
|
|
+ withdrawApplyRepo.findByStatusAndAmountLessThanEqual(WithdrawStatus.SUCCESS, new BigDecimal("1000"))
|
|
|
+ .parallelStream().forEach(apply -> {
|
|
|
+ try {
|
|
|
+ UserBankCard bankCard = userBankCardRepo.findByUserId(apply.getUserId())
|
|
|
+ .stream().findFirst()
|
|
|
+ .orElseThrow(new BusinessException("未绑卡"));
|
|
|
+ JSONObject res = sandPayService.transfer(snowflakeIdWorker.nextId() + "", bankCard.getRealName(),
|
|
|
+ bankCard.getBankNo(), new BigDecimal("6"));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("fixCharge", e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }).get();
|
|
|
+
|
|
|
}
|
|
|
}
|