作者 朱兆平

IMF开发包和springboot 报 还是有冲突,注意这里的坑,找时间弄下这些包

开始做切换到IMF的新仓单数据订阅的报文解析
正在显示 24 个修改的文件 包含 1039 行增加57 行删除
@@ -93,6 +93,12 @@ @@ -93,6 +93,12 @@
93 <groupId>com.fasterxml.jackson.dataformat</groupId> 93 <groupId>com.fasterxml.jackson.dataformat</groupId>
94 <artifactId>jackson-dataformat-yaml</artifactId> 94 <artifactId>jackson-dataformat-yaml</artifactId>
95 </dependency> 95 </dependency>
  96 + <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
  97 + <dependency>
  98 + <groupId>commons-io</groupId>
  99 + <artifactId>commons-io</artifactId>
  100 + <version>2.6</version>
  101 + </dependency>
96 </dependencies> 102 </dependencies>
97 <dependencyManagement> 103 <dependencyManagement>
98 <dependencies> 104 <dependencies>
  1 +package com.example.demo.controller;
  2 +
  3 +import com.example.demo.service.NMS_FSU_FOH_Service;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.web.bind.annotation.*;
  6 +
  7 +@RestController
  8 +@RequestMapping(value = "/arrivalMaster")
  9 +public class FSUFohController {
  10 +
  11 + @Autowired
  12 + private NMS_FSU_FOH_Service fohService;
  13 +
  14 + @GetMapping("list")
  15 + public Object list(@RequestParam(name = "pageNum",required = false,defaultValue = "1")
  16 + int pageNum,
  17 + @RequestParam(name = "pageSize",required = false,defaultValue = "10")
  18 + int pageSize){
  19 + return fohService.selectAll(pageNum,pageSize);
  20 + }
  21 +
  22 + @GetMapping("getByAutoid")
  23 + public Object getByAutoid(@RequestParam(name = "autoid",required = true) String autoid){
  24 + return fohService.selectByPrimaryKey(autoid);
  25 + }
  26 +}
  1 +package com.example.demo.handle;
  2 +
  3 +import com.example.demo.model.IMF_META;
  4 +import com.example.demo.util.IO.FileTool;
  5 +import com.example.demo.util.XML.XML2ENTITY;
  6 +import org.dom4j.Document;
  7 +import org.dom4j.DocumentHelper;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +import java.util.Map;
  13 +
  14 +@Component
  15 +public class IMF_Message_MainHandle {
  16 + protected static final Logger logger = LoggerFactory.getLogger(IMF_Message_MainHandle.class);
  17 +
  18 + public IMF_META messageHandle(String xmlString) throws Exception{
  19 + String TYPE_Path = "All";
  20 + IMF_META imf_meta = new IMF_META();
  21 + try{
  22 + Document doc = DocumentHelper.parseText(xmlString);
  23 + XML2ENTITY xml2ENTITY = new XML2ENTITY();
  24 + Map<String, Object> map = xml2ENTITY.Dom2Map(doc);
  25 +
  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");
  33 + imf_meta.setSTYP(TYPE_Path);
  34 +
  35 + //解析分配
  36 + switch (TYPE_Path){
  37 + case "PFFM":
  38 +
  39 + break;
  40 + case "UFOH":
  41 +
  42 + break;
  43 + case "EFOH":
  44 + break;
  45 + case "UDEP":
  46 + break;
  47 + case "EDEP":
  48 + break;
  49 + case "URCF":
  50 + break;
  51 + case "ERCF":
  52 + break;
  53 + case "FFM":
  54 + break;
  55 + case "IFWB":
  56 + break;
  57 + case "IFHL":
  58 + break;
  59 + }
  60 + }catch (Exception e){
  61 + FileTool.writeFile(TYPE_Path,e.toString()+"\n"+xmlString,false);
  62 + }
  63 + return imf_meta;
  64 + }
  65 +
  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 +
  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 +}
