作者 朱兆平

主单运抵入库

package com.example.demo.handle;
import com.example.demo.handle.nms.FSU_FOH_Handle;
import com.example.demo.model.IMF_META;
import com.example.demo.util.IO.FileTool;
import com.example.demo.util.XML.XML2ENTITY;
... ... @@ -23,13 +24,13 @@ public class IMF_Message_MainHandle {
XML2ENTITY xml2ENTITY = new XML2ENTITY();
Map<String, Object> map = xml2ENTITY.Dom2Map(doc);
Map metaMap = (Map) getMap(map,"META");
imf_meta.setSNDR((String) getMap(metaMap,"SNDR"));
imf_meta.setDDTM((String) getMap(metaMap,"DDTM"));
imf_meta.setRCVR((String) getMap(metaMap,"RCVR"));
imf_meta.setSEQN((String) getMap(metaMap,"SEQN"));
imf_meta.setTYPE((String) getMap(metaMap,"TYPE"));
TYPE_Path = (String) getMap(metaMap,"STYP");
Map metaMap = (Map) xml2ENTITY.getMap(map,"META");
imf_meta.setSNDR((String) xml2ENTITY.getMap(metaMap,"SNDR"));
imf_meta.setDDTM((String) xml2ENTITY.getMap(metaMap,"DDTM"));
imf_meta.setRCVR((String) xml2ENTITY.getMap(metaMap,"RCVR"));
imf_meta.setSEQN((String) xml2ENTITY.getMap(metaMap,"SEQN"));
imf_meta.setTYPE((String) xml2ENTITY.getMap(metaMap,"TYPE"));
TYPE_Path = (String) xml2ENTITY.getMap(metaMap,"STYP");
imf_meta.setSTYP(TYPE_Path);
//解析分配
... ... @@ -38,7 +39,7 @@ public class IMF_Message_MainHandle {
break;
case "UFOH":
FSU_FOH_Handle.handle(doc);
break;
case "EFOH":
break;
... ... @@ -63,19 +64,5 @@ public class IMF_Message_MainHandle {
return imf_meta;
}
public static Boolean CheckMap(Map map,String key){
if(map.containsKey(key)){
return Boolean.TRUE;
}else {
return Boolean.FALSE;
}
}
public static Object getMap(Map map,String key){
if(map!=null && CheckMap(map,key)){
return map.get(key);
}else {
return null;
}
}
}
... ...
package com.example.demo.handle.nms;
import com.example.demo.model.NMS_FSU_FOH;
import com.example.demo.service.NMS_FSU_FOH_Service;
import com.example.demo.util.Helper;
import com.example.demo.util.IO.FileTool;
import com.example.demo.util.XML.XML2ENTITY;
import com.example.demo.util.XML.XMLXPath;
import org.dom4j.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.time.ZonedDateTime;
import java.util.Date;
import java.util.Map;
@Component
public class FSU_FOH_Handle {
public void fsu_foh_handle(){
@Autowired
protected NMS_FSU_FOH_Service fohService;
private static FSU_FOH_Handle fsu_foh_handle;
private final static String stype = "FSU_FOH";
@PostConstruct
public void init(){
fsu_foh_handle = this;
fsu_foh_handle.fohService = this.fohService;
}
public static void handle(Document document){
try {
XML2ENTITY xml2ENTITY = new XML2ENTITY();
Map<String, Object> map = xml2ENTITY.Dom2Map(document);
NMS_FSU_FOH fsu_foh = new NMS_FSU_FOH();
Map ConsignmentStatus = (Map) XML2ENTITY.getMap(map, "ConsignmentStatus");
Map MasterConsignment = (Map) XML2ENTITY.getMap(ConsignmentStatus, "MasterConsignment");
Map TransportContractDocument = (Map) XML2ENTITY.getMap(MasterConsignment, "TransportContractDocument"); //运单信息节点
Map OriginLocation = (Map) XML2ENTITY.getMap(MasterConsignment, "OriginLocation"); //运单起始站信息节点
Map FinalDestinationLocation = (Map) XML2ENTITY.getMap(MasterConsignment, "FinalDestinationLocation"); //运单目的站信息节点
String arrivPiece = (String) XML2ENTITY.getMap(MasterConsignment, "PieceQuantity");//运抵件数
String arrivWeight = (String) XML2ENTITY.getMap(MasterConsignment, "GrossWeightMeasure");//运抵重量
String grossWeightMeasureUc = XMLXPath.getSingleValueByPath(document, "//MSG/ConsignmentStatus/MasterConsignment/GrossWeightMeasure/@unitCode");//运抵重量计费单位
String totalWeightMeasureUc = XMLXPath.getSingleValueByPath(document, "//MSG/ConsignmentStatus/MasterConsignment/TotalGrossWeightMeasure//@unitCode");//运单重量计费单位
String chargeWeighMeasureUc = XMLXPath.getSingleValueByPath(document, "//MSG/ConsignmentStatus/MasterConsignment/ChargeableWeightMeasure//@unitCode");//计费重量计费单位
String totalPiece = (String) XML2ENTITY.getMap(MasterConsignment, "TotalPieceQuantity");//运单件数
String totalWeight = (String) XML2ENTITY.getMap(MasterConsignment, "TotalGrossWeightMeasure");//运单重量
String chargeWeight = (String) XML2ENTITY.getMap(MasterConsignment, "ChargeableWeightMeasure");//运单计费重量
String waybillNo = (String) XML2ENTITY.getMap(TransportContractDocument, "ID");//运单号
String originLocation = (String) XML2ENTITY.getMap(OriginLocation, "ID");
String finalLocation = (String) XML2ENTITY.getMap(FinalDestinationLocation, "ID");
String originName = (String) XML2ENTITY.getMap(OriginLocation, "Name");
String finalLocationName = (String) XML2ENTITY.getMap(FinalDestinationLocation, "Name");
fsu_foh.setWaybillnomaster(waybillNo);
fsu_foh.setOriginatingstation(originLocation);
fsu_foh.setDestinationstation(finalLocation);
fsu_foh.setoName(originName);
fsu_foh.setFdName(finalLocationName);
fsu_foh.setArrivedtotalpiece(arrivPiece);
fsu_foh.setArrivedtotalweight(arrivWeight);
fsu_foh.setGrossweightmeasureuc(grossWeightMeasureUc);
fsu_foh.setTotalpiecequantity(totalPiece);
fsu_foh.setTotalgrossweightmeasure(totalWeight);
fsu_foh.setTotalgrossweightmeasureuc(totalWeightMeasureUc);
fsu_foh.setChargeableweightmeasure(chargeWeight);
fsu_foh.setChargeableweightmeasureuc(chargeWeighMeasureUc);
String tcd_name = (String) XML2ENTITY.getMap(TransportContractDocument, "Name");
fsu_foh.setTcdName(tcd_name);
String typecode = (String) XML2ENTITY.getMap(TransportContractDocument, "TypeCode");
fsu_foh.setTcdTypecode(typecode);
Map ReportedStatus = (Map) XML2ENTITY.getMap(MasterConsignment, "ReportedStatus"); //运抵节点
Map EventTime = (Map) XML2ENTITY.getMap(ReportedStatus, "EventTime"); //运抵节点
String OccurrenceDateTime = (String) XML2ENTITY.getMap(EventTime, "OccurrenceDateTime"); //运抵时间
ZonedDateTime arrZoneTime = ZonedDateTime.parse(OccurrenceDateTime);
Date arriv_time = Date.from(arrZoneTime.toInstant()); //这个是入库航班日期格式
fsu_foh.setArriveddate(arriv_time);
Map AssociatedStatusConsignment = (Map) XML2ENTITY.getMap(ReportedStatus, "AssociatedStatusConsignment"); //航班信息节点
Map SpecifiedLogisticsTransportMovement = (Map) XML2ENTITY.getMap(AssociatedStatusConsignment, "SpecifiedLogisticsTransportMovement");
String flight = (String) XML2ENTITY.getMap(SpecifiedLogisticsTransportMovement, "ID");//航班号
if (!flight.isEmpty() && !flight.equals(null)) {
String carrier_no = flight.substring(0, 2);
String flight_no = flight.substring(2);
fsu_foh.setFlightno(flight_no);
fsu_foh.setCarrier(carrier_no);
}
Map DepartureEvent = (Map) XML2ENTITY.getMap(SpecifiedLogisticsTransportMovement, "DepartureEvent");//航班离港日期节点
String dep_time = (String) XML2ENTITY.getMap(DepartureEvent, "DepartureOccurrenceDateTime");//离港日期作为航班日期
ZonedDateTime depZoneTime = ZonedDateTime.parse(dep_time);
Date flightDate = Date.from(depZoneTime.toInstant()); //这个是入库航班日期格式
fsu_foh.setFlightdate(flightDate);
String custom = "4604";
Map StorageLocations = (Map) XML2ENTITY.getMap(AssociatedStatusConsignment, "StorageLocations");
Map LocationInfomation = (Map) XML2ENTITY.getMap(StorageLocations, "LocationInfomation");
String Location = XML2ENTITY.getMap(LocationInfomation, "Location").toString();
if (Location.contains("ZBQ")) {
custom = "4620";
}
fsu_foh.setCustomscode(custom);
String TransportSplitDescription = (String) XML2ENTITY.getMap(AssociatedStatusConsignment, "TransportSplitDescription");
fsu_foh.setTransportsplitdescription(TransportSplitDescription);
Map IncludedMasterConsignmentItem = (Map) XML2ENTITY.getMap(AssociatedStatusConsignment, "IncludedMasterConsignmentItem");
String productName = (String) XML2ENTITY.getMap(IncludedMasterConsignmentItem, "TypeCode");
fsu_foh.setProductname(productName);
fsu_foh.setStatus("01"); //默认自动发送
fsu_foh.setReceiptinformation("");
Date creatTime = new Date();
fsu_foh.setCreatedate(creatTime);
fsu_foh.setAutoid(Helper.getUUID());
int resoult = fsu_foh_handle.fohService.insert(fsu_foh);
FileTool.writeWaybill("FSU_FOH",document.asXML(),waybillNo);
}catch (Exception e){
e.printStackTrace();
FileTool.writeFile(stype,e.toString()+"\n"+document.asXML(),false);
}
}
}
... ...
... ... @@ -13,6 +13,8 @@ public interface NMS_FSU_FOHMapper {
NMS_FSU_FOH selectByPrimaryKey(String autoid);
List<NMS_FSU_FOH> selecMmasterWaybillList (String waybillNo);
int updateByPrimaryKeySelective(NMS_FSU_FOH record);
int updateByPrimaryKey(NMS_FSU_FOH record);
... ...
... ... @@ -17,7 +17,7 @@ public class IMF_Task {
public static boolean isSuc = true;
public static IMFClient client = null;
// @Scheduled(fixedRate = 5000)
@Scheduled(fixedRate = 5000)
private static void start() throws Exception {
PropertyConfigurator.configure("config/log4j.properties");
client = IMFClientFactory.createInstance();
... ...
... ... @@ -3,6 +3,7 @@ package com.example.demo.service;
import com.example.demo.model.NMS_FSU_FOH;
import com.github.pagehelper.PageInfo;
import java.util.List;
public interface NMS_FSU_FOH_Service {
... ... @@ -13,4 +14,5 @@ public interface NMS_FSU_FOH_Service {
int updateByPrimaryKey(NMS_FSU_FOH record);
NMS_FSU_FOH selectByPrimaryKey(String autoid);
PageInfo<NMS_FSU_FOH> selectAll(int pageNum, int pageSize);
List<NMS_FSU_FOH> selecMmasterWaybillList (String waybillNo);
}
... ...
... ... @@ -18,10 +18,30 @@ public class NMS_FSU_FOH_ServiceImp implements NMS_FSU_FOH_Service{
private NMS_FSU_FOHMapper fsu_fohMapper;
public int insert(NMS_FSU_FOH record){
return fsu_fohMapper.insert(record);
int i=0;
List<NMS_FSU_FOH> masterList = selecMmasterWaybillList(record.getWaybillnomaster());
if(masterList!=null && masterList.size()>0){
for (NMS_FSU_FOH master:masterList) {
updateByPrimaryKey(master);
}
}else {
i= fsu_fohMapper.insert(record);
}
return i;
}
public int insertSelective(NMS_FSU_FOH record){
return fsu_fohMapper.insertSelective(record);
int i=0;
List<NMS_FSU_FOH> masterList = selecMmasterWaybillList(record.getWaybillnomaster());
if(masterList!=null && masterList.size()>0){
for (NMS_FSU_FOH master:masterList) {
updateByPrimaryKey(master);
}
}else {
i= fsu_fohMapper.insertSelective(record);
}
return i;
}
public int updateByPrimaryKeySelective(NMS_FSU_FOH record){
return fsu_fohMapper.updateByPrimaryKeySelective(record);
... ... @@ -39,4 +59,7 @@ public class NMS_FSU_FOH_ServiceImp implements NMS_FSU_FOH_Service{
PageInfo<NMS_FSU_FOH> result = new PageInfo<NMS_FSU_FOH>(fsuFohList);
return result;
}
public List<NMS_FSU_FOH> selecMmasterWaybillList (String waybillNo){
return fsu_fohMapper.selecMmasterWaybillList(waybillNo);
}
}
... ...
... ... @@ -33,20 +33,7 @@ public class Helper {
return ret;
}
/**
* 判断map是否包含key,包含返回KEY值,不包含返回NULL
* @param map
* @param key
* @return
*/
@Nullable static public Object CheckMapKey(Map map, String key){
boolean contains = map.containsKey(key); //判断是否包含指定的键值
if (contains) { //如果条件为真
return map.get(key);
} else {
return null;
}
}
public static String getUUID(){
return UUID.randomUUID().toString().replace("-", "");
... ...
... ... @@ -23,9 +23,9 @@ public final class FileTool {
StringBuffer stringBuffer = new StringBuffer();
if (rightOrwrong){
stringBuffer.append(xmlRootDirectory).append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log");
stringBuffer.append(xmlRootDirectory).append("/").append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log");
}else {
stringBuffer.append(errorRootDirectory).append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log");
stringBuffer.append(errorRootDirectory).append("/").append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log");
}
File file = new File(stringBuffer.toString());
... ... @@ -37,4 +37,16 @@ public final class FileTool {
}
}
public static void writeWaybill(String path,String content,String waybillNo){
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(xmlRootDirectory).append("/").append(path).append("/").append(DateUtil.getToday()).append("/").append(waybillNo).append(".log");
File file = new File(stringBuffer.toString());
try{
FileUtils.writeStringToFile(file,content,Cherector);
}catch (IOException e){
e.printStackTrace();
}
}
}
... ...
... ... @@ -5,11 +5,17 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.Element;
import org.springframework.lang.Nullable;
public class XML2ENTITY {
@SuppressWarnings("unchecked")
/**取KEY的VALUE
*
*/
public Map<String, Object> Dom2Map(Document doc){
Map<String, Object> map = new HashMap<String, Object>();
if(doc == null)
... ... @@ -72,6 +78,107 @@ public class XML2ENTITY {
map.put(e.getName(), e.getText());
return map;
}
public List<Map> attrOfElement(Element e){
List attList = new ArrayList();
List<Attribute> listAttr = e.attributes();
for(Attribute attr:listAttr){//遍历当前节点的所有属性
String name=attr.getName();//属性名称
String value=attr.getValue();//属性的值
Map<String, Object> attMap = new HashMap<String, Object>();
attMap.put(name,value);
attList.add(attMap);
}
return attList;
}
@SuppressWarnings("unchecked")
/**遍历所有节点的属性值
*
*/
public Map<String, Object> Dom2Map_propety(Document doc){
Map<String, Object> map = new HashMap<String, Object>();
if(doc == null)
return map;
Element root = doc.getRootElement();
for (Iterator iterator = root.elementIterator(); iterator.hasNext();) {
Element e = (Element) iterator.next();
List list = e.elements();
if(list.size() > 0){
map.put(e.getName(), Dom2Map_propety(e));
}else {
map.put(e.getName(), attrOfElement(e));
}
}
return map;
}
@SuppressWarnings("unchecked")
public Map Dom2Map_propety(Element e){
Map map = new HashMap();
List list = e.elements();
if(list.size() > 0){
for (int i = 0;i < list.size(); i++) {
Element iter = (Element) list.get(i);
List mapList = new ArrayList();
if(iter.elements().size() > 0){
Map m = Dom2Map_propety(iter);
if(map.get(iter.getName()) != null){
Object obj = map.get(iter.getName());
if(!obj.getClass().getName().equals("java.util.ArrayList")){
mapList = new ArrayList();
mapList.add(obj);
mapList.add(m);
}
if(obj.getClass().getName().equals("java.util.ArrayList")){
mapList = (List) obj;
mapList.add(m);
}
map.put(iter.getName(), mapList);
}else
map.put(iter.getName(), m);
}
else{
if(map.get(iter.getName()) != null){
Object obj = map.get(iter.getName());
if(!obj.getClass().getName().equals("java.util.ArrayList")){
mapList = new ArrayList();
mapList.add(obj);
mapList.add(iter.getText());
}
if(obj.getClass().getName().equals("java.util.ArrayList")){
mapList = (List) obj;
mapList.add(iter.getText());
}
map.put(iter.getName(), mapList);
}else{
map.put(iter.getName(), attrOfElement(iter));
}
}
}
}else {
map.put(e.getName(), attrOfElement(e));
}
return map;
}
/**
* 判断map是否包含key,包含返回KEY值,不包含返回NULL
* @param map
* @param key
* @return
*/
@Nullable
public static Object getMap(Map map, String key){
if(map!=null && map.containsKey(key)){
return map.get(key);
} else {
return null;
}
}
}
... ...
package com.example.demo.util.XML;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.Node;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class XMLXPath {
public static String getSingleValueByPath(Document document,String path){
Node node = document.selectSingleNode(path);
if (node!=null){
String nodeValue = node.getStringValue();
return nodeValue;
}else {
return null;
}
}
public static List<Node> getPathValues(Document document,String path){
List<Node> nodes= document.selectNodes(path);
return nodes;
}
public static void getPathValues2(Document document,String path){
List list = document.selectNodes(path);
for (Iterator it = list.iterator(); it.hasNext();) {
Attribute attr = (Attribute) it.next();
//TODO
}
}
}
... ...
... ... @@ -52,6 +52,14 @@
FROM
<include refid="Base_Table"/>
</select>
<select id="selecMmasterWaybillList" resultMap="BaseResultMap" parameterType="java.lang.String">-- resultType="com.example.demo.model.NMS_FSU_FOH"
SELECT
<include refid="Base_Column_List"/>
FROM
ARRIVEDMASTER
WHERE WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from ARRIVEDMASTER
where AUTOID = #{autoid,jdbcType=VARCHAR}
... ...
... ... @@ -4,6 +4,7 @@ import com.example.demo.model.T_TXD_FWB;
import com.example.demo.model.T_TXD_FWBPARTY;
import com.example.demo.service.T_TXD_FWB_Service;
import com.example.demo.util.XML.XML2ENTITY;
import com.example.demo.util.XML.XMLXPath;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
... ... @@ -38,207 +39,135 @@ public class FWBDemo {
String xml = "<MSG>\n" +
"\t<META>\n" +
"\t\t<SNDR>TXD</SNDR>\n" +
"\t\t<DDTM>20181114040536</DDTM>\n" +
"\t\t<DDTM>20181210085229</DDTM>\n" +
"\t\t<TYPE>DFME</TYPE>\n" +
"\t\t<STYP>FWB</STYP>\n" +
"\t\t<SEQN>4643187</SEQN>\n" +
"\t\t<STYP>UFOH</STYP>\n" +
"\t\t<SEQN>75532140</SEQN>\n" +
"\t</META>\n" +
"\t<MasterConsignment>\n" +
"\t\t<ID>880-83213594</ID>\n" +
"\t\t<TypeCode>741</TypeCode>\n" +
"\t\t<NilCarriageValueIndicator>false</NilCarriageValueIndicator>\n" +
"\t\t<DeclaredValueForCarriageAmount currencyID=\"CNY\">0</DeclaredValueForCarriageAmount>\n" +
"\t\t<NilCustomsValueIndicator>true</NilCustomsValueIndicator>\n" +
"\t\t<DeclaredValueForCustomsAmount currencyID=\"CNY\">NCV</DeclaredValueForCustomsAmount>\n" +
"\t\t<NilInsuranceValueIndicator>true</NilInsuranceValueIndicator>\n" +
"\t\t<InsuranceValueAmount currencyID=\"CNY\">XXX</InsuranceValueAmount>\n" +
"\t\t<TotalChargePrepaidIndicator>true</TotalChargePrepaidIndicator>\n" +
"\t\t<WeightTotalChargeAmount currencyID=\"CNY\">502</WeightTotalChargeAmount>\n" +
"\t\t<ValuationTotalChargeAmount currencyID=\"CNY\">0.00</ValuationTotalChargeAmount>\n" +
"\t\t<TotalDisbursementPrepaidIndicator>true</TotalDisbursementPrepaidIndicator>\n" +
"\t\t<TotalPrepaidChargeAmount currencyID=\"CNY\">613.60</TotalPrepaidChargeAmount>\n" +
"\t\t<TotalCollectChargeAmount currencyID=\"CNY\">0</TotalCollectChargeAmount>\n" +
"\t\t<DestinationCurrencyTotalCollectChargeAmount currencyID=\"CNY\">0</DestinationCurrencyTotalCollectChargeAmount>\n" +
"\t\t<IncludedTareGrossWeightMeasure unitCode=\"KGM\">558.0</IncludedTareGrossWeightMeasure>\n" +
"\t\t<NetWeightMeasure/>\n" +
"\t\t<GrossVolumeMeasure unitCode=\"MTQ\">4.44</GrossVolumeMeasure>\n" +
"\t\t<TotalChargeableWeightMeasure unitCode=\"KGM\">558.0</TotalChargeableWeightMeasure>\n" +
"\t\t<ConsignmentItemQuantity>1</ConsignmentItemQuantity>\n" +
"\t\t<TotalPieceQuantity>74</TotalPieceQuantity>\n" +
"\t\t<TotalLoadedPackageQuantity>74</TotalLoadedPackageQuantity>\n" +
"\t\t<PackageInfo>编织袋</PackageInfo>\n" +
"\t\t<FreightRateTypeCode>Q</FreightRateTypeCode>\n" +
"\t\t<ConsignorParty>\n" +
"\t\t\t<PrimaryID schemeAgencyID=\"1\">HNHH</PrimaryID>\n" +
"\t\t\t<Name>河南汇海物流有限公司</Name>\n" +
"\t\t\t<AccountID>INFOSKY:NULL</AccountID>\n" +
"\t\t\t<PostalStructuredAddress>\n" +
"\t\t\t\t<StreetName>郑州</StreetName>\n" +
"\t\t\t\t<CityName>CGO</CityName>\n" +
"\t\t\t\t<CountryID>CN</CountryID>\n" +
"\t\t\t\t<SpecifiedAddressLocation/>\n" +
"\t\t\t</PostalStructuredAddress>\n" +
"\t\t\t<SpecifiedCargoAgentLocation/>\n" +
"\t\t\t<DefinedTradeContact>\n" +
"\t\t\t\t<DirectTelephoneCommunication>\n" +
"\t\t\t\t\t<CompleteNumber>CGO</CompleteNumber>\n" +
"\t\t\t\t</DirectTelephoneCommunication>\n" +
"\t\t\t</DefinedTradeContact>\n" +
"\t\t</ConsignorParty>\n" +
"\t\t<ConsigneeParty>\n" +
"\t\t\t<PrimaryID schemeAgencyID=\"2\">SK</PrimaryID>\n" +
"\t\t\t<Name>海南顺丰速运有限公司</Name>\n" +
"\t\t\t<AccountID>INFOSKY:NULL</AccountID>\n" +
"\t\t\t<PostalStructuredAddress>\n" +
"\t\t\t\t<StreetName>机场自提</StreetName>\n" +
"\t\t\t\t<CityName>HAK</CityName>\n" +
"\t\t\t\t<CountryID>CN</CountryID>\n" +
"\t\t\t\t<SpecifiedAddressLocation/>\n" +
"\t\t\t</PostalStructuredAddress>\n" +
"\t\t\t<SpecifiedCargoAgentLocation/>\n" +
"\t\t\t<DefinedTradeContact/>\n" +
"\t\t</ConsigneeParty>\n" +
"\t\t<FreightForwarderParty>\n" +
"\t\t\t<Name>CGOSA</Name>\n" +
"\t\t\t<AccountID>INFOSKY:NULL</AccountID>\n" +
"\t\t\t<PostalStructuredAddress>\n" +
"\t\t\t\t<CityName>CGO</CityName>\n" +
"\t\t\t\t<CountryID>CN</CountryID>\n" +
"\t\t\t\t<SpecifiedAddressLocation/>\n" +
"\t\t\t</PostalStructuredAddress>\n" +
"\t\t\t<SpecifiedCargoAgentLocation/>\n" +
"\t\t\t<DefinedTradeContact/>\n" +
"\t\t</FreightForwarderParty>\n" +
"\t\t<AssociatedParty>\n" +
"\t\t\t<PrimaryID/>\n" +
"\t\t\t<Name>CGO</Name>\n" +
"\t\t\t<AccountID>INFOSKY:NULL</AccountID>\n" +
"\t\t\t<RoleCode>AGT</RoleCode>\n" +
"\t\t\t<Role>Agent</Role>\n" +
"\t\t\t<PostalStructuredAddress>\n" +
"\t\t\t\t<CityName>CGO</CityName>\n" +
"\t\t\t\t<CountryID>CN</CountryID>\n" +
"\t\t\t\t<SpecifiedAddressLocation/>\n" +
"\t\t\t</PostalStructuredAddress>\n" +
"\t\t\t<SpecifiedCargoAgentLocation/>\n" +
"\t\t\t<DefinedTradeContact/>\n" +
"\t\t</AssociatedParty>\n" +
"\t\t<AssociatedParty>\n" +
"\t\t\t<PrimaryID/>\n" +
"\t\t\t<Name>CGOHA</Name>\n" +
"\t\t\t<AccountID>INFOSKY:NULL</AccountID>\n" +
"\t\t\t<RoleCode>GHA</RoleCode>\n" +
"\t\t\t<Role>Ground Handling Agent</Role>\n" +
"\t\t\t<PostalStructuredAddress>\n" +
"\t\t\t\t<CityName>CGO</CityName>\n" +
"\t\t\t\t<CountryID>CN</CountryID>\n" +
"\t\t\t\t<SpecifiedAddressLocation/>\n" +
"\t\t\t</PostalStructuredAddress>\n" +
"\t\t\t<SpecifiedCargoAgentLocation/>\n" +
"\t\t\t<DefinedTradeContact/>\n" +
"\t\t</AssociatedParty>\n" +
"\t\t<OriginLocation>\n" +
"\t\t\t<ID>CGO</ID>\n" +
"\t\t</OriginLocation>\n" +
"\t\t<FinalDestinationLocation>\n" +
"\t\t\t<ID>HAK</ID>\n" +
"\t\t</FinalDestinationLocation>\n" +
"\t\t<SpecifiedLogisticsTransportMovement>\n" +
"\t\t\t<StageCode>HU7304/Nov14</StageCode>\n" +
"\t\t\t<ModeCode>4</ModeCode>\n" +
"\t\t\t<Mode>Air Transport</Mode>\n" +
"\t\t\t<ID>HU7304</ID>\n" +
"\t\t\t<SequenceNumeric>1</SequenceNumeric>\n" +
"\t\t\t<UsedLogisticsTransportMeans/>\n" +
"\t\t\t<ArrivalEvent>\n" +
"\t\t\t\t<OccurrenceArrivalLocation>\n" +
"\t\t\t\t\t<ID>HAK</ID>\n" +
"\t\t\t\t</OccurrenceArrivalLocation>\n" +
"\t\t\t</ArrivalEvent>\n" +
"\t\t\t<DepartureEvent>\n" +
"\t\t\t\t<ScheduledOccurrenceDateTime>2018-11-14T00:00:00+08:00</ScheduledOccurrenceDateTime>\n" +
"\t\t\t\t<OccurrenceDepartureLocation>\n" +
"\t\t\t\t\t<ID>CGO</ID>\n" +
"\t\t\t\t</OccurrenceDepartureLocation>\n" +
"\t\t\t</DepartureEvent>\n" +
"\t\t</SpecifiedLogisticsTransportMovement>\n" +
"\t\t<IncludedAccountingNote>\n" +
"\t\t\t<ContentCode>20010003普通</ContentCode>\n" +
"\t\t\t<Content>20010003普通</Content>\n" +
"\t\t</IncludedAccountingNote>\n" +
"\t\t<AssociatedConsignmentCustomsProcedure/>\n" +
"\t\t<ApplicableTradeCurrencyExchange>\n" +
"\t\t\t<SourceCurrencyCode>CNY</SourceCurrencyCode>\n" +
"\t\t\t<TargetCurrencyCode>CNY</TargetCurrencyCode>\n" +
"\t\t\t<MarketID>S</MarketID>\n" +
"\t\t\t<ConversionRate>1</ConversionRate>\n" +
"\t\t</ApplicableTradeCurrencyExchange>\n" +
"\t\t<ApplicableLogisticsServiceCharge/>\n" +
"\t\t<ApplicableLogisticsAllowanceCharge>\n" +
"\t\t\t<ID>MY</ID>\n" +
"\t\t\t<Reason>燃油费</Reason>\n" +
"\t\t\t<ActualAmount currencyID=\"CNY\">111.6</ActualAmount>\n" +
"\t\t\t<PartyTypeCode>C</PartyTypeCode>\n" +
"\t\t</ApplicableLogisticsAllowanceCharge>\n" +
"\t\t<SignatoryCarrierAuthentication>\n" +
"\t\t\t<ActualDateTime>2018-11-14T04:02:00</ActualDateTime>\n" +
"\t\t\t<Signatory>牛青</Signatory>\n" +
"\t\t\t<IssueAuthenticationLocation>\n" +
"\t\t\t\t<Name>郑州</Name>\n" +
"\t\t\t</IssueAuthenticationLocation>\n" +
"\t\t</SignatoryCarrierAuthentication>\n" +
"\t\t<IncludedMasterConsignmentItem>\n" +
"\t\t\t<SequenceNumeric>1</SequenceNumeric>\n" +
"\t\t\t<TypeCode listAgencyID=\"1\">PH</TypeCode>\n" +
"\t\t\t<GrossWeightMeasure unitCode=\"KGM\">558.0</GrossWeightMeasure>\n" +
"\t\t\t<GrossVolumeMeasure unitCode=\"MTQ\">4.44</GrossVolumeMeasure>\n" +
"\t\t\t<PieceQuantity>74</PieceQuantity>\n" +
"\t\t\t<TareWeightMeasure unitCode=\"KGM\">558.0</TareWeightMeasure>\n" +
"\t\t\t<NatureIdentificationTransportCargo>\n" +
"\t\t\t\t<Identification>手机机头(无电池) 电子主板 上衣 茶叶 大枣 皮带 票证 运动鞋 背包 灯座</Identification>\n" +
"\t\t\t</NatureIdentificationTransportCargo>\n" +
"\t\t\t<OriginCountry/>\n" +
"\t\t\t<AssociatedUnitLoadTransportEquipment>\n" +
"\t\t\t\t<OperatingParty/>\n" +
"\t\t\t</AssociatedUnitLoadTransportEquipment>\n" +
"\t\t\t<TransportLogisticsPackage>\n" +
"\t\t\t\t<ItemQuantity>74</ItemQuantity>\n" +
"\t\t\t\t<LinearSpatialDimension>\n" +
"\t\t\t\t\t<Description>true</Description>\n" +
"\t\t\t\t\t<WidthMeasure unitCode=\"CMT\">40</WidthMeasure>\n" +
"\t\t\t\t\t<LengthMeasure unitCode=\"CMT\">30</LengthMeasure>\n" +
"\t\t\t\t\t<HeightMeasure unitCode=\"CMT\">50</HeightMeasure>\n" +
"\t\t\t\t</LinearSpatialDimension>\n" +
"\t\t\t</TransportLogisticsPackage>\n" +
"\t\t\t<ApplicableFreightRateServiceCharge>\n" +
"\t\t\t\t<CategoryCode>Q</CategoryCode>\n" +
"\t\t\t\t<CommodityItemID>P</CommodityItemID>\n" +
"\t\t\t\t<ChargeableWeightMeasure unitCode=\"KGM\">558.0</ChargeableWeightMeasure>\n" +
"\t\t\t\t<AppliedRate>0.9</AppliedRate>\n" +
"\t\t\t\t<AppliedAmount currencyID=\"CNY\">502</AppliedAmount>\n" +
"\t\t\t</ApplicableFreightRateServiceCharge>\n" +
"\t\t\t<SpecifiedRateCombinationPointLocation/>\n" +
"\t\t</IncludedMasterConsignmentItem>\n" +
"\t\t<ReportedStatus>\n" +
"\t\t\t<ReasonCode>FWB</ReasonCode>\n" +
"\t\t\t<EventTime>\n" +
"\t\t\t\t<OccurrenceDateTime>2018-11-14T04:03:02+08:00</OccurrenceDateTime>\n" +
"\t\t\t\t<DateTimeTypeCode>Actual</DateTimeTypeCode>\n" +
"\t\t\t</EventTime>\n" +
"\t\t\t<SpecifiedLocation>\n" +
"\t<ConsignmentStatus>\n" +
"\t\t<MasterConsignment>\n" +
"\t\t\t<GrossWeightMeasure unitCode=\"KGM\">3877</GrossWeightMeasure>\n" +
"\t\t\t<TotalGrossWeightMeasure unitCode=\"KGM\">3877</TotalGrossWeightMeasure>\n" +
"\t\t\t<ChargeableWeightMeasure unitCode=\"KGM\">4308.69</ChargeableWeightMeasure>\n" +
"\t\t\t<PieceQuantity>12</PieceQuantity>\n" +
"\t\t\t<TotalPieceQuantity>12</TotalPieceQuantity>\n" +
"\t\t\t<TransportSplitDescription>T</TransportSplitDescription>\n" +
"\t\t\t<TransportContractDocument>\n" +
"\t\t\t\t<ID>172-32971562</ID>\n" +
"\t\t\t\t<Name>Air Waybill</Name>\n" +
"\t\t\t\t<TypeCode>741</TypeCode>\n" +
"\t\t\t</TransportContractDocument>\n" +
"\t\t\t<OriginLocation>\n" +
"\t\t\t\t<ID>CGO</ID>\n" +
"\t\t\t</SpecifiedLocation>\n" +
"\t\t</ReportedStatus>\n" +
"\t</MasterConsignment>\n" +
"\t\t\t\t<Name>ZHENGZHOU</Name>\n" +
"\t\t\t</OriginLocation>\n" +
"\t\t\t<FinalDestinationLocation>\n" +
"\t\t\t\t<ID>ORD</ID>\n" +
"\t\t\t\t<Name>Chicago</Name>\n" +
"\t\t\t</FinalDestinationLocation>\n" +
"\t\t\t<ReportedStatus>\n" +
"\t\t\t\t<ReasonCode>FOH</ReasonCode>\n" +
"\t\t\t\t<EventTime>\n" +
"\t\t\t\t\t<OccurrenceDateTime>2018-12-09T17:48:10+08:00</OccurrenceDateTime>\n" +
"\t\t\t\t\t<DateTimeTypeCode>Actual</DateTimeTypeCode>\n" +
"\t\t\t\t</EventTime>\n" +
"\t\t\t\t<SpecifiedLocation>\n" +
"\t\t\t\t\t<ID>CGO</ID>\n" +
"\t\t\t\t\t<Name/>\n" +
"\t\t\t\t\t<TypeCode>Airport</TypeCode>\n" +
"\t\t\t\t</SpecifiedLocation>\n" +
"\t\t\t\t<AssociatedStatusConsignment>\n" +
"\t\t\t\t\t<GrossWeightMeasure unitCode=\"KGM\">3877</GrossWeightMeasure>\n" +
"\t\t\t\t\t<GrossVolumeMeasure unitCode=\"MTQ\">25.85</GrossVolumeMeasure>\n" +
"\t\t\t\t\t<ChargeableWeightMeasure unitCode=\"KGM\">4308.69</ChargeableWeightMeasure>\n" +
"\t\t\t\t\t<DensityGroupCode>MC</DensityGroupCode>\n" +
"\t\t\t\t\t<PieceQuantity>12</PieceQuantity>\n" +
"\t\t\t\t\t<TransportSplitDescription>T</TransportSplitDescription>\n" +
"\t\t\t\t\t<SpecifiedLogisticsTransportMovement>\n" +
"\t\t\t\t\t\t<ID>CV9761</ID>\n" +
"\t\t\t\t\t\t<UsedLogisticsTransportMeans>\n" +
"\t\t\t\t\t\t\t<Name>B747E</Name>\n" +
"\t\t\t\t\t\t\t<Type>XXX</Type>\n" +
"\t\t\t\t\t\t</UsedLogisticsTransportMeans>\n" +
"\t\t\t\t\t\t<ArrivalEvent>\n" +
"\t\t\t\t\t\t\t<ArrivalOccurrenceDateTime>2018-12-11T12:30:00+08:00</ArrivalOccurrenceDateTime>\n" +
"\t\t\t\t\t\t\t<ArrivalDateTimeTypeCode>Schedual</ArrivalDateTimeTypeCode>\n" +
"\t\t\t\t\t\t\t<OccurrenceArrivalLocation>\n" +
"\t\t\t\t\t\t\t\t<ID/>\n" +
"\t\t\t\t\t\t\t\t<Name/>\n" +
"\t\t\t\t\t\t\t\t<TypeCode>Airport</TypeCode>\n" +
"\t\t\t\t\t\t\t\t<FirstArrivalCountryID/>\n" +
"\t\t\t\t\t\t\t</OccurrenceArrivalLocation>\n" +
"\t\t\t\t\t\t</ArrivalEvent>\n" +
"\t\t\t\t\t\t<DepartureEvent>\n" +
"\t\t\t\t\t\t\t<DepartureOccurrenceDateTime>2018-12-11T04:30:00+08:00</DepartureOccurrenceDateTime>\n" +
"\t\t\t\t\t\t\t<DepartureDateTimeTypeCode>Schedual</DepartureDateTimeTypeCode>\n" +
"\t\t\t\t\t\t\t<OccurrenceDepartureLocation>\n" +
"\t\t\t\t\t\t\t\t<ID>CGO</ID>\n" +
"\t\t\t\t\t\t\t\t<Name>ZHENGZHOU</Name>\n" +
"\t\t\t\t\t\t\t\t<TypeCode>Airport</TypeCode>\n" +
"\t\t\t\t\t\t\t\t<FirstArrivalCountryID>CN</FirstArrivalCountryID>\n" +
"\t\t\t\t\t\t\t</OccurrenceDepartureLocation>\n" +
"\t\t\t\t\t\t</DepartureEvent>\n" +
"\t\t\t\t\t\t<CarrierParty>\n" +
"\t\t\t\t\t\t\t<PrimaryID schemeAgencyID=\"3\">CV</PrimaryID>\n" +
"\t\t\t\t\t\t</CarrierParty>\n" +
"\t\t\t\t\t\t<SpecifiedLocation>\n" +
"\t\t\t\t\t\t\t<ID>CGO</ID>\n" +
"\t\t\t\t\t\t\t<Name>ZHENGZHOU</Name>\n" +
"\t\t\t\t\t\t\t<TypeCode>Airport</TypeCode>\n" +
"\t\t\t\t\t\t</SpecifiedLocation>\n" +
"\t\t\t\t\t\t<SpecifiedEvent>\n" +
"\t\t\t\t\t\t\t<OccurrenceDateTime>2018-12-09T17:48:10+08:00</OccurrenceDateTime>\n" +
"\t\t\t\t\t\t\t<DateTimeTypeCode>Actual</DateTimeTypeCode>\n" +
"\t\t\t\t\t\t</SpecifiedEvent>\n" +
"\t\t\t\t\t</SpecifiedLogisticsTransportMovement>\n" +
"\t\t\t\t\t<StorageLocations>\n" +
"\t\t\t\t\t\t<LocationInfomation>\n" +
"\t\t\t\t\t\t\t<Location>KQ/KQ</Location>\n" +
"\t\t\t\t\t\t\t<PieceQuantity>12</PieceQuantity>\n" +
"\t\t\t\t\t\t\t<GrossWeightMeasure unitCode=\"KGM\">3877</GrossWeightMeasure>\n" +
"\t\t\t\t\t\t</LocationInfomation>\n" +
"\t\t\t\t\t</StorageLocations>\n" +
"\t\t\t\t\t<RecievedFromParty>\n" +
"\t\t\t\t\t\t<Name>DSV AIR SEA CO LTD 1</Name>\n" +
"\t\t\t\t\t\t<PostalStructuredAddress>\n" +
"\t\t\t\t\t\t\t<StreetName/>\n" +
"\t\t\t\t\t\t</PostalStructuredAddress>\n" +
"\t\t\t\t\t\t<DefinedTradeContact>\n" +
"\t\t\t\t\t\t\t<DirectTelephoneCommunication>\n" +
"\t\t\t\t\t\t\t\t<CompleteNumber/>\n" +
"\t\t\t\t\t\t\t</DirectTelephoneCommunication>\n" +
"\t\t\t\t\t\t</DefinedTradeContact>\n" +
"\t\t\t\t\t</RecievedFromParty>\n" +
"\t\t\t\t\t<IncludedMasterConsignmentItem>\n" +
"\t\t\t\t\t\t<TypeCode listAgencyID=\"1\">CONSOL</TypeCode>\n" +
"\t\t\t\t\t</IncludedMasterConsignmentItem>\n" +
"\t\t\t\t\t<IncludedCustomsNote>\n" +
"\t\t\t\t\t\t<ContentCode>CD</ContentCode>\n" +
"\t\t\t\t\t\t<Content>P-CGOXH-ICUSTOMS0000</Content>\n" +
"\t\t\t\t\t\t<SubjectCode/>\n" +
"\t\t\t\t\t\t<CountryID/>\n" +
"\t\t\t\t\t\t<UtilizedUnitLoadTransportEquipment/>\n" +
"\t\t\t\t\t</IncludedCustomsNote>\n" +
"\t\t\t\t</AssociatedStatusConsignment>\n" +
"\t\t\t</ReportedStatus>\n" +
"\t\t</MasterConsignment>\n" +
"\t</ConsignmentStatus>\n" +
"</MSG>";
Document doc = DocumentHelper.parseText(xml);
// String currencyID = XMLXPath.getSinglePathProperty(doc,"//MSG/MasterConsignment/DeclaredValueForCarriageAmount/@currencyID");
String measure = XMLXPath.getSingleValueByPath(doc,"//MSG/ConsignmentStatus/MasterConsignment/GrossWeightMeasure/@unitCode");
String measure1 = XMLXPath.getSingleValueByPath(doc,"//MSG/ConsignmentStatus/MasterConsignment/GrossWeightMeasure");
long beginTime = System.currentTimeMillis();
try{
XML2ENTITY xml2ENTITY = new XML2ENTITY();
Map<String, Object> map = xml2ENTITY.Dom2Map(doc);
Map<String, Object> map = xml2ENTITY.Dom2Map_propety(doc);
T_TXD_FWB fwb= new T_TXD_FWB();
//fwb.setFid(getBigDecimal(1));
fwb.setMessageBakId(getBigDecimal(1));
... ...