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();
|
}
|
}
|
|
|
}
|