1 package com.example.demo.handle; 1 package com.example.demo.handle;
2 2
3 import com.example.demo.model.T_TXD_FWB; 3 import com.example.demo.model.T_TXD_FWB;
4 -import com.example.demo.model.T_TXD_FWBSTATUS;  
5 import com.example.demo.service.T_TXD_FWB_Service; 4 import com.example.demo.service.T_TXD_FWB_Service;
6 import com.example.demo.util.Helper; 5 import com.example.demo.util.Helper;
7 import com.example.demo.util.XML.XML2ENTITY; 6 import com.example.demo.util.XML.XML2ENTITY;
@@ -37,7 +36,8 @@ public class T_ETL_FWB_Handle { @@ -37,7 +36,8 @@ public class T_ETL_FWB_Handle {
37 public Boolean insertHandle (String xmlStr,BigDecimal messageBak_fid){ 36 public Boolean insertHandle (String xmlStr,BigDecimal messageBak_fid){
38 try{ 37 try{
39 Document doc = DocumentHelper.parseText(xmlStr); 38 Document doc = DocumentHelper.parseText(xmlStr);
40 - Map<String, Object> map = XML2ENTITY.Dom2Map(doc); 39 + XML2ENTITY xml2ENTITY = new XML2ENTITY();
  40 + Map<String, Object> map = xml2ENTITY.Dom2Map(doc);
41 T_TXD_FWB fwb= new T_TXD_FWB(); 41 T_TXD_FWB fwb= new T_TXD_FWB();
42 fwb.setMessageBakId(messageBak_fid); 42 fwb.setMessageBakId(messageBak_fid);
43 43
@@ -73,7 +73,7 @@ public class T_ETL_FWB_Handle { @@ -73,7 +73,7 @@ public class T_ETL_FWB_Handle {
73 String flightDevTime = ((Map)flight.get("DepartureEvent")).get("ScheduledOccurrenceDateTime").toString(); 73 String flightDevTime = ((Map)flight.get("DepartureEvent")).get("ScheduledOccurrenceDateTime").toString();
74 ZonedDateTime depZoneTime = ZonedDateTime.parse(flightDevTime); 74 ZonedDateTime depZoneTime = ZonedDateTime.parse(flightDevTime);
75 Date flightDate = Date.from(depZoneTime.toInstant()); //这个是入库航班日期格式 75 Date flightDate = Date.from(depZoneTime.toInstant()); //这个是入库航班日期格式
76 - 76 + fwb.setDeDatetime(flightDate);
77 //货物节点 77 //货物节点
78 78
79 //插入主数据表 79 //插入主数据表
  1 +package com.example.demo.handle.nms;
  2 +
  3 +public class FSU_FOH_Handle {
  4 +
  5 + public void fsu_foh_handle(){
  6 +
  7 + }
  8 +}
1 -package com.example.demo.handle.IMF; 1 +package com.example.demo.imf;
2 2
3 import com.caac.imf.api.IMFClient; 3 import com.caac.imf.api.IMFClient;
4 -import com.example.demo.scheduled.IMF_KAKO_Task; 4 +import com.example.demo.handle.IMF_Message_MainHandle;
  5 +import com.example.demo.model.IMF_META;
  6 +import com.example.demo.scheduled.IMF_Task;
  7 +import com.example.demo.util.IO.FileTool;
5 import org.apache.log4j.Logger; 8 import org.apache.log4j.Logger;
6 9
7 -public class KAKO_Reader extends Thread{  
8 - protected static final Logger logger = Logger.getLogger(KAKO_Reader.class); 10 +public class IMF_Reader extends Thread{
  11 + protected static final Logger logger = Logger.getLogger(IMF_Reader.class);
9 private IMFClient client; 12 private IMFClient client;
10 public static boolean isrunning; 13 public static boolean isrunning;
11 14
12 - public KAKO_Reader(IMFClient client) { 15 + public IMF_Reader(IMFClient client) {
13 this.client = client; 16 this.client = client;
14 } 17 }
15 18
@@ -18,19 +21,20 @@ public class KAKO_Reader extends Thread{ @@ -18,19 +21,20 @@ public class KAKO_Reader extends Thread{
18 try{ 21 try{
19 isrunning =true; 22 isrunning =true;
20 while(true) { 23 while(true) {
21 - if (IMF_KAKO_Task.LOGIN_OK) {  
22 - synchronized(this) { 24 + if (IMF_Task.LOGIN_OK) {
23 String message = this.client.getMSG(); 25 String message = this.client.getMSG();
24 if (message != null) { 26 if (message != null) {
25 - logger.info(message);  
26 - } 27 + FileTool.writeFile("all",message,true);
  28 + IMF_Message_MainHandle mainHandle = new IMF_Message_MainHandle();
  29 + IMF_META meta = mainHandle.messageHandle(message);
27 } 30 }
  31 + logger.info("当前线程:"+Thread.currentThread().getName());
28 } else { 32 } else {
29 //logger.info("***"); 33 //logger.info("***");
30 } 34 }
31 35
32 try { 36 try {
33 - Thread.sleep(100L); 37 + Thread.sleep(500L);
34 } catch (InterruptedException var3) { 38 } catch (InterruptedException var3) {
35 var3.printStackTrace(); 39 var3.printStackTrace();
36 40
1 -package com.example.demo.handle.IMF; 1 +package com.example.demo.imf;
2 2
3 import com.caac.imf.api.IMFClient; 3 import com.caac.imf.api.IMFClient;
4 -import com.example.demo.scheduled.IMF_KAKO_Task; 4 +import com.example.demo.scheduled.IMF_Task;
5 import org.apache.log4j.Logger; 5 import org.apache.log4j.Logger;
6 -import org.slf4j.LoggerFactory;  
7 6
8 -public class KAKO_Sender extends Thread{ 7 +public class IMF_Sender extends Thread{
9 8
10 - protected static final Logger logger = Logger.getLogger(KAKO_Sender.class); 9 + protected static final Logger logger = Logger.getLogger(IMF_Sender.class);
11 public static boolean isrunning; 10 public static boolean isrunning;
12 private IMFClient client; 11 private IMFClient client;
13 - public KAKO_Sender(IMFClient client) { 12 + private String content;
  13 + public IMF_Sender(IMFClient client,String content) {
14 this.client = client; 14 this.client = client;
  15 + this.content = content;
15 } 16 }
16 private String SendMsg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + 17 private String SendMsg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
17 "<Msg>\n" + 18 "<Msg>\n" +
18 "\t<META>\n" + 19 "\t<META>\n" +
19 - "\t\t<SNDR>ZWY</SNDR>\n" + 20 + "\t\t<SNDR>NMS</SNDR>\n" +
20 "\t\t<RCVR/>\n" + 21 "\t\t<RCVR/>\n" +
21 "\t\t<SEQN>16078357182</SEQN>\n" + 22 "\t\t<SEQN>16078357182</SEQN>\n" +
22 "\t\t<DDTM>20181116175107671</DDTM>\n" + 23 "\t\t<DDTM>20181116175107671</DDTM>\n" +
23 "\t\t<TYPE>HYXX</TYPE>\n" + 24 "\t\t<TYPE>HYXX</TYPE>\n" +
24 - "\t\t<STYP>NDLR</STYP>\n" + 25 + "\t\t<STYP>GAT</STYP>\n" +
25 "\t</META>\n" + 26 "\t</META>\n" +
26 "\t<DECLAREPREPAREMASTERXMLBODY>\n" + 27 "\t<DECLAREPREPAREMASTERXMLBODY>\n" +
27 "\t\t<Head>\n" + 28 "\t\t<Head>\n" +
@@ -123,9 +124,9 @@ public class KAKO_Sender extends Thread{ @@ -123,9 +124,9 @@ public class KAKO_Sender extends Thread{
123 return; 124 return;
124 } 125 }
125 isrunning=true; 126 isrunning=true;
126 - if(IMF_KAKO_Task.isSuc){ 127 + if(IMF_Task.isSuc){
127 // logger.info("<<<<<<<<<<<主线程初始化成功>>>>>>>>>>>>"); 128 // logger.info("<<<<<<<<<<<主线程初始化成功>>>>>>>>>>>>");
128 - if(IMF_KAKO_Task.LOGIN_OK){ 129 + if(IMF_Task.LOGIN_OK){
129 130
130 String returnMsg = this.client.sendMSG(SendMsg); 131 String returnMsg = this.client.sendMSG(SendMsg);
131 logger.info("《--------发送信息成功开始轮询500mm一次--------"+returnMsg); 132 logger.info("《--------发送信息成功开始轮询500mm一次--------"+returnMsg);
@@ -143,6 +144,6 @@ public class KAKO_Sender extends Thread{ @@ -143,6 +144,6 @@ public class KAKO_Sender extends Thread{
143 144
144 145
145 isrunning=false; 146 isrunning=false;
146 - logger.info("<<<<<<<<<<<发送线程不在了>>>>>>>>>>>>"); 147 + logger.info("<<<<<<<<<<<发送线程结束>>>>>>>>>>>>");
147 } 148 }
148 } 149 }
  1 +package com.example.demo.mapper;
  2 +
  3 +import com.example.demo.model.NMS_FSU_FOH;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface NMS_FSU_FOHMapper {
  8 + int deleteByPrimaryKey(String autoid);
  9 +
  10 + int insert(NMS_FSU_FOH record);
  11 +
  12 + int insertSelective(NMS_FSU_FOH record);
  13 +
  14 + NMS_FSU_FOH selectByPrimaryKey(String autoid);
  15 +
  16 + int updateByPrimaryKeySelective(NMS_FSU_FOH record);
  17 +
  18 + int updateByPrimaryKey(NMS_FSU_FOH record);
  19 +
  20 + List<NMS_FSU_FOH> selectAll();
  21 +}
  1 +package com.example.demo.model;
  2 +
  3 +public class IMF_META {
  4 + private String SNDR;//报文发送者账号
  5 + private String RCVR;//指定消息接受者
  6 + private String DDTM;//发送时间yyyyMMddhhmmss
  7 + private String TYPE;//消息主类型
  8 + private String STYP;//消息子类型
  9 + private String SEQN;//消息序号
  10 +
  11 + public String getBODY() {
  12 + return BODY;
  13 + }
  14 +
  15 + public void setBODY(String BODY) {
  16 + this.BODY = BODY;
  17 + }
  18 +
  19 + private String BODY;//消息体
  20 +
  21 + public String getSNDR() {
  22 + return SNDR;
  23 + }
  24 +
  25 + public void setSNDR(String SNDR) {
  26 + this.SNDR = SNDR;
  27 + }
  28 +
  29 + public String getRCVR() {
  30 + return RCVR;
  31 + }
  32 +
  33 + public void setRCVR(String RCVR) {
  34 + this.RCVR = RCVR;
  35 + }
  36 +
  37 + public String getDDTM() {
  38 + return DDTM;
  39 + }
  40 +
  41 + public void setDDTM(String DDTM) {
  42 + this.DDTM = DDTM;
  43 + }
  44 +
  45 + public String getTYPE() {
  46 + return TYPE;
  47 + }
  48 +
  49 + public void setTYPE(String TYPE) {
  50 + this.TYPE = TYPE;
  51 + }
  52 +
  53 + public String getSTYP() {
  54 + return STYP;
  55 + }
  56 +
  57 + public void setSTYP(String STYP) {
  58 + this.STYP = STYP;
  59 + }
  60 +
  61 + public String getSEQN() {
  62 + return SEQN;
  63 + }
  64 +
  65 + public void setSEQN(String SEQN) {
  66 + this.SEQN = SEQN;
  67 + }
  68 +}
  1 +package com.example.demo.model;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class NMS_FSU_FOH {
  6 + private String autoid;
  7 +
  8 + private String waybillnomaster;
  9 +
  10 + private String tcdName;
  11 +
  12 + private String tcdTypecode;
  13 +
  14 + private String flightno;
  15 +
  16 + private Date flightdate;
  17 +
  18 + private String carrier;
  19 +
  20 + private String originatingstation;
  21 +
  22 + private String oName;
  23 +
  24 + private String destinationstation;
  25 +
  26 + private String fdName;
  27 +
  28 + private String arrivedtotalpiece;
  29 +
  30 + private String totalpiecequantity;
  31 +
  32 + private String arrivedtotalweight;
  33 +
  34 + private String grossweightmeasureuc;
  35 +
  36 + private String totalgrossweightmeasure;
  37 +
  38 + private String totalgrossweightmeasureuc;
  39 +
  40 + private String chargeableweightmeasure;
  41 +
  42 + private String chargeableweightmeasureuc;
  43 +
  44 + private Date arriveddate;
  45 +
  46 + private String transportsplitdescription;
  47 +
  48 + private String customscode;
  49 +
  50 + private String productname;
  51 +
  52 + private String status;
  53 +
  54 + private String receiptinformation;
  55 +
  56 + private Date createdate;
  57 +
  58 + public String getAutoid() {
  59 + return autoid;
  60 + }
  61 +
  62 + public void setAutoid(String autoid) {
  63 + this.autoid = autoid == null ? null : autoid.trim();
  64 + }
  65 +
  66 + public String getWaybillnomaster() {
  67 + return waybillnomaster;
  68 + }
  69 +
  70 + public void setWaybillnomaster(String waybillnomaster) {
  71 + this.waybillnomaster = waybillnomaster == null ? null : waybillnomaster.trim();
  72 + }
  73 +
  74 + public String getTcdName() {
  75 + return tcdName;
  76 + }
  77 +
  78 + public void setTcdName(String tcdName) {
  79 + this.tcdName = tcdName == null ? null : tcdName.trim();
  80 + }
  81 +
  82 + public String getTcdTypecode() {
  83 + return tcdTypecode;
  84 + }
  85 +
  86 + public void setTcdTypecode(String tcdTypecode) {
  87 + this.tcdTypecode = tcdTypecode == null ? null : tcdTypecode.trim();
  88 + }
  89 +
  90 + public String getFlightno() {
  91 + return flightno;
  92 + }
  93 +
  94 + public void setFlightno(String flightno) {
  95 + this.flightno = flightno == null ? null : flightno.trim();
  96 + }
  97 +
  98 + public Date getFlightdate() {
  99 + return flightdate;
  100 + }
  101 +
  102 + public void setFlightdate(Date flightdate) {
  103 + this.flightdate = flightdate;
  104 + }
  105 +
  106 + public String getCarrier() {
  107 + return carrier;
  108 + }
  109 +
  110 + public void setCarrier(String carrier) {
  111 + this.carrier = carrier == null ? null : carrier.trim();
  112 + }
  113 +
  114 + public String getOriginatingstation() {
  115 + return originatingstation;
  116 + }
  117 +
  118 + public void setOriginatingstation(String originatingstation) {
  119 + this.originatingstation = originatingstation == null ? null : originatingstation.trim();
  120 + }
  121 +
  122 + public String getoName() {
  123 + return oName;
  124 + }
  125 +
  126 + public void setoName(String oName) {
  127 + this.oName = oName == null ? null : oName.trim();
  128 + }
  129 +
  130 + public String getDestinationstation() {
  131 + return destinationstation;
  132 + }
  133 +
  134 + public void setDestinationstation(String destinationstation) {
  135 + this.destinationstation = destinationstation == null ? null : destinationstation.trim();
  136 + }
  137 +
  138 + public String getFdName() {
  139 + return fdName;
  140 + }
  141 +
  142 + public void setFdName(String fdName) {
  143 + this.fdName = fdName == null ? null : fdName.trim();
  144 + }
  145 +
  146 + public String getArrivedtotalpiece() {
  147 + return arrivedtotalpiece;
  148 + }
  149 +
  150 + public void setArrivedtotalpiece(String arrivedtotalpiece) {
  151 + this.arrivedtotalpiece = arrivedtotalpiece == null ? null : arrivedtotalpiece.trim();
  152 + }
  153 +
  154 + public String getTotalpiecequantity() {
  155 + return totalpiecequantity;
  156 + }
  157 +
  158 + public void setTotalpiecequantity(String totalpiecequantity) {
  159 + this.totalpiecequantity = totalpiecequantity == null ? null : totalpiecequantity.trim();
  160 + }
  161 +
  162 + public String getArrivedtotalweight() {
  163 + return arrivedtotalweight;
  164 + }
  165 +
  166 + public void setArrivedtotalweight(String arrivedtotalweight) {
  167 + this.arrivedtotalweight = arrivedtotalweight == null ? null : arrivedtotalweight.trim();
  168 + }
  169 +
  170 + public String getGrossweightmeasureuc() {
  171 + return grossweightmeasureuc;
  172 + }
  173 +
  174 + public void setGrossweightmeasureuc(String grossweightmeasureuc) {
  175 + this.grossweightmeasureuc = grossweightmeasureuc == null ? null : grossweightmeasureuc.trim();
  176 + }
  177 +
  178 + public String getTotalgrossweightmeasure() {
  179 + return totalgrossweightmeasure;
  180 + }
  181 +
  182 + public void setTotalgrossweightmeasure(String totalgrossweightmeasure) {
  183 + this.totalgrossweightmeasure = totalgrossweightmeasure == null ? null : totalgrossweightmeasure.trim();
  184 + }
  185 +
  186 + public String getTotalgrossweightmeasureuc() {
  187 + return totalgrossweightmeasureuc;
  188 + }
  189 +
  190 + public void setTotalgrossweightmeasureuc(String totalgrossweightmeasureuc) {
  191 + this.totalgrossweightmeasureuc = totalgrossweightmeasureuc == null ? null : totalgrossweightmeasureuc.trim();
  192 + }
  193 +
  194 + public String getChargeableweightmeasure() {
  195 + return chargeableweightmeasure;
  196 + }
  197 +
  198 + public void setChargeableweightmeasure(String chargeableweightmeasure) {
  199 + this.chargeableweightmeasure = chargeableweightmeasure == null ? null : chargeableweightmeasure.trim();
  200 + }
  201 +
  202 + public String getChargeableweightmeasureuc() {
  203 + return chargeableweightmeasureuc;
  204 + }
  205 +
  206 + public void setChargeableweightmeasureuc(String chargeableweightmeasureuc) {
  207 + this.chargeableweightmeasureuc = chargeableweightmeasureuc == null ? null : chargeableweightmeasureuc.trim();
  208 + }
  209 +
  210 + public Date getArriveddate() {
  211 + return arriveddate;
  212 + }
  213 +
  214 + public void setArriveddate(Date arriveddate) {
  215 + this.arriveddate = arriveddate;
  216 + }
  217 +
  218 + public String getTransportsplitdescription() {
  219 + return transportsplitdescription;
  220 + }
  221 +
  222 + public void setTransportsplitdescription(String transportsplitdescription) {
  223 + this.transportsplitdescription = transportsplitdescription == null ? null : transportsplitdescription.trim();
  224 + }
  225 +
  226 + public String getCustomscode() {
  227 + return customscode;
  228 + }
  229 +
  230 + public void setCustomscode(String customscode) {
  231 + this.customscode = customscode == null ? null : customscode.trim();
  232 + }
  233 +
  234 + public String getProductname() {
  235 + return productname;
  236 + }
  237 +
  238 + public void setProductname(String productname) {
  239 + this.productname = productname == null ? null : productname.trim();
  240 + }
  241 +
  242 + public String getStatus() {
  243 + return status;
  244 + }
  245 +
  246 + public void setStatus(String status) {
  247 + this.status = status == null ? null : status.trim();
  248 + }
  249 +
  250 + public String getReceiptinformation() {
  251 + return receiptinformation;
  252 + }
  253 +
  254 + public void setReceiptinformation(String receiptinformation) {
  255 + this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim();
  256 + }
  257 +
  258 + public Date getCreatedate() {
  259 + return createdate;
  260 + }
  261 +
  262 + public void setCreatedate(Date createdate) {
  263 + this.createdate = createdate;
  264 + }
  265 +}
@@ -2,53 +2,54 @@ package com.example.demo.scheduled; @@ -2,53 +2,54 @@ package com.example.demo.scheduled;
2 2
3 import com.caac.imf.api.IMFClient; 3 import com.caac.imf.api.IMFClient;
4 import com.caac.imf.api.IMFClientFactory; 4 import com.caac.imf.api.IMFClientFactory;
5 -import com.example.demo.handle.IMF.KAKO_Reader;  
6 -import com.example.demo.handle.IMF.KAKO_Sender;  
7 import org.apache.log4j.Logger; 5 import org.apache.log4j.Logger;
8 import org.apache.log4j.PropertyConfigurator; 6 import org.apache.log4j.PropertyConfigurator;
9 import org.springframework.scheduling.annotation.Scheduled; 7 import org.springframework.scheduling.annotation.Scheduled;
10 import org.springframework.stereotype.Component; 8 import org.springframework.stereotype.Component;
  9 +import com.example.demo.imf.IMF_Reader;
  10 +import com.example.demo.imf.IMF_Sender;
11 11
12 @Component 12 @Component
13 -public class IMF_KAKO_Task {  
14 - protected static final Logger logger = Logger.getLogger(IMF_KAKO_Task.class); 13 +public class IMF_Task {
  14 + protected static final Logger logger = Logger.getLogger(IMF_Task.class);
15 15
16 public static boolean LOGIN_OK = false; 16 public static boolean LOGIN_OK = false;
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();
24 24
25 25
26 if (client != null) { 26 if (client != null) {
27 - if (!KAKO_Reader.isrunning) {  
28 - KAKO_Reader kako_reader = new KAKO_Reader(client); 27 + IMF_Reader kako_reader = new IMF_Reader(client);
  28 + if (!kako_reader.isrunning) {
29 kako_reader.start(); 29 kako_reader.start();
30 logger.info("*********KAKO读取线程已开启***********"); 30 logger.info("*********KAKO读取线程已开启***********");
31 } else { 31 } else {
32 logger.info("*********KAKO读取线程已开启-不再启动线程*********"); 32 logger.info("*********KAKO读取线程已开启-不再启动线程*********");
33 } 33 }
34 -  
35 - if(!KAKO_Sender.isrunning){  
36 - KAKO_Sender kako_sender = new KAKO_Sender(client);  
37 - kako_sender.start();  
38 - logger.info("<<<<<<<<<KAKO发送线程已开启>>>>>>>>>>>>");  
39 - }else {  
40 - logger.info("<<<<<<<<<KAKO发送线程已开启-不再启动线程>>>>>>>>>>>>");  
41 - }  
42 -  
43 } 34 }
44 if (!LOGIN_OK){ 35 if (!LOGIN_OK){
45 - loginIMF(client, "KAKO", "KAKO", "config/imf_config.properties"); 36 + loginIMF(client, "NMS", "NMS_P", "config/imf_config.properties");
46 } 37 }
47 38
48 39
49 40
50 } 41 }
51 42
  43 + public void sendMsg(String msg){
  44 + if (!msg.equals(null) && !msg.isEmpty()){
  45 + IMF_Sender kako_sender = new IMF_Sender(client,msg);
  46 + if(!kako_sender.isrunning) {
  47 + kako_sender.start();
  48 + }
  49 + }
  50 +
  51 + }
  52 +
52 private static void loginIMF(IMFClient client, String userName, String password, String confFileName) { 53 private static void loginIMF(IMFClient client, String userName, String password, String confFileName) {
53 if (client.initial(confFileName)) { 54 if (client.initial(confFileName)) {
54 String message = client.login(userName, password); 55 String message = client.login(userName, password);
  1 +package com.example.demo.service;
  2 +
  3 +import com.example.demo.model.NMS_FSU_FOH;
  4 +import com.github.pagehelper.PageInfo;
  5 +
  6 +
  7 +
  8 +public interface NMS_FSU_FOH_Service {
  9 +
  10 + int insert(NMS_FSU_FOH record);
  11 + int insertSelective(NMS_FSU_FOH record);
  12 + int updateByPrimaryKeySelective(NMS_FSU_FOH record);
  13 + int updateByPrimaryKey(NMS_FSU_FOH record);
  14 + NMS_FSU_FOH selectByPrimaryKey(String autoid);
  15 + PageInfo<NMS_FSU_FOH> selectAll(int pageNum, int pageSize);
  16 +}
  1 +package com.example.demo.service.imp;
  2 +
  3 +import com.example.demo.mapper.NMS_FSU_FOHMapper;
  4 +import com.example.demo.model.NMS_FSU_FOH;
  5 +import com.example.demo.service.NMS_FSU_FOH_Service;
  6 +import com.github.pagehelper.Page;
  7 +import com.github.pagehelper.PageHelper;
  8 +import com.github.pagehelper.PageInfo;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Service;
  11 +
  12 +import java.util.List;
  13 +
  14 +@Service("fsu_foh_service")
  15 +public class NMS_FSU_FOH_ServiceImp implements NMS_FSU_FOH_Service{
  16 +
  17 + @Autowired
  18 + private NMS_FSU_FOHMapper fsu_fohMapper;
  19 +
  20 + public int insert(NMS_FSU_FOH record){
  21 + return fsu_fohMapper.insert(record);
  22 + }
  23 + public int insertSelective(NMS_FSU_FOH record){
  24 + return fsu_fohMapper.insertSelective(record);
  25 + }
  26 + public int updateByPrimaryKeySelective(NMS_FSU_FOH record){
  27 + return fsu_fohMapper.updateByPrimaryKeySelective(record);
  28 + }
  29 + public int updateByPrimaryKey(NMS_FSU_FOH record){
  30 + return fsu_fohMapper.updateByPrimaryKey(record);
  31 + }
  32 + public NMS_FSU_FOH selectByPrimaryKey(String autoid){
  33 + return fsu_fohMapper.selectByPrimaryKey(autoid);
  34 + }
  35 + public PageInfo<NMS_FSU_FOH> selectAll(int pageNum,int pageSize){
  36 + PageHelper.startPage(pageNum,pageSize);
  37 + Page<NMS_FSU_FOH> page = PageHelper.startPage(pageNum,pageSize);
  38 + List<NMS_FSU_FOH> fsuFohList = fsu_fohMapper.selectAll();
  39 + PageInfo<NMS_FSU_FOH> result = new PageInfo<NMS_FSU_FOH>(fsuFohList);
  40 + return result;
  41 + }
  42 +}
  1 +package com.example.demo.util.Date;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.Date;
  5 +
  6 +public final class DateUtil {
  7 + private static Date currentDate = new Date();
  8 + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  9 +
  10 + public static String getToday(){
  11 + return sdf.format(currentDate);
  12 + }
  13 +}
@@ -5,6 +5,7 @@ import org.springframework.lang.Nullable; @@ -5,6 +5,7 @@ import org.springframework.lang.Nullable;
5 import java.math.BigDecimal; 5 import java.math.BigDecimal;
6 import java.math.BigInteger; 6 import java.math.BigInteger;
7 import java.util.Map; 7 import java.util.Map;
  8 +import java.util.UUID;
8 9
9 public class Helper { 10 public class Helper {
10 11
@@ -46,4 +47,8 @@ public class Helper { @@ -46,4 +47,8 @@ public class Helper {
46 return null; 47 return null;
47 } 48 }
48 } 49 }
  50 +
  51 + public static String getUUID(){
  52 + return UUID.randomUUID().toString().replace("-", "");
  53 + }
49 } 54 }
  1 +package com.example.demo.util.IO;
  2 +
  3 +import com.example.demo.util.Date.DateUtil;
  4 +import com.example.demo.util.Helper;
  5 +import org.apache.commons.io.FileUtils;
  6 +
  7 +import java.io.File;
  8 +import java.io.IOException;
  9 +
  10 +
  11 +public final class FileTool {
  12 + private final static String errorRootDirectory = "errorLogs";//错误的根目录名
  13 + private final static String xmlRootDirectory = "xmlLog"; //记录已收到的报文目录
  14 + private final static String Cherector = "UTF-8";
  15 +
  16 + /**
  17 + * 写入文件
  18 + * @param path 二级目录
  19 + * @param content 写入内容
  20 + * @param rightOrwrong 是写入错误记录目录还是记录目录
  21 + */
  22 + public static void writeFile(String path,String content,boolean rightOrwrong){
  23 + StringBuffer stringBuffer = new StringBuffer();
  24 +
  25 + if (rightOrwrong){
  26 + stringBuffer.append(xmlRootDirectory).append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log");
  27 + }else {
  28 + stringBuffer.append(errorRootDirectory).append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log");
  29 + }
  30 +
  31 + File file = new File(stringBuffer.toString());
  32 +
  33 + try{
  34 + FileUtils.writeStringToFile(file,content,Cherector);
  35 + }catch (IOException e){
  36 + e.printStackTrace();
  37 + }
  38 +
  39 + }
  40 +}
@@ -10,7 +10,7 @@ import org.dom4j.Element; @@ -10,7 +10,7 @@ import org.dom4j.Element;
10 10
11 public class XML2ENTITY { 11 public class XML2ENTITY {
12 @SuppressWarnings("unchecked") 12 @SuppressWarnings("unchecked")
13 - public static Map<String, Object> Dom2Map(Document doc){ 13 + public Map<String, Object> Dom2Map(Document doc){
14 Map<String, Object> map = new HashMap<String, Object>(); 14 Map<String, Object> map = new HashMap<String, Object>();
15 if(doc == null) 15 if(doc == null)
16 return map; 16 return map;
@@ -26,7 +26,7 @@ public class XML2ENTITY { @@ -26,7 +26,7 @@ public class XML2ENTITY {
26 return map; 26 return map;
27 } 27 }
28 @SuppressWarnings("unchecked") 28 @SuppressWarnings("unchecked")
29 - public static Map Dom2Map(Element e){ 29 + public Map Dom2Map(Element e){
30 Map map = new HashMap(); 30 Map map = new HashMap();
31 List list = e.elements(); 31 List list = e.elements();
32 if(list.size() > 0){ 32 if(list.size() > 0){
@@ -6,15 +6,15 @@ eureka.instance.hostname=localhost @@ -6,15 +6,15 @@ eureka.instance.hostname=localhost
6 #eureka服务器页面中status的请求路径 6 #eureka服务器页面中status的请求路径
7 eureka.instance.status-page-url=http://localhost:7002/index 7 eureka.instance.status-page-url=http://localhost:7002/index
8 #eureka注册中心服务器地址 8 #eureka注册中心服务器地址
9 -eureka.client.service-url.defaultZone=http://localhost:7001/eureka/ 9 +eureka.client.service-url.defaultZone=http://10.50.3.82:19527/eureka/
10 #服务名 10 #服务名
11 spring.application.name=wareHouseAnalysis 11 spring.application.name=wareHouseAnalysis
12 12
13 #spring.datasource.name=CGOETL 13 #spring.datasource.name=CGOETL
14 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource 14 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
15 spring.datasource.driver-class-name=oracle.jdbc.OracleDriver 15 spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
16 -spring.datasource.url=jdbc:oracle:thin:@10.50.3.68:1521:CGODW  
17 -spring.datasource.username=cgoetl 16 +spring.datasource.url=jdbc:oracle:thin:@10.50.3.70:1521:CGODB
  17 +spring.datasource.username=CGONMS
18 spring.datasource.password=1q2w3e4r 18 spring.datasource.password=1q2w3e4r
19 #配置初始化大小/最小/最大 19 #配置初始化大小/最小/最大
20 spring.datasource.druid.initial-size=1 20 spring.datasource.druid.initial-size=1
@@ -36,7 +36,9 @@ mybatis.mapper-locations=classpath:mapping/*.xml @@ -36,7 +36,9 @@ mybatis.mapper-locations=classpath:mapping/*.xml
36 mybatis.type-aliases-package=com.example.demo.model 36 mybatis.type-aliases-package=com.example.demo.model
37 logging.level.com.example.demo.mapper=DEBUG 37 logging.level.com.example.demo.mapper=DEBUG
38 38
39 -pagehelper.helper-dialect=mysql 39 +pagehelper.helper-dialect=oracle
  40 +#pagehelper.auto-dialect=true
  41 +#pagehelper.auto-runtime-dialect=true
40 pagehelper.reasonable=true 42 pagehelper.reasonable=true
41 pagehelper.support-methods-arguments=true 43 pagehelper.support-methods-arguments=true
42 pagehelper.params=count=countSql 44 pagehelper.params=count=countSql
@@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
16 <!--<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3307/statistics" userId="root" password="">--> 16 <!--<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3307/statistics" userId="root" password="">-->
17 <!--</jdbcConnection>--> 17 <!--</jdbcConnection>-->
18 <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" 18 <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
19 - connectionURL="jdbc:oracle:thin:@10.50.3.68:1521:CGODW"  
20 - userId="cgoetl" 19 + connectionURL="jdbc:oracle:thin:@10.50.3.70:1521:CGODB"
  20 + userId="CGONMS"
21 password="1q2w3e4r"> 21 password="1q2w3e4r">
22 </jdbcConnection> 22 </jdbcConnection>
23 <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和 23 <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和
@@ -42,6 +42,6 @@ @@ -42,6 +42,6 @@
42 <property name="enableSubPackages" value="true"/> 42 <property name="enableSubPackages" value="true"/>
43 </javaClientGenerator> 43 </javaClientGenerator>
44 <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名--> 44 <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
45 - <table tableName="T_ETL_MESSAGE" domainObjectName="T_ETL_MESSAGE" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> 45 + <table tableName="ARRIVEDMASTER" domainObjectName="NMS_FSU_FOH" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
46 </context> 46 </context>
47 </generatorConfiguration> 47 </generatorConfiguration>
@@ -10,7 +10,7 @@ Configuration: @@ -10,7 +10,7 @@ Configuration:
10 - name: log.level.xjj 10 - name: log.level.xjj
11 value: trace 11 value: trace
12 - name: log.path 12 - name: log.path
13 - value: /opt/logs 13 + value: logs
14 - name: project.name 14 - name: project.name
15 value: my-spring-boot 15 value: my-spring-boot
16 16
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.example.demo.mapper.NMS_FSU_FOHMapper" >
  4 + <resultMap id="BaseResultMap" type="com.example.demo.model.NMS_FSU_FOH" >
  5 + <id column="AUTOID" property="autoid" jdbcType="VARCHAR" />
  6 + <result column="WAYBILLNOMASTER" property="waybillnomaster" jdbcType="VARCHAR" />
  7 + <result column="TCD_NAME" property="tcdName" jdbcType="VARCHAR" />
  8 + <result column="TCD_TYPECODE" property="tcdTypecode" jdbcType="VARCHAR" />
  9 + <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" />
  10 + <result column="FLIGHTDATE" property="flightdate" jdbcType="TIMESTAMP" />
  11 + <result column="CARRIER" property="carrier" jdbcType="VARCHAR" />
  12 + <result column="ORIGINATINGSTATION" property="originatingstation" jdbcType="VARCHAR" />
  13 + <result column="O_NAME" property="oName" jdbcType="VARCHAR" />
  14 + <result column="DESTINATIONSTATION" property="destinationstation" jdbcType="VARCHAR" />
  15 + <result column="FD_NAME" property="fdName" jdbcType="VARCHAR" />
  16 + <result column="ARRIVEDTOTALPIECE" property="arrivedtotalpiece" jdbcType="VARCHAR" />
  17 + <result column="TOTALPIECEQUANTITY" property="totalpiecequantity" jdbcType="VARCHAR" />
  18 + <result column="ARRIVEDTOTALWEIGHT" property="arrivedtotalweight" jdbcType="VARCHAR" />
  19 + <result column="GROSSWEIGHTMEASUREUC" property="grossweightmeasureuc" jdbcType="VARCHAR" />
  20 + <result column="TOTALGROSSWEIGHTMEASURE" property="totalgrossweightmeasure" jdbcType="VARCHAR" />
  21 + <result column="TOTALGROSSWEIGHTMEASUREUC" property="totalgrossweightmeasureuc" jdbcType="VARCHAR" />
  22 + <result column="CHARGEABLEWEIGHTMEASURE" property="chargeableweightmeasure" jdbcType="VARCHAR" />
  23 + <result column="CHARGEABLEWEIGHTMEASUREUC" property="chargeableweightmeasureuc" jdbcType="VARCHAR" />
  24 + <result column="ARRIVEDDATE" property="arriveddate" jdbcType="TIMESTAMP" />
  25 + <result column="TRANSPORTSPLITDESCRIPTION" property="transportsplitdescription" jdbcType="VARCHAR" />
  26 + <result column="CUSTOMSCODE" property="customscode" jdbcType="VARCHAR" />
  27 + <result column="PRODUCTNAME" property="productname" jdbcType="VARCHAR" />
  28 + <result column="STATUS" property="status" jdbcType="VARCHAR" />
  29 + <result column="RECEIPTINFORMATION" property="receiptinformation" jdbcType="VARCHAR" />
  30 + <result column="CREATEDATE" property="createdate" jdbcType="TIMESTAMP" />
  31 + </resultMap>
  32 + <sql id="Base_Table">
  33 + ARRIVEDMASTER
  34 + </sql>
  35 + <sql id="Base_Column_List" >
  36 + AUTOID, WAYBILLNOMASTER, TCD_NAME, TCD_TYPECODE, FLIGHTNO, FLIGHTDATE, CARRIER, ORIGINATINGSTATION,
  37 + O_NAME, DESTINATIONSTATION, FD_NAME, ARRIVEDTOTALPIECE, TOTALPIECEQUANTITY, ARRIVEDTOTALWEIGHT,
  38 + GROSSWEIGHTMEASUREUC, TOTALGROSSWEIGHTMEASURE, TOTALGROSSWEIGHTMEASUREUC, CHARGEABLEWEIGHTMEASURE,
  39 + CHARGEABLEWEIGHTMEASUREUC, ARRIVEDDATE, TRANSPORTSPLITDESCRIPTION, CUSTOMSCODE, PRODUCTNAME,
  40 + STATUS, RECEIPTINFORMATION, CREATEDATE
  41 + </sql>
  42 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  43 + select
  44 + <include refid="Base_Column_List" />
  45 + from ARRIVEDMASTER
  46 + where AUTOID = #{autoid,jdbcType=VARCHAR}
  47 + </select>
  48 + <select id="selectAll" resultMap="BaseResultMap">-- resultType="com.example.demo.model.NMS_FSU_FOH"
  49 + SELECT
  50 + <include refid="Base_Column_List"/>
  51 +
  52 + FROM
  53 + <include refid="Base_Table"/>
  54 + </select>
  55 + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  56 + delete from ARRIVEDMASTER
  57 + where AUTOID = #{autoid,jdbcType=VARCHAR}
  58 + </delete>
  59 + <insert id="insert" parameterType="com.example.demo.model.NMS_FSU_FOH" >
  60 + insert into ARRIVEDMASTER (AUTOID, WAYBILLNOMASTER, TCD_NAME,
  61 + TCD_TYPECODE, FLIGHTNO, FLIGHTDATE,
  62 + CARRIER, ORIGINATINGSTATION, O_NAME,
  63 + DESTINATIONSTATION, FD_NAME, ARRIVEDTOTALPIECE,
  64 + TOTALPIECEQUANTITY, ARRIVEDTOTALWEIGHT,
  65 + GROSSWEIGHTMEASUREUC, TOTALGROSSWEIGHTMEASURE,
  66 + TOTALGROSSWEIGHTMEASUREUC, CHARGEABLEWEIGHTMEASURE,
  67 + CHARGEABLEWEIGHTMEASUREUC, ARRIVEDDATE,
  68 + TRANSPORTSPLITDESCRIPTION, CUSTOMSCODE,
  69 + PRODUCTNAME, STATUS, RECEIPTINFORMATION,
  70 + CREATEDATE)
  71 + values (#{autoid,jdbcType=VARCHAR}, #{waybillnomaster,jdbcType=VARCHAR}, #{tcdName,jdbcType=VARCHAR},
  72 + #{tcdTypecode,jdbcType=VARCHAR}, #{flightno,jdbcType=VARCHAR}, #{flightdate,jdbcType=TIMESTAMP},
  73 + #{carrier,jdbcType=VARCHAR}, #{originatingstation,jdbcType=VARCHAR}, #{oName,jdbcType=VARCHAR},
  74 + #{destinationstation,jdbcType=VARCHAR}, #{fdName,jdbcType=VARCHAR}, #{arrivedtotalpiece,jdbcType=VARCHAR},
  75 + #{totalpiecequantity,jdbcType=VARCHAR}, #{arrivedtotalweight,jdbcType=VARCHAR},
  76 + #{grossweightmeasureuc,jdbcType=VARCHAR}, #{totalgrossweightmeasure,jdbcType=VARCHAR},
  77 + #{totalgrossweightmeasureuc,jdbcType=VARCHAR}, #{chargeableweightmeasure,jdbcType=VARCHAR},
  78 + #{chargeableweightmeasureuc,jdbcType=VARCHAR}, #{arriveddate,jdbcType=TIMESTAMP},
  79 + #{transportsplitdescription,jdbcType=VARCHAR}, #{customscode,jdbcType=VARCHAR},
  80 + #{productname,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{receiptinformation,jdbcType=VARCHAR},
  81 + #{createdate,jdbcType=TIMESTAMP})
  82 + </insert>
  83 + <insert id="insertSelective" parameterType="com.example.demo.model.NMS_FSU_FOH" >
  84 + insert into ARRIVEDMASTER
  85 + <trim prefix="(" suffix=")" suffixOverrides="," >
  86 + <if test="autoid != null" >
  87 + AUTOID,
  88 + </if>
  89 + <if test="waybillnomaster != null" >
  90 + WAYBILLNOMASTER,
  91 + </if>
  92 + <if test="tcdName != null" >
  93 + TCD_NAME,
  94 + </if>
  95 + <if test="tcdTypecode != null" >
  96 + TCD_TYPECODE,
  97 + </if>
  98 + <if test="flightno != null" >
  99 + FLIGHTNO,
  100 + </if>
  101 + <if test="flightdate != null" >
  102 + FLIGHTDATE,
  103 + </if>
  104 + <if test="carrier != null" >
  105 + CARRIER,
  106 + </if>
  107 + <if test="originatingstation != null" >
  108 + ORIGINATINGSTATION,
  109 + </if>
  110 + <if test="oName != null" >
  111 + O_NAME,
  112 + </if>
  113 + <if test="destinationstation != null" >
  114 + DESTINATIONSTATION,
  115 + </if>
  116 + <if test="fdName != null" >
  117 + FD_NAME,
  118 + </if>
  119 + <if test="arrivedtotalpiece != null" >
  120 + ARRIVEDTOTALPIECE,
  121 + </if>
  122 + <if test="totalpiecequantity != null" >
  123 + TOTALPIECEQUANTITY,
  124 + </if>
  125 + <if test="arrivedtotalweight != null" >
  126 + ARRIVEDTOTALWEIGHT,
  127 + </if>
  128 + <if test="grossweightmeasureuc != null" >
  129 + GROSSWEIGHTMEASUREUC,
  130 + </if>
  131 + <if test="totalgrossweightmeasure != null" >
  132 + TOTALGROSSWEIGHTMEASURE,
  133 + </if>
  134 + <if test="totalgrossweightmeasureuc != null" >
  135 + TOTALGROSSWEIGHTMEASUREUC,
  136 + </if>
  137 + <if test="chargeableweightmeasure != null" >
  138 + CHARGEABLEWEIGHTMEASURE,
  139 + </if>
  140 + <if test="chargeableweightmeasureuc != null" >
  141 + CHARGEABLEWEIGHTMEASUREUC,
  142 + </if>
  143 + <if test="arriveddate != null" >
  144 + ARRIVEDDATE,
  145 + </if>
  146 + <if test="transportsplitdescription != null" >
  147 + TRANSPORTSPLITDESCRIPTION,
  148 + </if>
  149 + <if test="customscode != null" >
  150 + CUSTOMSCODE,
  151 + </if>
  152 + <if test="productname != null" >
  153 + PRODUCTNAME,
  154 + </if>
  155 + <if test="status != null" >
  156 + STATUS,
  157 + </if>
  158 + <if test="receiptinformation != null" >
  159 + RECEIPTINFORMATION,
  160 + </if>
  161 + <if test="createdate != null" >
  162 + CREATEDATE,
  163 + </if>
  164 + </trim>
  165 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  166 + <if test="autoid != null" >
  167 + #{autoid,jdbcType=VARCHAR},
  168 + </if>
  169 + <if test="waybillnomaster != null" >
  170 + #{waybillnomaster,jdbcType=VARCHAR},
  171 + </if>
  172 + <if test="tcdName != null" >
  173 + #{tcdName,jdbcType=VARCHAR},
  174 + </if>
  175 + <if test="tcdTypecode != null" >
  176 + #{tcdTypecode,jdbcType=VARCHAR},
  177 + </if>
  178 + <if test="flightno != null" >
  179 + #{flightno,jdbcType=VARCHAR},
  180 + </if>
  181 + <if test="flightdate != null" >
  182 + #{flightdate,jdbcType=TIMESTAMP},
  183 + </if>
  184 + <if test="carrier != null" >
  185 + #{carrier,jdbcType=VARCHAR},
  186 + </if>
  187 + <if test="originatingstation != null" >
  188 + #{originatingstation,jdbcType=VARCHAR},
  189 + </if>
  190 + <if test="oName != null" >
  191 + #{oName,jdbcType=VARCHAR},
  192 + </if>
  193 + <if test="destinationstation != null" >
  194 + #{destinationstation,jdbcType=VARCHAR},
  195 + </if>
  196 + <if test="fdName != null" >
  197 + #{fdName,jdbcType=VARCHAR},
  198 + </if>
  199 + <if test="arrivedtotalpiece != null" >
  200 + #{arrivedtotalpiece,jdbcType=VARCHAR},
  201 + </if>
  202 + <if test="totalpiecequantity != null" >
  203 + #{totalpiecequantity,jdbcType=VARCHAR},
  204 + </if>
  205 + <if test="arrivedtotalweight != null" >
  206 + #{arrivedtotalweight,jdbcType=VARCHAR},
  207 + </if>
  208 + <if test="grossweightmeasureuc != null" >
  209 + #{grossweightmeasureuc,jdbcType=VARCHAR},
  210 + </if>
  211 + <if test="totalgrossweightmeasure != null" >
  212 + #{totalgrossweightmeasure,jdbcType=VARCHAR},
  213 + </if>
  214 + <if test="totalgrossweightmeasureuc != null" >
  215 + #{totalgrossweightmeasureuc,jdbcType=VARCHAR},
  216 + </if>
  217 + <if test="chargeableweightmeasure != null" >
  218 + #{chargeableweightmeasure,jdbcType=VARCHAR},
  219 + </if>
  220 + <if test="chargeableweightmeasureuc != null" >
  221 + #{chargeableweightmeasureuc,jdbcType=VARCHAR},
  222 + </if>
  223 + <if test="arriveddate != null" >
  224 + #{arriveddate,jdbcType=TIMESTAMP},
  225 + </if>
  226 + <if test="transportsplitdescription != null" >
  227 + #{transportsplitdescription,jdbcType=VARCHAR},
  228 + </if>
  229 + <if test="customscode != null" >
  230 + #{customscode,jdbcType=VARCHAR},
  231 + </if>
  232 + <if test="productname != null" >
  233 + #{productname,jdbcType=VARCHAR},
  234 + </if>
  235 + <if test="status != null" >
  236 + #{status,jdbcType=VARCHAR},
  237 + </if>
  238 + <if test="receiptinformation != null" >
  239 + #{receiptinformation,jdbcType=VARCHAR},
  240 + </if>
  241 + <if test="createdate != null" >
  242 + #{createdate,jdbcType=TIMESTAMP},
  243 + </if>
  244 + </trim>
  245 + </insert>
  246 + <update id="updateByPrimaryKeySelective" parameterType="com.example.demo.model.NMS_FSU_FOH" >
  247 + update ARRIVEDMASTER
  248 + <set >
  249 + <if test="waybillnomaster != null" >
  250 + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR},
  251 + </if>
  252 + <if test="tcdName != null" >
  253 + TCD_NAME = #{tcdName,jdbcType=VARCHAR},
  254 + </if>
  255 + <if test="tcdTypecode != null" >
  256 + TCD_TYPECODE = #{tcdTypecode,jdbcType=VARCHAR},
  257 + </if>
  258 + <if test="flightno != null" >
  259 + FLIGHTNO = #{flightno,jdbcType=VARCHAR},
  260 + </if>
  261 + <if test="flightdate != null" >
  262 + FLIGHTDATE = #{flightdate,jdbcType=TIMESTAMP},
  263 + </if>
  264 + <if test="carrier != null" >
  265 + CARRIER = #{carrier,jdbcType=VARCHAR},
  266 + </if>
  267 + <if test="originatingstation != null" >
  268 + ORIGINATINGSTATION = #{originatingstation,jdbcType=VARCHAR},
  269 + </if>
  270 + <if test="oName != null" >
  271 + O_NAME = #{oName,jdbcType=VARCHAR},
  272 + </if>
  273 + <if test="destinationstation != null" >
  274 + DESTINATIONSTATION = #{destinationstation,jdbcType=VARCHAR},
  275 + </if>
  276 + <if test="fdName != null" >
  277 + FD_NAME = #{fdName,jdbcType=VARCHAR},
  278 + </if>
  279 + <if test="arrivedtotalpiece != null" >
  280 + ARRIVEDTOTALPIECE = #{arrivedtotalpiece,jdbcType=VARCHAR},
  281 + </if>
  282 + <if test="totalpiecequantity != null" >
  283 + TOTALPIECEQUANTITY = #{totalpiecequantity,jdbcType=VARCHAR},
  284 + </if>
  285 + <if test="arrivedtotalweight != null" >
  286 + ARRIVEDTOTALWEIGHT = #{arrivedtotalweight,jdbcType=VARCHAR},
  287 + </if>
  288 + <if test="grossweightmeasureuc != null" >
  289 + GROSSWEIGHTMEASUREUC = #{grossweightmeasureuc,jdbcType=VARCHAR},
  290 + </if>
  291 + <if test="totalgrossweightmeasure != null" >
  292 + TOTALGROSSWEIGHTMEASURE = #{totalgrossweightmeasure,jdbcType=VARCHAR},
  293 + </if>
  294 + <if test="totalgrossweightmeasureuc != null" >
  295 + TOTALGROSSWEIGHTMEASUREUC = #{totalgrossweightmeasureuc,jdbcType=VARCHAR},
  296 + </if>
  297 + <if test="chargeableweightmeasure != null" >
  298 + CHARGEABLEWEIGHTMEASURE = #{chargeableweightmeasure,jdbcType=VARCHAR},
  299 + </if>
  300 + <if test="chargeableweightmeasureuc != null" >
  301 + CHARGEABLEWEIGHTMEASUREUC = #{chargeableweightmeasureuc,jdbcType=VARCHAR},
  302 + </if>
  303 + <if test="arriveddate != null" >
  304 + ARRIVEDDATE = #{arriveddate,jdbcType=TIMESTAMP},
  305 + </if>
  306 + <if test="transportsplitdescription != null" >
  307 + TRANSPORTSPLITDESCRIPTION = #{transportsplitdescription,jdbcType=VARCHAR},
  308 + </if>
  309 + <if test="customscode != null" >
  310 + CUSTOMSCODE = #{customscode,jdbcType=VARCHAR},
  311 + </if>
  312 + <if test="productname != null" >
  313 + PRODUCTNAME = #{productname,jdbcType=VARCHAR},
  314 + </if>
  315 + <if test="status != null" >
  316 + STATUS = #{status,jdbcType=VARCHAR},
  317 + </if>
  318 + <if test="receiptinformation != null" >
  319 + RECEIPTINFORMATION = #{receiptinformation,jdbcType=VARCHAR},
  320 + </if>
  321 + <if test="createdate != null" >
  322 + CREATEDATE = #{createdate,jdbcType=TIMESTAMP},
  323 + </if>
  324 + </set>
  325 + where AUTOID = #{autoid,jdbcType=VARCHAR}
  326 + </update>
  327 + <update id="updateByPrimaryKey" parameterType="com.example.demo.model.NMS_FSU_FOH" >
  328 + update ARRIVEDMASTER
  329 + set WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR},
  330 + TCD_NAME = #{tcdName,jdbcType=VARCHAR},
  331 + TCD_TYPECODE = #{tcdTypecode,jdbcType=VARCHAR},
  332 + FLIGHTNO = #{flightno,jdbcType=VARCHAR},
  333 + FLIGHTDATE = #{flightdate,jdbcType=TIMESTAMP},
  334 + CARRIER = #{carrier,jdbcType=VARCHAR},
  335 + ORIGINATINGSTATION = #{originatingstation,jdbcType=VARCHAR},
  336 + O_NAME = #{oName,jdbcType=VARCHAR},
  337 + DESTINATIONSTATION = #{destinationstation,jdbcType=VARCHAR},
  338 + FD_NAME = #{fdName,jdbcType=VARCHAR},
  339 + ARRIVEDTOTALPIECE = #{arrivedtotalpiece,jdbcType=VARCHAR},
  340 + TOTALPIECEQUANTITY = #{totalpiecequantity,jdbcType=VARCHAR},
  341 + ARRIVEDTOTALWEIGHT = #{arrivedtotalweight,jdbcType=VARCHAR},
  342 + GROSSWEIGHTMEASUREUC = #{grossweightmeasureuc,jdbcType=VARCHAR},
  343 + TOTALGROSSWEIGHTMEASURE = #{totalgrossweightmeasure,jdbcType=VARCHAR},
  344 + TOTALGROSSWEIGHTMEASUREUC = #{totalgrossweightmeasureuc,jdbcType=VARCHAR},
  345 + CHARGEABLEWEIGHTMEASURE = #{chargeableweightmeasure,jdbcType=VARCHAR},
  346 + CHARGEABLEWEIGHTMEASUREUC = #{chargeableweightmeasureuc,jdbcType=VARCHAR},
  347 + ARRIVEDDATE = #{arriveddate,jdbcType=TIMESTAMP},
  348 + TRANSPORTSPLITDESCRIPTION = #{transportsplitdescription,jdbcType=VARCHAR},
  349 + CUSTOMSCODE = #{customscode,jdbcType=VARCHAR},
  350 + PRODUCTNAME = #{productname,jdbcType=VARCHAR},
  351 + STATUS = #{status,jdbcType=VARCHAR},
  352 + RECEIPTINFORMATION = #{receiptinformation,jdbcType=VARCHAR},
  353 + CREATEDATE = #{createdate,jdbcType=TIMESTAMP}
  354 + where AUTOID = #{autoid,jdbcType=VARCHAR}
  355 + </update>
  356 +</mapper>
@@ -237,7 +237,8 @@ public class FWBDemo { @@ -237,7 +237,8 @@ public class FWBDemo {
237 long beginTime = System.currentTimeMillis(); 237 long beginTime = System.currentTimeMillis();
238 238
239 try{ 239 try{
240 - Map<String, Object> map = XML2ENTITY.Dom2Map(doc); 240 + XML2ENTITY xml2ENTITY = new XML2ENTITY();
  241 + Map<String, Object> map = xml2ENTITY.Dom2Map(doc);
241 T_TXD_FWB fwb= new T_TXD_FWB(); 242 T_TXD_FWB fwb= new T_TXD_FWB();
242 //fwb.setFid(getBigDecimal(1)); 243 //fwb.setFid(getBigDecimal(1));
243 fwb.setMessageBakId(getBigDecimal(1)); 244 fwb.setMessageBakId(getBigDecimal(1));
  1 +package com.example.demo;
  2 +
  3 +import com.example.demo.util.Date.DateUtil;
  4 +import com.example.demo.util.Helper;
  5 +import org.apache.commons.io.FileUtils;
  6 +
  7 +import java.io.File;
  8 +import java.io.IOException;
  9 +
  10 +public class FileTest {
  11 + private static String rootDirectory = "errorLogs";
  12 + private static String Cherector = "UTF-8";
  13 +
  14 + public static void main(String[] args) throws IOException {
  15 + writeFile("/PFFM/","test我是谁");
  16 + }
  17 + public static void writeFile(String path,String content){
  18 + String filename=rootDirectory + path + DateUtil.getToday()+"/"+ Helper.getUUID()+".log";
  19 + File file = new File(filename);
  20 + try{
  21 +
  22 + FileUtils.writeStringToFile(file,content,Cherector);
  23 + }catch (IOException e){
  24 + e.printStackTrace();
  25 + }
  26 +
  27 + }
  28 +}
@@ -1176,12 +1176,10 @@ public class XmlToMapDemo { @@ -1176,12 +1176,10 @@ public class XmlToMapDemo {
1176 1176
1177 long beginTime = System.currentTimeMillis(); 1177 long beginTime = System.currentTimeMillis();
1178 1178
1179 - Map<String, Object> map = XML2ENTITY.Dom2Map(doc);  
1180 -  
1181 // 头部解析 1179 // 头部解析
1182 - Map metamap = (Map) map.get("META");  
1183 - String SEDR = (String) metamap.get("SNDR");  
1184 - logger.info(SEDR); 1180 +
  1181 + XML2ENTITY xml2ENTITY = new XML2ENTITY();
  1182 + Map<String, Object> map = xml2ENTITY.Dom2Map(doc); map.get("META");
1185 1183
1186 //报体解析入口 1184 //报体解析入口
1187 Map LogisticsTransportManifest = (Map) map.get("LogisticsTransportManifest"); 1185 Map LogisticsTransportManifest = (Map) map.get("LogisticsTransportManifest");