NmmsBase.java
2.7 KB
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
package com.tianbo.analysis.model;
import com.tianbo.analysis.model.CustomReception;
import com.tianbo.analysis.service.imp.CoustomAnalysisServiceImp;
import com.tianbo.analysis.service.imp.ShareServiceImp;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.scheduling.annotation.Async;
import java.util.Date;
@Slf4j
@Async
public class NmmsBase {
public ShareServiceImp shareServiceImp;
public CoustomAnalysisServiceImp coustomAnalysisServiceImp;
public String awbA ;
public String awbH ;
public String rspCode;
public String nmsStatusCode;
public String reception;
public String flightDateStr;
public CustomReception customReception;
public Date flightDate;
public int insertRecept(CustomReception customReception){
log.warn("公共对象监控打印{}",this);
this.shareServiceImp = new ShareServiceImp();
// 发送日志 插入
this.coustomAnalysisServiceImp = new CoustomAnalysisServiceImp();
this.customReception = customReception;
// 主单号;处理主单格式,将海关回执的主单号58019316861,变为580-19316861
this.awbA = AWBTools.awbFormat(customReception.getWayBillMaster());
this.awbH = customReception.getWayBillSecond();
this.rspCode = customReception.getResponseCode();
this.nmsStatusCode = AWBTools.transCusRspCode(rspCode);
this.reception = customReception.getResponseText();
this.flightDateStr = customReception.getFlightDate();
log.info("开始解析:运单号 {} 回执类型:{} ",awbA,customReception.getMessageType());
if (!StringUtils.isEmpty(flightDateStr)) {
this.flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
// 判断航班号 航班日期 是否为空
if (flightDate != null && customReception.getFlightNo() != null){
//有分单号 更新分单回执
if(!StringUtils.isEmpty(awbH)){
return second();
}
if (!StringUtils.isEmpty(awbA)){
return master();
}
}else {
//从发送日志表查找发送MESSAGEID进行二次入库
return shareServiceImp.share(customReception.getMessageType(), customReception);
}
}
return 0;
}
/**
* 入库分单回执信息
* @return 成功返回1,失败返回0。
*/
public int second() {
return 0;
}
/**
* 入库分单回执信息
* @return 成功返回1,失败返回0。
*/
public int master() {
return 0;
}
}