正在显示
44 个修改的文件
包含
2913 行增加
和
75 行删除
src/java/com/airport/Main.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport; | ||
7 | + | ||
8 | +import com.airport.core.AgentSender; | ||
9 | +import com.airport.core.IMFNoDelaySender; | ||
10 | +import com.airport.core.IMFReader; | ||
11 | +import com.airport.core.ZYFNoDelaySender; | ||
12 | +import com.airport.util.ConfigUtils; | ||
13 | +import com.airport.util.SystemBean; | ||
14 | +import com.caac.imf.api.IMFClient; | ||
15 | +import com.caac.imf.api.IMFClientFactory; | ||
16 | +import java.util.Timer; | ||
17 | +import org.apache.log4j.Logger; | ||
18 | +import org.apache.log4j.PropertyConfigurator; | ||
19 | +import sun.management.Agent; | ||
20 | + | ||
21 | +public class Main { | ||
22 | + private static final Logger logger = Logger.getLogger(Main.class); | ||
23 | + public static boolean LOGIN_OK = false; | ||
24 | + public static boolean isSuc = true; | ||
25 | + public static IMFClient client = null; | ||
26 | + | ||
27 | + | ||
28 | + public Main() { | ||
29 | + } | ||
30 | + | ||
31 | + private static void start() throws Exception { | ||
32 | + PropertyConfigurator.configure("config/log4j.properties"); | ||
33 | + SystemBean.createInstance("config/ApplicationContext.xml"); | ||
34 | + ConfigUtils conf = new ConfigUtils(); | ||
35 | + conf.Initialize(); | ||
36 | + client = IMFClientFactory.createInstance(); | ||
37 | + if ("R".equalsIgnoreCase(ConfigUtils.ROLE)) { | ||
38 | + if (client != null) { | ||
39 | + IMFReader reader = new IMFReader(client); | ||
40 | + reader.start(); | ||
41 | + } | ||
42 | + | ||
43 | + loginIMF(client, ConfigUtils.IMF_USERNAME, ConfigUtils.IMF_PASSWORD, "config/imf_config.properties"); | ||
44 | + } else if ("S".equalsIgnoreCase(ConfigUtils.ROLE)) { | ||
45 | + loginIMF(client, ConfigUtils.IMF_USERNAME, ConfigUtils.IMF_PASSWORD, "config/imf_config.properties"); | ||
46 | + if (LOGIN_OK && client != null) { | ||
47 | + logger.info("start run Timer,client hasocde=" + client.hashCode()); | ||
48 | + | ||
49 | + while (true){ | ||
50 | + if(!AgentSender.isrunning){ | ||
51 | + AgentSender send = new AgentSender(client); | ||
52 | + send.start(); | ||
53 | + } | ||
54 | + try { | ||
55 | + Thread.sleep(50000); | ||
56 | + } catch (Exception e) { | ||
57 | + e.printStackTrace(); | ||
58 | + logger.info(e.getMessage()); | ||
59 | + } | ||
60 | + | ||
61 | + } | ||
62 | + | ||
63 | + //代理人发送程序 | ||
64 | + | ||
65 | + | ||
66 | + //数据仓库给九州的发送程序 | ||
67 | +// Timer timer = new Timer(); | ||
68 | + | ||
69 | +// //从配置文件读取sql语句,发送货运数据 | ||
70 | +// String sql_select=ConfigUtils.SQl; | ||
71 | +// String sqlmax = ConfigUtils.SQlMax; | ||
72 | +// ZYFNoDelaySender CangKu2Jiuzhou = new ZYFNoDelaySender(client,"data/fid_index.txt",sql_select,sqlmax); | ||
73 | +// CangKu2Jiuzhou.start(); | ||
74 | +// timer.schedule(CangKu2Jiuzhou, 10000L, 1200000L); | ||
75 | + | ||
76 | + } | ||
77 | + } | ||
78 | + | ||
79 | + } | ||
80 | + | ||
81 | + private static void loginIMF(IMFClient client, String userName, String password, String confFileName) { | ||
82 | + if (client.initial(confFileName)) { | ||
83 | + String message = client.login(userName, password); | ||
84 | + logger.info("message=" + message); | ||
85 | + if (message.indexOf("<CODE>1</CODE>") > 0) { | ||
86 | + logger.info("登陆成功"); | ||
87 | + LOGIN_OK = true; | ||
88 | + } else { | ||
89 | + int times = 0; | ||
90 | + | ||
91 | + while(times <= 3) { | ||
92 | + logger.info("try connection..."); | ||
93 | + ++times; | ||
94 | + logger.info("message.=" + message); | ||
95 | + if (message.indexOf("<CODE>1</CODE>") > 0) { | ||
96 | + logger.info("登陆成功"); | ||
97 | + LOGIN_OK = true; | ||
98 | + break; | ||
99 | + } | ||
100 | + | ||
101 | + logger.info("登录失败~~~~"); | ||
102 | + message = client.login(userName, password); | ||
103 | + | ||
104 | + try { | ||
105 | + Thread.sleep(4000L); | ||
106 | + } catch (InterruptedException var7) { | ||
107 | + var7.printStackTrace(); | ||
108 | + } | ||
109 | + } | ||
110 | + | ||
111 | + if (!LOGIN_OK) { | ||
112 | + logger.info("多次尝试登录失败,退出登陆"); | ||
113 | + client.disconnect(); | ||
114 | + isSuc =false; | ||
115 | + System.exit(-1); | ||
116 | + } | ||
117 | + } | ||
118 | + } | ||
119 | + | ||
120 | + } | ||
121 | + | ||
122 | + public static void main(String[] args) throws Exception { | ||
123 | + start(); | ||
124 | + } | ||
125 | +} |
src/java/com/airport/bean/MessageBak.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.bean; | ||
7 | + | ||
8 | +public class MessageBak { | ||
9 | + private int fid; | ||
10 | + private String content; | ||
11 | + private int rownum_; | ||
12 | + | ||
13 | + public MessageBak(int fid, String content) { | ||
14 | + this.fid = fid; | ||
15 | + this.content = content; | ||
16 | + } | ||
17 | + | ||
18 | + public MessageBak(int fid, String content,int rownum_) { | ||
19 | + this.fid = fid; | ||
20 | + this.content = content; | ||
21 | + this.rownum_ = rownum_; | ||
22 | + } | ||
23 | + | ||
24 | + public String toString() { | ||
25 | + return this.fid + " " + this.content; | ||
26 | + } | ||
27 | + | ||
28 | + public int getFid() { | ||
29 | + return this.fid; | ||
30 | + } | ||
31 | + | ||
32 | + public void setFid(int fid) { | ||
33 | + this.fid = fid; | ||
34 | + } | ||
35 | + | ||
36 | + public String getContent() { | ||
37 | + return this.content; | ||
38 | + } | ||
39 | + | ||
40 | + public void setContent(String content) { | ||
41 | + this.content = content; | ||
42 | + } | ||
43 | + | ||
44 | + public int getRownum_() { | ||
45 | + return rownum_; | ||
46 | + } | ||
47 | + | ||
48 | + public void setRownum_(int rownum_) { | ||
49 | + this.rownum_ = rownum_; | ||
50 | + } | ||
51 | +} |
src/java/com/airport/bean/XMLHeader.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.bean; | ||
7 | + | ||
8 | +public class XMLHeader { | ||
9 | + private String sndr; | ||
10 | + private String rcvr; | ||
11 | + private String type; | ||
12 | + private String stype; | ||
13 | + | ||
14 | + public XMLHeader() { | ||
15 | + } | ||
16 | + | ||
17 | + public String toString() { | ||
18 | + return "sndr=[" + this.sndr + "]\t rcvr=[" + this.rcvr + "]\t type=[" + this.type + "]\t stype=[" + this.stype + "]"; | ||
19 | + } | ||
20 | + | ||
21 | + public String getSndr() { | ||
22 | + return this.sndr; | ||
23 | + } | ||
24 | + | ||
25 | + public void setSndr(String sndr) { | ||
26 | + this.sndr = sndr; | ||
27 | + } | ||
28 | + | ||
29 | + public String getRcvr() { | ||
30 | + return this.rcvr; | ||
31 | + } | ||
32 | + | ||
33 | + public void setRcvr(String rcvr) { | ||
34 | + this.rcvr = rcvr; | ||
35 | + } | ||
36 | + | ||
37 | + public String getType() { | ||
38 | + return this.type; | ||
39 | + } | ||
40 | + | ||
41 | + public void setType(String type) { | ||
42 | + this.type = type; | ||
43 | + } | ||
44 | + | ||
45 | + public String getStype() { | ||
46 | + return this.stype; | ||
47 | + } | ||
48 | + | ||
49 | + public void setStype(String stype) { | ||
50 | + this.stype = stype; | ||
51 | + } | ||
52 | +} |
src/java/com/airport/core/AgentSender.java
0 → 100644
1 | +package com.airport.core; | ||
2 | + | ||
3 | +import com.airport.Main; | ||
4 | +import org.apache.log4j.Logger; | ||
5 | +import com.caac.imf.api.IMFClient; | ||
6 | + | ||
7 | +import redis.clients.jedis.Jedis; | ||
8 | + | ||
9 | + | ||
10 | +public class AgentSender extends Thread{ | ||
11 | + | ||
12 | + private static final Logger logger = Logger.getLogger(AgentSender.class); | ||
13 | + | ||
14 | + public static boolean isrunning; | ||
15 | + | ||
16 | + Jedis jedis = new Jedis("10.50.3.73", 6379); | ||
17 | + | ||
18 | + private IMFClient client; | ||
19 | + | ||
20 | + public AgentSender(IMFClient client){ | ||
21 | + this.client = client; | ||
22 | + } | ||
23 | + | ||
24 | + | ||
25 | + public void run(){ | ||
26 | + logger.info(jedis); | ||
27 | + | ||
28 | + try { | ||
29 | + | ||
30 | + if (this.client == null) { | ||
31 | + logger.info("IMFClient has been closed"); | ||
32 | + return; | ||
33 | + } | ||
34 | + isrunning=true; | ||
35 | + if(Main.isSuc){ | ||
36 | + logger.info("《《《主线程初始化成功。。。。》》》"); | ||
37 | + if(Main.LOGIN_OK){ | ||
38 | + logger.info("《《《登录成功开始轮询500mm一次。。。。》》》"); | ||
39 | + while(true){ | ||
40 | + String SendMsg = jedis.rpoplpush("task-queue", "tmp-queue"); //取队列消息 | ||
41 | + //队列消息不为NULL开始发送 | ||
42 | + if(SendMsg !=null && SendMsg.length() != 0){ | ||
43 | + | ||
44 | + String returnMsg = this.client.sendMSG(SendMsg); | ||
45 | + logger.debug("<<发送返回的信息:"+returnMsg+">>"); | ||
46 | + | ||
47 | + //9是发送成功 | ||
48 | + if(returnMsg.indexOf("<CODE>9</CODE>")>=0){ | ||
49 | + try { | ||
50 | + jedis.rpop("tmp-queue"); | ||
51 | + logger.debug("<<移除队列>>"); | ||
52 | + } catch (Exception e) { | ||
53 | + e.printStackTrace(); | ||
54 | + logger.info(e.getMessage()); | ||
55 | + logger.info("!!移除队列失败!!"); | ||
56 | + } | ||
57 | + | ||
58 | + | ||
59 | + }else{ | ||
60 | + //如果发送不成功继续发送 | ||
61 | + try{ | ||
62 | + jedis.rpoplpush("tmp-queue", "task-queue"); | ||
63 | + logger.info("!!<<执行未成功发送的消息返回到发送消息队列>>!!"); | ||
64 | + }catch (Exception e){ | ||
65 | + e.printStackTrace(); | ||
66 | + logger.info(e.getMessage()); | ||
67 | + logger.info("!!回写TMP到TASK队列失败!!"); | ||
68 | + } | ||
69 | + | ||
70 | + | ||
71 | + } | ||
72 | + | ||
73 | + | ||
74 | + } | ||
75 | + | ||
76 | + //发送延迟 | ||
77 | + try { | ||
78 | + Thread.sleep(500); | ||
79 | + } catch (Exception e) { | ||
80 | + e.printStackTrace(); | ||
81 | + logger.info(e.getMessage()); | ||
82 | + } | ||
83 | + } | ||
84 | + }else{ | ||
85 | + logger.info("---------登陆中"); | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | + }catch (Exception var14) { | ||
90 | + var14.printStackTrace(); | ||
91 | + logger.info(var14.getMessage()); | ||
92 | + } | ||
93 | + | ||
94 | + | ||
95 | + | ||
96 | + | ||
97 | + isrunning=false; | ||
98 | + logger.info("---------线程不在了"); | ||
99 | + } | ||
100 | + | ||
101 | +} |
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.core; | ||
7 | + | ||
8 | +import com.airport.bean.MessageBak; | ||
9 | +import com.airport.bean.XMLHeader; | ||
10 | +import com.airport.dao.Dao; | ||
11 | +import com.airport.dao.impl.DaoImpl; | ||
12 | +import com.airport.util.ConfigUtils; | ||
13 | +import com.airport.util.SystemBean; | ||
14 | +import com.airport.util.Utils; | ||
15 | +import com.airport.util.parse.IMFXMLMaker; | ||
16 | +import com.airport.util.parse.XMPParse; | ||
17 | +import com.caac.imf.api.IMFClient; | ||
18 | +import org.apache.commons.lang.StringUtils; | ||
19 | +import org.apache.log4j.Logger; | ||
20 | + | ||
21 | +import java.util.Iterator; | ||
22 | +import java.util.List; | ||
23 | +import java.util.Map; | ||
24 | +import java.util.TimerTask; | ||
25 | + | ||
26 | +public class IMFNoDelaySender extends Thread{ | ||
27 | + private static final Logger logger = Logger.getLogger(IMFNoDelaySender.class); | ||
28 | + private Dao dao = (DaoImpl)SystemBean.getBean("dao"); | ||
29 | + private IMFClient client; | ||
30 | + private String indexFileName; //记录发送数据的节点 | ||
31 | + private String sql; | ||
32 | + private String sqlMax; | ||
33 | + | ||
34 | + public IMFNoDelaySender(IMFClient client, String fileName,String sql,String sqlMax) { | ||
35 | + this.indexFileName = fileName; | ||
36 | + this.client = client; | ||
37 | + this.sql=sql; | ||
38 | + this.sqlMax=sqlMax; | ||
39 | + } | ||
40 | + | ||
41 | + public synchronized void run() { | ||
42 | + try { | ||
43 | + | ||
44 | + if (this.client == null) { | ||
45 | + logger.info("IMFClient has been closed"); | ||
46 | + return; | ||
47 | + } | ||
48 | + | ||
49 | + while(true) { | ||
50 | + //初始化读取 | ||
51 | + logger.info("job start,发送线程开始["+Thread.currentThread().getName()+"]"); | ||
52 | + int lastFID = Utils.readFIDIndex(this.indexFileName); | ||
53 | + int maxFID = this.dao.getMaxFID(sqlMax); | ||
54 | + logger.info("lastROW=" + lastFID + " maxCount=" + maxFID); | ||
55 | + int is_ok = 0; | ||
56 | + | ||
57 | + if (maxFID > lastFID) { | ||
58 | + //这里修改从FID_INDEX文件读取的FID ,改为取搜索结果的rownum,此处FID代表ROWNUM | ||
59 | + String sqlformat = String.format(sql, lastFID, lastFID, ConfigUtils.RECORD_COUNT); | ||
60 | + logger.info(sqlformat); | ||
61 | + List<MessageBak> list = this.dao.getRecordByFID(lastFID,sqlformat); //查询大于[FID]350的报文 | ||
62 | + //如果两个发送者,要用到这里 | ||
63 | + Map<Integer, XMLHeader> map = ConfigUtils.XML_HEADER_MAP; | ||
64 | + Iterator var7 = list.iterator(); | ||
65 | + | ||
66 | + while(var7.hasNext()) { | ||
67 | + MessageBak m = (MessageBak)var7.next(); | ||
68 | + if (is_ok != 0) { | ||
69 | + logger.error("记录FID时发生异常,发送消息任务被迫中断"); | ||
70 | + return; | ||
71 | + } | ||
72 | + | ||
73 | + if (m.getContent() != null) { | ||
74 | + int times = 0; | ||
75 | + //配置文件里面有几个sender 这里循环几次 | ||
76 | + for(Iterator var10 = map.keySet().iterator(); var10.hasNext(); times++) { | ||
77 | + Integer key = (Integer)var10.next(); | ||
78 | + XMLHeader header = (XMLHeader)map.get(key); | ||
79 | + logger.info("key=" + key + " value=" + ((XMLHeader)map.get(key)).toString()); | ||
80 | + logger.info("准备发送数据 FID:" + m.getFid() + " XML.length=:" + m.getContent().length()); | ||
81 | + | ||
82 | + | ||
83 | + //初始化最终发布报文内容的存储器 | ||
84 | + String sendMsg = ""; | ||
85 | + String xmlStr = m.getContent(); | ||
86 | +//_____________________________________解析华东的报文给九州------------------------------------------------------------------------------------------- | ||
87 | + if (xmlStr.contains("<MessageType>IS1</MessageType>")){ | ||
88 | + IMFXMLMaker haiguanXml = new IMFXMLMaker(header.getSndr(),Integer.toString(m.getFid()),"DFME","IS1"); | ||
89 | + haiguanXml.setIMFContent(m.getContent()); | ||
90 | + sendMsg = haiguanXml.finalXmlStr(); | ||
91 | + }else if(xmlStr.contains("<MessageType>ES1</MessageType>") ){ | ||
92 | + IMFXMLMaker haiguanXml = new IMFXMLMaker(header.getSndr(),Integer.toString(m.getFid()),"DFME","ES1"); | ||
93 | + haiguanXml.setIMFContent(m.getContent()); | ||
94 | + sendMsg = haiguanXml.finalXmlStr(); | ||
95 | + }else if(xmlStr.contains("<MessageType>CLR</MessageType>")){ | ||
96 | + IMFXMLMaker haiguanXml = new IMFXMLMaker(header.getSndr(),Integer.toString(m.getFid()),"DFME","CLR"); | ||
97 | + haiguanXml.setIMFContent(m.getContent()); | ||
98 | + sendMsg = haiguanXml.finalXmlStr(); | ||
99 | + }else if(xmlStr.contains("<MessageType>RSC</MessageType>")){ | ||
100 | + IMFXMLMaker haiguanXml = new IMFXMLMaker(header.getSndr(),Integer.toString(m.getFid()),"DFME","RSC"); | ||
101 | + haiguanXml.setIMFContent(m.getContent()); | ||
102 | + sendMsg = haiguanXml.finalXmlStr(); | ||
103 | + } else { | ||
104 | +//_____________________________________解析天信达的报文,读取配置文件,替换相关参数给九州------------------------------------------------------------------------------------------- | ||
105 | + sendMsg= Utils.searchReplace(m.getContent(), header.getSndr(), "SNDR"); | ||
106 | + sendMsg = Utils.searchReplace(sendMsg, header.getType(), "TYPE"); //替换报文主类型 | ||
107 | + | ||
108 | + String stype = tranlateXML(m.getContent()); | ||
109 | + sendMsg = Utils.searchReplace(sendMsg, stype, "STYP"); | ||
110 | + sendMsg = Utils.searchReplaceSingle(sendMsg, header.getRcvr(), "RCVR"); | ||
111 | + } | ||
112 | +//_____________________________________给多式联运的航空报文,读取配置文件,生成新的META,并把最原始的报文封装到新报文的content里面-------------------------------------------------------------------- | ||
113 | +// String sndr = header.getSndr(); | ||
114 | +// String type = header.getType(); | ||
115 | +// String styp = header.getStype(); | ||
116 | +// | ||
117 | +// IMFXMLMaker newXml = new IMFXMLMaker(sndr,Integer.toString(m.getFid()),type,styp); | ||
118 | +// newXml.setIMFContent(m.getContent()); | ||
119 | +// sendMsg = newXml.finalXmlStr(); | ||
120 | + | ||
121 | + if (!"".equals(sendMsg)) { | ||
122 | + sendXml(sendMsg); | ||
123 | + is_ok = Utils.writeFIDIndex(this.indexFileName, m.getRownum_()); //发送成功写入节点文件 | ||
124 | + logger.debug("FID:" + m.getFid() + " 缓存成功"); | ||
125 | + ++times; | ||
126 | + } else { | ||
127 | + logger.error("查找替换节点数据出现异常,可能找不到这个节点,原始XML=" + m.getContent()); | ||
128 | + } | ||
129 | + } | ||
130 | + | ||
131 | +// this.dao.update(m.getFid(), times); | ||
132 | + } else { | ||
133 | + logger.info("FID=" + m.getFid() + "XML is null "); | ||
134 | + } | ||
135 | + } | ||
136 | + }else { | ||
137 | + try { | ||
138 | + Thread.sleep(100000L); | ||
139 | + logger.info("发送线程》》》"+Thread.currentThread().getName()+"休眠"); | ||
140 | + } catch (InterruptedException var3) { | ||
141 | + var3.printStackTrace(); | ||
142 | + } | ||
143 | + } | ||
144 | + } | ||
145 | + | ||
146 | + }catch (Exception var14) { | ||
147 | + var14.printStackTrace(); | ||
148 | + logger.info(var14.getMessage()); | ||
149 | + } | ||
150 | + } | ||
151 | + | ||
152 | + public synchronized void sendXml(String msg){ | ||
153 | + logger.info("线程:::"+Thread.currentThread().getName()+"开始发送数据 XML:" + msg); | ||
154 | + String is_send_ok = this.client.sendMSG(msg); | ||
155 | + logger.info("发送回执=" + is_send_ok); | ||
156 | + } | ||
157 | + | ||
158 | + private static String tranlateXML(String xml) throws Exception { | ||
159 | + String stype = XMPParse.getNodeValueFromXmlString(xml, "/MSG/META/STYP"); | ||
160 | + if (!StringUtils.isBlank(stype)) { | ||
161 | + if (ConfigUtils.XTYPE_MAP.containsKey(stype)) { | ||
162 | + stype = (String)ConfigUtils.XTYPE_MAP.get(stype); | ||
163 | + } else { | ||
164 | + logger.info("stype=" + stype + " 在对应关系里找不到这个KEY"); | ||
165 | + } | ||
166 | + } else { | ||
167 | + logger.info(" 在XML找不到STYPE这个节点"); | ||
168 | + stype = ""; | ||
169 | + } | ||
170 | + | ||
171 | + return stype; | ||
172 | + } | ||
173 | +} |
src/java/com/airport/core/IMFReader.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.core; | ||
7 | + | ||
8 | +import com.airport.Main; | ||
9 | +import com.airport.dao.impl.DaoImpl; | ||
10 | +import com.airport.util.SystemBean; | ||
11 | +import com.airport.util.Utils; | ||
12 | +import com.airport.util.parse.XMPParse; | ||
13 | +import com.caac.imf.api.IMFClient; | ||
14 | +import java.util.Date; | ||
15 | +import org.apache.log4j.Logger; | ||
16 | + | ||
17 | +public class IMFReader extends Thread { | ||
18 | + private static final Logger logger = Logger.getLogger(IMFReader.class); | ||
19 | + private static final String stype = "/MSG/META/STYP"; | ||
20 | + private IMFClient client; | ||
21 | + | ||
22 | + public IMFReader(IMFClient client) { | ||
23 | + this.client = client; | ||
24 | + } | ||
25 | + | ||
26 | + public void run() { | ||
27 | + while(true) { | ||
28 | + if (Main.LOGIN_OK) { | ||
29 | + synchronized(this) { | ||
30 | + String message = this.client.getMSG(); | ||
31 | + if (message != null) { | ||
32 | + this.save(message); | ||
33 | + } | ||
34 | + } | ||
35 | + } else { | ||
36 | + //logger.info("***"); | ||
37 | + } | ||
38 | + | ||
39 | + try { | ||
40 | + Thread.sleep(100L); | ||
41 | + } catch (InterruptedException var3) { | ||
42 | + var3.printStackTrace(); | ||
43 | + } | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | + private void save(String message) { | ||
48 | + Date dt = new Date(); | ||
49 | + DaoImpl dao = (DaoImpl)SystemBean.getBean("dao"); | ||
50 | + String path = "data/" + Utils.dateToStr(dt, "yyyy-MM-dd") + "/"; | ||
51 | + if (Utils.createDir(path)) { | ||
52 | + String fileName = ""; | ||
53 | + | ||
54 | + try { | ||
55 | + String stype_value = XMPParse.getNodeValueFromXmlString(message, "/MSG/META/STYP"); | ||
56 | + String type_value = XMPParse.getNodeValueFromXmlString(message, "/MSG/META/TYPE"); | ||
57 | + String sender_value = XMPParse.getNodeValueFromXmlString(message, "/MSG/META/SNDR"); | ||
58 | + String sntm_value = XMPParse.getNodeValueFromXmlString(message, "/MSG/META/DDTM"); | ||
59 | + String seqn_value = XMPParse.getNodeValueFromXmlString(message, "/MSG/META/SEQN"); | ||
60 | + | ||
61 | +// fileName = path + stype_value + "_" + Utils.dateToStr(dt, "yyyyMMddhhmmssSSS") + ".xml"; | ||
62 | +// Utils.saveFile(fileName, message); | ||
63 | + dao.saveRecord("ALL", sender_value,sntm_value, message,type_value,stype_value,seqn_value); | ||
64 | +// logger.info("created " + fileName + " ok"); | ||
65 | + } catch (Exception var7) { | ||
66 | + //出错的报文存储到报文目录 | ||
67 | + fileName = path + Utils.dateToStr(dt, "yyyyMMddhhmmssSSS") + ".txt"; | ||
68 | + Utils.saveFile(fileName, message); | ||
69 | + logger.warn("报文入库失败已存储成备份文件:created " + fileName + " ok"); | ||
70 | + logger.error(var7); | ||
71 | + logger.warn(var7); | ||
72 | + } | ||
73 | + } else { | ||
74 | + logger.warn("创建目录失败."); | ||
75 | + logger.warn(message); | ||
76 | + } | ||
77 | + | ||
78 | + } | ||
79 | +} |
src/java/com/airport/dao/Dao.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.dao; | ||
7 | + | ||
8 | +import com.airport.bean.MessageBak; | ||
9 | +import java.util.List; | ||
10 | + | ||
11 | +public interface Dao { | ||
12 | + int insertRecord(String var1, String var2,String var3,String var4,String var5,String var6); | ||
13 | + | ||
14 | + void saveRecord(String var1, String var2, String var3,String var4,String var5,String var6,String var7) throws Exception; | ||
15 | + | ||
16 | + void delete(int var1); | ||
17 | + | ||
18 | + List<MessageBak> getRecordByFID(int var1,String var2); | ||
19 | + | ||
20 | + int getRecordCount(); | ||
21 | + | ||
22 | + int getMaxFID(String var1); | ||
23 | + | ||
24 | + void update(int var1, int var2); | ||
25 | +} |
src/java/com/airport/dao/impl/DaoImpl.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.dao.impl; | ||
7 | + | ||
8 | +import com.airport.bean.MessageBak; | ||
9 | +import com.airport.dao.Dao; | ||
10 | +import com.airport.util.ConfigUtils; | ||
11 | +import java.io.IOException; | ||
12 | +import java.io.Writer; | ||
13 | +import java.sql.Connection; | ||
14 | +import java.sql.PreparedStatement; | ||
15 | +import java.sql.ResultSet; | ||
16 | +import java.sql.SQLException; | ||
17 | +import java.sql.Statement; | ||
18 | +import java.util.ArrayList; | ||
19 | +import java.util.List; | ||
20 | +import oracle.sql.CLOB; | ||
21 | +import org.apache.log4j.Logger; | ||
22 | +import org.springframework.dao.DataAccessException; | ||
23 | +import org.springframework.dao.EmptyResultDataAccessException; | ||
24 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
25 | +import org.springframework.jdbc.core.PreparedStatementCreator; | ||
26 | +import org.springframework.jdbc.core.support.AbstractLobStreamingResultSetExtractor; | ||
27 | +import org.springframework.jdbc.support.GeneratedKeyHolder; | ||
28 | +import org.springframework.jdbc.support.KeyHolder; | ||
29 | +import org.springframework.jdbc.support.lob.DefaultLobHandler; | ||
30 | +import org.springframework.jdbc.support.lob.LobHandler; | ||
31 | + | ||
32 | +public class DaoImpl implements Dao { | ||
33 | + private static final Logger logger = Logger.getLogger(DaoImpl.class); | ||
34 | + private JdbcTemplate jdbcTemplate; | ||
35 | + | ||
36 | + public DaoImpl() { | ||
37 | + } | ||
38 | + | ||
39 | + public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { | ||
40 | + this.jdbcTemplate = jdbcTemplate; | ||
41 | + } | ||
42 | + | ||
43 | + public int insertRecord(final String oper, final String sndr,final String sntm,final String type,final String styp,final String seqn) { | ||
44 | + KeyHolder keyHolder = new GeneratedKeyHolder(); | ||
45 | + this.jdbcTemplate.update(new PreparedStatementCreator() { | ||
46 | + public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { | ||
47 | + DaoImpl.logger.info("oper=" + oper + " sndr=" + sndr+" type="+type+" styp="+styp); | ||
48 | + String sql = "insert into T_ETL_MESSAGE(OPER,SNDR,SNTM,content,TYPE,STYP,SEQN) values(?,?,to_timestamp(?,'yyyyMMddHH24MIssff'),empty_clob(),?,?,?)"; | ||
49 | + PreparedStatement ps = connection.prepareStatement(sql, new String[]{"FID"}); | ||
50 | + ps.setString(1, oper); | ||
51 | + ps.setString(2, sndr); | ||
52 | + ps.setString(3, sntm); | ||
53 | + ps.setString(4, type); | ||
54 | + ps.setString(5, styp); | ||
55 | + ps.setString(6,seqn); | ||
56 | + return ps; | ||
57 | + } | ||
58 | + }, keyHolder); | ||
59 | + int generatedId = keyHolder.getKey().intValue(); | ||
60 | + return generatedId; | ||
61 | + } | ||
62 | + | ||
63 | + public void saveRecord(String messaegType, String sndr,String sntm, String xmlContent,String type,String styp,String seqn) throws Exception { | ||
64 | + Connection conn = null; | ||
65 | + Statement stmt = null; | ||
66 | + ResultSet rs = null; | ||
67 | + int fid = -100; | ||
68 | + | ||
69 | + try { | ||
70 | + fid = this.insertRecord(messaegType, sndr,sntm,type,styp,seqn); | ||
71 | + conn = this.jdbcTemplate.getDataSource().getConnection(); | ||
72 | + conn.setAutoCommit(false); | ||
73 | + stmt = conn.createStatement(); | ||
74 | + String SQL = "select CONTENT from T_ETL_MESSAGE where FID=" + fid + " for update"; | ||
75 | + rs = stmt.executeQuery(SQL); | ||
76 | + | ||
77 | + while(rs.next()) { | ||
78 | + CLOB clob = (CLOB)rs.getClob(1); | ||
79 | + Writer os = clob.getCharacterOutputStream(); | ||
80 | + os.write(xmlContent); | ||
81 | + os.flush(); | ||
82 | + os.close(); | ||
83 | + } | ||
84 | + | ||
85 | + conn.commit(); | ||
86 | + } catch (SQLException var14) { | ||
87 | + if (fid > 0) { | ||
88 | + this.delete(fid); | ||
89 | + } | ||
90 | + | ||
91 | + var14.printStackTrace(); | ||
92 | + conn.rollback(); | ||
93 | + } finally { | ||
94 | + if (conn != null) { | ||
95 | + conn.setAutoCommit(true); | ||
96 | + } | ||
97 | + | ||
98 | + if (rs != null) { | ||
99 | + rs.close(); | ||
100 | + } | ||
101 | + | ||
102 | + if (stmt != null) { | ||
103 | + stmt.close(); | ||
104 | + } | ||
105 | + | ||
106 | + if (conn != null) { | ||
107 | + conn.close(); | ||
108 | + } | ||
109 | + | ||
110 | + } | ||
111 | + | ||
112 | + } | ||
113 | + | ||
114 | + public void delete(int fid) { | ||
115 | + this.jdbcTemplate.update("delete from T_ETL_MESSAGE where fid=" + fid); | ||
116 | + } | ||
117 | + | ||
118 | + public int getMaxFID(String sqlmax) { | ||
119 | +// String sqlmax = "select max(fid) from MESSAGE_BAK WHERE (FID>%s and FID<%s+%s) AND (TYPE='CLR' OR TYPE='ES1' OR TYPE='IS1' OR STYP = 'BSTA' OR STYP = 'FZE_RCF' OR STYP = 'FSU_FOH' OR STYP = 'FSU_DEP' OR STYP = 'COST' OR STYP = 'ABME' OR STYP = 'FZE_DEP' OR STYP = 'FSU_RCF') ORDER BY FID\n"; | ||
120 | +// sqlmax = ConfigUtils.SQlMax; | ||
121 | + return this.jdbcTemplate.queryForInt(sqlmax); | ||
122 | + } | ||
123 | + | ||
124 | + public List<MessageBak> getRecordByFID(int fid,String sql) { | ||
125 | + | ||
126 | + final LobHandler lobHandler = new DefaultLobHandler(); | ||
127 | + final ArrayList xmlList = new ArrayList(); | ||
128 | + | ||
129 | + try { | ||
130 | + this.jdbcTemplate.query(sql, new AbstractLobStreamingResultSetExtractor() { | ||
131 | + protected void streamData(ResultSet rs) throws SQLException, IOException, DataAccessException { | ||
132 | + String content = ""; | ||
133 | + while(rs.next()) { | ||
134 | + int fid = rs.getInt(1); | ||
135 | + content = lobHandler.getClobAsString(rs, "CONTENT"); | ||
136 | + int rownum = rs.getInt("rownum_"); | ||
137 | + if (content != null) { | ||
138 | + MessageBak obj = new MessageBak(fid, content,rownum); | ||
139 | + xmlList.add(obj); | ||
140 | + } else { | ||
141 | + DaoImpl.logger.error("FID=" + fid + " content is NULL"); | ||
142 | + } | ||
143 | + } | ||
144 | + | ||
145 | + } | ||
146 | + }); | ||
147 | + } catch (EmptyResultDataAccessException var7) { | ||
148 | + var7.printStackTrace(); | ||
149 | + } | ||
150 | + | ||
151 | + return xmlList; | ||
152 | + } | ||
153 | + | ||
154 | + public int getRecordCount() { | ||
155 | + return this.jdbcTemplate.queryForInt("select count(*) from T_ETL_MESSAGE where SNDR='FIMS' "); | ||
156 | + } | ||
157 | + | ||
158 | + public void update(int fid, int times) { | ||
159 | + String sql = String.format("update T_ETL_MESSAGE set OUTFLAG=%s ,OUTTM=sysdate where FID=%s", times, fid); | ||
160 | + logger.info("sql=" + sql); | ||
161 | + this.jdbcTemplate.update(sql); | ||
162 | + } | ||
163 | +} |
src/java/com/airport/util/ConfigUtils.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.util; | ||
7 | + | ||
8 | +import com.airport.bean.XMLHeader; | ||
9 | +import java.io.File; | ||
10 | +import java.util.HashMap; | ||
11 | +import java.util.Map; | ||
12 | +import org.apache.commons.lang.StringUtils; | ||
13 | +import org.apache.log4j.Logger; | ||
14 | + | ||
15 | +public class ConfigUtils { | ||
16 | + private static final Logger logger = Logger.getLogger(ConfigUtils.class); | ||
17 | + public static String ROLE; | ||
18 | + public static String IMF_USERNAME; | ||
19 | + public static String IMF_PASSWORD; | ||
20 | + public static final String IFM_CONSUMER = "config/imf_config.properties"; | ||
21 | + public static final String IMF_PRUDUCER = "config/imf_config.properties"; | ||
22 | + public static final String INDEX_FILE_NAME = "data/fid_index.txt"; | ||
23 | + public static int SEND_MESSAGE_INTERVAL = 1; | ||
24 | + public static int RECORD_COUNT = 1000; | ||
25 | + public static String XML_HEADER_SNDR = ""; | ||
26 | + public static String XML_HEADER_TYPE = ""; | ||
27 | + public static String XML_HEADER_STYPE = ""; | ||
28 | + public static String XML_HEADER_RCVR = ""; | ||
29 | + public static Map<Integer, XMLHeader> XML_HEADER_MAP = new HashMap(); | ||
30 | + public static String RCVR = ""; | ||
31 | + public static String APPID = ""; | ||
32 | + public static String SNDR = ""; | ||
33 | + public static String SQl=""; | ||
34 | + public static String SQlMax=""; | ||
35 | + public static String SQl1=""; | ||
36 | + public static String SQlMax1=""; | ||
37 | + public static Map<String, String> XTYPE_MAP = new HashMap(); | ||
38 | + | ||
39 | + public ConfigUtils() { | ||
40 | + } | ||
41 | + private void initMap() { | ||
42 | + XTYPE_MAP.put("FSU_DEP", "UDEP"); | ||
43 | + XTYPE_MAP.put("FSU_RCF", "URCF"); | ||
44 | + XTYPE_MAP.put("FSU_FOH", "UFOH"); | ||
45 | + XTYPE_MAP.put("FZE_DEP", "EDEP"); | ||
46 | + XTYPE_MAP.put("FZE_RCF", "ERCF"); | ||
47 | + XTYPE_MAP.put("FZE_FOH", "EFOH"); | ||
48 | + XTYPE_MAP.put("CARGO_SERV", "CARG"); | ||
49 | + } | ||
50 | + public void Initialize() throws LteException { | ||
51 | + logger.debug("Loading all the config parameters..."); | ||
52 | + this.loadParameter(); | ||
53 | + this.initMap(); | ||
54 | + } | ||
55 | + | ||
56 | + private final void loadParameter() throws LteException { | ||
57 | + boolean ok = false; | ||
58 | + logger.info("================Initialize system parameter ================="); | ||
59 | + Configuration config = (Configuration)SystemBean.getBean("configurationBean"); | ||
60 | + ROLE = config.getProperty("role").trim(); | ||
61 | + IMF_USERNAME = config.getProperty("imf_username").trim(); | ||
62 | + IMF_PASSWORD = config.getProperty("imf_password").trim(); | ||
63 | + SQl = config.getProperty("sql"); | ||
64 | + SQlMax = config.getProperty("sqlmax"); | ||
65 | + SQl1 = config.getProperty("sql1"); | ||
66 | + SQlMax1 = config.getProperty("sqlmax1"); | ||
67 | + String interval = config.getProperty("interval").trim(); | ||
68 | + String record_count = config.getProperty("record_count").trim(); | ||
69 | + logger.info(String.format("role=%s", ROLE)); | ||
70 | + logger.info(String.format("imf_username=%s", IMF_USERNAME)); | ||
71 | + logger.info(String.format("imf_password=%s", IMF_PASSWORD)); | ||
72 | + logger.info(String.format("interval=%s", interval)); | ||
73 | + if (StringUtils.isBlank(ROLE)) { | ||
74 | + logger.error("role 参数错误"); | ||
75 | + ok = true; | ||
76 | + } else if ("R".equalsIgnoreCase(ROLE)) { | ||
77 | + if (!isFileExists("config/imf_config.properties")) { | ||
78 | + logger.error("如果要从IMF接收数据,需要在config/imf_config.properties 配置IMF参数"); | ||
79 | + ok = true; | ||
80 | + } | ||
81 | + } else if ("S".equalsIgnoreCase(ROLE)) { | ||
82 | + if (!isFileExists("config/imf_config.properties")) { | ||
83 | + logger.error("如果向IMF发送数据,需要在config/imf_config.properties 配置IMF参数"); | ||
84 | + ok = true; | ||
85 | + } | ||
86 | + } else { | ||
87 | + logger.error("role 参数错误,必须是S(从IMF接收消息) 或者 R(发送消息到IMF)"); | ||
88 | + } | ||
89 | + | ||
90 | + int int_total_group; | ||
91 | + if ("S".equalsIgnoreCase(ROLE)) { | ||
92 | + String total_group = config.getProperty("total_group").trim(); | ||
93 | + int_total_group = 0; | ||
94 | + logger.info(String.format("record_count=%s", record_count)); | ||
95 | + logger.info(String.format("total_group=%s", total_group)); | ||
96 | + if (StringUtils.isBlank(total_group)) { | ||
97 | + logger.error("total_group 参数错误"); | ||
98 | + ok = true; | ||
99 | + } else { | ||
100 | + int_total_group = Integer.parseInt(total_group); | ||
101 | + if (int_total_group <= 10 && int_total_group >= 1) { | ||
102 | + this.loadXMLHeaderParameter(config, int_total_group); | ||
103 | + } else { | ||
104 | + logger.error("total_group 参数设置错误,范围在1--10之间"); | ||
105 | + ok = true; | ||
106 | + } | ||
107 | + } | ||
108 | + | ||
109 | + int x; | ||
110 | + if (StringUtils.isBlank(record_count)) { | ||
111 | + logger.error("record_count 参数错误"); | ||
112 | + ok = true; | ||
113 | + } else { | ||
114 | + x = Integer.parseInt(record_count); | ||
115 | + if (x <= 10000 && x >= 100) { | ||
116 | + RECORD_COUNT = x; | ||
117 | + } else { | ||
118 | + logger.error("record_count 参数设置错误,范围在100--10000之间"); | ||
119 | + ok = true; | ||
120 | + } | ||
121 | + } | ||
122 | + | ||
123 | + if (StringUtils.isBlank(interval)) { | ||
124 | + logger.error("interval 参数错误"); | ||
125 | + ok = true; | ||
126 | + } else { | ||
127 | + x = Integer.parseInt(interval); | ||
128 | + if (x <= 60 && x >= 1) { | ||
129 | + SEND_MESSAGE_INTERVAL = x * 1000; | ||
130 | + } else { | ||
131 | + logger.error("interval 参数设置错误,范围在1---60之间"); | ||
132 | + ok = true; | ||
133 | + } | ||
134 | + } | ||
135 | + } | ||
136 | + | ||
137 | + if (!isFileExists("data/")) { | ||
138 | + File f = new File("data"); | ||
139 | + f.mkdir(); | ||
140 | + Utils.writeFIDIndex("data/fid_index.txt", 0); | ||
141 | + int_total_group = Utils.readFIDIndex("data/fid_index.txt"); | ||
142 | + logger.info("FID=" + int_total_group); | ||
143 | + } else { | ||
144 | + logger.info("data/fid_index.txt exists"); | ||
145 | + } | ||
146 | + | ||
147 | + boolean hasError = false; | ||
148 | + hasError = this.validate(IMF_USERNAME, "imf_username 参数错误"); | ||
149 | + hasError = this.validate(IMF_PASSWORD, "imf_password 参数错误"); | ||
150 | + if (ok && !hasError) { | ||
151 | + logger.error("参数错误 启动程序失败。"); | ||
152 | + System.exit(-1); | ||
153 | + } | ||
154 | + | ||
155 | + } | ||
156 | + | ||
157 | + private void loadXMLHeaderParameter(Configuration config, int total) throws LteException { | ||
158 | + String sndr = ""; | ||
159 | + String rcvr = ""; | ||
160 | + String type = ""; | ||
161 | + String stype = ""; | ||
162 | + | ||
163 | + for(int i = 1; i <= total; ++i) { | ||
164 | + logger.info(String.format("group %d--------------------------", i)); | ||
165 | + sndr = config.getProperty("sndr_" + i).trim(); | ||
166 | + rcvr = config.getProperty("rcvr_" + i).trim(); | ||
167 | + type = config.getProperty("type_" + i).trim(); | ||
168 | + stype = config.getProperty("stype_" + i).trim(); | ||
169 | + logger.info(String.format("SNDR_%d=%s", i, sndr)); | ||
170 | + logger.info(String.format("RCVR_%d=%s", i, rcvr)); | ||
171 | + logger.info(String.format("TYPE_%d=%s", i, type)); | ||
172 | + logger.info(String.format("STYPE_%d=%s", i, stype)); | ||
173 | + XMLHeader header = new XMLHeader(); | ||
174 | + header.setSndr(sndr); | ||
175 | + header.setRcvr(rcvr); | ||
176 | + header.setType(type); | ||
177 | + header.setStype(stype); | ||
178 | + logger.info("group[" + i + "]\t" + header.toString()); | ||
179 | + XML_HEADER_MAP.put(i, header); | ||
180 | + } | ||
181 | + | ||
182 | + } | ||
183 | + | ||
184 | + private boolean validate(String paraValue, String tipText) { | ||
185 | + if (StringUtils.isBlank(paraValue)) { | ||
186 | + logger.error(tipText); | ||
187 | + return false; | ||
188 | + } else { | ||
189 | + return true; | ||
190 | + } | ||
191 | + } | ||
192 | + | ||
193 | + private static boolean isFileExists(String filename) { | ||
194 | + File f = new File(filename); | ||
195 | + return f.exists(); | ||
196 | + } | ||
197 | + | ||
198 | + public static void main(String[] argc) { | ||
199 | + File f = new File("config/producer_imf_config.properties"); | ||
200 | + if (f.exists()) { | ||
201 | + System.out.println("file exists"); | ||
202 | + } else { | ||
203 | + System.out.println("file not exists"); | ||
204 | + } | ||
205 | + | ||
206 | + } | ||
207 | +} |
src/java/com/airport/util/Configuration.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.util; | ||
7 | + | ||
8 | +import java.io.IOException; | ||
9 | +import java.io.InputStream; | ||
10 | +import java.util.HashMap; | ||
11 | +import java.util.Iterator; | ||
12 | +import java.util.Map; | ||
13 | +import java.util.Properties; | ||
14 | +import org.apache.commons.lang.StringUtils; | ||
15 | +import org.apache.log4j.Level; | ||
16 | +import org.apache.log4j.Logger; | ||
17 | +import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; | ||
18 | +import org.springframework.core.io.Resource; | ||
19 | +import org.springframework.util.DefaultPropertiesPersister; | ||
20 | +import org.springframework.util.PropertiesPersister; | ||
21 | + | ||
22 | +public class Configuration extends PropertyPlaceholderConfigurer { | ||
23 | + private static final Logger logger = Logger.getLogger(Configuration.class); | ||
24 | + private static final Map<String, String> parameterMap = new HashMap(); | ||
25 | + private Resource location; | ||
26 | + | ||
27 | + public void setLocation(Resource location) { | ||
28 | + this.location = location; | ||
29 | + } | ||
30 | + | ||
31 | + public void loadProperties(Properties props) throws IOException { | ||
32 | + PropertiesPersister propertiesPersister = new DefaultPropertiesPersister(); | ||
33 | + InputStream is = null; | ||
34 | + | ||
35 | + try { | ||
36 | + Resource location = this.location; | ||
37 | + is = location.getInputStream(); | ||
38 | + propertiesPersister.load(props, is); | ||
39 | + Iterator var6 = props.keySet().iterator(); | ||
40 | + | ||
41 | + while(var6.hasNext()) { | ||
42 | + Object key = var6.next(); | ||
43 | + String code = props.getProperty((String)key).trim(); | ||
44 | + parameterMap.put((String)key, code); | ||
45 | + } | ||
46 | + } catch (Exception var11) { | ||
47 | + logger.error("initialization error", var11); | ||
48 | + var11.printStackTrace(); | ||
49 | + } finally { | ||
50 | + if (is != null) { | ||
51 | + is.close(); | ||
52 | + } | ||
53 | + | ||
54 | + } | ||
55 | + | ||
56 | + } | ||
57 | + | ||
58 | + public Configuration() { | ||
59 | + logger.setLevel(Level.INFO); | ||
60 | + } | ||
61 | + | ||
62 | + public String getProperty(String name) throws LteException { | ||
63 | + String str = (String)parameterMap.get(name); | ||
64 | + if (str == null) { | ||
65 | + String errMsg = String.format("config.properties key Error, can not find key [%s]", name); | ||
66 | + logger.error(errMsg); | ||
67 | + throw new LteException(errMsg); | ||
68 | + } else { | ||
69 | + return str.trim(); | ||
70 | + } | ||
71 | + } | ||
72 | + | ||
73 | + public String getPropertyMaybeNull(String name) throws LteException { | ||
74 | + String str = (String)parameterMap.get(name); | ||
75 | + if (StringUtils.isBlank(str)) { | ||
76 | + str = ""; | ||
77 | + } | ||
78 | + | ||
79 | + return str.trim(); | ||
80 | + } | ||
81 | +} |
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.util; | ||
7 | + | ||
8 | +import java.io.PrintWriter; | ||
9 | +import java.io.StringWriter; | ||
10 | + | ||
11 | +public class ExceptionUtils { | ||
12 | + public ExceptionUtils() { | ||
13 | + } | ||
14 | + | ||
15 | + public static String outputExceptionDetailsInfo(String label, String msg, Throwable t) { | ||
16 | + StringBuffer sb = new StringBuffer(); | ||
17 | + StackTraceElement[] messages = t.getStackTrace(); | ||
18 | + int length = messages.length; | ||
19 | + sb.append("\n"); | ||
20 | + sb.append("\n"); | ||
21 | + sb.append("\t"); | ||
22 | + sb.append("["); | ||
23 | + sb.append(label + " component exception super class name"); | ||
24 | + sb.append(":"); | ||
25 | + sb.append(msg); | ||
26 | + sb.append("]"); | ||
27 | + sb.append("\n"); | ||
28 | + sb.append("\t********Exception Detail List Begin********"); | ||
29 | + sb.append("\n\t" + t + "\n"); | ||
30 | + | ||
31 | + for(int i = 0; i < length; ++i) { | ||
32 | + sb.append("\t" + messages[i].toString() + "\n"); | ||
33 | + } | ||
34 | + | ||
35 | + sb.append("\t********Exception Detail List End********"); | ||
36 | + return sb.toString(); | ||
37 | + } | ||
38 | + | ||
39 | + public static String getStackTrace(Throwable t) { | ||
40 | + StringWriter sw = new StringWriter(); | ||
41 | + PrintWriter pw = new PrintWriter(sw); | ||
42 | + | ||
43 | + String var4; | ||
44 | + try { | ||
45 | + t.printStackTrace(pw); | ||
46 | + var4 = sw.toString(); | ||
47 | + } finally { | ||
48 | + pw.close(); | ||
49 | + } | ||
50 | + | ||
51 | + return var4; | ||
52 | + } | ||
53 | +} |
src/java/com/airport/util/LteException.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.util; | ||
7 | + | ||
8 | +import org.apache.log4j.Logger; | ||
9 | + | ||
10 | +public class LteException extends Exception { | ||
11 | + private static final Logger logger = Logger.getLogger(LteException.class); | ||
12 | + private static final long serialVersionUID = -3047721096749400047L; | ||
13 | + private int errorCode = -1; | ||
14 | + | ||
15 | + public LteException() { | ||
16 | + } | ||
17 | + | ||
18 | + public LteException(String s) { | ||
19 | + super(s); | ||
20 | + } | ||
21 | + | ||
22 | + public LteException(int errorCode, String errmsg) { | ||
23 | + super(errmsg); | ||
24 | + this.errorCode = errorCode; | ||
25 | + if (errorCode > 0) { | ||
26 | + logger.debug("ErrorCode: " + errorCode + " " + errmsg); | ||
27 | + } | ||
28 | + | ||
29 | + } | ||
30 | + | ||
31 | + public int getErrorCode() { | ||
32 | + return this.errorCode; | ||
33 | + } | ||
34 | + | ||
35 | + public LteException(String s, Throwable cause) { | ||
36 | + super(s, cause); | ||
37 | + } | ||
38 | +} |
src/java/com/airport/util/SystemBean.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.util; | ||
7 | + | ||
8 | +import org.apache.log4j.Logger; | ||
9 | +import org.springframework.beans.BeansException; | ||
10 | +import org.springframework.context.support.FileSystemXmlApplicationContext; | ||
11 | + | ||
12 | +public class SystemBean { | ||
13 | + private static Logger logger = Logger.getLogger(SystemBean.class); | ||
14 | + private static SystemBean inistance; | ||
15 | + private static FileSystemXmlApplicationContext fileSystemXmlApplicationContext; | ||
16 | + private static Object lock = new Object(); | ||
17 | + | ||
18 | + public SystemBean() { | ||
19 | + } | ||
20 | + | ||
21 | + public static final synchronized void createInstance(String path) throws LteException { | ||
22 | + if (inistance == null) { | ||
23 | + Object var1 = lock; | ||
24 | + synchronized(lock) { | ||
25 | + if (inistance == null) { | ||
26 | + inistance = new SystemBean(); | ||
27 | + | ||
28 | + String err; | ||
29 | + try { | ||
30 | + logger.info("Initialization ApplicationContext "); | ||
31 | + fileSystemXmlApplicationContext = new FileSystemXmlApplicationContext(path); | ||
32 | + fileSystemXmlApplicationContext.registerShutdownHook(); | ||
33 | + } catch (BeansException var4) { | ||
34 | + err = ExceptionUtils.getStackTrace(var4); | ||
35 | + throw new LteException("Initialization ApplicationContext error:" + err); | ||
36 | + } catch (Exception var5) { | ||
37 | + err = ExceptionUtils.getStackTrace(var5); | ||
38 | + throw new LteException("Initialization ApplicationContext error:" + err); | ||
39 | + } | ||
40 | + } | ||
41 | + } | ||
42 | + } | ||
43 | + | ||
44 | + } | ||
45 | + | ||
46 | + public static final Object getBean(String beanName) { | ||
47 | + return fileSystemXmlApplicationContext.getBean(beanName); | ||
48 | + } | ||
49 | + | ||
50 | + public static final void destroy() { | ||
51 | + fileSystemXmlApplicationContext.getBeanFactory().destroySingletons(); | ||
52 | + } | ||
53 | +} |
src/java/com/airport/util/Utils.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.util; | ||
7 | + | ||
8 | +import java.io.BufferedReader; | ||
9 | +import java.io.BufferedWriter; | ||
10 | +import java.io.File; | ||
11 | +import java.io.FileNotFoundException; | ||
12 | +import java.io.FileOutputStream; | ||
13 | +import java.io.FileReader; | ||
14 | +import java.io.IOException; | ||
15 | +import java.io.OutputStreamWriter; | ||
16 | +import java.io.PrintStream; | ||
17 | +import java.io.PrintWriter; | ||
18 | +import java.text.ParseException; | ||
19 | +import java.text.SimpleDateFormat; | ||
20 | +import java.util.Date; | ||
21 | +import java.util.regex.Matcher; | ||
22 | +import java.util.regex.Pattern; | ||
23 | +import org.apache.commons.lang.StringUtils; | ||
24 | +import org.apache.log4j.Logger; | ||
25 | +//读取写入已发送的FID | ||
26 | +public class Utils { | ||
27 | + private static Logger logger = Logger.getLogger(SystemBean.class); | ||
28 | + | ||
29 | + public Utils() { | ||
30 | + } | ||
31 | + | ||
32 | + public static final Date iso8601DateStrToDate(String dateStr) { | ||
33 | + Date dt = null; | ||
34 | + String str_ = dateStr.replace("T", " "); | ||
35 | + str_ = str_.substring(0, 19); | ||
36 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
37 | + | ||
38 | + try { | ||
39 | + dt = format.parse(str_); | ||
40 | + } catch (ParseException var5) { | ||
41 | + var5.printStackTrace(); | ||
42 | + } | ||
43 | + | ||
44 | + return dt; | ||
45 | + } | ||
46 | + | ||
47 | + public static String dateToStr(Date date) { | ||
48 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
49 | + String str = format.format(date); | ||
50 | + return str; | ||
51 | + } | ||
52 | + | ||
53 | + public static String dateToStr(Date date, String dateFmt) { | ||
54 | + SimpleDateFormat format = new SimpleDateFormat(dateFmt); | ||
55 | + String str = format.format(date); | ||
56 | + return str; | ||
57 | + } | ||
58 | + | ||
59 | + public static boolean createDir(String destDirName) { | ||
60 | + File dir = new File(destDirName); | ||
61 | + if (dir.exists()) { | ||
62 | + return true; | ||
63 | + } else { | ||
64 | + if (!destDirName.endsWith(File.separator)) { | ||
65 | + destDirName = destDirName + File.separator; | ||
66 | + } | ||
67 | + | ||
68 | + if (dir.mkdirs()) { | ||
69 | + return true; | ||
70 | + } else { | ||
71 | + logger.info("创建目录失败! 目录名称:" + destDirName); | ||
72 | + return false; | ||
73 | + } | ||
74 | + } | ||
75 | + } | ||
76 | + | ||
77 | + public static void saveFile(String fileName, String content) { | ||
78 | + try { | ||
79 | + PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), "utf-8"))); | ||
80 | + out.write(content); | ||
81 | + out.flush(); | ||
82 | + out.close(); | ||
83 | + } catch (IOException var3) { | ||
84 | + var3.printStackTrace(); | ||
85 | + logger.error(var3.getMessage()); | ||
86 | + } | ||
87 | + | ||
88 | + } | ||
89 | + | ||
90 | + public static int writeFIDIndex(String fileName, int fid) { | ||
91 | + PrintStream ps = null; | ||
92 | + byte is_ok = 1; | ||
93 | + | ||
94 | + try { | ||
95 | + File file = new File(fileName); | ||
96 | + ps = new PrintStream(new FileOutputStream(file)); | ||
97 | + ps.println(fid); | ||
98 | + is_ok = 0; | ||
99 | + } catch (IOException var8) { | ||
100 | + var8.printStackTrace(); | ||
101 | + logger.error(var8.getMessage()); | ||
102 | + } finally { | ||
103 | + ps.close(); | ||
104 | + } | ||
105 | + | ||
106 | + return is_ok; | ||
107 | + } | ||
108 | + | ||
109 | + public static int readFIDIndex(String fileName) { | ||
110 | + FileReader reader = null; | ||
111 | + BufferedReader br = null; | ||
112 | + int index = 0; | ||
113 | + | ||
114 | + try { | ||
115 | + reader = new FileReader(fileName); | ||
116 | + br = new BufferedReader(reader); | ||
117 | + String str = br.readLine(); | ||
118 | + index = Integer.parseInt(str); | ||
119 | + } catch (FileNotFoundException var15) { | ||
120 | + var15.printStackTrace(); | ||
121 | + } catch (IOException var16) { | ||
122 | + var16.printStackTrace(); | ||
123 | + } finally { | ||
124 | + try { | ||
125 | + br.close(); | ||
126 | + reader.close(); | ||
127 | + } catch (IOException var14) { | ||
128 | + var14.printStackTrace(); | ||
129 | + } | ||
130 | + | ||
131 | + } | ||
132 | + | ||
133 | + return index; | ||
134 | + } | ||
135 | + | ||
136 | + public static String searchReplace(String xml, String replacement, String nodeName) { | ||
137 | + String pStr = String.format("(?<=<%s>).*(?=</%s>)", nodeName, nodeName); | ||
138 | + Pattern pat = Pattern.compile(pStr); | ||
139 | + Matcher matcher = pat.matcher(xml); | ||
140 | + if (matcher.find()) { | ||
141 | + if (!StringUtils.isBlank(replacement)) { | ||
142 | + return xml.replace(matcher.group(), replacement); | ||
143 | + } | ||
144 | + } else { | ||
145 | + logger.error("can not find " + nodeName + " in " + xml); | ||
146 | + } | ||
147 | + | ||
148 | + return xml; | ||
149 | + } | ||
150 | + | ||
151 | + public static String searchReplaceSingle(String xml, String replacement, String nodeName) { | ||
152 | + String pStr = String.format("(<%s/>)", nodeName); | ||
153 | + String rep = String.format("<%s>%s</%s>", nodeName, replacement, nodeName); | ||
154 | + Pattern pat = Pattern.compile(pStr); | ||
155 | + Matcher mat = pat.matcher(xml); | ||
156 | + return mat.find() && !StringUtils.isBlank(replacement) ? xml.replace(mat.group(), rep) : xml; | ||
157 | + } | ||
158 | +} |
1 | +package com.airport.util.parse; | ||
2 | +import org.apache.log4j.Logger; | ||
3 | +import org.jdom.Document; | ||
4 | +import org.jdom.Element; | ||
5 | +import org.jdom.JDOMException; | ||
6 | +import org.jdom.input.SAXBuilder; | ||
7 | +import org.jdom.output.Format; | ||
8 | +import org.jdom.output.XMLOutputter; | ||
9 | + | ||
10 | +import java.io.*; | ||
11 | +import java.text.SimpleDateFormat; | ||
12 | +import java.util.Date; | ||
13 | + | ||
14 | +public class IMFXMLMaker { | ||
15 | + private static final Logger logger = Logger.getLogger(IMFXMLMaker.class); | ||
16 | + private Document XmlDocument; | ||
17 | + private Element RootElement; | ||
18 | + private Element SndrElement; | ||
19 | + private Element RcvrElement; | ||
20 | + private Element SEQNElement; | ||
21 | + private Element TYPEElement; | ||
22 | + private Element STYPElement; | ||
23 | + private Element originalELEMENT; | ||
24 | + | ||
25 | + private String XmlStr; | ||
26 | + private String SNDR; | ||
27 | + private String RCVR; | ||
28 | + private String SEQN; | ||
29 | + private String TYPE; | ||
30 | + private String STYP; | ||
31 | + private String IMFContent; | ||
32 | + private String IMFXml; | ||
33 | + | ||
34 | + public String getXmlStr() { | ||
35 | + return XmlStr; | ||
36 | + } | ||
37 | + | ||
38 | + public void setXmlStr(String xmlStr) { | ||
39 | + XmlStr = xmlStr; | ||
40 | + } | ||
41 | + | ||
42 | + public String getSNDR() { | ||
43 | + return SNDR; | ||
44 | + } | ||
45 | + | ||
46 | + public void setSNDR(String SNDR) { | ||
47 | + this.SNDR = SNDR; | ||
48 | + } | ||
49 | + | ||
50 | + public String getRCVR() { | ||
51 | + return RCVR; | ||
52 | + } | ||
53 | + | ||
54 | + public void setRCVR(String RCVR) { | ||
55 | + this.RCVR = RCVR; | ||
56 | + } | ||
57 | + | ||
58 | + public String getSEQN() { | ||
59 | + return SEQN; | ||
60 | + } | ||
61 | + | ||
62 | + public void setSEQN(String SEQN) { | ||
63 | + this.SEQN = SEQN; | ||
64 | + } | ||
65 | + | ||
66 | + public String getTYPE() { | ||
67 | + return TYPE; | ||
68 | + } | ||
69 | + | ||
70 | + public void setTYPE(String TYPE) { | ||
71 | + this.TYPE = TYPE; | ||
72 | + } | ||
73 | + | ||
74 | + public String getSTYP() { | ||
75 | + return STYP; | ||
76 | + } | ||
77 | + | ||
78 | + public void setSTYP(String STYP) { | ||
79 | + this.STYP = STYP; | ||
80 | + } | ||
81 | + | ||
82 | + public String getIMFContent() { | ||
83 | + return IMFContent; | ||
84 | + } | ||
85 | + | ||
86 | + public void setIMFContent(String IMFContent) { | ||
87 | + this.IMFContent = IMFContent; | ||
88 | + } | ||
89 | + | ||
90 | + public String getIMFXml() { | ||
91 | + return IMFXml; | ||
92 | + } | ||
93 | + | ||
94 | + public void setIMFXml(String IMFXml) { | ||
95 | + this.IMFXml = IMFXml; | ||
96 | + } | ||
97 | + | ||
98 | + //初始化报文头部节点 | ||
99 | + public IMFXMLMaker(String sndr,String seqn,String type,String styp){ | ||
100 | + this.SNDR = sndr; | ||
101 | + this.SEQN = seqn; | ||
102 | + this.TYPE = type; | ||
103 | + this.STYP = styp; | ||
104 | + | ||
105 | + this.XmlDocument = new Document(); | ||
106 | + | ||
107 | + //跟节点 | ||
108 | + this.RootElement = new Element("MSG"); | ||
109 | + this.XmlDocument.addContent(this.RootElement); | ||
110 | + | ||
111 | + //meta节点 | ||
112 | + Element MetaElement = new Element("META"); | ||
113 | + this.RootElement.addContent(0,MetaElement); | ||
114 | + | ||
115 | + //原始内容节点,储存最原始报文内容的节点 | ||
116 | + this.originalELEMENT = new Element("original"); | ||
117 | + this.RootElement.addContent(1,this.originalELEMENT); | ||
118 | + | ||
119 | + //meta下的子节点们 | ||
120 | + SndrElement = new Element("SNDR"); | ||
121 | + RcvrElement = new Element("RCVR"); | ||
122 | + SEQNElement = new Element("SEQN"); | ||
123 | + Element DDTMElement = new Element("DDTM"); | ||
124 | + TYPEElement = new Element("TYPE"); | ||
125 | + STYPElement = new Element("STYP"); | ||
126 | + | ||
127 | + MetaElement.addContent(0,SndrElement); | ||
128 | + MetaElement.addContent(1,RcvrElement); | ||
129 | + MetaElement.addContent(2,SEQNElement); | ||
130 | + MetaElement.addContent(3,DDTMElement); | ||
131 | + MetaElement.addContent(4,TYPEElement); | ||
132 | + MetaElement.addContent(5,STYPElement); | ||
133 | + | ||
134 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); | ||
135 | + String dateString = simpleDateFormat.format(new Date()); | ||
136 | + DDTMElement.setText(dateString); | ||
137 | + | ||
138 | + SndrElement.setText(this.SNDR); | ||
139 | + SEQNElement.setText(this.SEQN); | ||
140 | + TYPEElement.setText(this.TYPE); | ||
141 | + STYPElement.setText(this.STYP); | ||
142 | + | ||
143 | + } | ||
144 | + | ||
145 | + public String finalXmlStr(){ | ||
146 | + | ||
147 | + try{ | ||
148 | + Document contentDocument = string2Doc(this.IMFContent); | ||
149 | + this.originalELEMENT.addContent(0,contentDocument.detachRootElement()); | ||
150 | + | ||
151 | + String backXml = doc2String(this.XmlDocument); | ||
152 | + return backXml; | ||
153 | + }catch (Exception e){ | ||
154 | + e.printStackTrace(); | ||
155 | + return this.SEQN+"error"; | ||
156 | + } | ||
157 | + | ||
158 | + } | ||
159 | + | ||
160 | + /** | ||
161 | + * 字符串转换为DOCUMENT | ||
162 | + * | ||
163 | + * @param xmlStr 字符串 | ||
164 | + * @return doc JDOM的Document | ||
165 | + * @throws Exception | ||
166 | + */ | ||
167 | + public static Document string2Doc(String xmlStr) throws Exception { | ||
168 | + java.io.Reader in = new StringReader(xmlStr); | ||
169 | + Document doc = (new SAXBuilder()).build(in); | ||
170 | + return doc; | ||
171 | + } | ||
172 | + | ||
173 | + /** | ||
174 | + * Document转换为字符串 | ||
175 | + * | ||
176 | + * @param doc DOCUMENT对象 | ||
177 | + * @return xmlStr 字符串 | ||
178 | + * @throws Exception | ||
179 | + */ | ||
180 | + public String doc2String(Document doc) throws Exception { | ||
181 | + Format format = Format.getPrettyFormat(); | ||
182 | + format.setEncoding("UTF-8");// 设置xml文件的字符为UTF-8,解决中文问题 | ||
183 | + XMLOutputter xmlout = new XMLOutputter(format); | ||
184 | + ByteArrayOutputStream bo = new ByteArrayOutputStream(); | ||
185 | + xmlout.output(doc, bo); | ||
186 | + return bo.toString(); | ||
187 | + } | ||
188 | + | ||
189 | + /** | ||
190 | + * XML转换为Document | ||
191 | + * | ||
192 | + * @param xmlFilePath XML文件路径 | ||
193 | + * @return doc Document对象 | ||
194 | + * @throws Exception | ||
195 | + */ | ||
196 | + public static Document xml2Doc(String xmlFilePath) throws Exception { | ||
197 | + File file = new File(xmlFilePath); | ||
198 | + return (new SAXBuilder()).build(file); | ||
199 | + } | ||
200 | + | ||
201 | + public void main(String[] args) throws Exception{ | ||
202 | + finalXmlStr(); | ||
203 | + } | ||
204 | +} |
src/java/com/airport/util/parse/SubNode.java
0 → 100644
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.util.parse; | ||
7 | + | ||
8 | +import org.jdom.Element; | ||
9 | + | ||
10 | +public class SubNode { | ||
11 | + private Element element; | ||
12 | + | ||
13 | + public SubNode(Element element) { | ||
14 | + this.element = element; | ||
15 | + } | ||
16 | + | ||
17 | + public Element getElement() { | ||
18 | + return this.element; | ||
19 | + } | ||
20 | + | ||
21 | + public void setElement(Element element) { | ||
22 | + this.element = element; | ||
23 | + } | ||
24 | +} |
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.util.parse; | ||
7 | + | ||
8 | +import com.airport.util.Utils; | ||
9 | +import java.io.IOException; | ||
10 | +import java.io.StringReader; | ||
11 | +import java.util.Date; | ||
12 | +import java.util.LinkedList; | ||
13 | +import java.util.List; | ||
14 | +import org.jdom.Document; | ||
15 | +import org.jdom.Element; | ||
16 | +import org.jdom.JDOMException; | ||
17 | +import org.jdom.input.SAXBuilder; | ||
18 | +import org.xml.sax.InputSource; | ||
19 | + | ||
20 | +public class XMPParse { | ||
21 | + public XMPParse() { | ||
22 | + } | ||
23 | + | ||
24 | + public static final Date nodeValue2Date(String xmlFile, String xmlNodePath) { | ||
25 | + String str = getNodeValue(xmlFile, xmlNodePath); | ||
26 | + return !"".equals(str) ? Utils.iso8601DateStrToDate(str) : null; | ||
27 | + } | ||
28 | + | ||
29 | + public static final Date nodeValue2Date(String xmlFile, String xmlNodePath, Date date) { | ||
30 | + String str = getNodeValue(xmlFile, xmlNodePath); | ||
31 | + return !"".equals(str) ? Utils.iso8601DateStrToDate(str) : date; | ||
32 | + } | ||
33 | + | ||
34 | + public static final Date nodeAttribute2Date(String xmlFile, String xmlNodePath, String attributeName, Date date) { | ||
35 | + String str = getNodeAttribute(xmlFile, xmlNodePath, attributeName, ""); | ||
36 | + return !"".equals(str) ? Utils.iso8601DateStrToDate(str) : date; | ||
37 | + } | ||
38 | + | ||
39 | + public static final String getNodeValue(String xmlFile, String xmlNodePath) { | ||
40 | + String[] nodes = xmlNodePath.split("/"); | ||
41 | + new Document(); | ||
42 | + SAXBuilder builder = new SAXBuilder(); | ||
43 | + Element root = null; | ||
44 | + LinkedList<SubNode> listNode = new LinkedList(); | ||
45 | + String value = ""; | ||
46 | + | ||
47 | + Document document; | ||
48 | + try { | ||
49 | + document = builder.build(xmlFile); | ||
50 | + | ||
51 | + for(int i = 1; i < nodes.length; ++i) { | ||
52 | + SubNode snode; | ||
53 | + if (i > 1) { | ||
54 | + snode = (SubNode)listNode.getLast(); | ||
55 | + List<Element> eList = snode.getElement().getChildren(nodes[i]); | ||
56 | + if (eList != null && eList.size() > 0) { | ||
57 | + SubNode s1 = new SubNode((Element)eList.get(0)); | ||
58 | + listNode.add(s1); | ||
59 | + } | ||
60 | + } else if (1 == i) { | ||
61 | + root = document.getRootElement(); | ||
62 | + snode = new SubNode(root); | ||
63 | + listNode.add(snode); | ||
64 | + } | ||
65 | + } | ||
66 | + | ||
67 | + SubNode n = (SubNode)listNode.getLast(); | ||
68 | + value = n.getElement().getText(); | ||
69 | + n = null; | ||
70 | + } catch (Exception var15) { | ||
71 | + var15.printStackTrace(); | ||
72 | + } finally { | ||
73 | + listNode.clear(); | ||
74 | + document = null; | ||
75 | + root = null; | ||
76 | + builder = null; | ||
77 | + nodes = null; | ||
78 | + } | ||
79 | + | ||
80 | + System.out.println("key=" + xmlNodePath + " value=" + value); | ||
81 | + return value; | ||
82 | + } | ||
83 | + | ||
84 | + public static final String getNodeValueFromXmlString(String xmlString, String xmlNodePath) throws Exception { | ||
85 | + String[] nodes = xmlNodePath.split("/"); | ||
86 | + new Document(); | ||
87 | + SAXBuilder builder = new SAXBuilder(); | ||
88 | + Element root = null; | ||
89 | + LinkedList<SubNode> listNode = new LinkedList(); | ||
90 | + String value = ""; | ||
91 | + | ||
92 | + Document document; | ||
93 | + try { | ||
94 | + StringReader xmlReader = new StringReader(xmlString); | ||
95 | + InputSource xmlSource = new InputSource(xmlReader); | ||
96 | + document = builder.build(xmlSource); | ||
97 | + | ||
98 | + for(int i = 1; i < nodes.length; ++i) { | ||
99 | + SubNode snode; | ||
100 | + if (i > 1) { | ||
101 | + snode = (SubNode)listNode.getLast(); | ||
102 | + List<Element> eList = snode.getElement().getChildren(nodes[i]); | ||
103 | + if (eList != null && eList.size() > 0) { | ||
104 | + SubNode s1 = new SubNode((Element)eList.get(0)); | ||
105 | + listNode.add(s1); | ||
106 | + } | ||
107 | + } else if (1 == i) { | ||
108 | + root = document.getRootElement(); | ||
109 | + snode = new SubNode(root); | ||
110 | + listNode.add(snode); | ||
111 | + } | ||
112 | + } | ||
113 | + | ||
114 | + SubNode n = (SubNode)listNode.getLast(); | ||
115 | + value = n.getElement().getText(); | ||
116 | + n = null; | ||
117 | + return value; | ||
118 | + } catch (Exception var17) { | ||
119 | + var17.printStackTrace(); | ||
120 | + throw var17; | ||
121 | + } finally { | ||
122 | + listNode.clear(); | ||
123 | + document = null; | ||
124 | + root = null; | ||
125 | + builder = null; | ||
126 | + nodes = null; | ||
127 | + } | ||
128 | + } | ||
129 | + | ||
130 | + public static final String getNodeAttribute(String xmlFile, String xmlNodePath, String attributeName, String defaultValue) { | ||
131 | + String[] nodes = xmlNodePath.split("/"); | ||
132 | + new Document(); | ||
133 | + SAXBuilder builder = new SAXBuilder(); | ||
134 | + Element root = null; | ||
135 | + LinkedList<SubNode> listNode = new LinkedList(); | ||
136 | + String value = ""; | ||
137 | + | ||
138 | + Document document; | ||
139 | + try { | ||
140 | + document = builder.build(xmlFile); | ||
141 | + | ||
142 | + for(int i = 1; i < nodes.length; ++i) { | ||
143 | + SubNode snode; | ||
144 | + if (i > 1) { | ||
145 | + snode = (SubNode)listNode.getLast(); | ||
146 | + List<Element> eList = snode.getElement().getChildren(nodes[i]); | ||
147 | + if (eList != null && eList.size() > 0) { | ||
148 | + SubNode s1 = new SubNode((Element)eList.get(0)); | ||
149 | + listNode.add(s1); | ||
150 | + } | ||
151 | + } else if (1 == i) { | ||
152 | + root = document.getRootElement(); | ||
153 | + snode = new SubNode(root); | ||
154 | + listNode.add(snode); | ||
155 | + } | ||
156 | + } | ||
157 | + | ||
158 | + SubNode n = (SubNode)listNode.getLast(); | ||
159 | + value = n.getElement().getAttributeValue(attributeName, defaultValue); | ||
160 | + n = null; | ||
161 | + } catch (JDOMException var18) { | ||
162 | + var18.printStackTrace(); | ||
163 | + } catch (IOException var19) { | ||
164 | + var19.printStackTrace(); | ||
165 | + } finally { | ||
166 | + listNode.clear(); | ||
167 | + document = null; | ||
168 | + root = null; | ||
169 | + builder = null; | ||
170 | + nodes = null; | ||
171 | + } | ||
172 | + | ||
173 | + System.out.println("key=" + xmlNodePath + " node attrivte value=" + value); | ||
174 | + return value; | ||
175 | + } | ||
176 | +} |
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package com.airport.util.parse; | ||
7 | + | ||
8 | +import java.io.IOException; | ||
9 | +import java.util.LinkedList; | ||
10 | +import java.util.List; | ||
11 | +import org.jdom.Document; | ||
12 | +import org.jdom.Element; | ||
13 | +import org.jdom.JDOMException; | ||
14 | +import org.jdom.input.SAXBuilder; | ||
15 | + | ||
16 | +public class XmlDocument { | ||
17 | + private Document document = null; | ||
18 | + private SAXBuilder builder = null; | ||
19 | + private Element root = null; | ||
20 | + private String xmlFile; | ||
21 | + | ||
22 | + public XmlDocument(String xmlFileName) { | ||
23 | + this.xmlFile = xmlFileName; | ||
24 | + | ||
25 | + try { | ||
26 | + this.builder = new SAXBuilder(); | ||
27 | + this.document = new Document(); | ||
28 | + this.document = this.builder.build(this.xmlFile); | ||
29 | + } catch (JDOMException var3) { | ||
30 | + var3.printStackTrace(); | ||
31 | + } catch (IOException var4) { | ||
32 | + var4.printStackTrace(); | ||
33 | + } | ||
34 | + | ||
35 | + } | ||
36 | + | ||
37 | + public void destory() { | ||
38 | + this.document = null; | ||
39 | + this.root = null; | ||
40 | + this.builder = null; | ||
41 | + } | ||
42 | + | ||
43 | + public String getStringFromInnerText(String xmlNodePath) { | ||
44 | + String[] nodes = xmlNodePath.split("/"); | ||
45 | + LinkedList<SubNode> listNode = new LinkedList(); | ||
46 | + String value = ""; | ||
47 | + | ||
48 | + try { | ||
49 | + for(int i = 1; i < nodes.length; ++i) { | ||
50 | + SubNode snode; | ||
51 | + if (i > 1) { | ||
52 | + snode = (SubNode)listNode.getLast(); | ||
53 | + List<Element> eList = snode.getElement().getChildren(nodes[i]); | ||
54 | + if (eList != null && eList.size() > 0) { | ||
55 | + SubNode s1 = new SubNode((Element)eList.get(0)); | ||
56 | + listNode.add(s1); | ||
57 | + } | ||
58 | + } else if (1 == i) { | ||
59 | + this.root = this.document.getRootElement(); | ||
60 | + snode = new SubNode(this.root); | ||
61 | + listNode.add(snode); | ||
62 | + } | ||
63 | + } | ||
64 | + | ||
65 | + SubNode n = (SubNode)listNode.getLast(); | ||
66 | + value = n.getElement().getText(); | ||
67 | + n = null; | ||
68 | + } catch (Exception var12) { | ||
69 | + var12.printStackTrace(); | ||
70 | + } finally { | ||
71 | + listNode.clear(); | ||
72 | + } | ||
73 | + | ||
74 | + return value; | ||
75 | + } | ||
76 | + | ||
77 | + public String getStringFromXmlNodeAttribute(String xmlNodePath, String attributeName, String defaultValue) { | ||
78 | + String[] nodes = xmlNodePath.split("/"); | ||
79 | + LinkedList<SubNode> listNode = new LinkedList(); | ||
80 | + String value = ""; | ||
81 | + | ||
82 | + try { | ||
83 | + for(int i = 1; i < nodes.length; ++i) { | ||
84 | + SubNode snode; | ||
85 | + if (i > 1) { | ||
86 | + snode = (SubNode)listNode.getLast(); | ||
87 | + List<Element> eList = snode.getElement().getChildren(nodes[i]); | ||
88 | + if (eList != null && eList.size() > 0) { | ||
89 | + SubNode s1 = new SubNode((Element)eList.get(0)); | ||
90 | + listNode.add(s1); | ||
91 | + } | ||
92 | + } else if (1 == i) { | ||
93 | + this.root = this.document.getRootElement(); | ||
94 | + snode = new SubNode(this.root); | ||
95 | + listNode.add(snode); | ||
96 | + } | ||
97 | + } | ||
98 | + | ||
99 | + SubNode n = (SubNode)listNode.getLast(); | ||
100 | + value = n.getElement().getAttributeValue(attributeName, defaultValue); | ||
101 | + n = null; | ||
102 | + } catch (Exception var14) { | ||
103 | + var14.printStackTrace(); | ||
104 | + } finally { | ||
105 | + listNode.clear(); | ||
106 | + } | ||
107 | + | ||
108 | + return value; | ||
109 | + } | ||
110 | +} |
1 | +package com.thinkgem.jeesite.common.utils; | ||
2 | + | ||
3 | +import java.lang.reflect.Field; | ||
4 | +import java.lang.reflect.Method; | ||
5 | +import java.math.BigDecimal; | ||
6 | +import java.sql.Timestamp; | ||
7 | +import java.text.DecimalFormat; | ||
8 | +import java.util.ArrayList; | ||
9 | +import java.util.HashMap; | ||
10 | +import java.util.List; | ||
11 | +import java.util.Map; | ||
12 | + | ||
13 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
14 | +import com.thoughtworks.xstream.converters.Converter; | ||
15 | +import com.thoughtworks.xstream.converters.MarshallingContext; | ||
16 | +import com.thoughtworks.xstream.converters.UnmarshallingContext; | ||
17 | +import com.thoughtworks.xstream.io.HierarchicalStreamReader; | ||
18 | +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; | ||
19 | + | ||
20 | +public class NullConverter implements Converter { | ||
21 | + private Map<Class<?>, List<String>> attributes = null; | ||
22 | + | ||
23 | + public void regAttribute(Class<?> type, String attribute) | ||
24 | + { | ||
25 | + if (null == attributes) | ||
26 | + { | ||
27 | + attributes = new HashMap<Class<?>, List<String>>(); | ||
28 | + } | ||
29 | + | ||
30 | + List value = attributes.get(type); | ||
31 | + if (null == value) | ||
32 | + { | ||
33 | + value = new ArrayList<String>(); | ||
34 | + attributes.put(type, value); | ||
35 | + } | ||
36 | + | ||
37 | + value.add(attribute); | ||
38 | + } | ||
39 | + | ||
40 | + | ||
41 | + /** | ||
42 | + * 是否是属性(是属性的不用以单独标签实现) | ||
43 | + * @param type | ||
44 | + * @param attribute | ||
45 | + * @return | ||
46 | + */ | ||
47 | + public boolean isClassAttribute(Class<?> type,String attribute) { | ||
48 | + List<String> value = getAttributes(type); | ||
49 | + if (type.equals(Integer.class) || type.equals(Double.class) | ||
50 | + || type.equals(Long.class) || type.equals(Short.class) | ||
51 | + || type.equals(Float.class) || type.equals(BigDecimal.class) | ||
52 | + || type.equals(int.class) || type.equals(float.class) | ||
53 | + || type.equals(long.class) || type.equals(double.class) | ||
54 | + || type.equals(short.class)) { | ||
55 | + return true; | ||
56 | + } | ||
57 | + return false; | ||
58 | + } | ||
59 | + /** | ||
60 | + * 获取注册的属性 | ||
61 | + * @param type | ||
62 | + * @return | ||
63 | + */ | ||
64 | + public List<String> getAttributes(Class<?> type) { | ||
65 | + if (null != attributes){ | ||
66 | + return attributes.get(type); | ||
67 | + } | ||
68 | + return null; | ||
69 | + } | ||
70 | + /** | ||
71 | + * 输出对象的属性标签 | ||
72 | + * @param source | ||
73 | + * @param writer | ||
74 | + */ | ||
75 | + public void writerAttribute (Object source, HierarchicalStreamWriter writer) { | ||
76 | + Class cType = source.getClass(); | ||
77 | + List<String> value = getAttributes(cType); | ||
78 | + if ((null != value) && (value.size() > 0)){ | ||
79 | + Method[] methods = cType.getMethods(); | ||
80 | + for (Method method : methods){ | ||
81 | + String methodName = method.getName(); | ||
82 | + if (methodName.indexOf("get") != -1 && methodName != "getClass") { | ||
83 | + String name = methodName.substring(3); | ||
84 | + name = name.toLowerCase(); | ||
85 | + if (value.contains(name)){ | ||
86 | + Object o = null; | ||
87 | + try { | ||
88 | + o = method.invoke(source, null); | ||
89 | + } catch (Exception e) { | ||
90 | + e.printStackTrace(); | ||
91 | + } | ||
92 | + writer.addAttribute(name, o==null?"":o.toString()); | ||
93 | + } | ||
94 | + } | ||
95 | + } | ||
96 | + } | ||
97 | + } | ||
98 | + @SuppressWarnings("unchecked") | ||
99 | + public void marshal(Object source, HierarchicalStreamWriter writer, | ||
100 | + MarshallingContext context) { | ||
101 | + if (null == source) | ||
102 | + return; | ||
103 | + Class cType = source.getClass(); | ||
104 | + Field[] fields = cType.getDeclaredFields(); | ||
105 | + if (source instanceof List) { | ||
106 | + List list = (List) source; | ||
107 | + for (Object obj : list) { | ||
108 | + XStreamAlias alias = obj.getClass().getAnnotation(XStreamAlias.class); | ||
109 | + if (alias != null) { | ||
110 | + writer.startNode(alias.value()); | ||
111 | + marshal(obj, writer, context); | ||
112 | + writer.endNode(); | ||
113 | + }else { | ||
114 | + marshal(obj, writer, context); | ||
115 | + } | ||
116 | + } | ||
117 | + } else { | ||
118 | + for (Field field : fields) { | ||
119 | + //获得get方法 | ||
120 | + String temp1 = "get" | ||
121 | + + field.getName().substring(0, 1).toUpperCase() | ||
122 | + + field.getName().substring(1); | ||
123 | + Method m = null; | ||
124 | + try { | ||
125 | + m = cType.getMethod(temp1, null); | ||
126 | + } catch (SecurityException e1) { | ||
127 | + e1.printStackTrace(); | ||
128 | + } catch (NoSuchMethodException e1) { | ||
129 | + e1.printStackTrace(); | ||
130 | + } | ||
131 | + String methodName = m.getName(); | ||
132 | + if (methodName.indexOf("get") != -1 && methodName != "getClass") { | ||
133 | + boolean isBaseType = isBaseType(m.getReturnType()); | ||
134 | + String name = methodName.substring(3); | ||
135 | + Object o = null; | ||
136 | + try { | ||
137 | + o = m.invoke(source, null); | ||
138 | + } catch (Exception e) { | ||
139 | + e.printStackTrace(); | ||
140 | + } | ||
141 | + //递归打出基础类型值 | ||
142 | + if (isBaseType) { | ||
143 | + if(getAliasByNameAndType(name, cType)!=null){ | ||
144 | + writer.startNode(getAliasByNameAndType(name, cType).value()); | ||
145 | + writeData(o, m.getReturnType(), writer); | ||
146 | + writer.endNode(); | ||
147 | + } | ||
148 | + } else { | ||
149 | + XStreamAlias alias = getAliasByNameAndType(name, cType); | ||
150 | + if (alias == null) { | ||
151 | + marshal(o, writer, context); | ||
152 | + } else { | ||
153 | + writer.startNode(alias.value()); | ||
154 | + marshal(o, writer, context); | ||
155 | + writer.endNode(); | ||
156 | + } | ||
157 | + } | ||
158 | + } | ||
159 | + } | ||
160 | + } | ||
161 | + } | ||
162 | + | ||
163 | + /** | ||
164 | + * 根据Name和类获得Xstream注解 | ||
165 | + * @param name | ||
166 | + * Name | ||
167 | + * @param cType | ||
168 | + * 类 | ||
169 | + * @return | ||
170 | + * XStreamAlias | ||
171 | + */ | ||
172 | + private XStreamAlias getAliasByNameAndType(String name,Class<?> cType){ | ||
173 | + String temp = name.substring(0, 1).toLowerCase() | ||
174 | + + name.substring(1); | ||
175 | + Field f = null; | ||
176 | + try { | ||
177 | + f = cType.getDeclaredField(temp); | ||
178 | + } catch (SecurityException e) { | ||
179 | + e.printStackTrace(); | ||
180 | + } catch (NoSuchFieldException e) { | ||
181 | + e.printStackTrace(); | ||
182 | + } | ||
183 | + XStreamAlias alias = f.getAnnotation(XStreamAlias.class); | ||
184 | + return alias; | ||
185 | + } | ||
186 | + | ||
187 | + /** | ||
188 | + * 改写输出XML | ||
189 | + * @param o | ||
190 | + * @param ReturnType | ||
191 | + * @param writer | ||
192 | + */ | ||
193 | + private void writeData(Object o,Class<?> ReturnType,HierarchicalStreamWriter writer) { | ||
194 | + //如果是数字类型的话就要预设为0而不能为空 | ||
195 | + if (isNumValueType(ReturnType)) { | ||
196 | + if (o == null) { | ||
197 | + writer.setValue("0"); | ||
198 | + }else if (ReturnType.equals(Double.class)||ReturnType.equals(double.class)||ReturnType.equals(BigDecimal.class)) { | ||
199 | + DecimalFormat df = new DecimalFormat("#.##"); | ||
200 | + writer.setValue(df.format(o)); | ||
201 | + }else { | ||
202 | + writer.setValue(o.toString()); | ||
203 | + } | ||
204 | + } else { | ||
205 | + writer.setValue(o == null ? "" : o.toString()); | ||
206 | + } | ||
207 | + } | ||
208 | + | ||
209 | + public Object unmarshal(HierarchicalStreamReader reader, | ||
210 | + UnmarshallingContext context) { | ||
211 | + return null; | ||
212 | + } | ||
213 | + | ||
214 | + public boolean canConvert(Class type) { | ||
215 | + return true; | ||
216 | + } | ||
217 | + | ||
218 | + | ||
219 | + /** | ||
220 | + * 判断是否为基本类型 | ||
221 | + * @param type | ||
222 | + * @return | ||
223 | + * boolean | ||
224 | + */ | ||
225 | + private boolean isBaseType(Class<?> type) { | ||
226 | + if (type.equals(Integer.class) || type.equals(Double.class) | ||
227 | + || type.equals(String.class) || type.equals(Boolean.class) | ||
228 | + || type.equals(Long.class) || type.equals(Short.class) | ||
229 | + || type.equals(Byte.class) || type.equals(Float.class) | ||
230 | + || type.equals(BigDecimal.class) || type.equals(int.class) | ||
231 | + || type.equals(float.class) || type.equals(long.class) | ||
232 | + || type.equals(double.class) || type.equals(short.class) | ||
233 | + || type.equals(boolean.class) || type.equals(byte.class) | ||
234 | + || type.equals(Timestamp.class)) { | ||
235 | + return true; | ||
236 | + } | ||
237 | + return false; | ||
238 | + } | ||
239 | + | ||
240 | + /** | ||
241 | + * 判断是否为数字类型 | ||
242 | + * @param type | ||
243 | + * @return | ||
244 | + * boolean | ||
245 | + */ | ||
246 | + public boolean isNumValueType(Class<?> type) { | ||
247 | + if (type.equals(Integer.class) || type.equals(Double.class) | ||
248 | + || type.equals(Long.class) || type.equals(Short.class) | ||
249 | + || type.equals(Float.class) || type.equals(BigDecimal.class) | ||
250 | + || type.equals(int.class) || type.equals(float.class) | ||
251 | + || type.equals(long.class) || type.equals(double.class) | ||
252 | + || type.equals(short.class)) { | ||
253 | + return true; | ||
254 | + } | ||
255 | + return false; | ||
256 | + } | ||
257 | +} |
1 | +package com.thinkgem.jeesite.common.utils; | ||
2 | + | ||
3 | +import org.springframework.stereotype.Component; | ||
4 | + | ||
5 | +import com.thinkgem.jeesite.modules.xml.CommandXmlEntity; | ||
6 | +import com.thinkgem.jeesite.modules.xml.MsgXmlEntity; | ||
7 | +import com.thoughtworks.xstream.XStream; | ||
8 | + | ||
9 | +@Component | ||
10 | +public class XmlGen { | ||
11 | + | ||
12 | + /** | ||
13 | + * 生成抬杆xml报文 | ||
14 | + * @param entity | ||
15 | + */ | ||
16 | + public static String genControlCommandXml(CommandXmlEntity xmlVO){ | ||
17 | + XStream xstream = new XStream(); | ||
18 | + xstream.autodetectAnnotations(true); | ||
19 | + //xstream.registerConverter(new NullConverter()); | ||
20 | + String xml = xstream.toXML(xmlVO); | ||
21 | + xml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+xml; | ||
22 | + xml=xml.replace("__", "_"); | ||
23 | + System.out.println(xml); | ||
24 | + return xml; | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * 生成IMF报文 | ||
29 | + * @param entity | ||
30 | + */ | ||
31 | + public static String genIMFXml(MsgXmlEntity msgXmlEntity){ | ||
32 | + XStream xstream = new XStream(); | ||
33 | + xstream.autodetectAnnotations(true); | ||
34 | + xstream.registerConverter(new NullConverter()); | ||
35 | + String xml = xstream.toXML(msgXmlEntity); | ||
36 | + xml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+xml; | ||
37 | + xml=xml.replace("__", "_"); | ||
38 | + System.out.println(xml); | ||
39 | + return xml; | ||
40 | + } | ||
41 | +} |
1 | +package com.thinkgem.jeesite.modules.xml; | ||
2 | +import com.thinkgem.jeesite.common.utils.XmlGen; | ||
3 | +/** | ||
4 | + * 设备控制命令报文 | ||
5 | + */ | ||
6 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
7 | +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; | ||
8 | + | ||
9 | +@XStreamAlias("COMMAND_INFO") | ||
10 | +public class CommandXmlEntity { | ||
11 | + | ||
12 | + @XStreamAsAttribute | ||
13 | + @XStreamAlias("AREA_ID") | ||
14 | + private String areaId; // 场站编号(10位) | ||
15 | + | ||
16 | + @XStreamAsAttribute | ||
17 | + @XStreamAlias("CHNL_NO") | ||
18 | + private String chnlNo; //通道编号(10位) | ||
19 | + | ||
20 | + @XStreamAsAttribute | ||
21 | + @XStreamAlias("I_E_TYPE") | ||
22 | + private String ieType; //进出卡口标志 I表示进卡口,E(字母)表示出卡口 | ||
23 | + | ||
24 | + @XStreamAsAttribute | ||
25 | + @XStreamAlias("SEQ_NO") | ||
26 | + private String seqNo; //20位的字符串。表示报文的序列号 | ||
27 | + | ||
28 | + @XStreamAlias("EXCUTE_COMMAND") | ||
29 | + private String excuteCommand; //服务器返回指令定义 | ||
30 | + | ||
31 | + @XStreamAlias("GPS") | ||
32 | + private GpsXmlEntity gps; //GPS信息部分 | ||
33 | + | ||
34 | + @XStreamAlias("SEAL") | ||
35 | + private SealXmlEntity seal; //电子关锁信息部分 | ||
36 | + | ||
37 | + @XStreamAlias("ContaNum") | ||
38 | + private String contaNum; //箱数 | ||
39 | + | ||
40 | + @XStreamAlias("OP_TYPE") | ||
41 | + private String opType; //0:抬杠放行 1:待处理 2:退回 | ||
42 | + | ||
43 | + @XStreamAlias("OP_REASON") | ||
44 | + private String opReason; //抬杠原因 | ||
45 | + | ||
46 | + @XStreamAlias("OP_ID") | ||
47 | + private String opId; //操作人 | ||
48 | + | ||
49 | + public String getAreaId() { | ||
50 | + return areaId; | ||
51 | + } | ||
52 | + | ||
53 | + public void setAreaId(String areaId) { | ||
54 | + this.areaId = areaId; | ||
55 | + } | ||
56 | + | ||
57 | + public String getChnlNo() { | ||
58 | + return chnlNo; | ||
59 | + } | ||
60 | + | ||
61 | + public void setChnlNo(String chnlNo) { | ||
62 | + this.chnlNo = chnlNo; | ||
63 | + } | ||
64 | + | ||
65 | + public String getIeType() { | ||
66 | + return ieType; | ||
67 | + } | ||
68 | + | ||
69 | + public void setIeType(String ieType) { | ||
70 | + this.ieType = ieType; | ||
71 | + } | ||
72 | + | ||
73 | + public String getSeqNo() { | ||
74 | + return seqNo; | ||
75 | + } | ||
76 | + | ||
77 | + public void setSeqNo(String seqNo) { | ||
78 | + this.seqNo = seqNo; | ||
79 | + } | ||
80 | + | ||
81 | + public String getExcuteCommand() { | ||
82 | + return excuteCommand; | ||
83 | + } | ||
84 | + | ||
85 | + public void setExcuteCommand(String excuteCommand) { | ||
86 | + this.excuteCommand = excuteCommand; | ||
87 | + } | ||
88 | + | ||
89 | + public GpsXmlEntity getGps() { | ||
90 | + return gps; | ||
91 | + } | ||
92 | + | ||
93 | + public void setGps(GpsXmlEntity gps) { | ||
94 | + this.gps = gps; | ||
95 | + } | ||
96 | + | ||
97 | + public SealXmlEntity getSeal() { | ||
98 | + return seal; | ||
99 | + } | ||
100 | + | ||
101 | + public void setSeal(SealXmlEntity seal) { | ||
102 | + this.seal = seal; | ||
103 | + } | ||
104 | + | ||
105 | + public String getContaNum() { | ||
106 | + return contaNum; | ||
107 | + } | ||
108 | + | ||
109 | + public void setContaNum(String contaNum) { | ||
110 | + this.contaNum = contaNum; | ||
111 | + } | ||
112 | + | ||
113 | + public String getOpType() { | ||
114 | + return opType; | ||
115 | + } | ||
116 | + | ||
117 | + public void setOpType(String opType) { | ||
118 | + this.opType = opType; | ||
119 | + } | ||
120 | + | ||
121 | + public String getOpReason() { | ||
122 | + return opReason; | ||
123 | + } | ||
124 | + | ||
125 | + public void setOpReason(String opReason) { | ||
126 | + this.opReason = opReason; | ||
127 | + } | ||
128 | + | ||
129 | + public String getOpId() { | ||
130 | + return opId; | ||
131 | + } | ||
132 | + | ||
133 | + public void setOpId(String opId) { | ||
134 | + this.opId = opId; | ||
135 | + } | ||
136 | + | ||
137 | + public static void main(String[] args) { | ||
138 | + CommandXmlEntity xmlVO = new CommandXmlEntity(); | ||
139 | + GpsXmlEntity gps = new GpsXmlEntity(); | ||
140 | + SealXmlEntity seal = new SealXmlEntity(); | ||
141 | + xmlVO.setGps(gps); | ||
142 | + xmlVO.setSeal(seal); | ||
143 | + xmlVO.setAreaId("1"); | ||
144 | + xmlVO.setChnlNo("1"); | ||
145 | + xmlVO.setIeType("1"); | ||
146 | + xmlVO.setSeqNo("1"); | ||
147 | + xmlVO.setOpId("20181026"); | ||
148 | + String xml = XmlGen.genControlCommandXml(xmlVO); | ||
149 | + } | ||
150 | +} | ||
151 | + |
1 | +package com.thinkgem.jeesite.modules.xml; | ||
2 | +/** | ||
3 | + * GPS信息 | ||
4 | + */ | ||
5 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
6 | + | ||
7 | + | ||
8 | +public class GpsXmlEntity { | ||
9 | + | ||
10 | + @XStreamAlias("VE_NAME") | ||
11 | + private String veName; // 海关车辆编号(值可以为空) | ||
12 | + | ||
13 | + @XStreamAlias("GPS_ID") | ||
14 | + private String gpsId; //GPS ID号 | ||
15 | + | ||
16 | + @XStreamAlias("ORIGIN_CUSTOMS") | ||
17 | + private String originCustom; //源关区号 | ||
18 | + | ||
19 | + @XStreamAlias("DEST_CUSTOMS") | ||
20 | + private String destCustoms; //目的关区号 | ||
21 | + | ||
22 | + public String getVeName() { | ||
23 | + return veName; | ||
24 | + } | ||
25 | + | ||
26 | + public void setVeName(String veName) { | ||
27 | + this.veName = veName; | ||
28 | + } | ||
29 | + | ||
30 | + public String getGpsId() { | ||
31 | + return gpsId; | ||
32 | + } | ||
33 | + | ||
34 | + public void setGpsId(String gpsId) { | ||
35 | + this.gpsId = gpsId; | ||
36 | + } | ||
37 | + | ||
38 | + public String getOriginCustom() { | ||
39 | + return originCustom; | ||
40 | + } | ||
41 | + | ||
42 | + public void setOriginCustom(String originCustom) { | ||
43 | + this.originCustom = originCustom; | ||
44 | + } | ||
45 | + | ||
46 | + public String getDestCustoms() { | ||
47 | + return destCustoms; | ||
48 | + } | ||
49 | + | ||
50 | + public void setDestCustoms(String destCustoms) { | ||
51 | + this.destCustoms = destCustoms; | ||
52 | + } | ||
53 | +} | ||
54 | + |
1 | +package com.thinkgem.jeesite.modules.xml; | ||
2 | + | ||
3 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
4 | + | ||
5 | +public class MessageBodyXmlEntity { | ||
6 | + | ||
7 | + @XStreamAlias("COMMAND_INFO") | ||
8 | + private CommandXmlEntity commandXmlEntity; | ||
9 | + | ||
10 | + public CommandXmlEntity getCommandXmlEntity() { | ||
11 | + return commandXmlEntity; | ||
12 | + } | ||
13 | + | ||
14 | + public void setCommandXmlEntity(CommandXmlEntity commandXmlEntity) { | ||
15 | + this.commandXmlEntity = commandXmlEntity; | ||
16 | + } | ||
17 | +} |
1 | +package com.thinkgem.jeesite.modules.xml; | ||
2 | +import java.util.Date; | ||
3 | + | ||
4 | +import com.thinkgem.jeesite.common.utils.DateUtils; | ||
5 | +/** | ||
6 | + * MSG消息根标签 | ||
7 | + */ | ||
8 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
9 | + | ||
10 | + | ||
11 | +public class MetaXmlEntity { | ||
12 | + | ||
13 | + @XStreamAlias("SNDR") | ||
14 | + private String sndr; //消息发送者为FIMS | ||
15 | + | ||
16 | + @XStreamAlias("RCVR") | ||
17 | + private String rcvr; //消息接收者为空 代表发送给所有IMF预定义的接收者 | ||
18 | + | ||
19 | + @XStreamAlias("SEQN") | ||
20 | + private String seqn; //本消息序号,消息唯一标识 | ||
21 | + | ||
22 | + @XStreamAlias("DDTM") | ||
23 | + private String ddtm = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss"); //发送时间,格式为yyyyMMddHHmmss | ||
24 | + | ||
25 | + @XStreamAlias("TYPE") | ||
26 | + private String type; //消息大类型; DFOE | ||
27 | + | ||
28 | + @XStreamAlias("STYP") | ||
29 | + private String styp; //消息子类型; DFDL(整表消息) | ||
30 | + | ||
31 | + public String getSndr() { | ||
32 | + return sndr; | ||
33 | + } | ||
34 | + | ||
35 | + public void setSndr(String sndr) { | ||
36 | + this.sndr = sndr; | ||
37 | + } | ||
38 | + | ||
39 | + public String getRcvr() { | ||
40 | + return rcvr; | ||
41 | + } | ||
42 | + | ||
43 | + public void setRcvr(String rcvr) { | ||
44 | + this.rcvr = rcvr; | ||
45 | + } | ||
46 | + | ||
47 | + public String getSeqn() { | ||
48 | + return seqn; | ||
49 | + } | ||
50 | + | ||
51 | + public void setSeqn(String seqn) { | ||
52 | + this.seqn = seqn; | ||
53 | + } | ||
54 | + | ||
55 | + public String getDdtm() { | ||
56 | + return ddtm; | ||
57 | + } | ||
58 | + | ||
59 | + public void setDdtm(String ddtm) { | ||
60 | + this.ddtm = ddtm; | ||
61 | + } | ||
62 | + | ||
63 | + public String getType() { | ||
64 | + return type; | ||
65 | + } | ||
66 | + | ||
67 | + public void setType(String type) { | ||
68 | + this.type = type; | ||
69 | + } | ||
70 | + | ||
71 | + public String getStyp() { | ||
72 | + return styp; | ||
73 | + } | ||
74 | + | ||
75 | + public void setStyp(String styp) { | ||
76 | + this.styp = styp; | ||
77 | + } | ||
78 | +} | ||
79 | + |
1 | +package com.thinkgem.jeesite.modules.xml; | ||
2 | +import com.thinkgem.jeesite.common.utils.XmlGen; | ||
3 | +/** | ||
4 | + * MSG消息根标签 | ||
5 | + */ | ||
6 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
7 | + | ||
8 | +@XStreamAlias("MSG") | ||
9 | +public class MsgXmlEntity { | ||
10 | + | ||
11 | + @XStreamAlias("META") | ||
12 | + private MetaXmlEntity metaXmlEntity; | ||
13 | + | ||
14 | + | ||
15 | + @XStreamAlias("MESSAGE_BODY") | ||
16 | + private MessageBodyXmlEntity messageBody; | ||
17 | + | ||
18 | + | ||
19 | + public MetaXmlEntity getMetaXmlEntity() { | ||
20 | + return metaXmlEntity; | ||
21 | + } | ||
22 | + | ||
23 | + | ||
24 | + public void setMetaXmlEntity(MetaXmlEntity metaXmlEntity) { | ||
25 | + this.metaXmlEntity = metaXmlEntity; | ||
26 | + } | ||
27 | + | ||
28 | + | ||
29 | + public MessageBodyXmlEntity getMessageBody() { | ||
30 | + return messageBody; | ||
31 | + } | ||
32 | + | ||
33 | + | ||
34 | + public void setMessageBody(MessageBodyXmlEntity messageBody) { | ||
35 | + this.messageBody = messageBody; | ||
36 | + } | ||
37 | + | ||
38 | + public static void main(String[] args) { | ||
39 | + CommandXmlEntity commandXmlEntity = new CommandXmlEntity(); | ||
40 | + GpsXmlEntity gps = new GpsXmlEntity(); | ||
41 | + SealXmlEntity seal = new SealXmlEntity(); | ||
42 | + MsgXmlEntity msgXmlEntity = new MsgXmlEntity(); | ||
43 | + MetaXmlEntity metaXmlEntity = new MetaXmlEntity(); | ||
44 | + MessageBodyXmlEntity messageBody = new MessageBodyXmlEntity(); | ||
45 | + messageBody.setCommandXmlEntity(commandXmlEntity); | ||
46 | + commandXmlEntity.setGps(gps); | ||
47 | + commandXmlEntity.setSeal(seal); | ||
48 | + msgXmlEntity.setMetaXmlEntity(metaXmlEntity); | ||
49 | + msgXmlEntity.setMessageBody(messageBody); | ||
50 | + | ||
51 | + String xml = XmlGen.genIMFXml(msgXmlEntity); | ||
52 | + } | ||
53 | +} | ||
54 | + |
1 | +package com.thinkgem.jeesite.modules.xml; | ||
2 | +/** | ||
3 | + * 电子关锁信息部分 | ||
4 | + */ | ||
5 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
6 | + | ||
7 | + | ||
8 | +public class SealXmlEntity { | ||
9 | + | ||
10 | + @XStreamAlias("ESEAL_ID") | ||
11 | + private String esealId; // 关锁号码 | ||
12 | + | ||
13 | + @XStreamAlias("SEAL_KEY") | ||
14 | + private String sealKey; //关锁密钥 | ||
15 | + | ||
16 | + @XStreamAlias("OPEN_TIMES") | ||
17 | + private String openTimes; //电子关锁开启次数,当解封的时候下发 | ||
18 | + | ||
19 | + public String getEsealId() { | ||
20 | + return esealId; | ||
21 | + } | ||
22 | + | ||
23 | + public void setEsealId(String esealId) { | ||
24 | + this.esealId = esealId; | ||
25 | + } | ||
26 | + | ||
27 | + public String getSealKey() { | ||
28 | + return sealKey; | ||
29 | + } | ||
30 | + | ||
31 | + public void setSealKey(String sealKey) { | ||
32 | + this.sealKey = sealKey; | ||
33 | + } | ||
34 | + | ||
35 | + public String getOpenTimes() { | ||
36 | + return openTimes; | ||
37 | + } | ||
38 | + | ||
39 | + public void setOpenTimes(String openTimes) { | ||
40 | + this.openTimes = openTimes; | ||
41 | + } | ||
42 | + | ||
43 | +} | ||
44 | + |
@@ -17,11 +17,13 @@ import com.thinkgem.jeesite.common.persistence.DataEntity; | @@ -17,11 +17,13 @@ import com.thinkgem.jeesite.common.persistence.DataEntity; | ||
17 | public class Bayonet extends DataEntity<Bayonet> { | 17 | public class Bayonet extends DataEntity<Bayonet> { |
18 | 18 | ||
19 | private static final long serialVersionUID = 1L; | 19 | private static final long serialVersionUID = 1L; |
20 | + | ||
21 | + private Yard yard; //父表 | ||
22 | + | ||
20 | private String yardId; // 场站 | 23 | private String yardId; // 场站 |
21 | private String name; // 卡口名称 | 24 | private String name; // 卡口名称 |
22 | private String channel; // 通道编号 | 25 | private String channel; // 通道编号 |
23 | 26 | ||
24 | - private String yardName; //场站名称 | ||
25 | 27 | ||
26 | public Bayonet() { | 28 | public Bayonet() { |
27 | super(); | 29 | super(); |
@@ -31,7 +33,6 @@ public class Bayonet extends DataEntity<Bayonet> { | @@ -31,7 +33,6 @@ public class Bayonet extends DataEntity<Bayonet> { | ||
31 | super(id); | 33 | super(id); |
32 | } | 34 | } |
33 | 35 | ||
34 | - @NotNull(message="场站名称不能为空") | ||
35 | @Length(min=0, max=64, message="场站长度必须介于 0 和 64 之间") | 36 | @Length(min=0, max=64, message="场站长度必须介于 0 和 64 之间") |
36 | public String getYardId() { | 37 | public String getYardId() { |
37 | return yardId; | 38 | return yardId; |
@@ -61,13 +62,12 @@ public class Bayonet extends DataEntity<Bayonet> { | @@ -61,13 +62,12 @@ public class Bayonet extends DataEntity<Bayonet> { | ||
61 | this.channel = channel; | 62 | this.channel = channel; |
62 | } | 63 | } |
63 | 64 | ||
64 | - | ||
65 | - public String getYardName() { | ||
66 | - return yardName; | 65 | + public Yard getYard() { |
66 | + return yard; | ||
67 | } | 67 | } |
68 | 68 | ||
69 | - public void setYardName(String yardName) { | ||
70 | - this.yardName = yardName; | 69 | + public void setYard(Yard yard) { |
70 | + this.yard = yard; | ||
71 | } | 71 | } |
72 | 72 | ||
73 | } | 73 | } |
@@ -20,7 +20,7 @@ public class Warehouse extends DataEntity<Warehouse> { | @@ -20,7 +20,7 @@ public class Warehouse extends DataEntity<Warehouse> { | ||
20 | private String yardId; // 场站ID_父ID | 20 | private String yardId; // 场站ID_父ID |
21 | private String name; // 仓库名称 | 21 | private String name; // 仓库名称 |
22 | 22 | ||
23 | - private String yardName; //场站名称 | 23 | + private Yard yard; //父表 |
24 | 24 | ||
25 | public Warehouse() { | 25 | public Warehouse() { |
26 | super(); | 26 | super(); |
@@ -49,13 +49,14 @@ public class Warehouse extends DataEntity<Warehouse> { | @@ -49,13 +49,14 @@ public class Warehouse extends DataEntity<Warehouse> { | ||
49 | this.name = name; | 49 | this.name = name; |
50 | } | 50 | } |
51 | 51 | ||
52 | - | ||
53 | - public String getYardName() { | ||
54 | - return yardName; | 52 | + public Yard getYard() { |
53 | + return yard; | ||
55 | } | 54 | } |
56 | 55 | ||
57 | - public void setYardName(String yardName) { | ||
58 | - this.yardName = yardName; | 56 | + public void setYard(Yard yard) { |
57 | + this.yard = yard; | ||
59 | } | 58 | } |
60 | 59 | ||
60 | + | ||
61 | + | ||
61 | } | 62 | } |
@@ -20,7 +20,7 @@ public class Wharf extends DataEntity<Wharf> { | @@ -20,7 +20,7 @@ public class Wharf extends DataEntity<Wharf> { | ||
20 | private String yardId; // 场站ID_父ID | 20 | private String yardId; // 场站ID_父ID |
21 | private String name; // 码头名称 | 21 | private String name; // 码头名称 |
22 | 22 | ||
23 | - private String yardName; //场站名称 | 23 | + private Yard yard; //父表 |
24 | 24 | ||
25 | public Wharf() { | 25 | public Wharf() { |
26 | super(); | 26 | super(); |
@@ -50,12 +50,13 @@ public class Wharf extends DataEntity<Wharf> { | @@ -50,12 +50,13 @@ public class Wharf extends DataEntity<Wharf> { | ||
50 | } | 50 | } |
51 | 51 | ||
52 | 52 | ||
53 | - public String getYardName() { | ||
54 | - return yardName; | 53 | + |
54 | + public Yard getYard() { | ||
55 | + return yard; | ||
55 | } | 56 | } |
56 | 57 | ||
57 | - public void setYardName(String yardName) { | ||
58 | - this.yardName = yardName; | 58 | + public void setYard(Yard yard) { |
59 | + this.yard = yard; | ||
59 | } | 60 | } |
60 | 61 | ||
61 | } | 62 | } |
@@ -3,10 +3,13 @@ | @@ -3,10 +3,13 @@ | ||
3 | */ | 3 | */ |
4 | package com.thinkgem.jeesite.modules.yard.entity; | 4 | package com.thinkgem.jeesite.modules.yard.entity; |
5 | 5 | ||
6 | +import java.util.List; | ||
7 | + | ||
6 | import javax.validation.constraints.NotNull; | 8 | import javax.validation.constraints.NotNull; |
7 | 9 | ||
8 | import org.hibernate.validator.constraints.Length; | 10 | import org.hibernate.validator.constraints.Length; |
9 | 11 | ||
12 | +import com.google.common.collect.Lists; | ||
10 | import com.thinkgem.jeesite.common.persistence.DataEntity; | 13 | import com.thinkgem.jeesite.common.persistence.DataEntity; |
11 | 14 | ||
12 | /** | 15 | /** |
@@ -20,6 +23,12 @@ public class Yard extends DataEntity<Yard> { | @@ -20,6 +23,12 @@ public class Yard extends DataEntity<Yard> { | ||
20 | private String name; // 场站名称 | 23 | private String name; // 场站名称 |
21 | private String customsCode; // 关区代码 | 24 | private String customsCode; // 关区代码 |
22 | 25 | ||
26 | + private List<Bayonet> bayonetList = Lists.newArrayList(); // 卡口 | ||
27 | + | ||
28 | + private List<Wharf> WarfList = Lists.newArrayList(); // 码头 | ||
29 | + | ||
30 | + private List<Warehouse> warehouseList = Lists.newArrayList(); // 仓库 | ||
31 | + | ||
23 | public Yard() { | 32 | public Yard() { |
24 | super(); | 33 | super(); |
25 | } | 34 | } |
@@ -47,4 +56,28 @@ public class Yard extends DataEntity<Yard> { | @@ -47,4 +56,28 @@ public class Yard extends DataEntity<Yard> { | ||
47 | this.customsCode = customsCode; | 56 | this.customsCode = customsCode; |
48 | } | 57 | } |
49 | 58 | ||
59 | + public List<Bayonet> getBayonetList() { | ||
60 | + return bayonetList; | ||
61 | + } | ||
62 | + | ||
63 | + public void setBayonetList(List<Bayonet> bayonetList) { | ||
64 | + this.bayonetList = bayonetList; | ||
65 | + } | ||
66 | + | ||
67 | + public List<Warehouse> getWarehouseList() { | ||
68 | + return warehouseList; | ||
69 | + } | ||
70 | + | ||
71 | + public void setWarehouseList(List<Warehouse> warehouseList) { | ||
72 | + this.warehouseList = warehouseList; | ||
73 | + } | ||
74 | + | ||
75 | + public List<Wharf> getWarfList() { | ||
76 | + return WarfList; | ||
77 | + } | ||
78 | + | ||
79 | + public void setWarfList(List<Wharf> warfList) { | ||
80 | + WarfList = warfList; | ||
81 | + } | ||
82 | + | ||
50 | } | 83 | } |
@@ -46,6 +46,13 @@ public class YardController extends BaseController { | @@ -46,6 +46,13 @@ public class YardController extends BaseController { | ||
46 | return entity; | 46 | return entity; |
47 | } | 47 | } |
48 | 48 | ||
49 | + @RequestMapping(value = {"regist"}) | ||
50 | + public String regist() { | ||
51 | + | ||
52 | + return "modules/yard/regist"; | ||
53 | + } | ||
54 | + | ||
55 | + | ||
49 | @RequiresPermissions("yard:yard:view") | 56 | @RequiresPermissions("yard:yard:view") |
50 | @RequestMapping(value = {"list", ""}) | 57 | @RequestMapping(value = {"list", ""}) |
51 | public String list(Yard yard, HttpServletRequest request, HttpServletResponse response, Model model) { | 58 | public String list(Yard yard, HttpServletRequest request, HttpServletResponse response, Model model) { |
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.thinkgem.jeesite.modules.yard.dao.BayonetDao"> | ||
4 | + | ||
5 | + <sql id="bayonetColumns"> | ||
6 | + p.name AS "yardName", | ||
7 | + a.id AS "id", | ||
8 | + a.yard_id AS "yardId", | ||
9 | + a.name AS "name", | ||
10 | + a.channel AS "channel", | ||
11 | + a.create_by AS "createBy.id", | ||
12 | + a.create_date AS "createDate", | ||
13 | + a.update_by AS "updateBy.id", | ||
14 | + a.update_date AS "updateDate", | ||
15 | + a.remarks AS "remarks", | ||
16 | + a.del_flag AS "delFlag" | ||
17 | + </sql> | ||
18 | + | ||
19 | + <sql id="bayonetJoins"> | ||
20 | + LEFT JOIN yard p ON p.id = a.yard_id | ||
21 | + </sql> | ||
22 | + | ||
23 | + <select id="get" resultType="Bayonet"> | ||
24 | + SELECT | ||
25 | + <include refid="bayonetColumns"/> | ||
26 | + FROM bayonet a | ||
27 | + <include refid="bayonetJoins"/> | ||
28 | + WHERE a.id = #{id} | ||
29 | + </select> | ||
30 | + | ||
31 | + <select id="findList" resultType="Bayonet"> | ||
32 | + SELECT | ||
33 | + <include refid="bayonetColumns"/> | ||
34 | + FROM bayonet a | ||
35 | + <include refid="bayonetJoins"/> | ||
36 | + <where> | ||
37 | + a.del_flag = #{DEL_FLAG_NORMAL} | ||
38 | + <if test="yardName != null and yardName != ''"> | ||
39 | + AND p.name LIKE | ||
40 | + <if test="dbName == 'oracle'">'%'||#{yardName}||'%'</if> | ||
41 | + <if test="dbName == 'mssql'">'%'+#{yardName}+'%'</if> | ||
42 | + <if test="dbName == 'mysql'">concat('%',#{yardName},'%')</if> | ||
43 | + </if> | ||
44 | + <if test="name != null and name != ''"> | ||
45 | + AND a.name LIKE | ||
46 | + <if test="dbName == 'oracle'">'%'||#{name}||'%'</if> | ||
47 | + <if test="dbName == 'mssql'">'%'+#{name}+'%'</if> | ||
48 | + <if test="dbName == 'mysql'">concat('%',#{name},'%')</if> | ||
49 | + </if> | ||
50 | + <if test="channel != null and channel != ''"> | ||
51 | + AND a.channel = #{channel} | ||
52 | + </if> | ||
53 | + </where> | ||
54 | + <choose> | ||
55 | + <when test="page !=null and page.orderBy != null and page.orderBy != ''"> | ||
56 | + ORDER BY ${page.orderBy} | ||
57 | + </when> | ||
58 | + <otherwise> | ||
59 | + ORDER BY a.update_date DESC | ||
60 | + </otherwise> | ||
61 | + </choose> | ||
62 | + </select> | ||
63 | + | ||
64 | + <select id="findAllList" resultType="Bayonet"> | ||
65 | + SELECT | ||
66 | + <include refid="bayonetColumns"/> | ||
67 | + FROM bayonet a | ||
68 | + <include refid="bayonetJoins"/> | ||
69 | + <where> | ||
70 | + a.del_flag = #{DEL_FLAG_NORMAL} | ||
71 | + </where> | ||
72 | + <choose> | ||
73 | + <when test="page !=null and page.orderBy != null and page.orderBy != ''"> | ||
74 | + ORDER BY ${page.orderBy} | ||
75 | + </when> | ||
76 | + <otherwise> | ||
77 | + ORDER BY a.update_date DESC | ||
78 | + </otherwise> | ||
79 | + </choose> | ||
80 | + </select> | ||
81 | + | ||
82 | + <insert id="insert"> | ||
83 | + INSERT INTO bayonet( | ||
84 | + id, | ||
85 | + yard_id, | ||
86 | + name, | ||
87 | + channel, | ||
88 | + create_by, | ||
89 | + create_date, | ||
90 | + update_by, | ||
91 | + update_date, | ||
92 | + remarks, | ||
93 | + del_flag | ||
94 | + ) VALUES ( | ||
95 | + #{id}, | ||
96 | + #{yardId}, | ||
97 | + #{name}, | ||
98 | + #{channel}, | ||
99 | + #{createBy.id}, | ||
100 | + #{createDate}, | ||
101 | + #{updateBy.id}, | ||
102 | + #{updateDate}, | ||
103 | + #{remarks}, | ||
104 | + #{delFlag} | ||
105 | + ) | ||
106 | + </insert> | ||
107 | + | ||
108 | + <update id="update"> | ||
109 | + UPDATE bayonet SET | ||
110 | + yard_id = #{yardId}, | ||
111 | + name = #{name}, | ||
112 | + channel = #{channel}, | ||
113 | + update_by = #{updateBy.id}, | ||
114 | + update_date = #{updateDate}, | ||
115 | + remarks = #{remarks} | ||
116 | + WHERE id = #{id} | ||
117 | + </update> | ||
118 | + | ||
119 | + <update id="delete"> | ||
120 | + UPDATE bayonet SET | ||
121 | + del_flag = #{DEL_FLAG_DELETE} | ||
122 | + WHERE id = #{id} | ||
123 | + </update> | ||
124 | + | ||
125 | +</mapper> |
@@ -3,21 +3,14 @@ | @@ -3,21 +3,14 @@ | ||
3 | <mapper namespace="com.thinkgem.jeesite.modules.yard.dao.BayonetDao"> | 3 | <mapper namespace="com.thinkgem.jeesite.modules.yard.dao.BayonetDao"> |
4 | 4 | ||
5 | <sql id="bayonetColumns"> | 5 | <sql id="bayonetColumns"> |
6 | - p.name AS "yardName", | ||
7 | - a.id AS "id", | ||
8 | - a.yard_id AS "yardId", | ||
9 | - a.name AS "name", | ||
10 | - a.channel AS "channel", | ||
11 | - a.create_by AS "createBy.id", | ||
12 | - a.create_date AS "createDate", | ||
13 | - a.update_by AS "updateBy.id", | ||
14 | - a.update_date AS "updateDate", | ||
15 | - a.remarks AS "remarks", | ||
16 | - a.del_flag AS "delFlag" | 6 | + a.*, |
7 | + b.id AS "yard.id", | ||
8 | + b.name AS "yard.name", | ||
9 | + b.customs_code AS "yard.customsCode" | ||
17 | </sql> | 10 | </sql> |
18 | 11 | ||
19 | <sql id="bayonetJoins"> | 12 | <sql id="bayonetJoins"> |
20 | - LEFT JOIN yard p ON p.id = a.yard_id | 13 | + JOIN yard b ON b.id = a.yard_id |
21 | </sql> | 14 | </sql> |
22 | 15 | ||
23 | <select id="get" resultType="Bayonet"> | 16 | <select id="get" resultType="Bayonet"> |
@@ -35,11 +28,11 @@ | @@ -35,11 +28,11 @@ | ||
35 | <include refid="bayonetJoins"/> | 28 | <include refid="bayonetJoins"/> |
36 | <where> | 29 | <where> |
37 | a.del_flag = #{DEL_FLAG_NORMAL} | 30 | a.del_flag = #{DEL_FLAG_NORMAL} |
38 | - <if test="yardName != null and yardName != ''"> | ||
39 | - AND p.name LIKE | ||
40 | - <if test="dbName == 'oracle'">'%'||#{yardName}||'%'</if> | ||
41 | - <if test="dbName == 'mssql'">'%'+#{yardName}+'%'</if> | ||
42 | - <if test="dbName == 'mysql'">concat('%',#{yardName},'%')</if> | 31 | + <if test="yard != null and yard != ''"> |
32 | + AND b.name LIKE | ||
33 | + <if test="dbName == 'oracle'">'%'||#{yard.name}||'%'</if> | ||
34 | + <if test="dbName == 'mssql'">'%'+#{yard.name}+'%'</if> | ||
35 | + <if test="dbName == 'mysql'">concat('%',#{yard.name},'%')</if> | ||
43 | </if> | 36 | </if> |
44 | <if test="name != null and name != ''"> | 37 | <if test="name != null and name != ''"> |
45 | AND a.name LIKE | 38 | AND a.name LIKE |
@@ -107,7 +100,7 @@ | @@ -107,7 +100,7 @@ | ||
107 | 100 | ||
108 | <update id="update"> | 101 | <update id="update"> |
109 | UPDATE bayonet SET | 102 | UPDATE bayonet SET |
110 | - yard_id = #{yardId}, | 103 | + yard_id = #{yard.id}, |
111 | name = #{name}, | 104 | name = #{name}, |
112 | channel = #{channel}, | 105 | channel = #{channel}, |
113 | update_by = #{updateBy.id}, | 106 | update_by = #{updateBy.id}, |
@@ -3,20 +3,14 @@ | @@ -3,20 +3,14 @@ | ||
3 | <mapper namespace="com.thinkgem.jeesite.modules.yard.dao.WarehouseDao"> | 3 | <mapper namespace="com.thinkgem.jeesite.modules.yard.dao.WarehouseDao"> |
4 | 4 | ||
5 | <sql id="warehouseColumns"> | 5 | <sql id="warehouseColumns"> |
6 | - p.name AS "yardName", | ||
7 | - a.id AS "id", | ||
8 | - a.yard_id AS "yardId", | ||
9 | - a.name AS "name", | ||
10 | - a.create_by AS "createBy.id", | ||
11 | - a.create_date AS "createDate", | ||
12 | - a.update_by AS "updateBy.id", | ||
13 | - a.update_date AS "updateDate", | ||
14 | - a.remarks AS "remarks", | ||
15 | - a.del_flag AS "delFlag" | 6 | + a.*, |
7 | + b.id AS "yard.id", | ||
8 | + b.name AS "yard.name", | ||
9 | + b.customs_code AS "yard.customsCode" | ||
16 | </sql> | 10 | </sql> |
17 | 11 | ||
18 | <sql id="warehouseJoins"> | 12 | <sql id="warehouseJoins"> |
19 | - LEFT JOIN yard p ON p.id = a.yard_id | 13 | + JOIN yard b ON b.id = a.yard_id |
20 | </sql> | 14 | </sql> |
21 | 15 | ||
22 | <select id="get" resultType="Warehouse"> | 16 | <select id="get" resultType="Warehouse"> |
@@ -34,11 +28,11 @@ | @@ -34,11 +28,11 @@ | ||
34 | <include refid="warehouseJoins"/> | 28 | <include refid="warehouseJoins"/> |
35 | <where> | 29 | <where> |
36 | a.del_flag = #{DEL_FLAG_NORMAL} | 30 | a.del_flag = #{DEL_FLAG_NORMAL} |
37 | - <if test="yardName != null and yardName != ''"> | ||
38 | - AND p.name LIKE | ||
39 | - <if test="dbName == 'oracle'">'%'||#{yardName}||'%'</if> | ||
40 | - <if test="dbName == 'mssql'">'%'+#{yardName}+'%'</if> | ||
41 | - <if test="dbName == 'mysql'">concat('%',#{yardName},'%')</if> | 31 | + <if test="yard != null and yard != ''"> |
32 | + AND b.name LIKE | ||
33 | + <if test="dbName == 'oracle'">'%'||#{yard.name}||'%'</if> | ||
34 | + <if test="dbName == 'mssql'">'%'+#{yard.name}+'%'</if> | ||
35 | + <if test="dbName == 'mysql'">concat('%',#{yard.name},'%')</if> | ||
42 | </if> | 36 | </if> |
43 | <if test="name != null and name != ''"> | 37 | <if test="name != null and name != ''"> |
44 | AND a.name LIKE | 38 | AND a.name LIKE |
@@ -3,20 +3,14 @@ | @@ -3,20 +3,14 @@ | ||
3 | <mapper namespace="com.thinkgem.jeesite.modules.yard.dao.WharfDao"> | 3 | <mapper namespace="com.thinkgem.jeesite.modules.yard.dao.WharfDao"> |
4 | 4 | ||
5 | <sql id="wharfColumns"> | 5 | <sql id="wharfColumns"> |
6 | - p.name AS "yardName", | ||
7 | - a.id AS "id", | ||
8 | - a.yard_id AS "yardId", | ||
9 | - a.name AS "name", | ||
10 | - a.create_by AS "createBy.id", | ||
11 | - a.create_date AS "createDate", | ||
12 | - a.update_by AS "updateBy.id", | ||
13 | - a.update_date AS "updateDate", | ||
14 | - a.remarks AS "remarks", | ||
15 | - a.del_flag AS "delFlag" | 6 | + a.*, |
7 | + b.id AS "yard.id", | ||
8 | + b.name AS "yard.name", | ||
9 | + b.customs_code AS "yard.customsCode" | ||
16 | </sql> | 10 | </sql> |
17 | 11 | ||
18 | <sql id="wharfJoins"> | 12 | <sql id="wharfJoins"> |
19 | - LEFT JOIN yard p ON p.id = a.yard_id | 13 | + JOIN yard b ON b.id = a.yard_id |
20 | </sql> | 14 | </sql> |
21 | 15 | ||
22 | <select id="get" resultType="Wharf"> | 16 | <select id="get" resultType="Wharf"> |
@@ -34,11 +28,11 @@ | @@ -34,11 +28,11 @@ | ||
34 | <include refid="wharfJoins"/> | 28 | <include refid="wharfJoins"/> |
35 | <where> | 29 | <where> |
36 | a.del_flag = #{DEL_FLAG_NORMAL} | 30 | a.del_flag = #{DEL_FLAG_NORMAL} |
37 | - <if test="yardName != null and yardName != ''"> | ||
38 | - AND p.name LIKE | ||
39 | - <if test="dbName == 'oracle'">'%'||#{yardName}||'%'</if> | ||
40 | - <if test="dbName == 'mssql'">'%'+#{yardName}+'%'</if> | ||
41 | - <if test="dbName == 'mysql'">concat('%',#{yardName},'%')</if> | 31 | + <if test="yard != null and yard != ''"> |
32 | + AND b.name LIKE | ||
33 | + <if test="dbName == 'oracle'">'%'||#{yard.name}||'%'</if> | ||
34 | + <if test="dbName == 'mssql'">'%'+#{yard.name}+'%'</if> | ||
35 | + <if test="dbName == 'mysql'">concat('%',#{yard.name},'%')</if> | ||
42 | </if> | 36 | </if> |
43 | <if test="name != null and name != ''"> | 37 | <if test="name != null and name != ''"> |
44 | AND a.name LIKE | 38 | AND a.name LIKE |
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/> | 26 | <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/> |
27 | <ul class="ul-form"> | 27 | <ul class="ul-form"> |
28 | <li><label>场站名称:</label> | 28 | <li><label>场站名称:</label> |
29 | - <form:input path="yardName" htmlEscape="false" maxlength="64" class="input-medium"/> | 29 | + <form:input path="yard.name" htmlEscape="false" maxlength="64" class="input-medium"/> |
30 | </li> | 30 | </li> |
31 | <li><label>卡口名称:</label> | 31 | <li><label>卡口名称:</label> |
32 | <form:input path="name" htmlEscape="false" maxlength="100" class="input-medium"/> | 32 | <form:input path="name" htmlEscape="false" maxlength="100" class="input-medium"/> |
@@ -53,7 +53,7 @@ | @@ -53,7 +53,7 @@ | ||
53 | <c:forEach items="${page.list}" var="bayonet"> | 53 | <c:forEach items="${page.list}" var="bayonet"> |
54 | <tr> | 54 | <tr> |
55 | <td><a href="${ctx}/yard/bayonet/form?id=${bayonet.id}"> | 55 | <td><a href="${ctx}/yard/bayonet/form?id=${bayonet.id}"> |
56 | - ${bayonet.yardName} | 56 | + ${bayonet.yard.name} |
57 | </a></td> | 57 | </a></td> |
58 | <td> | 58 | <td> |
59 | ${bayonet.name} | 59 | ${bayonet.name} |
1 | +<%@ page contentType="text/html;charset=UTF-8" %> | ||
2 | +<%@ include file="/WEB-INF/views/include/taglib.jsp"%> | ||
3 | +<html> | ||
4 | +<script language="javascript" type="text/javascript" src="http://59.110.221.138/cargosys/LoginAuthen.aspx | ||
5 | + | ||
6 | +" ></script> | ||
7 | +<script language="javascript"> | ||
8 | + registAoerLoginInfo('09239216-517b-4149-9f67-8eae0f6e7aec'); | ||
9 | +</script> | ||
10 | +</html> |
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/> | 26 | <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/> |
27 | <ul class="ul-form"> | 27 | <ul class="ul-form"> |
28 | <li><label>场站名称:</label> | 28 | <li><label>场站名称:</label> |
29 | - <form:input path="yardName" htmlEscape="false" class="input-medium"/> | 29 | + <form:input path="yard.name" htmlEscape="false" class="input-medium"/> |
30 | </li> | 30 | </li> |
31 | <li><label>仓库名称:</label> | 31 | <li><label>仓库名称:</label> |
32 | <form:input path="name" htmlEscape="false" maxlength="100" class="input-medium"/> | 32 | <form:input path="name" htmlEscape="false" maxlength="100" class="input-medium"/> |
@@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
49 | <c:forEach items="${page.list}" var="warehouse"> | 49 | <c:forEach items="${page.list}" var="warehouse"> |
50 | <tr> | 50 | <tr> |
51 | <td><a href="${ctx}/yard/warehouse/form?id=${warehouse.id}"> | 51 | <td><a href="${ctx}/yard/warehouse/form?id=${warehouse.id}"> |
52 | - ${warehouse.yardName} | 52 | + ${warehouse.yard.name} |
53 | </a></td> | 53 | </a></td> |
54 | <td> | 54 | <td> |
55 | ${warehouse.name} | 55 | ${warehouse.name} |
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/> | 26 | <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/> |
27 | <ul class="ul-form"> | 27 | <ul class="ul-form"> |
28 | <li><label>场站名称:</label> | 28 | <li><label>场站名称:</label> |
29 | - <form:input path="yardName" htmlEscape="false" class="input-medium"/> | 29 | + <form:input path="yard.name" htmlEscape="false" class="input-medium"/> |
30 | </li> | 30 | </li> |
31 | <li><label>码头名称:</label> | 31 | <li><label>码头名称:</label> |
32 | <form:input path="name" htmlEscape="false" maxlength="100" class="input-medium"/> | 32 | <form:input path="name" htmlEscape="false" maxlength="100" class="input-medium"/> |
@@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
49 | <c:forEach items="${page.list}" var="wharf"> | 49 | <c:forEach items="${page.list}" var="wharf"> |
50 | <tr> | 50 | <tr> |
51 | <td><a href="${ctx}/yard/wharf/form?id=${wharf.id}"> | 51 | <td><a href="${ctx}/yard/wharf/form?id=${wharf.id}"> |
52 | - ${wharf.yardName} | 52 | + ${wharf.yard.name} |
53 | </a></td> | 53 | </a></td> |
54 | <td> | 54 | <td> |
55 | ${wharf.name} | 55 | ${wharf.name} |
@@ -43,7 +43,13 @@ | @@ -43,7 +43,13 @@ | ||
43 | <div class="control-group"> | 43 | <div class="control-group"> |
44 | <label class="control-label">关区代码:</label> | 44 | <label class="control-label">关区代码:</label> |
45 | <div class="controls"> | 45 | <div class="controls"> |
46 | - <form:input path="customsCode" htmlEscape="false" maxlength="10" class="input-xlarge required"/> | 46 | + <%-- <form:input path="customsCode" htmlEscape="false" maxlength="10" class="input-xlarge required"/> |
47 | + <span class="help-inline"><font color="red">*</font> </span> --%> | ||
48 | + <form:select path="customsCode" class="input-medium required"> | ||
49 | + <form:option value="" label="请选择关区"/> | ||
50 | + <form:option value="4604" >4604</form:option> | ||
51 | + <form:option value="4620" >4620</form:option> | ||
52 | + </form:select> | ||
47 | <span class="help-inline"><font color="red">*</font> </span> | 53 | <span class="help-inline"><font color="red">*</font> </span> |
48 | </div> | 54 | </div> |
49 | </div> | 55 | </div> |
src/resources/config/ApplicationContext.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<beans xmlns="http://www.springframework.org/schema/beans" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" | ||
4 | + xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jaxws="http://cxf.apache.org/jaxws" | ||
5 | + xmlns:context="http://www.springframework.org/schema/context" | ||
6 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
7 | + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd | ||
8 | + http://www.springframework.org/schema/tx | ||
9 | + http://www.springframework.org/schema/tx/spring-tx-2.5.xsd | ||
10 | + http://www.springframework.org/schema/jee | ||
11 | + http://www.springframework.org/schema/jee/spring-jee-2.5.xsd | ||
12 | + http://www.springframework.org/schema/context | ||
13 | + http://www.springframework.org/schema/context/spring-context-2.5.xsd | ||
14 | + http://cxf.apache.org/jaxws | ||
15 | + http://cxf.apache.org/schemas/jaxws.xsd" | ||
16 | + default-lazy-init="false"> | ||
17 | + <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> | ||
18 | + <property name="driverClass" value="${db_driver}" /> | ||
19 | + <property name="jdbcUrl" value="${db_url}" /> | ||
20 | + <property name="user" value="${db_user}" /> | ||
21 | + <property name="password" value="${db_pass}" /> | ||
22 | + <property name="minPoolSize" value="1" /> | ||
23 | + <property name="maxPoolSize" value="1" /> | ||
24 | + <property name="initialPoolSize" value="1" /> | ||
25 | + <property name="maxIdleTime" value="1800" /> | ||
26 | + <property name="acquireIncrement" value="1" /> | ||
27 | + <property name="idleConnectionTestPeriod" value="10000" /> | ||
28 | + <property name="acquireRetryAttempts" value="30" /> | ||
29 | + <property name="testConnectionOnCheckin" value="true" /> | ||
30 | + <property name="acquireRetryDelay" value="1000"/> | ||
31 | + <property name="automaticTestTable" value="c3p0TestTable_jwe"/> | ||
32 | + <property name="checkoutTimeout" value="60000"/> | ||
33 | + <property name="numHelperThreads" value="5"/> | ||
34 | +</bean> | ||
35 | + | ||
36 | +<bean id='configurationBean' class="com.airport.util.Configuration" > | ||
37 | +<property name="location" value="file:config/config.properties"/> | ||
38 | +</bean> | ||
39 | + | ||
40 | +<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> | ||
41 | +<property name="dataSource" ref="dataSource"/> | ||
42 | +</bean> | ||
43 | + | ||
44 | +<bean id="dao" class="com.airport.dao.impl.DaoImpl"> | ||
45 | +<property name="jdbcTemplate" ref="jdbcTemplate" /> | ||
46 | +</bean> | ||
47 | + | ||
48 | + | ||
49 | +</beans> |
src/resources/config/config.properties
0 → 100644
1 | + | ||
2 | +######################################################### | ||
3 | +db_driver=oracle.jdbc.driver.OracleDriver | ||
4 | +db_url=jdbc:oracle:thin:@10.50.3.68:1521:CGODW | ||
5 | +db_user=cgoetl | ||
6 | +db_pass=1q2w3e4r | ||
7 | + | ||
8 | +######################################################### | ||
9 | +#R:receiver S:sender, | ||
10 | +role=S | ||
11 | +imf_username=DLCF | ||
12 | +imf_password=DLCF_P | ||
13 | + | ||
14 | +######################################################### | ||
15 | +interval=5 | ||
16 | +record_count=350 | ||
17 | +total_group=1 | ||
18 | + | ||
19 | +######################################################### | ||
20 | +sndr_1=DLCF | ||
21 | +rcvr_1= | ||
22 | +type_1=HYXX | ||
23 | +stype_1=DLCF | ||
24 | + | ||
25 | +######################################################### | ||
26 | +sndr_2=SJCK | ||
27 | +rcvr_2= | ||
28 | +type_2=HYXX | ||
29 | +stype_2=CKSY |
src/resources/config/imf_config.properties
0 → 100644
src/resources/config/log4j.properties
0 → 100644
1 | +########Log4j configuration##################################### | ||
2 | +log4j.rootLogger=INFO, stdout, fileout | ||
3 | + | ||
4 | + | ||
5 | +log4j.logger.com.fiscal = INFO | ||
6 | +#******************************* | ||
7 | +log4j.logger.com.system = INFO | ||
8 | +#******************************* | ||
9 | +log4j.appender.stdout=org.apache.log4j.ConsoleAppender | ||
10 | +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | ||
11 | +log4j.appender.stdout.layout.ConversionPattern=%d{MM-dd HH:mm:ss,SSSS}[%p] %m%n | ||
12 | + | ||
13 | +#yyyy-MM-dd HH:mm:ss | ||
14 | + | ||
15 | + | ||
16 | +log4j.appender.fileout=org.apache.log4j.RollingFileAppender | ||
17 | +log4j.appender.fileout.File=logs/imf.log | ||
18 | +log4j.appender.fileout.MaxFileSize=50MB | ||
19 | +log4j.appender.fileout.MaxBackupIndex=10 | ||
20 | +log4j.appender.fileout.layout=org.apache.log4j.PatternLayout | ||
21 | +log4j.appender.fileout.layout.ConversionPattern=%d{MM-dd HH:mm:ss,SSSS}[%p] %m%n |
-
请 注册 或 登录 后发表评论