Commit 9f0199adfba1281c387619bc3740943a2cf862d2
Merge remote-tracking branch 'origin/develop' into develop
Showing
48 changed files
with
3376 additions
and
1037 deletions
Too many changes to show.
To preserve performance only 40 of 48 files are displayed.
.idea/encodings.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <project version="4"> |
3 | - <component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="UTF-8"> | |
3 | + <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8"> | |
4 | 4 | <file url="file://$PROJECT_DIR$" charset="UTF-8" /> |
5 | + <file url="file://$PROJECT_DIR$/src/main/resources/application.yml" charset="UTF-8" /> | |
5 | 6 | <file url="PROJECT" charset="UTF-8" /> |
6 | 7 | </component> |
7 | 8 | </project> |
8 | 9 | \ No newline at end of file |
... | ... |
.idea/workspace.xml
... | ... | @@ -2,15 +2,21 @@ |
2 | 2 | <project version="4"> |
3 | 3 | <component name="ChangeListManager"> |
4 | 4 | <list default="true" id="9ff7b25e-dc1a-4859-8a0c-00039489e359" name="Default Changelist" comment=""> |
5 | - <change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" /> | |
5 | + <change afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/receiptType/controller/receiptTypeController.java" afterDir="false" /> | |
6 | + <change afterPath="$PROJECT_DIR$/src/main/resources/mybatis/general/BomDetailMapper.xml" afterDir="false" /> | |
7 | + <change afterPath="$PROJECT_DIR$/src/main/resources/templates/config/receiptType/add.html" afterDir="false" /> | |
8 | + <change afterPath="$PROJECT_DIR$/src/main/resources/templates/config/receiptType/edit.html" afterDir="false" /> | |
9 | + <change afterPath="$PROJECT_DIR$/src/main/resources/templates/config/receiptType/receiptType.html" afterDir="false" /> | |
6 | 10 | <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> |
7 | - <change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" /> | |
8 | - <change beforePath="$PROJECT_DIR$/src/main/resources/static/img/qr_code.png" beforeDir="false" /> | |
9 | - <change beforePath="$PROJECT_DIR$/src/main/resources/templates/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/index.html" afterDir="false" /> | |
10 | - <change beforePath="$PROJECT_DIR$/src/main/resources/templates/login.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/login.html" afterDir="false" /> | |
11 | - <change beforePath="$PROJECT_DIR$/src/test/java/com.huaheng.test/CreateCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/com.huaheng.test/CreateCode.java" afterDir="false" /> | |
11 | + <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptType/domain/ReceiptType.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/receiptType/domain/ReceiptType.java" afterDir="false" /> | |
12 | + <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptType/mapper/ReceiptTypeMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/receiptType/mapper/ReceiptTypeMapper.java" afterDir="false" /> | |
13 | + <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptType/service/ReceiptTypeService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeService.java" afterDir="false" /> | |
14 | + <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptType/service/ReceiptTypeServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeServiceImpl.java" afterDir="false" /> | |
15 | + <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/shipment/shipmentDetail/domain/ShipmentDetail.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/shipment/shipmentDetail/domain/ShipmentDetail.java" afterDir="false" /> | |
16 | + <change beforePath="$PROJECT_DIR$/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.yml" afterDir="false" /> | |
17 | + <change beforePath="$PROJECT_DIR$/src/main/resources/mybatis/receipt/ReceiptTypeMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mybatis/config/ReceiptTypeMapper.xml" afterDir="false" /> | |
18 | + <change beforePath="$PROJECT_DIR$/src/main/resources/templates/tool/import/import.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/tool/import/import.html" afterDir="false" /> | |
12 | 19 | </list> |
13 | - <ignored path="$PROJECT_DIR$/target/" /> | |
14 | 20 | <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> |
15 | 21 | <option name="SHOW_DIALOG" value="false" /> |
16 | 22 | <option name="HIGHLIGHT_CONFLICTS" value="true" /> |
... | ... | @@ -28,36 +34,32 @@ |
28 | 34 | <option name="HIDDEN_KINDS"> |
29 | 35 | <set /> |
30 | 36 | </option> |
31 | - <expand /> | |
37 | + <expand> | |
38 | + <path> | |
39 | + <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" /> | |
40 | + <item name="@172.16.29.45" type="feb32156:DbDataSourceImpl" /> | |
41 | + </path> | |
42 | + <path> | |
43 | + <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" /> | |
44 | + <item name="@172.16.29.45" type="feb32156:DbDataSourceImpl" /> | |
45 | + <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" /> | |
46 | + </path> | |
47 | + <path> | |
48 | + <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" /> | |
49 | + <item name="@172.16.29.45" type="feb32156:DbDataSourceImpl" /> | |
50 | + <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" /> | |
51 | + <item name="wms_v2: schema" type="76f4a085:MysqlImplModel$Schema" /> | |
52 | + </path> | |
53 | + </expand> | |
32 | 54 | <select /> |
33 | 55 | </component> |
34 | - <component name="FileEditorManager"> | |
35 | - <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> | |
36 | - <file pinned="false" current-in-tab="false"> | |
37 | - <entry file="file://$PROJECT_DIR$/pom.xml"> | |
38 | - <provider selected="true" editor-type-id="text-editor"> | |
39 | - <state relative-caret-position="248"> | |
40 | - <caret line="16" column="40" selection-start-line="16" selection-start-column="40" selection-end-line="16" selection-end-column="40" /> | |
41 | - </state> | |
42 | - </provider> | |
43 | - <provider editor-type-id="MavenHelperPluginDependencyAnalyzer" /> | |
44 | - </entry> | |
45 | - </file> | |
46 | - <file pinned="false" current-in-tab="true"> | |
47 | - <entry file="file://$PROJECT_DIR$/src/main/resources/templates/login.html"> | |
48 | - <provider selected="true" editor-type-id="text-editor"> | |
49 | - <state relative-caret-position="289"> | |
50 | - <caret line="40" column="24" selection-start-line="40" selection-start-column="24" selection-end-line="40" selection-end-column="24" /> | |
51 | - </state> | |
52 | - </provider> | |
53 | - </entry> | |
54 | - </file> | |
55 | - </leaf> | |
56 | - </component> | |
57 | 56 | <component name="FileTemplateManagerImpl"> |
58 | 57 | <option name="RECENT_TEMPLATES"> |
59 | 58 | <list> |
59 | + <option value="FxmlFile" /> | |
60 | + <option value="Interface" /> | |
60 | 61 | <option value="Class" /> |
62 | + <option value="HTML File" /> | |
61 | 63 | </list> |
62 | 64 | </option> |
63 | 65 | </component> |
... | ... | @@ -69,21 +71,6 @@ |
69 | 71 | </map> |
70 | 72 | </option> |
71 | 73 | </component> |
72 | - <component name="IdeDocumentHistory"> | |
73 | - <option name="CHANGED_PATHS"> | |
74 | - <list> | |
75 | - <option value="$PROJECT_DIR$/src/main/resources/application.properties" /> | |
76 | - <option value="$PROJECT_DIR$/src/main/java/com/huaheng/pc/system/user/controller/IndexController.java" /> | |
77 | - <option value="$PROJECT_DIR$/src/main/java/com/huaheng/HuaHengApplication.java" /> | |
78 | - <option value="$PROJECT_DIR$/src/main/resources/templates/system/dict/data/data.html" /> | |
79 | - <option value="$PROJECT_DIR$/src/main/resources/application-druid.properties" /> | |
80 | - <option value="$PROJECT_DIR$/src/test/java/com.huaheng.test/CreateCode.java" /> | |
81 | - <option value="$PROJECT_DIR$/pom.xml" /> | |
82 | - <option value="$PROJECT_DIR$/src/main/resources/templates/index.html" /> | |
83 | - <option value="$PROJECT_DIR$/src/main/resources/templates/login.html" /> | |
84 | - </list> | |
85 | - </option> | |
86 | - </component> | |
87 | 74 | <component name="IgnoredFileRootStore"> |
88 | 75 | <option name="generatedRoots"> |
89 | 76 | <set> |
... | ... | @@ -91,201 +78,14 @@ |
91 | 78 | </set> |
92 | 79 | </option> |
93 | 80 | </component> |
94 | - <component name="MavenImportPreferences"> | |
95 | - <option name="importingSettings"> | |
96 | - <MavenImportingSettings> | |
97 | - <option name="importAutomatically" value="true" /> | |
98 | - </MavenImportingSettings> | |
99 | - </option> | |
100 | - </component> | |
101 | - <component name="MavenProjectNavigator"> | |
102 | - <treeState> | |
103 | - <expand> | |
104 | - <path> | |
105 | - <item name="" type="16c1761:MavenProjectsStructure$RootNode" /> | |
106 | - <item name="huaheng" type="9519ce18:MavenProjectsStructure$ProjectNode" /> | |
107 | - </path> | |
108 | - <path> | |
109 | - <item name="" type="16c1761:MavenProjectsStructure$RootNode" /> | |
110 | - <item name="huaheng" type="9519ce18:MavenProjectsStructure$ProjectNode" /> | |
111 | - <item name="Lifecycle" type="58874e2:MavenProjectsStructure$LifecycleNode" /> | |
112 | - </path> | |
113 | - </expand> | |
114 | - <select /> | |
115 | - </treeState> | |
116 | - </component> | |
117 | - <component name="MavenRunner"> | |
118 | - <option name="skipTests" value="true" /> | |
119 | - </component> | |
120 | - <component name="ProjectFrameBounds" extendedState="6"> | |
121 | - <option name="x" value="-10" /> | |
122 | - <option name="y" value="-10" /> | |
123 | - <option name="width" value="1940" /> | |
124 | - <option name="height" value="1100" /> | |
125 | - </component> | |
126 | 81 | <component name="ProjectId" id="1P5Ngjh73HToCarlEZkqMxrL7pm" /> |
127 | 82 | <component name="ProjectLevelVcsManager"> |
128 | 83 | <ConfirmationsSetting value="2" id="Add" /> |
129 | 84 | </component> |
130 | - <component name="ProjectView"> | |
131 | - <navigator proportions="" version="1"> | |
132 | - <foldersAlwaysOnTop value="true" /> | |
133 | - </navigator> | |
134 | - <panes> | |
135 | - <pane id="Scope" /> | |
136 | - <pane id="ProjectPane"> | |
137 | - <subPane> | |
138 | - <expand> | |
139 | - <path> | |
140 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
141 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
142 | - </path> | |
143 | - <path> | |
144 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
145 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
146 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
147 | - </path> | |
148 | - <path> | |
149 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
150 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
151 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
152 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
153 | - </path> | |
154 | - <path> | |
155 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
156 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
157 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
158 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
159 | - <item name="java" type="462c0819:PsiDirectoryNode" /> | |
160 | - </path> | |
161 | - <path> | |
162 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
163 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
164 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
165 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
166 | - <item name="java" type="462c0819:PsiDirectoryNode" /> | |
167 | - <item name="com" type="462c0819:PsiDirectoryNode" /> | |
168 | - </path> | |
169 | - <path> | |
170 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
171 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
172 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
173 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
174 | - <item name="java" type="462c0819:PsiDirectoryNode" /> | |
175 | - <item name="com" type="462c0819:PsiDirectoryNode" /> | |
176 | - <item name="huaheng" type="462c0819:PsiDirectoryNode" /> | |
177 | - </path> | |
178 | - <path> | |
179 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
180 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
181 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
182 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
183 | - <item name="java" type="462c0819:PsiDirectoryNode" /> | |
184 | - <item name="com" type="462c0819:PsiDirectoryNode" /> | |
185 | - <item name="huaheng" type="462c0819:PsiDirectoryNode" /> | |
186 | - <item name="pc" type="462c0819:PsiDirectoryNode" /> | |
187 | - </path> | |
188 | - <path> | |
189 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
190 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
191 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
192 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
193 | - <item name="java" type="462c0819:PsiDirectoryNode" /> | |
194 | - <item name="com" type="462c0819:PsiDirectoryNode" /> | |
195 | - <item name="huaheng" type="462c0819:PsiDirectoryNode" /> | |
196 | - <item name="pc" type="462c0819:PsiDirectoryNode" /> | |
197 | - <item name="inventory" type="462c0819:PsiDirectoryNode" /> | |
198 | - </path> | |
199 | - <path> | |
200 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
201 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
202 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
203 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
204 | - <item name="java" type="462c0819:PsiDirectoryNode" /> | |
205 | - <item name="com" type="462c0819:PsiDirectoryNode" /> | |
206 | - <item name="huaheng" type="462c0819:PsiDirectoryNode" /> | |
207 | - <item name="pc" type="462c0819:PsiDirectoryNode" /> | |
208 | - <item name="inventory" type="462c0819:PsiDirectoryNode" /> | |
209 | - <item name="inventoryDetail" type="462c0819:PsiDirectoryNode" /> | |
210 | - </path> | |
211 | - <path> | |
212 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
213 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
214 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
215 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
216 | - <item name="java" type="462c0819:PsiDirectoryNode" /> | |
217 | - <item name="com" type="462c0819:PsiDirectoryNode" /> | |
218 | - <item name="huaheng" type="462c0819:PsiDirectoryNode" /> | |
219 | - <item name="pc" type="462c0819:PsiDirectoryNode" /> | |
220 | - <item name="inventory" type="462c0819:PsiDirectoryNode" /> | |
221 | - <item name="inventoryHeader" type="462c0819:PsiDirectoryNode" /> | |
222 | - </path> | |
223 | - <path> | |
224 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
225 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
226 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
227 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
228 | - <item name="java" type="462c0819:PsiDirectoryNode" /> | |
229 | - <item name="com" type="462c0819:PsiDirectoryNode" /> | |
230 | - <item name="huaheng" type="462c0819:PsiDirectoryNode" /> | |
231 | - <item name="pc" type="462c0819:PsiDirectoryNode" /> | |
232 | - <item name="inventory" type="462c0819:PsiDirectoryNode" /> | |
233 | - <item name="inventoryTransaction" type="462c0819:PsiDirectoryNode" /> | |
234 | - </path> | |
235 | - <path> | |
236 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
237 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
238 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
239 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
240 | - <item name="resources" type="462c0819:PsiDirectoryNode" /> | |
241 | - </path> | |
242 | - <path> | |
243 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
244 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
245 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
246 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
247 | - <item name="resources" type="462c0819:PsiDirectoryNode" /> | |
248 | - <item name="static" type="462c0819:PsiDirectoryNode" /> | |
249 | - </path> | |
250 | - <path> | |
251 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
252 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
253 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
254 | - <item name="main" type="462c0819:PsiDirectoryNode" /> | |
255 | - <item name="resources" type="462c0819:PsiDirectoryNode" /> | |
256 | - <item name="templates" type="462c0819:PsiDirectoryNode" /> | |
257 | - </path> | |
258 | - <path> | |
259 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
260 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
261 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
262 | - <item name="test" type="462c0819:PsiDirectoryNode" /> | |
263 | - </path> | |
264 | - <path> | |
265 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
266 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
267 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
268 | - <item name="test" type="462c0819:PsiDirectoryNode" /> | |
269 | - <item name="java" type="462c0819:PsiDirectoryNode" /> | |
270 | - </path> | |
271 | - <path> | |
272 | - <item name="wms2" type="b2602c69:ProjectViewProjectNode" /> | |
273 | - <item name="wms2" type="462c0819:PsiDirectoryNode" /> | |
274 | - <item name="src" type="462c0819:PsiDirectoryNode" /> | |
275 | - <item name="test" type="462c0819:PsiDirectoryNode" /> | |
276 | - <item name="java" type="462c0819:PsiDirectoryNode" /> | |
277 | - <item name="com.huaheng.test" type="462c0819:PsiDirectoryNode" /> | |
278 | - </path> | |
279 | - </expand> | |
280 | - <select /> | |
281 | - </subPane> | |
282 | - </pane> | |
283 | - <pane id="PackagesPane" /> | |
284 | - </panes> | |
285 | - </component> | |
286 | 85 | <component name="PropertiesComponent"> |
287 | 86 | <property name="ASKED_ADD_EXTERNAL_FILES" value="true" /> |
288 | 87 | <property name="DatabaseDriversLRU" value="mysql" /> |
88 | + <property name="DefaultHtmlFileTemplate" value="HTML File" /> | |
289 | 89 | <property name="ExpandSpringBootJavaOptionsPanel" value="true" /> |
290 | 90 | <property name="RequestMappingsPanelOrder0" value="0" /> |
291 | 91 | <property name="RequestMappingsPanelOrder1" value="1" /> |
... | ... | @@ -294,22 +94,39 @@ |
294 | 94 | <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> |
295 | 95 | <property name="WebServerToolWindowFactoryState" value="false" /> |
296 | 96 | <property name="aspect.path.notification.shown" value="true" /> |
297 | - <property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/resources/mybatis" /> | |
97 | + <property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/resources/mybatis/config" /> | |
298 | 98 | <property name="node.js.detected.package.eslint" value="true" /> |
299 | 99 | <property name="node.js.detected.package.tslint" value="true" /> |
300 | 100 | <property name="node.js.path.for.package.eslint" value="project" /> |
301 | 101 | <property name="node.js.path.for.package.tslint" value="project" /> |
302 | 102 | <property name="node.js.selected.package.eslint" value="(autodetect)" /> |
303 | 103 | <property name="node.js.selected.package.tslint" value="(autodetect)" /> |
304 | - <property name="settings.editor.selected.configurable" value="preferences.pluginManager" /> | |
104 | + <property name="nodejs_package_manager_path" value="npm" /> | |
105 | + <property name="project.structure.last.edited" value="Project" /> | |
106 | + <property name="project.structure.proportion" value="0.0" /> | |
107 | + <property name="project.structure.side.proportion" value="0.0" /> | |
108 | + <property name="settings.editor.selected.configurable" value="File.Encoding" /> | |
305 | 109 | </component> |
306 | 110 | <component name="RecentsManager"> |
307 | 111 | <key name="MoveFile.RECENT_KEYS"> |
112 | + <recent name="E:\code\wms2\src\main\resources\templates\general\carrier" /> | |
308 | 113 | <recent name="E:\code\wms2\src\main\resources\mybatis\general" /> |
309 | 114 | <recent name="E:\code\wms2\src\main\resources\mybatis\config" /> |
310 | 115 | </key> |
116 | + <key name="CopyFile.RECENT_KEYS"> | |
117 | + <recent name="E:\code\wms2\src\main\resources\mybatis\config" /> | |
118 | + <recent name="E:\code\wms2\src\main\java\com\huaheng\pc\config" /> | |
119 | + <recent name="E:\code\wms2\src\main\resources\static\ajax\libs\layui\lay\modules" /> | |
120 | + <recent name="E:\code\wms2\target\classes\static\file" /> | |
121 | + <recent name="E:\code\wms2\src\main\resources\static\file" /> | |
122 | + </key> | |
311 | 123 | </component> |
312 | 124 | <component name="RunDashboard"> |
125 | + <option name="configurationTypes"> | |
126 | + <set> | |
127 | + <option value="SpringBootApplicationConfigurationType" /> | |
128 | + </set> | |
129 | + </option> | |
313 | 130 | <option name="ruleStates"> |
314 | 131 | <list> |
315 | 132 | <RuleState> |
... | ... | @@ -323,10 +140,9 @@ |
323 | 140 | </component> |
324 | 141 | <component name="RunManager"> |
325 | 142 | <configuration name="HuaHengApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> |
326 | - <module name="wms2" /> | |
143 | + <module name="huaheng" /> | |
327 | 144 | <option name="SPRING_BOOT_MAIN_CLASS" value="com.huaheng.HuaHengApplication" /> |
328 | - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" /> | |
329 | - <option name="ALTERNATIVE_JRE_PATH" value="C:\Program Files\Java\jdk1.8.0_202\jre" /> | |
145 | + <option name="ALTERNATIVE_JRE_PATH" /> | |
330 | 146 | <option name="UPDATE_ACTION_UPDATE_POLICY" value="UpdateClassesAndResources" /> |
331 | 147 | <option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" /> |
332 | 148 | <method v="2"> |
... | ... | @@ -345,8 +161,18 @@ |
345 | 161 | <component name="ServiceViewManager"> |
346 | 162 | <option name="allServicesViewState"> |
347 | 163 | <serviceView> |
164 | + <option name="contentProportion" value="0.18875067" /> | |
348 | 165 | <treeState> |
349 | - <expand /> | |
166 | + <expand> | |
167 | + <path> | |
168 | + <item name="services root" type="e789fda9:ObjectUtils$Sentinel" /> | |
169 | + <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@5ef312b7" type="7427dc5b:ServiceModel$ServiceGroupNode" /> | |
170 | + </path> | |
171 | + <path> | |
172 | + <item name="services root" type="e789fda9:ObjectUtils$Sentinel" /> | |
173 | + <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@28150ae" type="7427dc5b:ServiceModel$ServiceGroupNode" /> | |
174 | + </path> | |
175 | + </expand> | |
350 | 176 | <select /> |
351 | 177 | </treeState> |
352 | 178 | </serviceView> |
... | ... | @@ -369,7 +195,22 @@ |
369 | 195 | <workItem from="1565311988064" duration="7176000" /> |
370 | 196 | <workItem from="1565328536669" duration="797000" /> |
371 | 197 | <workItem from="1565345715376" duration="452000" /> |
372 | - <workItem from="1565570424829" duration="697000" /> | |
198 | + <workItem from="1565570424829" duration="11663000" /> | |
199 | + <workItem from="1565587737758" duration="12961000" /> | |
200 | + <workItem from="1565657307503" duration="115000" /> | |
201 | + <workItem from="1565657439247" duration="2447000" /> | |
202 | + <workItem from="1565662229227" duration="20296000" /> | |
203 | + <workItem from="1565691345079" duration="6000" /> | |
204 | + <workItem from="1565743087352" duration="10121000" /> | |
205 | + <workItem from="1565760941070" duration="6738000" /> | |
206 | + <workItem from="1565768341327" duration="2970000" /> | |
207 | + <workItem from="1565771864886" duration="599000" /> | |
208 | + <workItem from="1565772469694" duration="23000" /> | |
209 | + <workItem from="1565772518459" duration="4348000" /> | |
210 | + <workItem from="1565829438280" duration="3502000" /> | |
211 | + <workItem from="1565832950552" duration="86000" /> | |
212 | + <workItem from="1565833039573" duration="288000" /> | |
213 | + <workItem from="1565833342181" duration="13946000" /> | |
373 | 214 | </task> |
374 | 215 | <task id="LOCAL-00001" summary="添加库位、库位类型增删改查接口"> |
375 | 216 | <created>1565226427512</created> |
... | ... | @@ -399,49 +240,72 @@ |
399 | 240 | <option name="project" value="LOCAL" /> |
400 | 241 | <updated>1565342188814</updated> |
401 | 242 | </task> |
402 | - <option name="localTasksCounter" value="5" /> | |
243 | + <task id="LOCAL-00005" summary="添加userWarehouse"> | |
244 | + <created>1565571202923</created> | |
245 | + <option name="number" value="00005" /> | |
246 | + <option name="presentableId" value="LOCAL-00005" /> | |
247 | + <option name="project" value="LOCAL" /> | |
248 | + <updated>1565571202923</updated> | |
249 | + </task> | |
250 | + <task id="LOCAL-00006" summary="添加containerCapacity"> | |
251 | + <created>1565578920011</created> | |
252 | + <option name="number" value="00006" /> | |
253 | + <option name="presentableId" value="LOCAL-00006" /> | |
254 | + <option name="project" value="LOCAL" /> | |
255 | + <updated>1565578920011</updated> | |
256 | + </task> | |
257 | + <task id="LOCAL-00007" summary="添加物料页面"> | |
258 | + <created>1565593159103</created> | |
259 | + <option name="number" value="00007" /> | |
260 | + <option name="presentableId" value="LOCAL-00007" /> | |
261 | + <option name="project" value="LOCAL" /> | |
262 | + <updated>1565593159103</updated> | |
263 | + </task> | |
264 | + <task id="LOCAL-00008" summary="添加商品详情"> | |
265 | + <created>1565598117104</created> | |
266 | + <option name="number" value="00008" /> | |
267 | + <option name="presentableId" value="LOCAL-00008" /> | |
268 | + <option name="project" value="LOCAL" /> | |
269 | + <updated>1565598117104</updated> | |
270 | + </task> | |
271 | + <task id="LOCAL-00009" summary="添加物料时判断单位是否存在,不存在则添加物料单位"> | |
272 | + <created>1565659672152</created> | |
273 | + <option name="number" value="00009" /> | |
274 | + <option name="presentableId" value="LOCAL-00009" /> | |
275 | + <option name="project" value="LOCAL" /> | |
276 | + <updated>1565659672152</updated> | |
277 | + </task> | |
278 | + <task id="LOCAL-00010" summary="添加task实体类"> | |
279 | + <created>1565665525508</created> | |
280 | + <option name="number" value="00010" /> | |
281 | + <option name="presentableId" value="LOCAL-00010" /> | |
282 | + <option name="project" value="LOCAL" /> | |
283 | + <updated>1565665525508</updated> | |
284 | + </task> | |
285 | + <task id="LOCAL-00011" summary="添加商品、商品详情页面"> | |
286 | + <created>1565686619774</created> | |
287 | + <option name="number" value="00011" /> | |
288 | + <option name="presentableId" value="LOCAL-00011" /> | |
289 | + <option name="project" value="LOCAL" /> | |
290 | + <updated>1565686619774</updated> | |
291 | + </task> | |
292 | + <task id="LOCAL-00012" summary="添加承运商"> | |
293 | + <created>1565745258070</created> | |
294 | + <option name="number" value="00012" /> | |
295 | + <option name="presentableId" value="LOCAL-00012" /> | |
296 | + <option name="project" value="LOCAL" /> | |
297 | + <updated>1565745258070</updated> | |
298 | + </task> | |
299 | + <task id="LOCAL-00013" summary="添加物料导入、导出模板,添加Excel导入导出配置文件"> | |
300 | + <created>1565833218584</created> | |
301 | + <option name="number" value="00013" /> | |
302 | + <option name="presentableId" value="LOCAL-00013" /> | |
303 | + <option name="project" value="LOCAL" /> | |
304 | + <updated>1565833218584</updated> | |
305 | + </task> | |
306 | + <option name="localTasksCounter" value="14" /> | |
403 | 307 | <servers /> |
404 | 308 | </component> |
405 | - <component name="ToolWindowManager"> | |
406 | - <frame x="-7" y="-7" width="1550" height="838" extended-state="6" /> | |
407 | - <editor active="true" /> | |
408 | - <layout> | |
409 | - <window_info content_ui="combo" id="Project" order="0" sideWeight="0.4967462" visible="true" weight="0.28820375" /> | |
410 | - <window_info id="Structure" order="1" sideWeight="0.5032538" side_tool="true" weight="0.1673774" /> | |
411 | - <window_info id="Designer" order="2" /> | |
412 | - <window_info id="UI Designer" order="3" /> | |
413 | - <window_info id="Favorites" order="4" side_tool="true" /> | |
414 | - <window_info id="Capture Tool" order="5" /> | |
415 | - <window_info id="Web" order="6" side_tool="true" /> | |
416 | - <window_info id="Image Layers" order="7" /> | |
417 | - <window_info anchor="bottom" id="Message" order="0" /> | |
418 | - <window_info anchor="bottom" id="Find" order="1" /> | |
419 | - <window_info anchor="bottom" id="Run" order="2" /> | |
420 | - <window_info active="true" anchor="bottom" id="Debug" order="3" visible="true" weight="0.2407932" /> | |
421 | - <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> | |
422 | - <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> | |
423 | - <window_info anchor="bottom" id="TODO" order="6" /> | |
424 | - <window_info anchor="bottom" id="Spring" order="7" /> | |
425 | - <window_info anchor="bottom" id="Terminal" order="8" /> | |
426 | - <window_info anchor="bottom" id="Event Log" order="9" side_tool="true" /> | |
427 | - <window_info anchor="bottom" id="Java Enterprise" order="10" weight="0.3286119" /> | |
428 | - <window_info anchor="bottom" id="Database Changes" order="11" /> | |
429 | - <window_info anchor="bottom" id="Version Control" order="12" weight="0.8427762" /> | |
430 | - <window_info anchor="bottom" id="Docker" order="13" show_stripe_button="false" /> | |
431 | - <window_info anchor="bottom" id="Messages" order="14" weight="0.329718" /> | |
432 | - <window_info anchor="bottom" id="MyBatis Log" order="15" /> | |
433 | - <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> | |
434 | - <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> | |
435 | - <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> | |
436 | - <window_info anchor="right" id="Maven" order="3" weight="0.22334754" /> | |
437 | - <window_info anchor="right" id="Palette" order="4" /> | |
438 | - <window_info anchor="right" id="Capture Analysis" order="5" /> | |
439 | - <window_info anchor="right" id="Database" order="6" weight="0.32995737" /> | |
440 | - <window_info anchor="right" id="Palette	" order="7" /> | |
441 | - <window_info anchor="right" id="Theme Preview" order="8" /> | |
442 | - <window_info anchor="right" id="Bean Validation" order="9" weight="0.32995737" /> | |
443 | - </layout> | |
444 | - </component> | |
445 | 309 | <component name="TypeScriptGeneratedFilesManager"> |
446 | 310 | <option name="version" value="1" /> |
447 | 311 | </component> |
... | ... | @@ -451,20 +315,7 @@ |
451 | 315 | <entry key="MAIN"> |
452 | 316 | <value> |
453 | 317 | <State> |
454 | - <option name="RECENTLY_FILTERED_USER_GROUPS"> | |
455 | - <collection /> | |
456 | - </option> | |
457 | - <option name="RECENTLY_FILTERED_BRANCH_GROUPS"> | |
458 | - <collection /> | |
459 | - </option> | |
460 | - <option name="COLUMN_ORDER"> | |
461 | - <list> | |
462 | - <option value="0" /> | |
463 | - <option value="1" /> | |
464 | - <option value="2" /> | |
465 | - <option value="3" /> | |
466 | - </list> | |
467 | - </option> | |
318 | + <option name="COLUMN_ORDER" /> | |
468 | 319 | </State> |
469 | 320 | </value> |
470 | 321 | </entry> |
... | ... | @@ -490,168 +341,44 @@ |
490 | 341 | <MESSAGE value="添加入库、出库表实体类 添加客户、供应商增删改查接口 添加库位、容器、供应商页面" /> |
491 | 342 | <MESSAGE value="修改库区service" /> |
492 | 343 | <MESSAGE value="Merge branch 'develop' of http://172.16.29.40:8010/wms/wms2 into develop # Conflicts: #	.idea/workspace.xml" /> |
493 | - <MESSAGE value="配置文件更新修改" /> | |
494 | - <MESSAGE value="修复页面字典明细报错" /> | |
495 | - <MESSAGE value="更新json库和druid的jar包" /> | |
496 | - <option name="LAST_COMMIT_MESSAGE" value="更新json库和druid的jar包" /> | |
344 | + <MESSAGE value="添加userWarehouse" /> | |
345 | + <MESSAGE value="添加containerCapacity" /> | |
346 | + <MESSAGE value="添加物料页面" /> | |
347 | + <MESSAGE value="添加商品详情" /> | |
348 | + <MESSAGE value="添加物料时判断单位是否存在,不存在则添加物料单位" /> | |
349 | + <MESSAGE value="添加task实体类" /> | |
350 | + <MESSAGE value="添加商品、商品详情页面" /> | |
351 | + <MESSAGE value="添加承运商" /> | |
352 | + <MESSAGE value="添加物料导入、导出模板,添加Excel导入导出配置文件" /> | |
353 | + <option name="LAST_COMMIT_MESSAGE" value="添加物料导入、导出模板,添加Excel导入导出配置文件" /> | |
497 | 354 | </component> |
498 | 355 | <component name="XDebuggerManager"> |
499 | 356 | <breakpoint-manager> |
500 | 357 | <breakpoints> |
501 | 358 | <line-breakpoint enabled="true" type="java-line"> |
502 | 359 | <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/general/material/controller/MaterialController.java</url> |
503 | - <line>78</line> | |
504 | - <properties /> | |
505 | - <option name="timeStamp" value="1" /> | |
360 | + <line>198</line> | |
361 | + <option name="timeStamp" value="11" /> | |
362 | + </line-breakpoint> | |
363 | + <line-breakpoint enabled="true" type="java-line"> | |
364 | + <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/common/utils/poi/ExcelUtil.java</url> | |
365 | + <line>302</line> | |
366 | + <option name="timeStamp" value="12" /> | |
367 | + </line-breakpoint> | |
368 | + <line-breakpoint enabled="true" type="java-line"> | |
369 | + <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/general/material/controller/MaterialController.java</url> | |
370 | + <line>187</line> | |
371 | + <option name="timeStamp" value="16" /> | |
372 | + </line-breakpoint> | |
373 | + <line-breakpoint enabled="true" type="java-line"> | |
374 | + <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/general/material/service/MaterialServiceImpl.java</url> | |
375 | + <line>66</line> | |
376 | + <option name="timeStamp" value="24" /> | |
506 | 377 | </line-breakpoint> |
507 | 378 | </breakpoints> |
508 | 379 | </breakpoint-manager> |
509 | 380 | </component> |
510 | - <component name="editorHistoryManager"> | |
511 | - <entry file="file://$PROJECT_DIR$/src/main/java/com/huaheng/common/redis/RedisConfig.java" /> | |
512 | - <entry file="file://$PROJECT_DIR$/src/main/java/com/huaheng/HuaHengServletInitializer.java"> | |
513 | - <provider selected="true" editor-type-id="text-editor"> | |
514 | - <state relative-caret-position="180"> | |
515 | - <caret line="10" column="13" selection-start-line="10" selection-start-column="13" selection-end-line="10" selection-end-column="13" /> | |
516 | - </state> | |
517 | - </provider> | |
518 | - </entry> | |
519 | - <entry file="file://$PROJECT_DIR$/src/main/java/com/huaheng/common/redis/serviceimpl/RedisServiceImpl.java" /> | |
520 | - <entry file="file://$PROJECT_DIR$/src/main/resources/application.properties"> | |
521 | - <provider selected="true" editor-type-id="text-editor"> | |
522 | - <state relative-caret-position="-272"> | |
523 | - <caret line="17" column="17" selection-start-line="17" selection-start-column="17" selection-end-line="17" selection-end-column="17" /> | |
524 | - </state> | |
525 | - </provider> | |
526 | - </entry> | |
527 | - <entry file="file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/report/excelReport/service/ExcelReportService.java"> | |
528 | - <provider selected="true" editor-type-id="text-editor" /> | |
529 | - </entry> | |
530 | - <entry file="file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/system/user/domain/User.java"> | |
531 | - <provider selected="true" editor-type-id="text-editor"> | |
532 | - <state relative-caret-position="113"> | |
533 | - <caret line="147" column="39" selection-start-line="147" selection-start-column="39" selection-end-line="147" selection-end-column="39" /> | |
534 | - <folding> | |
535 | - <element signature="e#3376#3377#0" expanded="true" /> | |
536 | - <element signature="e#3415#3416#0" expanded="true" /> | |
537 | - </folding> | |
538 | - </state> | |
539 | - </provider> | |
540 | - </entry> | |
541 | - <entry file="file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/system/user/controller/IndexController.java"> | |
542 | - <provider selected="true" editor-type-id="text-editor"> | |
543 | - <state relative-caret-position="372"> | |
544 | - <caret line="311" column="16" selection-start-line="311" selection-start-column="16" selection-end-line="311" selection-end-column="16" /> | |
545 | - <folding> | |
546 | - <element signature="imports" expanded="true" /> | |
547 | - </folding> | |
548 | - </state> | |
549 | - </provider> | |
550 | - </entry> | |
551 | - <entry file="file://$PROJECT_DIR$/src/main/resources/templates/system/dict/data/data.html"> | |
552 | - <provider selected="true" editor-type-id="text-editor"> | |
553 | - <state relative-caret-position="2980"> | |
554 | - <caret line="149" column="10" selection-start-line="149" selection-start-column="10" selection-end-line="149" selection-end-column="10" /> | |
555 | - </state> | |
556 | - </provider> | |
557 | - </entry> | |
558 | - <entry file="file://$PROJECT_DIR$/src/test/java/com.huaheng.test/CreateCode.java"> | |
559 | - <provider selected="true" editor-type-id="text-editor"> | |
560 | - <state relative-caret-position="368"> | |
561 | - <caret line="1054" column="29" lean-forward="true" selection-start-line="1054" selection-start-column="29" selection-end-line="1054" selection-end-column="29" /> | |
562 | - </state> | |
563 | - </provider> | |
564 | - </entry> | |
565 | - <entry file="file://$PROJECT_DIR$/src/test/java/com.huaheng.test/EncryptPassword.java"> | |
566 | - <provider selected="true" editor-type-id="text-editor"> | |
567 | - <state relative-caret-position="240"> | |
568 | - <caret line="12" lean-forward="true" selection-start-line="12" selection-end-line="12" /> | |
569 | - </state> | |
570 | - </provider> | |
571 | - </entry> | |
572 | - <entry file="file://$PROJECT_DIR$/src/main/resources/application-druid.properties"> | |
573 | - <provider selected="true" editor-type-id="text-editor"> | |
574 | - <state relative-caret-position="160"> | |
575 | - <caret line="8" column="70" selection-start-line="8" selection-start-column="70" selection-end-line="8" selection-end-column="70" /> | |
576 | - </state> | |
577 | - </provider> | |
578 | - </entry> | |
579 | - <entry file="file://$PROJECT_DIR$/src/main/java/com/huaheng/HuaHengApplication.java"> | |
580 | - <provider selected="true" editor-type-id="text-editor"> | |
581 | - <state relative-caret-position="88"> | |
582 | - <caret line="11" column="3" selection-start-line="11" selection-start-column="3" selection-end-line="11" selection-end-column="3" /> | |
583 | - </state> | |
584 | - </provider> | |
585 | - </entry> | |
586 | - <entry file="file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/inventory/inventoryDetail/domain/InventoryDetail.java"> | |
587 | - <provider selected="true" editor-type-id="text-editor"> | |
588 | - <state relative-caret-position="120"> | |
589 | - <caret line="12" column="13" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" /> | |
590 | - </state> | |
591 | - </provider> | |
592 | - </entry> | |
593 | - <entry file="file://$PROJECT_DIR$/src/main/resources/templates/include.html"> | |
594 | - <provider selected="true" editor-type-id="text-editor" /> | |
595 | - </entry> | |
596 | - <entry file="file://$PROJECT_DIR$/src/main/resources/templates/main.html"> | |
597 | - <provider selected="true" editor-type-id="text-editor"> | |
598 | - <state relative-caret-position="-1548" /> | |
599 | - </provider> | |
600 | - </entry> | |
601 | - <entry file="file://$PROJECT_DIR$/src/main/resources/templates/index.html"> | |
602 | - <provider selected="true" editor-type-id="text-editor"> | |
603 | - <state relative-caret-position="-526"> | |
604 | - <caret line="8" column="43" selection-start-line="8" selection-start-column="43" selection-end-line="8" selection-end-column="43" /> | |
605 | - </state> | |
606 | - </provider> | |
607 | - </entry> | |
608 | - <entry file="file://$PROJECT_DIR$/src/main/resources/static/favicon.ico"> | |
609 | - <provider selected="true" editor-type-id="images" /> | |
610 | - </entry> | |
611 | - <entry file="file://$PROJECT_DIR$/src/main/resources/static/huaheng.png"> | |
612 | - <provider selected="true" editor-type-id="images" /> | |
613 | - </entry> | |
614 | - <entry file="file://$PROJECT_DIR$/src/main/resources/static/img/user.png"> | |
615 | - <provider selected="true" editor-type-id="images" /> | |
616 | - </entry> | |
617 | - <entry file="file://$PROJECT_DIR$/src/main/resources/static/img/locked.png"> | |
618 | - <provider selected="true" editor-type-id="images" /> | |
619 | - </entry> | |
620 | - <entry file="file://$PROJECT_DIR$/src/main/resources/static/img/progress.png"> | |
621 | - <provider selected="true" editor-type-id="images" /> | |
622 | - </entry> | |
623 | - <entry file="file://$PROJECT_DIR$/src/main/resources/static/img/loading.gif"> | |
624 | - <provider selected="true" editor-type-id="images" /> | |
625 | - </entry> | |
626 | - <entry file="file://$PROJECT_DIR$/src/main/resources/static/img/sprite-skin-flat.png"> | |
627 | - <provider selected="true" editor-type-id="images" /> | |
628 | - </entry> | |
629 | - <entry file="file://$PROJECT_DIR$/src/main/resources/static/img/qr_code.png"> | |
630 | - <provider selected="true" editor-type-id="images" /> | |
631 | - </entry> | |
632 | - <entry file="file://$PROJECT_DIR$/src/main/resources/static/img/profile.jpg"> | |
633 | - <provider selected="true" editor-type-id="images" /> | |
634 | - </entry> | |
635 | - <entry file="file://$PROJECT_DIR$/src/main/resources/static/img/bg.png"> | |
636 | - <provider selected="true" editor-type-id="images" /> | |
637 | - </entry> | |
638 | - <entry file="file://$PROJECT_DIR$/src/main/resources/static/img/webuploader.png"> | |
639 | - <provider selected="true" editor-type-id="images" /> | |
640 | - </entry> | |
641 | - <entry file="file://$PROJECT_DIR$/pom.xml"> | |
642 | - <provider selected="true" editor-type-id="text-editor"> | |
643 | - <state relative-caret-position="248"> | |
644 | - <caret line="16" column="40" selection-start-line="16" selection-start-column="40" selection-end-line="16" selection-end-column="40" /> | |
645 | - </state> | |
646 | - </provider> | |
647 | - <provider editor-type-id="MavenHelperPluginDependencyAnalyzer" /> | |
648 | - </entry> | |
649 | - <entry file="file://$PROJECT_DIR$/src/main/resources/templates/login.html"> | |
650 | - <provider selected="true" editor-type-id="text-editor"> | |
651 | - <state relative-caret-position="289"> | |
652 | - <caret line="40" column="24" selection-start-line="40" selection-start-column="24" selection-end-line="40" selection-end-column="24" /> | |
653 | - </state> | |
654 | - </provider> | |
655 | - </entry> | |
381 | + <component name="com.intellij.coverage.CoverageDataManagerImpl"> | |
382 | + <SUITE FILE_PATH="coverage/wmsv2$HuaHengApplication.ic" NAME="HuaHengApplication Coverage Results" MODIFIED="1565752188059" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" /> | |
656 | 383 | </component> |
657 | 384 | </project> |
658 | 385 | \ No newline at end of file |
... | ... |
pom.xml
... | ... | @@ -246,7 +246,7 @@ |
246 | 246 | <dependency> |
247 | 247 | <groupId>org.apache.poi</groupId> |
248 | 248 | <artifactId>poi-ooxml</artifactId> |
249 | - <version>3.9</version> | |
249 | + <version>3.17</version> | |
250 | 250 | </dependency> |
251 | 251 | |
252 | 252 | <!--activiti工作流--> |
... | ... | @@ -337,6 +337,12 @@ |
337 | 337 | <artifactId>mybatis-plus-annotation</artifactId> |
338 | 338 | <version>3.1.2</version> |
339 | 339 | </dependency> |
340 | + | |
341 | + <!-- yml解析器 --> | |
342 | + <dependency> | |
343 | + <groupId>org.yaml</groupId> | |
344 | + <artifactId>snakeyaml</artifactId> | |
345 | + </dependency> | |
340 | 346 | </dependencies> |
341 | 347 | |
342 | 348 | <build> |
... | ... |
src/main/java/com/huaheng/common/annotation/Excels.java
0 → 100644
1 | +package com.huaheng.common.annotation; | |
2 | + | |
3 | +import com.huaheng.framework.aspectj.lang.annotation.Excel; | |
4 | + | |
5 | +import java.lang.annotation.ElementType; | |
6 | +import java.lang.annotation.Retention; | |
7 | +import java.lang.annotation.RetentionPolicy; | |
8 | +import java.lang.annotation.Target; | |
9 | + | |
10 | +/** | |
11 | + * Excel注解集 | |
12 | + * | |
13 | + * @author ruoyi | |
14 | + */ | |
15 | +@Target(ElementType.FIELD) | |
16 | +@Retention(RetentionPolicy.RUNTIME) | |
17 | +public @interface Excels | |
18 | +{ | |
19 | + Excel[] value(); | |
20 | +} | |
... | ... |
src/main/java/com/huaheng/common/config/Global.java
0 → 100644
1 | +package com.huaheng.common.config; | |
2 | + | |
3 | +import java.io.FileNotFoundException; | |
4 | +import java.util.HashMap; | |
5 | +import java.util.Map; | |
6 | + | |
7 | +import com.huaheng.common.utils.StringUtils; | |
8 | +import org.slf4j.Logger; | |
9 | +import org.slf4j.LoggerFactory; | |
10 | + | |
11 | +import com.ruoyi.common.utils.YamlUtil; | |
12 | + | |
13 | +/** | |
14 | + * 全局配置类 | |
15 | + * | |
16 | + * @author ruoyi | |
17 | + */ | |
18 | +public class Global | |
19 | +{ | |
20 | + private static final Logger log = LoggerFactory.getLogger(Global.class); | |
21 | + | |
22 | + private static String NAME = "application.yml"; | |
23 | + | |
24 | + /** | |
25 | + * 当前对象实例 | |
26 | + */ | |
27 | + private static Global global; | |
28 | + | |
29 | + /** | |
30 | + * 保存全局属性值 | |
31 | + */ | |
32 | + private static Map<String, String> map = new HashMap<String, String>(); | |
33 | + | |
34 | + private Global() | |
35 | + { | |
36 | + } | |
37 | + | |
38 | + /** | |
39 | + * 静态工厂方法 | |
40 | + */ | |
41 | + public static synchronized Global getInstance() | |
42 | + { | |
43 | + if (global == null) | |
44 | + { | |
45 | + global = new Global(); | |
46 | + } | |
47 | + return global; | |
48 | + } | |
49 | + | |
50 | + /** | |
51 | + * 获取配置 | |
52 | + */ | |
53 | + public static String getConfig(String key) | |
54 | + { | |
55 | + String value = map.get(key); | |
56 | + if (value == null) | |
57 | + { | |
58 | + Map<?, ?> yamlMap = null; | |
59 | + try | |
60 | + { | |
61 | + yamlMap = YamlUtil.loadYaml(NAME); | |
62 | + value = String.valueOf(YamlUtil.getProperty(yamlMap, key)); | |
63 | + map.put(key, value != null ? value : StringUtils.EMPTY); | |
64 | + } | |
65 | + catch (FileNotFoundException e) | |
66 | + { | |
67 | + log.error("获取全局配置异常 {}", key); | |
68 | + } | |
69 | + } | |
70 | + return value; | |
71 | + } | |
72 | + | |
73 | + /** | |
74 | + * 获取项目名称 | |
75 | + */ | |
76 | + public static String getName() | |
77 | + { | |
78 | + return StringUtils.nvl(getConfig("huaheng.name"), "RuoYi"); | |
79 | + } | |
80 | + | |
81 | + /** | |
82 | + * 获取项目版本 | |
83 | + */ | |
84 | + public static String getVersion() | |
85 | + { | |
86 | + return StringUtils.nvl(getConfig("huaheng.version"), "4.0.0"); | |
87 | + } | |
88 | + | |
89 | + /** | |
90 | + * 获取版权年份 | |
91 | + */ | |
92 | + public static String getCopyrightYear() | |
93 | + { | |
94 | + return StringUtils.nvl(getConfig("huaheng.copyrightYear"), "2019"); | |
95 | + } | |
96 | + | |
97 | + /** | |
98 | + * 实例演示开关 | |
99 | + */ | |
100 | + public static String isDemoEnabled() | |
101 | + { | |
102 | + return StringUtils.nvl(getConfig("huaheng.demoEnabled"), "true"); | |
103 | + } | |
104 | + | |
105 | + /** | |
106 | + * 获取ip地址开关 | |
107 | + */ | |
108 | + public static Boolean isAddressEnabled() | |
109 | + { | |
110 | + return Boolean.valueOf(getConfig("huaheng.addressEnabled")); | |
111 | + } | |
112 | + | |
113 | + /** | |
114 | + * 获取文件上传路径 | |
115 | + */ | |
116 | + public static String getProfile() | |
117 | + { | |
118 | + return getConfig("huaheng.profile"); | |
119 | + } | |
120 | + | |
121 | + /** | |
122 | + * 获取头像上传路径 | |
123 | + */ | |
124 | + public static String getAvatarPath() | |
125 | + { | |
126 | + return getProfile() + "/avatar"; | |
127 | + } | |
128 | + | |
129 | + /** | |
130 | + * 获取下载路径 | |
131 | + */ | |
132 | + public static String getDownloadPath() | |
133 | + { | |
134 | + return getProfile() + "/download"; | |
135 | + } | |
136 | + | |
137 | + /** | |
138 | + * 获取上传路径 | |
139 | + */ | |
140 | + public static String getUploadPath() | |
141 | + { | |
142 | + return getProfile() + "/upload"; | |
143 | + } | |
144 | +} | |
... | ... |
src/main/java/com/huaheng/common/exception/BusinessException.java
0 → 100644
1 | +package com.huaheng.common.exception; | |
2 | + | |
3 | +/** | |
4 | + * 业务异常 | |
5 | + * | |
6 | + * @author huaheng | |
7 | + */ | |
8 | +public class BusinessException extends RuntimeException{ | |
9 | + private static final long serialVersionUID = 1L; | |
10 | + | |
11 | + protected final String message; | |
12 | + | |
13 | + public BusinessException(String message) { | |
14 | + this.message = message; | |
15 | + } | |
16 | + | |
17 | + @Override | |
18 | + public String getMessage() { | |
19 | + return message; | |
20 | + } | |
21 | +} | |
... | ... |
src/main/java/com/huaheng/common/utils/DateUtils.java
... | ... | @@ -10,7 +10,7 @@ import org.apache.commons.lang3.time.DateFormatUtils; |
10 | 10 | * |
11 | 11 | * @author huaheng |
12 | 12 | */ |
13 | -public class DateUtils | |
13 | +public class DateUtils extends org.apache.commons.lang3.time.DateUtils | |
14 | 14 | { |
15 | 15 | public static String YYYY = "yyyy"; |
16 | 16 | |
... | ... | @@ -22,6 +22,11 @@ public class DateUtils |
22 | 22 | |
23 | 23 | public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; |
24 | 24 | |
25 | + private static String[] parsePatterns = { | |
26 | + "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", | |
27 | + "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", | |
28 | + "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; | |
29 | + | |
25 | 30 | /** |
26 | 31 | * 获取当前Date型日期 |
27 | 32 | * |
... | ... | @@ -97,4 +102,23 @@ public class DateUtils |
97 | 102 | return DateFormatUtils.format(now, "yyyyMMdd"); |
98 | 103 | } |
99 | 104 | |
105 | + /** | |
106 | + * 日期型字符串转化为日期 格式 | |
107 | + */ | |
108 | + public static Date parseDate(Object str) | |
109 | + { | |
110 | + if (str == null) | |
111 | + { | |
112 | + return null; | |
113 | + } | |
114 | + try | |
115 | + { | |
116 | + return parseDate(str.toString(), parsePatterns); | |
117 | + } | |
118 | + catch (ParseException e) | |
119 | + { | |
120 | + return null; | |
121 | + } | |
122 | + } | |
123 | + | |
100 | 124 | } |
... | ... |
src/main/java/com/huaheng/common/utils/YamlUtil.java
0 → 100644
1 | +package com.ruoyi.common.utils; | |
2 | + | |
3 | +import java.io.FileNotFoundException; | |
4 | +import java.io.FileWriter; | |
5 | +import java.io.IOException; | |
6 | +import java.io.InputStream; | |
7 | +import java.util.LinkedHashMap; | |
8 | +import java.util.Map; | |
9 | +import org.yaml.snakeyaml.DumperOptions; | |
10 | +import org.yaml.snakeyaml.Yaml; | |
11 | +import com.huaheng.common.utils.StringUtils; | |
12 | + | |
13 | +/** | |
14 | + * 配置处理工具类 | |
15 | + * | |
16 | + * @author yml | |
17 | + */ | |
18 | +public class YamlUtil | |
19 | +{ | |
20 | + public static Map<?, ?> loadYaml(String fileName) throws FileNotFoundException | |
21 | + { | |
22 | + InputStream in = YamlUtil.class.getClassLoader().getResourceAsStream(fileName); | |
23 | + return StringUtils.isNotEmpty(fileName) ? (LinkedHashMap<?, ?>) new Yaml().load(in) : null; | |
24 | + } | |
25 | + | |
26 | + public static void dumpYaml(String fileName, Map<?, ?> map) throws IOException | |
27 | + { | |
28 | + if (StringUtils.isNotEmpty(fileName)) | |
29 | + { | |
30 | + FileWriter fileWriter = new FileWriter(YamlUtil.class.getResource(fileName).getFile()); | |
31 | + DumperOptions options = new DumperOptions(); | |
32 | + options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); | |
33 | + Yaml yaml = new Yaml(options); | |
34 | + yaml.dump(map, fileWriter); | |
35 | + } | |
36 | + } | |
37 | + | |
38 | + public static Object getProperty(Map<?, ?> map, Object qualifiedKey) | |
39 | + { | |
40 | + if (map != null && !map.isEmpty() && qualifiedKey != null) | |
41 | + { | |
42 | + String input = String.valueOf(qualifiedKey); | |
43 | + if (!"".equals(input)) | |
44 | + { | |
45 | + if (input.contains(".")) | |
46 | + { | |
47 | + int index = input.indexOf("."); | |
48 | + String left = input.substring(0, index); | |
49 | + String right = input.substring(index + 1, input.length()); | |
50 | + return getProperty((Map<?, ?>) map.get(left), right); | |
51 | + } | |
52 | + else if (map.containsKey(input)) | |
53 | + { | |
54 | + return map.get(input); | |
55 | + } | |
56 | + else | |
57 | + { | |
58 | + return null; | |
59 | + } | |
60 | + } | |
61 | + } | |
62 | + return null; | |
63 | + } | |
64 | + | |
65 | + @SuppressWarnings("unchecked") | |
66 | + public static void setProperty(Map<?, ?> map, Object qualifiedKey, Object value) | |
67 | + { | |
68 | + if (map != null && !map.isEmpty() && qualifiedKey != null) | |
69 | + { | |
70 | + String input = String.valueOf(qualifiedKey); | |
71 | + if (!input.equals("")) | |
72 | + { | |
73 | + if (input.contains(".")) | |
74 | + { | |
75 | + int index = input.indexOf("."); | |
76 | + String left = input.substring(0, index); | |
77 | + String right = input.substring(index + 1, input.length()); | |
78 | + setProperty((Map<?, ?>) map.get(left), right, value); | |
79 | + } | |
80 | + else | |
81 | + { | |
82 | + ((Map<Object, Object>) map).put(qualifiedKey, value); | |
83 | + } | |
84 | + } | |
85 | + } | |
86 | + } | |
87 | +} | |
0 | 88 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/common/utils/file/FileUtils.java
1 | 1 | package com.huaheng.common.utils.file; |
2 | 2 | |
3 | -import java.io.File; | |
4 | -import java.io.FileInputStream; | |
5 | -import java.io.FileNotFoundException; | |
6 | -import java.io.IOException; | |
7 | -import java.io.OutputStream; | |
3 | +import javax.servlet.http.HttpServletRequest; | |
4 | +import java.io.*; | |
5 | +import java.net.URLEncoder; | |
8 | 6 | |
9 | 7 | /** |
10 | 8 | * 文件处理工具类 |
... | ... | @@ -13,11 +11,13 @@ import java.io.OutputStream; |
13 | 11 | */ |
14 | 12 | public class FileUtils |
15 | 13 | { |
14 | + public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; | |
16 | 15 | |
17 | 16 | /** |
18 | 17 | * 输出指定文件的byte数组 |
19 | - * | |
20 | - * @param filename 文件 | |
18 | + * | |
19 | + * @param filePath 文件路径 | |
20 | + * @param os 输出流 | |
21 | 21 | * @return |
22 | 22 | */ |
23 | 23 | public static void writeBytes(String filePath, OutputStream os) throws IOException |
... | ... | @@ -88,4 +88,51 @@ public class FileUtils |
88 | 88 | return flag; |
89 | 89 | } |
90 | 90 | |
91 | + /** | |
92 | + * 文件名称验证 | |
93 | + * | |
94 | + * @param filename 文件名称 | |
95 | + * @return true 正常 false 非法 | |
96 | + */ | |
97 | + public static boolean isValidFilename(String filename) | |
98 | + { | |
99 | + return filename.matches(FILENAME_PATTERN); | |
100 | + } | |
101 | + | |
102 | + /** | |
103 | + * 下载文件名重新编码 | |
104 | + * | |
105 | + * @param request 请求对象 | |
106 | + * @param fileName 文件名 | |
107 | + * @return 编码后的文件名 | |
108 | + */ | |
109 | + public static String setFileDownloadHeader(HttpServletRequest request, String fileName) | |
110 | + throws UnsupportedEncodingException | |
111 | + { | |
112 | + final String agent = request.getHeader("USER-AGENT"); | |
113 | + String filename = fileName; | |
114 | + if (agent.contains("MSIE")) | |
115 | + { | |
116 | + // IE浏览器 | |
117 | + filename = URLEncoder.encode(filename, "utf-8"); | |
118 | + filename = filename.replace("+", " "); | |
119 | + } | |
120 | + else if (agent.contains("Firefox")) | |
121 | + { | |
122 | + // 火狐浏览器 | |
123 | + filename = new String(fileName.getBytes(), "ISO8859-1"); | |
124 | + } | |
125 | + else if (agent.contains("Chrome")) | |
126 | + { | |
127 | + // google浏览器 | |
128 | + filename = URLEncoder.encode(filename, "utf-8"); | |
129 | + } | |
130 | + else | |
131 | + { | |
132 | + // 其它浏览器 | |
133 | + filename = URLEncoder.encode(filename, "utf-8"); | |
134 | + } | |
135 | + return filename; | |
136 | + } | |
137 | + | |
91 | 138 | } |
... | ... |
src/main/java/com/huaheng/common/utils/poi/ExcelUtil.java
1 | 1 | package com.huaheng.common.utils.poi; |
2 | 2 | |
3 | -import java.io.FileNotFoundException; | |
3 | +import java.io.File; | |
4 | 4 | import java.io.FileOutputStream; |
5 | +import java.io.IOException; | |
5 | 6 | import java.io.InputStream; |
6 | 7 | import java.io.OutputStream; |
7 | 8 | import java.lang.reflect.Field; |
9 | +import java.lang.reflect.Method; | |
8 | 10 | import java.math.BigDecimal; |
9 | -import java.net.URLEncoder; | |
10 | -import java.text.SimpleDateFormat; | |
11 | -import java.util.*; | |
12 | - | |
13 | -import org.apache.poi.hssf.usermodel.DVConstraint; | |
14 | -import org.apache.poi.hssf.usermodel.HSSFCell; | |
15 | -import org.apache.poi.hssf.usermodel.HSSFCellStyle; | |
16 | -import org.apache.poi.hssf.usermodel.HSSFDataValidation; | |
17 | -import org.apache.poi.hssf.usermodel.HSSFFont; | |
18 | -import org.apache.poi.hssf.usermodel.HSSFRow; | |
19 | -import org.apache.poi.hssf.usermodel.HSSFSheet; | |
20 | -import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |
21 | -import org.apache.poi.hssf.util.HSSFColor; | |
11 | +import java.text.DecimalFormat; | |
12 | +import java.util.ArrayList; | |
13 | +import java.util.Arrays; | |
14 | +import java.util.Date; | |
15 | +import java.util.HashMap; | |
16 | +import java.util.List; | |
17 | +import java.util.Map; | |
18 | +import java.util.UUID; | |
19 | + | |
20 | +import com.huaheng.common.annotation.Excels; | |
21 | +import com.huaheng.common.config.Global; | |
22 | +import com.huaheng.common.exception.BusinessException; | |
23 | +import com.huaheng.common.support.Convert; | |
24 | +import com.huaheng.common.utils.DateUtils; | |
25 | +import com.huaheng.common.utils.StringUtils; | |
26 | +import com.huaheng.common.utils.reflect.ReflectUtils; | |
27 | +import com.huaheng.framework.aspectj.lang.annotation.Excel; | |
28 | +import com.huaheng.framework.aspectj.lang.annotation.Excel.Type; | |
29 | +import com.huaheng.framework.web.domain.AjaxResult; | |
30 | +import org.apache.poi.hssf.usermodel.HSSFDateUtil; | |
31 | +import org.apache.poi.ss.usermodel.BorderStyle; | |
22 | 32 | import org.apache.poi.ss.usermodel.Cell; |
23 | 33 | import org.apache.poi.ss.usermodel.CellStyle; |
34 | +import org.apache.poi.ss.usermodel.CellType; | |
35 | +import org.apache.poi.ss.usermodel.DataValidation; | |
36 | +import org.apache.poi.ss.usermodel.DataValidationConstraint; | |
37 | +import org.apache.poi.ss.usermodel.DataValidationHelper; | |
38 | +import org.apache.poi.ss.usermodel.DateUtil; | |
39 | +import org.apache.poi.ss.usermodel.FillPatternType; | |
40 | +import org.apache.poi.ss.usermodel.Font; | |
41 | +import org.apache.poi.ss.usermodel.HorizontalAlignment; | |
42 | +import org.apache.poi.ss.usermodel.IndexedColors; | |
24 | 43 | import org.apache.poi.ss.usermodel.Row; |
25 | 44 | import org.apache.poi.ss.usermodel.Sheet; |
45 | +import org.apache.poi.ss.usermodel.VerticalAlignment; | |
26 | 46 | import org.apache.poi.ss.usermodel.Workbook; |
27 | 47 | import org.apache.poi.ss.usermodel.WorkbookFactory; |
28 | 48 | import org.apache.poi.ss.util.CellRangeAddressList; |
49 | +import org.apache.poi.xssf.streaming.SXSSFWorkbook; | |
50 | +import org.apache.poi.xssf.usermodel.XSSFDataValidation; | |
29 | 51 | import org.slf4j.Logger; |
30 | 52 | import org.slf4j.LoggerFactory; |
31 | -import org.springframework.util.ResourceUtils; | |
32 | -import com.huaheng.common.utils.StringUtils; | |
33 | -import com.huaheng.framework.aspectj.lang.annotation.Excel; | |
34 | -import com.huaheng.framework.shiro.web.session.OnlineWebSessionManager; | |
35 | -import com.huaheng.framework.web.domain.AjaxResult; | |
36 | - | |
37 | -import javax.servlet.http.HttpServletResponse; | |
38 | 53 | |
39 | 54 | /** |
40 | 55 | * Excel相关处理 |
41 | - * | |
42 | - * @author huaheng | |
56 | + * | |
57 | + * @author ruoyi | |
43 | 58 | */ |
44 | 59 | public class ExcelUtil<T> |
45 | 60 | { |
61 | + private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class); | |
62 | + | |
63 | + /** | |
64 | + * Excel sheet最大行数,默认65536 | |
65 | + */ | |
66 | + public static final int sheetSize = 65536; | |
67 | + | |
68 | + /** | |
69 | + * 工作表名称 | |
70 | + */ | |
71 | + private String sheetName; | |
46 | 72 | |
47 | - private static final Logger log = LoggerFactory.getLogger(OnlineWebSessionManager.class); | |
73 | + /** | |
74 | + * 导出类型(EXPORT:导出数据;IMPORT:导入模板) | |
75 | + */ | |
76 | + private Type type; | |
48 | 77 | |
78 | + /** | |
79 | + * 工作薄对象 | |
80 | + */ | |
81 | + private Workbook wb; | |
82 | + | |
83 | + /** | |
84 | + * 工作表对象 | |
85 | + */ | |
86 | + private Sheet sheet; | |
87 | + | |
88 | + /** | |
89 | + * 样式列表 | |
90 | + */ | |
91 | + private Map<String, CellStyle> styles; | |
92 | + | |
93 | + /** | |
94 | + * 导入导出数据列表 | |
95 | + */ | |
96 | + private List<T> list; | |
97 | + | |
98 | + /** | |
99 | + * 注解列表 | |
100 | + */ | |
101 | + private List<Object[]> fields; | |
102 | + | |
103 | + /** | |
104 | + * 实体对象 | |
105 | + */ | |
49 | 106 | public Class<T> clazz; |
50 | 107 | |
51 | 108 | public ExcelUtil(Class<T> clazz) |
... | ... | @@ -53,29 +110,80 @@ public class ExcelUtil<T> |
53 | 110 | this.clazz = clazz; |
54 | 111 | } |
55 | 112 | |
56 | - public ExcelUtil() | |
113 | + public void init(List<T> list, String sheetName, Type type) | |
57 | 114 | { |
115 | + if (list == null) | |
116 | + { | |
117 | + list = new ArrayList<T>(); | |
118 | + } | |
119 | + this.list = list; | |
120 | + this.sheetName = sheetName; | |
121 | + this.type = type; | |
122 | + createExcelField(); | |
123 | + createWorkbook(); | |
58 | 124 | } |
59 | - public List<T> importExcel(String sheetName, InputStream input) throws Exception | |
125 | + | |
126 | + /** | |
127 | + * 对excel表单默认第一个索引名转换成list | |
128 | + * | |
129 | + * @param is 输入流 | |
130 | + * @return 转换后集合 | |
131 | + */ | |
132 | + public List<T> importExcel(InputStream is) throws Exception | |
60 | 133 | { |
61 | - List<T> list = new ArrayList<T>(); | |
134 | + return importExcel(StringUtils.EMPTY, is); | |
135 | + } | |
62 | 136 | |
63 | - Workbook workbook = WorkbookFactory.create(input); | |
64 | - Sheet sheet = workbook.getSheet(sheetName); | |
137 | + /** | |
138 | + * 对excel表单指定表格索引名转换成list | |
139 | + * | |
140 | + * @param sheetName 表格索引名 | |
141 | + * @param is 输入流 | |
142 | + * @return 转换后集合 | |
143 | + */ | |
144 | + public List<T> importExcel(String sheetName, InputStream is) throws Exception | |
145 | + { | |
146 | + this.type = Type.IMPORT; | |
147 | + this.wb = WorkbookFactory.create(is); | |
148 | + List<T> list = new ArrayList<T>(); | |
149 | + Sheet sheet = null; | |
65 | 150 | if (StringUtils.isNotEmpty(sheetName)) |
66 | 151 | { |
67 | 152 | // 如果指定sheet名,则取指定sheet中的内容. |
68 | - sheet = workbook.getSheet(sheetName); | |
153 | + sheet = wb.getSheet(sheetName); | |
69 | 154 | } |
70 | - if (sheet == null) | |
155 | + else | |
71 | 156 | { |
72 | 157 | // 如果传入的sheet名不存在则默认指向第1个sheet. |
73 | - sheet = workbook.getSheetAt(0); | |
158 | + sheet = wb.getSheetAt(0); | |
74 | 159 | } |
160 | + | |
161 | + if (sheet == null) | |
162 | + { | |
163 | + throw new IOException("文件sheet不存在"); | |
164 | + } | |
165 | + | |
75 | 166 | int rows = sheet.getPhysicalNumberOfRows(); |
76 | 167 | |
77 | 168 | if (rows > 0) |
78 | 169 | { |
170 | + // 定义一个map用于存放excel列的序号和field. | |
171 | + Map<String, Integer> cellMap = new HashMap<String, Integer>(); | |
172 | + // 获取表头 | |
173 | + Row heard = sheet.getRow(0); | |
174 | + for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) | |
175 | + { | |
176 | + Cell cell = heard.getCell(i); | |
177 | + if (StringUtils.isNotNull(cell != null)) | |
178 | + { | |
179 | + String value = this.getCellValue(heard, i).toString(); | |
180 | + cellMap.put(value, i); | |
181 | + } | |
182 | + else | |
183 | + { | |
184 | + cellMap.put(null, i); | |
185 | + } | |
186 | + } | |
79 | 187 | // 有数据时才处理 得到类的所有field. |
80 | 188 | Field[] allFields = clazz.getDeclaredFields(); |
81 | 189 | // 定义一个map用于存放列的序号和field. |
... | ... | @@ -83,461 +191,391 @@ public class ExcelUtil<T> |
83 | 191 | for (int col = 0; col < allFields.length; col++) |
84 | 192 | { |
85 | 193 | Field field = allFields[col]; |
86 | - // 将有注解的field存放到map中. | |
87 | - if (field.isAnnotationPresent(Excel.class)) | |
194 | + Excel attr = field.getAnnotation(Excel.class); | |
195 | + if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) | |
88 | 196 | { |
89 | 197 | // 设置类的私有字段属性可访问. |
90 | 198 | field.setAccessible(true); |
91 | - fieldsMap.put(col, field); | |
199 | + Integer column = cellMap.get(attr.name()); | |
200 | + fieldsMap.put(column, field); | |
92 | 201 | } |
93 | 202 | } |
94 | 203 | for (int i = 1; i < rows; i++) |
95 | 204 | { |
96 | 205 | // 从第2行开始取数据,默认第一行是表头. |
97 | 206 | Row row = sheet.getRow(i); |
98 | - int cellNum = sheet.getRow(0).getPhysicalNumberOfCells(); | |
99 | 207 | T entity = null; |
100 | - for (int j = 0; j < cellNum; j++) | |
208 | + for (Map.Entry<Integer, Field> entry : fieldsMap.entrySet()) | |
101 | 209 | { |
102 | - Cell cell = row.getCell(j); | |
103 | - if (cell == null) | |
104 | - { | |
105 | - continue; | |
106 | - } | |
107 | - else | |
108 | - { | |
109 | - // 先设置Cell的类型,然后就可以把纯数字作为String类型读进来了 | |
110 | - row.getCell(j).setCellType(Cell.CELL_TYPE_STRING); | |
111 | - cell = row.getCell(j); | |
112 | - } | |
113 | - | |
114 | - String c = cell.getStringCellValue(); | |
115 | - if (StringUtils.isEmpty(c)) | |
116 | - { | |
117 | - continue; | |
118 | - } | |
210 | + Object val = this.getCellValue(row, entry.getKey()); | |
119 | 211 | |
120 | 212 | // 如果不存在实例则新建. |
121 | 213 | entity = (entity == null ? clazz.newInstance() : entity); |
122 | 214 | // 从map中得到对应列的field. |
123 | - Field field = fieldsMap.get(j); | |
215 | + Field field = fieldsMap.get(entry.getKey()); | |
124 | 216 | // 取得类型,并根据对象类型设置值. |
125 | 217 | Class<?> fieldType = field.getType(); |
126 | 218 | if (String.class == fieldType) |
127 | 219 | { |
128 | - field.set(entity, String.valueOf(c)); | |
220 | + String s = Convert.toStr(val); | |
221 | + if (StringUtils.endsWith(s, ".0")) | |
222 | + { | |
223 | + val = StringUtils.substringBefore(s, ".0"); | |
224 | + } | |
225 | + else | |
226 | + { | |
227 | + val = Convert.toStr(val); | |
228 | + } | |
129 | 229 | } |
130 | 230 | else if ((Integer.TYPE == fieldType) || (Integer.class == fieldType)) |
131 | 231 | { |
132 | - field.set(entity, Integer.parseInt(c)); | |
232 | + val = Convert.toInt(val); | |
133 | 233 | } |
134 | - else if ((Integer.TYPE == fieldType) || (Integer.class == fieldType)) | |
234 | + else if ((Long.TYPE == fieldType) || (Long.class == fieldType)) | |
135 | 235 | { |
136 | - field.set(entity, Integer.valueOf(c)); | |
236 | + val = Convert.toLong(val); | |
137 | 237 | } |
138 | - else if ((Float.TYPE == fieldType) || (Float.class == fieldType)) | |
238 | + else if ((Double.TYPE == fieldType) || (Double.class == fieldType)) | |
139 | 239 | { |
140 | - field.set(entity, Float.valueOf(c)); | |
240 | + val = Convert.toDouble(val); | |
141 | 241 | } |
142 | - else if ((Short.TYPE == fieldType) || (Short.class == fieldType)) | |
242 | + else if ((Float.TYPE == fieldType) || (Float.class == fieldType)) | |
143 | 243 | { |
144 | - field.set(entity, Short.valueOf(c)); | |
244 | + val = Convert.toFloat(val); | |
145 | 245 | } |
146 | - else if ((Double.TYPE == fieldType) || (Double.class == fieldType)) | |
246 | + else if (BigDecimal.class == fieldType) | |
147 | 247 | { |
148 | - field.set(entity, Double.valueOf(c)); | |
248 | + val = Convert.toBigDecimal(val); | |
149 | 249 | } |
150 | - else if (Character.TYPE == fieldType) | |
250 | + else if (Date.class == fieldType) | |
151 | 251 | { |
152 | - if ((c != null) && (c.length() > 0)) | |
252 | + if (val instanceof String) | |
253 | + { | |
254 | + val = DateUtils.parseDate(val); | |
255 | + } | |
256 | + else if (val instanceof Double) | |
153 | 257 | { |
154 | - field.set(entity, Character.valueOf(c.charAt(0))); | |
258 | + val = DateUtil.getJavaDate((Double) val); | |
155 | 259 | } |
156 | 260 | } |
157 | - else if (java.util.Date.class == fieldType) | |
261 | + if (StringUtils.isNotNull(fieldType)) | |
158 | 262 | { |
159 | - if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) | |
263 | + Excel attr = field.getAnnotation(Excel.class); | |
264 | + String propertyName = field.getName(); | |
265 | + if (StringUtils.isNotEmpty(attr.targetAttr())) | |
160 | 266 | { |
161 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
162 | - cell.setCellValue(sdf.format(cell.getNumericCellValue())); | |
163 | - c = sdf.format(cell.getNumericCellValue()); | |
267 | + propertyName = field.getName() + "." + attr.targetAttr(); | |
164 | 268 | } |
165 | - else | |
269 | + else if (StringUtils.isNotEmpty(attr.readConverterExp())) | |
166 | 270 | { |
167 | - c = cell.getStringCellValue(); | |
271 | + val = reverseByExp(String.valueOf(val), attr.readConverterExp()); | |
168 | 272 | } |
273 | + ReflectUtils.invokeSetter(entity, propertyName, val); | |
169 | 274 | } |
170 | - else if (java.math.BigDecimal.class == fieldType) | |
171 | - { | |
172 | - c = cell.getStringCellValue(); | |
173 | - } | |
174 | - } | |
175 | - if (entity != null) | |
176 | - { | |
177 | - list.add(entity); | |
178 | 275 | } |
276 | + list.add(entity); | |
179 | 277 | } |
180 | 278 | } |
181 | - | |
182 | 279 | return list; |
183 | 280 | } |
184 | 281 | |
185 | 282 | /** |
186 | 283 | * 对list数据源将其里面的数据导入到excel表单 |
187 | - * | |
284 | + * | |
285 | + * @param list 导出数据集合 | |
188 | 286 | * @param sheetName 工作表的名称 |
287 | + * @return 结果 | |
189 | 288 | */ |
190 | - public AjaxResult exportExcel2(List<LinkedHashMap<String,Object>> list, String sheetName,HttpServletResponse response) | |
289 | + public AjaxResult exportExcel(List<T> list, String sheetName) | |
191 | 290 | { |
192 | - if(list==null||list.size()==0){ | |
193 | - return AjaxResult.error("无数据"); | |
194 | - } | |
291 | + this.init(list, sheetName, Type.EXPORT); | |
292 | + return exportExcel(); | |
293 | + } | |
195 | 294 | |
196 | - //表头 | |
197 | - List<String> headers = new ArrayList<>(); | |
198 | - for (Map.Entry<String, Object> entry : list.get(0).entrySet()) { | |
199 | - headers.add(entry.getKey()); | |
200 | - } | |
295 | + /** | |
296 | + * 对list数据源将其里面的数据导入到excel表单 | |
297 | + * | |
298 | + * @param sheetName 工作表的名称 | |
299 | + * @return 结果 | |
300 | + */ | |
301 | + public AjaxResult importTemplateExcel(String sheetName) | |
302 | + { | |
303 | + this.init(null, sheetName, Type.IMPORT); | |
304 | + return exportExcel(); | |
305 | + } | |
201 | 306 | |
202 | - // 产生工作薄对象 | |
203 | - HSSFWorkbook workbook = new HSSFWorkbook(); | |
204 | - // excel2003中每个sheet中最多有65536行 | |
205 | - int sheetSize = 65536; | |
206 | - // 取出一共有多少个sheet. | |
207 | - double sheetNo = Math.ceil(list.size() / sheetSize); | |
208 | - for (int index = 0; index <= sheetNo; index++) | |
307 | + /** | |
308 | + * 对list数据源将其里面的数据导入到excel表单 | |
309 | + * | |
310 | + * @return 结果 | |
311 | + */ | |
312 | + public AjaxResult exportExcel() | |
313 | + { | |
314 | + OutputStream out = null; | |
315 | + try | |
209 | 316 | { |
210 | - // 产生工作表对象 | |
211 | - HSSFSheet sheet = workbook.createSheet(); | |
212 | - if (sheetNo == 0) | |
317 | + // 取出一共有多少个sheet. | |
318 | + double sheetNo = Math.ceil(list.size() / sheetSize); | |
319 | + for (int index = 0; index <= sheetNo; index++) | |
213 | 320 | { |
214 | - workbook.setSheetName(index, sheetName); | |
321 | + createSheet(sheetNo, index); | |
322 | + | |
323 | + // 产生一行 | |
324 | + Row row = sheet.createRow(0); | |
325 | + int column = 0; | |
326 | + // 写入各个字段的列头名称 | |
327 | + for (Object[] os : fields) | |
328 | + { | |
329 | + Excel excel = (Excel) os[1]; | |
330 | + this.createCell(excel, row, column++); | |
331 | + } | |
332 | + if (Type.EXPORT.equals(type)) | |
333 | + { | |
334 | + fillExcelData(index, row); | |
335 | + } | |
215 | 336 | } |
216 | - else | |
337 | + String filename = encodingFilename(sheetName); | |
338 | + out = new FileOutputStream(getAbsoluteFile(filename)); | |
339 | + wb.write(out); | |
340 | + return AjaxResult.success(filename); | |
341 | + } | |
342 | + catch (Exception e) | |
343 | + { | |
344 | + log.error("导出Excel异常{}", e.getMessage()); | |
345 | + throw new BusinessException("导出Excel失败,请联系网站管理员!"); | |
346 | + } | |
347 | + finally | |
348 | + { | |
349 | + if (wb != null) | |
217 | 350 | { |
218 | - // 设置工作表的名称. | |
219 | - workbook.setSheetName(index, sheetName + index); | |
351 | + try | |
352 | + { | |
353 | + wb.close(); | |
354 | + } | |
355 | + catch (IOException e1) | |
356 | + { | |
357 | + e1.printStackTrace(); | |
358 | + } | |
220 | 359 | } |
221 | - HSSFRow row; | |
222 | - HSSFCell cell; // 产生单元格 | |
223 | - | |
224 | - // 产生一行 | |
225 | - row = sheet.createRow(0); | |
226 | - // 写入各个字段的列头名称 | |
227 | - for (int i = 0; i < headers.size(); i++) | |
360 | + if (out != null) | |
228 | 361 | { |
229 | - // 创建列 | |
230 | - String attr = headers.get(i); | |
231 | - cell = row.createCell(i); | |
232 | - // 设置列中写入内容为String类型 | |
233 | - cell.setCellType(HSSFCell.CELL_TYPE_STRING); | |
234 | - HSSFCellStyle cellStyle = workbook.createCellStyle(); | |
235 | - cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); | |
236 | - cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); | |
237 | - if (attr.contains("注:")) | |
362 | + try | |
238 | 363 | { |
239 | - HSSFFont font = workbook.createFont(); | |
240 | - font.setColor(HSSFFont.COLOR_RED); | |
241 | - cellStyle.setFont(font); | |
242 | - cellStyle.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index); | |
243 | - sheet.setColumnWidth(i, 6000); | |
364 | + out.close(); | |
244 | 365 | } |
245 | - else | |
366 | + catch (IOException e1) | |
246 | 367 | { |
247 | - HSSFFont font = workbook.createFont(); | |
248 | - // 粗体显示 | |
249 | - font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); | |
250 | - // 选择需要用到的字体格式 | |
251 | - cellStyle.setFont(font); | |
252 | - cellStyle.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index); | |
253 | - // 设置列宽 | |
254 | - sheet.setColumnWidth(i, 3766); | |
368 | + e1.printStackTrace(); | |
255 | 369 | } |
256 | - cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); | |
257 | - cellStyle.setWrapText(true); | |
258 | - cell.setCellStyle(cellStyle); | |
259 | - | |
260 | - // 写入列名 | |
261 | - cell.setCellValue(attr); | |
262 | - | |
263 | - // 如果设置了提示信息则鼠标放上去提示. | |
264 | -// if (StringUtils.isNotEmpty(attr.prompt())) | |
265 | -// { | |
266 | -// // 这里默认设了2-101列提示. | |
267 | -// setHSSFPrompt(sheet, "", attr.prompt(), 1, 100, i, i); | |
268 | -// } | |
269 | -// // 如果设置了combo属性则本列只能选择不能输入 | |
270 | -// if (attr.combo().length > 0) | |
271 | -// { | |
272 | -// // 这里默认设了2-101列只能选择不能输入. | |
273 | -// setHSSFValidation(sheet, attr.combo(), 1, 100, i, i); | |
274 | -// } | |
275 | 370 | } |
371 | + } | |
372 | + } | |
276 | 373 | |
277 | - int startNo = index * sheetSize; | |
278 | - int endNo = Math.min(startNo + sheetSize, list.size()); | |
279 | - // 写入各条记录,每条记录对应excel表中的一行 | |
280 | - HSSFCellStyle cs = workbook.createCellStyle(); | |
281 | - cs.setAlignment(HSSFCellStyle.ALIGN_CENTER); | |
282 | - cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER); | |
283 | - for (int i = startNo; i < endNo; i++) | |
374 | + /** | |
375 | + * 填充excel数据 | |
376 | + * | |
377 | + * @param index 序号 | |
378 | + * @param row 单元格行 | |
379 | + * @param cell 类型单元格 | |
380 | + */ | |
381 | + public void fillExcelData(int index, Row row) | |
382 | + { | |
383 | + int startNo = index * sheetSize; | |
384 | + int endNo = Math.min(startNo + sheetSize, list.size()); | |
385 | + for (int i = startNo; i < endNo; i++) | |
386 | + { | |
387 | + row = sheet.createRow(i + 1 - startNo); | |
388 | + // 得到导出对象. | |
389 | + T vo = (T) list.get(i); | |
390 | + int column = 0; | |
391 | + for (Object[] os : fields) | |
284 | 392 | { |
285 | - row = sheet.createRow(i + 1 - startNo); | |
286 | - // 得到导出对象. | |
287 | - LinkedHashMap<String, Object> map = list.get(i); | |
288 | - int tempCount = 0; | |
289 | - for (Map.Entry<String, Object> entry : map.entrySet()) { | |
290 | - try{ | |
291 | - cell = row.createCell(tempCount); | |
292 | - cell.setCellStyle(cs); | |
293 | - try{ | |
294 | - if (String.valueOf(entry.getValue()).length() > 10) | |
295 | - { | |
296 | - throw new Exception("长度超过10位就不用转数字了"); | |
297 | - } | |
298 | - // 如果可以转成数字则导出为数字类型 | |
299 | - BigDecimal bc = new BigDecimal(String.valueOf(entry.getValue())); | |
300 | - cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); | |
301 | - cell.setCellValue(bc.doubleValue()); | |
302 | - | |
303 | - }catch (Throwable tt){ | |
304 | - cell.setCellType(HSSFCell.CELL_TYPE_STRING); | |
305 | - if (entry.getValue() == null) | |
306 | - { | |
307 | - // 如果数据存在就填入,不存在填入空格. | |
308 | - cell.setCellValue(""); | |
309 | - } | |
310 | - else | |
311 | - { | |
312 | - // 如果数据存在就填入,不存在填入空格. | |
313 | - cell.setCellValue(entry.getValue() == null ? "" : String.valueOf(entry.getValue())); | |
314 | - } | |
315 | - } | |
316 | - | |
317 | - }catch (Throwable t){ | |
318 | - log.error("导出Excel失败{}", t.getMessage()); | |
319 | - } | |
320 | - tempCount++; | |
321 | - } | |
393 | + Field field = (Field) os[0]; | |
394 | + Excel excel = (Excel) os[1]; | |
395 | + // 设置实体类私有属性可访问 | |
396 | + field.setAccessible(true); | |
397 | + this.addCell(excel, row, vo, field, column++); | |
322 | 398 | } |
323 | 399 | } |
324 | - try | |
400 | + } | |
401 | + | |
402 | + /** | |
403 | + * 创建表格样式 | |
404 | + * | |
405 | + * @param wb 工作薄对象 | |
406 | + * @return 样式列表 | |
407 | + */ | |
408 | + private Map<String, CellStyle> createStyles(Workbook wb) | |
409 | + { | |
410 | + // 写入各条记录,每条记录对应excel表中的一行 | |
411 | + Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); | |
412 | + CellStyle style = wb.createCellStyle(); | |
413 | + style.setAlignment(HorizontalAlignment.CENTER); | |
414 | + style.setVerticalAlignment(VerticalAlignment.CENTER); | |
415 | + style.setBorderRight(BorderStyle.THIN); | |
416 | + style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); | |
417 | + style.setBorderLeft(BorderStyle.THIN); | |
418 | + style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); | |
419 | + style.setBorderTop(BorderStyle.THIN); | |
420 | + style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); | |
421 | + style.setBorderBottom(BorderStyle.THIN); | |
422 | + style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); | |
423 | + Font dataFont = wb.createFont(); | |
424 | + dataFont.setFontName("Arial"); | |
425 | + dataFont.setFontHeightInPoints((short) 10); | |
426 | + style.setFont(dataFont); | |
427 | + styles.put("data", style); | |
428 | + | |
429 | + style = wb.createCellStyle(); | |
430 | + style.cloneStyleFrom(styles.get("data")); | |
431 | + style.setAlignment(HorizontalAlignment.CENTER); | |
432 | + style.setVerticalAlignment(VerticalAlignment.CENTER); | |
433 | + style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex()); | |
434 | + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); | |
435 | + Font headerFont = wb.createFont(); | |
436 | + headerFont.setFontName("Arial"); | |
437 | + headerFont.setFontHeightInPoints((short) 10); | |
438 | + headerFont.setBold(true); | |
439 | + headerFont.setColor(IndexedColors.WHITE.getIndex()); | |
440 | + style.setFont(headerFont); | |
441 | + styles.put("header", style); | |
442 | + | |
443 | + return styles; | |
444 | + } | |
445 | + | |
446 | + /** | |
447 | + * 创建单元格 | |
448 | + */ | |
449 | + public Cell createCell(Excel attr, Row row, int column) | |
450 | + { | |
451 | + // 创建列 | |
452 | + Cell cell = row.createCell(column); | |
453 | + // 写入列信息 | |
454 | + cell.setCellValue(attr.name()); | |
455 | + setDataValidation(attr, row, column); | |
456 | + cell.setCellStyle(styles.get("header")); | |
457 | + return cell; | |
458 | + } | |
459 | + | |
460 | + /** | |
461 | + * 设置单元格信息 | |
462 | + * | |
463 | + * @param value 单元格值 | |
464 | + * @param attr 注解相关 | |
465 | + * @param cell 单元格信息 | |
466 | + */ | |
467 | + public void setCellVo(Object value, Excel attr, Cell cell) | |
468 | + { | |
469 | + if (Excel.ColumnType.STRING == attr.cellType()) | |
325 | 470 | { |
326 | - response.setContentType("application/vnd.ms-excel"); | |
327 | - String fileName = encodingFilename(sheetName); | |
328 | - response.addHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode(fileName, "UTF-8")); | |
329 | - OutputStream out = response.getOutputStream(); | |
330 | - workbook.write(out); | |
331 | - out.close(); | |
332 | - return AjaxResult.success(fileName); | |
471 | + cell.setCellType(CellType.NUMERIC); | |
472 | + cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix()); | |
333 | 473 | } |
334 | - catch (Exception e) | |
474 | + else if (Excel.ColumnType.NUMERIC == attr.cellType()) | |
335 | 475 | { |
336 | - log.error("关闭flush失败{}", e.getMessage()); | |
337 | - return AjaxResult.error("导出Excel失败,请联系网站管理员!"); | |
476 | + cell.setCellType(CellType.NUMERIC); | |
477 | + cell.setCellValue(Integer.parseInt(value + "")); | |
338 | 478 | } |
339 | 479 | } |
340 | 480 | |
341 | 481 | /** |
342 | - * 对list数据源将其里面的数据导入到excel表单 | |
343 | - * | |
344 | - * @param sheetName 工作表的名称 | |
482 | + * 创建表格样式 | |
345 | 483 | */ |
346 | - public AjaxResult exportExcel(List<T> list, String sheetName) | |
484 | + public void setDataValidation(Excel attr, Row row, int column) | |
347 | 485 | { |
348 | - // 得到所有定义字段 | |
349 | - Field[] allFields = clazz.getDeclaredFields(); | |
350 | - List<Field> fields = new ArrayList<Field>(); | |
351 | - // 得到所有field并存放到一个list中. | |
352 | - for (Field field : allFields) | |
486 | + if (attr.name().indexOf("注:") >= 0) | |
353 | 487 | { |
354 | - if (field.isAnnotationPresent(Excel.class)) | |
355 | - { | |
356 | - fields.add(field); | |
357 | - } | |
488 | + sheet.setColumnWidth(column, 6000); | |
358 | 489 | } |
359 | - | |
360 | - // 产生工作薄对象 | |
361 | - HSSFWorkbook workbook = new HSSFWorkbook(); | |
362 | - // excel2003中每个sheet中最多有65536行 | |
363 | - int sheetSize = 65536; | |
364 | - // 取出一共有多少个sheet. | |
365 | - double sheetNo = Math.ceil(list.size() / sheetSize); | |
366 | - for (int index = 0; index <= sheetNo; index++) | |
490 | + else | |
367 | 491 | { |
368 | - // 产生工作表对象 | |
369 | - HSSFSheet sheet = workbook.createSheet(); | |
370 | - if (sheetNo == 0) | |
371 | - { | |
372 | - workbook.setSheetName(index, sheetName); | |
373 | - } | |
374 | - else | |
375 | - { | |
376 | - // 设置工作表的名称. | |
377 | - workbook.setSheetName(index, sheetName + index); | |
378 | - } | |
379 | - HSSFRow row; | |
380 | - HSSFCell cell; // 产生单元格 | |
492 | + // 设置列宽 | |
493 | + sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256)); | |
494 | + row.setHeight((short) (attr.height() * 20)); | |
495 | + } | |
496 | + // 如果设置了提示信息则鼠标放上去提示. | |
497 | + if (StringUtils.isNotEmpty(attr.prompt())) | |
498 | + { | |
499 | + // 这里默认设了2-101列提示. | |
500 | + setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column); | |
501 | + } | |
502 | + // 如果设置了combo属性则本列只能选择不能输入 | |
503 | + if (attr.combo().length > 0) | |
504 | + { | |
505 | + // 这里默认设了2-101列只能选择不能输入. | |
506 | + setXSSFValidation(sheet, attr.combo(), 1, 100, column, column); | |
507 | + } | |
508 | + } | |
381 | 509 | |
382 | - // 产生一行 | |
383 | - row = sheet.createRow(0); | |
384 | - // 写入各个字段的列头名称 | |
385 | - for (int i = 0; i < fields.size(); i++) | |
510 | + /** | |
511 | + * 添加单元格 | |
512 | + */ | |
513 | + public Cell addCell(Excel attr, Row row, T vo, Field field, int column) | |
514 | + { | |
515 | + Cell cell = null; | |
516 | + try | |
517 | + { | |
518 | + // 设置行高 | |
519 | + row.setHeight((short) (attr.height() * 20)); | |
520 | + // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列. | |
521 | + if (attr.isExport()) | |
386 | 522 | { |
387 | - Field field = fields.get(i); | |
388 | - Excel attr = field.getAnnotation(Excel.class); | |
389 | - // 创建列 | |
390 | - cell = row.createCell(i); | |
391 | - // 设置列中写入内容为String类型 | |
392 | - cell.setCellType(HSSFCell.CELL_TYPE_STRING); | |
393 | - HSSFCellStyle cellStyle = workbook.createCellStyle(); | |
394 | - cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); | |
395 | - cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); | |
396 | - if (attr.name().indexOf("注:") >= 0) | |
523 | + // 创建cell | |
524 | + cell = row.createCell(column); | |
525 | + cell.setCellStyle(styles.get("data")); | |
526 | + | |
527 | + // 用于读取对象中的属性 | |
528 | + Object value = getTargetValue(vo, field, attr); | |
529 | + String dateFormat = attr.dateFormat(); | |
530 | + String readConverterExp = attr.readConverterExp(); | |
531 | + if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) | |
397 | 532 | { |
398 | - HSSFFont font = workbook.createFont(); | |
399 | - font.setColor(HSSFFont.COLOR_RED); | |
400 | - cellStyle.setFont(font); | |
401 | - cellStyle.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index); | |
402 | - sheet.setColumnWidth(i, 6000); | |
533 | + cell.setCellValue(DateUtils.parseDateToStr(dateFormat, (Date) value)); | |
403 | 534 | } |
404 | - else | |
405 | - { | |
406 | - HSSFFont font = workbook.createFont(); | |
407 | - // 粗体显示 | |
408 | - font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); | |
409 | - // 选择需要用到的字体格式 | |
410 | - cellStyle.setFont(font); | |
411 | - cellStyle.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index); | |
412 | - // 设置列宽 | |
413 | - sheet.setColumnWidth(i, 3766); | |
414 | - } | |
415 | - cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); | |
416 | - cellStyle.setWrapText(true); | |
417 | - cell.setCellStyle(cellStyle); | |
418 | - | |
419 | - // 写入列名 | |
420 | - cell.setCellValue(attr.name()); | |
421 | - | |
422 | - // 如果设置了提示信息则鼠标放上去提示. | |
423 | - if (StringUtils.isNotEmpty(attr.prompt())) | |
535 | + else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) | |
424 | 536 | { |
425 | - // 这里默认设了2-101列提示. | |
426 | - setHSSFPrompt(sheet, "", attr.prompt(), 1, 100, i, i); | |
537 | + cell.setCellValue(convertByExp(String.valueOf(value), readConverterExp)); | |
427 | 538 | } |
428 | - // 如果设置了combo属性则本列只能选择不能输入 | |
429 | - if (attr.combo().length > 0) | |
539 | + else | |
430 | 540 | { |
431 | - // 这里默认设了2-101列只能选择不能输入. | |
432 | - setHSSFValidation(sheet, attr.combo(), 1, 100, i, i); | |
433 | - } | |
434 | - } | |
435 | - | |
436 | - int startNo = index * sheetSize; | |
437 | - int endNo = Math.min(startNo + sheetSize, list.size()); | |
438 | - // 写入各条记录,每条记录对应excel表中的一行 | |
439 | - HSSFCellStyle cs = workbook.createCellStyle(); | |
440 | - cs.setAlignment(HSSFCellStyle.ALIGN_CENTER); | |
441 | - cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER); | |
442 | - for (int i = startNo; i < endNo; i++) | |
443 | - { | |
444 | - row = sheet.createRow(i + 1 - startNo); | |
445 | - // 得到导出对象. | |
446 | - T vo = (T) list.get(i); | |
447 | - for (int j = 0; j < fields.size(); j++) | |
448 | - { | |
449 | - // 获得field. | |
450 | - Field field = fields.get(j); | |
451 | - // 设置实体类私有属性可访问 | |
452 | - field.setAccessible(true); | |
453 | - Excel attr = field.getAnnotation(Excel.class); | |
454 | - try | |
455 | - { | |
456 | - // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列. | |
457 | - if (attr.isExport()) | |
458 | - { | |
459 | - // 创建cell | |
460 | - cell = row.createCell(j); | |
461 | - cell.setCellStyle(cs); | |
462 | - try | |
463 | - { | |
464 | - if (String.valueOf(field.get(vo)).length() > 10) | |
465 | - { | |
466 | - throw new Exception("长度超过10位就不用转数字了"); | |
467 | - } | |
468 | - // 如果可以转成数字则导出为数字类型 | |
469 | - BigDecimal bc = new BigDecimal(String.valueOf(field.get(vo))); | |
470 | - cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); | |
471 | - cell.setCellValue(bc.doubleValue()); | |
472 | - } | |
473 | - catch (Exception e) | |
474 | - { | |
475 | - cell.setCellType(HSSFCell.CELL_TYPE_STRING); | |
476 | - if (vo == null) | |
477 | - { | |
478 | - // 如果数据存在就填入,不存在填入空格. | |
479 | - cell.setCellValue(""); | |
480 | - } | |
481 | - else | |
482 | - { | |
483 | - // 如果数据存在就填入,不存在填入空格. | |
484 | - cell.setCellValue(field.get(vo) == null ? "" : String.valueOf(field.get(vo))); | |
485 | - } | |
486 | - | |
487 | - } | |
488 | - } | |
489 | - } | |
490 | - catch (Exception e) | |
491 | - { | |
492 | - log.error("导出Excel失败{}", e.getMessage()); | |
493 | - } | |
541 | + // 设置列类型 | |
542 | + setCellVo(value, attr, cell); | |
494 | 543 | } |
495 | 544 | } |
496 | 545 | } |
497 | - try | |
498 | - { | |
499 | - String filename = encodingFilename(sheetName); | |
500 | - OutputStream out = new FileOutputStream(getfile() + filename); | |
501 | - workbook.write(out); | |
502 | - out.close(); | |
503 | - return AjaxResult.success(filename); | |
504 | - } | |
505 | 546 | catch (Exception e) |
506 | 547 | { |
507 | - log.error("关闭flush失败{}", e.getMessage()); | |
508 | - return AjaxResult.error("导出Excel失败,请联系网站管理员!"); | |
548 | + log.error("导出Excel失败{}", e); | |
509 | 549 | } |
550 | + return cell; | |
510 | 551 | } |
511 | 552 | |
512 | 553 | /** |
513 | - * 设置单元格上提示 | |
514 | - * | |
515 | - * @param sheet 要设置的sheet. | |
516 | - * @param promptTitle 标题 | |
517 | - * @param promptContent 内容 | |
554 | + * 设置 POI XSSFSheet 单元格提示 | |
555 | + * | |
556 | + * @param sheet 表单 | |
557 | + * @param promptTitle 提示标题 | |
558 | + * @param promptContent 提示内容 | |
518 | 559 | * @param firstRow 开始行 |
519 | 560 | * @param endRow 结束行 |
520 | 561 | * @param firstCol 开始列 |
521 | 562 | * @param endCol 结束列 |
522 | - * @return 设置好的sheet. | |
523 | 563 | */ |
524 | - public static HSSFSheet setHSSFPrompt(HSSFSheet sheet, String promptTitle, String promptContent, int firstRow, | |
525 | - int endRow, int firstCol, int endCol) | |
564 | + public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow, | |
565 | + int firstCol, int endCol) | |
526 | 566 | { |
527 | - // 构造constraint对象 | |
528 | - DVConstraint constraint = DVConstraint.createCustomFormulaConstraint("DD1"); | |
529 | - // 四个参数分别是:起始行、终止行、起始列、终止列 | |
567 | + DataValidationHelper helper = sheet.getDataValidationHelper(); | |
568 | + DataValidationConstraint constraint = helper.createCustomConstraint("DD1"); | |
530 | 569 | CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); |
531 | - // 数据有效性对象 | |
532 | - HSSFDataValidation dataValidationView = new HSSFDataValidation(regions, constraint); | |
533 | - dataValidationView.createPromptBox(promptTitle, promptContent); | |
534 | - sheet.addValidationData(dataValidationView); | |
535 | - return sheet; | |
570 | + DataValidation dataValidation = helper.createValidation(constraint, regions); | |
571 | + dataValidation.createPromptBox(promptTitle, promptContent); | |
572 | + dataValidation.setShowPromptBox(true); | |
573 | + sheet.addValidationData(dataValidation); | |
536 | 574 | } |
537 | 575 | |
538 | 576 | /** |
539 | 577 | * 设置某些列的值只能输入预制的数据,显示下拉框. |
540 | - * | |
578 | + * | |
541 | 579 | * @param sheet 要设置的sheet. |
542 | 580 | * @param textlist 下拉框显示的内容 |
543 | 581 | * @param firstRow 开始行 |
... | ... | @@ -546,17 +584,85 @@ public class ExcelUtil<T> |
546 | 584 | * @param endCol 结束列 |
547 | 585 | * @return 设置好的sheet. |
548 | 586 | */ |
549 | - public static HSSFSheet setHSSFValidation(HSSFSheet sheet, String[] textlist, int firstRow, int endRow, | |
550 | - int firstCol, int endCol) | |
587 | + public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) | |
551 | 588 | { |
589 | + DataValidationHelper helper = sheet.getDataValidationHelper(); | |
552 | 590 | // 加载下拉列表内容 |
553 | - DVConstraint constraint = DVConstraint.createExplicitListConstraint(textlist); | |
591 | + DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist); | |
554 | 592 | // 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列 |
555 | 593 | CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); |
556 | 594 | // 数据有效性对象 |
557 | - HSSFDataValidation dataValidationList = new HSSFDataValidation(regions, constraint); | |
558 | - sheet.addValidationData(dataValidationList); | |
559 | - return sheet; | |
595 | + DataValidation dataValidation = helper.createValidation(constraint, regions); | |
596 | + // 处理Excel兼容性问题 | |
597 | + if (dataValidation instanceof XSSFDataValidation) | |
598 | + { | |
599 | + dataValidation.setSuppressDropDownArrow(true); | |
600 | + dataValidation.setShowErrorBox(true); | |
601 | + } | |
602 | + else | |
603 | + { | |
604 | + dataValidation.setSuppressDropDownArrow(false); | |
605 | + } | |
606 | + | |
607 | + sheet.addValidationData(dataValidation); | |
608 | + } | |
609 | + | |
610 | + /** | |
611 | + * 解析导出值 0=男,1=女,2=未知 | |
612 | + * | |
613 | + * @param propertyValue 参数值 | |
614 | + * @param converterExp 翻译注解 | |
615 | + * @return 解析后值 | |
616 | + * @throws Exception | |
617 | + */ | |
618 | + public static String convertByExp(String propertyValue, String converterExp) throws Exception | |
619 | + { | |
620 | + try | |
621 | + { | |
622 | + String[] convertSource = converterExp.split(","); | |
623 | + for (String item : convertSource) | |
624 | + { | |
625 | + String[] itemArray = item.split("="); | |
626 | + if (itemArray[0].equals(propertyValue)) | |
627 | + { | |
628 | + return itemArray[1]; | |
629 | + } | |
630 | + } | |
631 | + } | |
632 | + catch (Exception e) | |
633 | + { | |
634 | + throw e; | |
635 | + } | |
636 | + return propertyValue; | |
637 | + } | |
638 | + | |
639 | + /** | |
640 | + * 反向解析值 男=0,女=1,未知=2 | |
641 | + * | |
642 | + * @param propertyValue 参数值 | |
643 | + * @param converterExp 翻译注解 | |
644 | + * @return 解析后值 | |
645 | + * @throws Exception | |
646 | + */ | |
647 | + public static String reverseByExp(String propertyValue, String converterExp) throws Exception | |
648 | + { | |
649 | + try | |
650 | + { | |
651 | + String[] convertSource = converterExp.split(","); | |
652 | + for (String item : convertSource) | |
653 | + { | |
654 | + String[] itemArray = item.split("="); | |
655 | + if (itemArray[1].equals(propertyValue)) | |
656 | + { | |
657 | + return itemArray[0]; | |
658 | + } | |
659 | + } | |
660 | + } | |
661 | + catch (Exception e) | |
662 | + { | |
663 | + throw e; | |
664 | + } | |
665 | + return propertyValue; | |
560 | 666 | } |
561 | 667 | |
562 | 668 | /** |
... | ... | @@ -564,13 +670,205 @@ public class ExcelUtil<T> |
564 | 670 | */ |
565 | 671 | public String encodingFilename(String filename) |
566 | 672 | { |
567 | - filename = UUID.randomUUID().toString() + "_" + filename + ".xls"; | |
673 | + filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx"; | |
568 | 674 | return filename; |
569 | 675 | } |
570 | 676 | |
571 | - public String getfile() throws FileNotFoundException | |
677 | + /** | |
678 | + * 获取下载路径 | |
679 | + * | |
680 | + * @param filename 文件名称 | |
681 | + */ | |
682 | + public String getAbsoluteFile(String filename) | |
683 | + { | |
684 | + String downloadPath = Global.getDownloadPath() + filename; | |
685 | + File desc = new File(downloadPath); | |
686 | + if (!desc.getParentFile().exists()) | |
687 | + { | |
688 | + desc.getParentFile().mkdirs(); | |
689 | + } | |
690 | + return downloadPath; | |
691 | + } | |
692 | + | |
693 | + /** | |
694 | + * 获取bean中的属性值 | |
695 | + * | |
696 | + * @param vo 实体对象 | |
697 | + * @param field 字段 | |
698 | + * @param excel 注解 | |
699 | + * @return 最终的属性值 | |
700 | + * @throws Exception | |
701 | + */ | |
702 | + private Object getTargetValue(T vo, Field field, Excel excel) throws Exception | |
703 | + { | |
704 | + Object o = field.get(vo); | |
705 | + if (StringUtils.isNotEmpty(excel.targetAttr())) | |
706 | + { | |
707 | + String target = excel.targetAttr(); | |
708 | + if (target.indexOf(".") > -1) | |
709 | + { | |
710 | + String[] targets = target.split("[.]"); | |
711 | + for (String name : targets) | |
712 | + { | |
713 | + o = getValue(o, name); | |
714 | + } | |
715 | + } | |
716 | + else | |
717 | + { | |
718 | + o = getValue(o, target); | |
719 | + } | |
720 | + } | |
721 | + return o; | |
722 | + } | |
723 | + | |
724 | + /** | |
725 | + * 以类的属性的get方法方法形式获取值 | |
726 | + * | |
727 | + * @param o | |
728 | + * @param name | |
729 | + * @return value | |
730 | + * @throws Exception | |
731 | + */ | |
732 | + private Object getValue(Object o, String name) throws Exception | |
572 | 733 | { |
573 | - return ResourceUtils.getURL("classpath:").getPath() + "static/file/"; | |
734 | + if (StringUtils.isNotEmpty(name)) | |
735 | + { | |
736 | + Class<?> clazz = o.getClass(); | |
737 | + String methodName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); | |
738 | + Method method = clazz.getMethod(methodName); | |
739 | + o = method.invoke(o); | |
740 | + } | |
741 | + return o; | |
574 | 742 | } |
575 | 743 | |
744 | + /** | |
745 | + * 得到所有定义字段 | |
746 | + */ | |
747 | + private void createExcelField() | |
748 | + { | |
749 | + this.fields = new ArrayList<Object[]>(); | |
750 | + List<Field> tempFields = new ArrayList<>(); | |
751 | + tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields())); | |
752 | + tempFields.addAll(Arrays.asList(clazz.getDeclaredFields())); | |
753 | + for (Field field : tempFields) | |
754 | + { | |
755 | + // 单注解 | |
756 | + if (field.isAnnotationPresent(Excel.class)) | |
757 | + { | |
758 | + putToField(field, field.getAnnotation(Excel.class)); | |
759 | + } | |
760 | + | |
761 | + // 多注解 | |
762 | + if (field.isAnnotationPresent(Excels.class)) | |
763 | + { | |
764 | + Excels attrs = field.getAnnotation(Excels.class); | |
765 | + Excel[] excels = attrs.value(); | |
766 | + for (Excel excel : excels) | |
767 | + { | |
768 | + putToField(field, excel); | |
769 | + } | |
770 | + } | |
771 | + } | |
772 | + } | |
773 | + | |
774 | + /** | |
775 | + * 放到字段集合中 | |
776 | + */ | |
777 | + private void putToField(Field field, Excel attr) | |
778 | + { | |
779 | + if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) | |
780 | + { | |
781 | + this.fields.add(new Object[] { field, attr }); | |
782 | + } | |
783 | + } | |
784 | + | |
785 | + /** | |
786 | + * 创建一个工作簿 | |
787 | + */ | |
788 | + public void createWorkbook() | |
789 | + { | |
790 | + this.wb = new SXSSFWorkbook(500); | |
791 | + } | |
792 | + | |
793 | + /** | |
794 | + * 创建工作表 | |
795 | + * | |
796 | + * @param sheetName,指定Sheet名称 | |
797 | + * @param sheetNo sheet数量 | |
798 | + * @param index 序号 | |
799 | + */ | |
800 | + public void createSheet(double sheetNo, int index) | |
801 | + { | |
802 | + this.sheet = wb.createSheet(); | |
803 | + this.styles = createStyles(wb); | |
804 | + // 设置工作表的名称. | |
805 | + if (sheetNo == 0) | |
806 | + { | |
807 | + wb.setSheetName(index, sheetName); | |
808 | + } | |
809 | + else | |
810 | + { | |
811 | + wb.setSheetName(index, sheetName + index); | |
812 | + } | |
813 | + } | |
814 | + | |
815 | + /** | |
816 | + * 获取单元格值 | |
817 | + * | |
818 | + * @param row 获取的行 | |
819 | + * @param column 获取单元格列号 | |
820 | + * @return 单元格值 | |
821 | + */ | |
822 | + public Object getCellValue(Row row, int column) | |
823 | + { | |
824 | + if (row == null) | |
825 | + { | |
826 | + return row; | |
827 | + } | |
828 | + Object val = ""; | |
829 | + try | |
830 | + { | |
831 | + Cell cell = row.getCell(column); | |
832 | + if (cell != null) | |
833 | + { | |
834 | + if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA) | |
835 | + { | |
836 | + val = cell.getNumericCellValue(); | |
837 | + if (HSSFDateUtil.isCellDateFormatted(cell)) | |
838 | + { | |
839 | + val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换 | |
840 | + } | |
841 | + else | |
842 | + { | |
843 | + if ((Double) val % 1 > 0) | |
844 | + { | |
845 | + val = new DecimalFormat("0.00").format(val); | |
846 | + } | |
847 | + else | |
848 | + { | |
849 | + val = new DecimalFormat("0").format(val); | |
850 | + } | |
851 | + } | |
852 | + } | |
853 | + else if (cell.getCellTypeEnum() == CellType.STRING) | |
854 | + { | |
855 | + val = cell.getStringCellValue(); | |
856 | + } | |
857 | + else if (cell.getCellTypeEnum() == CellType.BOOLEAN) | |
858 | + { | |
859 | + val = cell.getBooleanCellValue(); | |
860 | + } | |
861 | + else if (cell.getCellTypeEnum() == CellType.ERROR) | |
862 | + { | |
863 | + val = cell.getErrorCellValue(); | |
864 | + } | |
865 | + | |
866 | + } | |
867 | + } | |
868 | + catch (Exception e) | |
869 | + { | |
870 | + return val; | |
871 | + } | |
872 | + return val; | |
873 | + } | |
576 | 874 | } |
577 | 875 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/common/utils/reflect/ReflectUtils.java
0 → 100644
1 | +package com.huaheng.common.utils.reflect; | |
2 | + | |
3 | +import com.huaheng.common.support.Convert; | |
4 | +import com.huaheng.common.utils.DateUtils; | |
5 | +import org.apache.commons.lang3.StringUtils; | |
6 | +import org.apache.commons.lang3.Validate; | |
7 | +import org.apache.poi.ss.usermodel.DateUtil; | |
8 | +import org.slf4j.Logger; | |
9 | +import org.slf4j.LoggerFactory; | |
10 | + | |
11 | +import java.lang.reflect.*; | |
12 | +import java.util.Date; | |
13 | + | |
14 | +/** | |
15 | + * 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数. | |
16 | + * | |
17 | + * @author ruoyi | |
18 | + */ | |
19 | +public class ReflectUtils { | |
20 | + | |
21 | + private static final String SETTER_PREFIX = "set"; | |
22 | + | |
23 | + private static final String GETTER_PREFIX = "get"; | |
24 | + | |
25 | + private static final String CGLIB_CLASS_SEPARATOR = "$$"; | |
26 | + | |
27 | + private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class); | |
28 | + | |
29 | + /** | |
30 | + * 调用Getter方法. | |
31 | + * 支持多级,如:对象名.对象名.方法 | |
32 | + */ | |
33 | + @SuppressWarnings("unchecked") | |
34 | + public static <E> E invokeGetter(Object obj, String propertyName) | |
35 | + { | |
36 | + Object object = obj; | |
37 | + for (String name : StringUtils.split(propertyName, ".")) | |
38 | + { | |
39 | + String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name); | |
40 | + object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); | |
41 | + } | |
42 | + return (E) object; | |
43 | + } | |
44 | + | |
45 | + /** | |
46 | + * 调用Setter方法, 仅匹配方法名。 | |
47 | + * 支持多级,如:对象名.对象名.方法 | |
48 | + */ | |
49 | + public static <E> void invokeSetter(Object obj, String propertyName, E value) | |
50 | + { | |
51 | + Object object = obj; | |
52 | + String[] names = StringUtils.split(propertyName, "."); | |
53 | + for (int i = 0; i < names.length; i++) | |
54 | + { | |
55 | + if (i < names.length - 1) | |
56 | + { | |
57 | + String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]); | |
58 | + object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); | |
59 | + } | |
60 | + else | |
61 | + { | |
62 | + String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]); | |
63 | + invokeMethodByName(object, setterMethodName, new Object[] { value }); | |
64 | + } | |
65 | + } | |
66 | + } | |
67 | + | |
68 | + /** | |
69 | + * 直接读取对象属性值, 无视private/protected修饰符, 不经过getter函数. | |
70 | + */ | |
71 | + @SuppressWarnings("unchecked") | |
72 | + public static <E> E getFieldValue(final Object obj, final String fieldName) | |
73 | + { | |
74 | + Field field = getAccessibleField(obj, fieldName); | |
75 | + if (field == null) | |
76 | + { | |
77 | + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); | |
78 | + return null; | |
79 | + } | |
80 | + E result = null; | |
81 | + try | |
82 | + { | |
83 | + result = (E) field.get(obj); | |
84 | + } | |
85 | + catch (IllegalAccessException e) | |
86 | + { | |
87 | + logger.error("不可能抛出的异常{}", e.getMessage()); | |
88 | + } | |
89 | + return result; | |
90 | + } | |
91 | + | |
92 | + /** | |
93 | + * 直接设置对象属性值, 无视private/protected修饰符, 不经过setter函数. | |
94 | + */ | |
95 | + public static <E> void setFieldValue(final Object obj, final String fieldName, final E value) | |
96 | + { | |
97 | + Field field = getAccessibleField(obj, fieldName); | |
98 | + if (field == null) | |
99 | + { | |
100 | + // throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); | |
101 | + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); | |
102 | + return; | |
103 | + } | |
104 | + try | |
105 | + { | |
106 | + field.set(obj, value); | |
107 | + } | |
108 | + catch (IllegalAccessException e) | |
109 | + { | |
110 | + logger.error("不可能抛出的异常: {}", e.getMessage()); | |
111 | + } | |
112 | + } | |
113 | + | |
114 | + /** | |
115 | + * 直接调用对象方法, 无视private/protected修饰符. | |
116 | + * 用于一次性调用的情况,否则应使用getAccessibleMethod()函数获得Method后反复调用. | |
117 | + * 同时匹配方法名+参数类型, | |
118 | + */ | |
119 | + @SuppressWarnings("unchecked") | |
120 | + public static <E> E invokeMethod(final Object obj, final String methodName, final Class<?>[] parameterTypes, | |
121 | + final Object[] args) | |
122 | + { | |
123 | + if (obj == null || methodName == null) | |
124 | + { | |
125 | + return null; | |
126 | + } | |
127 | + Method method = getAccessibleMethod(obj, methodName, parameterTypes); | |
128 | + if (method == null) | |
129 | + { | |
130 | + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 "); | |
131 | + return null; | |
132 | + } | |
133 | + try | |
134 | + { | |
135 | + return (E) method.invoke(obj, args); | |
136 | + } | |
137 | + catch (Exception e) | |
138 | + { | |
139 | + String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; | |
140 | + throw convertReflectionExceptionToUnchecked(msg, e); | |
141 | + } | |
142 | + } | |
143 | + | |
144 | + /** | |
145 | + * 直接调用对象方法, 无视private/protected修饰符, | |
146 | + * 用于一次性调用的情况,否则应使用getAccessibleMethodByName()函数获得Method后反复调用. | |
147 | + * 只匹配函数名,如果有多个同名函数调用第一个。 | |
148 | + */ | |
149 | + @SuppressWarnings("unchecked") | |
150 | + public static <E> E invokeMethodByName(final Object obj, final String methodName, final Object[] args) | |
151 | + { | |
152 | + Method method = getAccessibleMethodByName(obj, methodName, args.length); | |
153 | + if (method == null) | |
154 | + { | |
155 | + // 如果为空不报错,直接返回空。 | |
156 | + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 "); | |
157 | + return null; | |
158 | + } | |
159 | + try | |
160 | + { | |
161 | + // 类型转换(将参数数据类型转换为目标方法参数类型) | |
162 | + Class<?>[] cs = method.getParameterTypes(); | |
163 | + for (int i = 0; i < cs.length; i++) | |
164 | + { | |
165 | + if (args[i] != null && !args[i].getClass().equals(cs[i])) | |
166 | + { | |
167 | + if (cs[i] == String.class) | |
168 | + { | |
169 | + args[i] = Convert.toStr(args[i]); | |
170 | + if (StringUtils.endsWith((String) args[i], ".0")) | |
171 | + { | |
172 | + args[i] = StringUtils.substringBefore((String) args[i], ".0"); | |
173 | + } | |
174 | + } | |
175 | + else if (cs[i] == Integer.class) | |
176 | + { | |
177 | + args[i] = Convert.toInt(args[i]); | |
178 | + } | |
179 | + else if (cs[i] == Long.class) | |
180 | + { | |
181 | + args[i] = Convert.toLong(args[i]); | |
182 | + } | |
183 | + else if (cs[i] == Double.class) | |
184 | + { | |
185 | + args[i] = Convert.toDouble(args[i]); | |
186 | + } | |
187 | + else if (cs[i] == Float.class) | |
188 | + { | |
189 | + args[i] = Convert.toFloat(args[i]); | |
190 | + } | |
191 | + else if (cs[i] == Date.class) | |
192 | + { | |
193 | + if (args[i] instanceof String) | |
194 | + { | |
195 | + args[i] = DateUtils.parseDate(args[i]); | |
196 | + } | |
197 | + else | |
198 | + { | |
199 | + args[i] = DateUtil.getJavaDate((Double) args[i]); | |
200 | + } | |
201 | + } | |
202 | + } | |
203 | + } | |
204 | + return (E) method.invoke(obj, args); | |
205 | + } | |
206 | + catch (Exception e) | |
207 | + { | |
208 | + String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; | |
209 | + throw convertReflectionExceptionToUnchecked(msg, e); | |
210 | + } | |
211 | + } | |
212 | + | |
213 | + /** | |
214 | + * 循环向上转型, 获取对象的DeclaredField, 并强制设置为可访问. | |
215 | + * 如向上转型到Object仍无法找到, 返回null. | |
216 | + */ | |
217 | + public static Field getAccessibleField(final Object obj, final String fieldName) | |
218 | + { | |
219 | + // 为空不报错。直接返回 null | |
220 | + if (obj == null) | |
221 | + { | |
222 | + return null; | |
223 | + } | |
224 | + Validate.notBlank(fieldName, "fieldName can't be blank"); | |
225 | + for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) | |
226 | + { | |
227 | + try | |
228 | + { | |
229 | + Field field = superClass.getDeclaredField(fieldName); | |
230 | + makeAccessible(field); | |
231 | + return field; | |
232 | + } | |
233 | + catch (NoSuchFieldException e) | |
234 | + { | |
235 | + continue; | |
236 | + } | |
237 | + } | |
238 | + return null; | |
239 | + } | |
240 | + | |
241 | + /** | |
242 | + * 循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问. | |
243 | + * 如向上转型到Object仍无法找到, 返回null. | |
244 | + * 匹配函数名+参数类型。 | |
245 | + * 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args) | |
246 | + */ | |
247 | + public static Method getAccessibleMethod(final Object obj, final String methodName, | |
248 | + final Class<?>... parameterTypes) | |
249 | + { | |
250 | + // 为空不报错。直接返回 null | |
251 | + if (obj == null) | |
252 | + { | |
253 | + return null; | |
254 | + } | |
255 | + Validate.notBlank(methodName, "methodName can't be blank"); | |
256 | + for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) | |
257 | + { | |
258 | + try | |
259 | + { | |
260 | + Method method = searchType.getDeclaredMethod(methodName, parameterTypes); | |
261 | + makeAccessible(method); | |
262 | + return method; | |
263 | + } | |
264 | + catch (NoSuchMethodException e) | |
265 | + { | |
266 | + continue; | |
267 | + } | |
268 | + } | |
269 | + return null; | |
270 | + } | |
271 | + | |
272 | + /** | |
273 | + * 循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问. | |
274 | + * 如向上转型到Object仍无法找到, 返回null. | |
275 | + * 只匹配函数名。 | |
276 | + * 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args) | |
277 | + */ | |
278 | + public static Method getAccessibleMethodByName(final Object obj, final String methodName, int argsNum) | |
279 | + { | |
280 | + // 为空不报错。直接返回 null | |
281 | + if (obj == null) | |
282 | + { | |
283 | + return null; | |
284 | + } | |
285 | + Validate.notBlank(methodName, "methodName can't be blank"); | |
286 | + for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) | |
287 | + { | |
288 | + Method[] methods = searchType.getDeclaredMethods(); | |
289 | + for (Method method : methods) | |
290 | + { | |
291 | + if (method.getName().equals(methodName) && method.getParameterTypes().length == argsNum) | |
292 | + { | |
293 | + makeAccessible(method); | |
294 | + return method; | |
295 | + } | |
296 | + } | |
297 | + } | |
298 | + return null; | |
299 | + } | |
300 | + | |
301 | + /** | |
302 | + * 改变private/protected的方法为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。 | |
303 | + */ | |
304 | + public static void makeAccessible(Method method) | |
305 | + { | |
306 | + if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers())) | |
307 | + && !method.isAccessible()) | |
308 | + { | |
309 | + method.setAccessible(true); | |
310 | + } | |
311 | + } | |
312 | + | |
313 | + /** | |
314 | + * 改变private/protected的成员变量为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。 | |
315 | + */ | |
316 | + public static void makeAccessible(Field field) | |
317 | + { | |
318 | + if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) | |
319 | + || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) | |
320 | + { | |
321 | + field.setAccessible(true); | |
322 | + } | |
323 | + } | |
324 | + | |
325 | + /** | |
326 | + * 通过反射, 获得Class定义中声明的泛型参数的类型, 注意泛型必须定义在父类处 | |
327 | + * 如无法找到, 返回Object.class. | |
328 | + */ | |
329 | + @SuppressWarnings("unchecked") | |
330 | + public static <T> Class<T> getClassGenricType(final Class clazz) | |
331 | + { | |
332 | + return getClassGenricType(clazz, 0); | |
333 | + } | |
334 | + | |
335 | + /** | |
336 | + * 通过反射, 获得Class定义中声明的父类的泛型参数的类型. | |
337 | + * 如无法找到, 返回Object.class. | |
338 | + */ | |
339 | + public static Class getClassGenricType(final Class clazz, final int index) | |
340 | + { | |
341 | + Type genType = clazz.getGenericSuperclass(); | |
342 | + | |
343 | + if (!(genType instanceof ParameterizedType)) | |
344 | + { | |
345 | + logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType"); | |
346 | + return Object.class; | |
347 | + } | |
348 | + | |
349 | + Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); | |
350 | + | |
351 | + if (index >= params.length || index < 0) | |
352 | + { | |
353 | + logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " | |
354 | + + params.length); | |
355 | + return Object.class; | |
356 | + } | |
357 | + if (!(params[index] instanceof Class)) | |
358 | + { | |
359 | + logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter"); | |
360 | + return Object.class; | |
361 | + } | |
362 | + | |
363 | + return (Class) params[index]; | |
364 | + } | |
365 | + | |
366 | + public static Class<?> getUserClass(Object instance) | |
367 | + { | |
368 | + if (instance == null) | |
369 | + { | |
370 | + throw new RuntimeException("Instance must not be null"); | |
371 | + } | |
372 | + Class clazz = instance.getClass(); | |
373 | + if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) | |
374 | + { | |
375 | + Class<?> superClass = clazz.getSuperclass(); | |
376 | + if (superClass != null && !Object.class.equals(superClass)) | |
377 | + { | |
378 | + return superClass; | |
379 | + } | |
380 | + } | |
381 | + return clazz; | |
382 | + | |
383 | + } | |
384 | + | |
385 | + /** | |
386 | + * 将反射时的checked exception转换为unchecked exception. | |
387 | + */ | |
388 | + public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e) | |
389 | + { | |
390 | + if (e instanceof IllegalAccessException || e instanceof IllegalArgumentException | |
391 | + || e instanceof NoSuchMethodException) | |
392 | + { | |
393 | + return new IllegalArgumentException(msg, e); | |
394 | + } | |
395 | + else if (e instanceof InvocationTargetException) | |
396 | + { | |
397 | + return new RuntimeException(msg, ((InvocationTargetException) e).getTargetException()); | |
398 | + } | |
399 | + return new RuntimeException(msg, e); | |
400 | + } | |
401 | +} | |
... | ... |
src/main/java/com/huaheng/framework/aspectj/lang/annotation/Excel.java
... | ... | @@ -17,20 +17,98 @@ public @interface Excel |
17 | 17 | /** |
18 | 18 | * 导出到Excel中的名字. |
19 | 19 | */ |
20 | - public abstract String name(); | |
20 | + public String name() default ""; | |
21 | + | |
22 | + /** | |
23 | + * 日期格式, 如: yyyy-MM-dd | |
24 | + */ | |
25 | + public String dateFormat() default ""; | |
26 | + | |
27 | + /** | |
28 | + * 读取内容转表达式 (如: 0=男,1=女,2=未知) | |
29 | + */ | |
30 | + public String readConverterExp() default ""; | |
31 | + | |
32 | + /** | |
33 | + * 导出类型(0数字 1字符串) | |
34 | + */ | |
35 | + public ColumnType cellType() default ColumnType.STRING; | |
36 | + | |
37 | + /** | |
38 | + * 导出时在excel中每个列的高度 单位为字符 | |
39 | + */ | |
40 | + public double height() default 14; | |
41 | + | |
42 | + /** | |
43 | + * 导出时在excel中每个列的宽 单位为字符 | |
44 | + */ | |
45 | + public double width() default 16; | |
46 | + | |
47 | + /** | |
48 | + * 文字后缀,如% 90 变成90% | |
49 | + */ | |
50 | + public String suffix() default ""; | |
51 | + | |
52 | + /** | |
53 | + * 当值为空时,字段的默认值 | |
54 | + */ | |
55 | + public String defaultValue() default ""; | |
21 | 56 | |
22 | 57 | /** |
23 | 58 | * 提示信息 |
24 | 59 | */ |
25 | - public abstract String prompt() default ""; | |
60 | + public String prompt() default ""; | |
26 | 61 | |
27 | 62 | /** |
28 | 63 | * 设置只能选择不能输入的列内容. |
29 | 64 | */ |
30 | - public abstract String[] combo() default {}; | |
65 | + public String[] combo() default {}; | |
31 | 66 | |
32 | 67 | /** |
33 | 68 | * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. |
34 | 69 | */ |
35 | - public abstract boolean isExport() default true; | |
70 | + public boolean isExport() default true; | |
71 | + | |
72 | + /** | |
73 | + * 另一个类中的属性名称,支持多级获取,以小数点隔开 | |
74 | + */ | |
75 | + public String targetAttr() default ""; | |
76 | + | |
77 | + /** | |
78 | + * 字段类型(0:导出导入;1:仅导出;2:仅导入) | |
79 | + */ | |
80 | + Type type() default Type.ALL; | |
81 | + | |
82 | + public enum Type | |
83 | + { | |
84 | + ALL(0), EXPORT(1), IMPORT(2); | |
85 | + private final int value; | |
86 | + | |
87 | + Type(int value) | |
88 | + { | |
89 | + this.value = value; | |
90 | + } | |
91 | + | |
92 | + public int value() | |
93 | + { | |
94 | + return this.value; | |
95 | + } | |
96 | + } | |
97 | + | |
98 | + public enum ColumnType | |
99 | + { | |
100 | + NUMERIC(0), STRING(1); | |
101 | + private final int value; | |
102 | + | |
103 | + ColumnType(int value) | |
104 | + { | |
105 | + this.value = value; | |
106 | + } | |
107 | + | |
108 | + public int value() | |
109 | + { | |
110 | + return this.value; | |
111 | + } | |
112 | + } | |
113 | + | |
36 | 114 | } |
37 | 115 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/common/CommonController.java
... | ... | @@ -4,6 +4,8 @@ import java.io.UnsupportedEncodingException; |
4 | 4 | import java.net.URLEncoder; |
5 | 5 | import javax.servlet.http.HttpServletRequest; |
6 | 6 | import javax.servlet.http.HttpServletResponse; |
7 | + | |
8 | +import com.huaheng.common.config.Global; | |
7 | 9 | import org.slf4j.Logger; |
8 | 10 | import org.slf4j.LoggerFactory; |
9 | 11 | import org.springframework.stereotype.Controller; |
... | ... | @@ -22,12 +24,11 @@ public class CommonController |
22 | 24 | private static final Logger log = LoggerFactory.getLogger(CommonController.class); |
23 | 25 | |
24 | 26 | @RequestMapping("common/download") |
25 | - public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) | |
26 | - { | |
27 | - String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); | |
28 | - try | |
29 | - { | |
30 | - String filePath = ResourceUtils.getURL("classpath:").getPath() + "static/file/" + fileName; | |
27 | + public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) { | |
28 | + | |
29 | + try { | |
30 | + String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); | |
31 | + String filePath = Global.getDownloadPath() + fileName; | |
31 | 32 | |
32 | 33 | response.setCharacterEncoding("utf-8"); |
33 | 34 | response.setContentType("multipart/form-data"); |
... | ... |
src/main/java/com/huaheng/pc/config/receiptType/controller/receiptTypeController.java
0 → 100644
1 | +package com.huaheng.pc.config.receiptType.controller; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
6 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
7 | +import com.huaheng.common.support.Convert; | |
8 | +import com.huaheng.common.utils.StringUtils; | |
9 | +import com.huaheng.common.utils.security.ShiroUtils; | |
10 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | |
11 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | |
12 | +import com.huaheng.framework.web.controller.BaseController; | |
13 | +import com.huaheng.framework.web.domain.AjaxResult; | |
14 | +import com.huaheng.framework.web.page.PageDomain; | |
15 | +import com.huaheng.framework.web.page.TableDataInfo; | |
16 | +import com.huaheng.framework.web.page.TableSupport; | |
17 | +import com.huaheng.pc.config.receiptType.domain.ReceiptType; | |
18 | +import com.huaheng.pc.config.receiptType.service.ReceiptTypeService; | |
19 | +import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; | |
20 | +import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; | |
21 | +import io.swagger.annotations.ApiOperation; | |
22 | +import io.swagger.annotations.ApiParam; | |
23 | +import org.apache.shiro.authz.annotation.RequiresPermissions; | |
24 | +import org.springframework.stereotype.Controller; | |
25 | +import org.springframework.ui.ModelMap; | |
26 | +import org.springframework.web.bind.annotation.*; | |
27 | + | |
28 | +import javax.annotation.Resource; | |
29 | +import java.util.ArrayList; | |
30 | +import java.util.List; | |
31 | + | |
32 | +@Controller | |
33 | +@RequestMapping("/config/receiptType") | |
34 | +public class receiptTypeController extends BaseController { | |
35 | + | |
36 | + @Resource | |
37 | + private ReceiptTypeService receiptTypeService; | |
38 | + @Resource | |
39 | + private ReceiptHeaderService receiptHeaderService; | |
40 | + | |
41 | + private String prefix = "config/receiptType"; | |
42 | + | |
43 | + @RequiresPermissions("config:receiptType:view") | |
44 | + @GetMapping() | |
45 | + public String receiptDetailHistory() { | |
46 | + return prefix + "/receiptType"; | |
47 | + } | |
48 | + | |
49 | + /** | |
50 | + * 查询入库类型 | |
51 | + */ | |
52 | + @ApiOperation(value="查看入库类型列表", notes="根据编码、类型、创建时间获取入库类型", httpMethod = "POST") | |
53 | + @RequiresPermissions("config:receiptType:list") | |
54 | + @Log(title = "入库-入库类型",operating = "入库类型列表", action = BusinessType.GRANT) | |
55 | + @PostMapping("/list") | |
56 | + @ResponseBody | |
57 | + public TableDataInfo list(@ApiParam(name="receiptType",value="编码、类型") ReceiptType receiptType, | |
58 | + @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin, | |
59 | + @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) { | |
60 | + LambdaQueryWrapper<ReceiptType> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
61 | + PageDomain pageDomain = TableSupport.buildPageRequest(); | |
62 | + Integer pageNum = pageDomain.getPageNum(); | |
63 | + Integer pageSize = pageDomain.getPageSize(); | |
64 | + lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), ReceiptType::getCreated, createdBegin) | |
65 | + .lt(StringUtils.isNotEmpty(createdEnd), ReceiptType::getCreated, createdEnd) | |
66 | + .eq(StringUtils.isNotEmpty(receiptType.getCode()), ReceiptType::getCode, receiptType.getCode()) | |
67 | + .eq(StringUtils.isNotEmpty(receiptType.getReferType()), ReceiptType::getReferType, receiptType.getReferType()) | |
68 | + .in(ReceiptType::getCompanyCode, ShiroUtils.getCompanyCodeList()) | |
69 | + .eq(ReceiptType::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
70 | + | |
71 | + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ | |
72 | + /*使用分页查询*/ | |
73 | + Page<ReceiptType> page = new Page<>(pageNum, pageSize); | |
74 | + IPage<ReceiptType> iPage = receiptTypeService.page(page, lambdaQueryWrapper); | |
75 | + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | |
76 | + } else { | |
77 | + List<ReceiptType> list = receiptTypeService.list(lambdaQueryWrapper); | |
78 | + return getDataTable(list); | |
79 | + } | |
80 | + } | |
81 | + | |
82 | + /** | |
83 | + * 新增入库类型 | |
84 | + */ | |
85 | + @GetMapping("/add") | |
86 | + public String add() { | |
87 | + return prefix + "/add"; | |
88 | + } | |
89 | + | |
90 | + /** | |
91 | + * 新增入库类型 | |
92 | + */ | |
93 | + @ApiOperation(value="新增入库类型", notes="新增入库类型", httpMethod = "POST") | |
94 | + @RequiresPermissions("config:receiptType:add") | |
95 | + @Log(title = "入库-入库类型",operating = "新增入库类型", action = BusinessType.INSERT) | |
96 | + @PostMapping("/add") | |
97 | + @ResponseBody | |
98 | + public AjaxResult addSave(ReceiptType receiptType) { | |
99 | + receiptType.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
100 | + receiptType.setCreatedBy(ShiroUtils.getLoginName()); | |
101 | + receiptType.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
102 | + return toAjax(receiptTypeService.save(receiptType )); | |
103 | + } | |
104 | + | |
105 | + /** | |
106 | + * 修改入库类型 | |
107 | + */ | |
108 | + @GetMapping("/edit/{id}") | |
109 | + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | |
110 | + ReceiptType receiptType = receiptTypeService.getById(id); | |
111 | + mmap.put("receiptType", receiptType); | |
112 | + return prefix + "/edit"; | |
113 | + } | |
114 | + | |
115 | + /** | |
116 | + * 修改保存入库类型 | |
117 | + */ | |
118 | + @ApiOperation(value="修改入库类型信息", notes="修改入库类型信息", httpMethod = "POST") | |
119 | + @RequiresPermissions("config:receiptType:edit") | |
120 | + @Log(title = "入库-入库类型",operating = "修改入库类型", action = BusinessType.UPDATE) | |
121 | + @PostMapping("/edit") | |
122 | + @ResponseBody | |
123 | + public AjaxResult editSave(ReceiptType receiptType) { | |
124 | + receiptType.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
125 | + return toAjax(receiptTypeService.updateById(receiptType)); | |
126 | + } | |
127 | + | |
128 | + /** | |
129 | + * 删除入库 | |
130 | + */ | |
131 | + @ApiOperation(value="删除入库信息", notes="单条删除或批量删除入库信息,示例1或1,2,3", httpMethod = "POST") | |
132 | + @RequiresPermissions("config:receiptType:remove") | |
133 | + @Log(title = "入库-入库管理",operating = "修改入库", action = BusinessType.DELETE) | |
134 | + @PostMapping( "/remove") | |
135 | + @ResponseBody | |
136 | + public AjaxResult remove(String ids) { | |
137 | + if (StringUtils.isEmpty(ids)) { | |
138 | + return AjaxResult.error("id不能为空"); | |
139 | + } | |
140 | + List<Integer> list = new ArrayList<>(); | |
141 | + for (Integer id : Convert.toIntArray(ids)) { | |
142 | + ReceiptType receiptType = receiptTypeService.getById(id); | |
143 | + LambdaQueryWrapper<ReceiptHeader> lambda = Wrappers.lambdaQuery(); | |
144 | + lambda.eq(ReceiptHeader::getReceiptType, receiptType.getCode()); | |
145 | + List<ReceiptHeader> receiptHeaderList = receiptHeaderService.list(lambda); | |
146 | + if (receiptHeaderList.size() == 0){ | |
147 | + list.add(id); | |
148 | + } else { | |
149 | + return AjaxResult.error("类型"+receiptType.getCode()+"存在入库单,不能删除"); | |
150 | + } | |
151 | + } | |
152 | + return toAjax(receiptTypeService.removeByIds(list)); | |
153 | + } | |
154 | +} | |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptType/domain/ReceiptType.java renamed to src/main/java/com/huaheng/pc/config/receiptType/domain/ReceiptType.java
1 | -package com.huaheng.pc.receipt.receiptType.domain; | |
1 | +package com.huaheng.pc.config.receiptType.domain; | |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.annotation.IdType; |
4 | 4 | import com.baomidou.mybatisplus.annotation.TableField; |
... | ... | @@ -6,10 +6,11 @@ import com.baomidou.mybatisplus.annotation.TableId; |
6 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
7 | 7 | import io.swagger.annotations.ApiModel; |
8 | 8 | import io.swagger.annotations.ApiModelProperty; |
9 | + | |
9 | 10 | import java.io.Serializable; |
10 | 11 | import java.util.Date; |
11 | 12 | |
12 | -@ApiModel(value="com.huaheng.pc.receipt.receiptType.domain.ReceiptType") | |
13 | +@ApiModel(value="com.huaheng.pc.config.receiptType.domain.ReceiptType") | |
13 | 14 | @TableName(value = "receipt_type") |
14 | 15 | public class ReceiptType implements Serializable { |
15 | 16 | /** |
... | ... | @@ -59,7 +60,7 @@ public class ReceiptType implements Serializable { |
59 | 60 | */ |
60 | 61 | @TableField(value = "enable") |
61 | 62 | @ApiModelProperty(value="是否启用") |
62 | - private String enable; | |
63 | + private Boolean enable; | |
63 | 64 | |
64 | 65 | /** |
65 | 66 | * 创建时间 |
... | ... | @@ -314,7 +315,7 @@ public class ReceiptType implements Serializable { |
314 | 315 | * |
315 | 316 | * @return enable - 是否启用 |
316 | 317 | */ |
317 | - public String getEnable() { | |
318 | + public Boolean getEnable() { | |
318 | 319 | return enable; |
319 | 320 | } |
320 | 321 | |
... | ... | @@ -323,7 +324,7 @@ public class ReceiptType implements Serializable { |
323 | 324 | * |
324 | 325 | * @param enable 是否启用 |
325 | 326 | */ |
326 | - public void setEnable(String enable) { | |
327 | + public void setEnable(Boolean enable) { | |
327 | 328 | this.enable = enable; |
328 | 329 | } |
329 | 330 | |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptType/mapper/ReceiptTypeMapper.java renamed to src/main/java/com/huaheng/pc/config/receiptType/mapper/ReceiptTypeMapper.java
1 | -package com.huaheng.pc.receipt.receiptType.mapper; | |
1 | +package com.huaheng.pc.config.receiptType.mapper; | |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | -import com.huaheng.pc.receipt.receiptType.domain.ReceiptType; | |
4 | +import com.huaheng.pc.config.receiptType.domain.ReceiptType; | |
5 | 5 | |
6 | 6 | public interface ReceiptTypeMapper extends BaseMapper<ReceiptType> { |
7 | 7 | } |
8 | 8 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptType/service/ReceiptTypeService.java renamed to src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeService.java
1 | -package com.huaheng.pc.receipt.receiptType.service; | |
1 | +package com.huaheng.pc.config.receiptType.service; | |
2 | 2 | |
3 | -import com.huaheng.pc.receipt.receiptType.domain.ReceiptType; | |
4 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | +import com.huaheng.pc.config.receiptType.domain.ReceiptType; | |
5 | + | |
5 | 6 | public interface ReceiptTypeService extends IService<ReceiptType>{ |
6 | 7 | |
7 | 8 | |
... | ... |
src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeServiceImpl.java
0 → 100644
1 | +package com.huaheng.pc.config.receiptType.service; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
4 | +import com.huaheng.pc.config.receiptType.domain.ReceiptType; | |
5 | +import com.huaheng.pc.config.receiptType.mapper.ReceiptTypeMapper; | |
6 | +import org.springframework.stereotype.Service; | |
7 | + | |
8 | +@Service | |
9 | +public class ReceiptTypeServiceImpl extends ServiceImpl<ReceiptTypeMapper, ReceiptType> implements ReceiptTypeService { | |
10 | + | |
11 | +} | |
... | ... |
src/main/java/com/huaheng/pc/general/carrier/controller/CarrierController.java
0 → 100644
1 | +package com.huaheng.pc.general.carrier.controller; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
6 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
7 | +import com.huaheng.common.support.Convert; | |
8 | +import com.huaheng.common.utils.StringUtils; | |
9 | +import com.huaheng.common.utils.security.ShiroUtils; | |
10 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | |
11 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | |
12 | +import com.huaheng.framework.web.controller.BaseController; | |
13 | +import com.huaheng.framework.web.domain.AjaxResult; | |
14 | +import com.huaheng.framework.web.page.PageDomain; | |
15 | +import com.huaheng.framework.web.page.TableDataInfo; | |
16 | +import com.huaheng.framework.web.page.TableSupport; | |
17 | +import com.huaheng.pc.general.carrier.domain.Carrier; | |
18 | +import com.huaheng.pc.general.carrier.service.CarrierService; | |
19 | +import io.swagger.annotations.ApiOperation; | |
20 | +import io.swagger.annotations.ApiParam; | |
21 | +import org.apache.shiro.authz.annotation.RequiresPermissions; | |
22 | +import org.springframework.stereotype.Controller; | |
23 | +import org.springframework.ui.ModelMap; | |
24 | +import org.springframework.web.bind.annotation.*; | |
25 | + | |
26 | +import javax.annotation.Resource; | |
27 | +import java.util.ArrayList; | |
28 | +import java.util.List; | |
29 | + | |
30 | +/** | |
31 | + * 承运商 | |
32 | + */ | |
33 | +@Controller | |
34 | +@RequestMapping("/general/carrier") | |
35 | +public class CarrierController extends BaseController { | |
36 | + | |
37 | + private String prefix = "general/carrier"; | |
38 | + | |
39 | + @Resource | |
40 | + private CarrierService carrierService; | |
41 | + | |
42 | + @RequiresPermissions("general:carrier:view") | |
43 | + @GetMapping() | |
44 | + public String bomHeader() { | |
45 | + return prefix + "/carrier"; | |
46 | + } | |
47 | + | |
48 | + /** | |
49 | + * 查询承运商列表 | |
50 | + */ | |
51 | + @ApiOperation(value="查看承运商列表", notes="根据承运商编码、名称、创建时间获取承运商信息", httpMethod = "POST") | |
52 | + @RequiresPermissions("general:carrier:list") | |
53 | + @Log(title = "通用-承运商管理", operating = "查看承运商列表", action = BusinessType.GRANT) | |
54 | + @PostMapping("/list") | |
55 | + @ResponseBody | |
56 | + public TableDataInfo list( | |
57 | + @ApiParam(name="carrier",value="承运商编码、名称") Carrier carrier, | |
58 | + @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin, | |
59 | + @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) { | |
60 | + LambdaQueryWrapper<Carrier> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
61 | + PageDomain pageDomain = TableSupport.buildPageRequest(); | |
62 | + Integer pageNum = pageDomain.getPageNum(); | |
63 | + Integer pageSize = pageDomain.getPageSize(); | |
64 | + lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), Carrier::getCreated, createdBegin) | |
65 | + .lt(StringUtils.isNotEmpty(createdEnd), Carrier::getCreated, createdEnd) | |
66 | + .eq(StringUtils.isNotEmpty(carrier.getCode()), Carrier::getCode, carrier.getCode()) | |
67 | + .eq(StringUtils.isNotEmpty(carrier.getName()), Carrier::getName, carrier.getName()) | |
68 | + .eq(Carrier::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
69 | + | |
70 | + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ | |
71 | + /*使用分页查询*/ | |
72 | + Page<Carrier> page = new Page<>(pageNum, pageSize); | |
73 | + IPage<Carrier> iPage = carrierService.page(page, lambdaQueryWrapper); | |
74 | + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | |
75 | + } else { | |
76 | + List<Carrier> list = carrierService.list(lambdaQueryWrapper); | |
77 | + return getDataTable(list); | |
78 | + } | |
79 | + } | |
80 | + | |
81 | + /** | |
82 | + * 新增承运商 | |
83 | + */ | |
84 | + @GetMapping("/add") | |
85 | + public String add() { | |
86 | + return prefix + "/add"; | |
87 | + } | |
88 | + | |
89 | + /** | |
90 | + * 新增保存承运商 | |
91 | + */ | |
92 | + @ApiOperation(value="新增承运商", notes="新增承运商", httpMethod = "POST") | |
93 | + @RequiresPermissions("general:carrier:add") | |
94 | + @Log(title = "通用-承运商", operating = "新增承运商", action = BusinessType.INSERT) | |
95 | + @PostMapping("/add") | |
96 | + @ResponseBody | |
97 | + public AjaxResult addSave(@ApiParam(name = "containerType", value = "承运商", required = true) | |
98 | + Carrier carrier) { | |
99 | + carrier.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
100 | + carrier.setCreatedBy(ShiroUtils.getLoginName()); | |
101 | + carrier.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
102 | + return toAjax(carrierService.save(carrier)); | |
103 | + } | |
104 | + | |
105 | + /** | |
106 | + * 修改承运商 | |
107 | + */ | |
108 | + @GetMapping("/edit/{id}") | |
109 | + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | |
110 | + mmap.put("carrier", carrierService.getById(id)); | |
111 | + return prefix + "/edit"; | |
112 | + } | |
113 | + | |
114 | + /** | |
115 | + * 修改保存承运商 | |
116 | + */ | |
117 | + @ApiOperation(value="修改承运商", notes="修改承运商", httpMethod = "POST") | |
118 | + @RequiresPermissions("general:carrier:edit") | |
119 | + @Log(title = "通用-承运商", operating = "修改承运商", action = BusinessType.UPDATE) | |
120 | + @PostMapping("/edit") | |
121 | + @ResponseBody | |
122 | + public AjaxResult editSave( | |
123 | + @ApiParam(name = "carrier", value = "承运商", required = true)Carrier carrier) { | |
124 | + carrier.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
125 | + return toAjax(carrierService.updateById(carrier)); | |
126 | + } | |
127 | + | |
128 | + /** | |
129 | + * 删除承运商 | |
130 | + */ | |
131 | + @ApiOperation(value="删除承运商", notes="根据id批量删除承运商,参数示例1,2,3", httpMethod = "POST") | |
132 | + @RequiresPermissions("general:carrier:remove") | |
133 | + @Log(title = "通用-承运商", operating = "删除承运商", action = BusinessType.DELETE) | |
134 | + @PostMapping( "/remove") | |
135 | + @ResponseBody | |
136 | + public AjaxResult remove(String ids) { | |
137 | + if (StringUtils.isEmpty(ids)){ | |
138 | + return AjaxResult.error("id不能为空"); | |
139 | + } | |
140 | + List<Integer> list = new ArrayList<>(); | |
141 | + for (Integer id : Convert.toIntArray(ids)) { | |
142 | + list.add(id); | |
143 | + } | |
144 | + return toAjax(carrierService.removeByIds(list)); | |
145 | + } | |
146 | +} | |
... | ... |
src/main/java/com/huaheng/pc/general/material/controller/MaterialController.java
... | ... | @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
6 | 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
7 | 7 | import com.huaheng.common.support.Convert; |
8 | 8 | import com.huaheng.common.utils.StringUtils; |
9 | +import com.huaheng.common.utils.poi.ExcelUtil; | |
9 | 10 | import com.huaheng.common.utils.security.ShiroUtils; |
10 | 11 | import com.huaheng.framework.aspectj.lang.annotation.Log; |
11 | 12 | import com.huaheng.framework.aspectj.lang.constant.BusinessType; |
... | ... | @@ -28,6 +29,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; |
28 | 29 | import org.springframework.stereotype.Controller; |
29 | 30 | import org.springframework.ui.ModelMap; |
30 | 31 | import org.springframework.web.bind.annotation.*; |
32 | +import org.springframework.web.multipart.MultipartFile; | |
31 | 33 | |
32 | 34 | import javax.annotation.Resource; |
33 | 35 | import java.util.List; |
... | ... | @@ -179,4 +181,23 @@ public class MaterialController extends BaseController { |
179 | 181 | } |
180 | 182 | } |
181 | 183 | |
184 | + @PostMapping("/importData") | |
185 | + @ResponseBody | |
186 | + public AjaxResult importData(MultipartFile file) throws Exception { | |
187 | + ExcelUtil<Material> util = new ExcelUtil<>(Material.class); | |
188 | + List<Material> materialList = util.importExcel(file.getInputStream()); | |
189 | + String operName = ShiroUtils.getLoginName(); | |
190 | + Boolean updateSupport = false; | |
191 | + String message = materialService.importMaterial(materialList, updateSupport, operName); | |
192 | + return AjaxResult.success(message); | |
193 | + } | |
194 | + | |
195 | + @GetMapping("/importTemplate") | |
196 | + @ResponseBody | |
197 | + public AjaxResult importTemplate() { | |
198 | + ExcelUtil<Material> util = new ExcelUtil<>(Material.class); | |
199 | + return util.importTemplateExcel("物料"); | |
200 | + } | |
201 | + | |
202 | + | |
182 | 203 | } |
... | ... |
src/main/java/com/huaheng/pc/general/material/domain/Material.java
... | ... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; |
4 | 4 | import com.baomidou.mybatisplus.annotation.TableField; |
5 | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
6 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
7 | +import com.huaheng.framework.aspectj.lang.annotation.Excel; | |
7 | 8 | import io.swagger.annotations.ApiModel; |
8 | 9 | import io.swagger.annotations.ApiModelProperty; |
9 | 10 | import java.io.Serializable; |
... | ... | @@ -17,8 +18,9 @@ public class Material implements Serializable { |
17 | 18 | /** |
18 | 19 | * ID |
19 | 20 | */ |
20 | - @TableId(value = "id", type = IdType.AUTO) | |
21 | + @TableId(value = "id", type = IdType.AUTO) | |
21 | 22 | @ApiModelProperty(value="ID") |
23 | + @Excel(name = "ID") | |
22 | 24 | private Integer id; |
23 | 25 | |
24 | 26 | /** |
... | ... | @@ -26,6 +28,7 @@ public class Material implements Serializable { |
26 | 28 | */ |
27 | 29 | @TableField(value = "code") |
28 | 30 | @ApiModelProperty(value="物料编码") |
31 | + @Excel(name = "物料编码") | |
29 | 32 | private String code; |
30 | 33 | |
31 | 34 | /** |
... | ... | @@ -33,6 +36,7 @@ public class Material implements Serializable { |
33 | 36 | */ |
34 | 37 | @TableField(value = "companyCode") |
35 | 38 | @ApiModelProperty(value="货主编码") |
39 | + @Excel(name = "货主编码") | |
36 | 40 | private String companyCode; |
37 | 41 | |
38 | 42 | /** |
... | ... | @@ -40,6 +44,7 @@ public class Material implements Serializable { |
40 | 44 | */ |
41 | 45 | @TableField(value = "warehouseCode") |
42 | 46 | @ApiModelProperty(value="仓库编码") |
47 | + @Excel(name = "仓库编码") | |
43 | 48 | private String warehouseCode; |
44 | 49 | |
45 | 50 | /** |
... | ... | @@ -47,6 +52,7 @@ public class Material implements Serializable { |
47 | 52 | */ |
48 | 53 | @TableField(value = "name") |
49 | 54 | @ApiModelProperty(value="名称") |
55 | + @Excel(name = "名称") | |
50 | 56 | private String name; |
51 | 57 | |
52 | 58 | /** |
... | ... | @@ -54,6 +60,7 @@ public class Material implements Serializable { |
54 | 60 | */ |
55 | 61 | @TableField(value = "spec") |
56 | 62 | @ApiModelProperty(value="规格") |
63 | + @Excel(name = "规格") | |
57 | 64 | private String spec; |
58 | 65 | |
59 | 66 | /** |
... | ... | @@ -61,6 +68,7 @@ public class Material implements Serializable { |
61 | 68 | */ |
62 | 69 | @TableField(value = "unit") |
63 | 70 | @ApiModelProperty(value="单位") |
71 | + @Excel(name = "单位") | |
64 | 72 | private String unit; |
65 | 73 | |
66 | 74 | /** |
... | ... | @@ -68,6 +76,7 @@ public class Material implements Serializable { |
68 | 76 | */ |
69 | 77 | @TableField(value = "type") |
70 | 78 | @ApiModelProperty(value="类别") |
79 | + @Excel(name = "类别") | |
71 | 80 | private String type; |
72 | 81 | |
73 | 82 | /** |
... | ... | @@ -75,6 +84,7 @@ public class Material implements Serializable { |
75 | 84 | */ |
76 | 85 | @TableField(value = "abcClass") |
77 | 86 | @ApiModelProperty(value="ABC分类") |
87 | + @Excel(name = "ABC分类") | |
78 | 88 | private String abcClass; |
79 | 89 | |
80 | 90 | /** |
... | ... | @@ -82,6 +92,7 @@ public class Material implements Serializable { |
82 | 92 | */ |
83 | 93 | @TableField(value = "daysToExpire") |
84 | 94 | @ApiModelProperty(value="保质期(天)") |
95 | + @Excel(name = "保质期(天)") | |
85 | 96 | private Integer daysToExpire; |
86 | 97 | |
87 | 98 | /** |
... | ... | @@ -89,6 +100,7 @@ public class Material implements Serializable { |
89 | 100 | */ |
90 | 101 | @TableField(value = "locatingRule") |
91 | 102 | @ApiModelProperty(value="定位规则") |
103 | + @Excel(name = "定位规则") | |
92 | 104 | private String locatingRule; |
93 | 105 | |
94 | 106 | /** |
... | ... | @@ -96,6 +108,7 @@ public class Material implements Serializable { |
96 | 108 | */ |
97 | 109 | @TableField(value = "allocationRule") |
98 | 110 | @ApiModelProperty(value="分配规则") |
111 | + @Excel(name = "分配规则") | |
99 | 112 | private String allocationRule; |
100 | 113 | |
101 | 114 | /** |
... | ... | @@ -103,6 +116,7 @@ public class Material implements Serializable { |
103 | 116 | */ |
104 | 117 | @TableField(value = "replenishmentRule") |
105 | 118 | @ApiModelProperty(value="补货规则") |
119 | + @Excel(name = "补货规则") | |
106 | 120 | private String replenishmentRule; |
107 | 121 | |
108 | 122 | /** |
... | ... | @@ -110,6 +124,7 @@ public class Material implements Serializable { |
110 | 124 | */ |
111 | 125 | @TableField(value = "emptyLocRule") |
112 | 126 | @ApiModelProperty(value="空货位规则") |
127 | + @Excel(name = "空货位规则") | |
113 | 128 | private String emptyLocRule; |
114 | 129 | |
115 | 130 | /** |
... | ... | @@ -117,6 +132,7 @@ public class Material implements Serializable { |
117 | 132 | */ |
118 | 133 | @TableField(value = "receivingFlow") |
119 | 134 | @ApiModelProperty(value="入库流程") |
135 | + @Excel(name = "入库流程") | |
120 | 136 | private String receivingFlow; |
121 | 137 | |
122 | 138 | /** |
... | ... | @@ -124,6 +140,7 @@ public class Material implements Serializable { |
124 | 140 | */ |
125 | 141 | @TableField(value = "shippingFlow") |
126 | 142 | @ApiModelProperty(value="出库流程") |
143 | + @Excel(name = "出库流程") | |
127 | 144 | private String shippingFlow; |
128 | 145 | |
129 | 146 | /** |
... | ... | @@ -131,6 +148,7 @@ public class Material implements Serializable { |
131 | 148 | */ |
132 | 149 | @TableField(value = "attributeTemplateCode") |
133 | 150 | @ApiModelProperty(value="属性模版") |
151 | + @Excel(name = "属性模版") | |
134 | 152 | private String attributeTemplateCode; |
135 | 153 | |
136 | 154 | /** |
... | ... | @@ -138,6 +156,7 @@ public class Material implements Serializable { |
138 | 156 | */ |
139 | 157 | @TableField(value = "trackSerialNum") |
140 | 158 | @ApiModelProperty(value="记录序列号") |
159 | + @Excel(name = "记录序列号") | |
141 | 160 | private Integer trackSerialNum; |
142 | 161 | |
143 | 162 | /** |
... | ... | @@ -145,6 +164,7 @@ public class Material implements Serializable { |
145 | 164 | */ |
146 | 165 | @TableField(value = "autoGenSerialNum") |
147 | 166 | @ApiModelProperty(value="自动生成序列号") |
167 | + @Excel(name = "自动生成序列号") | |
148 | 168 | private Integer autoGenSerialNum; |
149 | 169 | |
150 | 170 | /** |
... | ... | @@ -152,6 +172,7 @@ public class Material implements Serializable { |
152 | 172 | */ |
153 | 173 | @TableField(value = "autoGenSerialNumFormat") |
154 | 174 | @ApiModelProperty(value="自动生成序列号表达式") |
175 | + @Excel(name = "自动生成序列号表达式") | |
155 | 176 | private String autoGenSerialNumFormat; |
156 | 177 | |
157 | 178 | /** |
... | ... | @@ -159,6 +180,7 @@ public class Material implements Serializable { |
159 | 180 | */ |
160 | 181 | @TableField(value = "snTemplateCode") |
161 | 182 | @ApiModelProperty(value="序列号模版") |
183 | + @Excel(name = "序列号模版") | |
162 | 184 | private String snTemplateCode; |
163 | 185 | |
164 | 186 | /** |
... | ... | @@ -166,6 +188,7 @@ public class Material implements Serializable { |
166 | 188 | */ |
167 | 189 | @TableField(value = "expiringDays") |
168 | 190 | @ApiModelProperty(value="临期预警天数") |
191 | + @Excel(name = "临期预警天数") | |
169 | 192 | private Integer expiringDays; |
170 | 193 | |
171 | 194 | /** |
... | ... | @@ -173,6 +196,7 @@ public class Material implements Serializable { |
173 | 196 | */ |
174 | 197 | @TableField(value = "minShelfLifeDays") |
175 | 198 | @ApiModelProperty(value="收货预警天数") |
199 | + @Excel(name = "收货预警天数") | |
176 | 200 | private Integer minShelfLifeDays; |
177 | 201 | |
178 | 202 | /** |
... | ... | @@ -194,6 +218,7 @@ public class Material implements Serializable { |
194 | 218 | */ |
195 | 219 | @TableField(value = "createdBy") |
196 | 220 | @ApiModelProperty(value="创建用户") |
221 | + | |
197 | 222 | private String createdBy; |
198 | 223 | |
199 | 224 | /** |
... | ... | @@ -215,6 +240,7 @@ public class Material implements Serializable { |
215 | 240 | */ |
216 | 241 | @TableField(value = "version") |
217 | 242 | @ApiModelProperty(value="数据版本") |
243 | + @Excel(name = "数据版本") | |
218 | 244 | private Integer version; |
219 | 245 | |
220 | 246 | /** |
... | ... | @@ -222,6 +248,7 @@ public class Material implements Serializable { |
222 | 248 | */ |
223 | 249 | @TableField(value = "userDef1") |
224 | 250 | @ApiModelProperty(value="是否AGV区域发货") |
251 | + @Excel(name = "是否AGV区域发货") | |
225 | 252 | private String userDef1; |
226 | 253 | |
227 | 254 | /** |
... | ... |
src/main/java/com/huaheng/pc/general/material/service/MaterialService.java
... | ... | @@ -3,8 +3,15 @@ package com.huaheng.pc.general.material.service; |
3 | 3 | import com.huaheng.framework.web.domain.AjaxResult; |
4 | 4 | import com.huaheng.pc.general.material.domain.Material; |
5 | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
6 | + | |
7 | +import java.util.List; | |
8 | + | |
6 | 9 | public interface MaterialService extends IService<Material>{ |
7 | 10 | |
8 | 11 | AjaxResult removeByIds(String ids); |
9 | 12 | |
13 | + | |
14 | + public String importMaterial(List<Material> materialList, Boolean updateSupport,String operName); | |
15 | + | |
16 | + | |
10 | 17 | } |
... | ... |
src/main/java/com/huaheng/pc/general/material/service/MaterialServiceImpl.java
... | ... | @@ -2,7 +2,9 @@ package com.huaheng.pc.general.material.service; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | +import com.huaheng.common.exception.BusinessException; | |
5 | 6 | import com.huaheng.common.support.Convert; |
7 | +import com.huaheng.common.utils.StringUtils; | |
6 | 8 | import com.huaheng.common.utils.security.ShiroUtils; |
7 | 9 | import com.huaheng.framework.web.domain.AjaxResult; |
8 | 10 | import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; |
... | ... | @@ -16,6 +18,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
16 | 18 | import com.huaheng.pc.general.material.mapper.MaterialMapper; |
17 | 19 | import com.huaheng.pc.general.material.domain.Material; |
18 | 20 | import com.huaheng.pc.general.material.service.MaterialService; |
21 | +import org.springframework.transaction.annotation.Transactional; | |
22 | + | |
19 | 23 | @Service |
20 | 24 | public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService{ |
21 | 25 | |
... | ... | @@ -46,4 +50,50 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i |
46 | 50 | } |
47 | 51 | return AjaxResult.success("成功删除"+count+"条记录"); |
48 | 52 | } |
53 | + | |
54 | + /** | |
55 | + * 导入物料数据 | |
56 | + * | |
57 | + * @param materialList 用户数据列表 | |
58 | + * @param operName 操作用户 | |
59 | + * @return 结果 | |
60 | + */ | |
61 | + @Override | |
62 | + public String importMaterial(List<Material> materialList, Boolean isUpdateSupport, String operName) { | |
63 | + if (StringUtils.isNull(materialList) || materialList.size() == 0) { | |
64 | + throw new BusinessException("导入数据不能为空!"); | |
65 | + } | |
66 | + int successNum = 0; | |
67 | + int failureNum = 0; | |
68 | + StringBuilder successMsg = new StringBuilder(); | |
69 | + StringBuilder failureMsg = new StringBuilder(); | |
70 | + for (Material material : materialList) { | |
71 | + try { | |
72 | + LambdaQueryWrapper<Material> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
73 | + lambdaQueryWrapper.eq(Material::getCode, material.getCode()); | |
74 | + // 验证是否存在这个用户 | |
75 | + Material m = this.getOne(lambdaQueryWrapper); | |
76 | + if (StringUtils.isNull(m)) { | |
77 | + System.out.println(ShiroUtils.getLoginName()); | |
78 | + material.setCreatedBy(ShiroUtils.getUser().getLoginName()); | |
79 | + material.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
80 | + this.save(material); | |
81 | + successNum++; | |
82 | + successMsg.append("<br/>" + successNum + "、编码 " + material.getCode() + " 导入成功"); | |
83 | + } | |
84 | + } catch (Exception e) { | |
85 | + failureNum++; | |
86 | + String msg = "<br/>" + failureNum + "、编码" + material.getCode() + " 导入失败:"; | |
87 | + failureMsg.append(msg + e.getMessage()); | |
88 | + log.error(msg, e); | |
89 | + } | |
90 | + } | |
91 | + if (failureNum > 0) { | |
92 | + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); | |
93 | + throw new BusinessException(failureMsg.toString()); | |
94 | + } else { | |
95 | + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); | |
96 | + } | |
97 | + return successMsg.toString(); | |
98 | + } | |
49 | 99 | } |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptType/service/ReceiptTypeServiceImpl.java deleted
1 | -package com.huaheng.pc.receipt.receiptType.service; | |
2 | - | |
3 | -import org.springframework.stereotype.Service; | |
4 | -import javax.annotation.Resource; | |
5 | -import java.util.List; | |
6 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
7 | -import com.huaheng.pc.receipt.receiptType.domain.ReceiptType; | |
8 | -import com.huaheng.pc.receipt.receiptType.mapper.ReceiptTypeMapper; | |
9 | -import com.huaheng.pc.receipt.receiptType.service.ReceiptTypeService; | |
10 | -@Service | |
11 | -public class ReceiptTypeServiceImpl extends ServiceImpl<ReceiptTypeMapper, ReceiptType> implements ReceiptTypeService{ | |
12 | - | |
13 | -} |
src/main/java/com/huaheng/pc/report/excelReport/controller/ExcelReportController.java
... | ... | @@ -41,7 +41,7 @@ public class ExcelReportController extends BaseController { |
41 | 41 | @GetMapping("/getreport") |
42 | 42 | @ResponseBody |
43 | 43 | public void getReport(@RequestParam Map<String, String> params,HttpServletResponse response){ |
44 | - excelReportService.getReport(params, response); | |
44 | +// excelReportService.getReport(params, response); | |
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
... | ... | @@ -67,7 +67,8 @@ public class ExcelReportController extends BaseController { |
67 | 67 | @ResponseBody |
68 | 68 | public AjaxResult addSave(Excelreport excelreport) |
69 | 69 | { |
70 | - return excelReportService.save(excelreport); | |
70 | +// return excelReportService.save(excelreport); | |
71 | + return AjaxResult.success(1); | |
71 | 72 | } |
72 | 73 | |
73 | 74 | @GetMapping("/edit/{id}") |
... | ... |
src/main/java/com/huaheng/pc/report/excelReport/service/ExcelReportService.java
... | ... | @@ -21,34 +21,34 @@ public class ExcelReportService { |
21 | 21 | @Resource |
22 | 22 | private ExcelReportMapper mapper; |
23 | 23 | |
24 | - public void getReport(@RequestParam Map<String, String> params, HttpServletResponse response) { | |
25 | - if(!params.containsKey("id")){ | |
26 | -// return AjaxResult.error("未传递Id"); | |
27 | - return; | |
28 | - } | |
29 | - Excelreport excelreport = mapper.selectById(Convert.toInt(params.get("id"))); | |
30 | - if(excelreport==null){ | |
31 | -// return AjaxResult.error("报表未配置"); | |
32 | - return; | |
33 | - } | |
34 | - List<LinkedHashMap<String, Object>> list = mapper.selectCommon(excelreport.getSql()); | |
35 | - ExcelUtil excelUtil = new ExcelUtil(); | |
36 | - excelUtil.exportExcel2(list, excelreport.getName(),response); | |
37 | - } | |
38 | - | |
39 | - public AjaxResult save(Excelreport excelreport) { | |
40 | - String sql = excelreport.getSql().toLowerCase(); | |
41 | - if(sql.contains("delete")||sql.contains("update")||sql.contains("drop")){ | |
42 | - return AjaxResult.error("含有危险sql脚本"); | |
43 | - } | |
44 | - excelreport.setCreated(new Date()); | |
45 | - excelreport.setCreatedBy(ShiroUtils.getLoginName()); | |
46 | - excelreport.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
47 | - int i = mapper.insert(excelreport); | |
48 | - if(i>0){ | |
49 | - return AjaxResult.success("成功"); | |
50 | - }else { | |
51 | - return AjaxResult.error("新增失败"); | |
52 | - } | |
53 | - } | |
24 | +// public void getReport(@RequestParam Map<String, String> params, HttpServletResponse response) { | |
25 | +// if(!params.containsKey("id")){ | |
26 | +//// return AjaxResult.error("未传递Id"); | |
27 | +// return; | |
28 | +// } | |
29 | +// Excelreport excelreport = mapper.selectById(Convert.toInt(params.get("id"))); | |
30 | +// if(excelreport==null){ | |
31 | +//// return AjaxResult.error("报表未配置"); | |
32 | +// return; | |
33 | +// } | |
34 | +// List<LinkedHashMap<String, Object>> list = mapper.selectCommon(excelreport.getSql()); | |
35 | +// ExcelUtil excelUtil = new ExcelUtil(); | |
36 | +// excelUtil.exportExcel2(list, excelreport.getName(),response); | |
37 | +// } | |
38 | +// | |
39 | +// public AjaxResult save(Excelreport excelreport) { | |
40 | +// String sql = excelreport.getSql().toLowerCase(); | |
41 | +// if(sql.contains("delete")||sql.contains("update")||sql.contains("drop")){ | |
42 | +// return AjaxResult.error("含有危险sql脚本"); | |
43 | +// } | |
44 | +// excelreport.setCreated(new Date()); | |
45 | +// excelreport.setCreatedBy(ShiroUtils.getLoginName()); | |
46 | +// excelreport.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
47 | +// int i = mapper.insert(excelreport); | |
48 | +// if(i>0){ | |
49 | +// return AjaxResult.success("成功"); | |
50 | +// }else { | |
51 | +// return AjaxResult.error("新增失败"); | |
52 | +// } | |
53 | +// } | |
54 | 54 | } |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/domain/ShipmentDetail.java
src/main/java/com/huaheng/pc/tool/in/importController.java
0 → 100644
1 | +package com.huaheng.pc.tool.in; | |
2 | + | |
3 | +import org.apache.shiro.authz.annotation.RequiresPermissions; | |
4 | +import org.springframework.stereotype.Controller; | |
5 | +import org.springframework.web.bind.annotation.GetMapping; | |
6 | +import org.springframework.web.bind.annotation.RequestMapping; | |
7 | + | |
8 | +@Controller | |
9 | +@RequestMapping("/tool/import") | |
10 | +public class importController { | |
11 | + | |
12 | + private String prefix = "tool/import"; | |
13 | + | |
14 | + @RequiresPermissions("tool:import:view") | |
15 | + @GetMapping() | |
16 | + public String in() { | |
17 | + return prefix + "/import"; | |
18 | + } | |
19 | +} | |
... | ... |
src/main/resources/application-druid.properties
1 | -#\u6570\u636E\u6E90\u914D\u7F6E | |
1 | +# 数据源配置 | |
2 | 2 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
3 | 3 | spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver |
4 | -#\u4E3B\u5E93 | |
4 | +# 主库 | |
5 | 5 | spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false |
6 | 6 | #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/huahengExample?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false |
7 | 7 | #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/huaheng?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false |
... | ... | @@ -11,12 +11,12 @@ spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnic |
11 | 11 | |
12 | 12 | spring.datasource.druid.master.username=softhuaheng |
13 | 13 | spring.datasource.druid.master.password=HHrobot123. |
14 | -##\u4ECE\u5E93 | |
14 | +# 从库 | |
15 | 15 | #spring.datasource.druid.slave.open = true |
16 | 16 | #spring.datasource.druid.slave.url=jdbc:mysql://172.16.29.45:3306/huaheng?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false |
17 | 17 | #spring.datasource.druid.master.username=softhuaheng |
18 | 18 | #spring.datasource.druid.master.password=HHrobot123. |
19 | -# \u521D\u59CB\u8FDE\u63A5\u6570 | |
19 | +# 初始连接数 | |
20 | 20 | spring.datasource.druid.initial-size=10 |
21 | 21 | # \u6700\u5927\u8FDE\u63A5\u6C60\u6570\u91CF |
22 | 22 | spring.datasource.druid.max-active=100 |
... | ... |
src/main/resources/application.properties deleted
1 | -#\u9879\u76EE\u76F8\u5173\u914D\u7F6E | |
2 | -#\u540D\u79F0 | |
3 | -huaheng.name=huaheng | |
4 | -#\u7248\u672C | |
5 | -huaheng.version=4.0.0 | |
6 | -#\u7248\u6743\u5E74\u4EFD | |
7 | -huaheng.copyrightYear=2018 | |
8 | -#\u5934\u50CF\u4E0A\u4F20\u8DEF\u5F84 | |
9 | -huaheng.profile=C:/profile/ | |
10 | -# \u83B7\u53D6ip\u5730\u5740\u5F00\u5173 | |
11 | -huaheng.addressEnabled=false | |
12 | - | |
13 | -#\u5F00\u53D1\u73AF\u5883\u914D\u7F6E | |
14 | -#\u6D4B\u8BD5\u670D\u52A1\u7AEF\u53E3\u3001\u6D4B\u8BD5\u9879\u76EEcontextPath | |
15 | -server.port=8888 | |
16 | -server.servlet.context-path=/twms/ | |
17 | -#\u793A\u4F8B\u670D\u52A1\u7AEF\u53E3\u3001\u793A\u4F8B\u9879\u76EEcontextPath | |
18 | -#server.port=8889 | |
19 | -#server.servlet.context-path=/ewms/ | |
20 | -#\u6B63\u5F0F\u670D\u52A1\u7AEF\u53E3\u3001\u6B63\u5F0F\u9879\u76EEcontextPath | |
21 | -#server.port=8016 | |
22 | -#server.servlet.context-path=/wms/ | |
23 | -# tomcat\u7684URI\u7F16\u7801 | |
24 | -server.tomcat.uri-encoding=UTF-8 | |
25 | -# tomcat\u6700\u5927\u7EBF\u7A0B\u6570\uFF0C\u9ED8\u8BA4\u4E3A200 | |
26 | -server.tomcat.max-threads=800 | |
27 | -# Tomcat\u542F\u52A8\u521D\u59CB\u5316\u7684\u7EBF\u7A0B\u6570\uFF0C\u9ED8\u8BA4\u503C25 | |
28 | -server.tomcat.min-spare-threads=30 | |
29 | - | |
30 | -#\u65E5\u5FD7\u914D\u7F6E | |
31 | -logging.level.com.huaheng=DEBUG | |
32 | -logging.level.org.springframework=WARN | |
33 | -logging.level.org.spring.springboot.dao=DEBUG | |
34 | - | |
35 | -#\u7528\u6237\u914D\u7F6E | |
36 | -#\u5BC6\u7801\u9519\u8BEF5\u6B21\u9501\u5B9A10\u5206\u949F | |
37 | -user.password.maxRetryCount=5 | |
38 | - | |
39 | -#Spring\u914D\u7F6E | |
40 | -spring.thymeleaf.mode=HTML | |
41 | -spring.thymeleaf.encoding=utf-8 | |
42 | -# \u7981\u7528\u7F13\u5B58 | |
43 | -spring.thymeleaf.cache=false | |
44 | -#\u56FD\u9645\u5316\u8D44\u6E90\u6587\u4EF6\u8DEF\u5F84 | |
45 | -spring.messages.basename=i18n/messages | |
46 | -spring.jackson.time-zone=GMT+8 | |
47 | -spring.jackson.date-format=yyyy-MM-dd HH:mm:ss | |
48 | -spring.profiles.active=druid | |
49 | -#\u6587\u4EF6\u4E0A\u4F20 | |
50 | -spring.servlet.multipart.max-file-size=30MB | |
51 | -spring.servlet.multipart.max-request-size=30MB | |
52 | -#\u70ED\u90E8\u7F72\u5F00\u5173 | |
53 | -spring.devtools.restart.enabled=true | |
54 | -#activiti \u81EA\u52A8\u90E8\u7F72\u9A8C\u8BC1\u8BBE\u7F6E | |
55 | -#spring.activiti.check-process-definitions=false | |
56 | - | |
57 | -mybatis-plus.mapper-locations=classpath:mybatis/**/*.xml | |
58 | -mybatis-plus.type-aliases-package=com.huaheng.pc.**.**.domain | |
59 | - | |
60 | -# PageHelper | |
61 | -pagehelper.helperDialect=mysql | |
62 | -pagehelper.reasonable=true | |
63 | -pagehelper.supportMethodsArguments=true | |
64 | -pagehelper.pparams=count=countSql | |
65 | - | |
66 | -# Shiro | |
67 | -# \u767B\u5F55\u5730\u5740 | |
68 | -shiro.user.loginUrl=/login | |
69 | -# \u6743\u9650\u8BA4\u8BC1\u5931\u8D25\u5730\u5740 | |
70 | -shiro.user.unauthorizedUrl=/unauth | |
71 | -# \u9996\u9875\u5730\u5740 | |
72 | -shiro.user.indexUrl=/index | |
73 | -# \u9A8C\u8BC1\u7801\u5F00\u5173 | |
74 | -shiro.user.captchaEnabled=false | |
75 | -# \u9A8C\u8BC1\u7801\u7C7B\u578B math \u6570\u7EC4\u8BA1\u7B97 char \u5B57\u7B26 | |
76 | -shiro.user.captchaType=math | |
77 | -# \u8BBE\u7F6ECookie\u7684\u57DF\u540D \u9ED8\u8BA4\u7A7A\uFF0C\u5373\u5F53\u524D\u8BBF\u95EE\u7684\u57DF\u540D | |
78 | -shiro.cookie.domain = | |
79 | -# \u8BBE\u7F6Ecookie\u7684\u6709\u6548\u8BBF\u95EE\u8DEF\u5F84 | |
80 | -shiro.cookie.path=/ | |
81 | -# \u8BBE\u7F6EHttpOnly\u5C5E\u6027 | |
82 | -shiro.cookie.httpOnly=true | |
83 | -# \u8BBE\u7F6ECookie\u7684\u8FC7\u671F\u65F6\u95F4\uFF0C\u5929\u4E3A\u5355\u4F4D | |
84 | -shiro.cookie.maxAge=30 | |
85 | -# Session\u8D85\u65F6\u65F6\u95F4\uFF08\u9ED8\u8BA430\u5206\u949F\uFF09 | |
86 | -shiro.session.expireTime=30 | |
87 | -# \u540C\u6B65session\u5230\u6570\u636E\u5E93\u7684\u5468\u671F\uFF08\u9ED8\u8BA41\u5206\u949F\uFF09 | |
88 | -shiro.session.dbSyncPeriod=1 | |
89 | -# \u76F8\u9694\u591A\u4E45\u68C0\u67E5\u4E00\u6B21session\u7684\u6709\u6548\u6027\uFF0C\u9ED8\u8BA4\u5C31\u662F10\u5206\u949F | |
90 | -shiro.session.validationInterval=10 | |
91 | - | |
92 | -# \u9632\u6B62XSS\u653B\u51FB | |
93 | -# \u8FC7\u6EE4\u5F00\u5173 | |
94 | -xss.enabled=true | |
95 | -# \u6392\u9664\u94FE\u63A5\uFF08\u591A\u4E2A\u7528\u9017\u53F7\u5206\u9694\uFF09 | |
96 | -xss.excludes=/system/notice/* | |
97 | -# \u5339\u914D\u94FE\u63A5 | |
98 | -xss.urlPatterns=/system/*,/monitor/*,/tool/* | |
99 | - | |
100 | -# \u4EE3\u7801\u751F\u6210 | |
101 | -# \u4F5C\u8005 | |
102 | -gen.author=huaheng | |
103 | -# \u9ED8\u8BA4\u751F\u6210\u5305\u8DEF\u5F84 module \u9700\u6539\u6210\u81EA\u5DF1\u7684\u6A21\u5757\u540D\u79F0 \u5982 system monitor tool | |
104 | -gen.packageName=com.huaheng.pc.task | |
105 | -# \u81EA\u52A8\u53BB\u9664\u8868\u524D\u7F00\uFF0C\u9ED8\u8BA4\u662Ftrue | |
106 | -gen.autoRemovePre=false | |
107 | -# \u8868\u524D\u7F00(\u7C7B\u540D\u4E0D\u4F1A\u5305\u542B\u8868\u524D\u7F00) | |
108 | -gen.tablePrefix=sys_ | |
109 | - | |
110 | - | |
111 | - |
src/main/resources/application.yml
0 → 100644
1 | +#\u9879\u76EE\u76F8\u5173\u914D\u7F6E | |
2 | +#\u540D\u79F0 | |
3 | +huaheng: | |
4 | + name: huaheng | |
5 | +#\u7248\u672C | |
6 | + version: 4.0.0 | |
7 | +#\u7248\u6743\u5E74\u4EFD | |
8 | + copyrightYear: 2018 | |
9 | +# \u6587\u4EF6\u8DEF\u5F84 \u793A\u4F8B\uFF08 Windows\u914D\u7F6ED:/ruoyi/uploadPath\uFF0CLinux\u914D\u7F6E /home/ruoyi/uploadPath\uFF09 | |
10 | + profile: D:/ruoyi/uploadPath | |
11 | +# \u83B7\u53D6ip\u5730\u5740\u5F00\u5173 | |
12 | + addressEnabled: false | |
13 | + | |
14 | +#\u5F00\u53D1\u73AF\u5883\u914D\u7F6E | |
15 | +#\u6D4B\u8BD5\u670D\u52A1\u7AEF\u53E3\u3001\u6D4B\u8BD5\u9879\u76EEcontextPath | |
16 | +server: | |
17 | + port: 8888 | |
18 | + servlet: | |
19 | + context-path: /twms/ | |
20 | +#\u793A\u4F8B\u670D\u52A1\u7AEF\u53E3\u3001\u793A\u4F8B\u9879\u76EEcontextPath | |
21 | +#server.port=8889 | |
22 | +#server.servlet.context-path=/ewms/ | |
23 | +#\u6B63\u5F0F\u670D\u52A1\u7AEF\u53E3\u3001\u6B63\u5F0F\u9879\u76EEcontextPath | |
24 | +#server.port=8016 | |
25 | +#server.servlet.context-path=/wms/ | |
26 | +# tomcat\u7684URI\u7F16\u7801 | |
27 | + tomcat: | |
28 | + uri-encoding: UTF-8 | |
29 | +# tomcat\u6700\u5927\u7EBF\u7A0B\u6570\uFF0C\u9ED8\u8BA4\u4E3A200 | |
30 | + max-threads: 800 | |
31 | +# Tomcat\u542F\u52A8\u521D\u59CB\u5316\u7684\u7EBF\u7A0B\u6570\uFF0C\u9ED8\u8BA4\u503C25 | |
32 | + min-spare-threads: 30 | |
33 | + | |
34 | +#\u65E5\u5FD7\u914D\u7F6E | |
35 | +logging: | |
36 | + level: | |
37 | + com.huaheng: debug | |
38 | + org.springframework: warn | |
39 | + spring.springboot.dao: DEBUG | |
40 | + | |
41 | +# \u7528\u6237\u914D\u7F6E | |
42 | +user: | |
43 | + password: | |
44 | + # \u5BC6\u7801\u9519\u8BEF{maxRetryCount}\u6B21\u9501\u5B9A10\u5206\u949F | |
45 | + maxRetryCount: 5 | |
46 | + | |
47 | +# Spring\u914D\u7F6E | |
48 | +spring: | |
49 | + # \u6A21\u677F\u5F15\u64CE | |
50 | + thymeleaf: | |
51 | + mode: HTML | |
52 | + encoding: utf-8 | |
53 | + # \u7981\u7528\u7F13\u5B58 | |
54 | + cache: false | |
55 | +#\u56FD\u9645\u5316\u8D44\u6E90\u6587\u4EF6\u8DEF\u5F84 | |
56 | + messages: | |
57 | + basename: i18n/messages | |
58 | + jackson: | |
59 | + time-zone: GMT+8 | |
60 | + date-format: yyyy-MM-dd HH:mm:ss | |
61 | + profiles: | |
62 | + active: druid | |
63 | + # \u6587\u4EF6\u4E0A\u4F20 | |
64 | + servlet: | |
65 | + multipart: | |
66 | + # \u5355\u4E2A\u6587\u4EF6\u5927\u5C0F | |
67 | + max-file-size: 30MB | |
68 | + # \u8BBE\u7F6E\u603B\u4E0A\u4F20\u7684\u6587\u4EF6\u5927\u5C0F | |
69 | + max-request-size: 30MB | |
70 | + # \u670D\u52A1\u6A21\u5757 | |
71 | + devtools: | |
72 | + restart: | |
73 | + # \u70ED\u90E8\u7F72\u5F00\u5173 | |
74 | + enabled: true | |
75 | + | |
76 | +mybatis-plus: | |
77 | + mapper-locations: classpath:mybatis/**/*.xml | |
78 | + type-aliases-package: com.huaheng.pc.**.**.domain | |
79 | + | |
80 | +# PageHelper\u5206\u9875\u63D2\u4EF6 | |
81 | +pagehelper: | |
82 | + helperDialect: mysql | |
83 | + reasonable: true | |
84 | + supportMethodsArguments: true | |
85 | + params: count=countSql | |
86 | + | |
87 | +# Shiro | |
88 | +shiro: | |
89 | + user: | |
90 | + # \u767B\u5F55\u5730\u5740 | |
91 | + loginUrl: /login | |
92 | + # \u6743\u9650\u8BA4\u8BC1\u5931\u8D25\u5730\u5740 | |
93 | + unauthorizedUrl: /unauth | |
94 | + # \u9996\u9875\u5730\u5740 | |
95 | + indexUrl: /index | |
96 | + # \u9A8C\u8BC1\u7801\u5F00\u5173 | |
97 | + captchaEnabled: false | |
98 | + # \u9A8C\u8BC1\u7801\u7C7B\u578B math \u6570\u7EC4\u8BA1\u7B97 char \u5B57\u7B26 | |
99 | + captchaType: math | |
100 | + cookie: | |
101 | + # \u8BBE\u7F6ECookie\u7684\u57DF\u540D \u9ED8\u8BA4\u7A7A\uFF0C\u5373\u5F53\u524D\u8BBF\u95EE\u7684\u57DF\u540D | |
102 | + domain: | |
103 | + # \u8BBE\u7F6Ecookie\u7684\u6709\u6548\u8BBF\u95EE\u8DEF\u5F84 | |
104 | + path: / | |
105 | + # \u8BBE\u7F6EHttpOnly\u5C5E\u6027 | |
106 | + httpOnly: true | |
107 | + # \u8BBE\u7F6ECookie\u7684\u8FC7\u671F\u65F6\u95F4\uFF0C\u5929\u4E3A\u5355\u4F4D | |
108 | + maxAge: 30 | |
109 | + session: | |
110 | + # Session\u8D85\u65F6\u65F6\u95F4\uFF08\u9ED8\u8BA430\u5206\u949F\uFF09 | |
111 | + expireTime: 30 | |
112 | + # \u540C\u6B65session\u5230\u6570\u636E\u5E93\u7684\u5468\u671F\uFF08\u9ED8\u8BA41\u5206\u949F\uFF09 | |
113 | + dbSyncPeriod: 1 | |
114 | + # \u76F8\u9694\u591A\u4E45\u68C0\u67E5\u4E00\u6B21session\u7684\u6709\u6548\u6027\uFF0C\u9ED8\u8BA4\u5C31\u662F10\u5206\u949F | |
115 | + validationInterval: 10 | |
116 | + | |
117 | +# \u9632\u6B62XSS\u653B\u51FB | |
118 | +xss: | |
119 | + # \u8FC7\u6EE4\u5F00\u5173 | |
120 | + enabled: true | |
121 | + # \u6392\u9664\u94FE\u63A5\uFF08\u591A\u4E2A\u7528\u9017\u53F7\u5206\u9694\uFF09 | |
122 | + excludes: /system/notice/* | |
123 | + # \u5339\u914D\u94FE\u63A5 | |
124 | + urlPatterns: /system/*,/monitor/*,/tool/* | |
125 | + | |
126 | +# \u4EE3\u7801\u751F\u6210 | |
127 | +# \u4F5C\u8005 | |
128 | +gen: | |
129 | + author: huaheng | |
130 | +# \u9ED8\u8BA4\u751F\u6210\u5305\u8DEF\u5F84 module \u9700\u6539\u6210\u81EA\u5DF1\u7684\u6A21\u5757\u540D\u79F0 \u5982 system monitor tool | |
131 | + packageName: com.huaheng.pc.task | |
132 | +# \u81EA\u52A8\u53BB\u9664\u8868\u524D\u7F00\uFF0C\u9ED8\u8BA4\u662Ftrue | |
133 | + autoRemovePre: false | |
134 | +# \u8868\u524D\u7F00(\u7C7B\u540D\u4E0D\u4F1A\u5305\u542B\u8868\u524D\u7F00) | |
135 | + gen.tablePrefix: sys_ | |
136 | + | |
137 | + | |
138 | + | |
... | ... |
src/main/resources/mybatis/receipt/ReceiptTypeMapper.xml renamed to src/main/resources/mybatis/config/ReceiptTypeMapper.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | -<mapper namespace="com.huaheng.pc.receipt.receiptType.mapper.ReceiptTypeMapper"> | |
4 | - <resultMap id="BaseResultMap" type="com.huaheng.pc.receipt.receiptType.domain.ReceiptType"> | |
3 | +<mapper namespace="com.huaheng.pc.config.receiptType.mapper.ReceiptTypeMapper"> | |
4 | + <resultMap id="BaseResultMap" type="com.huaheng.pc.config.receiptType.domain.ReceiptType"> | |
5 | 5 | <!--@mbg.generated--> |
6 | 6 | <id column="id" jdbcType="INTEGER" property="id" /> |
7 | 7 | <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" /> |
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | <result column="code" jdbcType="VARCHAR" property="code" /> |
10 | 10 | <result column="referType" jdbcType="VARCHAR" property="referType" /> |
11 | 11 | <result column="receiptFlow" jdbcType="VARCHAR" property="receiptFlow" /> |
12 | - <result column="enable" jdbcType="VARCHAR" property="enable" /> | |
12 | + <result column="enable" jdbcType="BIT" property="enable" /> | |
13 | 13 | <result column="created" jdbcType="TIMESTAMP" property="created" /> |
14 | 14 | <result column="createdBy" jdbcType="VARCHAR" property="createdBy" /> |
15 | 15 | <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" /> |
... | ... |
src/main/resources/mybatis/general/BomDetailMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | +<mapper namespace="com.huaheng.pc.general.bom.mapper.BomDetailMapper"> | |
4 | + <resultMap id="BaseResultMap" type="com.huaheng.pc.general.bom.domain.BomDetail"> | |
5 | + <!--@mbg.generated--> | |
6 | + <id column="id" jdbcType="INTEGER" property="id" /> | |
7 | + <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" /> | |
8 | + <result column="companyCode" jdbcType="VARCHAR" property="companyCode" /> | |
9 | + <result column="bomId" jdbcType="INTEGER" property="bomId" /> | |
10 | + <result column="materialCode" jdbcType="VARCHAR" property="materialCode" /> | |
11 | + <result column="materialName" jdbcType="VARCHAR" property="materialName" /> | |
12 | + <result column="materialUnit" jdbcType="VARCHAR" property="materialUnit" /> | |
13 | + <result column="buildLevel" jdbcType="INTEGER" property="buildLevel" /> | |
14 | + <result column="buildSequence" jdbcType="INTEGER" property="buildSequence" /> | |
15 | + <result column="qty" jdbcType="INTEGER" property="qty" /> | |
16 | + <result column="allocationRule" jdbcType="VARCHAR" property="allocationRule" /> | |
17 | + <result column="fromLocation" jdbcType="VARCHAR" property="fromLocation" /> | |
18 | + <result column="enable" jdbcType="BIT" property="enable" /> | |
19 | + <result column="created" jdbcType="TIMESTAMP" property="created" /> | |
20 | + <result column="createdBy" jdbcType="VARCHAR" property="createdBy" /> | |
21 | + <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" /> | |
22 | + <result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" /> | |
23 | + <result column="version" jdbcType="INTEGER" property="version" /> | |
24 | + <result column="userDef1" jdbcType="VARCHAR" property="userDef1" /> | |
25 | + <result column="userDef2" jdbcType="VARCHAR" property="userDef2" /> | |
26 | + <result column="userDef3" jdbcType="VARCHAR" property="userDef3" /> | |
27 | + <result column="userDef4" jdbcType="VARCHAR" property="userDef4" /> | |
28 | + <result column="userDef5" jdbcType="VARCHAR" property="userDef5" /> | |
29 | + <result column="userDef6" jdbcType="VARCHAR" property="userDef6" /> | |
30 | + <result column="userDef7" jdbcType="VARCHAR" property="userDef7" /> | |
31 | + <result column="userDef8" jdbcType="VARCHAR" property="userDef8" /> | |
32 | + <result column="processStamp" jdbcType="VARCHAR" property="processStamp" /> | |
33 | + </resultMap> | |
34 | + <sql id="Base_Column_List"> | |
35 | + <!--@mbg.generated--> | |
36 | + id, warehouseCode, companyCode, bomId, materialCode, materialName, materialUnit, | |
37 | + buildLevel, buildSequence, qty, allocationRule, fromLocation, `enable`, created, | |
38 | + createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, userDef4, | |
39 | + userDef5, userDef6, userDef7, userDef8, processStamp | |
40 | + </sql> | |
41 | +</mapper> | |
0 | 42 | \ No newline at end of file |
... | ... |
src/main/resources/static/ajax/libs/layui/lay/modules/upload.js
0 → 100644
1 | +/** layui-v2.4.5 MIT License By https://www.layui.com */ | |
2 | + ;layui.define("layer",function(e){"use strict";var i=layui.$,t=layui.layer,n=layui.hint(),a=layui.device(),o={config:{},set:function(e){var t=this;return t.config=i.extend({},t.config,e),t},on:function(e,i){return layui.onevent.call(this,r,e,i)}},l=function(){var e=this;return{upload:function(i){e.upload.call(e,i)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var t=this;t.config=i.extend({},t.config,o.config,e),t.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var t=this,e=t.config;e.elem=i(e.elem),e.bindAction=i(e.bindAction),t.file(),t.events()},p.prototype.file=function(){var e=this,t=e.config,n=e.elemFile=i(['<input class="'+u+'" type="file" accept="'+t.acceptMime+'" name="'+t.field+'"',t.multiple?" multiple":"",">"].join("")),o=t.elem.next();(o.hasClass(u)||o.hasClass(c))&&o.remove(),a.ie&&a.ie<10&&t.elem.wrap('<div class="layui-upload-wrap"></div>'),e.isFile()?(e.elemFile=t.elem,t.field=t.elem[0].name):t.elem.after(n),a.ie&&a.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,t=e.config,n=i('<iframe id="'+f+'" class="'+f+'" name="'+f+'" frameborder="0"></iframe>'),a=i(['<form target="'+f+'" class="'+c+'" method="post" key="set-mine" enctype="multipart/form-data" action="'+t.url+'">',"</form>"].join(""));i("#"+f)[0]||i("body").append(n),t.elem.next().hasClass(c)||(e.elemFile.wrap(a),t.elem.next("."+c).append(function(){var e=[];return layui.each(t.data,function(i,t){t="function"==typeof t?t():t,e.push('<input type="hidden" name="'+i+'" value="'+t+'">')}),e.join("")}()))},p.prototype.msg=function(e){return t.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var i=this;window.FileReader&&layui.each(i.chooseFiles,function(i,t){var n=new FileReader;n.readAsDataURL(t),n.onload=function(){e&&e(i,t,this.result)}})},p.prototype.upload=function(e,t){var n,o=this,l=o.config,r=o.elemFile[0],u=function(){var t=0,n=0,a=e||o.files||o.chooseFiles||r.files,u=function(){l.multiple&&t+n===o.fileLength&&"function"==typeof l.allDone&&l.allDone({total:o.fileLength,successful:t,aborted:n})};layui.each(a,function(e,a){var r=new FormData;r.append(l.field,a),layui.each(l.data,function(e,i){i="function"==typeof i?i():i,r.append(e,i)}),i.ajax({url:l.url,type:"post",data:r,contentType:!1,processData:!1,dataType:"json",headers:l.headers||{},success:function(i){t++,d(e,i),u()},error:function(){n++,o.msg("请求上传接口出现异常"),m(e),u()}})})},c=function(){var e=i("#"+f);o.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var i,t=e.contents().find("body");try{i=t.text()}catch(n){o.msg("获取上传后的响应信息出现异常"),clearInterval(p.timer),m()}i&&(clearInterval(p.timer),t.html(""),d(0,i))},30)},d=function(e,i){if(o.elemFile.next("."+s).remove(),r.value="","object"!=typeof i)try{i=JSON.parse(i)}catch(t){return i={},o.msg("请对上传接口返回有效JSON")}"function"==typeof l.done&&l.done(i,e||0,function(e){o.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){o.upload(e)})},h=l.exts,v=function(){var i=[];return layui.each(e||o.chooseFiles,function(e,t){i.push(t.name)}),i}(),g={preview:function(e){o.preview(e)},upload:function(e,i){var t={};t[e]=i,o.upload(t)},pushFile:function(){return o.files=o.files||{},layui.each(o.chooseFiles,function(e,i){o.files[e]=i}),o.files},resetFile:function(e,i,t){var n=new File([i],t);o.files=o.files||{},o.files[e]=n}},y=function(){if("choose"!==t&&!l.auto||(l.choose&&l.choose(g),"choose"!==t))return l.before&&l.before(g),a.ie?a.ie>9?u():c():void u()};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return o.msg("选择的文件中包含不支持的格式"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return o.msg("选择的视频中包含不支持的格式"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return o.msg("选择的音频中包含不支持的格式"),r.value="";break;default:if(layui.each(v,function(e,i){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(i))||(n=!0)}),n)return o.msg("选择的图片中包含不支持的格式"),r.value=""}if(o.fileLength=function(){var i=0,t=e||o.files||o.chooseFiles||r.files;return layui.each(t,function(){i++}),i}(),l.number&&o.fileLength>l.number)return o.msg("同时最多只能上传的数量为:"+l.number);if(l.size>0&&!(a.ie&&a.ie<10)){var F;if(layui.each(o.chooseFiles,function(e,i){if(i.size>1024*l.size){var t=l.size/1024;t=t>=1?t.toFixed(2)+"MB":l.size+"KB",r.value="",F=t}}),F)return o.msg("文件不能超过"+F)}y()}},p.prototype.events=function(){var e=this,t=e.config,o=function(i){e.chooseFiles={},layui.each(i,function(i,t){var n=(new Date).getTime();e.chooseFiles[n+"-"+i]=t})},l=function(i,n){var a=e.elemFile,o=i.length>1?i.length+"个文件":(i[0]||{}).name||a[0].value.match(/[^\/\\]+\..+/g)||[]||"";a.next().hasClass(s)&&a.next().remove(),e.upload(null,"choose"),e.isFile()||t.choose||a.after('<span class="layui-inline '+s+'">'+o+"</span>")};t.elem.off("upload.start").on("upload.start",function(){var a=i(this),o=a.attr("lay-data");if(o)try{o=new Function("return "+o)(),e.config=i.extend({},t,o)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+o)}e.config.item=a,e.elemFile[0].click()}),a.ie&&a.ie<10||t.elem.off("upload.over").on("upload.over",function(){var e=i(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=i(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,a){var r=i(this),u=a.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),o(u),t.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var i=this.files||[];o(i),t.auto?e.upload():l(i)}),t.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),t.elem.data("haveEvents")||(e.elemFile.on("change",function(){i(this).trigger("upload.change")}),t.elem.on("click",function(){e.isFile()||i(this).trigger("upload.start")}),t.drag&&t.elem.on("dragover",function(e){e.preventDefault(),i(this).trigger("upload.over")}).on("dragleave",function(e){i(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),i(this).trigger("upload.drop",e)}),t.bindAction.on("click",function(){i(this).trigger("upload.action")}),t.elem.data("haveEvents",!0))},o.render=function(e){var i=new p(e);return l.call(i)},e(r,o)}); | |
0 | 3 | \ No newline at end of file |
... | ... |
src/main/resources/static/file/物料.xls
0 → 100644
1 | +ÎïÁÏ code | |
... | ... |
src/main/resources/static/huaheng/js/huahengUI.js
... | ... | @@ -159,7 +159,59 @@ |
159 | 159 | } |
160 | 160 | }); |
161 | 161 | return actions.join(''); |
162 | - } | |
162 | + }, | |
163 | + // 导入数据 | |
164 | + importExcel: function(formId) { | |
165 | + var currentId = $.common.isEmpty(formId) ? 'importTpl' : formId; | |
166 | + layer.open({ | |
167 | + type: 1, | |
168 | + area: ['400px', '230px'], | |
169 | + fix: false, | |
170 | + //不固定 | |
171 | + maxmin: true, | |
172 | + shade: 0.3, | |
173 | + title: '导入' + $.table._option.modalName + '数据', | |
174 | + content: $('#' + currentId).html(), | |
175 | + btn: ['<i class="fa fa-check"></i> 导入', '<i class="fa fa-remove"></i> 取消'], | |
176 | + // 弹层外区域关闭 | |
177 | + shadeClose: true, | |
178 | + btn1: function(index, layero){ | |
179 | + var file = layero.find('#file').val(); | |
180 | + if (file == '' || (!$.common.endWith(file, '.xls') && !$.common.endWith(file, '.xlsx'))){ | |
181 | + $.modal.msgWarning("请选择后缀为 “xls”或“xlsx”的文件。"); | |
182 | + return false; | |
183 | + } | |
184 | + var index = layer.load(2, {shade: false}); | |
185 | + $.modal.disable(); | |
186 | + var formData = new FormData(); | |
187 | + formData.append("file", $('#file')[0].files[0]); | |
188 | + formData.append("updateSupport", $("input[name='updateSupport']").is(':checked')); | |
189 | + $.ajax({ | |
190 | + url: $.table._option.importUrl, | |
191 | + data: formData, | |
192 | + cache: false, | |
193 | + contentType: false, | |
194 | + processData: false, | |
195 | + type: 'POST', | |
196 | + success: function (result) { | |
197 | + if (result.code == web_status.SUCCESS) { | |
198 | + $.modal.closeAll(); | |
199 | + $.modal.alertSuccess(result.msg); | |
200 | + $.table.refresh(); | |
201 | + } else if (result.code == web_status.WARNING) { | |
202 | + layer.close(index); | |
203 | + $.modal.enable(); | |
204 | + $.modal.alertWarning(result.msg) | |
205 | + } else { | |
206 | + layer.close(index); | |
207 | + $.modal.enable(); | |
208 | + $.modal.alertError(result.msg); | |
209 | + } | |
210 | + } | |
211 | + }); | |
212 | + } | |
213 | + }); | |
214 | + }, | |
163 | 215 | }, |
164 | 216 | // 表格树封装处理 |
165 | 217 | treeTable: { |
... | ... |
src/main/resources/templates/config/receiptType/add.html
0 → 100644
1 | +<!DOCTYPE HTML> | |
2 | +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> | |
3 | +<meta charset="utf-8"> | |
4 | +<head th:include="include :: header"></head> | |
5 | +<body class="white-bg"> | |
6 | +<div class="wrapper wrapper-content animated fadeInRight ibox-content"> | |
7 | + <form class="form-horizontal m" id="form-receiptType-add"> | |
8 | + <div class="form-group"> | |
9 | + <label class="col-sm-3 control-label">编码:</label> | |
10 | + <div class="col-sm-8"> | |
11 | + <input id="code" name="code" class="form-control" type="text"> | |
12 | + </div> | |
13 | + </div> | |
14 | + <div class="form-group"> | |
15 | + <label class="col-sm-3 control-label">货主编码:</label> | |
16 | + <div class="col-sm-8"> | |
17 | + <select id="companyCode" name="companyCode" class="form-control" th:with="companyList=${@companyService.selectCompanyByCurrentUserId()}"> | |
18 | + <option th:each="company : ${companyList}" th:text="${company['name']}" th:value="${company['code']}"></option> | |
19 | + </select> | |
20 | + </div> | |
21 | + </div> | |
22 | + <!--<div class="form-group"> --> | |
23 | + <!--<label class="col-sm-3 control-label">仓库Id:</label>--> | |
24 | + <!--<div class="col-sm-8">--> | |
25 | + <!--<input id="warehouseId" name="warehouseId" class="form-control" type="text">--> | |
26 | + <!--</div>--> | |
27 | + <!--</div>--> | |
28 | + <!--<div class="form-group"> --> | |
29 | + <!--<label class="col-sm-3 control-label">仓库编码:</label>--> | |
30 | + <!--<div class="col-sm-8">--> | |
31 | + <!--<input id="warehouseCode" name="warehouseCode" class="form-control" type="text">--> | |
32 | + <!--</div>--> | |
33 | + <!--</div>--> | |
34 | + <div class="form-group"> | |
35 | + <label class="col-sm-3 control-label">关联订单类型:</label> | |
36 | + <div class="col-sm-8"> | |
37 | + <input id="referType" name="referType" class="form-control" type="text"> | |
38 | + </div> | |
39 | + </div> | |
40 | + <div class="form-group"> | |
41 | + <label class="col-sm-3 control-label">入库流程:</label> | |
42 | + <div class="col-sm-8"> | |
43 | + <input id="receiptFlow" name="receiptFlow" class="form-control" type="text"> | |
44 | + </div> | |
45 | + </div> | |
46 | + <!--<div class="form-group"> | |
47 | + <label class="col-sm-3 control-label">数据版本:</label> | |
48 | + <div class="col-sm-8"> | |
49 | + <input id="version" name="version" class="form-control" type="text"> | |
50 | + </div> | |
51 | + </div>--> | |
52 | + <!--<div class="form-group"> --> | |
53 | + <!--<label class="col-sm-3 control-label">创建时间:</label>--> | |
54 | + <!--<div class="col-sm-8">--> | |
55 | + <!--<input id="created" name="created" class="form-control" type="text">--> | |
56 | + <!--</div>--> | |
57 | + <!--</div>--> | |
58 | + <!--<div class="form-group"> --> | |
59 | + <!--<label class="col-sm-3 control-label">创建者:</label>--> | |
60 | + <!--<div class="col-sm-8">--> | |
61 | + <!--<input id="createdBy" name="createdBy" class="form-control" type="text">--> | |
62 | + <!--</div>--> | |
63 | + <!--</div>--> | |
64 | + <!--<div class="form-group"> --> | |
65 | + <!--<label class="col-sm-3 control-label">创建时间:</label>--> | |
66 | + <!--<div class="col-sm-8">--> | |
67 | + <!--<input id="lastUpdated" name="lastUpdated" class="form-control" type="text">--> | |
68 | + <!--</div>--> | |
69 | + <!--</div>--> | |
70 | + <!--<div class="form-group"> --> | |
71 | + <!--<label class="col-sm-3 control-label">更新者:</label>--> | |
72 | + <!--<div class="col-sm-8">--> | |
73 | + <!--<input id="lastUpdatedBy" name="lastUpdatedBy" class="form-control" type="text">--> | |
74 | + <!--</div>--> | |
75 | + <!--</div>--> | |
76 | + <!--<div class="form-group"> --> | |
77 | + <!--<label class="col-sm-3 control-label">是否有效:</label>--> | |
78 | + <!--<div class="col-sm-8">--> | |
79 | + <!--<!–<input id="enable" name="enable" class="form-control" type="text">–>--> | |
80 | + <!--<div class="onoffswitch">--> | |
81 | + <!--<input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="enable" name="enable">--> | |
82 | + <!--<label class="onoffswitch-label" for="enable">--> | |
83 | + <!--<span class="onoffswitch-inner"></span>--> | |
84 | + <!--<span class="onoffswitch-switch"></span>--> | |
85 | + <!--</label>--> | |
86 | + <!--</div>--> | |
87 | + <!--</div>--> | |
88 | + <!--</div>--> | |
89 | + <!--<div class="form-group"> --> | |
90 | + <!--<label class="col-sm-3 control-label">是否删除:</label>--> | |
91 | + <!--<div class="col-sm-8">--> | |
92 | + <!--<input id="deleted" name="deleted" class="form-control" type="text">--> | |
93 | + <!--</div>--> | |
94 | + <!--</div>--> | |
95 | + <!--<div class="form-group"> --> | |
96 | + <!--<label class="col-sm-3 control-label">自定义字段1:</label>--> | |
97 | + <!--<div class="col-sm-8">--> | |
98 | + <!--<input id="userDef1" name="userDef1" class="form-control" type="text">--> | |
99 | + <!--</div>--> | |
100 | + <!--</div>--> | |
101 | + <!--<div class="form-group"> --> | |
102 | + <!--<label class="col-sm-3 control-label">自定义字段2:</label>--> | |
103 | + <!--<div class="col-sm-8">--> | |
104 | + <!--<input id="userDef2" name="userDef2" class="form-control" type="text">--> | |
105 | + <!--</div>--> | |
106 | + <!--</div>--> | |
107 | + <!--<div class="form-group"> --> | |
108 | + <!--<label class="col-sm-3 control-label">自定义字段3:</label>--> | |
109 | + <!--<div class="col-sm-8">--> | |
110 | + <!--<input id="userDef3" name="userDef3" class="form-control" type="text">--> | |
111 | + <!--</div>--> | |
112 | + <!--</div>--> | |
113 | + <!--<div class="form-group"> --> | |
114 | + <!--<label class="col-sm-3 control-label">自定义字段4:</label>--> | |
115 | + <!--<div class="col-sm-8">--> | |
116 | + <!--<input id="userDef4" name="userDef4" class="form-control" type="text">--> | |
117 | + <!--</div>--> | |
118 | + <!--</div>--> | |
119 | + <!--<div class="form-group"> --> | |
120 | + <!--<label class="col-sm-3 control-label">自定义字段5:</label>--> | |
121 | + <!--<div class="col-sm-8">--> | |
122 | + <!--<input id="userDef5" name="userDef5" class="form-control" type="text">--> | |
123 | + <!--</div>--> | |
124 | + <!--</div>--> | |
125 | + <div class="form-group"> | |
126 | + <label class="col-sm-3 control-label">是否启用:</label> | |
127 | + <div class="col-sm-8"> | |
128 | + <div class="onoffswitch"> | |
129 | + <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="enable" name="enable"> | |
130 | + <label class="onoffswitch-label" for="enable"> | |
131 | + <span class="onoffswitch-inner"></span> | |
132 | + <span class="onoffswitch-switch"></span> | |
133 | + </label> | |
134 | + </div> | |
135 | + </div> | |
136 | + </div> | |
137 | + <div class="form-group"> | |
138 | + <div class="form-control-static col-sm-offset-9"> | |
139 | + <button type="submit" class="btn btn-primary">提交</button> | |
140 | + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> | |
141 | + </div> | |
142 | + </div> | |
143 | + </form> | |
144 | +</div> | |
145 | +<div th:include="include::footer"></div> | |
146 | +<script type="text/javascript"> | |
147 | + var prefix = ctx + "config/receiptType"; | |
148 | + $("#form-receiptType-add").validate({ | |
149 | + rules:{ | |
150 | + code:{ | |
151 | + required:true, | |
152 | + }, | |
153 | + referType:{ | |
154 | + required:true, | |
155 | + }, | |
156 | + receiptFlow:{ | |
157 | + required:true, | |
158 | + }, | |
159 | + }, | |
160 | + submitHandler: function(form) { | |
161 | + // $.operate.save(prefix + "/add", $('#form-locationType-add').serialize()); | |
162 | + var tableValue = $.common.getTableValue("#form-receiptType-add"); | |
163 | + tableValue = formValueReplace(tableValue, "companyCode", $("#companyCode option:selected").val()); | |
164 | + tableValue = formValueReplace(tableValue, "enable", $("input[name='enable']").is(':checked')); | |
165 | + $.operate.save(prefix + "/add", tableValue); | |
166 | + } | |
167 | + }); | |
168 | +</script> | |
169 | +</body> | |
170 | +</html> | |
... | ... |
src/main/resources/templates/config/receiptType/edit.html
0 → 100644
1 | +<!DOCTYPE HTML> | |
2 | +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> | |
3 | +<meta charset="utf-8"> | |
4 | +<head th:include="include :: header"></head> | |
5 | +<body class="white-bg"> | |
6 | +<div class="wrapper wrapper-content animated fadeInRight ibox-content"> | |
7 | + <form class="form-horizontal m" id="form-receiptType-edit" th:object="${receiptType}"> | |
8 | + <input name="id" type="hidden" th:field="*{id}"> | |
9 | + <div class="form-group"> | |
10 | + <label class="col-sm-3 control-label">编码:</label> | |
11 | + <div class="col-sm-8"> | |
12 | + <input id="code" name="code" class="form-control" type="text" th:field="*{code}"> | |
13 | + </div> | |
14 | + </div> | |
15 | + <div class="form-group"> | |
16 | + <label class="col-sm-3 control-label">货主编码:</label> | |
17 | + <div class="col-sm-8"> | |
18 | + <select id="companyCode" name="companyCode" class="form-control" th:with="companyList=${@companyService.selectCompanyByCurrentUserId()}" | |
19 | + th:field="*{companyCode}"> | |
20 | + <option th:each="company : ${companyList}" th:text="${company['name']}" th:value="${company['code']}"></option> | |
21 | + </select> | |
22 | + </div> | |
23 | + </div> | |
24 | + <!--<div class="form-group"> --> | |
25 | + <!--<label class="col-sm-3 control-label">仓库Id:</label>--> | |
26 | + <!--<div class="col-sm-8">--> | |
27 | + <!--<input id="warehouseId" name="warehouseId" class="form-control" type="text">--> | |
28 | + <!--</div>--> | |
29 | + <!--</div>--> | |
30 | + <!--<div class="form-group"> --> | |
31 | + <!--<label class="col-sm-3 control-label">仓库编码:</label>--> | |
32 | + <!--<div class="col-sm-8">--> | |
33 | + <!--<input id="warehouseCode" name="warehouseCode" class="form-control" type="text">--> | |
34 | + <!--</div>--> | |
35 | + <!--</div>--> | |
36 | + <div class="form-group"> | |
37 | + <label class="col-sm-3 control-label">关联订单类型:</label> | |
38 | + <div class="col-sm-8"> | |
39 | + <input id="referType" name="referType" class="form-control" type="text" th:field="*{referType}"> | |
40 | + </div> | |
41 | + </div> | |
42 | + <div class="form-group"> | |
43 | + <label class="col-sm-3 control-label">入库流程:</label> | |
44 | + <div class="col-sm-8"> | |
45 | + <input id="receiptFlow" name="receiptFlow" class="form-control" type="text" th:field="*{receiptFlow}"> | |
46 | + </div> | |
47 | + </div> | |
48 | + <!--<div class="form-group"> | |
49 | + <label class="col-sm-3 control-label">数据版本:</label> | |
50 | + <div class="col-sm-8"> | |
51 | + <input id="version" name="version" class="form-control" type="text"> | |
52 | + </div> | |
53 | + </div>--> | |
54 | + <!--<div class="form-group"> --> | |
55 | + <!--<label class="col-sm-3 control-label">创建时间:</label>--> | |
56 | + <!--<div class="col-sm-8">--> | |
57 | + <!--<input id="created" name="created" class="form-control" type="text">--> | |
58 | + <!--</div>--> | |
59 | + <!--</div>--> | |
60 | + <!--<div class="form-group"> --> | |
61 | + <!--<label class="col-sm-3 control-label">创建者:</label>--> | |
62 | + <!--<div class="col-sm-8">--> | |
63 | + <!--<input id="createdBy" name="createdBy" class="form-control" type="text">--> | |
64 | + <!--</div>--> | |
65 | + <!--</div>--> | |
66 | + <!--<div class="form-group"> --> | |
67 | + <!--<label class="col-sm-3 control-label">创建时间:</label>--> | |
68 | + <!--<div class="col-sm-8">--> | |
69 | + <!--<input id="lastUpdated" name="lastUpdated" class="form-control" type="text">--> | |
70 | + <!--</div>--> | |
71 | + <!--</div>--> | |
72 | + <!--<div class="form-group"> --> | |
73 | + <!--<label class="col-sm-3 control-label">更新者:</label>--> | |
74 | + <!--<div class="col-sm-8">--> | |
75 | + <!--<input id="lastUpdatedBy" name="lastUpdatedBy" class="form-control" type="text">--> | |
76 | + <!--</div>--> | |
77 | + <!--</div>--> | |
78 | + <!--<div class="form-group"> --> | |
79 | + <!--<label class="col-sm-3 control-label">是否有效:</label>--> | |
80 | + <!--<div class="col-sm-8">--> | |
81 | + <!--<!–<input id="enable" name="enable" class="form-control" type="text">–>--> | |
82 | + <!--<div class="onoffswitch">--> | |
83 | + <!--<input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="enable" name="enable">--> | |
84 | + <!--<label class="onoffswitch-label" for="enable">--> | |
85 | + <!--<span class="onoffswitch-inner"></span>--> | |
86 | + <!--<span class="onoffswitch-switch"></span>--> | |
87 | + <!--</label>--> | |
88 | + <!--</div>--> | |
89 | + <!--</div>--> | |
90 | + <!--</div>--> | |
91 | + <!--<div class="form-group"> --> | |
92 | + <!--<label class="col-sm-3 control-label">是否删除:</label>--> | |
93 | + <!--<div class="col-sm-8">--> | |
94 | + <!--<input id="deleted" name="deleted" class="form-control" type="text">--> | |
95 | + <!--</div>--> | |
96 | + <!--</div>--> | |
97 | + <!--<div class="form-group"> --> | |
98 | + <!--<label class="col-sm-3 control-label">自定义字段1:</label>--> | |
99 | + <!--<div class="col-sm-8">--> | |
100 | + <!--<input id="userDef1" name="userDef1" class="form-control" type="text">--> | |
101 | + <!--</div>--> | |
102 | + <!--</div>--> | |
103 | + <!--<div class="form-group"> --> | |
104 | + <!--<label class="col-sm-3 control-label">自定义字段2:</label>--> | |
105 | + <!--<div class="col-sm-8">--> | |
106 | + <!--<input id="userDef2" name="userDef2" class="form-control" type="text">--> | |
107 | + <!--</div>--> | |
108 | + <!--</div>--> | |
109 | + <!--<div class="form-group"> --> | |
110 | + <!--<label class="col-sm-3 control-label">自定义字段3:</label>--> | |
111 | + <!--<div class="col-sm-8">--> | |
112 | + <!--<input id="userDef3" name="userDef3" class="form-control" type="text">--> | |
113 | + <!--</div>--> | |
114 | + <!--</div>--> | |
115 | + <!--<div class="form-group"> --> | |
116 | + <!--<label class="col-sm-3 control-label">自定义字段4:</label>--> | |
117 | + <!--<div class="col-sm-8">--> | |
118 | + <!--<input id="userDef4" name="userDef4" class="form-control" type="text">--> | |
119 | + <!--</div>--> | |
120 | + <!--</div>--> | |
121 | + <!--<div class="form-group"> --> | |
122 | + <!--<label class="col-sm-3 control-label">自定义字段5:</label>--> | |
123 | + <!--<div class="col-sm-8">--> | |
124 | + <!--<input id="userDef5" name="userDef5" class="form-control" type="text">--> | |
125 | + <!--</div>--> | |
126 | + <!--</div>--> | |
127 | + <div class="form-group"> | |
128 | + <label class="col-sm-3 control-label">是否启用:</label> | |
129 | + <div class="col-sm-8"> | |
130 | + <div class="onoffswitch"> | |
131 | + <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="enable" name="enable" th:field="${enable}"> | |
132 | + <label class="onoffswitch-label" for="enable"> | |
133 | + <span class="onoffswitch-inner"></span> | |
134 | + <span class="onoffswitch-switch"></span> | |
135 | + </label> | |
136 | + </div> | |
137 | + </div> | |
138 | + </div> | |
139 | + <div class="form-group"> | |
140 | + <div class="form-control-static col-sm-offset-9"> | |
141 | + <button type="submit" class="btn btn-primary">提交</button> | |
142 | + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> | |
143 | + </div> | |
144 | + </div> | |
145 | + </form> | |
146 | +</div> | |
147 | +<div th:include="include::footer"></div> | |
148 | +<script type="text/javascript"> | |
149 | + var prefix = ctx + "config/receiptType"; | |
150 | + $("#form-locationType-add").validate({ | |
151 | + rules:{ | |
152 | + code:{ | |
153 | + required:true, | |
154 | + }, | |
155 | + referType:{ | |
156 | + required:true, | |
157 | + }, | |
158 | + receiptFlow:{ | |
159 | + required:true, | |
160 | + }, | |
161 | + }, | |
162 | + submitHandler: function(form) { | |
163 | + // $.operate.save(prefix + "/add", $('#form-locationType-add').serialize()); | |
164 | + var tableValue = $.common.getTableValue("#form-locationType-add"); | |
165 | + tableValue = formValueReplace(tableValue, "companyCode", $("#companyCode option:selected").val()); | |
166 | + $.operate.save(prefix + "/add", tableValue); | |
167 | + } | |
168 | + }); | |
169 | +</script> | |
170 | +</body> | |
171 | +</html> | |
... | ... |
src/main/resources/templates/config/receiptType/receiptType.html
0 → 100644
1 | +<!DOCTYPE HTML> | |
2 | +<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> | |
3 | +<meta charset="utf-8"> | |
4 | +<head th:include="include :: header"></head> | |
5 | +<body class="gray-bg"> | |
6 | +<div class="container-div"> | |
7 | + <div class="row"> | |
8 | + <div class="col-sm-12 select-info"> | |
9 | + <form id="locationType-form"> | |
10 | + <div class="select-list"> | |
11 | + <ul> | |
12 | + <li> | |
13 | + 编码:<input type="text" name="code"/> | |
14 | + </li> | |
15 | + <li class="time"> | |
16 | + <label>创建时间: </label> | |
17 | + <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="createdBegin"/> | |
18 | + <span>-</span> | |
19 | + <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="createdEnd"/> | |
20 | + </li> | |
21 | + <li> | |
22 | + <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> | |
23 | + <!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="system:role:export"><i class="fa fa-download"></i> 导出</a>--> | |
24 | + </li> | |
25 | + </ul> | |
26 | + </div> | |
27 | + </form> | |
28 | + </div> | |
29 | + <div class="btn-group hidden-xs" id="toolbar" role="group"> | |
30 | + <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="config:locationType:add"> | |
31 | + <i class="fa fa-plus"></i> 新增 | |
32 | + </a> | |
33 | + <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="config:locationType:remove"> | |
34 | + <i class="fa fa-trash-o"></i> 删除 | |
35 | + </a> | |
36 | + </div> | |
37 | + | |
38 | + <div class="col-sm-12 select-info"> | |
39 | + <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table> | |
40 | + </div> | |
41 | + <div> | |
42 | + </div> | |
43 | + <div th:include="include :: footer"></div> | |
44 | + <script th:inline="javascript"> | |
45 | + var editFlag = [[${@permission.hasPermi('config:receiptType:edit')}]]; | |
46 | + var removeFlag = [[${@permission.hasPermi('config:receiptType:remove')}]]; | |
47 | + var prefix = ctx + "config/receiptType"; | |
48 | + var datas = [[${@dict.getType('sys_normal_disable')}]]; | |
49 | + $(function() { | |
50 | + var options = { | |
51 | + url: prefix + "/list", | |
52 | + createUrl: prefix + "/add", | |
53 | + updateUrl: prefix + "/edit/{id}", | |
54 | + removeUrl: prefix + "/remove", | |
55 | + modalName: "入库单类型", | |
56 | + search: false, | |
57 | + columns: [{ | |
58 | + checkbox: true | |
59 | + }, | |
60 | + { | |
61 | + field : 'id', | |
62 | + title : '库位类型Id' | |
63 | + }, | |
64 | + { | |
65 | + field : 'code', | |
66 | + title : '类型编码' | |
67 | + }, | |
68 | + { | |
69 | + field : 'companyCode', | |
70 | + title : '货主编码' | |
71 | + }, | |
72 | + { | |
73 | + field : 'warehouseCode', | |
74 | + title : '仓库编码' | |
75 | + }, | |
76 | + { | |
77 | + field : 'referType', | |
78 | + title : '关联订单类型' | |
79 | + }, | |
80 | + { | |
81 | + field : 'receiptFlow', | |
82 | + title : '入库流程' | |
83 | + }, | |
84 | + { | |
85 | + field : 'created', | |
86 | + title : '创建时间' | |
87 | + }, | |
88 | + { | |
89 | + field : 'createdBy', | |
90 | + title : '创建用户' | |
91 | + }, | |
92 | + { | |
93 | + field : 'lastUpdated', | |
94 | + title : '更新时间' | |
95 | + }, | |
96 | + { | |
97 | + field : 'lastUpdatedBy', | |
98 | + title : '更新用户' | |
99 | + }, | |
100 | + { | |
101 | + field : 'enable', | |
102 | + title : '是否有效', | |
103 | + formatter: function(value, row, index) { | |
104 | + return $.table.selectDictLabel(datas, value); | |
105 | + }, | |
106 | + align: 'center', | |
107 | + }, | |
108 | + { | |
109 | + field : 'version', | |
110 | + title : '数据版本' | |
111 | + }, | |
112 | + { | |
113 | + field : 'processStamp', | |
114 | + title : '处理标记', | |
115 | + visible : false | |
116 | + }, | |
117 | + { | |
118 | + field : 'userDef1', | |
119 | + title : '自定义字段1' , | |
120 | + visible:false | |
121 | + }, | |
122 | + { | |
123 | + field : 'userDef2', | |
124 | + title : '自定义字段2' , | |
125 | + visible:false | |
126 | + }, | |
127 | + { | |
128 | + field : 'userDef3', | |
129 | + title : '自定义字段3' , | |
130 | + visible:false | |
131 | + }, | |
132 | + { | |
133 | + field : 'userDef4', | |
134 | + title : '自定义字段4' , | |
135 | + visible:false | |
136 | + }, | |
137 | + { | |
138 | + field : 'userDef5', | |
139 | + title : '自定义字段5' , | |
140 | + visible:false | |
141 | + }, | |
142 | + { | |
143 | + title: '操作', | |
144 | + align: 'center', | |
145 | + formatter: function(value, row, index) { | |
146 | + var actions = []; | |
147 | + actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')" ><i class="fa fa-edit"></i>编辑</a> '); | |
148 | + actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')" ><i class="fa fa-trash-o"></i>删除</a>'); | |
149 | + return actions.join(''); | |
150 | + } | |
151 | + }] | |
152 | + }; | |
153 | + $.table.init(options); | |
154 | + }); | |
155 | + </script> | |
156 | +</body> | |
157 | +</html> | |
0 | 158 | \ No newline at end of file |
... | ... |
src/main/resources/templates/general/carrier/add.html
0 → 100644
1 | +<!DOCTYPE HTML> | |
2 | +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> | |
3 | +<meta charset="utf-8"> | |
4 | +<head th:include="include :: header"></head> | |
5 | +<body class="white-bg"> | |
6 | +<div class="wrapper wrapper-content animated fadeInRight ibox-content"> | |
7 | + <form class="form-horizontal m" id="form-company-add"> | |
8 | + <div class="form-group"> | |
9 | + <label class="col-sm-3 control-label">编码:</label> | |
10 | + <div class="col-sm-8"> | |
11 | + <input id="code" name="code" class="form-control" type="text"> | |
12 | + </div> | |
13 | + </div> | |
14 | + <div class="form-group"> | |
15 | + <label class="col-sm-3 control-label">名称:</label> | |
16 | + <div class="col-sm-8"> | |
17 | + <input id="name" name="name" class="form-control" type="text"> | |
18 | + </div> | |
19 | + </div> | |
20 | + <div class="form-group"> | |
21 | + <label class="col-sm-3 control-label">仓库:</label> | |
22 | + <div class="col-sm-8"> | |
23 | + <label th:each="warehouse:${warehouseList}" class="checkbox-inline i-checks"> | |
24 | + <input name="warehouseCode" type="checkbox" th:value="${warehouse.value}" th:text=" ${warehouse.name}" th:disabled="${warehouse.enable == false} "> | |
25 | + </label> | |
26 | + </div> | |
27 | + </div> | |
28 | + <div class="form-group"> | |
29 | + <label class="col-sm-3 control-label">运单获取地址url:</label> | |
30 | + <div class="col-sm-8"> | |
31 | + <input id="waybillServerUrl" name="waybillServerUrl" class="form-control" type="text"> | |
32 | + </div> | |
33 | + </div> | |
34 | + | |
35 | + <!--<div class="form-group"> | |
36 | + <label class="col-sm-3 control-label">数据版本:</label> | |
37 | + <div class="col-sm-8"> | |
38 | + <input id="version" name="version" class="form-control" type="text"> | |
39 | + </div> | |
40 | + </div>--> | |
41 | + | |
42 | + <!--<div class="form-group"> --> | |
43 | + <!--<label class="col-sm-3 control-label">自定义字段1:</label>--> | |
44 | + <!--<div class="col-sm-8">--> | |
45 | + <!--<input id="userDef1" name="userDef1" class="form-control" type="text">--> | |
46 | + <!--</div>--> | |
47 | + <!--</div>--> | |
48 | + <!--<div class="form-group"> --> | |
49 | + <!--<label class="col-sm-3 control-label">自定义字段2:</label>--> | |
50 | + <!--<div class="col-sm-8">--> | |
51 | + <!--<input id="userDef2" name="userDef2" class="form-control" type="text">--> | |
52 | + <!--</div>--> | |
53 | + <!--</div>--> | |
54 | + <!--<div class="form-group"> --> | |
55 | + <!--<label class="col-sm-3 control-label">自定义字段3:</label>--> | |
56 | + <!--<div class="col-sm-8">--> | |
57 | + <!--<input id="userDef3" name="userDef3" class="form-control" type="text">--> | |
58 | + <!--</div>--> | |
59 | + <!--</div>--> | |
60 | + <div class="form-group"> | |
61 | + <div class="form-control-static col-sm-offset-9"> | |
62 | + <button type="submit" class="btn btn-primary">提交</button> | |
63 | + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> | |
64 | + </div> | |
65 | + </div> | |
66 | + </form> | |
67 | +</div> | |
68 | +<div th:include="include::footer"></div> | |
69 | +<script type="text/javascript"> | |
70 | + var prefix = ctx + "general/company" | |
71 | + $("#form-company-add").validate({ | |
72 | + rules:{ | |
73 | + code:{ | |
74 | + required:true | |
75 | + }, | |
76 | + name:{ | |
77 | + required:true | |
78 | + }, | |
79 | + }, | |
80 | + submitHandler: function() { | |
81 | + var tableValue = $("#form-bomHeader-add").serialize(); | |
82 | + tableValue = formValueReplace(tableValue, "warehouseCode", $.form.selectCheckeds("warehouseCode")); | |
83 | + $.operate.save(prefix + "/add", tableValue); | |
84 | + } | |
85 | + }); | |
86 | +</script> | |
87 | +</body> | |
88 | +</html> | |
... | ... |