正在显示
45 个修改的文件
包含
4736 行增加
和
0 行删除
.classpath
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<classpath> | ||
3 | + <classpathentry kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/java"> | ||
4 | + <attributes> | ||
5 | + <attribute name="optional" value="true"/> | ||
6 | + <attribute name="maven.pomderived" value="true"/> | ||
7 | + </attributes> | ||
8 | + </classpathentry> | ||
9 | + <classpathentry excluding="**" kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/resources"> | ||
10 | + <attributes> | ||
11 | + <attribute name="maven.pomderived" value="true"/> | ||
12 | + </attributes> | ||
13 | + </classpathentry> | ||
14 | + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
15 | + <attributes> | ||
16 | + <attribute name="optional" value="true"/> | ||
17 | + <attribute name="maven.pomderived" value="true"/> | ||
18 | + </attributes> | ||
19 | + </classpathentry> | ||
20 | + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> | ||
21 | + <attributes> | ||
22 | + <attribute name="maven.pomderived" value="true"/> | ||
23 | + </attributes> | ||
24 | + </classpathentry> | ||
25 | + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
26 | + <attributes> | ||
27 | + <attribute name="maven.pomderived" value="true"/> | ||
28 | + <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> | ||
29 | + </attributes> | ||
30 | + </classpathentry> | ||
31 | + <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/analyzer-2012_u6.jar"/> | ||
32 | + <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/apache-ant-zip-2.3.jar"/> | ||
33 | + <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/ckfinder-2.3.jar"/> | ||
34 | + <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/ckfinderplugin-fileeditor-2.3.jar"/> | ||
35 | + <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/ckfinderplugin-imageresize-2.3.jar"/> | ||
36 | + <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/ojdbc14-10.2.0.4.0.jar"/> | ||
37 | + <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/thumbnailator-0.4.2.jar"/> | ||
38 | + <classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/UserAgentUtils-1.13.jar"/> | ||
39 | + <classpathentry kind="output" path="src/main/webapp/WEB-INF/classes"/> | ||
40 | +</classpath> |
.idea/.name
0 → 100644
1 | +station |
.idea/compiler.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="CompilerConfiguration"> | ||
4 | + <annotationProcessing> | ||
5 | + <profile name="Maven default annotation processors profile" enabled="true"> | ||
6 | + <sourceOutputDir name="target/generated-sources/annotations" /> | ||
7 | + <sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> | ||
8 | + <outputRelativeToContentRoot value="true" /> | ||
9 | + <module name="station" /> | ||
10 | + </profile> | ||
11 | + </annotationProcessing> | ||
12 | + </component> | ||
13 | +</project> |
.idea/encodings.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8" addBOMForNewFiles="with NO BOM"> | ||
4 | + <file url="file://$PROJECT_DIR$" charset="UTF-8" /> | ||
5 | + <file url="PROJECT" charset="UTF-8" /> | ||
6 | + </component> | ||
7 | +</project> |
.idea/misc.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="ExternalStorageConfigurationManager" enabled="true" /> | ||
4 | + <component name="FrameworkDetectionExcludesConfiguration"> | ||
5 | + <file type="web" url="file://$PROJECT_DIR$" /> | ||
6 | + </component> | ||
7 | + <component name="MavenProjectsManager"> | ||
8 | + <option name="originalFiles"> | ||
9 | + <list> | ||
10 | + <option value="$PROJECT_DIR$/pom.xml" /> | ||
11 | + </list> | ||
12 | + </option> | ||
13 | + </component> | ||
14 | + <component name="ProjectInspectionProfilesVisibleTreeState"> | ||
15 | + <entry key="Project Default"> | ||
16 | + <profile-state> | ||
17 | + <expanded-state> | ||
18 | + <State /> | ||
19 | + <State> | ||
20 | + <id>Class structureJava</id> | ||
21 | + </State> | ||
22 | + <State> | ||
23 | + <id>Code maturityJava</id> | ||
24 | + </State> | ||
25 | + <State> | ||
26 | + <id>Google Web Toolkit</id> | ||
27 | + </State> | ||
28 | + <State> | ||
29 | + <id>JUnitJava</id> | ||
30 | + </State> | ||
31 | + <State> | ||
32 | + <id>Java</id> | ||
33 | + </State> | ||
34 | + <State> | ||
35 | + <id>Java 5Java language level migration aidsJava</id> | ||
36 | + </State> | ||
37 | + <State> | ||
38 | + <id>Java 7Java language level migration aidsJava</id> | ||
39 | + </State> | ||
40 | + <State> | ||
41 | + <id>Java 8Java language level migration aidsJava</id> | ||
42 | + </State> | ||
43 | + <State> | ||
44 | + <id>Java language level migration aidsJava</id> | ||
45 | + </State> | ||
46 | + <State> | ||
47 | + <id>JavadocJava</id> | ||
48 | + </State> | ||
49 | + <State> | ||
50 | + <id>Numeric issuesJava</id> | ||
51 | + </State> | ||
52 | + <State> | ||
53 | + <id>PerformanceJava</id> | ||
54 | + </State> | ||
55 | + <State> | ||
56 | + <id>Spring</id> | ||
57 | + </State> | ||
58 | + <State> | ||
59 | + <id>Spring AOPSpring</id> | ||
60 | + </State> | ||
61 | + <State> | ||
62 | + <id>TestNGJava</id> | ||
63 | + </State> | ||
64 | + <State> | ||
65 | + <id>Threading issuesJava</id> | ||
66 | + </State> | ||
67 | + </expanded-state> | ||
68 | + </profile-state> | ||
69 | + </entry> | ||
70 | + </component> | ||
71 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | ||
72 | + <output url="file://$PROJECT_DIR$/out" /> | ||
73 | + </component> | ||
74 | +</project> |
.idea/vcs.xml
0 → 100644
.project
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<projectDescription> | ||
3 | + <name>station</name> | ||
4 | + <comment></comment> | ||
5 | + <projects> | ||
6 | + </projects> | ||
7 | + <buildSpec> | ||
8 | + <buildCommand> | ||
9 | + <name>org.eclipse.jdt.core.javabuilder</name> | ||
10 | + <arguments> | ||
11 | + </arguments> | ||
12 | + </buildCommand> | ||
13 | + <buildCommand> | ||
14 | + <name>org.eclipse.wst.common.project.facet.core.builder</name> | ||
15 | + <arguments> | ||
16 | + </arguments> | ||
17 | + </buildCommand> | ||
18 | + <buildCommand> | ||
19 | + <name>org.eclipse.wst.validation.validationbuilder</name> | ||
20 | + <arguments> | ||
21 | + </arguments> | ||
22 | + </buildCommand> | ||
23 | + <buildCommand> | ||
24 | + <name>org.springframework.ide.eclipse.core.springbuilder</name> | ||
25 | + <arguments> | ||
26 | + </arguments> | ||
27 | + </buildCommand> | ||
28 | + <buildCommand> | ||
29 | + <name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name> | ||
30 | + <arguments> | ||
31 | + </arguments> | ||
32 | + </buildCommand> | ||
33 | + <buildCommand> | ||
34 | + <name>org.eclipse.m2e.core.maven2Builder</name> | ||
35 | + <arguments> | ||
36 | + </arguments> | ||
37 | + </buildCommand> | ||
38 | + </buildSpec> | ||
39 | + <natures> | ||
40 | + <nature>org.springframework.ide.eclipse.core.springnature</nature> | ||
41 | + <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> | ||
42 | + <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> | ||
43 | + <nature>org.eclipse.jdt.core.javanature</nature> | ||
44 | + <nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
45 | + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> | ||
46 | + <nature>org.eclipse.wst.jsdt.core.jsNature</nature> | ||
47 | + </natures> | ||
48 | +</projectDescription> |
LICENSE.txt
0 → 100644
1 | + | ||
2 | + Apache License | ||
3 | + Version 2.0, January 2004 | ||
4 | + http://www.apache.org/licenses/ | ||
5 | + | ||
6 | + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
7 | + | ||
8 | + 1. Definitions. | ||
9 | + | ||
10 | + "License" shall mean the terms and conditions for use, reproduction, | ||
11 | + and distribution as defined by Sections 1 through 9 of this document. | ||
12 | + | ||
13 | + "Licensor" shall mean the copyright owner or entity authorized by | ||
14 | + the copyright owner that is granting the License. | ||
15 | + | ||
16 | + "Legal Entity" shall mean the union of the acting entity and all | ||
17 | + other entities that control, are controlled by, or are under common | ||
18 | + control with that entity. For the purposes of this definition, | ||
19 | + "control" means (i) the power, direct or indirect, to cause the | ||
20 | + direction or management of such entity, whether by contract or | ||
21 | + otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||
22 | + outstanding shares, or (iii) beneficial ownership of such entity. | ||
23 | + | ||
24 | + "You" (or "Your") shall mean an individual or Legal Entity | ||
25 | + exercising permissions granted by this License. | ||
26 | + | ||
27 | + "Source" form shall mean the preferred form for making modifications, | ||
28 | + including but not limited to software source code, documentation | ||
29 | + source, and configuration files. | ||
30 | + | ||
31 | + "Object" form shall mean any form resulting from mechanical | ||
32 | + transformation or translation of a Source form, including but | ||
33 | + not limited to compiled object code, generated documentation, | ||
34 | + and conversions to other media types. | ||
35 | + | ||
36 | + "Work" shall mean the work of authorship, whether in Source or | ||
37 | + Object form, made available under the License, as indicated by a | ||
38 | + copyright notice that is included in or attached to the work | ||
39 | + (an example is provided in the Appendix below). | ||
40 | + | ||
41 | + "Derivative Works" shall mean any work, whether in Source or Object | ||
42 | + form, that is based on (or derived from) the Work and for which the | ||
43 | + editorial revisions, annotations, elaborations, or other modifications | ||
44 | + represent, as a whole, an original work of authorship. For the purposes | ||
45 | + of this License, Derivative Works shall not include works that remain | ||
46 | + separable from, or merely link (or bind by name) to the interfaces of, | ||
47 | + the Work and Derivative Works thereof. | ||
48 | + | ||
49 | + "Contribution" shall mean any work of authorship, including | ||
50 | + the original version of the Work and any modifications or additions | ||
51 | + to that Work or Derivative Works thereof, that is intentionally | ||
52 | + submitted to Licensor for inclusion in the Work by the copyright owner | ||
53 | + or by an individual or Legal Entity authorized to submit on behalf of | ||
54 | + the copyright owner. For the purposes of this definition, "submitted" | ||
55 | + means any form of electronic, verbal, or written communication sent | ||
56 | + to the Licensor or its representatives, including but not limited to | ||
57 | + communication on electronic mailing lists, source code control systems, | ||
58 | + and issue tracking systems that are managed by, or on behalf of, the | ||
59 | + Licensor for the purpose of discussing and improving the Work, but | ||
60 | + excluding communication that is conspicuously marked or otherwise | ||
61 | + designated in writing by the copyright owner as "Not a Contribution." | ||
62 | + | ||
63 | + "Contributor" shall mean Licensor and any individual or Legal Entity | ||
64 | + on behalf of whom a Contribution has been received by Licensor and | ||
65 | + subsequently incorporated within the Work. | ||
66 | + | ||
67 | + 2. Grant of Copyright License. Subject to the terms and conditions of | ||
68 | + this License, each Contributor hereby grants to You a perpetual, | ||
69 | + worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
70 | + copyright license to reproduce, prepare Derivative Works of, | ||
71 | + publicly display, publicly perform, sublicense, and distribute the | ||
72 | + Work and such Derivative Works in Source or Object form. | ||
73 | + | ||
74 | + 3. Grant of Patent License. Subject to the terms and conditions of | ||
75 | + this License, each Contributor hereby grants to You a perpetual, | ||
76 | + worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
77 | + (except as stated in this section) patent license to make, have made, | ||
78 | + use, offer to sell, sell, import, and otherwise transfer the Work, | ||
79 | + where such license applies only to those patent claims licensable | ||
80 | + by such Contributor that are necessarily infringed by their | ||
81 | + Contribution(s) alone or by combination of their Contribution(s) | ||
82 | + with the Work to which such Contribution(s) was submitted. If You | ||
83 | + institute patent litigation against any entity (including a | ||
84 | + cross-claim or counterclaim in a lawsuit) alleging that the Work | ||
85 | + or a Contribution incorporated within the Work constitutes direct | ||
86 | + or contributory patent infringement, then any patent licenses | ||
87 | + granted to You under this License for that Work shall terminate | ||
88 | + as of the date such litigation is filed. | ||
89 | + | ||
90 | + 4. Redistribution. You may reproduce and distribute copies of the | ||
91 | + Work or Derivative Works thereof in any medium, with or without | ||
92 | + modifications, and in Source or Object form, provided that You | ||
93 | + meet the following conditions: | ||
94 | + | ||
95 | + (a) You must give any other recipients of the Work or | ||
96 | + Derivative Works a copy of this License; and | ||
97 | + | ||
98 | + (b) You must cause any modified files to carry prominent notices | ||
99 | + stating that You changed the files; and | ||
100 | + | ||
101 | + (c) You must retain, in the Source form of any Derivative Works | ||
102 | + that You distribute, all copyright, patent, trademark, and | ||
103 | + attribution notices from the Source form of the Work, | ||
104 | + excluding those notices that do not pertain to any part of | ||
105 | + the Derivative Works; and | ||
106 | + | ||
107 | + (d) If the Work includes a "NOTICE" text file as part of its | ||
108 | + distribution, then any Derivative Works that You distribute must | ||
109 | + include a readable copy of the attribution notices contained | ||
110 | + within such NOTICE file, excluding those notices that do not | ||
111 | + pertain to any part of the Derivative Works, in at least one | ||
112 | + of the following places: within a NOTICE text file distributed | ||
113 | + as part of the Derivative Works; within the Source form or | ||
114 | + documentation, if provided along with the Derivative Works; or, | ||
115 | + within a display generated by the Derivative Works, if and | ||
116 | + wherever such third-party notices normally appear. The contents | ||
117 | + of the NOTICE file are for informational purposes only and | ||
118 | + do not modify the License. You may add Your own attribution | ||
119 | + notices within Derivative Works that You distribute, alongside | ||
120 | + or as an addendum to the NOTICE text from the Work, provided | ||
121 | + that such additional attribution notices cannot be construed | ||
122 | + as modifying the License. | ||
123 | + | ||
124 | + You may add Your own copyright statement to Your modifications and | ||
125 | + may provide additional or different license terms and conditions | ||
126 | + for use, reproduction, or distribution of Your modifications, or | ||
127 | + for any such Derivative Works as a whole, provided Your use, | ||
128 | + reproduction, and distribution of the Work otherwise complies with | ||
129 | + the conditions stated in this License. | ||
130 | + | ||
131 | + 5. Submission of Contributions. Unless You explicitly state otherwise, | ||
132 | + any Contribution intentionally submitted for inclusion in the Work | ||
133 | + by You to the Licensor shall be under the terms and conditions of | ||
134 | + this License, without any additional terms or conditions. | ||
135 | + Notwithstanding the above, nothing herein shall supersede or modify | ||
136 | + the terms of any separate license agreement you may have executed | ||
137 | + with Licensor regarding such Contributions. | ||
138 | + | ||
139 | + 6. Trademarks. This License does not grant permission to use the trade | ||
140 | + names, trademarks, service marks, or product names of the Licensor, | ||
141 | + except as required for reasonable and customary use in describing the | ||
142 | + origin of the Work and reproducing the content of the NOTICE file. | ||
143 | + | ||
144 | + 7. Disclaimer of Warranty. Unless required by applicable law or | ||
145 | + agreed to in writing, Licensor provides the Work (and each | ||
146 | + Contributor provides its Contributions) on an "AS IS" BASIS, | ||
147 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
148 | + implied, including, without limitation, any warranties or conditions | ||
149 | + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||
150 | + PARTICULAR PURPOSE. You are solely responsible for determining the | ||
151 | + appropriateness of using or redistributing the Work and assume any | ||
152 | + risks associated with Your exercise of permissions under this License. | ||
153 | + | ||
154 | + 8. Limitation of Liability. In no event and under no legal theory, | ||
155 | + whether in tort (including negligence), contract, or otherwise, | ||
156 | + unless required by applicable law (such as deliberate and grossly | ||
157 | + negligent acts) or agreed to in writing, shall any Contributor be | ||
158 | + liable to You for damages, including any direct, indirect, special, | ||
159 | + incidental, or consequential damages of any character arising as a | ||
160 | + result of this License or out of the use or inability to use the | ||
161 | + Work (including but not limited to damages for loss of goodwill, | ||
162 | + work stoppage, computer failure or malfunction, or any and all | ||
163 | + other commercial damages or losses), even if such Contributor | ||
164 | + has been advised of the possibility of such damages. | ||
165 | + | ||
166 | + 9. Accepting Warranty or Additional Liability. While redistributing | ||
167 | + the Work or Derivative Works thereof, You may choose to offer, | ||
168 | + and charge a fee for, acceptance of support, warranty, indemnity, | ||
169 | + or other liability obligations and/or rights consistent with this | ||
170 | + License. However, in accepting such obligations, You may act only | ||
171 | + on Your own behalf and on Your sole responsibility, not on behalf | ||
172 | + of any other Contributor, and only if You agree to indemnify, | ||
173 | + defend, and hold each Contributor harmless for any liability | ||
174 | + incurred by, or claims asserted against, such Contributor by reason | ||
175 | + of your accepting any such warranty or additional liability. | ||
176 | + | ||
177 | + END OF TERMS AND CONDITIONS | ||
178 | + | ||
179 | + APPENDIX: How to apply the Apache License to your work. | ||
180 | + | ||
181 | + To apply the Apache License to your work, attach the following | ||
182 | + boilerplate notice, with the fields enclosed by brackets "[]" | ||
183 | + replaced with your own identifying information. (Don't include | ||
184 | + the brackets!) The text should be enclosed in the appropriate | ||
185 | + comment syntax for the file format. We also recommend that a | ||
186 | + file or class name and description of purpose be included on the | ||
187 | + same "printed page" as the copyright notice for easier | ||
188 | + identification within third-party archives. | ||
189 | + | ||
190 | + Copyright © 2012-2013 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. | ||
191 | + | ||
192 | + Licensed under the Apache License, Version 2.0 (the "License"); | ||
193 | + you may not use this file except in compliance with the License. | ||
194 | + You may obtain a copy of the License at | ||
195 | + | ||
196 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
197 | + | ||
198 | + Unless required by applicable law or agreed to in writing, software | ||
199 | + distributed under the License is distributed on an "AS IS" BASIS, | ||
200 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
201 | + See the License for the specific language governing permissions and | ||
202 | + limitations under the License. | ||
203 | + | ||
204 | + | ||
205 | + ====================================================================== | ||
206 | + | ||
207 | + Apache许可证 | ||
208 | + 版本 2.0,2004年1月 | ||
209 | + http://www.apache.org/licenses/ | ||
210 | + | ||
211 | + 使用、重生成及分发的术语和条件: | ||
212 | + | ||
213 | + 1.定义 | ||
214 | + | ||
215 | + "许可证"是指根据本文档第1到第9部分关于使用、重生成和分发的术语和条件。 | ||
216 | + | ||
217 | + "许可证颁发者"是指版权所有者或者由版权所有者批准的授权许可证的实体。 | ||
218 | + | ||
219 | + "法律实体"是指实施实体和进行控制的所有其它实体受该实体控制,或者受该实体集中控制。 | ||
220 | + 根据此定义,"控制"是指(i)让无论是否签订协议的上述实体,进行指导或管理的直接权利或间接权利, | ||
221 | + 或者(ii)拥有百分之五十(50%)或以上已发行股票的所有者,或者(iii)上述实体的实权所有者。 | ||
222 | + | ||
223 | + "用户"(或"用户的")是指行使本许可证所授予权限的个人或法律实体。 | ||
224 | + | ||
225 | + "源程序"形式是指对包含但不限制软件源代码、文档源程序和配置文件进行修改的首选形式。 | ||
226 | + | ||
227 | + "目标"形式是指对源程序形式进行机械转换或翻译的任何形式,包括但不限于对编译的目标代码, | ||
228 | + 生成的文件以及转换为其它媒体类型。 | ||
229 | + | ||
230 | + "作品"是指根据本许可证所制作的源程序形式或目标形式的著作,在著作中包含的或附加的版权通知 | ||
231 | + (在下面附录中提供了一个示例)。 | ||
232 | + | ||
233 | + "衍生作品"是指基于作品(或从作品衍生而来)的源程序形式或目标形式的任何作品,以及编辑修订、 | ||
234 | + 注释、详细描述或其它修订等构成原创著作作品的整体。根据本许可证,衍生作品不得包括与作品及其 | ||
235 | + 衍生作品分离之作品,或仅与作品及其衍生作品的接口相链接(或按名称结合)之作品。 | ||
236 | + | ||
237 | + "贡献"是指任何著作作品,包括作品的原始版本和对该作品或衍生作品所做的任何修订或补充, | ||
238 | + 意在提交给许可证颁发者以让版权所有者或代表版权所有者的授权个人或法律实体包含在其作品中。 | ||
239 | + 根据此定义,"提交"一词表示发送给许可证颁发者或其代表人,任何电子的、口头的或书面的交流信息形式, | ||
240 | + 包括但不限于在由许可证颁发者或者代表其管理的电子邮件清单、源代码控制系统、以及发布跟踪系统上为 | ||
241 | + 讨论和提高作品的交流,但不包括由版权所有者以书面形式明显标注或指定为"非贡献"的交流活动。 | ||
242 | + | ||
243 | + "贡献者"是指许可证颁发者和代表从许可证颁发者接受之贡献的并随后包含在作品之贡献中的任何个人或法律实体。 | ||
244 | + | ||
245 | + 2.版权许可证的授予 | ||
246 | + | ||
247 | + 根据本许可证的条款,每个贡献者授予用户永久性的、全球性的、非专有性的、免费的、无版权费的、 | ||
248 | + 不可撤销的版权许可证以源程序形式或目标形式复制、准备衍生作品、公开显示、公开执行、 | ||
249 | + 授予分许可证、以及分发作品和这样的衍生作品。 | ||
250 | + | ||
251 | + 3.专利许可证的授予 | ||
252 | + | ||
253 | + 根据本许可证的条款,每个贡献者授予用户永久性的、全球性的、非专有性的、免费的、无版权费的、 | ||
254 | + 不可撤销的(除在本部分进行说明)专利许可证对作品进行制作、让人制作、使用、提供销售、销售、 | ||
255 | + 进口和其它转让,且这样的许可证仅适用于在所递交作品的贡献中因可由单一的或多个这样的贡献者 | ||
256 | + 授予而必须侵犯的申请专利。如果用户对任何实体针对作品或作品中所涉及贡献提出因直接性或贡献性 | ||
257 | + 专利侵权而提起专利法律诉讼(包括交互诉讼请求或反索赔),那么根据本许可证,授予用户针对作品 | ||
258 | + 的任何专利许可证将在提起上述诉讼之日起终止。 | ||
259 | + | ||
260 | + 4.重新分发 | ||
261 | + | ||
262 | + 用户可在任何媒介中复制和分发作品或衍生作品之副本,无论是否修订,还是以源程序形式或目标形式, | ||
263 | + 条件是用户需满足下列条款: | ||
264 | + | ||
265 | + a) 用户必须为作品或衍生作品的任何其他接收者提供本许可证的副本;并且 | ||
266 | + | ||
267 | + b) 用户必须让任何修改过的文件附带明显的通知,声明用户已更改文件;并且 | ||
268 | + | ||
269 | + c) 用户必须从作品的源程序形式中保留衍生作品源程序形式的用户所分发的所有版权、专利、 | ||
270 | + 商标和属性通知,但不包括不属于衍生作品任何部分的类似通知;并且 | ||
271 | + | ||
272 | + d) 如果作品将"通知"文本文件包括为其分发作品的一部分,那么用户分发的任何衍生作品中须至少 | ||
273 | + 在下列地方之一包括,在这样的通知文件中所包含的属性通知的可读副本,但不包括那些不属于衍生 | ||
274 | + 作品任何部分的通知:在作为衍生作品一部分而分发的通知文本文件中;如果与衍生作品一起提供则 | ||
275 | + 在源程序形式或文件中;或者通常作为第三方通知出现的时候和地方,在衍生作品中产生的画面中。 | ||
276 | + 通知文件的内容仅供信息提供,并未对许可证进行修改。用户可在其分发的衍生作品中在作品的通知 | ||
277 | + 文本后或作为附录添加自己的属性通知,条件是附加的属性通知不得构成修改本许可证。 | ||
278 | + | ||
279 | + 用户可以为自身所做出的修订添加自己的版权声明并可对自身所做出修订内容或为这样的衍生作品作为 | ||
280 | + 整体的使用、复制或分发提供附加或不同的条款,条件是用户对作品的使用、复制和分发必须符合本许 | ||
281 | + 可证中声明的条款。 | ||
282 | + | ||
283 | + 5.贡献的提交。 | ||
284 | + | ||
285 | + 除非用户明确声明,在作品中由用户向许可证颁发者的提交若要包含在贡献中,必须在无任何附加条款下 | ||
286 | + 符合本许可证的条款。尽管上面如此规定,执行许可证颁发者有关贡献的条款时,任何情况下均不得替代 | ||
287 | + 或修改任何单独许可证协议的条款。 | ||
288 | + | ||
289 | + 6.商标。本许可证并未授予用户使用许可证颁发者的商号、商标、服务标记或产品名称,除非将这些名称 | ||
290 | + 用于合理性和惯例性描述作品起源和复制通知文件的内容时。 | ||
291 | + | ||
292 | + 7.保证否认条款。除非因适用法律需要或书面同意,许可证颁发者以"按原样"基础提供作品(并且每个 | ||
293 | + 贡献者提供其贡献),无任何明示的或暗示的保证或条件,包括但不限于关于所有权、不侵权、 | ||
294 | + 商品适销性、或适用性的保证或条件。用户仅对使用或重新分发作品的正确性负责,并需承担根据本 | ||
295 | + 许可证行使权限时的任何风险。 | ||
296 | + | ||
297 | + 8.责任限制条款。在任何情况下并根据任何法律,无论是因侵权(包括过失)或根据合同,还是其它原因, | ||
298 | + 除非根据适用法律需要(例如故意行为和重大过失行为)或经书面同意,即使贡献者事先已被告知发生 | ||
299 | + 损害的可能性,任何贡献者不就用户因使用本许可证或不能使用或无法使用作品(包括但不限于商誉损失、 | ||
300 | + 停工、计算机失效或故障,或任何商业损坏或损失)而造成的损失,包括直接的、非直接的、特殊的、意外 | ||
301 | + 的或间接的字符损坏而负责。 | ||
302 | + | ||
303 | + 9.接受保证或附加责任。重新分发作品或及其衍生作品时,用户可选择提供或为符合本许可证承担之支持、 | ||
304 | + 担保、赔偿或其它职责义务和/或权利而收取费用。但是,在承担上述义务时,用户只可代表用户本身和 | ||
305 | + 用户本身责任来执行,无需代表任何其它贡献者,并且用户仅可保证、防护并保持每个贡献者不受任何 | ||
306 | + 因此而产生的责任或对因用户自身承担这样的保证或附加责任而对这样的贡献者所提出的索赔。 | ||
307 | + | ||
308 | + 条款结束 | ||
309 | + | ||
310 | + 附录:如何向用户作品中应用Apache许可证。 | ||
311 | + | ||
312 | + 若要向用户作品应用Apache许可证,请附加下列样本通知,将括号"[]"中的字段以用户自身的 | ||
313 | + 区分信息来替换(但不包括括号)。文本必须以文件格式适当的注释句法包含在其中。 | ||
314 | + 另外建议将文件名或类别名以及目的说明包含在相同的"打印页"上作为版权通知,以更加容易的区分出第三方档案。 | ||
315 | + | ||
316 | + 版权所有 2012-2013 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> 根据2.0版本Apache许可证("许可证")授权; | ||
317 | + 根据本许可证,用户可以不使用此文件。 | ||
318 | + | ||
319 | + 用户可从下列网址获得许可证副本:http://www.apache.org/licenses/LICENSE-2.0 | ||
320 | + 除非因适用法律需要或书面同意,根据许可证分发的软件是基于"按原样"基础提供, | ||
321 | + 无任何明示的或暗示的保证或条件。详见根据许可证许可下,特定语言的管辖权限和限制。 | ||
322 | + | ||
323 | + ======================================================= | ||
324 | + | ||
325 | + 简要解释: | ||
326 | + | ||
327 | + 1.需要给代码的用户一份Apache Licence | ||
328 | + 2.如果你修改了代码,需要在被修改的文件中说明。 | ||
329 | + 3.在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标, | ||
330 | + 专利声明和其他原来作者规定需要包含的说明。 | ||
331 | + 4.如果再发布的产品中包含一个Notice文件,则在Notice文件中需要带有 Apache Licence。 | ||
332 | + 你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。 |
README.md
0 → 100644
pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
4 | + <modelVersion>4.0.0</modelVersion> | ||
5 | + | ||
6 | + <groupId>com.thinkgem.jeesite</groupId> | ||
7 | + <artifactId>station</artifactId> | ||
8 | + <version>1.2.7</version> | ||
9 | + <packaging>war</packaging> | ||
10 | + | ||
11 | + <name>station</name> | ||
12 | + | ||
13 | + <!--<inceptionYear>2012-2016</inceptionYear>--> | ||
14 | + | ||
15 | + <!-- 项目属性 --> | ||
16 | + <properties> | ||
17 | + | ||
18 | + <!-- main version setting --> | ||
19 | + <spring.version>4.1.9.RELEASE</spring.version> | ||
20 | + <validator.version>5.2.4.Final</validator.version> | ||
21 | + <mybatis.version>3.2.8</mybatis.version> | ||
22 | + <mybatis-spring.version>1.2.3</mybatis-spring.version> | ||
23 | + <druid.version>1.0.18</druid.version> | ||
24 | + <ehcache.version>2.6.11</ehcache.version> | ||
25 | + <ehcache-web.version>2.0.4</ehcache-web.version> | ||
26 | + <shiro.version>1.2.5</shiro.version> | ||
27 | + <sitemesh.version>2.4.2</sitemesh.version> | ||
28 | + <activiti.version>5.21.0</activiti.version> | ||
29 | + | ||
30 | + <!-- tools version setting --> | ||
31 | + <slf4j.version>1.7.7</slf4j.version> | ||
32 | + <commons-lang3.version>3.3.2</commons-lang3.version> | ||
33 | + <commons-io.version>2.4</commons-io.version> | ||
34 | + <commons-codec.version>1.9</commons-codec.version> | ||
35 | + <commons-fileupload.version>1.3.1</commons-fileupload.version> | ||
36 | + <commons-beanutils.version>1.9.1</commons-beanutils.version> | ||
37 | + <jackson.version>2.2.3</jackson.version> | ||
38 | + <fastjson.version>1.1.40</fastjson.version> | ||
39 | + <xstream.version>1.4.7</xstream.version> | ||
40 | + <guava.version>17.0</guava.version> | ||
41 | + <dozer.version>5.5.1</dozer.version> | ||
42 | + <poi.version>3.9</poi.version> | ||
43 | + <freemarker.version>2.3.20</freemarker.version> | ||
44 | + | ||
45 | + <!-- jdbc driver setting --> | ||
46 | + <mysql.driver.version>8.0.13</mysql.driver.version> | ||
47 | + <oracle.driver.version>10.2.0.4.0</oracle.driver.version> | ||
48 | + <mssql.driver.version>1.3.1</mssql.driver.version> | ||
49 | + <kaptcha-version>2.3.2</kaptcha-version> | ||
50 | + | ||
51 | + <!-- environment setting --> | ||
52 | + <jdk.version>1.7</jdk.version> | ||
53 | + <tomcat.version>2.2</tomcat.version> | ||
54 | + <jetty.version>7.6.14.v20131031</jetty.version> | ||
55 | + <webserver.port>8181</webserver.port> | ||
56 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
57 | + <downloadSources>true</downloadSources> | ||
58 | + | ||
59 | + </properties> | ||
60 | + | ||
61 | + <!-- 设定主仓库,按设定顺序进行查找。 --> | ||
62 | + <repositories> | ||
63 | + | ||
64 | + <repository> | ||
65 | + <id>jeesite-repos</id> | ||
66 | + <name>Jeesite Repository</name> | ||
67 | + <url>http://maven.aliyun.com/nexus/content/groups/public</url> | ||
68 | + </repository> | ||
69 | + | ||
70 | + </repositories> | ||
71 | + | ||
72 | + <!-- 设定插件仓库 --> | ||
73 | + <pluginRepositories> | ||
74 | + | ||
75 | + <pluginRepository> | ||
76 | + <id>jeesite-repos</id> | ||
77 | + <name>Jeesite Repository</name> | ||
78 | + <url>http://maven.aliyun.com/nexus/content/groups/public</url> | ||
79 | + </pluginRepository> | ||
80 | + | ||
81 | + </pluginRepositories> | ||
82 | + | ||
83 | + <!-- 依赖项定义 --> | ||
84 | + <dependencies> | ||
85 | + | ||
86 | + <!-- SPRING begin --> | ||
87 | + <dependency> | ||
88 | + <groupId>org.springframework</groupId> | ||
89 | + <artifactId>spring-core</artifactId> | ||
90 | + <version>${spring.version}</version> | ||
91 | + <exclusions> | ||
92 | + <exclusion> | ||
93 | + <groupId>commons-logging</groupId> | ||
94 | + <artifactId>commons-logging</artifactId> | ||
95 | + </exclusion> | ||
96 | + </exclusions> | ||
97 | + </dependency> | ||
98 | + <dependency> | ||
99 | + <groupId>org.springframework</groupId> | ||
100 | + <artifactId>spring-beans</artifactId> | ||
101 | + <version>${spring.version}</version> | ||
102 | + </dependency> | ||
103 | + <dependency> | ||
104 | + <groupId>org.springframework</groupId> | ||
105 | + <artifactId>spring-context</artifactId> | ||
106 | + <version>${spring.version}</version> | ||
107 | + </dependency> | ||
108 | + <dependency> | ||
109 | + <groupId>org.springframework</groupId> | ||
110 | + <artifactId>spring-context-support</artifactId> | ||
111 | + <version>${spring.version}</version> | ||
112 | + </dependency> | ||
113 | + <dependency> | ||
114 | + <groupId>org.springframework</groupId> | ||
115 | + <artifactId>spring-aop</artifactId> | ||
116 | + <version>${spring.version}</version> | ||
117 | + <exclusions> | ||
118 | + <exclusion> | ||
119 | + <groupId>commons-logging</groupId> | ||
120 | + <artifactId>commons-logging</artifactId> | ||
121 | + </exclusion> | ||
122 | + </exclusions> | ||
123 | + </dependency> | ||
124 | + <dependency> | ||
125 | + <groupId>org.springframework</groupId> | ||
126 | + <artifactId>spring-tx</artifactId> | ||
127 | + <version>${spring.version}</version> | ||
128 | + </dependency> | ||
129 | + | ||
130 | + <!-- spring orm --> | ||
131 | + <dependency> | ||
132 | + <groupId>org.springframework</groupId> | ||
133 | + <artifactId>spring-orm</artifactId> | ||
134 | + <version>${spring.version}</version> | ||
135 | + </dependency> | ||
136 | + <dependency> | ||
137 | + <groupId>org.springframework</groupId> | ||
138 | + <artifactId>spring-jdbc</artifactId> | ||
139 | + <version>${spring.version}</version> | ||
140 | + </dependency> | ||
141 | + | ||
142 | + <!-- bean validate --> | ||
143 | + <dependency> | ||
144 | + <groupId>org.hibernate</groupId> | ||
145 | + <artifactId>hibernate-validator</artifactId> | ||
146 | + <version>${validator.version}</version> | ||
147 | + </dependency> | ||
148 | + <!-- SPRING end --> | ||
149 | + | ||
150 | + <!-- AOP begin --> | ||
151 | + <dependency> | ||
152 | + <groupId>org.aspectj</groupId> | ||
153 | + <artifactId>aspectjrt</artifactId> | ||
154 | + <version>1.7.4</version> | ||
155 | + </dependency> | ||
156 | + <dependency> | ||
157 | + <groupId>org.aspectj</groupId> | ||
158 | + <artifactId>aspectjweaver</artifactId> | ||
159 | + <version>1.7.4</version> | ||
160 | + </dependency> | ||
161 | + <dependency> | ||
162 | + <groupId>cglib</groupId> | ||
163 | + <artifactId>cglib</artifactId> | ||
164 | + <version>3.1</version> | ||
165 | + </dependency> | ||
166 | + <!-- AOP end --> | ||
167 | + | ||
168 | + <!-- PERSISTENCE begin --> | ||
169 | + | ||
170 | + <!-- MyBatis --> | ||
171 | + <dependency> | ||
172 | + <groupId>org.mybatis</groupId> | ||
173 | + <artifactId>mybatis</artifactId> | ||
174 | + <version>${mybatis.version}</version> | ||
175 | + </dependency> | ||
176 | + <dependency> | ||
177 | + <groupId>org.mybatis</groupId> | ||
178 | + <artifactId>mybatis-spring</artifactId> | ||
179 | + <version>${mybatis-spring.version}</version> | ||
180 | + </dependency> | ||
181 | + | ||
182 | + <!-- connection pool --> | ||
183 | + <dependency> | ||
184 | + <groupId>com.alibaba</groupId> | ||
185 | + <artifactId>druid</artifactId> | ||
186 | + <version>${druid.version}</version> | ||
187 | + </dependency> | ||
188 | + | ||
189 | + <!-- jdbc driver --> | ||
190 | + <dependency> | ||
191 | + <groupId>mysql</groupId> | ||
192 | + <artifactId>mysql-connector-java</artifactId> | ||
193 | + <version>${mysql.driver.version}</version> | ||
194 | + <scope>runtime</scope> | ||
195 | + </dependency> | ||
196 | + <dependency> | ||
197 | + <groupId>com.oracle</groupId> | ||
198 | + <artifactId>ojdbc14</artifactId> | ||
199 | + <version>${oracle.driver.version}</version> | ||
200 | + <scope>system</scope> | ||
201 | + <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/ojdbc14-10.2.0.4.0.jar</systemPath> | ||
202 | + </dependency> | ||
203 | + <dependency> | ||
204 | + <groupId>net.sourceforge.jtds</groupId> | ||
205 | + <artifactId>jtds</artifactId> | ||
206 | + <version>${mssql.driver.version}</version> | ||
207 | + <scope>runtime</scope> | ||
208 | + </dependency> | ||
209 | + <!-- PERSISTENCE end --> | ||
210 | + | ||
211 | + <!-- WEB begin --> | ||
212 | + <dependency> | ||
213 | + <groupId>org.springframework</groupId> | ||
214 | + <artifactId>spring-web</artifactId> | ||
215 | + <version>${spring.version}</version> | ||
216 | + </dependency> | ||
217 | + <dependency> | ||
218 | + <groupId>org.springframework</groupId> | ||
219 | + <artifactId>spring-webmvc</artifactId> | ||
220 | + <version>${spring.version}</version> | ||
221 | + </dependency> | ||
222 | + <dependency> | ||
223 | + <groupId>org.springframework</groupId> | ||
224 | + <artifactId>spring-oxm</artifactId> | ||
225 | + <version>${spring.version}</version> | ||
226 | + </dependency> | ||
227 | + <dependency> | ||
228 | + <groupId>opensymphony</groupId> | ||
229 | + <artifactId>sitemesh</artifactId> | ||
230 | + <version>${sitemesh.version}</version> | ||
231 | + </dependency> | ||
232 | + <dependency> | ||
233 | + <groupId>taglibs</groupId> | ||
234 | + <artifactId>standard</artifactId> | ||
235 | + <version>1.1.2</version> | ||
236 | + <type>jar</type> | ||
237 | + </dependency> | ||
238 | + <dependency> | ||
239 | + <groupId>javax.servlet</groupId> | ||
240 | + <artifactId>jstl</artifactId> | ||
241 | + <version>1.2</version> | ||
242 | + <type>jar</type> | ||
243 | + </dependency> | ||
244 | + <dependency> | ||
245 | + <groupId>javax.servlet</groupId> | ||
246 | + <artifactId>servlet-api</artifactId> | ||
247 | + <version>2.5</version> | ||
248 | + <scope>provided</scope> | ||
249 | + </dependency> | ||
250 | + <dependency> | ||
251 | + <groupId>javax.servlet.jsp</groupId> | ||
252 | + <artifactId>jsp-api</artifactId> | ||
253 | + <version>2.1</version> | ||
254 | + <scope>provided</scope> | ||
255 | + </dependency> | ||
256 | + <dependency> | ||
257 | + <groupId>com.github.penggle</groupId> | ||
258 | + <artifactId>kaptcha</artifactId> | ||
259 | + <version>${kaptcha-version}</version> | ||
260 | + </dependency> | ||
261 | + | ||
262 | + <!-- <dependency> | ||
263 | + <groupId>javax.servlet</groupId> | ||
264 | + <artifactId>javax.servlet-api</artifactId> | ||
265 | + <version>3.0.1</version> | ||
266 | + <scope>provided</scope> | ||
267 | + </dependency> | ||
268 | + <dependency> | ||
269 | + <groupId>javax.servlet.jsp</groupId> | ||
270 | + <artifactId>jsp-api</artifactId> | ||
271 | + <version>2.2</version> | ||
272 | + <scope>provided</scope> | ||
273 | + </dependency> --> | ||
274 | + <!-- WEB end --> | ||
275 | + | ||
276 | + <!-- CACHE begin --> | ||
277 | + <dependency> | ||
278 | + <groupId>net.sf.ehcache</groupId> | ||
279 | + <artifactId>ehcache-core</artifactId> | ||
280 | + <version>${ehcache.version}</version> | ||
281 | + </dependency> | ||
282 | + <dependency> | ||
283 | + <groupId>net.sf.ehcache</groupId> | ||
284 | + <artifactId>ehcache-web</artifactId> | ||
285 | + <version>${ehcache-web.version}</version> | ||
286 | + </dependency> | ||
287 | + <dependency> | ||
288 | + <groupId>redis.clients</groupId> | ||
289 | + <artifactId>jedis</artifactId> | ||
290 | + <version>2.5.1</version> | ||
291 | + </dependency> | ||
292 | + <!-- CACHE end --> | ||
293 | + | ||
294 | + <!-- SECURITY begin --> | ||
295 | + <dependency> | ||
296 | + <groupId>org.apache.shiro</groupId> | ||
297 | + <artifactId>shiro-core</artifactId> | ||
298 | + <version>${shiro.version}</version> | ||
299 | + </dependency> | ||
300 | + <dependency> | ||
301 | + <groupId>org.apache.shiro</groupId> | ||
302 | + <artifactId>shiro-spring</artifactId> | ||
303 | + <version>${shiro.version}</version> | ||
304 | + </dependency> | ||
305 | + <dependency> | ||
306 | + <groupId>org.apache.shiro</groupId> | ||
307 | + <artifactId>shiro-cas</artifactId> | ||
308 | + <version>${shiro.version}</version> | ||
309 | + <exclusions> | ||
310 | + <exclusion> | ||
311 | + <groupId>commons-logging</groupId> | ||
312 | + <artifactId>commons-logging</artifactId> | ||
313 | + </exclusion> | ||
314 | + </exclusions> | ||
315 | + </dependency> | ||
316 | + <dependency> | ||
317 | + <groupId>org.apache.shiro</groupId> | ||
318 | + <artifactId>shiro-web</artifactId> | ||
319 | + <version>${shiro.version}</version> | ||
320 | + </dependency> | ||
321 | + <dependency> | ||
322 | + <groupId>org.apache.shiro</groupId> | ||
323 | + <artifactId>shiro-ehcache</artifactId> | ||
324 | + <version>${shiro.version}</version> | ||
325 | + </dependency> | ||
326 | + <!-- SECURITY end --> | ||
327 | + <!-- Activiti --> | ||
328 | + <dependency> | ||
329 | + <groupId>org.activiti</groupId> | ||
330 | + <artifactId>activiti-engine</artifactId> | ||
331 | + <version>${activiti.version}</version> | ||
332 | + </dependency> | ||
333 | + <dependency> | ||
334 | + <groupId>org.activiti</groupId> | ||
335 | + <artifactId>activiti-spring</artifactId> | ||
336 | + <version>${activiti.version}</version> | ||
337 | + </dependency> | ||
338 | + <dependency> | ||
339 | + <groupId>org.activiti</groupId> | ||
340 | + <artifactId>activiti-explorer</artifactId> | ||
341 | + <version>${activiti.version}</version> | ||
342 | + <exclusions> | ||
343 | + <exclusion> | ||
344 | + <artifactId>vaadin</artifactId> | ||
345 | + <groupId>com.vaadin</groupId> | ||
346 | + </exclusion> | ||
347 | + <exclusion> | ||
348 | + <artifactId>dcharts-widget</artifactId> | ||
349 | + <groupId>org.vaadin.addons</groupId> | ||
350 | + </exclusion> | ||
351 | + <exclusion> | ||
352 | + <artifactId>activiti-simple-workflow</artifactId> | ||
353 | + <groupId>org.activiti</groupId> | ||
354 | + </exclusion> | ||
355 | + </exclusions> | ||
356 | + </dependency> | ||
357 | + <dependency> | ||
358 | + <groupId>org.activiti</groupId> | ||
359 | + <artifactId>activiti-modeler</artifactId> | ||
360 | + <version>${activiti.version}</version> | ||
361 | + </dependency> | ||
362 | + <dependency> | ||
363 | + <groupId>org.activiti</groupId> | ||
364 | + <artifactId>activiti-diagram-rest</artifactId> | ||
365 | + <version>${activiti.version}</version> | ||
366 | + </dependency> | ||
367 | + | ||
368 | + <!-- 支持activiti缓存 --> | ||
369 | + <!-- <dependency> | ||
370 | + <groupId>org.infinispan</groupId> | ||
371 | + <artifactId>infinispan-core</artifactId> | ||
372 | + <version>5.1.7.Final</version> | ||
373 | + </dependency> --> | ||
374 | + | ||
375 | + <!-- LOGGING begin --> | ||
376 | + <dependency> | ||
377 | + <groupId>org.slf4j</groupId> | ||
378 | + <artifactId>slf4j-api</artifactId> | ||
379 | + <version>${slf4j.version}</version> | ||
380 | + </dependency> | ||
381 | + <dependency> | ||
382 | + <groupId>org.slf4j</groupId> | ||
383 | + <artifactId>slf4j-log4j12</artifactId> | ||
384 | + <version>${slf4j.version}</version> | ||
385 | + </dependency> | ||
386 | + <!-- common-logging 实际调用slf4j --> | ||
387 | + <dependency> | ||
388 | + <groupId>org.slf4j</groupId> | ||
389 | + <artifactId>jcl-over-slf4j</artifactId> | ||
390 | + <version>${slf4j.version}</version> | ||
391 | + </dependency> | ||
392 | + <!-- java.util.logging 实际调用slf4j --> | ||
393 | + <dependency> | ||
394 | + <groupId>org.slf4j</groupId> | ||
395 | + <artifactId>jul-to-slf4j</artifactId> | ||
396 | + <version>${slf4j.version}</version> | ||
397 | + </dependency> | ||
398 | + <!-- LOGGING end --> | ||
399 | + | ||
400 | + <!-- GENERAL UTILS begin --> | ||
401 | + <dependency> | ||
402 | + <groupId>org.apache.commons</groupId> | ||
403 | + <artifactId>commons-lang3</artifactId> | ||
404 | + <version>${commons-lang3.version}</version> | ||
405 | + </dependency> | ||
406 | + <dependency> | ||
407 | + <groupId>commons-io</groupId> | ||
408 | + <artifactId>commons-io</artifactId> | ||
409 | + <version>${commons-io.version}</version> | ||
410 | + </dependency> | ||
411 | + <dependency> | ||
412 | + <groupId>commons-codec</groupId> | ||
413 | + <artifactId>commons-codec</artifactId> | ||
414 | + <version>${commons-codec.version}</version> | ||
415 | + </dependency> | ||
416 | + <dependency> | ||
417 | + <groupId>commons-fileupload</groupId> | ||
418 | + <artifactId>commons-fileupload</artifactId> | ||
419 | + <version>${commons-fileupload.version}</version> | ||
420 | + </dependency> | ||
421 | + <dependency> | ||
422 | + <groupId>commons-beanutils</groupId> | ||
423 | + <artifactId>commons-beanutils</artifactId> | ||
424 | + <version>${commons-beanutils.version}</version> | ||
425 | + <exclusions> | ||
426 | + <exclusion> | ||
427 | + <groupId>commons-logging</groupId> | ||
428 | + <artifactId>commons-logging</artifactId> | ||
429 | + </exclusion> | ||
430 | + </exclusions> | ||
431 | + </dependency> | ||
432 | + | ||
433 | + <!-- google java lib --> | ||
434 | + <dependency> | ||
435 | + <groupId>com.google.guava</groupId> | ||
436 | + <artifactId>guava</artifactId> | ||
437 | + <version>${guava.version}</version> | ||
438 | + </dependency> | ||
439 | + | ||
440 | + <!-- jackson json --> | ||
441 | + <dependency> | ||
442 | + <groupId>com.fasterxml.jackson.core</groupId> | ||
443 | + <artifactId>jackson-core</artifactId> | ||
444 | + <version>${jackson.version}</version> | ||
445 | + </dependency> | ||
446 | + <dependency> | ||
447 | + <groupId>com.fasterxml.jackson.core</groupId> | ||
448 | + <artifactId>jackson-databind</artifactId> | ||
449 | + <version>${jackson.version}</version> | ||
450 | + </dependency> | ||
451 | + <dependency> | ||
452 | + <groupId>com.fasterxml.jackson.core</groupId> | ||
453 | + <artifactId>jackson-annotations</artifactId> | ||
454 | + <version>${jackson.version}</version> | ||
455 | + </dependency> | ||
456 | + <dependency> | ||
457 | + <groupId>com.fasterxml.jackson.module</groupId> | ||
458 | + <artifactId>jackson-module-jaxb-annotations</artifactId> | ||
459 | + <version>${jackson.version}</version> | ||
460 | + </dependency> | ||
461 | + | ||
462 | + <!-- fastjson json--> | ||
463 | + <dependency> | ||
464 | + <groupId>com.alibaba</groupId> | ||
465 | + <artifactId>fastjson</artifactId> | ||
466 | + <version>${fastjson.version}</version> | ||
467 | + </dependency> | ||
468 | + | ||
469 | + <!-- xstream xml --> | ||
470 | + <dependency> | ||
471 | + <groupId>com.thoughtworks.xstream</groupId> | ||
472 | + <artifactId>xstream</artifactId> | ||
473 | + <version>${xstream.version}</version> | ||
474 | + </dependency> | ||
475 | + | ||
476 | + <!-- pojo copy --> | ||
477 | + <dependency> | ||
478 | + <groupId>net.sf.dozer</groupId> | ||
479 | + <artifactId>dozer</artifactId> | ||
480 | + <version>${dozer.version}</version> | ||
481 | + </dependency> | ||
482 | + | ||
483 | + <!-- freemarker engine --> | ||
484 | + <dependency> | ||
485 | + <groupId>org.freemarker</groupId> | ||
486 | + <artifactId>freemarker</artifactId> | ||
487 | + <version>${freemarker.version}</version> | ||
488 | + </dependency> | ||
489 | + | ||
490 | + <!-- email --> | ||
491 | + <dependency> | ||
492 | + <groupId>javax.mail</groupId> | ||
493 | + <artifactId>mail</artifactId> | ||
494 | + <version>1.4.7</version> | ||
495 | + </dependency> | ||
496 | + <dependency> | ||
497 | + <groupId>javax.activation</groupId> | ||
498 | + <artifactId>activation</artifactId> | ||
499 | + <version>1.1.1</version> | ||
500 | + </dependency> | ||
501 | + | ||
502 | + <!-- poi office --> | ||
503 | + <dependency> | ||
504 | + <groupId>org.apache.poi</groupId> | ||
505 | + <artifactId>poi</artifactId> | ||
506 | + <version>${poi.version}</version> | ||
507 | + </dependency> | ||
508 | + <dependency> | ||
509 | + <groupId>org.apache.poi</groupId> | ||
510 | + <artifactId>poi-ooxml</artifactId> | ||
511 | + <version>${poi.version}</version> | ||
512 | + </dependency> | ||
513 | + <dependency> | ||
514 | + <groupId>org.apache.poi</groupId> | ||
515 | + <artifactId>poi-ooxml-schemas</artifactId> | ||
516 | + <version>${poi.version}</version> | ||
517 | + </dependency> | ||
518 | + | ||
519 | + <!-- image util --> | ||
520 | + <dependency> | ||
521 | + <groupId>com.drewnoakes</groupId> | ||
522 | + <artifactId>metadata-extractor</artifactId> | ||
523 | + <version>2.6.2</version> | ||
524 | + </dependency> | ||
525 | + | ||
526 | + <!-- 条形码、二维码生成 --> | ||
527 | + <dependency> | ||
528 | + <groupId>com.google.zxing</groupId> | ||
529 | + <artifactId>core</artifactId> | ||
530 | + <version>2.2</version> | ||
531 | + </dependency> | ||
532 | + <dependency> | ||
533 | + <groupId>com.google.zxing</groupId> | ||
534 | + <artifactId>javase</artifactId> | ||
535 | + <version>2.2</version> | ||
536 | + </dependency> | ||
537 | + | ||
538 | + <!-- 中文分词 --> | ||
539 | + <dependency> | ||
540 | + <groupId>org.wltea</groupId> | ||
541 | + <artifactId>analyzer</artifactId> | ||
542 | + <version>2012_u6</version> | ||
543 | + <scope>system</scope> | ||
544 | + <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/analyzer-2012_u6.jar</systemPath> | ||
545 | + </dependency> | ||
546 | + <!-- GENERAL UTILS end --> | ||
547 | + | ||
548 | + <!-- CKFinder begin --> | ||
549 | + <dependency> | ||
550 | + <groupId>net.coobird</groupId> | ||
551 | + <artifactId>thumbnailator</artifactId> | ||
552 | + <version>0.4.2</version> | ||
553 | + <scope>system</scope> | ||
554 | + <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/thumbnailator-0.4.2.jar</systemPath> | ||
555 | + </dependency> | ||
556 | + <dependency> | ||
557 | + <groupId>com.ckfinder</groupId> | ||
558 | + <artifactId>apache-ant-zip</artifactId> | ||
559 | + <version>2.3</version> | ||
560 | + <scope>system</scope> | ||
561 | + <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/apache-ant-zip-2.3.jar</systemPath> | ||
562 | + </dependency> | ||
563 | + <dependency> | ||
564 | + <groupId>com.ckfinder</groupId> | ||
565 | + <artifactId>ckfinder</artifactId> | ||
566 | + <version>2.3</version> | ||
567 | + <scope>system</scope> | ||
568 | + <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/ckfinder-2.3.jar</systemPath> | ||
569 | + </dependency> | ||
570 | + <dependency> | ||
571 | + <groupId>com.ckfinder</groupId> | ||
572 | + <artifactId>ckfinderplugin-fileeditor</artifactId> | ||
573 | + <version>2.3</version> | ||
574 | + <scope>system</scope> | ||
575 | + <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/ckfinderplugin-fileeditor-2.3.jar</systemPath> | ||
576 | + </dependency> | ||
577 | + <dependency> | ||
578 | + <groupId>com.ckfinder</groupId> | ||
579 | + <artifactId>ckfinderplugin-imageresize</artifactId> | ||
580 | + <version>2.3</version> | ||
581 | + <scope>system</scope> | ||
582 | + <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/ckfinderplugin-imageresize-2.3.jar</systemPath> | ||
583 | + </dependency> | ||
584 | + <!-- CKFinder end --> | ||
585 | + | ||
586 | + <!-- TEST begin --> | ||
587 | + <dependency> | ||
588 | + <groupId>junit</groupId> | ||
589 | + <artifactId>junit</artifactId> | ||
590 | + <version>4.11</version> | ||
591 | + </dependency> | ||
592 | + <dependency> | ||
593 | + <groupId>org.springframework</groupId> | ||
594 | + <artifactId>spring-test</artifactId> | ||
595 | + <version>${spring.version}</version> | ||
596 | + </dependency> | ||
597 | + <!-- TEST end --> | ||
598 | + | ||
599 | + <!-- User Agent --> | ||
600 | + <dependency> | ||
601 | + <groupId>bitwalker</groupId> | ||
602 | + <artifactId>UserAgentUtils</artifactId> | ||
603 | + <version>1.13</version> | ||
604 | + <scope>system</scope> | ||
605 | + <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/UserAgentUtils-1.13.jar</systemPath> | ||
606 | + </dependency> | ||
607 | + | ||
608 | + | ||
609 | + <!-- 自定义jar依赖包 | ||
610 | + <dependency> | ||
611 | + <groupId>com.thinkgem.jeesite</groupId> | ||
612 | + <artifactId>test-core</artifactId> | ||
613 | + <version>1.0</version> | ||
614 | + <scope>system</scope> | ||
615 | + <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/test-core-1.0.jar</systemPath> | ||
616 | + </dependency> --> | ||
617 | + | ||
618 | + <!-- 使用 Jetty JSP引擎 | ||
619 | + <dependency> | ||
620 | + <groupId>org.eclipse.jetty</groupId> | ||
621 | + <artifactId>jetty-jsp</artifactId> | ||
622 | + <version>${jetty.version}</version> | ||
623 | + <exclusions> | ||
624 | + <exclusion> | ||
625 | + <groupId>org.eclipse.jetty.orbit</groupId> | ||
626 | + <artifactId>javax.servlet</artifactId> | ||
627 | + </exclusion> | ||
628 | + <exclusion> | ||
629 | + <groupId>org.eclipse.jetty.orbit</groupId> | ||
630 | + <artifactId>org.apache.taglibs.standard.glassfish</artifactId> | ||
631 | + </exclusion> | ||
632 | + </exclusions> | ||
633 | + </dependency> --> | ||
634 | + | ||
635 | + </dependencies> | ||
636 | + | ||
637 | + <build> | ||
638 | + <outputDirectory>${project.basedir}/src/main/webapp/WEB-INF/classes/</outputDirectory> | ||
639 | + <plugins> | ||
640 | + <!-- Compiler 插件, 设定JDK版本 --> | ||
641 | + <plugin> | ||
642 | + <groupId>org.apache.maven.plugins</groupId> | ||
643 | + <artifactId>maven-compiler-plugin</artifactId> | ||
644 | + <version>3.5.1</version> | ||
645 | + <configuration> | ||
646 | + <source>${jdk.version}</source> | ||
647 | + <target>${jdk.version}</target> | ||
648 | + <showWarnings>true</showWarnings> | ||
649 | + </configuration> | ||
650 | + </plugin> | ||
651 | + | ||
652 | + <!-- JSP 预编译插件 jspweb.xml | ||
653 | + <plugin> | ||
654 | + <groupId>org.jasig.mojo.jspc</groupId> | ||
655 | + <artifactId>jspc-maven-plugin</artifactId> | ||
656 | + <version>2.0.0</version> | ||
657 | + <configuration> | ||
658 | + <injectString><!- - [INSERT FRAGMENT HERE] - -></injectString> | ||
659 | + </configuration> | ||
660 | + <executions> | ||
661 | + <execution> | ||
662 | + <goals> | ||
663 | + <goal>compile</goal> | ||
664 | + </goals> | ||
665 | + </execution> | ||
666 | + </executions> | ||
667 | + <dependencies> | ||
668 | + <dependency> | ||
669 | + <groupId>org.jasig.mojo.jspc</groupId> | ||
670 | + <artifactId>jspc-compiler-tomcat6</artifactId> | ||
671 | + <version>2.0.0</version> | ||
672 | + </dependency> | ||
673 | + </dependencies> | ||
674 | + </plugin>--> | ||
675 | + | ||
676 | + <!-- Jetty JSP 预编译插件 web.xml | ||
677 | + <plugin> | ||
678 | + <groupId>org.mortbay.jetty</groupId> | ||
679 | + <artifactId>jetty-jspc-maven-plugin</artifactId> | ||
680 | + <version>${jetty.version}</version> | ||
681 | + <configuration> | ||
682 | + <insertionMarker><!- - [INSERT FRAGMENT HERE] - -></insertionMarker> | ||
683 | + </configuration> | ||
684 | + <executions> | ||
685 | + <execution> | ||
686 | + <goals> | ||
687 | + <goal>jspc</goal> | ||
688 | + </goals> | ||
689 | + </execution> | ||
690 | + </executions> | ||
691 | + </plugin>--> | ||
692 | + | ||
693 | + <!-- 打包jar文件时,配置manifest文件,加入lib包的jar依赖 --> | ||
694 | + <plugin> | ||
695 | + <groupId>org.apache.maven.plugins</groupId> | ||
696 | + <artifactId>maven-jar-plugin</artifactId> | ||
697 | + <version>2.4</version> | ||
698 | + <configuration> | ||
699 | + <encoding>${project.build.sourceEncoding}</encoding> | ||
700 | + </configuration> | ||
701 | + <!-- <executions> | ||
702 | + <execution> | ||
703 | + <phase>prepare-package</phase> | ||
704 | + <goals> | ||
705 | + <goal>jar</goal> | ||
706 | + </goals> | ||
707 | + <configuration> | ||
708 | + <classesDirectory>${project.outputDirectory}</classesDirectory> | ||
709 | + <finalName>jeesite</finalName> | ||
710 | + <outputDirectory>${project.build.directory}/${project.artifactId}/WEB-INF/lib</outputDirectory> | ||
711 | + <includes> | ||
712 | + <include>com/thinkgem/jeesite/**</include> | ||
713 | + </includes> | ||
714 | + </configuration> | ||
715 | + </execution> | ||
716 | + </executions> --> | ||
717 | + </plugin> | ||
718 | + | ||
719 | + <!-- 混淆代码 | ||
720 | + <plugin> | ||
721 | + <groupId>com.github.wvengen</groupId> | ||
722 | + <artifactId>proguard-maven-plugin</artifactId> | ||
723 | + <version>2.0.11</version> | ||
724 | + <executions> | ||
725 | + <execution> | ||
726 | + <phase>prepare-package</phase> | ||
727 | + <goals> | ||
728 | + <goal>proguard</goal> | ||
729 | + </goals> | ||
730 | + </execution> | ||
731 | + </executions> | ||
732 | + <configuration> | ||
733 | + <obfuscate>true</obfuscate> | ||
734 | + <options> | ||
735 | + <option>-injars ${project.build.directory}/${project.artifactId}/WEB-INF/lib/jeesite.jar</option> | ||
736 | + </options> | ||
737 | + <outjar>${project.artifactId}/WEB-INF/lib/jeesite_out.jar</outjar> | ||
738 | + <outputDirectory>${project.build.directory}</outputDirectory> | ||
739 | + <proguardInclude>${basedir}/proguard.cfg</proguardInclude> | ||
740 | + <source>${jdk.version}</source> | ||
741 | + <target>${jdk.version}</target> | ||
742 | + <encoding>${project.build.sourceEncoding}</encoding> | ||
743 | + <libs> | ||
744 | + <lib>${java.home}/lib/rt.jar</lib> | ||
745 | + <lib>${java.home}/lib/jsse.jar</lib> | ||
746 | + <lib>${java.home}/lib/jce.jar</lib> | ||
747 | + </libs> | ||
748 | + <addMavenDescriptor>false</addMavenDescriptor> | ||
749 | + </configuration> | ||
750 | + <dependencies> | ||
751 | + <dependency> | ||
752 | + <groupId>net.sf.proguard</groupId> | ||
753 | + <artifactId>proguard-base</artifactId> | ||
754 | + <version>4.9</version> | ||
755 | + <scope>runtime</scope> | ||
756 | + </dependency> | ||
757 | + </dependencies> | ||
758 | + </plugin> --> | ||
759 | + | ||
760 | + <!-- war 打包插件, 设定war包名称不带版本号 --> | ||
761 | + <plugin> | ||
762 | + <groupId>org.apache.maven.plugins</groupId> | ||
763 | + <artifactId>maven-war-plugin</artifactId> | ||
764 | + <version>2.4</version> | ||
765 | + <configuration> | ||
766 | + <packagingExcludes> | ||
767 | + <!-- WEB-INF/classes/com/thinkgem/jeesite/** --> | ||
768 | + WEB-INF/classes/org/apache/ibatis/**, | ||
769 | + WEB-INF/classes/org/mybatis/spring/** | ||
770 | + </packagingExcludes> | ||
771 | + <warSourceExcludes> | ||
772 | + static/bootstrap/2.3.1/docs/**, | ||
773 | + static/ckeditor/_samples/**, | ||
774 | + static/ckeditor/_source/**, | ||
775 | + static/ckfinder/_samples/**, | ||
776 | + static/ckfinder/help/**, | ||
777 | + static/compressor*/**, | ||
778 | + static/jquery-jbox/2.3/docs/**, | ||
779 | + static/jquery-jbox/2.3/Skins2/**, | ||
780 | + static/jquery-validation/1.11.0/demo/**, | ||
781 | + static/jquery-ztree/3.5.12/demo/**, | ||
782 | + static/My97DatePicker/docs/**, | ||
783 | + static/supcan/doc/**, | ||
784 | + static/SuperSlide/demo/**, | ||
785 | + static/treeTable/demo/**<!-- , --> | ||
786 | + <!-- userfiles/** --><!-- ,/**/*.jsp -->, | ||
787 | + test/** | ||
788 | + </warSourceExcludes> | ||
789 | + <webappDirectory>${project.build.directory}/${project.artifactId}</webappDirectory><!-- | ||
790 | + <webXml>${project.basedir}/target/jspweb.xml</webXml> --> | ||
791 | + <warName>${project.artifactId}</warName> | ||
792 | + </configuration> | ||
793 | + </plugin> | ||
794 | + | ||
795 | + <!-- Eclipse 插件 --> | ||
796 | + <plugin> | ||
797 | + <groupId>org.apache.maven.plugins</groupId> | ||
798 | + <artifactId>maven-eclipse-plugin</artifactId> | ||
799 | + <version>2.9</version> | ||
800 | + <configuration> | ||
801 | + <downloadSources>${downloadSources}</downloadSources> | ||
802 | + <downloadJavadocs>false</downloadJavadocs> | ||
803 | + <wtpversion>2.0</wtpversion> | ||
804 | + <jeeversion>5.0</jeeversion> | ||
805 | + <!-- <jeeversion>6.0</jeeversion> --> | ||
806 | + <additionalConfig> | ||
807 | + <file> | ||
808 | + <name>.settings/org.eclipse.core.resources.prefs</name> | ||
809 | + <content> | ||
810 | + <![CDATA[eclipse.preferences.version=1${line.separator}encoding/<project>=${project.build.sourceEncoding}${line.separator}]]> | ||
811 | + </content> | ||
812 | + </file> | ||
813 | + </additionalConfig> | ||
814 | + <additionalProjectnatures> | ||
815 | + <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature> | ||
816 | + </additionalProjectnatures> | ||
817 | + </configuration> | ||
818 | + </plugin> | ||
819 | + | ||
820 | + <!-- tomcat6插件 --> | ||
821 | + <plugin> | ||
822 | + <groupId>org.apache.tomcat.maven</groupId> | ||
823 | + <artifactId>tomcat6-maven-plugin</artifactId> | ||
824 | + <version>${tomcat.version}</version> | ||
825 | + <configuration> | ||
826 | + <port>${webserver.port}</port> | ||
827 | + <path>/${project.artifactId}</path> | ||
828 | + <uriEncoding>${project.build.sourceEncoding}</uriEncoding> | ||
829 | + </configuration> | ||
830 | + </plugin> | ||
831 | + | ||
832 | + <!-- tomcat7插件 --> | ||
833 | + <plugin> | ||
834 | + <groupId>org.apache.tomcat.maven</groupId> | ||
835 | + <artifactId>tomcat7-maven-plugin</artifactId> | ||
836 | + <version>${tomcat.version}</version> | ||
837 | + <configuration> | ||
838 | + <port>${webserver.port}</port> | ||
839 | + <path>/${project.artifactId}</path> | ||
840 | + <uriEncoding>${project.build.sourceEncoding}</uriEncoding> | ||
841 | + </configuration> | ||
842 | + </plugin> | ||
843 | + | ||
844 | + <!-- jetty插件 --> | ||
845 | + <plugin> | ||
846 | + <groupId>org.mortbay.jetty</groupId> | ||
847 | + <artifactId>jetty-maven-plugin</artifactId> | ||
848 | + <version>${jetty.version}</version> | ||
849 | + <configuration> | ||
850 | + <connectors> | ||
851 | + <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> | ||
852 | + <port>${webserver.port}</port> | ||
853 | + </connector> | ||
854 | + </connectors> | ||
855 | + <webAppConfig> | ||
856 | + <contextPath>/${project.artifactId}</contextPath> | ||
857 | + </webAppConfig> | ||
858 | + <systemProperties> | ||
859 | + <systemProperty> | ||
860 | + <name>org.mortbay.util.URI.charset</name> | ||
861 | + <value>${project.build.sourceEncoding}</value> | ||
862 | + </systemProperty> | ||
863 | + </systemProperties> | ||
864 | + </configuration> | ||
865 | + </plugin> | ||
866 | + | ||
867 | + <!-- resource插件 --> | ||
868 | + <plugin> | ||
869 | + <groupId>org.apache.maven.plugins</groupId> | ||
870 | + <artifactId>maven-resources-plugin</artifactId> | ||
871 | + <version>2.7</version> | ||
872 | + </plugin> | ||
873 | + | ||
874 | + <!-- install插件 --> | ||
875 | + <plugin> | ||
876 | + <groupId>org.apache.maven.plugins</groupId> | ||
877 | + <artifactId>maven-install-plugin</artifactId> | ||
878 | + <version>2.5.2</version> | ||
879 | + </plugin> | ||
880 | + | ||
881 | + <!-- clean插件 --> | ||
882 | + <plugin> | ||
883 | + <groupId>org.apache.maven.plugins</groupId> | ||
884 | + <artifactId>maven-clean-plugin</artifactId> | ||
885 | + <version>2.6.1</version> | ||
886 | + </plugin> | ||
887 | + | ||
888 | + <!-- ant插件 --> | ||
889 | + <plugin> | ||
890 | + <groupId>org.apache.maven.plugins</groupId> | ||
891 | + <artifactId>maven-antrun-plugin</artifactId> | ||
892 | + <version>1.8</version> | ||
893 | + </plugin> | ||
894 | + | ||
895 | + <!-- dependency插件 --> | ||
896 | + <plugin> | ||
897 | + <groupId>org.apache.maven.plugins</groupId> | ||
898 | + <artifactId>maven-dependency-plugin</artifactId> | ||
899 | + <version>2.10</version> | ||
900 | + </plugin> | ||
901 | + </plugins> | ||
902 | + </build> | ||
903 | + | ||
904 | + <profiles> | ||
905 | + <!-- 初始化数据库 --> | ||
906 | + <profile> | ||
907 | + <id>init-db</id> | ||
908 | + <dependencies> | ||
909 | + <dependency> | ||
910 | + <groupId>org.dbunit</groupId> | ||
911 | + <artifactId>dbunit</artifactId> | ||
912 | + <version>2.4.8</version> | ||
913 | + </dependency> | ||
914 | + <dependency> | ||
915 | + <groupId>org.apache.poi</groupId> | ||
916 | + <artifactId>poi</artifactId> | ||
917 | + <version>3.2-FINAL</version> | ||
918 | + </dependency> | ||
919 | + </dependencies> | ||
920 | + <build> | ||
921 | + <plugins> | ||
922 | + <plugin> | ||
923 | + <groupId>org.apache.maven.plugins</groupId> | ||
924 | + <artifactId>maven-antrun-plugin</artifactId> | ||
925 | + <version>1.7</version> | ||
926 | + <configuration> | ||
927 | + <target> | ||
928 | + | ||
929 | + <!-- mysql --> | ||
930 | + <property name="dbunit.datatype" value="org.dbunit.ext.mysql.MySqlDataTypeFactory" /> | ||
931 | + | ||
932 | + <!-- mssql | ||
933 | + <property name="dbunit.datatype" value="org.dbunit.ext.mssql.MsSqlDataTypeFactory" /> --> | ||
934 | + | ||
935 | + <!-- oracle | ||
936 | + <property name="dbunit.datatype" value="org.dbunit.ext.oracle.Oracle10DataTypeFactory" /> --> | ||
937 | + | ||
938 | + <property file="src/main/resources/jeesite.properties" /> | ||
939 | + <sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}" | ||
940 | + onerror="continue" encoding="${project.build.sourceEncoding}"> | ||
941 | + <classpath refid="maven.test.classpath" /> | ||
942 | + <transaction src="db/sys/jeesite_${jdbc.type}.sql"/> | ||
943 | + <transaction src="db/cms/jeesite_${jdbc.type}.sql"/> | ||
944 | + <transaction src="db/oa/jeesite_${jdbc.type}.sql"/> | ||
945 | + <transaction src="db/gen/jeesite_${jdbc.type}.sql"/> | ||
946 | + <transaction src="db/gen/example_${jdbc.type}.sql"/> | ||
947 | + <transaction src="db/test/jeesite_${jdbc.type}.sql"/> | ||
948 | + <transaction src="db/act/drop/activiti.${jdbc.type}.drop.engine.sql"/> | ||
949 | + <transaction src="db/act/drop/activiti.${jdbc.type}.drop.history.sql"/> | ||
950 | + <transaction src="db/act/drop/activiti.${jdbc.type}.drop.identity.sql"/> | ||
951 | + <transaction src="db/act/create/activiti.${jdbc.type}.create.engine.sql"/> | ||
952 | + <transaction src="db/act/create/activiti.${jdbc.type}.create.history.sql"/> | ||
953 | + <transaction src="db/act/create/activiti.${jdbc.type}.create.identity.sql"/> | ||
954 | + </sql> | ||
955 | + | ||
956 | + <taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpathref="maven.test.classpath" /> | ||
957 | + | ||
958 | + <!-- mysql、mssql --> | ||
959 | + <dbunit driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" | ||
960 | + password="${jdbc.password}"> | ||
961 | + | ||
962 | + <!-- oracle | ||
963 | + <dbunit driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" | ||
964 | + password="${jdbc.password}" schema="${jdbc.username}" > --> | ||
965 | + | ||
966 | + <dbconfig> | ||
967 | + <property name="datatypeFactory" value="${dbunit.datatype}" /> | ||
968 | + </dbconfig> | ||
969 | + <classpath refid="maven.test.classpath" /> | ||
970 | + <operation type="INSERT" src="db/sys/jeesite_data.xls" format="xls" transaction="true"/> | ||
971 | + <operation type="INSERT" src="db/cms/jeesite_data.xls" format="xls" transaction="true"/> | ||
972 | + | ||
973 | + </dbunit> | ||
974 | + | ||
975 | + </target> | ||
976 | + </configuration> | ||
977 | + </plugin> | ||
978 | + </plugins> | ||
979 | + </build> | ||
980 | + </profile> | ||
981 | + </profiles> | ||
982 | + | ||
983 | + <!-- 开发者信息 --> | ||
984 | + <developers> | ||
985 | + <developer> | ||
986 | + <id>Promise</id> | ||
987 | + <name>Promise</name> | ||
988 | + <email>cpufun@163.com</email> | ||
989 | + <roles><role>Project lead</role></roles> | ||
990 | + <timezone>+8</timezone> | ||
991 | + </developer> | ||
992 | + </developers> | ||
993 | + | ||
994 | +</project> |
proguard.cfg
0 → 100644
1 | +# ---------------------------------- | ||
2 | +# 通过指定数量的优化能执行 | ||
3 | +# -optimizationpasses n | ||
4 | +# ---------------------------------- | ||
5 | +-optimizationpasses 3 | ||
6 | + | ||
7 | +# ---------------------------------- | ||
8 | +# 混淆时不会产生形形色色的类名 | ||
9 | +# -dontusemixedcaseclassnames | ||
10 | +# ---------------------------------- | ||
11 | +-dontusemixedcaseclassnames | ||
12 | + | ||
13 | +# ---------------------------------- | ||
14 | +# 指定不去忽略非公共的库类 | ||
15 | +# -dontskipnonpubliclibraryclasses | ||
16 | +# ---------------------------------- | ||
17 | +#-dontskipnonpubliclibraryclasses | ||
18 | + | ||
19 | +# ---------------------------------- | ||
20 | +# 不预校验 | ||
21 | +# -dontpreverify | ||
22 | +# ---------------------------------- | ||
23 | +#-dontpreverify | ||
24 | + | ||
25 | +# ---------------------------------- | ||
26 | +# 输出生成信息 | ||
27 | +# -verbose | ||
28 | +# ---------------------------------- | ||
29 | +-verbose | ||
30 | + | ||
31 | +#混淆时应用侵入式重载 | ||
32 | +-overloadaggressively | ||
33 | + | ||
34 | +#优化时允许访问并修改有修饰符的类和类的成员 | ||
35 | +-allowaccessmodification | ||
36 | + | ||
37 | +#确定统一的混淆类的成员名称来增加混淆 | ||
38 | +-useuniqueclassmembernames | ||
39 | + | ||
40 | +-dontwarn | ||
41 | + | ||
42 | +#这里添加你不需要混淆的类 | ||
43 | +-keep public class org.** {*;} | ||
44 | +-keep public class sun.** {*;} | ||
45 | +-keep public class com.thinkgem.jeesite.test.** {*;} | ||
46 | +-keep public class com.thinkgem.jeesite.**.dao.** {*;} | ||
47 | +-keep public class com.thinkgem.jeesite.**.entity.** {*;} | ||
48 | +-keep public class com.thinkgem.jeesite.modules.act.utils.Variable {*;} | ||
49 | +-keep public class com.thinkgem.jeesite.common.persistence.Page {*;} | ||
50 | + | ||
51 | +-keep public class * extends javax.servlet.Servlet | ||
52 | + | ||
53 | +-keepattributes ** | ||
54 | + | ||
55 | +#-keepnames class * implements java.io.Serializable | ||
56 | +# ---------保护所有实体中的字段名称---------- | ||
57 | +-keepclassmembers class * implements java.io.Serializable { | ||
58 | + <fields>; | ||
59 | +} | ||
60 | +-keepclassmembers class * implements com.thinkgem.jeesite.common.persistence.BaseEntity { | ||
61 | + <fields>; | ||
62 | +} | ||
63 | + | ||
64 | +# --------- 保护类中的所有方法名 ------------ | ||
65 | +-keepclassmembers class * { | ||
66 | + public <methods>; | ||
67 | +} |
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.annotation; | ||
2 | + | ||
3 | +import java.lang.annotation.ElementType; | ||
4 | +import java.lang.annotation.Retention; | ||
5 | +import java.lang.annotation.RetentionPolicy; | ||
6 | +import java.lang.annotation.Target; | ||
7 | + | ||
8 | +/** | ||
9 | + * bean中文名注解 | ||
10 | + */ | ||
11 | +@Target(ElementType.METHOD) | ||
12 | +@Retention(RetentionPolicy.RUNTIME) | ||
13 | +public @interface FieldName { | ||
14 | + | ||
15 | + String value(); | ||
16 | + | ||
17 | +} |
1 | +package com.thinkgem.jeesite.common.barCode; | ||
2 | + | ||
3 | +import java.awt.image.BufferedImage; | ||
4 | +import java.io.BufferedReader; | ||
5 | +import java.io.File; | ||
6 | +import java.io.IOException; | ||
7 | +import java.io.InputStreamReader; | ||
8 | +import java.io.OutputStreamWriter; | ||
9 | +import java.net.HttpURLConnection; | ||
10 | +import java.net.MalformedURLException; | ||
11 | +import java.net.URL; | ||
12 | +import java.text.SimpleDateFormat; | ||
13 | +import java.util.Date; | ||
14 | +import java.util.Map; | ||
15 | + | ||
16 | +import javax.imageio.ImageIO; | ||
17 | + | ||
18 | +import com.alibaba.fastjson.JSON; | ||
19 | +import com.alibaba.fastjson.JSONArray; | ||
20 | +import com.alibaba.fastjson.JSONObject; | ||
21 | +import com.google.zxing.BarcodeFormat; | ||
22 | +import com.google.zxing.MultiFormatWriter; | ||
23 | +import com.google.zxing.common.BitMatrix; | ||
24 | +import com.thinkgem.jeesite.modules.land.entity.LandRoadVeRecord; | ||
25 | + | ||
26 | +public class buildBarCode { | ||
27 | + | ||
28 | + private static final int BLACK = 0xFF000000; | ||
29 | + private static final int WHITE = 0xFFFFFFFF; | ||
30 | + | ||
31 | + private static String CREATEBARCODE = "http://10.50.7.11:8088/publiclogistics/createVehicleBarCode"; | ||
32 | + private static String CANCLEBARCODE = "http://10.50.7.11:8088/publiclogistics/cancelVehicleBarCode"; | ||
33 | + private static String CREATECAR = "http://10.50.7.11:8088/publiclogistics/saveVehicleRecord"; | ||
34 | + private static String CANCLECAR = "http://10.50.7.11:8088/publiclogistics/cancelVehicleRecord"; | ||
35 | + private static String CODE; | ||
36 | + private static String MSG; | ||
37 | + | ||
38 | + /** | ||
39 | + * 根据字符串生成对应的二维码图片png 大小:200*200 | ||
40 | + * | ||
41 | + * content:要转换的内容 path:生成的二维码图片的绝对路径 filename: 生成的文件名 | ||
42 | + */ | ||
43 | + public static void buildQuickMark(String content, String path, String filename) throws Exception { | ||
44 | + try { | ||
45 | + BitMatrix byteMatrix = new MultiFormatWriter().encode(new String(content.getBytes(), "ISO-8859-1"), | ||
46 | + BarcodeFormat.QR_CODE, 200, 200); | ||
47 | + String format = "png"; | ||
48 | + File file = new File(path + "\\" + filename + "." + format); | ||
49 | + BufferedImage image = toBufferedImage(byteMatrix); | ||
50 | + if (!ImageIO.write(image, format, file)) { | ||
51 | + throw new IOException("Could not write an image of format " + format + " to " + file); | ||
52 | + } | ||
53 | + } catch (Exception e) { | ||
54 | + e.printStackTrace(); | ||
55 | + } | ||
56 | + } | ||
57 | + | ||
58 | + // 生成二维码规格 | ||
59 | + private static BufferedImage toBufferedImage(BitMatrix matrix) { | ||
60 | + int width = matrix.getWidth(); | ||
61 | + int height = matrix.getHeight(); | ||
62 | + BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); | ||
63 | + for (int x = 0; x < width; x++) { | ||
64 | + for (int y = 0; y < height; y++) { | ||
65 | + image.setRGB(x, y, matrix.get(x, y) ? BLACK : WHITE); | ||
66 | + } | ||
67 | + } | ||
68 | + return image; | ||
69 | + } | ||
70 | + | ||
71 | + // 发送数据并接收返回数据 | ||
72 | + public static String sendData(String url, String json) { | ||
73 | + StringBuilder str = new StringBuilder(); | ||
74 | + BufferedReader bf = null; | ||
75 | + OutputStreamWriter writer = null; | ||
76 | + try { | ||
77 | + URL Url = new URL(url); | ||
78 | + HttpURLConnection conn = (HttpURLConnection) Url.openConnection(); | ||
79 | + conn.setDoInput(true); | ||
80 | + conn.setDoOutput(true); | ||
81 | + conn.setRequestProperty("X-Rrquested-With", "XMLHttpRequest"); | ||
82 | + conn.setRequestProperty("Connection", "keep-alive"); | ||
83 | + conn.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); | ||
84 | + conn.setRequestMethod("POST"); | ||
85 | + conn.connect(); | ||
86 | + writer = new OutputStreamWriter(conn.getOutputStream(), "UTF-8"); | ||
87 | + writer.write(json); | ||
88 | + writer.flush(); | ||
89 | + bf = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); | ||
90 | + String inputLine = null; | ||
91 | + while ((inputLine = bf.readLine()) != null) { | ||
92 | + str.append(inputLine); | ||
93 | + } | ||
94 | + writer.close(); | ||
95 | + bf.close(); | ||
96 | + } catch (MalformedURLException e) { | ||
97 | + e.printStackTrace(); | ||
98 | + } catch (IOException e) { | ||
99 | + e.printStackTrace(); | ||
100 | + } | ||
101 | + return str.toString(); | ||
102 | + } | ||
103 | + | ||
104 | + // 解析返回的json里的data数据 | ||
105 | + public static Map jsonFormat(String json) { | ||
106 | + JSONObject jsonObject = JSONObject.parseObject(json); | ||
107 | + CODE = jsonObject.getString("code"); | ||
108 | + MSG =jsonObject.getString("msg"); | ||
109 | + Object data = jsonObject.get("data"); | ||
110 | + Map map =null; | ||
111 | + if(data!=null) { | ||
112 | + String content = "[" + data.toString() + "]"; | ||
113 | + JSONArray jsonArray = JSONArray.parseArray(content); | ||
114 | + map= JSON.parseObject(jsonArray.getString(0)); | ||
115 | + } | ||
116 | + return map; | ||
117 | + } | ||
118 | + | ||
119 | + public static String jsonFormatToString(String json) { | ||
120 | + JSONObject jsonObject = JSONObject.parseObject(json); | ||
121 | + String code = jsonObject.getString("code"); | ||
122 | + String msg =jsonObject.getString("msg"); | ||
123 | + return code; | ||
124 | + } | ||
125 | + | ||
126 | + public static String getPath () { | ||
127 | + File directory = new File("."); | ||
128 | + String path = null; | ||
129 | + try { | ||
130 | + path = directory.getCanonicalPath();//获取当前路径 | ||
131 | + } catch (IOException e) { | ||
132 | + e.printStackTrace(); | ||
133 | + } | ||
134 | + return path; | ||
135 | + } | ||
136 | + // 获取每一天的字符串格式 | ||
137 | + public static String getFileName() { | ||
138 | + Date date = new Date(); | ||
139 | + SimpleDateFormat sp = new SimpleDateFormat("yyyyMMdd"); | ||
140 | + String st = sp.format(date); | ||
141 | + return st; | ||
142 | + } | ||
143 | + //将日期转化为字符串 | ||
144 | + public static String getDateTime() { | ||
145 | + Date date = new Date(); | ||
146 | + SimpleDateFormat sp = new SimpleDateFormat("yyyyMMddHHmmss"); | ||
147 | + String st = sp.format(date); | ||
148 | + return st; | ||
149 | + } | ||
150 | + | ||
151 | + // 生成二维码 | ||
152 | + public static String CreateBarCode(String carCode,String mainifist) { | ||
153 | + String json = "{\"token\":\"samples\",\"data\":{\"vehicle_no\":\""+carCode+"\",\"vehicle_no_color\":\"黄\",\"vehicle_rela_id\":\""+mainifist+"\"}}"; | ||
154 | + String content = buildBarCode.sendData(CREATEBARCODE, json); | ||
155 | + String str = null; | ||
156 | + try { | ||
157 | + Map map = buildBarCode.jsonFormat(content); | ||
158 | + str = map.get("vehicle_bar_code").toString(); | ||
159 | + }catch (Exception e) { | ||
160 | + e.printStackTrace(); | ||
161 | + } | ||
162 | + return str; | ||
163 | + } | ||
164 | + | ||
165 | + // 取消二维码 | ||
166 | + public static void cancleBarCode(String frameNo) { | ||
167 | + String json = "{\"token\":\"samples\",\"data\":{\"vehicle_no\":\""+frameNo+"\",\"vehicle_no_color\":\"黄\"}}"; | ||
168 | + buildBarCode.sendData(CANCLEBARCODE, json); | ||
169 | + } | ||
170 | + | ||
171 | + // 车辆备案 | ||
172 | + public static String crateCar(LandRoadVeRecord ve) { | ||
173 | + String json = "{\"token\":\"samples\",\"data\":{\"customs_code\":\""+ve.getMainPort()+"\",\"port_code\":\"001\"," | ||
174 | + + "\"vehicle_no\":\""+ve.getDomesticLisenceNo()+"\",\"vehicle_no_color\":\"黄\"" | ||
175 | + + ",\"vehicle_weight\":\""+ve.getSelfWt()+"\"" | ||
176 | + + ",\"vehicle_type\":\"1\",\"register_at\":\""+getDateTime()+"\"}}"; | ||
177 | + String content = buildBarCode.sendData(CREATECAR, json); | ||
178 | + String code = jsonFormatToString(content); | ||
179 | + return code; | ||
180 | + } | ||
181 | + | ||
182 | + // 取消车辆备案 | ||
183 | + public static void cancleCar(LandRoadVeRecord ve) { | ||
184 | + String json = "{\"token\":\"samples\",\"data\":{\"customs_code\":\""+ve.getMainPort()+"\",\"port_code\":\"001\"," | ||
185 | + + "\"vehicle_no\":\""+ve.getDomesticLisenceNo()+"\",\"vehicle_no_color\":\"黄\"}}"; | ||
186 | + buildBarCode.sendData(CANCLECAR, json); | ||
187 | + } | ||
188 | +} |
1 | +/** | ||
2 | + * Copyright (c) 2005-2012 springside.org.cn | ||
3 | + */ | ||
4 | +package com.thinkgem.jeesite.common.beanvalidator; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | +import java.util.Map; | ||
8 | +import java.util.Set; | ||
9 | + | ||
10 | +import javax.validation.ConstraintViolation; | ||
11 | +import javax.validation.ConstraintViolationException; | ||
12 | +import javax.validation.Validator; | ||
13 | + | ||
14 | +import com.google.common.collect.Lists; | ||
15 | +import com.google.common.collect.Maps; | ||
16 | + | ||
17 | +/** | ||
18 | + * JSR303 Validator(Hibernate Validator)工具类. | ||
19 | + * | ||
20 | + * ConstraintViolation中包含propertyPath, message 和invalidValue等信息. | ||
21 | + * 提供了各种convert方法,适合不同的i18n需求: | ||
22 | + * 1. List<String>, String内容为message | ||
23 | + * 2. List<String>, String内容为propertyPath + separator + message | ||
24 | + * 3. Map<propertyPath, message> | ||
25 | + * | ||
26 | + * 详情见wiki: https://github.com/springside/springside4/wiki/HibernateValidator | ||
27 | + * @author calvin | ||
28 | + * @version 2013-01-15 | ||
29 | + */ | ||
30 | +public class BeanValidators { | ||
31 | + | ||
32 | + /** | ||
33 | + * 调用JSR303的validate方法, 验证失败时抛出ConstraintViolationException. | ||
34 | + */ | ||
35 | + @SuppressWarnings({ "unchecked", "rawtypes" }) | ||
36 | + public static void validateWithException(Validator validator, Object object, Class<?>... groups) | ||
37 | + throws ConstraintViolationException { | ||
38 | + Set constraintViolations = validator.validate(object, groups); | ||
39 | + if (!constraintViolations.isEmpty()) { | ||
40 | + throw new ConstraintViolationException(constraintViolations); | ||
41 | + } | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * 辅助方法, 转换ConstraintViolationException中的Set<ConstraintViolations>中为List<message>. | ||
46 | + */ | ||
47 | + public static List<String> extractMessage(ConstraintViolationException e) { | ||
48 | + return extractMessage(e.getConstraintViolations()); | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * 辅助方法, 转换Set<ConstraintViolation>为List<message> | ||
53 | + */ | ||
54 | + @SuppressWarnings("rawtypes") | ||
55 | + public static List<String> extractMessage(Set<? extends ConstraintViolation> constraintViolations) { | ||
56 | + List<String> errorMessages = Lists.newArrayList(); | ||
57 | + for (ConstraintViolation violation : constraintViolations) { | ||
58 | + errorMessages.add(violation.getMessage()); | ||
59 | + } | ||
60 | + return errorMessages; | ||
61 | + } | ||
62 | + | ||
63 | + /** | ||
64 | + * 辅助方法, 转换ConstraintViolationException中的Set<ConstraintViolations>为Map<property, message>. | ||
65 | + */ | ||
66 | + public static Map<String, String> extractPropertyAndMessage(ConstraintViolationException e) { | ||
67 | + return extractPropertyAndMessage(e.getConstraintViolations()); | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * 辅助方法, 转换Set<ConstraintViolation>为Map<property, message>. | ||
72 | + */ | ||
73 | + @SuppressWarnings("rawtypes") | ||
74 | + public static Map<String, String> extractPropertyAndMessage(Set<? extends ConstraintViolation> constraintViolations) { | ||
75 | + Map<String, String> errorMessages = Maps.newHashMap(); | ||
76 | + for (ConstraintViolation violation : constraintViolations) { | ||
77 | + errorMessages.put(violation.getPropertyPath().toString(), violation.getMessage()); | ||
78 | + } | ||
79 | + return errorMessages; | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * 辅助方法, 转换ConstraintViolationException中的Set<ConstraintViolations>为List<propertyPath message>. | ||
84 | + */ | ||
85 | + public static List<String> extractPropertyAndMessageAsList(ConstraintViolationException e) { | ||
86 | + return extractPropertyAndMessageAsList(e.getConstraintViolations(), " "); | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * 辅助方法, 转换Set<ConstraintViolations>为List<propertyPath message>. | ||
91 | + */ | ||
92 | + @SuppressWarnings("rawtypes") | ||
93 | + public static List<String> extractPropertyAndMessageAsList(Set<? extends ConstraintViolation> constraintViolations) { | ||
94 | + return extractPropertyAndMessageAsList(constraintViolations, " "); | ||
95 | + } | ||
96 | + | ||
97 | + /** | ||
98 | + * 辅助方法, 转换ConstraintViolationException中的Set<ConstraintViolations>为List<propertyPath +separator+ message>. | ||
99 | + */ | ||
100 | + public static List<String> extractPropertyAndMessageAsList(ConstraintViolationException e, String separator) { | ||
101 | + return extractPropertyAndMessageAsList(e.getConstraintViolations(), separator); | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * 辅助方法, 转换Set<ConstraintViolation>为List<propertyPath +separator+ message>. | ||
106 | + */ | ||
107 | + @SuppressWarnings("rawtypes") | ||
108 | + public static List<String> extractPropertyAndMessageAsList(Set<? extends ConstraintViolation> constraintViolations, | ||
109 | + String separator) { | ||
110 | + List<String> errorMessages = Lists.newArrayList(); | ||
111 | + for (ConstraintViolation violation : constraintViolations) { | ||
112 | + errorMessages.add(violation.getPropertyPath() + separator + violation.getMessage()); | ||
113 | + } | ||
114 | + return errorMessages; | ||
115 | + } | ||
116 | +} |
1 | +/** | ||
2 | + * | ||
3 | + */ | ||
4 | +package com.thinkgem.jeesite.common.config; | ||
5 | + | ||
6 | +import java.io.File; | ||
7 | +import java.io.IOException; | ||
8 | +import java.util.Map; | ||
9 | + | ||
10 | +import org.springframework.core.io.DefaultResourceLoader; | ||
11 | + | ||
12 | +import com.ckfinder.connector.ServletContextFactory; | ||
13 | +import com.google.common.collect.Maps; | ||
14 | + | ||
15 | +import com.thinkgem.jeesite.common.utils.PropertiesLoader; | ||
16 | +import com.thinkgem.jeesite.common.utils.StringUtils; | ||
17 | + | ||
18 | +/** | ||
19 | + * 全局配置类 懒汉式单例类.在第一次调用的时候实例化自己 | ||
20 | + * @author ThinkGem,长春叭哥 | ||
21 | + * @version 2018年1月5日 | ||
22 | + */ | ||
23 | +public class Global { | ||
24 | + | ||
25 | + private Global() {} | ||
26 | + | ||
27 | + /** | ||
28 | + * 当前对象实例 | ||
29 | + */ | ||
30 | + private static Global global = null; | ||
31 | + | ||
32 | + /** | ||
33 | + * 静态工厂方法 获取当前对象实例 多线程安全单例模式(使用双重同步锁) | ||
34 | + */ | ||
35 | + | ||
36 | + public static synchronized Global getInstance() { | ||
37 | + | ||
38 | + if (global == null) { | ||
39 | + synchronized (Global.class) { | ||
40 | + if (global == null) | ||
41 | + global = new Global(); | ||
42 | + } | ||
43 | + } | ||
44 | + return global; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * 保存全局属性值 | ||
49 | + */ | ||
50 | + private static Map<String, String> map = Maps.newHashMap(); | ||
51 | + | ||
52 | + /** | ||
53 | + * 属性文件加载对象 | ||
54 | + */ | ||
55 | + private static PropertiesLoader loader = new PropertiesLoader("jeesite.properties"); | ||
56 | + | ||
57 | + /** | ||
58 | + * 显示/隐藏 | ||
59 | + */ | ||
60 | + public static final String SHOW = "1"; | ||
61 | + public static final String HIDE = "0"; | ||
62 | + | ||
63 | + /** | ||
64 | + * 是/否 | ||
65 | + */ | ||
66 | + public static final String YES = "1"; | ||
67 | + public static final String NO = "0"; | ||
68 | + | ||
69 | + /** | ||
70 | + * 对/错 | ||
71 | + */ | ||
72 | + public static final String TRUE = "true"; | ||
73 | + public static final String FALSE = "false"; | ||
74 | + | ||
75 | + /** | ||
76 | + * 上传文件基础虚拟路径 | ||
77 | + */ | ||
78 | + public static final String USERFILES_BASE_URL = "/userfiles/"; | ||
79 | + | ||
80 | + /** | ||
81 | + * 获取配置 | ||
82 | + * | ||
83 | + * @see ${fns:getConfig('adminPath')} | ||
84 | + */ | ||
85 | + public static String getConfig(String key) { | ||
86 | + String value = map.get(key); | ||
87 | + if (value == null) { | ||
88 | + value = loader.getProperty(key); | ||
89 | + map.put(key, value != null ? value : StringUtils.EMPTY); | ||
90 | + } | ||
91 | + return value; | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * 获取管理端根路径 | ||
96 | + */ | ||
97 | + public static String getAdminPath() { | ||
98 | + return getConfig("adminPath"); | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * 获取前端根路径 | ||
103 | + */ | ||
104 | + public static String getFrontPath() { | ||
105 | + return getConfig("frontPath"); | ||
106 | + } | ||
107 | + | ||
108 | + /** | ||
109 | + * 获取URL后缀 | ||
110 | + */ | ||
111 | + public static String getUrlSuffix() { | ||
112 | + return getConfig("urlSuffix"); | ||
113 | + } | ||
114 | + | ||
115 | + /** | ||
116 | + * 是否是演示模式,演示模式下不能修改用户、角色、密码、菜单、授权 | ||
117 | + */ | ||
118 | + public static Boolean isDemoMode() { | ||
119 | + String dm = getConfig("demoMode"); | ||
120 | + return "true".equals(dm) || "1".equals(dm); | ||
121 | + } | ||
122 | + | ||
123 | + /** | ||
124 | + * 在修改系统用户和角色时是否同步到Activiti | ||
125 | + */ | ||
126 | + public static Boolean isSynActivitiIndetity() { | ||
127 | + String dm = getConfig("activiti.isSynActivitiIndetity"); | ||
128 | + return "true".equals(dm) || "1".equals(dm); | ||
129 | + } | ||
130 | + | ||
131 | + /** | ||
132 | + * 页面获取常量 | ||
133 | + * | ||
134 | + * @see ${fns:getConst('YES')} | ||
135 | + */ | ||
136 | + public static Object getConst(String field) { | ||
137 | + try { | ||
138 | + return Global.class.getField(field).get(null); | ||
139 | + } catch (Exception e) { | ||
140 | + // 异常代表无配置,这里什么也不做 | ||
141 | + } | ||
142 | + return null; | ||
143 | + } | ||
144 | + | ||
145 | + /** | ||
146 | + * 获取上传文件的根目录 | ||
147 | + * | ||
148 | + * @return | ||
149 | + */ | ||
150 | + public static String getUserfilesBaseDir() { | ||
151 | + String dir = getConfig("userfiles.basedir"); | ||
152 | + if (StringUtils.isBlank(dir)) { | ||
153 | + try { | ||
154 | + dir = ServletContextFactory.getServletContext().getRealPath("/"); | ||
155 | + } catch (Exception e) { | ||
156 | + return ""; | ||
157 | + } | ||
158 | + } | ||
159 | + if (!dir.endsWith("/")) { | ||
160 | + dir += "/"; | ||
161 | + } | ||
162 | + // System.out.println("userfiles.basedir: " + dir); | ||
163 | + return dir; | ||
164 | + } | ||
165 | + | ||
166 | + /** | ||
167 | + * 获取工程路径 | ||
168 | + * | ||
169 | + * @return | ||
170 | + */ | ||
171 | + public static String getProjectPath() { | ||
172 | + // 如果配置了工程路径,则直接返回,否则自动获取。 | ||
173 | + String projectPath = Global.getConfig("projectPath"); | ||
174 | + if (StringUtils.isNotBlank(projectPath)) { | ||
175 | + return projectPath; | ||
176 | + } | ||
177 | + try { | ||
178 | + File file = new DefaultResourceLoader().getResource("").getFile(); | ||
179 | + if (file != null) { | ||
180 | + while (true) { | ||
181 | + File f = new File(file.getPath() + File.separator + "src" + File.separator + "main"); | ||
182 | + if (f == null || f.exists()) { | ||
183 | + break; | ||
184 | + } | ||
185 | + if (file.getParentFile() != null) { | ||
186 | + file = file.getParentFile(); | ||
187 | + } else { | ||
188 | + break; | ||
189 | + } | ||
190 | + } | ||
191 | + projectPath = file.toString(); | ||
192 | + } | ||
193 | + } catch (IOException e) { | ||
194 | + e.printStackTrace(); | ||
195 | + } | ||
196 | + return projectPath; | ||
197 | + } | ||
198 | + | ||
199 | +} |
1 | +/** | ||
2 | + * | ||
3 | + */ | ||
4 | +package com.thinkgem.jeesite.common.filter; | ||
5 | + | ||
6 | +import net.sf.ehcache.CacheManager; | ||
7 | +import net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter; | ||
8 | + | ||
9 | +import com.thinkgem.jeesite.common.utils.SpringContextHolder; | ||
10 | + | ||
11 | +/** | ||
12 | + * 页面高速缓存过滤器 | ||
13 | + * @author ThinkGem | ||
14 | + * @version 2013-8-5 | ||
15 | + */ | ||
16 | +public class PageCachingFilter extends SimplePageCachingFilter { | ||
17 | + | ||
18 | + private CacheManager cacheManager = SpringContextHolder.getBean(CacheManager.class); | ||
19 | + | ||
20 | + @Override | ||
21 | + protected CacheManager getCacheManager() { | ||
22 | + return cacheManager; | ||
23 | + } | ||
24 | + | ||
25 | +} |
1 | +package com.thinkgem.jeesite.common.kaptchaConfig; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author | ||
5 | + * @time 2019-10-22 15:02 | ||
6 | + */ | ||
7 | + | ||
8 | +import com.google.code.kaptcha.impl.DefaultKaptcha; | ||
9 | +import com.google.code.kaptcha.util.Config; | ||
10 | +import org.springframework.context.annotation.Bean; | ||
11 | +import org.springframework.context.annotation.Configuration; | ||
12 | + | ||
13 | +import java.util.Properties; | ||
14 | + | ||
15 | +/** | ||
16 | + * 生成验证码配置 | ||
17 | + * | ||
18 | + * @author hqk | ||
19 | + */ | ||
20 | +@Configuration | ||
21 | +public class KaptchaConfig { | ||
22 | + | ||
23 | + @Bean | ||
24 | + public DefaultKaptcha producer() { | ||
25 | + Properties properties = new Properties(); | ||
26 | + //图片边框 | ||
27 | + properties.put("kaptcha.border", "yes"); | ||
28 | + //字体颜色 | ||
29 | + properties.put("kaptcha.textproducer.font.color", "black"); | ||
30 | + //验证码长度 | ||
31 | + properties.put("kaptcha.textproducer.char.space", "5"); | ||
32 | + // 图片高 | ||
33 | + properties.setProperty("kaptcha.image.height", "30"); | ||
34 | + // 图片宽 | ||
35 | + properties.setProperty("kaptcha.image.width", "110"); | ||
36 | + // | ||
37 | + properties.setProperty("kaptcha.textproducer.font.size", "25"); | ||
38 | + //如果需要生成算法验证码加上一下配置 | ||
39 | + properties.put("kaptcha.textproducer.char.string", "1234567890"); | ||
40 | + // session key | ||
41 | + properties.setProperty("kaptcha.session.key", "code"); | ||
42 | + //如果需要去掉干扰线 | ||
43 | + properties.put("kaptcha.noise.impl", "com.google.code.kaptcha.impl.NoNoise"); | ||
44 | + | ||
45 | + Config config = new Config(properties); | ||
46 | + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); | ||
47 | + defaultKaptcha.setConfig(config); | ||
48 | + return defaultKaptcha; | ||
49 | + } | ||
50 | + | ||
51 | +} |
1 | +/** | ||
2 | + * Copyright (c) 2005-2012 springside.org.cn | ||
3 | + */ | ||
4 | +package com.thinkgem.jeesite.common.mapper; | ||
5 | + | ||
6 | +import java.util.Collection; | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +import org.dozer.DozerBeanMapper; | ||
10 | + | ||
11 | +import com.google.common.collect.Lists; | ||
12 | + | ||
13 | +/** | ||
14 | + * 简单封装Dozer, 实现深度转换Bean<->Bean的Mapper.实现: | ||
15 | + * | ||
16 | + * 1. 持有Mapper的单例. | ||
17 | + * 2. 返回值类型转换. | ||
18 | + * 3. 批量转换Collection中的所有对象. | ||
19 | + * 4. 区分创建新的B对象与将对象A值复制到已存在的B对象两种函数. | ||
20 | + * | ||
21 | + * @author calvin | ||
22 | + * @version 2013-01-15 | ||
23 | + */ | ||
24 | +public class BeanMapper { | ||
25 | + | ||
26 | + /** | ||
27 | + * 持有Dozer单例, 避免重复创建DozerMapper消耗资源. | ||
28 | + */ | ||
29 | + private static DozerBeanMapper dozer = new DozerBeanMapper(); | ||
30 | + | ||
31 | + /** | ||
32 | + * 基于Dozer转换对象的类型. | ||
33 | + */ | ||
34 | + public static <T> T map(Object source, Class<T> destinationClass) { | ||
35 | + return dozer.map(source, destinationClass); | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * 基于Dozer转换Collection中对象的类型. | ||
40 | + */ | ||
41 | + @SuppressWarnings("rawtypes") | ||
42 | + public static <T> List<T> mapList(Collection sourceList, Class<T> destinationClass) { | ||
43 | + List<T> destinationList = Lists.newArrayList(); | ||
44 | + for (Object sourceObject : sourceList) { | ||
45 | + T destinationObject = dozer.map(sourceObject, destinationClass); | ||
46 | + destinationList.add(destinationObject); | ||
47 | + } | ||
48 | + return destinationList; | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * 基于Dozer将对象A的值拷贝到对象B中. | ||
53 | + */ | ||
54 | + public static void copy(Object source, Object destinationObject) { | ||
55 | + dozer.map(source, destinationObject); | ||
56 | + } | ||
57 | +} |
1 | +/** | ||
2 | + * Copyright (c) 2005-2012 springside.org.cn | ||
3 | + */ | ||
4 | +package com.thinkgem.jeesite.common.mapper; | ||
5 | + | ||
6 | +import java.io.StringReader; | ||
7 | +import java.io.StringWriter; | ||
8 | +import java.util.Collection; | ||
9 | +import java.util.concurrent.ConcurrentHashMap; | ||
10 | +import java.util.concurrent.ConcurrentMap; | ||
11 | + | ||
12 | +import javax.xml.bind.JAXBContext; | ||
13 | +import javax.xml.bind.JAXBElement; | ||
14 | +import javax.xml.bind.JAXBException; | ||
15 | +import javax.xml.bind.Marshaller; | ||
16 | +import javax.xml.bind.Unmarshaller; | ||
17 | +import javax.xml.bind.annotation.XmlAnyElement; | ||
18 | +import javax.xml.namespace.QName; | ||
19 | + | ||
20 | +import org.springframework.http.converter.HttpMessageConversionException; | ||
21 | +import org.springframework.util.Assert; | ||
22 | + | ||
23 | +import com.thinkgem.jeesite.common.utils.Exceptions; | ||
24 | +import com.thinkgem.jeesite.common.utils.Reflections; | ||
25 | +import com.thinkgem.jeesite.common.utils.StringUtils; | ||
26 | + | ||
27 | +/** | ||
28 | + * 使用Jaxb2.0实现XML<->Java Object的Mapper. | ||
29 | + * | ||
30 | + * 在创建时需要设定所有需要序列化的Root对象的Class. | ||
31 | + * 特别支持Root对象是Collection的情形. | ||
32 | + * | ||
33 | + * @author calvin | ||
34 | + * @version 2013-01-15 | ||
35 | + */ | ||
36 | +@SuppressWarnings("rawtypes") | ||
37 | +public class JaxbMapper { | ||
38 | + | ||
39 | + private static ConcurrentMap<Class, JAXBContext> jaxbContexts = new ConcurrentHashMap<Class, JAXBContext>(); | ||
40 | + | ||
41 | + /** | ||
42 | + * Java Object->Xml without encoding. | ||
43 | + */ | ||
44 | + public static String toXml(Object root) { | ||
45 | + Class clazz = Reflections.getUserClass(root); | ||
46 | + return toXml(root, clazz, null); | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * Java Object->Xml with encoding. | ||
51 | + */ | ||
52 | + public static String toXml(Object root, String encoding) { | ||
53 | + Class clazz = Reflections.getUserClass(root); | ||
54 | + return toXml(root, clazz, encoding); | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
58 | + * Java Object->Xml with encoding. | ||
59 | + */ | ||
60 | + public static String toXml(Object root, Class clazz, String encoding) { | ||
61 | + try { | ||
62 | + StringWriter writer = new StringWriter(); | ||
63 | + createMarshaller(clazz, encoding).marshal(root, writer); | ||
64 | + return writer.toString(); | ||
65 | + } catch (JAXBException e) { | ||
66 | + throw Exceptions.unchecked(e); | ||
67 | + } | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * Java Collection->Xml without encoding, 特别支持Root Element是Collection的情形. | ||
72 | + */ | ||
73 | + public static String toXml(Collection<?> root, String rootName, Class clazz) { | ||
74 | + return toXml(root, rootName, clazz, null); | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * Java Collection->Xml with encoding, 特别支持Root Element是Collection的情形. | ||
79 | + */ | ||
80 | + public static String toXml(Collection<?> root, String rootName, Class clazz, String encoding) { | ||
81 | + try { | ||
82 | + CollectionWrapper wrapper = new CollectionWrapper(); | ||
83 | + wrapper.collection = root; | ||
84 | + | ||
85 | + JAXBElement<CollectionWrapper> wrapperElement = new JAXBElement<CollectionWrapper>(new QName(rootName), | ||
86 | + CollectionWrapper.class, wrapper); | ||
87 | + | ||
88 | + StringWriter writer = new StringWriter(); | ||
89 | + createMarshaller(clazz, encoding).marshal(wrapperElement, writer); | ||
90 | + | ||
91 | + return writer.toString(); | ||
92 | + } catch (JAXBException e) { | ||
93 | + throw Exceptions.unchecked(e); | ||
94 | + } | ||
95 | + } | ||
96 | + | ||
97 | + /** | ||
98 | + * Xml->Java Object. | ||
99 | + */ | ||
100 | + @SuppressWarnings("unchecked") | ||
101 | + public static <T> T fromXml(String xml, Class<T> clazz) { | ||
102 | + try { | ||
103 | + StringReader reader = new StringReader(xml); | ||
104 | + return (T) createUnmarshaller(clazz).unmarshal(reader); | ||
105 | + } catch (JAXBException e) { | ||
106 | + throw Exceptions.unchecked(e); | ||
107 | + } | ||
108 | + } | ||
109 | + | ||
110 | + /** | ||
111 | + * 创建Marshaller并设定encoding(可为null). | ||
112 | + * 线程不安全,需要每次创建或pooling。 | ||
113 | + */ | ||
114 | + public static Marshaller createMarshaller(Class clazz, String encoding) { | ||
115 | + try { | ||
116 | + JAXBContext jaxbContext = getJaxbContext(clazz); | ||
117 | + | ||
118 | + Marshaller marshaller = jaxbContext.createMarshaller(); | ||
119 | + | ||
120 | + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); | ||
121 | + | ||
122 | + if (StringUtils.isNotBlank(encoding)) { | ||
123 | + marshaller.setProperty(Marshaller.JAXB_ENCODING, encoding); | ||
124 | + } | ||
125 | + | ||
126 | + return marshaller; | ||
127 | + } catch (JAXBException e) { | ||
128 | + throw Exceptions.unchecked(e); | ||
129 | + } | ||
130 | + } | ||
131 | + | ||
132 | + /** | ||
133 | + * 创建UnMarshaller. | ||
134 | + * 线程不安全,需要每次创建或pooling。 | ||
135 | + */ | ||
136 | + public static Unmarshaller createUnmarshaller(Class clazz) { | ||
137 | + try { | ||
138 | + JAXBContext jaxbContext = getJaxbContext(clazz); | ||
139 | + return jaxbContext.createUnmarshaller(); | ||
140 | + } catch (JAXBException e) { | ||
141 | + throw Exceptions.unchecked(e); | ||
142 | + } | ||
143 | + } | ||
144 | + | ||
145 | + protected static JAXBContext getJaxbContext(Class clazz) { | ||
146 | + Assert.notNull(clazz, "'clazz' must not be null"); | ||
147 | + JAXBContext jaxbContext = jaxbContexts.get(clazz); | ||
148 | + if (jaxbContext == null) { | ||
149 | + try { | ||
150 | + jaxbContext = JAXBContext.newInstance(clazz, CollectionWrapper.class); | ||
151 | + jaxbContexts.putIfAbsent(clazz, jaxbContext); | ||
152 | + } catch (JAXBException ex) { | ||
153 | + throw new HttpMessageConversionException("Could not instantiate JAXBContext for class [" + clazz | ||
154 | + + "]: " + ex.getMessage(), ex); | ||
155 | + } | ||
156 | + } | ||
157 | + return jaxbContext; | ||
158 | + } | ||
159 | + | ||
160 | + /** | ||
161 | + * 封装Root Element 是 Collection的情况. | ||
162 | + */ | ||
163 | + public static class CollectionWrapper { | ||
164 | + | ||
165 | + @XmlAnyElement | ||
166 | + protected Collection<?> collection; | ||
167 | + } | ||
168 | + | ||
169 | +} |
1 | +/** | ||
2 | + * | ||
3 | + */ | ||
4 | +package com.thinkgem.jeesite.common.mapper; | ||
5 | + | ||
6 | +import java.io.IOException; | ||
7 | +import java.util.List; | ||
8 | +import java.util.Map; | ||
9 | +import java.util.TimeZone; | ||
10 | + | ||
11 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
12 | +import org.apache.commons.lang3.StringUtils; | ||
13 | +import org.slf4j.Logger; | ||
14 | +import org.slf4j.LoggerFactory; | ||
15 | + | ||
16 | +import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
17 | +import com.fasterxml.jackson.core.JsonGenerator; | ||
18 | +import com.fasterxml.jackson.core.JsonProcessingException; | ||
19 | +import com.fasterxml.jackson.core.JsonParser.Feature; | ||
20 | +import com.fasterxml.jackson.databind.DeserializationFeature; | ||
21 | +import com.fasterxml.jackson.databind.JavaType; | ||
22 | +import com.fasterxml.jackson.databind.JsonSerializer; | ||
23 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
24 | +import com.fasterxml.jackson.databind.SerializationFeature; | ||
25 | +import com.fasterxml.jackson.databind.SerializerProvider; | ||
26 | +import com.fasterxml.jackson.databind.module.SimpleModule; | ||
27 | +import com.fasterxml.jackson.databind.util.JSONPObject; | ||
28 | +import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; | ||
29 | +import com.google.common.collect.Lists; | ||
30 | +import com.google.common.collect.Maps; | ||
31 | + | ||
32 | +/** | ||
33 | + * 简单封装Jackson,实现JSON String<->Java Object的Mapper. | ||
34 | + * 封装不同的输出风格, 使用不同的builder函数创建实例. | ||
35 | + * @author ThinkGem | ||
36 | + * @version 2013-11-15 | ||
37 | + */ | ||
38 | +public class JsonMapper extends ObjectMapper { | ||
39 | + | ||
40 | + private static final long serialVersionUID = 1L; | ||
41 | + | ||
42 | + private static Logger logger = LoggerFactory.getLogger(JsonMapper.class); | ||
43 | + | ||
44 | + private static JsonMapper mapper; | ||
45 | + | ||
46 | + public JsonMapper() { | ||
47 | + this(Include.NON_EMPTY); | ||
48 | + } | ||
49 | + | ||
50 | + public JsonMapper(Include include) { | ||
51 | + // 设置输出时包含属性的风格 | ||
52 | + if (include != null) { | ||
53 | + this.setSerializationInclusion(include); | ||
54 | + } | ||
55 | + // 允许单引号、允许不带引号的字段名称 | ||
56 | + this.enableSimple(); | ||
57 | + // 设置输入时忽略在JSON字符串中存在但Java对象实际没有的属性 | ||
58 | + this.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); | ||
59 | + // 空值处理为空串 | ||
60 | + this.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>(){ | ||
61 | + @Override | ||
62 | + public void serialize(Object value, JsonGenerator jgen, | ||
63 | + SerializerProvider provider) throws IOException, | ||
64 | + JsonProcessingException { | ||
65 | + jgen.writeString(""); | ||
66 | + } | ||
67 | + }); | ||
68 | + // 进行HTML解码。 | ||
69 | + this.registerModule(new SimpleModule().addSerializer(String.class, new JsonSerializer<String>(){ | ||
70 | + @Override | ||
71 | + public void serialize(String value, JsonGenerator jgen, | ||
72 | + SerializerProvider provider) throws IOException, | ||
73 | + JsonProcessingException { | ||
74 | + jgen.writeString(StringEscapeUtils.unescapeHtml4(value)); | ||
75 | + } | ||
76 | + })); | ||
77 | + // 设置时区 | ||
78 | + this.setTimeZone(TimeZone.getDefault());//getTimeZone("GMT+8:00") | ||
79 | + } | ||
80 | + | ||
81 | + /** | ||
82 | + * 创建只输出非Null且非Empty(如List.isEmpty)的属性到Json字符串的Mapper,建议在外部接口中使用. | ||
83 | + */ | ||
84 | + public static JsonMapper getInstance() { | ||
85 | + if (mapper == null){ | ||
86 | + mapper = new JsonMapper().enableSimple(); | ||
87 | + } | ||
88 | + return mapper; | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * 创建只输出初始值被改变的属性到Json字符串的Mapper, 最节约的存储方式,建议在内部接口中使用。 | ||
93 | + */ | ||
94 | + public static JsonMapper nonDefaultMapper() { | ||
95 | + if (mapper == null){ | ||
96 | + mapper = new JsonMapper(Include.NON_DEFAULT); | ||
97 | + } | ||
98 | + return mapper; | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * Object可以是POJO,也可以是Collection或数组。 | ||
103 | + * 如果对象为Null, 返回"null". | ||
104 | + * 如果集合为空集合, 返回"[]". | ||
105 | + */ | ||
106 | + public String toJson(Object object) { | ||
107 | + try { | ||
108 | + return this.writeValueAsString(object); | ||
109 | + } catch (IOException e) { | ||
110 | + logger.warn("write to json string error:" + object, e); | ||
111 | + return null; | ||
112 | + } | ||
113 | + } | ||
114 | + | ||
115 | + /** | ||
116 | + * 反序列化POJO或简单Collection如List<String>. | ||
117 | + * | ||
118 | + * 如果JSON字符串为Null或"null"字符串, 返回Null. | ||
119 | + * 如果JSON字符串为"[]", 返回空集合. | ||
120 | + * | ||
121 | + * 如需反序列化复杂Collection如List<MyBean>, 请使用fromJson(String,JavaType) | ||
122 | + * @see #fromJson(String, JavaType) | ||
123 | + */ | ||
124 | + public <T> T fromJson(String jsonString, Class<T> clazz) { | ||
125 | + if (StringUtils.isEmpty(jsonString)) { | ||
126 | + return null; | ||
127 | + } | ||
128 | + try { | ||
129 | + return this.readValue(jsonString, clazz); | ||
130 | + } catch (IOException e) { | ||
131 | + logger.warn("parse json string error:" + jsonString, e); | ||
132 | + return null; | ||
133 | + } | ||
134 | + } | ||
135 | + | ||
136 | + /** | ||
137 | + * 反序列化复杂Collection如List<Bean>, 先使用函數createCollectionType构造类型,然后调用本函数. | ||
138 | + * @see #createCollectionType(Class, Class...) | ||
139 | + */ | ||
140 | + @SuppressWarnings("unchecked") | ||
141 | + public <T> T fromJson(String jsonString, JavaType javaType) { | ||
142 | + if (StringUtils.isEmpty(jsonString)) { | ||
143 | + return null; | ||
144 | + } | ||
145 | + try { | ||
146 | + return (T) this.readValue(jsonString, javaType); | ||
147 | + } catch (IOException e) { | ||
148 | + logger.warn("parse json string error:" + jsonString, e); | ||
149 | + return null; | ||
150 | + } | ||
151 | + } | ||
152 | + | ||
153 | + /** | ||
154 | + * 構造泛型的Collection Type如: | ||
155 | + * ArrayList<MyBean>, 则调用constructCollectionType(ArrayList.class,MyBean.class) | ||
156 | + * HashMap<String,MyBean>, 则调用(HashMap.class,String.class, MyBean.class) | ||
157 | + */ | ||
158 | + public JavaType createCollectionType(Class<?> collectionClass, Class<?>... elementClasses) { | ||
159 | + return this.getTypeFactory().constructParametricType(collectionClass, elementClasses); | ||
160 | + } | ||
161 | + | ||
162 | + /** | ||
163 | + * 當JSON裡只含有Bean的部分屬性時,更新一個已存在Bean,只覆蓋該部分的屬性. | ||
164 | + */ | ||
165 | + @SuppressWarnings("unchecked") | ||
166 | + public <T> T update(String jsonString, T object) { | ||
167 | + try { | ||
168 | + return (T) this.readerForUpdating(object).readValue(jsonString); | ||
169 | + } catch (JsonProcessingException e) { | ||
170 | + logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); | ||
171 | + } catch (IOException e) { | ||
172 | + logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); | ||
173 | + } | ||
174 | + return null; | ||
175 | + } | ||
176 | + | ||
177 | + /** | ||
178 | + * 輸出JSONP格式數據. | ||
179 | + */ | ||
180 | + public String toJsonP(String functionName, Object object) { | ||
181 | + return toJson(new JSONPObject(functionName, object)); | ||
182 | + } | ||
183 | + | ||
184 | + /** | ||
185 | + * 設定是否使用Enum的toString函數來讀寫Enum, | ||
186 | + * 為False時時使用Enum的name()函數來讀寫Enum, 默認為False. | ||
187 | + * 注意本函數一定要在Mapper創建後, 所有的讀寫動作之前調用. | ||
188 | + */ | ||
189 | + public JsonMapper enableEnumUseToString() { | ||
190 | + this.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); | ||
191 | + this.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); | ||
192 | + return this; | ||
193 | + } | ||
194 | + | ||
195 | + /** | ||
196 | + * 支持使用Jaxb的Annotation,使得POJO上的annotation不用与Jackson耦合。 | ||
197 | + * 默认会先查找jaxb的annotation,如果找不到再找jackson的。 | ||
198 | + */ | ||
199 | + public JsonMapper enableJaxbAnnotation() { | ||
200 | + JaxbAnnotationModule module = new JaxbAnnotationModule(); | ||
201 | + this.registerModule(module); | ||
202 | + return this; | ||
203 | + } | ||
204 | + | ||
205 | + /** | ||
206 | + * 允许单引号 | ||
207 | + * 允许不带引号的字段名称 | ||
208 | + */ | ||
209 | + public JsonMapper enableSimple() { | ||
210 | + this.configure(Feature.ALLOW_SINGLE_QUOTES, true); | ||
211 | + this.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); | ||
212 | + return this; | ||
213 | + } | ||
214 | + | ||
215 | + /** | ||
216 | + * 取出Mapper做进一步的设置或使用其他序列化API. | ||
217 | + */ | ||
218 | + public ObjectMapper getMapper() { | ||
219 | + return this; | ||
220 | + } | ||
221 | + | ||
222 | + /** | ||
223 | + * 对象转换为JSON字符串 | ||
224 | + * @param object | ||
225 | + * @return | ||
226 | + */ | ||
227 | + public static String toJsonString(Object object){ | ||
228 | + return JsonMapper.getInstance().toJson(object); | ||
229 | + } | ||
230 | + | ||
231 | + /** | ||
232 | + * JSON字符串转换为对象 | ||
233 | + * @param jsonString | ||
234 | + * @param clazz | ||
235 | + * @return | ||
236 | + */ | ||
237 | + public static Object fromJsonString(String jsonString, Class<?> clazz){ | ||
238 | + return JsonMapper.getInstance().fromJson(jsonString, clazz); | ||
239 | + } | ||
240 | + | ||
241 | + /** | ||
242 | + * 测试 | ||
243 | + */ | ||
244 | + public static void main(String[] args) { | ||
245 | + List<Map<String, Object>> list = Lists.newArrayList(); | ||
246 | + Map<String, Object> map = Maps.newHashMap(); | ||
247 | + map.put("id", 1); | ||
248 | + map.put("pId", -1); | ||
249 | + map.put("name", "根节点"); | ||
250 | + list.add(map); | ||
251 | + map = Maps.newHashMap(); | ||
252 | + map.put("id", 2); | ||
253 | + map.put("pId", 1); | ||
254 | + map.put("name", "你好"); | ||
255 | + map.put("open", true); | ||
256 | + list.add(map); | ||
257 | + String json = JsonMapper.getInstance().toJson(list); | ||
258 | + System.out.println(json); | ||
259 | + } | ||
260 | + | ||
261 | +} |
1 | +package com.thinkgem.jeesite.common.mapper.adapters; | ||
2 | + | ||
3 | +import java.util.HashMap; | ||
4 | +import java.util.Map; | ||
5 | + | ||
6 | +import javax.xml.bind.annotation.adapters.XmlAdapter; | ||
7 | + | ||
8 | +public class MapAdapter extends XmlAdapter<MapConvertor, Map<String, Object>> { | ||
9 | + | ||
10 | + @Override | ||
11 | + public MapConvertor marshal(Map<String, Object> map) throws Exception { | ||
12 | + MapConvertor convertor = new MapConvertor(); | ||
13 | + for (Map.Entry<String, Object> entry : map.entrySet()) { | ||
14 | + MapConvertor.MapEntry e = new MapConvertor.MapEntry(entry); | ||
15 | + convertor.addEntry(e); | ||
16 | + } | ||
17 | + return convertor; | ||
18 | + } | ||
19 | + | ||
20 | + @Override | ||
21 | + public Map<String, Object> unmarshal(MapConvertor map) throws Exception { | ||
22 | + Map<String, Object> result = new HashMap<String, Object>(); | ||
23 | + for (MapConvertor.MapEntry e : map.getEntries()) { | ||
24 | + result.put(e.getKey(), e.getValue()); | ||
25 | + } | ||
26 | + return result; | ||
27 | + } | ||
28 | + | ||
29 | +} | ||
30 | + |
1 | +package com.thinkgem.jeesite.common.mapper.adapters; | ||
2 | + | ||
3 | +import java.util.ArrayList; | ||
4 | +import java.util.List; | ||
5 | +import java.util.Map; | ||
6 | + | ||
7 | +import javax.xml.bind.annotation.XmlAccessType; | ||
8 | +import javax.xml.bind.annotation.XmlAccessorType; | ||
9 | +import javax.xml.bind.annotation.XmlType; | ||
10 | + | ||
11 | +@XmlType(name = "MapConvertor") | ||
12 | +@XmlAccessorType(XmlAccessType.FIELD) | ||
13 | +public class MapConvertor { | ||
14 | + | ||
15 | + private List<MapEntry> entries = new ArrayList<MapEntry>(); | ||
16 | + | ||
17 | + public void addEntry(MapEntry entry) { | ||
18 | + entries.add(entry); | ||
19 | + } | ||
20 | + | ||
21 | + public List<MapEntry> getEntries() { | ||
22 | + return entries; | ||
23 | + } | ||
24 | + | ||
25 | + public static class MapEntry { | ||
26 | + | ||
27 | + private String key; | ||
28 | + | ||
29 | + private Object value; | ||
30 | + | ||
31 | + public MapEntry() { | ||
32 | + super(); | ||
33 | + } | ||
34 | + | ||
35 | + public MapEntry(Map.Entry<String, Object> entry) { | ||
36 | + super(); | ||
37 | + this.key = entry.getKey(); | ||
38 | + this.value = entry.getValue(); | ||
39 | + } | ||
40 | + | ||
41 | + public MapEntry(String key, Object value) { | ||
42 | + super(); | ||
43 | + this.key = key; | ||
44 | + this.value = value; | ||
45 | + } | ||
46 | + | ||
47 | + public String getKey() { | ||
48 | + return key; | ||
49 | + } | ||
50 | + | ||
51 | + public void setKey(String key) { | ||
52 | + this.key = key; | ||
53 | + } | ||
54 | + | ||
55 | + public Object getValue() { | ||
56 | + return value; | ||
57 | + } | ||
58 | + | ||
59 | + public void setValue(Object value) { | ||
60 | + this.value = value; | ||
61 | + } | ||
62 | + } | ||
63 | +} |
1 | +/** | ||
2 | + * | ||
3 | + */ | ||
4 | +package com.thinkgem.jeesite.common.persistence; | ||
5 | + | ||
6 | +import java.io.Serializable; | ||
7 | + | ||
8 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
9 | +import com.thinkgem.jeesite.modules.act.entity.Act; | ||
10 | + | ||
11 | +/** | ||
12 | + * Activiti Entity类 | ||
13 | + * @author ThinkGem | ||
14 | + * @version 2013-05-28 | ||
15 | + */ | ||
16 | +public abstract class ActEntity<T> extends DataEntity<T> implements Serializable { | ||
17 | + | ||
18 | + private static final long serialVersionUID = 1L; | ||
19 | + | ||
20 | + protected Act act; // 流程任务对象 | ||
21 | + | ||
22 | + public ActEntity() { | ||
23 | + super(); | ||
24 | + } | ||
25 | + | ||
26 | + public ActEntity(String id) { | ||
27 | + super(id); | ||
28 | + } | ||
29 | + | ||
30 | + @JsonIgnore | ||
31 | + public Act getAct() { | ||
32 | + if (act == null){ | ||
33 | + act = new Act(); | ||
34 | + } | ||
35 | + return act; | ||
36 | + } | ||
37 | + | ||
38 | + public void setAct(Act act) { | ||
39 | + this.act = act; | ||
40 | + } | ||
41 | + | ||
42 | + /** | ||
43 | + * 获取流程实例ID | ||
44 | + * @return | ||
45 | + */ | ||
46 | + public String getProcInsId() { | ||
47 | + return this.getAct().getProcInsId(); | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * 设置流程实例ID | ||
52 | + * @param procInsId | ||
53 | + */ | ||
54 | + public void setProcInsId(String procInsId) { | ||
55 | + this.getAct().setProcInsId(procInsId); | ||
56 | + } | ||
57 | +} |
-
请 注册 或 登录 后发表评论