Pu Zhibing
3 天以前 0a8d28436b2f7229ecdf40c6b003902002c8947f
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
62
63
64
65
66
67
68
69
70
71
package com.stylefeng.guns.modular.shunfeng.task.jobs;
 
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.shunfeng.model.OrderRide;
import com.stylefeng.guns.modular.shunfeng.model.TimeTask;
import com.stylefeng.guns.modular.shunfeng.task.base.AbstractJob;
import com.stylefeng.guns.modular.system.model.Company;
import com.stylefeng.guns.modular.system.util.qianyuntong.OrderUtil;
import com.stylefeng.guns.modular.system.util.qianyuntong.model.ModifyTravelItineraryRequest;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
 
/**
 *  支付倒计时
 *  @author lvxue
 *  @date 2019年01月22日
 *  @version 1.0
 */
public class CourseExamineRide extends AbstractJob {
 
    public static final String DSCE = "orderRide";
 
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        JobDataMap maps = context.getMergedJobDataMap();
        Integer orderId = maps.getInt("orderId");
        Integer timeTaskId = maps.getInt("timeTaskId");
        try {
            System.out.println("----当id为:"+orderId+"的订单未支付,自动取消支付,释放");
 
            OrderRide order = this.orderRideService.selectById(orderId);
            if(order.getState().equals(1) || order.getState() ==1 ){
                //自动取消
                order.setState(6);
                this.orderRideService.updateById(order);
 
                //未支付的情况取消订单
                if(ToolUtil.isNotEmpty(order.getZttravelId())){
                    OrderUtil.tradeOrderCancel(order.getZttravelId());
                }
            }
            //修改定时任务数据状态
            TimeTask timeTask=timeTaskService.selectById(timeTaskId);
            //0有效,1无效
            timeTask.setState(1);
            timeTaskService.updateById(timeTask);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
 
    private Integer getState(Integer state){
        switch (state){
            case 1:
                return 7;
            case 2:
                return 1;
            case 3:
                return 4;
            case 4:
                return 5;
            case 5:
                return 8;
            case 6:
                return 10;
        }
        return null;
    }
}