作者 朱兆平

分单运抵入库

package com.example.demo.handle;
import com.example.demo.handle.nms.FSU_FOH_Handle;
import com.example.demo.handle.nms.FZE_FOH_Handle;
import com.example.demo.model.IMF_META;
import com.example.demo.util.IO.FileTool;
import com.example.demo.util.XML.XML2ENTITY;
... ... @@ -42,6 +43,8 @@ public class IMF_Message_MainHandle {
FSU_FOH_Handle.handle(doc);
break;
case "EFOH":
FZE_FOH_Handle fze_foh_handle = new FZE_FOH_Handle();
fze_foh_handle.handle(doc);
break;
case "UDEP":
break;
... ...
... ... @@ -90,7 +90,7 @@ public class FSU_FOH_Handle {
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)) {
if (flight!=null && !flight.isEmpty()) {
String carrier_no = flight.substring(0, 2);
String flight_no = flight.substring(2);
fsu_foh.setFlightno(flight_no);
... ... @@ -131,7 +131,7 @@ public class FSU_FOH_Handle {
int resoult = fsu_foh_handle.fohService.insert(fsu_foh);
FileTool.writeWaybill("FSU_FOH",document.asXML(),waybillNo);
FileTool.writeWaybill(stype,document.asXML(),waybillNo);
}catch (Exception e){
... ...
package com.example.demo.handle.nms;
import com.example.demo.model.NMS_FZE_FOH;
import com.example.demo.service.NMS_FZE_FOH_Service;
import com.example.demo.util.Helper;
import com.example.demo.util.IO.FileTool;
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;
@Component
public class FZE_FOH_Handle {
@Autowired
protected NMS_FZE_FOH_Service fzeService;
private static FZE_FOH_Handle fze_foh_handle;
private final static String stype = "FZE_FOH";
public final static String SNDR = "//MSG/META/SNDR";
public final static String RCVR = "//MSG/META/RCVR";
public final static String DDTM = "//MSG/META/DDTM";
public final static String TYPE = "//MSG/META/TYPE";
public final static String STYP = "//MSG/META/STYP";
public final static String SEQN = "//MSG/META/SEQN";
public final static String TID = "//MSG/ConsignmentStatus/MasterConsignment/TransportContractDocument/ID";
public final static String TName = "//MSG/ConsignmentStatus/MasterConsignment/TransportContractDocument/Name";
public final static String TTypeCode = "//MSG/ConsignmentStatus/MasterConsignment/TransportContractDocument/TypeCode";
public final static String OID = "//MSG/ConsignmentStatus/MasterConsignment/OriginLocation/ID";
public final static String OName = "//MSG/ConsignmentStatus/MasterConsignment/OriginLocation/Name";
public final static String FID = "//MSG/ConsignmentStatus/MasterConsignment/FinalDestinationLocation/ID";
public final static String FName = "//MSG/ConsignmentStatus/MasterConsignment/FinalDestinationLocation/Name";
public final static String GrossWeightMeasure = "//MSG/ConsignmentStatus/MasterConsignment/ReportedStatus/AssociatedStatusConsignment/GrossWeightMeasure";
public final static String GrossWeightMeasureUc = "//MSG/ConsignmentStatus/MasterConsignment/ReportedStatus/AssociatedStatusConsignment/GrossWeightMeasure/@unitCode";
public final static String TotalGrossWeightMeasureUc = "//MSG/ConsignmentStatus/MasterConsignment/ReportedStatus/AssociatedStatusConsignment/IncludedCustomsNote/IncludedHouseConsignment/TotalGrossWeightMeasure/@unitCode";
public final static String TotalGrossWeightMeasure = "//MSG/ConsignmentStatus/MasterConsignment/ReportedStatus/AssociatedStatusConsignment/IncludedCustomsNote/IncludedHouseConsignment/TotalGrossWeightMeasure";
public final static String PieceQuantity = "//MSG/ConsignmentStatus/MasterConsignment/ReportedStatus/AssociatedStatusConsignment/PieceQuantity";
public final static String SLTM_IDxml = "//MSG/ConsignmentStatus/MasterConsignment/ReportedStatus/AssociatedStatusConsignment/SpecifiedLogisticsTransportMovement/ID";
public final static String OccurrenceDateTimexml = "//MSG/ConsignmentStatus/MasterConsignment/ReportedStatus/AssociatedStatusConsignment/SpecifiedLogisticsTransportMovement/DepartureEvent/DepartureOccurrenceDateTime";
public final static String IMCT_TypeCodexml = "//MSG/ConsignmentStatus/MasterConsignment/ReportedStatus/AssociatedStatusConsignment/IncludedMasterConsignmentItem/TypeCode";
public final static String TCDIDxml = "//MSG/ConsignmentStatus/MasterConsignment/ReportedStatus/AssociatedStatusConsignment/IncludedCustomsNote/IncludedHouseConsignment/TransportContractDocument/ID";
public final static String SLTM_DepartureOccurrenceDateTimexml = "//MSG/ConsignmentStatus/MasterConsignment/ReportedStatus/EventTime/OccurrenceDateTime";
public final static String Location = "//MSG/ConsignmentStatus/MasterConsignment/ReportedStatus/AssociatedStatusConsignment/IncludedCustomsNote/Content";
@PostConstruct
public void init(){
fze_foh_handle = this;
fze_foh_handle.fzeService = this.fzeService;
}
public void handle(Document document) throws Exception{
try{
String autoId = Helper.getUUID();
NMS_FZE_FOH fzeFoh = new NMS_FZE_FOH();
fzeFoh.setAutoid(autoId);
fzeFoh.setoId(XMLXPath.getSingleValueByPath(document,OID));
fzeFoh.setoName(XMLXPath.getSingleValueByPath(document,OName));
fzeFoh.setFdId(XMLXPath.getSingleValueByPath(document,FID));
fzeFoh.setFdName(XMLXPath.getSingleValueByPath(document,FName));
String waybillMasterNo = XMLXPath.getSingleValueByPath(document,TID);
fzeFoh.setWaybillnomaster(waybillMasterNo);
if ("406-92658204".equals(waybillMasterNo)){//TXD1542736608590 消息ID
System.out.print(waybillMasterNo);
}
String waybillSecondNo = XMLXPath.getSingleValueByPath(document,TCDIDxml);
fzeFoh.setWaybillnosecondary(waybillSecondNo);
if ("WE6718TW8CK".equals(waybillSecondNo)){
System.out.print(waybillSecondNo);
}
fzeFoh.setTcdName(XMLXPath.getSingleValueByPath(document,TName));
fzeFoh.setTcdTypecode(XMLXPath.getSingleValueByPath(document,TTypeCode));
String flight = XMLXPath.getSingleValueByPath(document,SLTM_IDxml);
String flightNo = "";
String carrier = "";
if(flight!=null && !flight.isEmpty()){
String carrier_no = flight.substring(0, 2);
String flight_no = flight.substring(2);
fzeFoh.setFlightno(flight_no);
fzeFoh.setCarrier(carrier_no);
}
String flightDateStr = XMLXPath.getSingleValueByPath(document,OccurrenceDateTimexml);
ZonedDateTime depZoneTime = ZonedDateTime.parse(flightDateStr);
Date flightDate = Date.from(depZoneTime.toInstant()); //这个是入库航班日期格式
fzeFoh.setFlightdate(flightDate);
fzeFoh.setArrivedtotalpiece(XMLXPath.getSingleValueByPath(document,PieceQuantity));
fzeFoh.setTotalpiecequantity(XMLXPath.getSingleValueByPath(document,PieceQuantity));
fzeFoh.setArrivedtotalweight(XMLXPath.getSingleValueByPath(document,GrossWeightMeasure));
fzeFoh.setGrossweightmeasureuc(XMLXPath.getSingleValueByPath(document,GrossWeightMeasureUc));
fzeFoh.setTotalgrossweightmeasure(XMLXPath.getSingleValueByPath(document,TotalGrossWeightMeasure));
fzeFoh.setTotalgrossweightmeasureuc(XMLXPath.getSingleValueByPath(document,TotalGrossWeightMeasureUc));
fzeFoh.setChargeableweightmeasure(XMLXPath.getSingleValueByPath(document,GrossWeightMeasure));
fzeFoh.setChargeableweightmeasureuc("");
String OccurrenceDateTime = XMLXPath.getSingleValueByPath(document,SLTM_DepartureOccurrenceDateTimexml);
ZonedDateTime arrZoneTime = ZonedDateTime.parse(OccurrenceDateTime);
Date arriv_time = Date.from(arrZoneTime.toInstant()); //这个是入库航班日期格式
fzeFoh.setArriveddate(arriv_time);
String customCode = "4604";
String location = XMLXPath.getSingleValueByPath(document,Location);
if (location.contains("ZBQ")){
customCode = "4620";
}
fzeFoh.setCustomscode(customCode);
fzeFoh.setProductname(XMLXPath.getSingleValueByPath(document,IMCT_TypeCodexml));
fzeFoh.setCreatedate(new Date());
fzeFoh.setArrivedmasterid("");
fzeFoh.setTransportsplitdescription("");
fzeFoh.setStatus("01");
fzeFoh.setReceiption("");
int i = fze_foh_handle.fzeService.insert(fzeFoh);
FileTool.writeWaybill(stype,document.asXML(),waybillMasterNo+"_"+waybillSecondNo);
}catch (Exception e){
e.printStackTrace();
FileTool.writeFile(stype,e.toString()+"\n"+document.asXML(),false);
}
}
}
... ...
package com.example.demo.mapper;
import com.example.demo.model.NMS_FZE_FOH;
import java.util.List;
public interface NMS_FZE_FOHMapper {
int insert(NMS_FZE_FOH record);
int insertSelective(NMS_FZE_FOH record);
List<NMS_FZE_FOH> selecSecondWaybillList(NMS_FZE_FOH record);
int updateByPrimaryKey(NMS_FZE_FOH record);
}
\ No newline at end of file
... ...
package com.example.demo.model;
import java.util.Date;
public class NMS_FZE_FOH {
private String autoid;
private String waybillnomaster;
private String tcdName;
private String tcdTypecode;
private String waybillnosecondary;
private String carrier;
private String oId;
private String oName;
private String fdId;
private String fdName;
private String flightno;
private Date flightdate;
private String arrivedtotalpiece;
private String totalpiecequantity;
private String arrivedtotalweight;
private String grossweightmeasureuc;
private String totalgrossweightmeasure;
private String totalgrossweightmeasureuc;
private String chargeableweightmeasure;
private String chargeableweightmeasureuc;
private Date arriveddate;
private String customscode;
private String productname;
private Date createdate;
private String arrivedmasterid;
private String transportsplitdescription;
private String receiption;
private String status;
public String getAutoid() {
return autoid;
}
public void setAutoid(String autoid) {
this.autoid = autoid == null ? null : autoid.trim();
}
public String getWaybillnomaster() {
return waybillnomaster;
}
public void setWaybillnomaster(String waybillnomaster) {
this.waybillnomaster = waybillnomaster == null ? null : waybillnomaster.trim();
}
public String getTcdName() {
return tcdName;
}
public void setTcdName(String tcdName) {
this.tcdName = tcdName == null ? null : tcdName.trim();
}
public String getTcdTypecode() {
return tcdTypecode;
}
public void setTcdTypecode(String tcdTypecode) {
this.tcdTypecode = tcdTypecode == null ? null : tcdTypecode.trim();
}
public String getWaybillnosecondary() {
return waybillnosecondary;
}
public void setWaybillnosecondary(String waybillnosecondary) {
this.waybillnosecondary = waybillnosecondary == null ? null : waybillnosecondary.trim();
}
public String getCarrier() {
return carrier;
}
public void setCarrier(String carrier) {
this.carrier = carrier == null ? null : carrier.trim();
}
public String getoId() {
return oId;
}
public void setoId(String oId) {
this.oId = oId == null ? null : oId.trim();
}
public String getoName() {
return oName;
}
public void setoName(String oName) {
this.oName = oName == null ? null : oName.trim();
}
public String getFdId() {
return fdId;
}
public void setFdId(String fdId) {
this.fdId = fdId == null ? null : fdId.trim();
}
public String getFdName() {
return fdName;
}
public void setFdName(String fdName) {
this.fdName = fdName == null ? null : fdName.trim();
}
public String getFlightno() {
return flightno;
}
public void setFlightno(String flightno) {
this.flightno = flightno == null ? null : flightno.trim();
}
public Date getFlightdate() {
return flightdate;
}
public void setFlightdate(Date flightdate) {
this.flightdate = flightdate;
}
public String getArrivedtotalpiece() {
return arrivedtotalpiece;
}
public void setArrivedtotalpiece(String arrivedtotalpiece) {
this.arrivedtotalpiece = arrivedtotalpiece == null ? null : arrivedtotalpiece.trim();
}
public String getTotalpiecequantity() {
return totalpiecequantity;
}
public void setTotalpiecequantity(String totalpiecequantity) {
this.totalpiecequantity = totalpiecequantity == null ? null : totalpiecequantity.trim();
}
public String getArrivedtotalweight() {
return arrivedtotalweight;
}
public void setArrivedtotalweight(String arrivedtotalweight) {
this.arrivedtotalweight = arrivedtotalweight == null ? null : arrivedtotalweight.trim();
}
public String getGrossweightmeasureuc() {
return grossweightmeasureuc;
}
public void setGrossweightmeasureuc(String grossweightmeasureuc) {
this.grossweightmeasureuc = grossweightmeasureuc == null ? null : grossweightmeasureuc.trim();
}
public String getTotalgrossweightmeasure() {
return totalgrossweightmeasure;
}
public void setTotalgrossweightmeasure(String totalgrossweightmeasure) {
this.totalgrossweightmeasure = totalgrossweightmeasure == null ? null : totalgrossweightmeasure.trim();
}
public String getTotalgrossweightmeasureuc() {
return totalgrossweightmeasureuc;
}
public void setTotalgrossweightmeasureuc(String totalgrossweightmeasureuc) {
this.totalgrossweightmeasureuc = totalgrossweightmeasureuc == null ? null : totalgrossweightmeasureuc.trim();
}
public String getChargeableweightmeasure() {
return chargeableweightmeasure;
}
public void setChargeableweightmeasure(String chargeableweightmeasure) {
this.chargeableweightmeasure = chargeableweightmeasure == null ? null : chargeableweightmeasure.trim();
}
public String getChargeableweightmeasureuc() {
return chargeableweightmeasureuc;
}
public void setChargeableweightmeasureuc(String chargeableweightmeasureuc) {
this.chargeableweightmeasureuc = chargeableweightmeasureuc == null ? null : chargeableweightmeasureuc.trim();
}
public Date getArriveddate() {
return arriveddate;
}
public void setArriveddate(Date arriveddate) {
this.arriveddate = arriveddate;
}
public String getCustomscode() {
return customscode;
}
public void setCustomscode(String customscode) {
this.customscode = customscode == null ? null : customscode.trim();
}
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname == null ? null : productname.trim();
}
public Date getCreatedate() {
return createdate;
}
public void setCreatedate(Date createdate) {
this.createdate = createdate;
}
public String getArrivedmasterid() {
return arrivedmasterid;
}
public void setArrivedmasterid(String arrivedmasterid) {
this.arrivedmasterid = arrivedmasterid == null ? null : arrivedmasterid.trim();
}
public String getTransportsplitdescription() {
return transportsplitdescription;
}
public void setTransportsplitdescription(String transportsplitdescription) {
this.transportsplitdescription = transportsplitdescription == null ? null : transportsplitdescription.trim();
}
public String getReceiption() {
return receiption;
}
public void setReceiption(String receiption) {
this.receiption = receiption == null ? null : receiption.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
}
\ No newline at end of file
... ...
package com.example.demo.service;
import com.example.demo.model.NMS_FZE_FOH;
import java.util.List;
public interface NMS_FZE_FOH_Service {
int insert(NMS_FZE_FOH record);
int insertSelective(NMS_FZE_FOH record);
List<NMS_FZE_FOH> selecSecondWaybillList(NMS_FZE_FOH record);
int updateByPrimaryKey(NMS_FZE_FOH record);
}
... ...
package com.example.demo.service.imp;
import com.example.demo.mapper.NMS_FZE_FOHMapper;
import com.example.demo.model.NMS_FZE_FOH;
import com.example.demo.service.NMS_FZE_FOH_Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("fzefohservice")
public class NMS_FZE_FOH_ServiceImp implements NMS_FZE_FOH_Service{
@Autowired
NMS_FZE_FOHMapper fzeFohMapper;
public int insert(NMS_FZE_FOH record){
int i=0;
List<NMS_FZE_FOH> masterList = selecSecondWaybillList(record);
if(masterList!=null && masterList.size()>0){
for (NMS_FZE_FOH master:masterList) {
updateByPrimaryKey(master);
}
}else {
i= fzeFohMapper.insert(record);
}
return i;
}
public int insertSelective(NMS_FZE_FOH record){
return fzeFohMapper.insertSelective(record);
}
public List<NMS_FZE_FOH> selecSecondWaybillList(NMS_FZE_FOH record){
return fzeFohMapper.selecSecondWaybillList(record);
}
public int updateByPrimaryKey(NMS_FZE_FOH record){
return fzeFohMapper.updateByPrimaryKey(record);
}
}
... ...
... ... @@ -42,6 +42,6 @@
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<table tableName="ARRIVEDMASTER" domainObjectName="NMS_FSU_FOH" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="ARRIVEDSECONDARY" domainObjectName="NMS_FZE_FOH" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
</context>
</generatorConfiguration>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.example.demo.mapper.NMS_FZE_FOHMapper" >
<resultMap id="BaseResultMap" type="com.example.demo.model.NMS_FZE_FOH" >
<result column="AUTOID" property="autoid" jdbcType="VARCHAR" />
<result column="WAYBILLNOMASTER" property="waybillnomaster" jdbcType="VARCHAR" />
<result column="TCD_NAME" property="tcdName" jdbcType="VARCHAR" />
<result column="TCD_TYPECODE" property="tcdTypecode" jdbcType="VARCHAR" />
<result column="WAYBILLNOSECONDARY" property="waybillnosecondary" jdbcType="VARCHAR" />
<result column="CARRIER" property="carrier" jdbcType="VARCHAR" />
<result column="O_ID" property="oId" jdbcType="VARCHAR" />
<result column="O_NAME" property="oName" jdbcType="VARCHAR" />
<result column="FD_ID" property="fdId" jdbcType="VARCHAR" />
<result column="FD_NAME" property="fdName" jdbcType="VARCHAR" />
<result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" />
<result column="FLIGHTDATE" property="flightdate" jdbcType="TIMESTAMP" />
<result column="ARRIVEDTOTALPIECE" property="arrivedtotalpiece" jdbcType="VARCHAR" />
<result column="TOTALPIECEQUANTITY" property="totalpiecequantity" jdbcType="VARCHAR" />
<result column="ARRIVEDTOTALWEIGHT" property="arrivedtotalweight" jdbcType="VARCHAR" />
<result column="GROSSWEIGHTMEASUREUC" property="grossweightmeasureuc" jdbcType="VARCHAR" />
<result column="TOTALGROSSWEIGHTMEASURE" property="totalgrossweightmeasure" jdbcType="VARCHAR" />
<result column="TOTALGROSSWEIGHTMEASUREUC" property="totalgrossweightmeasureuc" jdbcType="VARCHAR" />
<result column="CHARGEABLEWEIGHTMEASURE" property="chargeableweightmeasure" jdbcType="VARCHAR" />
<result column="CHARGEABLEWEIGHTMEASUREUC" property="chargeableweightmeasureuc" jdbcType="VARCHAR" />
<result column="ARRIVEDDATE" property="arriveddate" jdbcType="TIMESTAMP" />
<result column="CUSTOMSCODE" property="customscode" jdbcType="VARCHAR" />
<result column="PRODUCTNAME" property="productname" jdbcType="VARCHAR" />
<result column="CREATEDATE" property="createdate" jdbcType="TIMESTAMP" />
<result column="ARRIVEDMASTERID" property="arrivedmasterid" jdbcType="VARCHAR" />
<result column="TRANSPORTSPLITDESCRIPTION" property="transportsplitdescription" jdbcType="VARCHAR" />
<result column="RECEIPTION" property="receiption" jdbcType="VARCHAR" />
<result column="STATUS" property="status" jdbcType="VARCHAR" />
</resultMap>
<insert id="insert" parameterType="com.example.demo.model.NMS_FZE_FOH" >
insert into ARRIVEDSECONDARY (AUTOID, WAYBILLNOMASTER, TCD_NAME,
TCD_TYPECODE, WAYBILLNOSECONDARY, CARRIER,
O_ID, O_NAME, FD_ID, FD_NAME,
FLIGHTNO, FLIGHTDATE, ARRIVEDTOTALPIECE,
TOTALPIECEQUANTITY, ARRIVEDTOTALWEIGHT,
GROSSWEIGHTMEASUREUC, TOTALGROSSWEIGHTMEASURE,
TOTALGROSSWEIGHTMEASUREUC, CHARGEABLEWEIGHTMEASURE,
CHARGEABLEWEIGHTMEASUREUC, ARRIVEDDATE,
CUSTOMSCODE, PRODUCTNAME, CREATEDATE,
ARRIVEDMASTERID, TRANSPORTSPLITDESCRIPTION,
RECEIPTION, STATUS)
values (#{autoid,jdbcType=VARCHAR}, #{waybillnomaster,jdbcType=VARCHAR}, #{tcdName,jdbcType=VARCHAR},
#{tcdTypecode,jdbcType=VARCHAR}, #{waybillnosecondary,jdbcType=VARCHAR}, #{carrier,jdbcType=VARCHAR},
#{oId,jdbcType=VARCHAR}, #{oName,jdbcType=VARCHAR}, #{fdId,jdbcType=VARCHAR}, #{fdName,jdbcType=VARCHAR},
#{flightno,jdbcType=VARCHAR}, #{flightdate,jdbcType=TIMESTAMP}, #{arrivedtotalpiece,jdbcType=VARCHAR},
#{totalpiecequantity,jdbcType=VARCHAR}, #{arrivedtotalweight,jdbcType=VARCHAR},
#{grossweightmeasureuc,jdbcType=VARCHAR}, #{totalgrossweightmeasure,jdbcType=VARCHAR},
#{totalgrossweightmeasureuc,jdbcType=VARCHAR}, #{chargeableweightmeasure,jdbcType=VARCHAR},
#{chargeableweightmeasureuc,jdbcType=VARCHAR}, #{arriveddate,jdbcType=TIMESTAMP},
#{customscode,jdbcType=VARCHAR}, #{productname,jdbcType=VARCHAR}, #{createdate,jdbcType=TIMESTAMP},
#{arrivedmasterid,jdbcType=VARCHAR}, #{transportsplitdescription,jdbcType=VARCHAR},
#{receiption,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.example.demo.model.NMS_FZE_FOH" >
insert into ARRIVEDSECONDARY
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="autoid != null" >
AUTOID,
</if>
<if test="waybillnomaster != null" >
WAYBILLNOMASTER,
</if>
<if test="tcdName != null" >
TCD_NAME,
</if>
<if test="tcdTypecode != null" >
TCD_TYPECODE,
</if>
<if test="waybillnosecondary != null" >
WAYBILLNOSECONDARY,
</if>
<if test="carrier != null" >
CARRIER,
</if>
<if test="oId != null" >
O_ID,
</if>
<if test="oName != null" >
O_NAME,
</if>
<if test="fdId != null" >
FD_ID,
</if>
<if test="fdName != null" >
FD_NAME,
</if>
<if test="flightno != null" >
FLIGHTNO,
</if>
<if test="flightdate != null" >
FLIGHTDATE,
</if>
<if test="arrivedtotalpiece != null" >
ARRIVEDTOTALPIECE,
</if>
<if test="totalpiecequantity != null" >
TOTALPIECEQUANTITY,
</if>
<if test="arrivedtotalweight != null" >
ARRIVEDTOTALWEIGHT,
</if>
<if test="grossweightmeasureuc != null" >
GROSSWEIGHTMEASUREUC,
</if>
<if test="totalgrossweightmeasure != null" >
TOTALGROSSWEIGHTMEASURE,
</if>
<if test="totalgrossweightmeasureuc != null" >
TOTALGROSSWEIGHTMEASUREUC,
</if>
<if test="chargeableweightmeasure != null" >
CHARGEABLEWEIGHTMEASURE,
</if>
<if test="chargeableweightmeasureuc != null" >
CHARGEABLEWEIGHTMEASUREUC,
</if>
<if test="arriveddate != null" >
ARRIVEDDATE,
</if>
<if test="customscode != null" >
CUSTOMSCODE,
</if>
<if test="productname != null" >
PRODUCTNAME,
</if>
<if test="createdate != null" >
CREATEDATE,
</if>
<if test="arrivedmasterid != null" >
ARRIVEDMASTERID,
</if>
<if test="transportsplitdescription != null" >
TRANSPORTSPLITDESCRIPTION,
</if>
<if test="receiption != null" >
RECEIPTION,
</if>
<if test="status != null" >
STATUS,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="autoid != null" >
#{autoid,jdbcType=VARCHAR},
</if>
<if test="waybillnomaster != null" >
#{waybillnomaster,jdbcType=VARCHAR},
</if>
<if test="tcdName != null" >
#{tcdName,jdbcType=VARCHAR},
</if>
<if test="tcdTypecode != null" >
#{tcdTypecode,jdbcType=VARCHAR},
</if>
<if test="waybillnosecondary != null" >
#{waybillnosecondary,jdbcType=VARCHAR},
</if>
<if test="carrier != null" >
#{carrier,jdbcType=VARCHAR},
</if>
<if test="oId != null" >
#{oId,jdbcType=VARCHAR},
</if>
<if test="oName != null" >
#{oName,jdbcType=VARCHAR},
</if>
<if test="fdId != null" >
#{fdId,jdbcType=VARCHAR},
</if>
<if test="fdName != null" >
#{fdName,jdbcType=VARCHAR},
</if>
<if test="flightno != null" >
#{flightno,jdbcType=VARCHAR},
</if>
<if test="flightdate != null" >
#{flightdate,jdbcType=TIMESTAMP},
</if>
<if test="arrivedtotalpiece != null" >
#{arrivedtotalpiece,jdbcType=VARCHAR},
</if>
<if test="totalpiecequantity != null" >
#{totalpiecequantity,jdbcType=VARCHAR},
</if>
<if test="arrivedtotalweight != null" >
#{arrivedtotalweight,jdbcType=VARCHAR},
</if>
<if test="grossweightmeasureuc != null" >
#{grossweightmeasureuc,jdbcType=VARCHAR},
</if>
<if test="totalgrossweightmeasure != null" >
#{totalgrossweightmeasure,jdbcType=VARCHAR},
</if>
<if test="totalgrossweightmeasureuc != null" >
#{totalgrossweightmeasureuc,jdbcType=VARCHAR},
</if>
<if test="chargeableweightmeasure != null" >
#{chargeableweightmeasure,jdbcType=VARCHAR},
</if>
<if test="chargeableweightmeasureuc != null" >
#{chargeableweightmeasureuc,jdbcType=VARCHAR},
</if>
<if test="arriveddate != null" >
#{arriveddate,jdbcType=TIMESTAMP},
</if>
<if test="customscode != null" >
#{customscode,jdbcType=VARCHAR},
</if>
<if test="productname != null" >
#{productname,jdbcType=VARCHAR},
</if>
<if test="createdate != null" >
#{createdate,jdbcType=TIMESTAMP},
</if>
<if test="arrivedmasterid != null" >
#{arrivedmasterid,jdbcType=VARCHAR},
</if>
<if test="transportsplitdescription != null" >
#{transportsplitdescription,jdbcType=VARCHAR},
</if>
<if test="receiption != null" >
#{receiption,jdbcType=VARCHAR},
</if>
<if test="status != null" >
#{status,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="selecSecondWaybillList" resultMap="BaseResultMap" parameterType="com.example.demo.model.NMS_FZE_FOH" >-- resultType="com.example.demo.model.NMS_FSU_FOH"
SELECT
AUTOID,WAYBILLNOMASTER,WAYBILLNOSECONDARY
FROM
ARRIVEDSECONDARY
WHERE WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
AND WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR}
</select>
<update id="updateByPrimaryKey" parameterType="com.example.demo.model.NMS_FZE_FOH" >
update ARRIVEDSECONDARY
set
WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR},
TCD_NAME = #{tcdName,jdbcType=VARCHAR},
TCD_TYPECODE = #{tcdTypecode,jdbcType=VARCHAR},
WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR},
CARRIER = #{carrier,jdbcType=VARCHAR},
O_ID = #{oId,jdbcType=VARCHAR},
O_NAME = #{oName,jdbcType=VARCHAR},
FD_ID = #{fdId,jdbcType=VARCHAR},
FD_NAME = #{fdName,jdbcType=VARCHAR},
FLIGHTNO = #{flightno,jdbcType=VARCHAR},
FLIGHTDATE = #{flightdate,jdbcType=TIMESTAMP},
ARRIVEDTOTALPIECE = #{arrivedtotalpiece,jdbcType=VARCHAR},
TOTALPIECEQUANTITY = #{totalpiecequantity,jdbcType=VARCHAR},
ARRIVEDTOTALWEIGHT = #{arrivedtotalweight,jdbcType=VARCHAR},
GROSSWEIGHTMEASUREUC = #{grossweightmeasureuc,jdbcType=VARCHAR},
TOTALGROSSWEIGHTMEASURE = #{totalgrossweightmeasure,jdbcType=VARCHAR},
TOTALGROSSWEIGHTMEASUREUC = #{totalgrossweightmeasureuc,jdbcType=VARCHAR},
CHARGEABLEWEIGHTMEASURE = #{chargeableweightmeasure,jdbcType=VARCHAR},
CHARGEABLEWEIGHTMEASUREUC = #{chargeableweightmeasureuc,jdbcType=VARCHAR},
ARRIVEDDATE = #{arriveddate,jdbcType=TIMESTAMP},
CUSTOMSCODE = #{customscode,jdbcType=VARCHAR},
PRODUCTNAME = #{productname,jdbcType=VARCHAR},
CREATEDATE = #{customscode,jdbcType=TIMESTAMP},
ARRIVEDMASTERID = #{arrivedmasterid,jdbcType=VARCHAR},
TRANSPORTSPLITDESCRIPTION = #{transportsplitdescription,jdbcType=VARCHAR},
RECEIPTION = #{receiption,jdbcType=VARCHAR},
STATUS = #{status,jdbcType=VARCHAR}
where AUTOID = #{autoid,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
... ...
package com.example.demo;
import com.example.demo.handle.nms.FZE_FOH_Handle;
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;
... ... @@ -11,6 +12,7 @@ import org.dom4j.DocumentHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.math.BigDecimal;
... ... @@ -20,6 +22,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
@Component
public class FWBDemo {
protected static final Logger logger = LoggerFactory.getLogger(FWBDemo.class);
... ... @@ -38,22 +41,17 @@ public class FWBDemo {
String xml = "<MSG>\n" +
"\t<META>\n" +
"\t\t<SNDR>TXD</SNDR>\n" +
"\t\t<DDTM>20181210085229</DDTM>\n" +
"\t\t<TYPE>DFME</TYPE>\n" +
"\t\t<STYP>UFOH</STYP>\n" +
"\t\t<SEQN>75532140</SEQN>\n" +
"\t\t<SNDR>CFPS</SNDR>\n" +
"\t\t<RCVR/>\n" +
"\t\t<DDTM>20170714162918</DDTM>\n" +
"\t\t<TYPE>ICUSTOMS</TYPE>\n" +
"\t\t<STYP>FZE_FOH</STYP>\n" +
"\t\t<SEQN>51077716</SEQN>\n" +
"\t</META>\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<ID>851-09067704</ID>\n" +
"\t\t\t\t<Name>Air Waybill</Name>\n" +
"\t\t\t\t<TypeCode>741</TypeCode>\n" +
"\t\t\t</TransportContractDocument>\n" +
... ... @@ -62,13 +60,13 @@ public class FWBDemo {
"\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\t<ID>DAC</ID>\n" +
"\t\t\t\t<Name>DHAKA</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<OccurrenceDateTime>2017-07-13T19:25:55+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" +
... ... @@ -77,62 +75,21 @@ public class FWBDemo {
"\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<GrossWeightMeasure unitCode=\"KGM\">811</GrossWeightMeasure>\n" +
"\t\t\t\t\t<GrossVolumeMeasure unitCode=\"MTQ\">0</GrossVolumeMeasure>\n" +
"\t\t\t\t\t<PieceQuantity>27</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<ID>HX9366</ID>\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<DepartureOccurrenceDateTime>2017-07-15T00:00: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<Name>ZHANGJIAGANG RONGYUE IM EXPORT CO</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\t<StreetName>SHAZHOU WEST ROAD ZHANGJIAGANG CITY</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" +
... ... @@ -141,7 +98,7 @@ public class FWBDemo {
"\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\t<TypeCode listAgencyID=\"1\">FABRIC</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" +
... ... @@ -149,6 +106,17 @@ public class FWBDemo {
"\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\t<IncludedHouseConsignment>\n" +
"\t\t\t\t\t\t\t<GrossWeightMeasure unitCode=\"KGM\">811</GrossWeightMeasure>\n" +
"\t\t\t\t\t\t\t<TotalGrossWeightMeasure unitCode=\"KGM\">811</TotalGrossWeightMeasure>\n" +
"\t\t\t\t\t\t\t<PieceQuantity>27</PieceQuantity>\n" +
"\t\t\t\t\t\t\t<TotalPieceQuantity>27</TotalPieceQuantity>\n" +
"\t\t\t\t\t\t\t<TransportSplitDescription>T</TransportSplitDescription>\n" +
"\t\t\t\t\t\t\t<TransportContractDocument>\n" +
"\t\t\t\t\t\t\t\t<ID>WIN70715739</ID>\n" +
"\t\t\t\t\t\t\t\t<TypeCode>703</TypeCode>\n" +
"\t\t\t\t\t\t\t</TransportContractDocument>\n" +
"\t\t\t\t\t\t</IncludedHouseConsignment>\n" +
"\t\t\t\t\t</IncludedCustomsNote>\n" +
"\t\t\t\t</AssociatedStatusConsignment>\n" +
"\t\t\t</ReportedStatus>\n" +
... ... @@ -158,6 +126,14 @@ public class FWBDemo {
Document doc = DocumentHelper.parseText(xml);
try{
FZE_FOH_Handle fze_foh_handle = new FZE_FOH_Handle();
fze_foh_handle.handle(doc);
}catch (Exception e){
}
// String currencyID = XMLXPath.getSinglePathProperty(doc,"//MSG/MasterConsignment/DeclaredValueForCarriageAmount/@currencyID");
String measure = XMLXPath.getSingleValueByPath(doc,"//MSG/ConsignmentStatus/MasterConsignment/GrossWeightMeasure/@unitCode");
... ...