|
@@ -3,10 +3,13 @@ package com.sckw.payment.task;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.sckw.payment.api.model.constant.ChannelEnum;
|
|
import com.sckw.payment.api.model.constant.ChannelEnum;
|
|
|
import com.sckw.payment.api.model.dto.common.R;
|
|
import com.sckw.payment.api.model.dto.common.R;
|
|
|
|
|
+import com.sckw.payment.dao.KwpWalletReceiveMapper;
|
|
|
import com.sckw.payment.dao.KwpWalletRefundMapper;
|
|
import com.sckw.payment.dao.KwpWalletRefundMapper;
|
|
|
import com.sckw.payment.dao.KwpWalletTransferMapper;
|
|
import com.sckw.payment.dao.KwpWalletTransferMapper;
|
|
|
|
|
+import com.sckw.payment.model.KwpWalletReceive;
|
|
|
import com.sckw.payment.model.KwpWalletRefund;
|
|
import com.sckw.payment.model.KwpWalletRefund;
|
|
|
import com.sckw.payment.model.KwpWalletTransfer;
|
|
import com.sckw.payment.model.KwpWalletTransfer;
|
|
|
|
|
+import com.sckw.payment.model.constant.ReceiveEnum;
|
|
|
import com.sckw.payment.model.constant.RefundEnum;
|
|
import com.sckw.payment.model.constant.RefundEnum;
|
|
|
import com.sckw.payment.model.constant.TransferEnum;
|
|
import com.sckw.payment.model.constant.TransferEnum;
|
|
|
import com.sckw.payment.model.dto.wallet.SplitDto;
|
|
import com.sckw.payment.model.dto.wallet.SplitDto;
|
|
@@ -35,6 +38,8 @@ public class RefundTask {
|
|
|
private KwpWalletRefundMapper kwpWalletRefundMapper;
|
|
private KwpWalletRefundMapper kwpWalletRefundMapper;
|
|
|
@Resource
|
|
@Resource
|
|
|
private KwpWalletTransferMapper kwpWalletTransferMapper;
|
|
private KwpWalletTransferMapper kwpWalletTransferMapper;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private KwpWalletReceiveMapper kwpWalletReceiveMapper;
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0/1 * * * ? ")
|
|
@Scheduled(cron = "0 0/1 * * * ? ")
|
|
|
public void task() {
|
|
public void task() {
|
|
@@ -69,20 +74,28 @@ public class RefundTask {
|
|
|
LambdaQueryWrapper<KwpWalletTransfer> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpWalletTransfer> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(KwpWalletTransfer::getStatus, TransferEnum.TRANSFERRING.getStatus());
|
|
wrapper.eq(KwpWalletTransfer::getStatus, TransferEnum.TRANSFERRING.getStatus());
|
|
|
List<KwpWalletTransfer> kwpWalletTransferList = kwpWalletTransferMapper.selectList(wrapper);
|
|
List<KwpWalletTransfer> kwpWalletTransferList = kwpWalletTransferMapper.selectList(wrapper);
|
|
|
- if (CollectionUtils.isEmpty(kwpWalletTransferList)) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ LambdaQueryWrapper<KwpWalletReceive> wrapper2 = new LambdaQueryWrapper<>();
|
|
|
|
|
+ wrapper2.eq(KwpWalletReceive::getStatus, ReceiveEnum.TRANSFERRING.getStatus());
|
|
|
|
|
+ List<KwpWalletReceive> walletReceiveList = kwpWalletReceiveMapper.selectList(wrapper2);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (CollectionUtils.isEmpty(kwpWalletTransferList) && CollectionUtils.isEmpty(walletReceiveList)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
|
- for (KwpWalletTransfer kwpWalletTransfer : kwpWalletTransferList) {
|
|
|
|
|
- //查询清分状态,修改退款单状态
|
|
|
|
|
- R<List<SplitDto>> listR = payCenterService.agentPayQuery(kwpWalletTransfer.getUid(), ChannelEnum.getByChannel(kwpWalletTransfer.getChannel()), kwpWalletTransfer.getOrderNo());
|
|
|
|
|
- if (listR.getStatus()) {
|
|
|
|
|
- List<SplitDto> data = listR.getData();
|
|
|
|
|
- if (!CollectionUtils.isEmpty(data)) {
|
|
|
|
|
- if (data.stream().allMatch(a -> a.getStatus() == 1)) {
|
|
|
|
|
- kwpWalletTransfer.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
- kwpWalletTransfer.setStatus(TransferEnum.SUCCESS.getStatus());
|
|
|
|
|
- kwpWalletTransferMapper.updateById(kwpWalletTransfer);
|
|
|
|
|
|
|
+ if(!CollectionUtils.isEmpty(kwpWalletTransferList)){
|
|
|
|
|
+ for (KwpWalletTransfer kwpWalletTransfer : kwpWalletTransferList) {
|
|
|
|
|
+ //查询清分状态,修改退款单状态
|
|
|
|
|
+ R<List<SplitDto>> listR = payCenterService.agentPayQuery(kwpWalletTransfer.getUid(), ChannelEnum.getByChannel(kwpWalletTransfer.getChannel()), kwpWalletTransfer.getOrderNo());
|
|
|
|
|
+ if (listR.getStatus()) {
|
|
|
|
|
+ List<SplitDto> data = listR.getData();
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(data)) {
|
|
|
|
|
+ if (data.stream().allMatch(a -> a.getStatus() == 1)) {
|
|
|
|
|
+ kwpWalletTransfer.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
+ kwpWalletTransfer.setStatus(TransferEnum.SUCCESS.getStatus());
|
|
|
|
|
+ kwpWalletTransferMapper.updateById(kwpWalletTransfer);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -90,5 +103,25 @@ public class RefundTask {
|
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
log.error("转账定时任务异常:{}", ex, ex);
|
|
log.error("转账定时任务异常:{}", ex, ex);
|
|
|
}
|
|
}
|
|
|
|
|
+ try {
|
|
|
|
|
+ if(!CollectionUtils.isEmpty(walletReceiveList)){
|
|
|
|
|
+ for (KwpWalletReceive kwpWalletReceive : walletReceiveList) {
|
|
|
|
|
+ //查询清分状态,修改退款单状态
|
|
|
|
|
+ R<List<SplitDto>> listR = payCenterService.agentPayQuery(kwpWalletReceive.getUid(), ChannelEnum.getByChannel(kwpWalletReceive.getChannel()), kwpWalletReceive.getOrderNo());
|
|
|
|
|
+ if (listR.getStatus()) {
|
|
|
|
|
+ List<SplitDto> data = listR.getData();
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(data)) {
|
|
|
|
|
+ if (data.stream().allMatch(a -> a.getStatus() == 1)) {
|
|
|
|
|
+ kwpWalletReceive.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
+ kwpWalletReceive.setStatus(ReceiveEnum.SUCCESS.getStatus());
|
|
|
|
|
+ kwpWalletReceiveMapper.updateById(kwpWalletReceive);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
|
+ log.error("货到付款任务异常:{}", ex, ex);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|