Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tagManager
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanmw
tagManager
Commits
8546e81f
Commit
8546e81f
authored
Mar 12, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改文件导入逻辑
parent
2453c39a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
TagFileService.java
...java/com/keymobile/tagmanager/service/TagFileService.java
+13
-12
No files found.
src/main/java/com/keymobile/tagmanager/service/TagFileService.java
View file @
8546e81f
package
com
.
keymobile
.
tagmanager
.
service
;
package
com
.
keymobile
.
tagmanager
.
service
;
import
java.io.ByteArrayOutputStream
;
import
java.io.InputStream
;
import
java.io.PrintStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -105,8 +104,9 @@ public class TagFileService {
...
@@ -105,8 +104,9 @@ public class TagFileService {
importLog
.
setCreator
(
userName
);
importLog
.
setCreator
(
userName
);
importLog
.
setDept
(
dept
);
importLog
.
setDept
(
dept
);
mongoOperations
.
save
(
importLog
);
mongoOperations
.
save
(
importLog
);
InputStream
inputStream
=
file
.
getInputStream
();
new
Thread
(
new
TagMetadataImportExecutor
(
userName
,
userId
,
dept
,
idPath
,
dimensionType
,
tagType
,
new
Thread
(
new
TagMetadataImportExecutor
(
userName
,
userId
,
dept
,
idPath
,
dimensionType
,
tagType
,
file
,
importLog
)).
start
();
inputStream
,
importLog
)).
start
();
return
"ok"
;
return
"ok"
;
}
}
...
@@ -218,7 +218,8 @@ public class TagFileService {
...
@@ -218,7 +218,8 @@ public class TagFileService {
importLog
.
setCreator
(
userName
);
importLog
.
setCreator
(
userName
);
importLog
.
setDept
(
dept
);
importLog
.
setDept
(
dept
);
mongoOperations
.
save
(
importLog
);
mongoOperations
.
save
(
importLog
);
new
Thread
(
new
ExcelImportExecutor
(
userName
,
userId
,
dept
,
file
,
importLog
)).
start
();
InputStream
inputStream
=
file
.
getInputStream
();
new
Thread
(
new
ExcelImportExecutor
(
userName
,
userId
,
dept
,
inputStream
,
importLog
)).
start
();
return
"ok"
;
return
"ok"
;
}
}
...
@@ -312,19 +313,19 @@ public class TagFileService {
...
@@ -312,19 +313,19 @@ public class TagFileService {
private
String
idPath
;
private
String
idPath
;
private
String
dimensionType
;
private
String
dimensionType
;
private
String
tagType
;
private
String
tagType
;
private
MultipartFile
file
;
private
InputStream
inputStream
;
private
ImportLog
importLog
;
private
ImportLog
importLog
;
public
TagMetadataImportExecutor
(
String
userName
,
String
userId
,
String
dept
,
public
TagMetadataImportExecutor
(
String
userName
,
String
userId
,
String
dept
,
String
idPath
,
String
dimensionType
,
String
tagType
,
String
idPath
,
String
dimensionType
,
String
tagType
,
MultipartFile
file
,
ImportLog
importLog
)
{
InputStream
inputStream
,
ImportLog
importLog
)
{
this
.
userName
=
userName
;
this
.
userName
=
userName
;
this
.
userId
=
userId
;
this
.
userId
=
userId
;
this
.
dept
=
dept
;
this
.
dept
=
dept
;
this
.
idPath
=
idPath
;
this
.
idPath
=
idPath
;
this
.
dimensionType
=
dimensionType
;
this
.
dimensionType
=
dimensionType
;
this
.
tagType
=
tagType
;
this
.
tagType
=
tagType
;
this
.
file
=
file
;
this
.
inputStream
=
inputStream
;
this
.
importLog
=
importLog
;
this
.
importLog
=
importLog
;
}
}
@Override
@Override
...
@@ -338,7 +339,7 @@ public class TagFileService {
...
@@ -338,7 +339,7 @@ public class TagFileService {
params
.
setNeedVerify
(
true
);
params
.
setNeedVerify
(
true
);
params
.
setVerifyHandler
(
new
TagMetadataVerifyHandler
());
params
.
setVerifyHandler
(
new
TagMetadataVerifyHandler
());
ExcelImportResult
<
TagMetadata
>
excelImportResult
=
ExcelImportUtil
.
ExcelImportResult
<
TagMetadata
>
excelImportResult
=
ExcelImportUtil
.
importExcelMore
(
file
.
getInputStream
()
,
TagMetadata
.
class
,
params
);
importExcelMore
(
inputStream
,
TagMetadata
.
class
,
params
);
List
<
String
>
successIds
=
new
ArrayList
<>();
List
<
String
>
successIds
=
new
ArrayList
<>();
List
<
TagMetadata
>
tagMetadatas
=
excelImportResult
.
getList
();
List
<
TagMetadata
>
tagMetadatas
=
excelImportResult
.
getList
();
for
(
TagMetadata
tagMetadata
:
tagMetadatas
)
{
for
(
TagMetadata
tagMetadata
:
tagMetadatas
)
{
...
@@ -414,16 +415,16 @@ public class TagFileService {
...
@@ -414,16 +415,16 @@ public class TagFileService {
class
ExcelImportExecutor
implements
Runnable
{
class
ExcelImportExecutor
implements
Runnable
{
private
String
dept
;
private
String
dept
;
private
MultipartFile
file
;
private
InputStream
inputStream
;
private
ImportLog
importLog
;
private
ImportLog
importLog
;
private
String
userName
;
private
String
userName
;
private
String
userId
;
private
String
userId
;
public
ExcelImportExecutor
(
String
userName
,
String
userId
,
String
dept
,
public
ExcelImportExecutor
(
String
userName
,
String
userId
,
String
dept
,
MultipartFile
file
,
ImportLog
importLog
)
{
InputStream
inputStream
,
ImportLog
importLog
)
{
this
.
userName
=
userName
;
this
.
userName
=
userName
;
this
.
userId
=
userId
;
this
.
userId
=
userId
;
this
.
dept
=
dept
;
this
.
dept
=
dept
;
this
.
file
=
file
;
this
.
inputStream
=
inputStream
;
this
.
importLog
=
importLog
;
this
.
importLog
=
importLog
;
}
}
@Override
@Override
...
@@ -438,7 +439,7 @@ public class TagFileService {
...
@@ -438,7 +439,7 @@ public class TagFileService {
params
.
setHeadRows
(
1
);
params
.
setHeadRows
(
1
);
params
.
setNeedVerify
(
true
);
params
.
setNeedVerify
(
true
);
params
.
setVerifyHandler
(
new
ExcelVerifyHandler
(
pathTags
));
params
.
setVerifyHandler
(
new
ExcelVerifyHandler
(
pathTags
));
ExcelImportResult
<
Tag
>
excelImportResult
=
ExcelImportUtil
.
importExcelMore
(
file
.
getInputStream
()
,
Tag
.
class
,
params
);
ExcelImportResult
<
Tag
>
excelImportResult
=
ExcelImportUtil
.
importExcelMore
(
inputStream
,
Tag
.
class
,
params
);
List
<
String
>
successIds
=
new
ArrayList
<>();
List
<
String
>
successIds
=
new
ArrayList
<>();
List
<
Tag
>
tags
=
excelImportResult
.
getList
();
List
<
Tag
>
tags
=
excelImportResult
.
getList
();
//author:zhangkb time:2020-3-12 desc:excel解析到的标签路径'\'改成逗号
//author:zhangkb time:2020-3-12 desc:excel解析到的标签路径'\'改成逗号
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment