8.3
luodangjia
2024-08-03 67157345fe1878681e39ec186ef37ff6b3b5c1fc
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
57
58
59
60
61
package com.ruoyi.order.task;
 
 
import com.ruoyi.order.entity.WithdrawDetail;
import com.ruoyi.order.service.WithdrawDetailService;
import com.ruoyi.order.vx.GetTransferBatchByOutNo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
import java.util.List;
 
 
/**
 * 定时任务工具类
 */
@Component
public class TaskUtil {
 
    @Resource
    private WithdrawDetailService withdrawDetailService;
 
 
    /**
     * 每隔一分钟去处理的定时任务
     */
    @Scheduled(fixedRate = 10000 * 60)
    public void taskMinute(){
        try {
 
            List<WithdrawDetail> list = withdrawDetailService.lambdaQuery().ne(WithdrawDetail::getStatus, "SUCCESS").ne(WithdrawDetail::getStatus, "FAIL").list();
 
            for (WithdrawDetail withdrawDetail : list) {
                String s = GetTransferBatchByOutNo.checkStatus(withdrawDetail.getOutBatchNo());
                if (s.equals("SUCCESS")) {
                    withdrawDetail.setStatus("SUCCESS");
                    withdrawDetailService.updateById(withdrawDetail);
                    //执行订单提现成功,增加提现成功金额
                    //查询订单
 
                    //增加已提现金额
 
 
                } else if (s.equals("FAIL")) {
                    withdrawDetail.setStatus("FAIL");
                    withdrawDetailService.updateById(withdrawDetail);
                }else {
                    withdrawDetail.setStatus(s);
                    withdrawDetailService.updateById(withdrawDetail);
                }
 
            }
 
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
 
}