|
@@ -354,88 +354,93 @@ public class SecurityDeclarationController { |
|
@@ -354,88 +354,93 @@ public class SecurityDeclarationController { |
354
|
|
354
|
|
355
|
|
355
|
|
356
|
//查询是否存在
|
356
|
//查询是否存在
|
357
|
- if (securityDeclarationService.findWaybill(waybill) == 0 && manifestService.findWbm(waybill) == null){
|
|
|
358
|
- //货物性质(类型)添加
|
|
|
359
|
- for (String type: list){
|
|
|
360
|
- SDCargoTypeEntity sdCargoTypeEntity = new SDCargoTypeEntity();
|
|
|
361
|
- sdCargoTypeEntity.setSd_waybill(waybill);
|
|
|
362
|
- sdCargoTypeEntity.setSd_cargo_type(type);
|
|
|
363
|
- sdCargoTypeService.save(sdCargoTypeEntity);
|
|
|
364
|
- }
|
|
|
365
|
-
|
|
|
366
|
- //货物品名
|
|
|
367
|
- String cName = cargoName.replaceAll(",", ",");
|
|
|
368
|
- String[] split = cName.split(",");
|
|
|
369
|
- for (int i=0; i<split.length; i++){
|
|
|
370
|
- if (!StringUtils.isBlank(split[i]) || !"".equals(split[i])){
|
|
|
371
|
- SDCargoNameEntity sdCargoNameEntity = new SDCargoNameEntity();
|
|
|
372
|
- sdCargoNameEntity.setSd_waybill(waybill);
|
|
|
373
|
- sdCargoNameEntity.setSd_cargo_name(split[i]);
|
|
|
374
|
- sdCargoNameService.save(sdCargoNameEntity);
|
357
|
+ if (securityDeclarationService.findWaybill(waybill) == 0){
|
|
|
358
|
+ if (manifestService.findWbm(waybill) == null){
|
|
|
359
|
+ //货物性质(类型)添加
|
|
|
360
|
+ for (String type: list){
|
|
|
361
|
+ SDCargoTypeEntity sdCargoTypeEntity = new SDCargoTypeEntity();
|
|
|
362
|
+ sdCargoTypeEntity.setSd_waybill(waybill);
|
|
|
363
|
+ sdCargoTypeEntity.setSd_cargo_type(type);
|
|
|
364
|
+ sdCargoTypeService.save(sdCargoTypeEntity);
|
375
|
}
|
365
|
}
|
376
|
- }
|
|
|
377
|
|
366
|
|
378
|
- UserEntity ue = (UserEntity)SecurityUtils.getSubject().getSession().getAttribute("user");
|
|
|
379
|
-
|
|
|
380
|
- ManifestEntity manifestEntity = new ManifestEntity();
|
|
|
381
|
-
|
|
|
382
|
- //添加安检申报
|
|
|
383
|
- SecurityDeclarationEntity sd = new SecurityDeclarationEntity();
|
|
|
384
|
- sd.setSd_waybill(waybill);
|
|
|
385
|
- sd.setSd_cargo_agent_name(cargoAgentName);
|
|
|
386
|
- sd.setSd_cargo_shipper_name(cargoShipperName);
|
|
|
387
|
- sd.setSd_iata_number(iataNumber);
|
|
|
388
|
- sd.setSd_transport_certificate(transportCertificate);
|
|
|
389
|
- sd.setSd_transportation_prove(transportationProve);
|
|
|
390
|
- sd.setSd_static("1");
|
|
|
391
|
- if (ue != null){
|
|
|
392
|
- if (ue.getId() != null ){
|
|
|
393
|
- sd.setUSER_ID(ue.getId());
|
|
|
394
|
- manifestEntity.setUSER_ID(ue.getId());
|
367
|
+ //货物品名
|
|
|
368
|
+ String cName = cargoName.replaceAll(",", ",");
|
|
|
369
|
+ String[] split = cName.split(",");
|
|
|
370
|
+ for (int i=0; i<split.length; i++){
|
|
|
371
|
+ if (!StringUtils.isBlank(split[i]) || !"".equals(split[i])){
|
|
|
372
|
+ SDCargoNameEntity sdCargoNameEntity = new SDCargoNameEntity();
|
|
|
373
|
+ sdCargoNameEntity.setSd_waybill(waybill);
|
|
|
374
|
+ sdCargoNameEntity.setSd_cargo_name(split[i]);
|
|
|
375
|
+ sdCargoNameService.save(sdCargoNameEntity);
|
|
|
376
|
+ }
|
395
|
}
|
377
|
}
|
396
|
- }
|
|
|
397
|
- securityDeclarationService.save(sd);
|
|
|
398
|
|
378
|
|
399
|
- // 生成报文并且发送
|
|
|
400
|
- String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR);
|
|
|
401
|
-
|
|
|
402
|
- //存放数据Vo
|
|
|
403
|
- SDVo sdVo = new SDVo();
|
|
|
404
|
- sdVo.setSd_waybill(waybill);
|
|
|
405
|
- sdVo.setSd_cargo_agent_name(cargoAgentName);
|
|
|
406
|
- sdVo.setSd_cargo_shipper_name(cargoShipperName);
|
|
|
407
|
- sdVo.setSd_iata_number(iataNumber);
|
|
|
408
|
- sdVo.setSd_transport_certificate(transportCertificate);
|
|
|
409
|
- sdVo.setSd_transportation_prove(transportationProve);
|
|
|
410
|
- //品名
|
|
|
411
|
- sdVo.setSd_cargo_name(cargoName);
|
|
|
412
|
- //货物类型
|
|
|
413
|
- String cargoType = "";
|
|
|
414
|
- for (String s: list){
|
|
|
415
|
- cargoType+=s+",";
|
379
|
+ UserEntity ue = (UserEntity)SecurityUtils.getSubject().getSession().getAttribute("user");
|
|
|
380
|
+
|
|
|
381
|
+ ManifestEntity manifestEntity = new ManifestEntity();
|
|
|
382
|
+
|
|
|
383
|
+ //添加安检申报
|
|
|
384
|
+ SecurityDeclarationEntity sd = new SecurityDeclarationEntity();
|
|
|
385
|
+ sd.setSd_waybill(waybill);
|
|
|
386
|
+ sd.setSd_cargo_agent_name(cargoAgentName);
|
|
|
387
|
+ sd.setSd_cargo_shipper_name(cargoShipperName);
|
|
|
388
|
+ sd.setSd_iata_number(iataNumber);
|
|
|
389
|
+ sd.setSd_transport_certificate(transportCertificate);
|
|
|
390
|
+ sd.setSd_transportation_prove(transportationProve);
|
|
|
391
|
+ sd.setSd_static("1");
|
|
|
392
|
+ if (ue != null){
|
|
|
393
|
+ if (ue.getId() != null ){
|
|
|
394
|
+ sd.setUSER_ID(ue.getId());
|
|
|
395
|
+ manifestEntity.setUSER_ID(ue.getId());
|
|
|
396
|
+ }
|
|
|
397
|
+ }
|
|
|
398
|
+ securityDeclarationService.save(sd);
|
|
|
399
|
+
|
|
|
400
|
+ // 生成报文并且发送
|
|
|
401
|
+ String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR);
|
|
|
402
|
+
|
|
|
403
|
+ //存放数据Vo
|
|
|
404
|
+ SDVo sdVo = new SDVo();
|
|
|
405
|
+ sdVo.setSd_waybill(waybill);
|
|
|
406
|
+ sdVo.setSd_cargo_agent_name(cargoAgentName);
|
|
|
407
|
+ sdVo.setSd_cargo_shipper_name(cargoShipperName);
|
|
|
408
|
+ sdVo.setSd_iata_number(iataNumber);
|
|
|
409
|
+ sdVo.setSd_transport_certificate(transportCertificate);
|
|
|
410
|
+ sdVo.setSd_transportation_prove(transportationProve);
|
|
|
411
|
+ //品名
|
|
|
412
|
+ sdVo.setSd_cargo_name(cargoName);
|
|
|
413
|
+ //货物类型
|
|
|
414
|
+ String cargoType = "";
|
|
|
415
|
+ for (String s: list){
|
|
|
416
|
+ cargoType+=s+",";
|
|
|
417
|
+ }
|
|
|
418
|
+ sdVo.setSd_cargo_type(cargoType);
|
|
|
419
|
+
|
|
|
420
|
+ //添加预配信息
|
|
|
421
|
+ manifestEntity.setWaybillnomaster(waybill);
|
|
|
422
|
+ manifestEntity.setFlightdate(flightdate);
|
|
|
423
|
+ manifestEntity.setFlightno(flightno);
|
|
|
424
|
+ manifestEntity.setCarrier(carrier);
|
|
|
425
|
+ manifestEntity.setTotalpiece(totalpiece);
|
|
|
426
|
+ manifestEntity.setTotalweight(totalweight);
|
|
|
427
|
+ manifestEntity.setDestinationstation(destinationstation);
|
|
|
428
|
+ manifestService.save(manifestEntity);
|
|
|
429
|
+
|
|
|
430
|
+ //生成报文
|
|
|
431
|
+ sdVo.setFlightno(flightno);
|
|
|
432
|
+ sdVo.setFlightdate(flightdate);
|
|
|
433
|
+ sdVo.setCarrier(carrier);
|
|
|
434
|
+ sdVo.setTotalpiece(totalpiece);
|
|
|
435
|
+ sdVo.setTotalweight(totalweight);
|
|
|
436
|
+ sdVo.setDestinationstation(destinationstation);
|
|
|
437
|
+ new XmlBuildTask(securityDeclarationService.sendNDLRXml(sdVo), ndlrPath).perform();
|
|
|
438
|
+
|
|
|
439
|
+ model.setStatus(200);
|
|
|
440
|
+ }else {
|
|
|
441
|
+ model.setStatus(204);
|
416
|
}
|
442
|
}
|
417
|
- sdVo.setSd_cargo_type(cargoType);
|
|
|
418
|
|
443
|
|
419
|
- //添加预配信息
|
|
|
420
|
- manifestEntity.setWaybillnomaster(waybill);
|
|
|
421
|
- manifestEntity.setFlightdate(flightdate);
|
|
|
422
|
- manifestEntity.setFlightno(flightno);
|
|
|
423
|
- manifestEntity.setCarrier(carrier);
|
|
|
424
|
- manifestEntity.setTotalpiece(totalpiece);
|
|
|
425
|
- manifestEntity.setTotalweight(totalweight);
|
|
|
426
|
- manifestEntity.setDestinationstation(destinationstation);
|
|
|
427
|
- manifestService.save(manifestEntity);
|
|
|
428
|
-
|
|
|
429
|
- //生成报文
|
|
|
430
|
- sdVo.setFlightno(flightno);
|
|
|
431
|
- sdVo.setFlightdate(flightdate);
|
|
|
432
|
- sdVo.setCarrier(carrier);
|
|
|
433
|
- sdVo.setTotalpiece(totalpiece);
|
|
|
434
|
- sdVo.setTotalweight(totalweight);
|
|
|
435
|
- sdVo.setDestinationstation(destinationstation);
|
|
|
436
|
- new XmlBuildTask(securityDeclarationService.sendNDLRXml(sdVo), ndlrPath).perform();
|
|
|
437
|
-
|
|
|
438
|
- model.setStatus(200);
|
|
|
439
|
}else {
|
444
|
}else {
|
440
|
model.setStatus(203);
|
445
|
model.setStatus(203);
|
441
|
}
|
446
|
}
|
|
@@ -744,7 +749,7 @@ public class SecurityDeclarationController { |
|
@@ -744,7 +749,7 @@ public class SecurityDeclarationController { |
744
|
String path = resource.getPath();
|
749
|
String path = resource.getPath();
|
745
|
String s = path +"../../resource/img/bar_code/"+replace+".png";
|
750
|
String s = path +"../../resource/img/bar_code/"+replace+".png";
|
746
|
//生成条形码
|
751
|
//生成条形码
|
747
|
-// BarCodeUtil.generateFile(replace, s);
|
752
|
+ BarCodeUtil.generateFile(replace, s);
|
748
|
|
753
|
|
749
|
model.addAttribute("path", replace);
|
754
|
model.addAttribute("path", replace);
|
750
|
|
755
|
|