FinanceSchedule.java
2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.glsx.usedcar.task;
import com.github.binarywang.wxpay.bean.transfer.TransferBillsGetResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.glsx.usedcar.module.finance.entity.Withdraw;
import com.glsx.usedcar.module.finance.service.WithdrawService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.List;
@Slf4j
@Component
public class FinanceSchedule {
@Resource
private WxPayService wxService;
@Resource
private WithdrawService withdrawService;
/**
* 查询企业付款到零钱的结果
*
* @return
* @throws WxPayException
*/
// @Scheduled(fixedDelay = 1000 * 10, initialDelay = 1000 * 50)
// public void queryEntPay() {
// LocalDateTime now = LocalDateTime.now();
// List<Withdraw> auditedWithdraws = withdrawService.getAuditedWithdraws(now.minusDays(2));
// for (Withdraw withdraw : auditedWithdraws) {
// String outBillNo = withdraw.getWithdrawCode();
// // 查询企业付款到零钱的结果
// try {
// TransferBillsGetResult result = wxService.getTransferService().getBillsByOutBillNo(outBillNo);
// log.debug("=== 查询转账结果(商户单号)===");
// log.debug("商户单号: " + result.getOutBillNo());
// log.debug("微信转账单号: " + result.getTransferBillNo());
// log.debug("状态: " + result.getState());
// log.debug("转账金额: " + result.getTransferAmount() + "分");
// log.debug("用户openid: " + result.getOpenid());
// log.debug("转账备注: " + result.getTransferRemark());
// log.debug("查询企业付款到零钱的结果:{}", result);
// withdrawService.updateWithdrawStatus(result);
// } catch (Exception e) {
// // 处理异常
// e.printStackTrace();
// log.error("查询企业付款到零钱的结果失败:{}", e.getMessage());
// }
// }
// }
}