DeliveryInfoController.java
25.5 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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
package com.agent.controller.agent;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.agent.controller.BasicController;
import com.agent.entity.Constant;
import com.agent.entity.agent.BasicAgentEntity;
import com.agent.entity.agent.DeliveryInfoEntity;
import com.agent.entity.agent.ManifestEntity;
import com.agent.entity.agent.PackageSizeEntity;
import com.agent.entity.agent.PackageTypeEntity;
import com.agent.entity.agent.PubDgEntity;
import com.agent.entity.agent.SupervisionEntity;
import com.agent.entity.system.UserEntity;
import com.agent.service.agent.BasicAgentService;
import com.agent.service.agent.DeliveryDicService;
import com.agent.service.agent.DeliveryInfoService;
import com.agent.service.agent.ManifestService;
import com.agent.service.agent.PackageSizeService;
import com.agent.service.agent.PackageTypeService;
import com.agent.service.agent.PubDgService;
import com.agent.service.agent.SupervisionService;
import com.agent.util.HttpJsonMsg;
import com.agent.vo.ResponseModel;
import com.agent.vo.agent.DeliveryVo;
import com.agent.xml.XmlBuildTask;
import com.agent.xml.common.XmlUtil;
import com.agent.xml.deliveryInfo.ApplicableFreightRateServiceChargeXml;
import com.agent.xml.deliveryInfo.ArrivalEventXml;
import com.agent.xml.deliveryInfo.AssociatedReferenceDocumentXml;
import com.agent.xml.deliveryInfo.DefinedTradeContactXml;
import com.agent.xml.deliveryInfo.DeliveryInfoAssociatedPartyXml;
import com.agent.xml.deliveryInfo.DeliveryInfoConsigneePartyXml;
import com.agent.xml.deliveryInfo.DeliveryInfoConsignorPartyXML;
import com.agent.xml.deliveryInfo.DeliveryInfoFreightForwarderPartyXml;
import com.agent.xml.deliveryInfo.DeliveryInfoMasterConsignmentXml;
import com.agent.xml.deliveryInfo.DepartureEventXml;
import com.agent.xml.deliveryInfo.DirectTelephoneCommunicationXml;
import com.agent.xml.deliveryInfo.EventTimeXml;
import com.agent.xml.deliveryInfo.FaxCommunicationxML;
import com.agent.xml.deliveryInfo.FinalDestinationLocationXml;
import com.agent.xml.deliveryInfo.HandlingInstructionsXml;
import com.agent.xml.deliveryInfo.IncludedCustomsNoteXml;
import com.agent.xml.deliveryInfo.IncludedMasterConsignmentItemXml;
import com.agent.xml.deliveryInfo.LinearSpatialDimensionXml;
import com.agent.xml.deliveryInfo.NatureIdentificationTransportCargoXml;
import com.agent.xml.deliveryInfo.OccurrenceArrivalLocationXml;
import com.agent.xml.deliveryInfo.OccurrenceDepartureLocationXml;
import com.agent.xml.deliveryInfo.OriginLocationXml;
import com.agent.xml.deliveryInfo.PostalStructuredAddressXml;
import com.agent.xml.deliveryInfo.ReportedStatusXml;
import com.agent.xml.deliveryInfo.SpecifiedLocationXml;
import com.agent.xml.deliveryInfo.SpecifiedLogisticsTransportMovementXml;
import com.agent.xml.deliveryInfo.TelexCommunicationXml;
import com.agent.xml.deliveryInfo.TransportLogisticsPackageXml;
import com.agent.xml.deliveryInfo.URIEmailCommunicationXML;
import com.agent.xml.deliveryInfo.UsedLogisticsTransportMeansXml;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.framework.core.Servlets;
import com.framework.shiro.SessionUtil;
import com.plugin.easyui.DataGrid;
import com.plugin.easyui.EasyPage;
/**
* Created by cohesion on 2017/3/29.
*/
@Controller
@RequestMapping(value = "/delivery")
public class DeliveryInfoController extends BasicController {
private static final Logger logger = LoggerFactory.getLogger(DeliveryInfoController.class);
/**
* 交运信息
*/
@Resource
private DeliveryInfoService deliveryInfoService;
/**
* 代理人
*/
@Resource
private BasicAgentService agentService;
@Resource
private SupervisionService supervisionService;
@Resource
private PubDgService dgService;
@Resource
private PackageTypeService packageTypeService;
@Resource
private PackageSizeService sizeService;
@Resource
private ManifestService manifestService;
@Resource
private DeliveryDicService deliverydicservice;
/**
* 交运信息页面
*
* @return
*/
@RequestMapping(value = "/list")
public String getList() {
return "delivery/list";
}
/**
* 交运信息分页数据
*
* @return
*/
@RequestMapping(value = "/grid.json")
@ResponseBody
public DataGrid<DeliveryVo> grid(HttpServletRequest request, EasyPage<DeliveryInfoEntity> pageForm)
throws ParseException {
Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
searchParams.put("EQ_isdelete", 0);
String deliveryDate = searchParams.get("GTE_deliveryDate").toString();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
if (StringUtils.isNotEmpty(deliveryDate)) {
searchParams.put("GTE_deliveryDate", dateFormat.parse(deliveryDate));
}
String deliveryDate1 = searchParams.get("LTE_deliveryDate").toString();
if (StringUtils.isNotEmpty(deliveryDate1)) {
searchParams.put("LTE_deliveryDate", dateFormat.parse(deliveryDate1));
}
pageForm.setSearchParams(searchParams);
pageForm.parseData(deliveryInfoService.getPage(pageForm));
return transferData(pageForm);
}
/**
* 编辑
*
* @param id
* @param model
* @return
*/
@RequestMapping(value = "/edit", method = { RequestMethod.GET })
public String edit(Long id, Model model) {
DeliveryInfoEntity deliveryInfo = null;
if (id != null) {
deliveryInfo = deliveryInfoService.findOne(id);
}
model.addAttribute("delivery", deliveryInfo);
UserEntity user = SessionUtil.getUser();
if (user != null && user.getAgent() != null) {
BasicAgentEntity agent = agentService.findOne(user.getAgent());
model.addAttribute("userAgent", agent);
}
// 品名代码
// List<DeliveryDicEntity> good = deliverydicservice.findGood();
// model.addAttribute("good",good);
// 监管代码
List<SupervisionEntity> supervisionList = supervisionService.findAll();
model.addAttribute("supervisionList", supervisionList);
// 危险品代码
List<PubDgEntity> dgList = dgService.findAll();
model.addAttribute("dgList", dgList);
// 包装种类
List<PackageTypeEntity> typeList = packageTypeService.findAll();
model.addAttribute("typeList", typeList);
return "delivery/edit";
}
/**
* 获取包装类型
*
* @param hostId
* @return
*/
@RequestMapping(value = "/size/get", method = { RequestMethod.POST })
@ResponseBody
public String getSize(Long hostId) {
return JSON.toJSONString(sizeService.getList(Constant.packageSizeDelivery, hostId), filter);
}
/**
* 保存
*
* @param deliveryJson
* @return
*/
@RequestMapping(value = "/save", method = { RequestMethod.POST })
@ResponseBody
public ResponseModel save(String deliveryJson, String sizeJson) {
ResponseModel model = new ResponseModel();
try {
DeliveryInfoEntity delivery = JSONObject.parseObject(deliveryJson, DeliveryInfoEntity.class);
List<PackageSizeEntity> sizeList = JSONArray.parseArray(sizeJson, PackageSizeEntity.class);
DeliveryInfoEntity deliveryInfo = deliveryInfoService.save(delivery, sizeList);
model.setData(deliveryInfo.getId());
model.setStatus(200);
} catch (Exception e) {
model.setStatus(500);
logger.error("系统异常 >>", e);
}
return model;
}
/**
* 保存并且发送
*
* @param deliveryJson
* @return
*/
@RequestMapping(value = "/sendXml", method = { RequestMethod.POST })
@ResponseBody
public ResponseModel sendXml(String deliveryJson, String sizeJson, HttpServletRequest request) {
ResponseModel model = new ResponseModel();
try {
DeliveryInfoEntity delivery = JSONObject.parseObject(deliveryJson, DeliveryInfoEntity.class);
delivery.setIsdelete(1);
List<PackageSizeEntity> sizeList = JSONArray.parseArray(sizeJson, PackageSizeEntity.class);
DeliveryInfoEntity deliveryInfo = deliveryInfoService.save(delivery, sizeList);
// 生成报文并且发送
String rootPath = request.getSession().getServletContext().getRealPath("/");
String path = rootPath + "/excel/manifest" + new Date().getTime() + ".xml";
new XmlBuildTask(deliveryInfoService.deliveryXml(delivery), path).perform();
// String xml = XmlUtil.convertToXml2(deliveryInfoService.deliveryXml(delivery),
// path);
// new XmlSendTask().saveMessage(xml);
model.setData(deliveryInfo.getId());
model.setStatus(200);
} catch (Exception e) {
model.setStatus(500);
logger.error("系统异常 >>", e);
}
return model;
}
/**
* 查询主单号是否存在
*
* @param mawbNo
* @return
*/
@RequestMapping(value = "/queryMawbNo", method = { RequestMethod.POST })
@ResponseBody
public ResponseModel queryMawbId(Long id, String mawbNo) {
ResponseModel model = new ResponseModel();
List<DeliveryInfoEntity> list = null;
if (StringUtils.isNotEmpty(mawbNo)) {
list = deliveryInfoService.findByMawbNo(mawbNo);
}
boolean exist = false;
if (CollectionUtils.isNotEmpty(list)) {
if (list.size() > 1) {
exist = true;
} else if (!list.get(0).getId().equals(id)) {
exist = true;
}
}
if (exist) {
model.setStatus(500);
} else {
model.setStatus(200);
}
return model;
}
/**
* 删除
*
* @param ids
* @return
*/
@RequestMapping(value = "/delete", method = { RequestMethod.POST })
@ResponseBody
public ResponseModel delete(String ids) {
ResponseModel model = new ResponseModel();
try {
deliveryInfoService.deleteAll(ids);
model.setStatus(200);
model.setMsg(HttpJsonMsg.SUCCESS);
} catch (Exception e) {
model.setStatus(500);
model.setMsg(HttpJsonMsg.ERROR);
logger.error("系统异常 >>", e);
}
return model;
}
private DataGrid<DeliveryVo> transferData(EasyPage<DeliveryInfoEntity> pageForm) {
DataGrid<DeliveryInfoEntity> list = pageForm.getData();
List<DeliveryVo> rows = new ArrayList<>();
if (CollectionUtils.isNotEmpty(list.getRows())) {
for (DeliveryInfoEntity entity : list.getRows()) {
DeliveryVo vo = new DeliveryVo();
vo.setId(entity.getId());
vo.setSupplier(entity.getSupplier());
vo.setMawbNo(entity.getMawbNo());
vo.setDestination(entity.getDestination());
vo.setGoodsName(entity.getGoodsName());
vo.setCbm(entity.getCbm());
vo.setWeight(entity.getWeight());
vo.setScheduledFlight(entity.getScheduledFlight());
if (entity.getAgent() != null) {
BasicAgentEntity agent = agentService.findOne(entity.getAgent());
if (agent != null) {
vo.setAgent(agent.getNameCn());
}
}
if (entity.getSendDate() != null) {
vo.setSendDate(Constant.dateFormat.format(entity.getSendDate()));
}
rows.add(vo);
}
}
DataGrid<DeliveryVo> vos = new DataGrid<>();
vos.setRows(rows);
vos.setTotal(list.getTotal());
return vos;
}
// 发送报文
@RequestMapping(value = "/xml", method = RequestMethod.POST)
@ResponseBody
public ResponseModel createXml(Long id, HttpServletRequest request, HttpServletResponse response) throws Exception {
ResponseModel model = new ResponseModel();
String rootPath = request.getSession().getServletContext().getRealPath("/");
String path = rootPath + "/excel/delivery" + new Date().getTime() + ".xml";
String xml = "";
if (id != null) {
xml = beanToXml(path, id);
}
model.setData(xml);
return model;
}
private String beanToXml(String path, Long id) {
// 获取表中信息
DeliveryInfoEntity deliveryInfo = deliveryInfoService.findOne(id);
// 创建xml
DeliveryInfoMasterConsignmentXml mas = new DeliveryInfoMasterConsignmentXml();
mas.setId(deliveryInfo.getMawbNo());
mas.setNilcarriagevalueindicator("true");
mas.setDeclaredvalueforcarriageamount(deliveryInfo.getDeclaredvalueforcarriageamount());
mas.setNilcustomsvalueindicator("true");
mas.setDeclaredvalueforcustomsamount(deliveryInfo.getDeclaredvalueforcustomsamount());
mas.setNilinsurancevalueindicator("true");
mas.setInsurancevalueamount(deliveryInfo.getInsurancevalueamount());
mas.setTotalchargeprepaidindicator("true");
mas.setTotaldisbursementprepaidindicator("true");
mas.setIncludedtaregrossweightmeasure(deliveryInfo.getWeight());
mas.setNetweightmeasure(deliveryInfo.getRecheckWeight());
mas.setGrossvolumemeasure(deliveryInfo.getCbm());
;
mas.setTotalpiecequantity(deliveryInfo.getRecheckPieces());
// 发货人
DeliveryInfoConsignorPartyXML deli = new DeliveryInfoConsignorPartyXML();
deli.setName(deliveryInfo.getC_name());
deli.setLegalid(deliveryInfo.getC_legalid());
deli.setAccountid(deliveryInfo.getC_accountid());
// 发货人地址
PostalStructuredAddressXml pos = new PostalStructuredAddressXml();
pos.setPostcodeCode(deliveryInfo.getC_postcodecode());
pos.setStreetName(deliveryInfo.getC_streetname());
pos.setCityName(deliveryInfo.getC_cityname());
pos.setCountryID(deliveryInfo.getC_countryid());
pos.setCountryName(deliveryInfo.getC_countryname());
pos.setCountrySubDivisionName(deliveryInfo.getC_countrysubdivisionname());
pos.setPostOfficeBox(deliveryInfo.getC_postofficebox());
pos.setCityID(deliveryInfo.getC_partycityid());
pos.setCountrySubDivisionID(deliveryInfo.getC_countrysubdivisionid());
deli.setPostalstructuredaddress(pos);
// 发货人电话
DefinedTradeContactXml def = new DefinedTradeContactXml();
def.setPersonname(deliveryInfo.getC_personname());
def.setDepartmentname(deliveryInfo.getC_departmentname());
DirectTelephoneCommunicationXml die = new DirectTelephoneCommunicationXml();
die.setCompleteNumber(deliveryInfo.getC_number());
def.setDirecttelephonecommunication(die);
FaxCommunicationxML fax = new FaxCommunicationxML();
fax.setCompletenumber(deliveryInfo.getC_completenumber());
def.setFaxcommunication(fax);
URIEmailCommunicationXML uri = new URIEmailCommunicationXML();
uri.setUriid(deliveryInfo.getC_uriid());
def.setUriemailcommunication(uri);
TelexCommunicationXml tel = new TelexCommunicationXml();
tel.setCompleteNumber(deliveryInfo.getC_completenumbers());
def.setTelexcommunication(tel);
deli.setDefinedtradecontact(def);
mas.setConsignorparty(deli);
// 收货人
DeliveryInfoConsigneePartyXml del = new DeliveryInfoConsigneePartyXml();
del.setName(deliveryInfo.getS_name());
del.setLegalid(deliveryInfo.getS_legalid());
del.setAccountid(deliveryInfo.getS_accountid());
// 地址
PostalStructuredAddressXml poss = new PostalStructuredAddressXml();
poss.setPostcodeCode(deliveryInfo.getS_postcodecode());
poss.setStreetName(deliveryInfo.getS_streetname());
poss.setCityName(deliveryInfo.getS_cityname());
poss.setCountryID(deliveryInfo.getS_countryid());
poss.setCountryName(deliveryInfo.getS_countryname());
poss.setCountrySubDivisionName(deliveryInfo.getS_countrysubdivisionname());
poss.setPostOfficeBox(deliveryInfo.getS_postofficebox());
poss.setCityID(deliveryInfo.getS_partycityid());
poss.setCountrySubDivisionID(deliveryInfo.getS_countrysubdivisionid());
del.setPostalstructuredaddress(poss);
// 电话
DefinedTradeContactXml deff = new DefinedTradeContactXml();
deff.setPersonname(deliveryInfo.getS_personname());
deff.setDepartmentname(deliveryInfo.getC_departmentname());
DirectTelephoneCommunicationXml diee = new DirectTelephoneCommunicationXml();
diee.setCompleteNumber(deliveryInfo.getS_number());
deff.setDirecttelephonecommunication(diee);
FaxCommunicationxML faxx = new FaxCommunicationxML();
faxx.setCompletenumber(deliveryInfo.getS_completenumber());
deff.setFaxcommunication(faxx);
URIEmailCommunicationXML urii = new URIEmailCommunicationXML();
urii.setUriid(deliveryInfo.getS_uriid());
deff.setUriemailcommunication(urii);
TelexCommunicationXml tell = new TelexCommunicationXml();
tell.setCompleteNumber(deliveryInfo.getS_completenumbers());
deff.setTelexcommunication(tell);
del.setDefinedtradecontact(deff);
mas.setConsigneeparty(del);
// 填开代理人
DeliveryInfoFreightForwarderPartyXml defr = new DeliveryInfoFreightForwarderPartyXml();
defr.setName(deliveryInfo.getF_name());
defr.setLegalid(deliveryInfo.getF_legalid());
defr.setAccountid(deliveryInfo.getF_accountid());
// 地址
PostalStructuredAddressXml stru = new PostalStructuredAddressXml();
stru.setPostcodeCode(deliveryInfo.getF_postcodecode());
stru.setStreetName(deliveryInfo.getF_streetname());
stru.setCityName(deliveryInfo.getF_cityname());
stru.setCountryID(deliveryInfo.getF_countryid());
stru.setCountryName(deliveryInfo.getF_countryname());
stru.setCountrySubDivisionName(deliveryInfo.getF_countrysubdivisionname());
stru.setPostOfficeBox(deliveryInfo.getF_postofficebox());
stru.setCityID(deliveryInfo.getF_cityid());
stru.setCountrySubDivisionID(deliveryInfo.getF_countrysubdivisionid());
defr.setPostalstructuredaddress(stru);
// 电话
DefinedTradeContactXml detf = new DefinedTradeContactXml();
detf.setPersonname(deliveryInfo.getF_personname());
detf.setDepartmentname(deliveryInfo.getF_departmentname());
DirectTelephoneCommunicationXml dieef = new DirectTelephoneCommunicationXml();
dieef.setCompleteNumber(deliveryInfo.getF_number());
detf.setDirecttelephonecommunication(dieef);
FaxCommunicationxML faxxf = new FaxCommunicationxML();
faxxf.setCompletenumber(deliveryInfo.getF_completenumber());
detf.setFaxcommunication(faxxf);
URIEmailCommunicationXML uriif = new URIEmailCommunicationXML();
uriif.setUriid(deliveryInfo.getF_uriid());
detf.setUriemailcommunication(uriif);
TelexCommunicationXml tellf = new TelexCommunicationXml();
tellf.setCompleteNumber(deliveryInfo.getF_completenumbers());
detf.setTelexcommunication(tellf);
defr.setDefinedtradecontact(detf);
mas.setFreightforwarderparty(defr);
// 其他代理人
DeliveryInfoAssociatedPartyXml deliin = new DeliveryInfoAssociatedPartyXml();
deliin.setName(deliveryInfo.getA_name());
deliin.setLegalid(deliveryInfo.getA_legalid());
deliin.setAccountid(deliveryInfo.getA_accountid());
// 地址
PostalStructuredAddressXml struip = new PostalStructuredAddressXml();
struip.setPostcodeCode(deliveryInfo.getP_postcodecode());
struip.setStreetName(deliveryInfo.getP_streetname());
struip.setCityName(deliveryInfo.getP_cityname());
struip.setCountryID(deliveryInfo.getP_countryid());
struip.setCountryName(deliveryInfo.getP_countryname());
struip.setCountrySubDivisionName(deliveryInfo.getP_countrysubdivisionname());
struip.setPostOfficeBox(deliveryInfo.getP_postofficebox());
struip.setCityID(deliveryInfo.getP_cityid());
struip.setCountrySubDivisionID(deliveryInfo.getP_countrysubdivisionid());
deliin.setPostalstructuredaddress(stru);
// 电话
DefinedTradeContactXml detfip = new DefinedTradeContactXml();
detfip.setPersonname(deliveryInfo.getP_personname());
detfip.setDepartmentname(deliveryInfo.getP_departmentname());
DirectTelephoneCommunicationXml dieefip = new DirectTelephoneCommunicationXml();
dieefip.setCompleteNumber(deliveryInfo.getP_number());
detfip.setDirecttelephonecommunication(dieefip);
FaxCommunicationxML faxxfip = new FaxCommunicationxML();
faxxfip.setCompletenumber(deliveryInfo.getP_completenumber());
detfip.setFaxcommunication(faxxfip);
URIEmailCommunicationXML uriifip = new URIEmailCommunicationXML();
uriifip.setUriid(deliveryInfo.getP_uriid());
detfip.setUriemailcommunication(uriifip);
TelexCommunicationXml tellfip = new TelexCommunicationXml();
tellfip.setCompleteNumber(deliveryInfo.getP_completenumbers());
detfip.setTelexcommunication(tellfip);
deliin.setDefinedtradecontact(detfip);
mas.setAssociatedparty(deliin);
// 实发站
OriginLocationXml ori = new OriginLocationXml();
ori.setId(deliveryInfo.getOriginlocationid());
ori.setName(deliveryInfo.getOriginlocationname());
mas.setOriginlocation(ori);
// 目的站
FinalDestinationLocationXml fina = new FinalDestinationLocationXml();
fina.setId(deliveryInfo.getFinaldestinationlocationid());
fina.setName(deliveryInfo.getFinaldestinationlocationname());
mas.setFinaldestinationlocation(fina);
// 订仓信息
SpecifiedLogisticsTransportMovementXml spec = new SpecifiedLogisticsTransportMovementXml();
spec.setStagecode(deliveryInfo.getStagecode());
spec.setModecode(deliveryInfo.getModecode());
spec.setMode(deliveryInfo.getM_mode());
spec.setId(deliveryInfo.getM_id());
UsedLogisticsTransportMeansXml used = new UsedLogisticsTransportMeansXml();
used.setName(deliveryInfo.getM_name());
spec.setUsedlogisticstransportmeans(used);
ArrivalEventXml arrivalevent = new ArrivalEventXml();
arrivalevent.setScheduledoccurrencedatetime(deliveryInfo.getSc_datetime().toString());
OccurrenceArrivalLocationXml occ = new OccurrenceArrivalLocationXml();
occ.setId(deliveryInfo.getSc_id());
occ.setName(deliveryInfo.getSc_name());
occ.setTypecode(deliveryInfo.getSc_typecode());
arrivalevent.setOccurrencearrivallocation(occ);
spec.setArrivalevent(arrivalevent);
DepartureEventXml departureevent = new DepartureEventXml();
departureevent.setScheduledoccurrencedatetime(deliveryInfo.getSo_datetime().toString());
OccurrenceDepartureLocationXml ocu = new OccurrenceDepartureLocationXml();
ocu.setId(deliveryInfo.getSc_id());
ocu.setName(deliveryInfo.getSc_name());
ocu.setTypecode(deliveryInfo.getSc_typecode());
departureevent.setOccurrencedeparturelocation(ocu);
spec.setDepartureevent(departureevent);
spec.setSequencenumeric("1");
mas.setSpecifiedlogisticstransportmovement(spec);
// 处理说明
HandlingInstructionsXml hand = new HandlingInstructionsXml();
hand.setDescription(deliveryInfo.getSeq2_description());
hand.setDescriptioncode(deliveryInfo.getSeq2_descriptioncode());
mas.setHandlinginstructions(hand);
// 相关文件
AssociatedReferenceDocumentXml ass = new AssociatedReferenceDocumentXml();
ass.setId(deliveryInfo.getAss_id());
ass.setIssuedatetime(deliveryInfo.getAss_issuedatetime().toString());
ass.setTypecode(deliveryInfo.getAss_typecode());
ass.setName(deliveryInfo.getAss_name());
mas.setAssociatedreferencedocument(ass);
// 海关相关代码
IncludedCustomsNoteXml inc = new IncludedCustomsNoteXml();
inc.setContentcode(deliveryInfo.getAss_contentcode());
inc.setContent(deliveryInfo.getAss_content());
inc.setSubjectcode(deliveryInfo.getAss_subjectcode());
inc.setCountryid(deliveryInfo.getAss_countryid());
mas.setIncludedcustomsnote(inc);
// 货物信息
IncludedMasterConsignmentItemXml clide = new IncludedMasterConsignmentItemXml();
clide.setSequencenumeric(deliveryInfo.getInc_sequencenumeric());
clide.setTypecode(deliveryInfo.getAss_typecode());
clide.setGrossweightmeasure(deliveryInfo.getInc_grossweightmeasure());
clide.setGrossvolumemeasure(deliveryInfo.getInc_grossvolumemeasure());
clide.setTotalchargeamount(deliveryInfo.getInc_totalchargeamount());
clide.setPiecequantity(deliveryInfo.getInc_piecequantity());
clide.setTareweightmeasure(deliveryInfo.getInc_tareweightmeasure());
clide.setVolumetricfactor(deliveryInfo.getInc_volumetricfactor());
NatureIdentificationTransportCargoXml natu = new NatureIdentificationTransportCargoXml();
natu.setExtraidentification(deliveryInfo.getInc_extraidentification());
natu.setIdentification(deliveryInfo.getInc_identification());
clide.setNatureidentificationtransportcargo(natu);
TransportLogisticsPackageXml tr = new TransportLogisticsPackageXml();
tr.setItemQuantity(deliveryInfo.getInc_itemquantity());
LinearSpatialDimensionXml linde = new LinearSpatialDimensionXml();
linde.setDescription("true");
linde.setHeightmeasure(deliveryInfo.getInc_heightmeasure());
linde.setLengthmeasure(deliveryInfo.getInc_lengthmeasure());
linde.setWidthmeasure(deliveryInfo.getInc_widthmeasure());
tr.setLinearSpatialDimension(linde);
clide.setTransportlogisticspackage(tr);
ApplicableFreightRateServiceChargeXml app = new ApplicableFreightRateServiceChargeXml();
app.setAppliedamount(deliveryInfo.getInc_appliedamount());
app.setAppliedrate(deliveryInfo.getInc_appliedrate());
app.setCategorycode(deliveryInfo.getInc_chargeableweightmeasure());
app.setChargeableweightmeasure(deliveryInfo.getInc_chargeableweightmeasure());
app.setCommodityitemid(deliveryInfo.getInc_commodityitemid());
clide.setApplicablefreightrateservicecharge(app);
mas.setIncludedmasterconsignmentitem(clide);
// 状态
ReportedStatusXml reop = new ReportedStatusXml();
reop.setReasonCode(deliveryInfo.getInc_reasoncode());
reop.setOperationCode(deliveryInfo.getInc_operationcode());
EventTimeXml even = new EventTimeXml();
even.setOccurrencedatetime(deliveryInfo.getInc_occurrencedatetime().toString());
even.setDatetimetypecode(deliveryInfo.getInc_datetimetypecode());
reop.setEventTime(even);
SpecifiedLocationXml spe = new SpecifiedLocationXml();
spe.setId(deliveryInfo.getSpe_id());
spe.setName(deliveryInfo.getSpe_name());
spe.setTypecode(deliveryInfo.getSpe_typecode());
reop.setSpecifiedLocation(spe);
mas.setReportedstatus(reop);
String xml = XmlUtil.convertToXml2(mas, path);
// System.out.println(xml);
// IMFServletManifst mis = new IMFServletManifst();
// mis.init(xml.toString());
return xml;
}
/**
* * 模糊查询匹配信息
*
* @param manifest
* @return
* @return
*/
@RequestMapping(value = "/infor")
@ResponseBody
public List<ManifestEntity> infor(String way) {
List<ManifestEntity> li = manifestService.findByMawbNo(way);
return li;
}
}