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";
|
}
|
}
|