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
faa38c5f
Commit
faa38c5f
authored
Jan 17, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
标签分析导出代码提交
parent
b3c3190b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
0 deletions
+137
-0
TagCtrl.java
src/main/java/com/keymobile/tagmanager/api/TagCtrl.java
+12
-0
TagAnalysis.java
...main/java/com/keymobile/tagmanager/model/TagAnalysis.java
+92
-0
TagFileService.java
...java/com/keymobile/tagmanager/service/TagFileService.java
+33
-0
No files found.
src/main/java/com/keymobile/tagmanager/api/TagCtrl.java
View file @
faa38c5f
...
@@ -3,6 +3,8 @@ import java.util.ArrayList;
...
@@ -3,6 +3,8 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -18,6 +20,7 @@ import com.keymobile.tagmanager.model.ExtTag;
...
@@ -18,6 +20,7 @@ import com.keymobile.tagmanager.model.ExtTag;
import
com.keymobile.tagmanager.model.Page
;
import
com.keymobile.tagmanager.model.Page
;
import
com.keymobile.tagmanager.model.SysTag
;
import
com.keymobile.tagmanager.model.SysTag
;
import
com.keymobile.tagmanager.model.Tag
;
import
com.keymobile.tagmanager.model.Tag
;
import
com.keymobile.tagmanager.service.TagFileService
;
import
com.keymobile.tagmanager.service.TagService
;
import
com.keymobile.tagmanager.service.TagService
;
import
com.keymobile.tagmanager.util.JsonTreeHelper.JsonNode
;
import
com.keymobile.tagmanager.util.JsonTreeHelper.JsonNode
;
import
com.keymobile.tagmanager.util.UserInfoUtils
;
import
com.keymobile.tagmanager.util.UserInfoUtils
;
...
@@ -35,6 +38,9 @@ public class TagCtrl {
...
@@ -35,6 +38,9 @@ public class TagCtrl {
@Autowired
@Autowired
private
TagService
tagService
;
private
TagService
tagService
;
@Autowired
private
TagFileService
tagExportService
;
private
Logger
logger
=
LoggerFactory
.
getLogger
(
TagCtrl
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
TagCtrl
.
class
);
//author:zhangkb time:2020-1-6 desc:修改标签相关接口
//author:zhangkb time:2020-1-6 desc:修改标签相关接口
...
@@ -248,6 +254,12 @@ public class TagCtrl {
...
@@ -248,6 +254,12 @@ public class TagCtrl {
return
tagService
.
tagAnalysis
(
dataType
);
return
tagService
.
tagAnalysis
(
dataType
);
}
}
@ApiOperation
(
value
=
"导出标签分析excel文件(dataType:0,1,2 依次代表:元数据,模型,标准; type:0,1 代表:导出系统分析,导出自定义分析)"
,
notes
=
"导出标签分析excel文件(dataType:0,1,2 依次代表:元数据,模型,标准; type:0,1 代表:导出系统分析,导出自定义分析)"
)
@GetMapping
(
"/exportTagAnalysis"
)
public
int
exportTagAnalysis
(
@RequestParam
String
dataType
,
@RequestParam
String
type
,
HttpServletResponse
response
)
throws
Exception
{
return
tagExportService
.
exportTagAnalysisExcel
(
dataType
,
type
,
response
);
}
//---------------以下为导入系统的时候用到------------------
//---------------以下为导入系统的时候用到------------------
...
...
src/main/java/com/keymobile/tagmanager/model/TagAnalysis.java
0 → 100644
View file @
faa38c5f
package
com
.
keymobile
.
tagmanager
.
model
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotNull
;
import
cn.afterturn.easypoi.excel.annotation.Excel
;
import
cn.afterturn.easypoi.excel.annotation.ExcelTarget
;
import
cn.afterturn.easypoi.handler.inter.IExcelDataModel
;
import
cn.afterturn.easypoi.handler.inter.IExcelModel
;
@ExcelTarget
(
"TagAnalysis"
)
public
class
TagAnalysis
implements
Serializable
,
IExcelModel
,
IExcelDataModel
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@Excel
(
name
=
"标签名称"
,
orderNum
=
"0"
,
width
=
30
)
@NotNull
private
String
name
;
@Excel
(
name
=
"标签英文名称"
,
orderNum
=
"1"
,
width
=
30
)
@NotNull
private
String
nameEn
;
@Excel
(
name
=
"排名"
,
orderNum
=
"2"
,
width
=
30
)
@NotNull
private
String
sort
;
@Excel
(
name
=
"总数"
,
orderNum
=
"3"
,
width
=
30
)
@NotNull
private
String
total
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getNameEn
()
{
return
nameEn
;
}
public
void
setNameEn
(
String
nameEn
)
{
this
.
nameEn
=
nameEn
;
}
public
String
getSort
()
{
return
sort
;
}
public
void
setSort
(
String
sort
)
{
this
.
sort
=
sort
;
}
public
String
getTotal
()
{
return
total
;
}
public
void
setTotal
(
String
total
)
{
this
.
total
=
total
;
}
@org
.
springframework
.
data
.
annotation
.
Transient
private
String
errMsg
;
@org
.
springframework
.
data
.
annotation
.
Transient
private
int
excelRowNum
;
@Override
public
String
getErrorMsg
()
{
return
errMsg
;
}
@Override
public
void
setErrorMsg
(
String
errorMsg
)
{
this
.
errMsg
=
errorMsg
;
}
@Override
public
Integer
getRowNum
()
{
return
excelRowNum
;
}
@Override
public
void
setRowNum
(
Integer
rowNum
)
{
this
.
excelRowNum
=
rowNum
;
}
}
src/main/java/com/keymobile/tagmanager/service/TagFileService.java
View file @
faa38c5f
...
@@ -28,6 +28,7 @@ import com.keymobile.tagmanager.model.ImportLog;
...
@@ -28,6 +28,7 @@ import com.keymobile.tagmanager.model.ImportLog;
import
com.keymobile.tagmanager.model.Page
;
import
com.keymobile.tagmanager.model.Page
;
import
com.keymobile.tagmanager.model.SysTag
;
import
com.keymobile.tagmanager.model.SysTag
;
import
com.keymobile.tagmanager.model.Tag
;
import
com.keymobile.tagmanager.model.Tag
;
import
com.keymobile.tagmanager.model.TagAnalysis
;
import
com.keymobile.tagmanager.model.TagMetadata
;
import
com.keymobile.tagmanager.model.TagMetadata
;
import
com.keymobile.tagmanager.persistence.TagRepository
;
import
com.keymobile.tagmanager.persistence.TagRepository
;
import
com.keymobile.tagmanager.remote.RepoServiceClient
;
import
com.keymobile.tagmanager.remote.RepoServiceClient
;
...
@@ -58,6 +59,38 @@ public class TagFileService {
...
@@ -58,6 +59,38 @@ public class TagFileService {
@Autowired
@Autowired
private
RepoServiceClient
repoService
;
private
RepoServiceClient
repoService
;
/**
* author:zhangkb time:2020-1-17 desc:标签分析excel导出
*/
@SuppressWarnings
(
"unchecked"
)
public
int
exportTagAnalysisExcel
(
String
dataType
,
String
type
,
HttpServletResponse
response
)
throws
Exception
{
Map
<
String
,
Object
>
tagAnalysisMap
=
tagService
.
tagAnalysis
(
dataType
);
List
<
Map
<
String
,
Object
>>
tagList
=
new
ArrayList
<>();
List
<
TagAnalysis
>
tagAnalysis
=
new
ArrayList
<>();
//如果是导出系统标签
if
(
"0"
.
equals
(
type
))
{
tagList
=
(
List
<
Map
<
String
,
Object
>>)
tagAnalysisMap
.
get
(
"sysTag"
);
}
else
{
tagList
=
(
List
<
Map
<
String
,
Object
>>)
tagAnalysisMap
.
get
(
"personalTag"
);
}
int
i
=
1
;
for
(
Map
<
String
,
Object
>
map
:
tagList
)
{
TagAnalysis
tagAn
=
new
TagAnalysis
();
tagAn
.
setName
(
map
.
get
(
"name"
).
toString
());
if
(
map
.
get
(
"EnName"
)!=
null
)
{
tagAn
.
setNameEn
(
map
.
get
(
"EnName"
).
toString
());
}
tagAn
.
setSort
(
i
+
""
);
tagAn
.
setTotal
(
map
.
get
(
"total"
).
toString
());
tagAnalysis
.
add
(
tagAn
);
}
// 导出操作
ExcelUtils
.
exportExcel
(
tagAnalysis
,
null
,
"sheet1"
,
TagAnalysis
.
class
,
"tagAnalysis_"
+
System
.
currentTimeMillis
()+
".xlsx"
,
response
);
return
tagAnalysis
.
size
();
}
//标签管理导入
//标签管理导入
public
String
importTagMetadataExcel
(
String
userName
,
String
userId
,
String
dept
,
public
String
importTagMetadataExcel
(
String
userName
,
String
userId
,
String
dept
,
String
idPath
,
String
dimensionType
,
String
tagType
,
MultipartFile
file
)
throws
Exception
{
String
idPath
,
String
dimensionType
,
String
tagType
,
MultipartFile
file
)
throws
Exception
{
...
...
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