作者 朱兆平

主单运抵入库

1 package com.example.demo.handle; 1 package com.example.demo.handle;
2 2
  3 +import com.example.demo.handle.nms.FSU_FOH_Handle;
3 import com.example.demo.model.IMF_META; 4 import com.example.demo.model.IMF_META;
4 import com.example.demo.util.IO.FileTool; 5 import com.example.demo.util.IO.FileTool;
5 import com.example.demo.util.XML.XML2ENTITY; 6 import com.example.demo.util.XML.XML2ENTITY;
@@ -23,13 +24,13 @@ public class IMF_Message_MainHandle { @@ -23,13 +24,13 @@ public class IMF_Message_MainHandle {
23 XML2ENTITY xml2ENTITY = new XML2ENTITY(); 24 XML2ENTITY xml2ENTITY = new XML2ENTITY();
24 Map<String, Object> map = xml2ENTITY.Dom2Map(doc); 25 Map<String, Object> map = xml2ENTITY.Dom2Map(doc);
25 26
26 - Map metaMap = (Map) getMap(map,"META");  
27 - imf_meta.setSNDR((String) getMap(metaMap,"SNDR"));  
28 - imf_meta.setDDTM((String) getMap(metaMap,"DDTM"));  
29 - imf_meta.setRCVR((String) getMap(metaMap,"RCVR"));  
30 - imf_meta.setSEQN((String) getMap(metaMap,"SEQN"));  
31 - imf_meta.setTYPE((String) getMap(metaMap,"TYPE"));  
32 - TYPE_Path = (String) getMap(metaMap,"STYP"); 27 + Map metaMap = (Map) xml2ENTITY.getMap(map,"META");
  28 + imf_meta.setSNDR((String) xml2ENTITY.getMap(metaMap,"SNDR"));
  29 + imf_meta.setDDTM((String) xml2ENTITY.getMap(metaMap,"DDTM"));
  30 + imf_meta.setRCVR((String) xml2ENTITY.getMap(metaMap,"RCVR"));
  31 + imf_meta.setSEQN((String) xml2ENTITY.getMap(metaMap,"SEQN"));
  32 + imf_meta.setTYPE((String) xml2ENTITY.getMap(metaMap,"TYPE"));
  33 + TYPE_Path = (String) xml2ENTITY.getMap(metaMap,"STYP");
33 imf_meta.setSTYP(TYPE_Path); 34 imf_meta.setSTYP(TYPE_Path);
34 35
35 //解析分配 36 //解析分配
@@ -38,7 +39,7 @@ public class IMF_Message_MainHandle { @@ -38,7 +39,7 @@ public class IMF_Message_MainHandle {
38 39
39 break; 40 break;
40 case "UFOH": 41 case "UFOH":
41 - 42 + FSU_FOH_Handle.handle(doc);
42 break; 43 break;
43 case "EFOH": 44 case "EFOH":
44 break; 45 break;
@@ -63,19 +64,5 @@ public class IMF_Message_MainHandle { @@ -63,19 +64,5 @@ public class IMF_Message_MainHandle {
63 return imf_meta; 64 return imf_meta;
64 } 65 }
65 66
66 - public static Boolean CheckMap(Map map,String key){  
67 - if(map.containsKey(key)){  
68 - return Boolean.TRUE;  
69 - }else {  
70 - return Boolean.FALSE;  
71 - }  
72 - }  
73 67
74 - public static Object getMap(Map map,String key){  
75 - if(map!=null && CheckMap(map,key)){  
76 - return map.get(key);  
77 - }else {  
78 - return null;  
79 - }  
80 - }  
81 } 68 }
1 package com.example.demo.handle.nms; 1 package com.example.demo.handle.nms;
2 2
  3 +import com.example.demo.model.NMS_FSU_FOH;
  4 +import com.example.demo.service.NMS_FSU_FOH_Service;
  5 +import com.example.demo.util.Helper;
  6 +import com.example.demo.util.IO.FileTool;
  7 +import com.example.demo.util.XML.XML2ENTITY;
  8 +import com.example.demo.util.XML.XMLXPath;
  9 +import org.dom4j.Document;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Component;
  12 +
  13 +import javax.annotation.PostConstruct;
  14 +import java.time.ZonedDateTime;
  15 +import java.util.Date;
  16 +import java.util.Map;
  17 +
  18 +@Component
3 public class FSU_FOH_Handle { 19 public class FSU_FOH_Handle {
4 20
5 - public void fsu_foh_handle(){ 21 + @Autowired
  22 + protected NMS_FSU_FOH_Service fohService;
  23 + private static FSU_FOH_Handle fsu_foh_handle;
  24 + private final static String stype = "FSU_FOH";
  25 +
  26 + @PostConstruct
  27 + public void init(){
  28 + fsu_foh_handle = this;
  29 + fsu_foh_handle.fohService = this.fohService;
  30 + }
  31 +
  32 + public static void handle(Document document){
  33 + try {
  34 + XML2ENTITY xml2ENTITY = new XML2ENTITY();
  35 + Map<String, Object> map = xml2ENTITY.Dom2Map(document);
  36 +
  37 +
  38 + NMS_FSU_FOH fsu_foh = new NMS_FSU_FOH();
  39 +
  40 + Map ConsignmentStatus = (Map) XML2ENTITY.getMap(map, "ConsignmentStatus");
  41 + Map MasterConsignment = (Map) XML2ENTITY.getMap(ConsignmentStatus, "MasterConsignment");
  42 + Map TransportContractDocument = (Map) XML2ENTITY.getMap(MasterConsignment, "TransportContractDocument"); //运单信息节点
  43 + Map OriginLocation = (Map) XML2ENTITY.getMap(MasterConsignment, "OriginLocation"); //运单起始站信息节点
  44 + Map FinalDestinationLocation = (Map) XML2ENTITY.getMap(MasterConsignment, "FinalDestinationLocation"); //运单目的站信息节点
  45 +
  46 + String arrivPiece = (String) XML2ENTITY.getMap(MasterConsignment, "PieceQuantity");//运抵件数
  47 + String arrivWeight = (String) XML2ENTITY.getMap(MasterConsignment, "GrossWeightMeasure");//运抵重量
  48 + String grossWeightMeasureUc = XMLXPath.getSingleValueByPath(document, "//MSG/ConsignmentStatus/MasterConsignment/GrossWeightMeasure/@unitCode");//运抵重量计费单位
  49 + String totalWeightMeasureUc = XMLXPath.getSingleValueByPath(document, "//MSG/ConsignmentStatus/MasterConsignment/TotalGrossWeightMeasure//@unitCode");//运单重量计费单位
  50 + String chargeWeighMeasureUc = XMLXPath.getSingleValueByPath(document, "//MSG/ConsignmentStatus/MasterConsignment/ChargeableWeightMeasure//@unitCode");//计费重量计费单位
  51 + String totalPiece = (String) XML2ENTITY.getMap(MasterConsignment, "TotalPieceQuantity");//运单件数
  52 + String totalWeight = (String) XML2ENTITY.getMap(MasterConsignment, "TotalGrossWeightMeasure");//运单重量
  53 + String chargeWeight = (String) XML2ENTITY.getMap(MasterConsignment, "ChargeableWeightMeasure");//运单计费重量
  54 + String waybillNo = (String) XML2ENTITY.getMap(TransportContractDocument, "ID");//运单号
  55 + String originLocation = (String) XML2ENTITY.getMap(OriginLocation, "ID");
  56 + String finalLocation = (String) XML2ENTITY.getMap(FinalDestinationLocation, "ID");
  57 + String originName = (String) XML2ENTITY.getMap(OriginLocation, "Name");
  58 + String finalLocationName = (String) XML2ENTITY.getMap(FinalDestinationLocation, "Name");
  59 + fsu_foh.setWaybillnomaster(waybillNo);
  60 + fsu_foh.setOriginatingstation(originLocation);
  61 + fsu_foh.setDestinationstation(finalLocation);
  62 + fsu_foh.setoName(originName);
  63 + fsu_foh.setFdName(finalLocationName);
  64 +
  65 + fsu_foh.setArrivedtotalpiece(arrivPiece);
  66 + fsu_foh.setArrivedtotalweight(arrivWeight);
  67 + fsu_foh.setGrossweightmeasureuc(grossWeightMeasureUc);
  68 +
  69 + fsu_foh.setTotalpiecequantity(totalPiece);
  70 + fsu_foh.setTotalgrossweightmeasure(totalWeight);
  71 + fsu_foh.setTotalgrossweightmeasureuc(totalWeightMeasureUc);
  72 +
  73 + fsu_foh.setChargeableweightmeasure(chargeWeight);
  74 + fsu_foh.setChargeableweightmeasureuc(chargeWeighMeasureUc);
  75 +
  76 +
  77 + String tcd_name = (String) XML2ENTITY.getMap(TransportContractDocument, "Name");
  78 + fsu_foh.setTcdName(tcd_name);
  79 +
  80 + String typecode = (String) XML2ENTITY.getMap(TransportContractDocument, "TypeCode");
  81 + fsu_foh.setTcdTypecode(typecode);
  82 +
  83 + Map ReportedStatus = (Map) XML2ENTITY.getMap(MasterConsignment, "ReportedStatus"); //运抵节点
  84 + Map EventTime = (Map) XML2ENTITY.getMap(ReportedStatus, "EventTime"); //运抵节点
  85 + String OccurrenceDateTime = (String) XML2ENTITY.getMap(EventTime, "OccurrenceDateTime"); //运抵时间
  86 + ZonedDateTime arrZoneTime = ZonedDateTime.parse(OccurrenceDateTime);
  87 + Date arriv_time = Date.from(arrZoneTime.toInstant()); //这个是入库航班日期格式
  88 + fsu_foh.setArriveddate(arriv_time);
  89 +
  90 + Map AssociatedStatusConsignment = (Map) XML2ENTITY.getMap(ReportedStatus, "AssociatedStatusConsignment"); //航班信息节点
  91 + Map SpecifiedLogisticsTransportMovement = (Map) XML2ENTITY.getMap(AssociatedStatusConsignment, "SpecifiedLogisticsTransportMovement");
  92 + String flight = (String) XML2ENTITY.getMap(SpecifiedLogisticsTransportMovement, "ID");//航班号
  93 + if (!flight.isEmpty() && !flight.equals(null)) {
  94 + String carrier_no = flight.substring(0, 2);
  95 + String flight_no = flight.substring(2);
  96 + fsu_foh.setFlightno(flight_no);
  97 + fsu_foh.setCarrier(carrier_no);
  98 + }
  99 +
  100 +
  101 + Map DepartureEvent = (Map) XML2ENTITY.getMap(SpecifiedLogisticsTransportMovement, "DepartureEvent");//航班离港日期节点
  102 + String dep_time = (String) XML2ENTITY.getMap(DepartureEvent, "DepartureOccurrenceDateTime");//离港日期作为航班日期
  103 + ZonedDateTime depZoneTime = ZonedDateTime.parse(dep_time);
  104 + Date flightDate = Date.from(depZoneTime.toInstant()); //这个是入库航班日期格式
  105 + fsu_foh.setFlightdate(flightDate);
  106 +
  107 + String custom = "4604";
  108 +
  109 + Map StorageLocations = (Map) XML2ENTITY.getMap(AssociatedStatusConsignment, "StorageLocations");
  110 + Map LocationInfomation = (Map) XML2ENTITY.getMap(StorageLocations, "LocationInfomation");
  111 + String Location = XML2ENTITY.getMap(LocationInfomation, "Location").toString();
  112 + if (Location.contains("ZBQ")) {
  113 + custom = "4620";
  114 + }
  115 + fsu_foh.setCustomscode(custom);
  116 +
  117 + String TransportSplitDescription = (String) XML2ENTITY.getMap(AssociatedStatusConsignment, "TransportSplitDescription");
  118 + fsu_foh.setTransportsplitdescription(TransportSplitDescription);
  119 +
  120 + Map IncludedMasterConsignmentItem = (Map) XML2ENTITY.getMap(AssociatedStatusConsignment, "IncludedMasterConsignmentItem");
  121 + String productName = (String) XML2ENTITY.getMap(IncludedMasterConsignmentItem, "TypeCode");
  122 + fsu_foh.setProductname(productName);
  123 +
  124 + fsu_foh.setStatus("01"); //默认自动发送
  125 + fsu_foh.setReceiptinformation("");
  126 +
  127 + Date creatTime = new Date();
  128 + fsu_foh.setCreatedate(creatTime);
  129 +
  130 + fsu_foh.setAutoid(Helper.getUUID());
  131 +
  132 + int resoult = fsu_foh_handle.fohService.insert(fsu_foh);
  133 +
  134 + FileTool.writeWaybill("FSU_FOH",document.asXML(),waybillNo);
  135 +
  136 +
  137 + }catch (Exception e){
  138 + e.printStackTrace();
  139 + FileTool.writeFile(stype,e.toString()+"\n"+document.asXML(),false);
  140 + }
  141 +
  142 +
  143 +
  144 +
6 145
7 } 146 }
8 } 147 }
@@ -13,6 +13,8 @@ public interface NMS_FSU_FOHMapper { @@ -13,6 +13,8 @@ public interface NMS_FSU_FOHMapper {
13 13
14 NMS_FSU_FOH selectByPrimaryKey(String autoid); 14 NMS_FSU_FOH selectByPrimaryKey(String autoid);
15 15
  16 + List<NMS_FSU_FOH> selecMmasterWaybillList (String waybillNo);
  17 +
16 int updateByPrimaryKeySelective(NMS_FSU_FOH record); 18 int updateByPrimaryKeySelective(NMS_FSU_FOH record);
17 19
18 int updateByPrimaryKey(NMS_FSU_FOH record); 20 int updateByPrimaryKey(NMS_FSU_FOH record);
@@ -17,7 +17,7 @@ public class IMF_Task { @@ -17,7 +17,7 @@ public class IMF_Task {
17 public static boolean isSuc = true; 17 public static boolean isSuc = true;
18 public static IMFClient client = null; 18 public static IMFClient client = null;
19 19
20 -// @Scheduled(fixedRate = 5000) 20 + @Scheduled(fixedRate = 5000)
21 private static void start() throws Exception { 21 private static void start() throws Exception {
22 PropertyConfigurator.configure("config/log4j.properties"); 22 PropertyConfigurator.configure("config/log4j.properties");
23 client = IMFClientFactory.createInstance(); 23 client = IMFClientFactory.createInstance();
@@ -3,6 +3,7 @@ package com.example.demo.service; @@ -3,6 +3,7 @@ package com.example.demo.service;
3 import com.example.demo.model.NMS_FSU_FOH; 3 import com.example.demo.model.NMS_FSU_FOH;
4 import com.github.pagehelper.PageInfo; 4 import com.github.pagehelper.PageInfo;
5 5
  6 +import java.util.List;
6 7
7 8
8 public interface NMS_FSU_FOH_Service { 9 public interface NMS_FSU_FOH_Service {
@@ -13,4 +14,5 @@ public interface NMS_FSU_FOH_Service { @@ -13,4 +14,5 @@ public interface NMS_FSU_FOH_Service {
13 int updateByPrimaryKey(NMS_FSU_FOH record); 14 int updateByPrimaryKey(NMS_FSU_FOH record);
14 NMS_FSU_FOH selectByPrimaryKey(String autoid); 15 NMS_FSU_FOH selectByPrimaryKey(String autoid);
15 PageInfo<NMS_FSU_FOH> selectAll(int pageNum, int pageSize); 16 PageInfo<NMS_FSU_FOH> selectAll(int pageNum, int pageSize);
  17 + List<NMS_FSU_FOH> selecMmasterWaybillList (String waybillNo);
16 } 18 }
@@ -18,10 +18,30 @@ public class NMS_FSU_FOH_ServiceImp implements NMS_FSU_FOH_Service{ @@ -18,10 +18,30 @@ public class NMS_FSU_FOH_ServiceImp implements NMS_FSU_FOH_Service{
18 private NMS_FSU_FOHMapper fsu_fohMapper; 18 private NMS_FSU_FOHMapper fsu_fohMapper;
19 19
20 public int insert(NMS_FSU_FOH record){ 20 public int insert(NMS_FSU_FOH record){
21 - return fsu_fohMapper.insert(record); 21 + int i=0;
  22 + List<NMS_FSU_FOH> masterList = selecMmasterWaybillList(record.getWaybillnomaster());
  23 + if(masterList!=null && masterList.size()>0){
  24 + for (NMS_FSU_FOH master:masterList) {
  25 + updateByPrimaryKey(master);
  26 + }
  27 + }else {
  28 +
  29 + i= fsu_fohMapper.insert(record);
  30 + }
  31 + return i;
22 } 32 }
23 public int insertSelective(NMS_FSU_FOH record){ 33 public int insertSelective(NMS_FSU_FOH record){
24 - return fsu_fohMapper.insertSelective(record); 34 + int i=0;
  35 + List<NMS_FSU_FOH> masterList = selecMmasterWaybillList(record.getWaybillnomaster());
  36 + if(masterList!=null && masterList.size()>0){
  37 + for (NMS_FSU_FOH master:masterList) {
  38 + updateByPrimaryKey(master);
  39 + }
  40 + }else {
  41 +
  42 + i= fsu_fohMapper.insertSelective(record);
  43 + }
  44 + return i;
25 } 45 }
26 public int updateByPrimaryKeySelective(NMS_FSU_FOH record){ 46 public int updateByPrimaryKeySelective(NMS_FSU_FOH record){
27 return fsu_fohMapper.updateByPrimaryKeySelective(record); 47 return fsu_fohMapper.updateByPrimaryKeySelective(record);
@@ -39,4 +59,7 @@ public class NMS_FSU_FOH_ServiceImp implements NMS_FSU_FOH_Service{ @@ -39,4 +59,7 @@ public class NMS_FSU_FOH_ServiceImp implements NMS_FSU_FOH_Service{
39 PageInfo<NMS_FSU_FOH> result = new PageInfo<NMS_FSU_FOH>(fsuFohList); 59 PageInfo<NMS_FSU_FOH> result = new PageInfo<NMS_FSU_FOH>(fsuFohList);
40 return result; 60 return result;
41 } 61 }
  62 + public List<NMS_FSU_FOH> selecMmasterWaybillList (String waybillNo){
  63 + return fsu_fohMapper.selecMmasterWaybillList(waybillNo);
  64 + }
42 } 65 }
@@ -33,20 +33,7 @@ public class Helper { @@ -33,20 +33,7 @@ public class Helper {
33 return ret; 33 return ret;
34 } 34 }
35 35
36 - /**  
37 - * 判断map是否包含key,包含返回KEY值,不包含返回NULL  
38 - * @param map  
39 - * @param key  
40 - * @return  
41 - */  
42 - @Nullable static public Object CheckMapKey(Map map, String key){  
43 - boolean contains = map.containsKey(key); //判断是否包含指定的键值  
44 - if (contains) { //如果条件为真  
45 - return map.get(key);  
46 - } else {  
47 - return null;  
48 - }  
49 - } 36 +
50 37
51 public static String getUUID(){ 38 public static String getUUID(){
52 return UUID.randomUUID().toString().replace("-", ""); 39 return UUID.randomUUID().toString().replace("-", "");
@@ -23,9 +23,9 @@ public final class FileTool { @@ -23,9 +23,9 @@ public final class FileTool {
23 StringBuffer stringBuffer = new StringBuffer(); 23 StringBuffer stringBuffer = new StringBuffer();
24 24
25 if (rightOrwrong){ 25 if (rightOrwrong){
26 - stringBuffer.append(xmlRootDirectory).append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log"); 26 + stringBuffer.append(xmlRootDirectory).append("/").append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log");
27 }else { 27 }else {
28 - stringBuffer.append(errorRootDirectory).append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log"); 28 + stringBuffer.append(errorRootDirectory).append("/").append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log");
29 } 29 }
30 30
31 File file = new File(stringBuffer.toString()); 31 File file = new File(stringBuffer.toString());
@@ -37,4 +37,16 @@ public final class FileTool { @@ -37,4 +37,16 @@ public final class FileTool {
37 } 37 }
38 38
39 } 39 }
  40 +
  41 + public static void writeWaybill(String path,String content,String waybillNo){
  42 + StringBuffer stringBuffer = new StringBuffer();
  43 + stringBuffer.append(xmlRootDirectory).append("/").append(path).append("/").append(DateUtil.getToday()).append("/").append(waybillNo).append(".log");
  44 + File file = new File(stringBuffer.toString());
  45 + try{
  46 + FileUtils.writeStringToFile(file,content,Cherector);
  47 + }catch (IOException e){
  48 + e.printStackTrace();
  49 + }
  50 +
  51 + }
40 } 52 }
@@ -5,11 +5,17 @@ import java.util.HashMap; @@ -5,11 +5,17 @@ import java.util.HashMap;
5 import java.util.Iterator; 5 import java.util.Iterator;
6 import java.util.List; 6 import java.util.List;
7 import java.util.Map; 7 import java.util.Map;
  8 +
  9 +import org.dom4j.Attribute;
8 import org.dom4j.Document; 10 import org.dom4j.Document;
9 import org.dom4j.Element; 11 import org.dom4j.Element;
  12 +import org.springframework.lang.Nullable;
10 13
11 public class XML2ENTITY { 14 public class XML2ENTITY {
12 @SuppressWarnings("unchecked") 15 @SuppressWarnings("unchecked")
  16 + /**取KEY的VALUE
  17 + *
  18 + */
13 public Map<String, Object> Dom2Map(Document doc){ 19 public Map<String, Object> Dom2Map(Document doc){
14 Map<String, Object> map = new HashMap<String, Object>(); 20 Map<String, Object> map = new HashMap<String, Object>();
15 if(doc == null) 21 if(doc == null)
@@ -72,6 +78,107 @@ public class XML2ENTITY { @@ -72,6 +78,107 @@ public class XML2ENTITY {
72 map.put(e.getName(), e.getText()); 78 map.put(e.getName(), e.getText());
73 return map; 79 return map;
74 } 80 }
  81 +
  82 + public List<Map> attrOfElement(Element e){
  83 + List attList = new ArrayList();
  84 + List<Attribute> listAttr = e.attributes();
  85 + for(Attribute attr:listAttr){//遍历当前节点的所有属性
  86 + String name=attr.getName();//属性名称
  87 + String value=attr.getValue();//属性的值
  88 + Map<String, Object> attMap = new HashMap<String, Object>();
  89 + attMap.put(name,value);
  90 + attList.add(attMap);
  91 + }
  92 + return attList;
  93 + }
  94 + @SuppressWarnings("unchecked")
  95 + /**遍历所有节点的属性值
  96 + *
  97 + */
  98 + public Map<String, Object> Dom2Map_propety(Document doc){
  99 + Map<String, Object> map = new HashMap<String, Object>();
  100 + if(doc == null)
  101 + return map;
  102 + Element root = doc.getRootElement();
  103 + for (Iterator iterator = root.elementIterator(); iterator.hasNext();) {
  104 + Element e = (Element) iterator.next();
  105 + List list = e.elements();
  106 + if(list.size() > 0){
  107 + map.put(e.getName(), Dom2Map_propety(e));
  108 + }else {
  109 + map.put(e.getName(), attrOfElement(e));
  110 + }
  111 + }
  112 + return map;
  113 + }
  114 + @SuppressWarnings("unchecked")
  115 + public Map Dom2Map_propety(Element e){
  116 + Map map = new HashMap();
  117 + List list = e.elements();
  118 + if(list.size() > 0){
  119 + for (int i = 0;i < list.size(); i++) {
  120 + Element iter = (Element) list.get(i);
  121 + List mapList = new ArrayList();
  122 +
  123 + if(iter.elements().size() > 0){
  124 + Map m = Dom2Map_propety(iter);
  125 + if(map.get(iter.getName()) != null){
  126 + Object obj = map.get(iter.getName());
  127 + if(!obj.getClass().getName().equals("java.util.ArrayList")){
  128 + mapList = new ArrayList();
  129 + mapList.add(obj);
  130 + mapList.add(m);
  131 + }
  132 + if(obj.getClass().getName().equals("java.util.ArrayList")){
  133 + mapList = (List) obj;
  134 + mapList.add(m);
  135 + }
  136 + map.put(iter.getName(), mapList);
  137 + }else
  138 + map.put(iter.getName(), m);
  139 + }
  140 + else{
  141 + if(map.get(iter.getName()) != null){
  142 + Object obj = map.get(iter.getName());
  143 + if(!obj.getClass().getName().equals("java.util.ArrayList")){
  144 + mapList = new ArrayList();
  145 + mapList.add(obj);
  146 + mapList.add(iter.getText());
  147 + }
  148 + if(obj.getClass().getName().equals("java.util.ArrayList")){
  149 + mapList = (List) obj;
  150 + mapList.add(iter.getText());
  151 + }
  152 + map.put(iter.getName(), mapList);
  153 + }else{
  154 + map.put(iter.getName(), attrOfElement(iter));
  155 + }
  156 +
  157 +
  158 + }
  159 + }
  160 + }else {
  161 + map.put(e.getName(), attrOfElement(e));
  162 + }
  163 + return map;
  164 + }
  165 +
  166 + /**
  167 + * 判断map是否包含key,包含返回KEY值,不包含返回NULL
  168 + * @param map
  169 + * @param key
  170 + * @return
  171 + */
  172 + @Nullable
  173 + public static Object getMap(Map map, String key){
  174 + if(map!=null && map.containsKey(key)){
  175 + return map.get(key);
  176 + } else {
  177 + return null;
  178 + }
  179 + }
  180 +
  181 +
75 } 182 }
76 183
77 184
  1 +package com.example.demo.util.XML;
  2 +
  3 +import org.dom4j.Attribute;
  4 +import org.dom4j.Document;
  5 +import org.dom4j.Node;
  6 +
  7 +import java.util.Iterator;
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +public class XMLXPath {
  12 +
  13 + public static String getSingleValueByPath(Document document,String path){
  14 + Node node = document.selectSingleNode(path);
  15 + if (node!=null){
  16 + String nodeValue = node.getStringValue();
  17 + return nodeValue;
  18 + }else {
  19 + return null;
  20 + }
  21 +
  22 + }
  23 + public static List<Node> getPathValues(Document document,String path){
  24 + List<Node> nodes= document.selectNodes(path);
  25 + return nodes;
  26 + }
  27 +
  28 + public static void getPathValues2(Document document,String path){
  29 + List list = document.selectNodes(path);
  30 + for (Iterator it = list.iterator(); it.hasNext();) {
  31 + Attribute attr = (Attribute) it.next();
  32 + //TODO
  33 + }
  34 + }
  35 +}
@@ -52,6 +52,14 @@ @@ -52,6 +52,14 @@
52 FROM 52 FROM
53 <include refid="Base_Table"/> 53 <include refid="Base_Table"/>
54 </select> 54 </select>
  55 + <select id="selecMmasterWaybillList" resultMap="BaseResultMap" parameterType="java.lang.String">-- resultType="com.example.demo.model.NMS_FSU_FOH"
  56 + SELECT
  57 + <include refid="Base_Column_List"/>
  58 +
  59 + FROM
  60 + ARRIVEDMASTER
  61 + WHERE WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
  62 + </select>
55 <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > 63 <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
56 delete from ARRIVEDMASTER 64 delete from ARRIVEDMASTER
57 where AUTOID = #{autoid,jdbcType=VARCHAR} 65 where AUTOID = #{autoid,jdbcType=VARCHAR}
@@ -4,6 +4,7 @@ import com.example.demo.model.T_TXD_FWB; @@ -4,6 +4,7 @@ import com.example.demo.model.T_TXD_FWB;
4 import com.example.demo.model.T_TXD_FWBPARTY; 4 import com.example.demo.model.T_TXD_FWBPARTY;
5 import com.example.demo.service.T_TXD_FWB_Service; 5 import com.example.demo.service.T_TXD_FWB_Service;
6 import com.example.demo.util.XML.XML2ENTITY; 6 import com.example.demo.util.XML.XML2ENTITY;
  7 +import com.example.demo.util.XML.XMLXPath;
7 import org.dom4j.Document; 8 import org.dom4j.Document;
8 import org.dom4j.DocumentException; 9 import org.dom4j.DocumentException;
9 import org.dom4j.DocumentHelper; 10 import org.dom4j.DocumentHelper;
@@ -38,207 +39,135 @@ public class FWBDemo { @@ -38,207 +39,135 @@ public class FWBDemo {
38 String xml = "<MSG>\n" + 39 String xml = "<MSG>\n" +
39 "\t<META>\n" + 40 "\t<META>\n" +
40 "\t\t<SNDR>TXD</SNDR>\n" + 41 "\t\t<SNDR>TXD</SNDR>\n" +
41 - "\t\t<DDTM>20181114040536</DDTM>\n" + 42 + "\t\t<DDTM>20181210085229</DDTM>\n" +
42 "\t\t<TYPE>DFME</TYPE>\n" + 43 "\t\t<TYPE>DFME</TYPE>\n" +
43 - "\t\t<STYP>FWB</STYP>\n" +  
44 - "\t\t<SEQN>4643187</SEQN>\n" + 44 + "\t\t<STYP>UFOH</STYP>\n" +
  45 + "\t\t<SEQN>75532140</SEQN>\n" +
45 "\t</META>\n" + 46 "\t</META>\n" +
46 - "\t<MasterConsignment>\n" +  
47 - "\t\t<ID>880-83213594</ID>\n" +  
48 - "\t\t<TypeCode>741</TypeCode>\n" +  
49 - "\t\t<NilCarriageValueIndicator>false</NilCarriageValueIndicator>\n" +  
50 - "\t\t<DeclaredValueForCarriageAmount currencyID=\"CNY\">0</DeclaredValueForCarriageAmount>\n" +  
51 - "\t\t<NilCustomsValueIndicator>true</NilCustomsValueIndicator>\n" +  
52 - "\t\t<DeclaredValueForCustomsAmount currencyID=\"CNY\">NCV</DeclaredValueForCustomsAmount>\n" +  
53 - "\t\t<NilInsuranceValueIndicator>true</NilInsuranceValueIndicator>\n" +  
54 - "\t\t<InsuranceValueAmount currencyID=\"CNY\">XXX</InsuranceValueAmount>\n" +  
55 - "\t\t<TotalChargePrepaidIndicator>true</TotalChargePrepaidIndicator>\n" +  
56 - "\t\t<WeightTotalChargeAmount currencyID=\"CNY\">502</WeightTotalChargeAmount>\n" +  
57 - "\t\t<ValuationTotalChargeAmount currencyID=\"CNY\">0.00</ValuationTotalChargeAmount>\n" +  
58 - "\t\t<TotalDisbursementPrepaidIndicator>true</TotalDisbursementPrepaidIndicator>\n" +  
59 - "\t\t<TotalPrepaidChargeAmount currencyID=\"CNY\">613.60</TotalPrepaidChargeAmount>\n" +  
60 - "\t\t<TotalCollectChargeAmount currencyID=\"CNY\">0</TotalCollectChargeAmount>\n" +  
61 - "\t\t<DestinationCurrencyTotalCollectChargeAmount currencyID=\"CNY\">0</DestinationCurrencyTotalCollectChargeAmount>\n" +  
62 - "\t\t<IncludedTareGrossWeightMeasure unitCode=\"KGM\">558.0</IncludedTareGrossWeightMeasure>\n" +  
63 - "\t\t<NetWeightMeasure/>\n" +  
64 - "\t\t<GrossVolumeMeasure unitCode=\"MTQ\">4.44</GrossVolumeMeasure>\n" +  
65 - "\t\t<TotalChargeableWeightMeasure unitCode=\"KGM\">558.0</TotalChargeableWeightMeasure>\n" +  
66 - "\t\t<ConsignmentItemQuantity>1</ConsignmentItemQuantity>\n" +  
67 - "\t\t<TotalPieceQuantity>74</TotalPieceQuantity>\n" +  
68 - "\t\t<TotalLoadedPackageQuantity>74</TotalLoadedPackageQuantity>\n" +  
69 - "\t\t<PackageInfo>编织袋</PackageInfo>\n" +  
70 - "\t\t<FreightRateTypeCode>Q</FreightRateTypeCode>\n" +  
71 - "\t\t<ConsignorParty>\n" +  
72 - "\t\t\t<PrimaryID schemeAgencyID=\"1\">HNHH</PrimaryID>\n" +  
73 - "\t\t\t<Name>河南汇海物流有限公司</Name>\n" +  
74 - "\t\t\t<AccountID>INFOSKY:NULL</AccountID>\n" +  
75 - "\t\t\t<PostalStructuredAddress>\n" +  
76 - "\t\t\t\t<StreetName>郑州</StreetName>\n" +  
77 - "\t\t\t\t<CityName>CGO</CityName>\n" +  
78 - "\t\t\t\t<CountryID>CN</CountryID>\n" +  
79 - "\t\t\t\t<SpecifiedAddressLocation/>\n" +  
80 - "\t\t\t</PostalStructuredAddress>\n" +  
81 - "\t\t\t<SpecifiedCargoAgentLocation/>\n" +  
82 - "\t\t\t<DefinedTradeContact>\n" +  
83 - "\t\t\t\t<DirectTelephoneCommunication>\n" +  
84 - "\t\t\t\t\t<CompleteNumber>CGO</CompleteNumber>\n" +  
85 - "\t\t\t\t</DirectTelephoneCommunication>\n" +  
86 - "\t\t\t</DefinedTradeContact>\n" +  
87 - "\t\t</ConsignorParty>\n" +  
88 - "\t\t<ConsigneeParty>\n" +  
89 - "\t\t\t<PrimaryID schemeAgencyID=\"2\">SK</PrimaryID>\n" +  
90 - "\t\t\t<Name>海南顺丰速运有限公司</Name>\n" +  
91 - "\t\t\t<AccountID>INFOSKY:NULL</AccountID>\n" +  
92 - "\t\t\t<PostalStructuredAddress>\n" +  
93 - "\t\t\t\t<StreetName>机场自提</StreetName>\n" +  
94 - "\t\t\t\t<CityName>HAK</CityName>\n" +  
95 - "\t\t\t\t<CountryID>CN</CountryID>\n" +  
96 - "\t\t\t\t<SpecifiedAddressLocation/>\n" +  
97 - "\t\t\t</PostalStructuredAddress>\n" +  
98 - "\t\t\t<SpecifiedCargoAgentLocation/>\n" +  
99 - "\t\t\t<DefinedTradeContact/>\n" +  
100 - "\t\t</ConsigneeParty>\n" +  
101 - "\t\t<FreightForwarderParty>\n" +  
102 - "\t\t\t<Name>CGOSA</Name>\n" +  
103 - "\t\t\t<AccountID>INFOSKY:NULL</AccountID>\n" +  
104 - "\t\t\t<PostalStructuredAddress>\n" +  
105 - "\t\t\t\t<CityName>CGO</CityName>\n" +  
106 - "\t\t\t\t<CountryID>CN</CountryID>\n" +  
107 - "\t\t\t\t<SpecifiedAddressLocation/>\n" +  
108 - "\t\t\t</PostalStructuredAddress>\n" +  
109 - "\t\t\t<SpecifiedCargoAgentLocation/>\n" +  
110 - "\t\t\t<DefinedTradeContact/>\n" +  
111 - "\t\t</FreightForwarderParty>\n" +  
112 - "\t\t<AssociatedParty>\n" +  
113 - "\t\t\t<PrimaryID/>\n" +  
114 - "\t\t\t<Name>CGO</Name>\n" +  
115 - "\t\t\t<AccountID>INFOSKY:NULL</AccountID>\n" +  
116 - "\t\t\t<RoleCode>AGT</RoleCode>\n" +  
117 - "\t\t\t<Role>Agent</Role>\n" +  
118 - "\t\t\t<PostalStructuredAddress>\n" +  
119 - "\t\t\t\t<CityName>CGO</CityName>\n" +  
120 - "\t\t\t\t<CountryID>CN</CountryID>\n" +  
121 - "\t\t\t\t<SpecifiedAddressLocation/>\n" +  
122 - "\t\t\t</PostalStructuredAddress>\n" +  
123 - "\t\t\t<SpecifiedCargoAgentLocation/>\n" +  
124 - "\t\t\t<DefinedTradeContact/>\n" +  
125 - "\t\t</AssociatedParty>\n" +  
126 - "\t\t<AssociatedParty>\n" +  
127 - "\t\t\t<PrimaryID/>\n" +  
128 - "\t\t\t<Name>CGOHA</Name>\n" +  
129 - "\t\t\t<AccountID>INFOSKY:NULL</AccountID>\n" +  
130 - "\t\t\t<RoleCode>GHA</RoleCode>\n" +  
131 - "\t\t\t<Role>Ground Handling Agent</Role>\n" +  
132 - "\t\t\t<PostalStructuredAddress>\n" +  
133 - "\t\t\t\t<CityName>CGO</CityName>\n" +  
134 - "\t\t\t\t<CountryID>CN</CountryID>\n" +  
135 - "\t\t\t\t<SpecifiedAddressLocation/>\n" +  
136 - "\t\t\t</PostalStructuredAddress>\n" +  
137 - "\t\t\t<SpecifiedCargoAgentLocation/>\n" +  
138 - "\t\t\t<DefinedTradeContact/>\n" +  
139 - "\t\t</AssociatedParty>\n" +  
140 - "\t\t<OriginLocation>\n" +  
141 - "\t\t\t<ID>CGO</ID>\n" +  
142 - "\t\t</OriginLocation>\n" +  
143 - "\t\t<FinalDestinationLocation>\n" +  
144 - "\t\t\t<ID>HAK</ID>\n" +  
145 - "\t\t</FinalDestinationLocation>\n" +  
146 - "\t\t<SpecifiedLogisticsTransportMovement>\n" +  
147 - "\t\t\t<StageCode>HU7304/Nov14</StageCode>\n" +  
148 - "\t\t\t<ModeCode>4</ModeCode>\n" +  
149 - "\t\t\t<Mode>Air Transport</Mode>\n" +  
150 - "\t\t\t<ID>HU7304</ID>\n" +  
151 - "\t\t\t<SequenceNumeric>1</SequenceNumeric>\n" +  
152 - "\t\t\t<UsedLogisticsTransportMeans/>\n" +  
153 - "\t\t\t<ArrivalEvent>\n" +  
154 - "\t\t\t\t<OccurrenceArrivalLocation>\n" +  
155 - "\t\t\t\t\t<ID>HAK</ID>\n" +  
156 - "\t\t\t\t</OccurrenceArrivalLocation>\n" +  
157 - "\t\t\t</ArrivalEvent>\n" +  
158 - "\t\t\t<DepartureEvent>\n" +  
159 - "\t\t\t\t<ScheduledOccurrenceDateTime>2018-11-14T00:00:00+08:00</ScheduledOccurrenceDateTime>\n" +  
160 - "\t\t\t\t<OccurrenceDepartureLocation>\n" +  
161 - "\t\t\t\t\t<ID>CGO</ID>\n" +  
162 - "\t\t\t\t</OccurrenceDepartureLocation>\n" +  
163 - "\t\t\t</DepartureEvent>\n" +  
164 - "\t\t</SpecifiedLogisticsTransportMovement>\n" +  
165 - "\t\t<IncludedAccountingNote>\n" +  
166 - "\t\t\t<ContentCode>20010003普通</ContentCode>\n" +  
167 - "\t\t\t<Content>20010003普通</Content>\n" +  
168 - "\t\t</IncludedAccountingNote>\n" +  
169 - "\t\t<AssociatedConsignmentCustomsProcedure/>\n" +  
170 - "\t\t<ApplicableTradeCurrencyExchange>\n" +  
171 - "\t\t\t<SourceCurrencyCode>CNY</SourceCurrencyCode>\n" +  
172 - "\t\t\t<TargetCurrencyCode>CNY</TargetCurrencyCode>\n" +  
173 - "\t\t\t<MarketID>S</MarketID>\n" +  
174 - "\t\t\t<ConversionRate>1</ConversionRate>\n" +  
175 - "\t\t</ApplicableTradeCurrencyExchange>\n" +  
176 - "\t\t<ApplicableLogisticsServiceCharge/>\n" +  
177 - "\t\t<ApplicableLogisticsAllowanceCharge>\n" +  
178 - "\t\t\t<ID>MY</ID>\n" +  
179 - "\t\t\t<Reason>燃油费</Reason>\n" +  
180 - "\t\t\t<ActualAmount currencyID=\"CNY\">111.6</ActualAmount>\n" +  
181 - "\t\t\t<PartyTypeCode>C</PartyTypeCode>\n" +  
182 - "\t\t</ApplicableLogisticsAllowanceCharge>\n" +  
183 - "\t\t<SignatoryCarrierAuthentication>\n" +  
184 - "\t\t\t<ActualDateTime>2018-11-14T04:02:00</ActualDateTime>\n" +  
185 - "\t\t\t<Signatory>牛青</Signatory>\n" +  
186 - "\t\t\t<IssueAuthenticationLocation>\n" +  
187 - "\t\t\t\t<Name>郑州</Name>\n" +  
188 - "\t\t\t</IssueAuthenticationLocation>\n" +  
189 - "\t\t</SignatoryCarrierAuthentication>\n" +  
190 - "\t\t<IncludedMasterConsignmentItem>\n" +  
191 - "\t\t\t<SequenceNumeric>1</SequenceNumeric>\n" +  
192 - "\t\t\t<TypeCode listAgencyID=\"1\">PH</TypeCode>\n" +  
193 - "\t\t\t<GrossWeightMeasure unitCode=\"KGM\">558.0</GrossWeightMeasure>\n" +  
194 - "\t\t\t<GrossVolumeMeasure unitCode=\"MTQ\">4.44</GrossVolumeMeasure>\n" +  
195 - "\t\t\t<PieceQuantity>74</PieceQuantity>\n" +  
196 - "\t\t\t<TareWeightMeasure unitCode=\"KGM\">558.0</TareWeightMeasure>\n" +  
197 - "\t\t\t<NatureIdentificationTransportCargo>\n" +  
198 - "\t\t\t\t<Identification>手机机头(无电池) 电子主板 上衣 茶叶 大枣 皮带 票证 运动鞋 背包 灯座</Identification>\n" +  
199 - "\t\t\t</NatureIdentificationTransportCargo>\n" +  
200 - "\t\t\t<OriginCountry/>\n" +  
201 - "\t\t\t<AssociatedUnitLoadTransportEquipment>\n" +  
202 - "\t\t\t\t<OperatingParty/>\n" +  
203 - "\t\t\t</AssociatedUnitLoadTransportEquipment>\n" +  
204 - "\t\t\t<TransportLogisticsPackage>\n" +  
205 - "\t\t\t\t<ItemQuantity>74</ItemQuantity>\n" +  
206 - "\t\t\t\t<LinearSpatialDimension>\n" +  
207 - "\t\t\t\t\t<Description>true</Description>\n" +  
208 - "\t\t\t\t\t<WidthMeasure unitCode=\"CMT\">40</WidthMeasure>\n" +  
209 - "\t\t\t\t\t<LengthMeasure unitCode=\"CMT\">30</LengthMeasure>\n" +  
210 - "\t\t\t\t\t<HeightMeasure unitCode=\"CMT\">50</HeightMeasure>\n" +  
211 - "\t\t\t\t</LinearSpatialDimension>\n" +  
212 - "\t\t\t</TransportLogisticsPackage>\n" +  
213 - "\t\t\t<ApplicableFreightRateServiceCharge>\n" +  
214 - "\t\t\t\t<CategoryCode>Q</CategoryCode>\n" +  
215 - "\t\t\t\t<CommodityItemID>P</CommodityItemID>\n" +  
216 - "\t\t\t\t<ChargeableWeightMeasure unitCode=\"KGM\">558.0</ChargeableWeightMeasure>\n" +  
217 - "\t\t\t\t<AppliedRate>0.9</AppliedRate>\n" +  
218 - "\t\t\t\t<AppliedAmount currencyID=\"CNY\">502</AppliedAmount>\n" +  
219 - "\t\t\t</ApplicableFreightRateServiceCharge>\n" +  
220 - "\t\t\t<SpecifiedRateCombinationPointLocation/>\n" +  
221 - "\t\t</IncludedMasterConsignmentItem>\n" +  
222 - "\t\t<ReportedStatus>\n" +  
223 - "\t\t\t<ReasonCode>FWB</ReasonCode>\n" +  
224 - "\t\t\t<EventTime>\n" +  
225 - "\t\t\t\t<OccurrenceDateTime>2018-11-14T04:03:02+08:00</OccurrenceDateTime>\n" +  
226 - "\t\t\t\t<DateTimeTypeCode>Actual</DateTimeTypeCode>\n" +  
227 - "\t\t\t</EventTime>\n" +  
228 - "\t\t\t<SpecifiedLocation>\n" + 47 + "\t<ConsignmentStatus>\n" +
  48 + "\t\t<MasterConsignment>\n" +
  49 + "\t\t\t<GrossWeightMeasure unitCode=\"KGM\">3877</GrossWeightMeasure>\n" +
  50 + "\t\t\t<TotalGrossWeightMeasure unitCode=\"KGM\">3877</TotalGrossWeightMeasure>\n" +
  51 + "\t\t\t<ChargeableWeightMeasure unitCode=\"KGM\">4308.69</ChargeableWeightMeasure>\n" +
  52 + "\t\t\t<PieceQuantity>12</PieceQuantity>\n" +
  53 + "\t\t\t<TotalPieceQuantity>12</TotalPieceQuantity>\n" +
  54 + "\t\t\t<TransportSplitDescription>T</TransportSplitDescription>\n" +
  55 + "\t\t\t<TransportContractDocument>\n" +
  56 + "\t\t\t\t<ID>172-32971562</ID>\n" +
  57 + "\t\t\t\t<Name>Air Waybill</Name>\n" +
  58 + "\t\t\t\t<TypeCode>741</TypeCode>\n" +
  59 + "\t\t\t</TransportContractDocument>\n" +
  60 + "\t\t\t<OriginLocation>\n" +
229 "\t\t\t\t<ID>CGO</ID>\n" + 61 "\t\t\t\t<ID>CGO</ID>\n" +
230 - "\t\t\t</SpecifiedLocation>\n" +  
231 - "\t\t</ReportedStatus>\n" +  
232 - "\t</MasterConsignment>\n" + 62 + "\t\t\t\t<Name>ZHENGZHOU</Name>\n" +
  63 + "\t\t\t</OriginLocation>\n" +
  64 + "\t\t\t<FinalDestinationLocation>\n" +
  65 + "\t\t\t\t<ID>ORD</ID>\n" +
  66 + "\t\t\t\t<Name>Chicago</Name>\n" +
  67 + "\t\t\t</FinalDestinationLocation>\n" +
  68 + "\t\t\t<ReportedStatus>\n" +
  69 + "\t\t\t\t<ReasonCode>FOH</ReasonCode>\n" +
  70 + "\t\t\t\t<EventTime>\n" +
  71 + "\t\t\t\t\t<OccurrenceDateTime>2018-12-09T17:48:10+08:00</OccurrenceDateTime>\n" +
  72 + "\t\t\t\t\t<DateTimeTypeCode>Actual</DateTimeTypeCode>\n" +
  73 + "\t\t\t\t</EventTime>\n" +
  74 + "\t\t\t\t<SpecifiedLocation>\n" +
  75 + "\t\t\t\t\t<ID>CGO</ID>\n" +
  76 + "\t\t\t\t\t<Name/>\n" +
  77 + "\t\t\t\t\t<TypeCode>Airport</TypeCode>\n" +
  78 + "\t\t\t\t</SpecifiedLocation>\n" +
  79 + "\t\t\t\t<AssociatedStatusConsignment>\n" +
  80 + "\t\t\t\t\t<GrossWeightMeasure unitCode=\"KGM\">3877</GrossWeightMeasure>\n" +
  81 + "\t\t\t\t\t<GrossVolumeMeasure unitCode=\"MTQ\">25.85</GrossVolumeMeasure>\n" +
  82 + "\t\t\t\t\t<ChargeableWeightMeasure unitCode=\"KGM\">4308.69</ChargeableWeightMeasure>\n" +
  83 + "\t\t\t\t\t<DensityGroupCode>MC</DensityGroupCode>\n" +
  84 + "\t\t\t\t\t<PieceQuantity>12</PieceQuantity>\n" +
  85 + "\t\t\t\t\t<TransportSplitDescription>T</TransportSplitDescription>\n" +
  86 + "\t\t\t\t\t<SpecifiedLogisticsTransportMovement>\n" +
  87 + "\t\t\t\t\t\t<ID>CV9761</ID>\n" +
  88 + "\t\t\t\t\t\t<UsedLogisticsTransportMeans>\n" +
  89 + "\t\t\t\t\t\t\t<Name>B747E</Name>\n" +
  90 + "\t\t\t\t\t\t\t<Type>XXX</Type>\n" +
  91 + "\t\t\t\t\t\t</UsedLogisticsTransportMeans>\n" +
  92 + "\t\t\t\t\t\t<ArrivalEvent>\n" +
  93 + "\t\t\t\t\t\t\t<ArrivalOccurrenceDateTime>2018-12-11T12:30:00+08:00</ArrivalOccurrenceDateTime>\n" +
  94 + "\t\t\t\t\t\t\t<ArrivalDateTimeTypeCode>Schedual</ArrivalDateTimeTypeCode>\n" +
  95 + "\t\t\t\t\t\t\t<OccurrenceArrivalLocation>\n" +
  96 + "\t\t\t\t\t\t\t\t<ID/>\n" +
  97 + "\t\t\t\t\t\t\t\t<Name/>\n" +
  98 + "\t\t\t\t\t\t\t\t<TypeCode>Airport</TypeCode>\n" +
  99 + "\t\t\t\t\t\t\t\t<FirstArrivalCountryID/>\n" +
  100 + "\t\t\t\t\t\t\t</OccurrenceArrivalLocation>\n" +
  101 + "\t\t\t\t\t\t</ArrivalEvent>\n" +
  102 + "\t\t\t\t\t\t<DepartureEvent>\n" +
  103 + "\t\t\t\t\t\t\t<DepartureOccurrenceDateTime>2018-12-11T04:30:00+08:00</DepartureOccurrenceDateTime>\n" +
  104 + "\t\t\t\t\t\t\t<DepartureDateTimeTypeCode>Schedual</DepartureDateTimeTypeCode>\n" +
  105 + "\t\t\t\t\t\t\t<OccurrenceDepartureLocation>\n" +
  106 + "\t\t\t\t\t\t\t\t<ID>CGO</ID>\n" +
  107 + "\t\t\t\t\t\t\t\t<Name>ZHENGZHOU</Name>\n" +
  108 + "\t\t\t\t\t\t\t\t<TypeCode>Airport</TypeCode>\n" +
  109 + "\t\t\t\t\t\t\t\t<FirstArrivalCountryID>CN</FirstArrivalCountryID>\n" +
  110 + "\t\t\t\t\t\t\t</OccurrenceDepartureLocation>\n" +
  111 + "\t\t\t\t\t\t</DepartureEvent>\n" +
  112 + "\t\t\t\t\t\t<CarrierParty>\n" +
  113 + "\t\t\t\t\t\t\t<PrimaryID schemeAgencyID=\"3\">CV</PrimaryID>\n" +
  114 + "\t\t\t\t\t\t</CarrierParty>\n" +
  115 + "\t\t\t\t\t\t<SpecifiedLocation>\n" +
  116 + "\t\t\t\t\t\t\t<ID>CGO</ID>\n" +
  117 + "\t\t\t\t\t\t\t<Name>ZHENGZHOU</Name>\n" +
  118 + "\t\t\t\t\t\t\t<TypeCode>Airport</TypeCode>\n" +
  119 + "\t\t\t\t\t\t</SpecifiedLocation>\n" +
  120 + "\t\t\t\t\t\t<SpecifiedEvent>\n" +
  121 + "\t\t\t\t\t\t\t<OccurrenceDateTime>2018-12-09T17:48:10+08:00</OccurrenceDateTime>\n" +
  122 + "\t\t\t\t\t\t\t<DateTimeTypeCode>Actual</DateTimeTypeCode>\n" +
  123 + "\t\t\t\t\t\t</SpecifiedEvent>\n" +
  124 + "\t\t\t\t\t</SpecifiedLogisticsTransportMovement>\n" +
  125 + "\t\t\t\t\t<StorageLocations>\n" +
  126 + "\t\t\t\t\t\t<LocationInfomation>\n" +
  127 + "\t\t\t\t\t\t\t<Location>KQ/KQ</Location>\n" +
  128 + "\t\t\t\t\t\t\t<PieceQuantity>12</PieceQuantity>\n" +
  129 + "\t\t\t\t\t\t\t<GrossWeightMeasure unitCode=\"KGM\">3877</GrossWeightMeasure>\n" +
  130 + "\t\t\t\t\t\t</LocationInfomation>\n" +
  131 + "\t\t\t\t\t</StorageLocations>\n" +
  132 + "\t\t\t\t\t<RecievedFromParty>\n" +
  133 + "\t\t\t\t\t\t<Name>DSV AIR SEA CO LTD 1</Name>\n" +
  134 + "\t\t\t\t\t\t<PostalStructuredAddress>\n" +
  135 + "\t\t\t\t\t\t\t<StreetName/>\n" +
  136 + "\t\t\t\t\t\t</PostalStructuredAddress>\n" +
  137 + "\t\t\t\t\t\t<DefinedTradeContact>\n" +
  138 + "\t\t\t\t\t\t\t<DirectTelephoneCommunication>\n" +
  139 + "\t\t\t\t\t\t\t\t<CompleteNumber/>\n" +
  140 + "\t\t\t\t\t\t\t</DirectTelephoneCommunication>\n" +
  141 + "\t\t\t\t\t\t</DefinedTradeContact>\n" +
  142 + "\t\t\t\t\t</RecievedFromParty>\n" +
  143 + "\t\t\t\t\t<IncludedMasterConsignmentItem>\n" +
  144 + "\t\t\t\t\t\t<TypeCode listAgencyID=\"1\">CONSOL</TypeCode>\n" +
  145 + "\t\t\t\t\t</IncludedMasterConsignmentItem>\n" +
  146 + "\t\t\t\t\t<IncludedCustomsNote>\n" +
  147 + "\t\t\t\t\t\t<ContentCode>CD</ContentCode>\n" +
  148 + "\t\t\t\t\t\t<Content>P-CGOXH-ICUSTOMS0000</Content>\n" +
  149 + "\t\t\t\t\t\t<SubjectCode/>\n" +
  150 + "\t\t\t\t\t\t<CountryID/>\n" +
  151 + "\t\t\t\t\t\t<UtilizedUnitLoadTransportEquipment/>\n" +
  152 + "\t\t\t\t\t</IncludedCustomsNote>\n" +
  153 + "\t\t\t\t</AssociatedStatusConsignment>\n" +
  154 + "\t\t\t</ReportedStatus>\n" +
  155 + "\t\t</MasterConsignment>\n" +
  156 + "\t</ConsignmentStatus>\n" +
233 "</MSG>"; 157 "</MSG>";
234 158
235 Document doc = DocumentHelper.parseText(xml); 159 Document doc = DocumentHelper.parseText(xml);
236 160
  161 +// String currencyID = XMLXPath.getSinglePathProperty(doc,"//MSG/MasterConsignment/DeclaredValueForCarriageAmount/@currencyID");
  162 +
  163 + String measure = XMLXPath.getSingleValueByPath(doc,"//MSG/ConsignmentStatus/MasterConsignment/GrossWeightMeasure/@unitCode");
  164 + String measure1 = XMLXPath.getSingleValueByPath(doc,"//MSG/ConsignmentStatus/MasterConsignment/GrossWeightMeasure");
  165 +
237 long beginTime = System.currentTimeMillis(); 166 long beginTime = System.currentTimeMillis();
238 167
239 try{ 168 try{
240 XML2ENTITY xml2ENTITY = new XML2ENTITY(); 169 XML2ENTITY xml2ENTITY = new XML2ENTITY();
241 - Map<String, Object> map = xml2ENTITY.Dom2Map(doc); 170 + Map<String, Object> map = xml2ENTITY.Dom2Map_propety(doc);
242 T_TXD_FWB fwb= new T_TXD_FWB(); 171 T_TXD_FWB fwb= new T_TXD_FWB();
243 //fwb.setFid(getBigDecimal(1)); 172 //fwb.setFid(getBigDecimal(1));
244 fwb.setMessageBakId(getBigDecimal(1)); 173 fwb.setMessageBakId(getBigDecimal(1));