diff --git a/jsowell-quartz/src/main/java/com/jsowell/quartz/task/JsowellTask.java b/jsowell-quartz/src/main/java/com/jsowell/quartz/task/JsowellTask.java index c30332f8f..ca95f61a7 100644 --- a/jsowell-quartz/src/main/java/com/jsowell/quartz/task/JsowellTask.java +++ b/jsowell-quartz/src/main/java/com/jsowell/quartz/task/JsowellTask.java @@ -1,6 +1,5 @@ package com.jsowell.quartz.task; -import com.huifu.adapay.core.exception.BaseAdaPayException; import com.jsowell.adapay.dto.WithdrawDTO; import com.jsowell.adapay.service.AdapayService; import com.jsowell.common.constant.CacheConstants; @@ -215,33 +214,39 @@ public class JsowellTask { } // 调分账方法 - // pileMerchantInfos.parallelStream().forEach(merchant -> { - // try { - // orderBasicInfoService.orderSplittingOperations(merchant.getId() + "", yesterday.toString()); - // } catch (Exception e) { - // log.error("处理订单分账异常, merchantId:{}", merchant.getId(), e); - // } - // }); - - - // 换为实时分账后, 此方法改为 自动提现并计算前一天的分账信息 pileMerchantInfos.parallelStream().forEach(merchant -> { - automaticPayouts(merchant.getId() + ""); + try { + // orderBasicInfoService.orderSplittingOperations(merchant.getId() + "", yesterday.toString()); + orderBasicInfoService.generateMerchantBill(merchant.getId() + "", yesterday.toString()); + } catch (Exception e) { + log.error("生成运营商日报异常, merchantId:{}", merchant.getId(), e); + } }); } /** - * 自动提现并计算前一天的分账信息 - * automaticPayouts + * 定时任务,自动提现 + * jsowellTask.automaticPayouts() */ - private void automaticPayouts(String merchantId) { - WithdrawDTO dto = new WithdrawDTO(); - dto.setMerchantId(merchantId); - dto.setFeeAmt("0"); - try { - adapayService.drawCash(dto); - } catch (BaseAdaPayException e) { - throw new RuntimeException(e); + public void automaticPayouts() { + // TODO 查询开启自动提现运营商列表 + List pileMerchantInfos = pileMerchantInfoService.selectPileMerchantInfoList(null); + if (CollectionUtils.isEmpty(pileMerchantInfos)) { + log.info("定时任务,自动提现, 未查询到运营商列表,直接返回"); + return; } + + // 调提现方法 + pileMerchantInfos.parallelStream().forEach(merchant -> { + try { + WithdrawDTO dto = new WithdrawDTO(); + dto.setMerchantId(merchant.getId() + ""); + dto.setFeeAmt("0"); + adapayService.drawCash(dto); + } catch (Exception e) { + log.error("生成运营商日报异常, merchantId:{}", merchant.getId(), e); + } + }); } + }