PREPAREMASTERServiceImp.java
4.2 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package com.tianbo.analysis.service.imp;
import com.tianbo.analysis.dao.PREPAREMASTERMapper;
import com.tianbo.analysis.dao.PREPARESECONDARYMapper;
import com.tianbo.analysis.model.PREPAREMASTER;
import com.tianbo.analysis.model.PREPARESECONDARY;
import com.tianbo.analysis.model.NmmsBase;
import com.tianbo.analysis.service.PREPAREMASTERService;
import com.tianbo.analysis.tools.AWBTools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Auther: shenhl
* @Date: 2019/8/26 15:29
*/
@Service
@Slf4j
@Async
public class PREPAREMASTERServiceImp extends NmmsBase implements PREPAREMASTERService {
@Autowired
PREPAREMASTERMapper preparemasterMapper;
@Autowired
PREPARESECONDARYMapper preparesecondaryMapper;
/**
* 入库分单回执信息
* @return 成功返回1,失败返回0。
*/
@Override
public int second() {
// 设置 接收运抵分单 回执
PREPARESECONDARY preparesecondary = new PREPARESECONDARY();
preparesecondary.setReceiptinformation(reception);
String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
preparesecondary.setFlightno(flightInfo[1]);
preparesecondary.setCarrier(flightInfo[0]);
preparesecondary.setFlightdate(flightDate);
//设置主分单的 主单号
preparesecondary.setWaybillnomaster(awbA);
//取分单号
String[] awbhArr = awbH.split("_");
String awbh = awbhArr[1];
preparesecondary.setWaybillnosecondary(awbh);
preparesecondary.setStatus(nmsStatusCode);
//更新分单回执
int i = preparesecondaryMapper.updateRECEIPTION(preparesecondary);
//获取分单autoid
List<PREPARESECONDARY> arrivedsecondaryList = preparesecondaryMapper.selectAutoIdByawbAawbH(preparesecondary);
if(!arrivedsecondaryList.isEmpty()){
PREPARESECONDARY preparesecondary1 = arrivedsecondaryList.get(0);
String autoId = preparesecondary1.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
int ii = coustomAnalysisServiceImp.insertSendlog(customReception.getMessageType(),reception,autoId);
int iii = shareServiceImp.updateMessages(customReception);
if (i>0 && ii>0){
log.info("运单号 {} 原始回执更新成功",awbH);
return 1;
}
if (iii > 0){
return 1;
}
}
return 0;
}
/**
* 入库分单回执信息
* @return 成功返回1,失败返回0。
*/
@Override
public int master() {
//设置主单回执、航班号、航班日期
PREPAREMASTER preparemaster = new PREPAREMASTER();
preparemaster.setReceiptinformation(reception);
String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
preparemaster.setFlightno(flightInfo[1]);
preparemaster.setCarrier(flightInfo[0]);
preparemaster.setFlightdate(flightDate);
preparemaster.setWaybillnomaster(awbA);
preparemaster.setStatus(nmsStatusCode);
//更新主单回执
int i = preparemasterMapper.updateRECEIPTION(preparemaster);
//获取分单autoid
List<PREPAREMASTER> arrivedmasterList = preparemasterMapper.selectAutoIdByAwb(preparemaster);
if(!arrivedmasterList.isEmpty()){
PREPAREMASTER originMaster = arrivedmasterList.get(0);
String autoId = originMaster.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
int ii =coustomAnalysisServiceImp.insertSendlog(customReception.getMessageType(),reception,autoId);
int iii = shareServiceImp.updateMessages(customReception);
if (i>0 && ii>0){
log.info("运单号 {} 原始回执更新成功",awbA);
return 1;
}
if (iii > 0){
return 1;
}
}
return 0;
}
}