ShareServiceImp.java
11.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
package com.tianbo.analysis.service.imp;
import com.tianbo.analysis.dao.*;
import com.tianbo.analysis.model.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Auther: shenhl
* @Date: 2019/8/26 17:15
*/
@Service
@Slf4j
/**
*
* 共享
*/
public class ShareServiceImp {
@Autowired
ARRIVEDMASTERMapper arrivedmasterMapper;
@Autowired
ARRIVEDSECONDARYMapper arrivedsecondaryMapper;
@Autowired
DEPARTURESLOADINGMapper departuresloadingMapper;
@Autowired
PREPAREMASTERMapper preparemasterMapper;
@Autowired
PREPARESECONDARYMapper preparesecondaryMapper;
@Autowired
TALLYMASTERMapper tallymasterMapper;
@Autowired
TALLYSECONDARYMapper tallysecondaryMapper;
@Autowired
ORIGINMANIFESTMASTERMapper originmanifestmasterMapper;
@Autowired
OriginmanifestsecondaryMapper originmanifestsecondaryMapper;
@Autowired
CUSTOMSMESSAGEMapper customsmessageMapper;
public int share(String type, CustomReception customReception){
// 发送日志 插入
CoustomAnalysisServiceImp coustomAnalysisServiceImp = new CoustomAnalysisServiceImp();
CUSTOMSMESSAGEWithBLOBs cus = customsmessageMapper.selectMessage(customReception.getMessageID());
switch (type){
case "MT9999":
return MT1201MT9999(customReception, cus, type);
case "MT3201":
// 判断 主单id 主单号是否为空
if (cus.getMasterautoid() != null && cus.getWaybillnomaster() != null){
String waybill = waybill(cus.getWaybillnomaster());
ARRIVEDMASTER arrivedmaster = new ARRIVEDMASTER();
arrivedmaster.setFlightno(cus.getFlightno());
arrivedmaster.setFlightdate(cus.getFlightdate());
arrivedmaster.setReceiptinformation(customReception.getResponseText());
arrivedmaster.setAutoid(cus.getMasterautoid());
arrivedmaster.setWaybillnomaster(waybill);
int i = arrivedmasterMapper.updateRECEIPTION(arrivedmaster);
//插入sendlog记录表
log.info("即将插入日志运单号为:"+waybill+"->autoid="+cus.getMasterautoid());
int ii = coustomAnalysisServiceImp.insertSendlog(type,customReception.getResponseText(),cus.getMasterautoid());
if (i > 0 && ii > 0){
return 1;
}
return 0;
}else {
// 分单
ARRIVEDSECONDARY arrivedsecondary = new ARRIVEDSECONDARY();
arrivedsecondary.setReceiption(customReception.getResponseText());
arrivedsecondary.setAutoid(cus.getSecondaryautoid());
arrivedsecondary.setWaybillnomaster(cus.getWaybillnomaster());
arrivedsecondary.setWaybillnosecondary(cus.getWaybillnosecondary());
int i = arrivedsecondaryMapper.updateRECEIPTION(arrivedsecondary);
//插入sendlog记录表
log.info("即将插入日志运单号为:"+cus.getWaybillnosecondary()+"->autoid="+cus.getSecondaryautoid());
int ii = coustomAnalysisServiceImp.insertSendlog(type,customReception.getResponseText(),cus.getSecondaryautoid());
if (i > 0 && ii > 0){
return 1;
}
}
case "MT5202":
return tallAWB_H(customReception, cus, type);
case "MT5201":
return tallAWB_H(customReception, cus, type);
case "MT4201":
String waybill = waybill(cus.getWaybillnomaster());
DEPARTURESLOADING departuresloading = new DEPARTURESLOADING();
departuresloading.setFlightno(cus.getFlightno());
departuresloading.setFlightdate(cus.getFlightdate());
departuresloading.setReceiption(customReception.getResponseText());
departuresloading.setId(cus.getMasterautoid());
departuresloading.setWaybillno(waybill);
int i = departuresloadingMapper.updateRECEIPTION(departuresloading);
//插入sendlog记录表
log.info("即将插入日志运单号为:"+waybill+"->autoid="+cus.getMasterautoid());
int ii = coustomAnalysisServiceImp.insertSendlog(type,customReception.getResponseText(),cus.getMasterautoid());
if (i > 0 && ii > 0){
return 1;
}
case "MT1201":
return MT1201MT9999(customReception, cus, type);
case "MT2201":
// 判断 主单id 主单号是否为空
if (cus.getMasterautoid() != null && cus.getWaybillnomaster() != null){
String waybill1 = waybill(cus.getWaybillnomaster());
PREPAREMASTER preparemaster = new PREPAREMASTER();
preparemaster.setFlightno(cus.getFlightno());
preparemaster.setFlightdate(cus.getFlightdate());
preparemaster.setReceiptinformation(customReception.getResponseText());
preparemaster.setAutoid(cus.getMasterautoid());
preparemaster.setWaybillnomaster(waybill1);
int i1 = preparemasterMapper.updateRECEIPTION(preparemaster);
//插入sendlog记录表
log.info("即将插入日志运单号为:"+waybill1+"->autoid="+cus.getMasterautoid());
int ii1 = coustomAnalysisServiceImp.insertSendlog(type,customReception.getResponseText(),cus.getMasterautoid());
if (i1 > 0 && ii1 > 0){
return 1;
}
return 0;
}else {
// 分单
PREPARESECONDARY preparesecondary = new PREPARESECONDARY();
preparesecondary.setReceiptinformation(customReception.getResponseText());
preparesecondary.setAutoid(cus.getSecondaryautoid());
preparesecondary.setWaybillnomaster(cus.getWaybillnomaster());
preparesecondary.setWaybillnosecondary(cus.getWaybillnosecondary());
int i1 = preparesecondaryMapper.updateRECEIPTION(preparesecondary);
//插入sendlog记录表
log.info("即将插入日志运单号为:"+cus.getWaybillnosecondary()+"->autoid="+cus.getSecondaryautoid());
int ii1 = coustomAnalysisServiceImp.insertSendlog(type,customReception.getResponseText(),cus.getSecondaryautoid());
if (i1 > 0 && ii1 > 0){
return 1;
}
}
}
return 0;
}
public String waybill (String waybill){
StringBuffer stringBuffer = new StringBuffer(waybill);
StringBuffer insert = stringBuffer.insert(3, "-");
return insert.toString();
}
// 主分单
public int tallAWB_H(CustomReception customReception, CUSTOMSMESSAGEWithBLOBs cus, String type){
// 发送日志 插入
CoustomAnalysisServiceImp coustomAnalysisServiceImp = new CoustomAnalysisServiceImp();
// 判断 主单id 主单号是否为空
if (cus.getMasterautoid() != null && cus.getWaybillnomaster() != null){
String waybill = waybill(cus.getWaybillnomaster());
TALLYMASTER tallymaster = new TALLYMASTER();
tallymaster.setFlightno(cus.getFlightno());
tallymaster.setFlightdate(cus.getFlightdate());
tallymaster.setReceiptinformation(customReception.getResponseText());
tallymaster.setAutoid(cus.getMasterautoid());
tallymaster.setWaybillnomaster(waybill);
int i = tallymasterMapper.updateRECEIPTION(tallymaster);
//插入sendlog记录表
log.info("即将插入日志运单号为:"+waybill+"->autoid="+cus.getMasterautoid());
int ii = coustomAnalysisServiceImp.insertSendlog(type,customReception.getResponseText(),cus.getMasterautoid());
if (i > 0 && ii > 0){
return 1;
}
return 0;
}else {
// 分单
TALLYSECONDARY tallysecondary = new TALLYSECONDARY();
tallysecondary.setReceiptinformation(customReception.getResponseText());
tallysecondary.setAutoid(cus.getSecondaryautoid());
tallysecondary.setWaybillnomaster(cus.getWaybillnomaster());
tallysecondary.setWaybillnosecondary(cus.getWaybillnosecondary());
int i = tallysecondaryMapper.updateRECEIPTION(tallysecondary);
//插入sendlog记录表
log.info("即将插入日志运单号为:"+cus.getWaybillnosecondary()+"->autoid="+cus.getSecondaryautoid());
int ii = coustomAnalysisServiceImp.insertSendlog(type,customReception.getResponseText(),cus.getSecondaryautoid());
if (i > 0 && ii > 0){
return 1;
}
return 0;
}
}
// MT9999 MT1201
public int MT1201MT9999(CustomReception customReception, CUSTOMSMESSAGEWithBLOBs cus, String type) {
// 发送日志 插入
CoustomAnalysisServiceImp coustomAnalysisServiceImp = new CoustomAnalysisServiceImp();
// 判断 主单id 主单号是否为空
if (cus.getMasterautoid() != null && cus.getWaybillnomaster() != null) {
String waybill = waybill(cus.getWaybillnomaster());
ORIGINMANIFESTMASTER or = new ORIGINMANIFESTMASTER();
or.setFlightno(cus.getFlightno());
or.setFlightDate(cus.getFlightdate());
or.setReceiptinformation(customReception.getResponseText());
or.setAutoid(cus.getMasterautoid());
or.setWaybillnomaster(waybill);
int i = originmanifestmasterMapper.updateRECEIPTION(or);
//插入sendlog记录表
log.info("即将插入日志运单号为:" + waybill + "->autoid=" + cus.getMasterautoid());
int ii = coustomAnalysisServiceImp.insertSendlog(type, customReception.getResponseText(), cus.getMasterautoid());
if (i > 0 && ii > 0) {
return 1;
}
return 0;
} else {
// 分单
Originmanifestsecondary or = new Originmanifestsecondary();
or.setReceiption(customReception.getResponseText());
or.setAutoid(cus.getSecondaryautoid());
or.setWaybillnomaster(cus.getWaybillnomaster());
or.setWaybillnosecondary(cus.getWaybillnosecondary());
int i = originmanifestsecondaryMapper.updateRECEIPTION(or);
//插入sendlog记录表
log.info("即将插入日志运单号为:" + cus.getWaybillnosecondary() + "->autoid=" + cus.getSecondaryautoid());
int ii = coustomAnalysisServiceImp.insertSendlog(type, customReception.getResponseText(), cus.getSecondaryautoid());
if (i > 0 && ii > 0) {
return 1;
}
return 0;
}
}
}