jiazx0107@163.com
2023-08-11 be175fe739e687cd1d45da58f2cb7dd0c36d001f
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.ld.igds.io.impl;
 
import com.ld.igds.constant.BizType;
import com.ld.igds.io.notify.NotifyGrainInvoker;
import com.ld.igds.models.DepotConf;
import com.ld.igds.models.DicSysConf;
import com.ld.igds.models.Grain;
import com.ld.igds.order.ExeOrderService;
import com.ld.igds.order.data.ExeRequest;
import com.ld.igds.util.SpringUtil;
import lombok.extern.slf4j.Slf4j;
 
import java.util.concurrent.Callable;
 
/**
 * 模拟演示粮情返回任务
 */
@Slf4j
public class DefaultAnalysisGrainTask implements Callable<String> {
 
    private Grain grainData;
    DepotConf depotConf;
    DicSysConf sysConf;
    String orderId;
 
    public DepotConf getDepotConf() {
        return depotConf;
    }
 
    public void setDepotConf(DepotConf depotConf) {
        this.depotConf = depotConf;
    }
 
    public DicSysConf getSysConf() {
        return sysConf;
    }
 
    public void setSysConf(DicSysConf sysConf) {
        this.sysConf = sysConf;
    }
 
    public Grain getGrainData() {
        return grainData;
    }
 
    public void setGrainData(Grain grainData) {
        this.grainData = grainData;
    }
 
    public String getOrderId() {
        return orderId;
    }
 
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
 
    public DefaultAnalysisGrainTask() {
    }
 
    public DefaultAnalysisGrainTask(Grain grainData, DepotConf depotConf,
                                    DicSysConf sysConf, String orderId) {
        this.grainData = grainData;
        this.depotConf = depotConf;
        this.sysConf = sysConf;
        this.orderId = orderId;
    }
 
    @Override
    public String call() throws Exception {
 
        Thread.sleep(5 * 1000);
 
        NotifyGrainInvoker notifyGrainInvoker = SpringUtil
                .getBean(NotifyGrainInvoker.class);
 
        ExeOrderService exeOrderService = SpringUtil.getBean(ExeOrderService.class);
 
        ExeRequest exeRequest = exeOrderService.getOrderById(BizType.GRAIN.getCode(), orderId);
 
        if (null != notifyGrainInvoker) {
            notifyGrainInvoker.analysisSuccess(grainData, exeRequest, sysConf);
        } else {
            log.error("-------粮情子任务没有获取到:NotifyGrainInvoker的注入类");
        }
 
        return "SUCCESS";
    }
}