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
04030b51
Commit
04030b51
authored
Dec 10, 2019
by
lanmw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
ebc0cc7b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
304 additions
and
34 deletions
+304
-34
pom.xml
pom.xml
+4
-3
TagCtrl.java
src/main/java/com/keymobile/tagmanager/api/TagCtrl.java
+7
-0
TagFileCtrl.java
src/main/java/com/keymobile/tagmanager/api/TagFileCtrl.java
+30
-5
ImportLog.java
src/main/java/com/keymobile/tagmanager/model/ImportLog.java
+156
-0
SysTag.java
src/main/java/com/keymobile/tagmanager/model/SysTag.java
+0
-0
Tag.java
src/main/java/com/keymobile/tagmanager/model/Tag.java
+52
-1
TagFileService.java
...java/com/keymobile/tagmanager/service/TagFileService.java
+0
-0
TagService.java
...ain/java/com/keymobile/tagmanager/service/TagService.java
+31
-13
Constants.java
src/main/java/com/keymobile/tagmanager/util/Constants.java
+3
-0
ExcelExportStylerCustomImpl.java
...eymobile/tagmanager/util/ExcelExportStylerCustomImpl.java
+11
-10
JsonTreeHelper.java
...in/java/com/keymobile/tagmanager/util/JsonTreeHelper.java
+10
-2
No files found.
pom.xml
View file @
04030b51
...
...
@@ -27,6 +27,7 @@
<druid.version>
1.0.29
</druid.version>
<fastjson.version>
1.2.30
</fastjson.version>
<spring-cloud.version>
Finchley.RELEASE
</spring-cloud.version>
<easypoi.version>
4.1.3
</easypoi.version>
</properties>
<dependencies>
...
...
@@ -141,17 +142,17 @@
<dependency>
<groupId>
cn.afterturn
</groupId>
<artifactId>
easypoi-base
</artifactId>
<version>
3.0.3
</version>
<version>
${easypoi.version}
</version>
</dependency>
<dependency>
<groupId>
cn.afterturn
</groupId>
<artifactId>
easypoi-web
</artifactId>
<version>
3.0.3
</version>
<version>
${easypoi.version}
</version>
</dependency>
<dependency>
<groupId>
cn.afterturn
</groupId>
<artifactId>
easypoi-annotation
</artifactId>
<version>
3.0.3
</version>
<version>
${easypoi.version}
</version>
</dependency>
<!-- 引入easypoi -->
</dependencies>
...
...
src/main/java/com/keymobile/tagmanager/api/TagCtrl.java
View file @
04030b51
...
...
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import
com.keymobile.tagmanager.exception.TagNotExistException
;
import
com.keymobile.tagmanager.model.Page
;
import
com.keymobile.tagmanager.model.SysTag
;
import
com.keymobile.tagmanager.model.Tag
;
import
com.keymobile.tagmanager.service.TagService
;
import
com.keymobile.tagmanager.util.JsonTreeHelper.JsonNode
;
...
...
@@ -90,6 +91,12 @@ public class TagCtrl {
return
tagService
.
searchSystemTagByPage
(
userName
,
keyword
,
path
,
domain
,
new
Page
(
pageSize
,
pageNo
));
}
@ApiOperation
(
value
=
"查询系统标签"
,
notes
=
"查询系统标签"
)
@GetMapping
(
value
=
"/listSysTags"
)
public
List
<
SysTag
>
listSysTags
()
{
return
tagService
.
listSysTags
();
}
@ApiOperation
(
value
=
"搜索维度标签里面的个人标签"
,
notes
=
"搜索维度标签里面的个人标签"
)
@GetMapping
(
value
=
"/searchPersonalDimensionTagByPage"
)
public
Page
searchPersonalDimensionTagByPage
(
@RequestParam
(
required
=
false
,
value
=
"keyword"
)
String
keyword
,
...
...
src/main/java/com/keymobile/tagmanager/api/TagFileCtrl.java
View file @
04030b51
...
...
@@ -5,31 +5,56 @@ import javax.servlet.http.HttpServletResponse;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.keymobile.tagmanager.model.
Tag
;
import
com.keymobile.tagmanager.model.
Page
;
import
com.keymobile.tagmanager.service.TagFileService
;
import
com.keymobile.tagmanager.util.UserInfoUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
@Api
(
value
=
"文件"
,
tags
=
"文件"
)
@RestController
@RequestMapping
(
value
=
"/file"
)
public
class
TagFileCtrl
{
@Autowired
private
TagFileService
tagExportService
;
@GetMapping
(
"/export
Excel
"
)
@GetMapping
(
"/export
Tag
"
)
public
int
export
(
HttpServletResponse
response
)
{
String
userName
=
UserInfoUtils
.
getUserName
();
return
tagExportService
.
exportExcel
(
userName
,
response
);
}
@PostMapping
(
"/import
Excel
"
)
public
int
importExcel
(
MultipartFile
fil
e
)
throws
Exception
{
@PostMapping
(
"/import
Tag
"
)
public
String
importExcel
(
MultipartFile
file
,
HttpServletResponse
respons
e
)
throws
Exception
{
String
userName
=
UserInfoUtils
.
getUserName
();
return
tagExportService
.
importExcel
(
userName
,
file
,
Tag
.
class
);
return
tagExportService
.
importExcel
(
userName
,
file
);
}
@PostMapping
(
"/importSysTag"
)
public
String
importSysExcel
(
MultipartFile
file
,
HttpServletResponse
response
)
throws
Exception
{
String
userName
=
UserInfoUtils
.
getUserName
();
return
tagExportService
.
importSysExcel
(
userName
,
file
);
}
@ApiOperation
(
value
=
"分页获取导入日志"
,
notes
=
"分页获取导入日志"
)
@GetMapping
(
value
=
"/listImportTagLogByPage"
)
public
Page
searchPersonalDimensionTagByPage
(
@RequestParam
(
"pageNo"
)
Integer
pageNo
,
@RequestParam
(
"pageSize"
)
Integer
pageSize
)
{
return
tagExportService
.
listImportlogByPage
(
new
Page
(
pageSize
,
pageNo
));
}
@ApiOperation
(
value
=
"撤销导入"
,
notes
=
"撤销导入"
)
@PostMapping
(
value
=
"/undoImportTag"
)
public
void
undoImportExcel
(
@RequestParam
(
"importlogId"
)
String
importlogId
)
{
tagExportService
.
undoImportExcel
(
importlogId
);
}
}
src/main/java/com/keymobile/tagmanager/model/ImportLog.java
0 → 100644
View file @
04030b51
package
com
.
keymobile
.
tagmanager
.
model
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
javax.persistence.Id
;
import
org.springframework.data.annotation.Transient
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
com.keymobile.tagmanager.util.Constants
;
import
com.keymobile.tagmanager.util.DateUtils
;
@Document
(
collection
=
"ImportLog"
)
public
class
ImportLog
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@Id
private
String
id
;
private
String
startTime
=
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
);
private
String
endTime
;
private
String
creator
;
private
boolean
hasFailNum
=
false
;
private
int
totalNum
;
private
List
<
String
>
successIds
=
new
ArrayList
<>();
@SuppressWarnings
(
"unused"
)
private
String
report
;
private
boolean
hasFinish
=
false
;
private
String
type
=
Constants
.
COMMON_TAG_LOG_TYPE
;
@Transient
private
StringBuilder
errorMsgSb
;
public
ImportLog
()
{
}
public
ImportLog
(
String
id
)
{
this
.
id
=
id
;
}
public
void
appendErrorMsg
(
String
errorMsg
)
{
if
(
errorMsgSb
==
null
)
{
errorMsgSb
=
new
StringBuilder
();
}
errorMsgSb
.
append
(
errorMsg
+
"<br>"
);
}
public
void
setReport
(
String
report
)
{
this
.
report
=
report
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getId
()
{
return
id
;
}
public
String
generateReport
()
{
int
failNum
=
totalNum
-
successIds
.
size
();
String
firstPart
=
String
.
format
(
"总共导入:%s条, 成功条数为:%s, 失败条数为:%s"
,
totalNum
,
successIds
.
size
(),
failNum
);
if
(
failNum
>
0
)
{
firstPart
+=
"<br>"
;
firstPart
+=
errorMsgSb
.
toString
();
}
return
firstPart
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getType
()
{
return
type
;
}
public
String
getReport
()
{
return
report
;
}
public
String
getCreator
()
{
return
creator
;
}
public
void
setCreator
(
String
creator
)
{
this
.
creator
=
creator
;
}
public
List
<
String
>
getSuccessIds
()
{
return
successIds
;
}
public
void
setSuccessIds
(
List
<
String
>
successIds
)
{
this
.
successIds
=
successIds
;
}
public
static
long
getSerialversionuid
()
{
return
serialVersionUID
;
}
public
int
getTotalNum
()
{
return
totalNum
;
}
public
void
setTotalNum
(
int
totalNum
)
{
this
.
totalNum
=
totalNum
;
}
public
String
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
String
startTime
)
{
this
.
startTime
=
startTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
boolean
isHasFailNum
()
{
return
hasFailNum
;
}
public
void
setHasFailNum
(
boolean
hasFailNum
)
{
this
.
hasFailNum
=
hasFailNum
;
}
public
boolean
isHasFinish
()
{
return
hasFinish
;
}
public
void
setHasFinish
(
boolean
hasFinish
)
{
this
.
hasFinish
=
hasFinish
;
}
}
src/main/java/com/keymobile/tagmanager/model/SysTag.java
0 → 100644
View file @
04030b51
This diff is collapsed.
Click to expand it.
src/main/java/com/keymobile/tagmanager/model/Tag.java
View file @
04030b51
...
...
@@ -2,6 +2,7 @@ package com.keymobile.tagmanager.model;
import
java.io.Serializable
;
import
javax.persistence.Id
;
import
javax.validation.constraints.NotNull
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.data.mongodb.core.mapping.Document
;
...
...
@@ -10,10 +11,12 @@ import com.keymobile.tagmanager.util.Constants;
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
(
"20"
)
@Document
(
collection
=
"Tag"
)
public
class
Tag
implements
Serializable
{
public
class
Tag
implements
Serializable
,
IExcelModel
,
IExcelDataModel
{
/**
*
...
...
@@ -22,11 +25,14 @@ public class Tag implements Serializable{
@Id
private
String
id
;
@Excel
(
name
=
"名称"
,
orderNum
=
"0"
,
width
=
30
)
@NotNull
private
String
name
;
@Excel
(
name
=
"英文名"
,
orderNum
=
"1"
,
width
=
30
)
private
String
nameEn
;
@Excel
(
name
=
"路径"
,
orderNum
=
"2"
,
width
=
30
)
@NotNull
private
String
path
;
@Excel
(
name
=
"描述"
,
orderNum
=
"3"
,
width
=
30
)
private
String
desc
;
...
...
@@ -36,11 +42,14 @@ public class Tag implements Serializable{
private
Integer
level
;
@Excel
(
name
=
"标签类型"
,
replace
=
{
"系统标签_0"
,
"自定义标签_1"
},
orderNum
=
"5"
,
width
=
30
)
private
String
tagType
;
//0, 系统标签, 1 ,自定义标签
private
String
idPath
;
private
String
creator
;
private
String
createDate
;
private
String
isOpen
=
Constants
.
TAG_CLOSE_STATUS
;
//0 不公开, 1, 公开
private
Integer
domain
;
private
String
dimensionType
=
Constants
.
TAG_DIMENSION_FALSE
;
//0 非维度标签, 1 维度标签
private
String
importId
;
//记录导入的Id,后面撤销用到
public
Tag
()
{}
...
...
@@ -77,6 +86,14 @@ public class Tag implements Serializable{
public
String
getId
()
{
return
id
;
}
public
void
setImportId
(
String
importId
)
{
this
.
importId
=
importId
;
}
public
String
getImportId
()
{
return
importId
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
...
...
@@ -177,6 +194,14 @@ public class Tag implements Serializable{
public
String
getDimensionType
()
{
return
dimensionType
;
}
public
void
setIdPath
(
String
idPath
)
{
this
.
idPath
=
idPath
;
}
public
String
getIdPath
()
{
return
idPath
;
}
@Override
public
String
toString
()
{
...
...
@@ -186,4 +211,30 @@ public class Tag implements Serializable{
+
", dimensionType="
+
dimensionType
+
"]"
;
}
@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 @
04030b51
This diff is collapsed.
Click to expand it.
src/main/java/com/keymobile/tagmanager/service/TagService.java
View file @
04030b51
...
...
@@ -3,6 +3,7 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -21,6 +22,7 @@ import com.keymobile.tagmanager.exception.TagException;
import
com.keymobile.tagmanager.exception.TagNotExistException
;
import
com.keymobile.tagmanager.model.ExtTag
;
import
com.keymobile.tagmanager.model.Page
;
import
com.keymobile.tagmanager.model.SysTag
;
import
com.keymobile.tagmanager.model.Tag
;
import
com.keymobile.tagmanager.persistence.TagRepository
;
import
com.keymobile.tagmanager.util.Constants
;
...
...
@@ -38,22 +40,33 @@ public class TagService {
private
Logger
logger
=
LoggerFactory
.
getLogger
(
TagService
.
class
);
public
Tag
addOrUpdateTag
(
String
parentId
,
Tag
tag
,
String
userName
)
throws
TagNotExistException
,
TagDuplicateException
,
TagException
{
String
originId
=
tag
.
getId
();
if
(
StringUtils
.
isNotBlank
(
parentId
))
{
Tag
parent
=
getTagById
(
parentId
);
String
parentIdPath
=
parent
.
getIdPath
();
String
tagId
=
StringUtils
.
isNotBlank
(
originId
)
?
originId
:
UUID
.
randomUUID
().
toString
();
tag
.
setId
(
tagId
);
tag
.
setIdPath
(
parentIdPath
+
Constants
.
TAG_PATH_SEPARATOR
+
tagId
);
tag
.
setPath
(
parent
.
getPath
()
+
Constants
.
TAG_PATH_SEPARATOR
+
tag
.
getName
());
}
else
{
tag
.
setPath
(
tag
.
getName
());
String
tagId
=
StringUtils
.
isNotBlank
(
originId
)
?
originId
:
UUID
.
randomUUID
().
toString
();
tag
.
setId
(
tagId
);
tag
.
setIdPath
(
tagId
);
}
changeNameToAvoidConflict
(
tag
,
userName
);
checkTagValid
(
tag
,
userName
);
if
(
StringUtils
.
isNotBlank
(
tag
.
getId
()))
{
if
(
StringUtils
.
isNotBlank
(
originId
))
{
//update
Tag
origin
=
mongoOperations
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"_id"
).
is
(
tag
.
getId
())),
Tag
.
class
);
List
<
Tag
>
relationTags
=
mongoOperations
.
find
(
Query
.
query
(
createRelationCriteria
(
userName
,
origin
)),
Tag
.
class
);
relationTags
.
forEach
(
p
->
{
List
<
Tag
>
relationNamepathTags
=
mongoOperations
.
find
(
Query
.
query
(
createRelationNamepathCriteria
(
userName
,
origin
)),
Tag
.
class
);
relationNamepathTags
.
forEach
(
p
->
{
p
.
setIdPath
(
p
.
getIdPath
().
replaceAll
(
origin
.
getIdPath
(),
tag
.
getIdPath
()));
p
.
setPath
(
p
.
getPath
().
replaceAll
(
origin
.
getPath
(),
tag
.
getPath
()));
p
.
setLevel
(
p
.
getPath
().
split
(
","
).
length
);
});
tagRepository
.
saveAll
(
relationTags
);
tagRepository
.
saveAll
(
relation
Namepath
Tags
);
}
tag
.
setLevel
(
tag
.
getPath
().
split
(
","
).
length
);
return
tagRepository
.
save
(
tag
);
...
...
@@ -69,8 +82,8 @@ public class TagService {
tag
.
setPath
(
t
.
getPath
().
substring
(
0
,
t
.
getPath
().
lastIndexOf
(
Constants
.
TAG_PATH_SEPARATOR
))
+
t
.
getName
());
}
}
private
Criteria
createRelationCriteria
(
String
userName
,
Tag
origin
)
{
private
Criteria
createRelation
Namepath
Criteria
(
String
userName
,
Tag
origin
)
{
if
(
Constants
.
TAG_DIMENSION_TRUE
.
equals
(
origin
.
getDimensionType
()))
{
return
Criteria
.
where
(
"path"
).
regex
(
"^"
+
origin
.
getPath
()
+
Constants
.
TAG_PATH_SEPARATOR
);
}
...
...
@@ -109,7 +122,7 @@ public class TagService {
}
List
<
JsonNode
>
nodes
=
new
ArrayList
<>();
tags
.
forEach
(
p
->
{
JsonNode
node
=
new
JsonNode
(
p
.
getPath
(),
p
.
getId
(),
p
.
getPath
());
JsonNode
node
=
new
JsonNode
(
p
.
getPath
(),
p
.
getId
(),
p
.
getPath
()
,
p
.
getIdPath
()
);
nodes
.
add
(
node
);
});
JsonNode
root
=
JsonTreeHelper
.
toJsonTree
(
nodes
,
Constants
.
TAG_PATH_SEPARATOR
);
...
...
@@ -214,7 +227,7 @@ public class TagService {
}
List
<
JsonNode
>
nodes
=
new
ArrayList
<>();
tags
.
forEach
(
p
->
{
JsonNode
node
=
new
JsonNode
(
p
.
getPath
(),
p
.
getId
(),
p
.
getPath
());
JsonNode
node
=
new
JsonNode
(
p
.
getPath
(),
p
.
getId
(),
p
.
getPath
()
,
p
.
getIdPath
()
);
nodes
.
add
(
node
);
});
JsonNode
root
=
JsonTreeHelper
.
toJsonTree
(
nodes
,
Constants
.
TAG_PATH_SEPARATOR
);
...
...
@@ -268,7 +281,7 @@ public class TagService {
Optional
<
Tag
>
optional
=
tagRepository
.
findById
(
tagId
);
if
(
optional
.
isPresent
())
{
Tag
parentTag
=
optional
.
get
();
List
<
Tag
>
childs
=
mongoOperations
.
find
(
Query
.
query
(
createRelationCriteria
(
userName
,
parentTag
)),
Tag
.
class
);
List
<
Tag
>
childs
=
mongoOperations
.
find
(
Query
.
query
(
createRelation
Namepath
Criteria
(
userName
,
parentTag
)),
Tag
.
class
);
if
(!
childs
.
isEmpty
())
{
throw
new
TagException
(
"存在子节点,不允许删除!"
);
}
...
...
@@ -280,7 +293,7 @@ public class TagService {
Optional
<
Tag
>
optional
=
tagRepository
.
findById
(
tagId
);
if
(
optional
.
isPresent
())
{
Tag
parentTag
=
optional
.
get
();
List
<
Tag
>
childs
=
mongoOperations
.
find
(
Query
.
query
(
createRelationCriteria
(
userName
,
parentTag
)),
Tag
.
class
);
List
<
Tag
>
childs
=
mongoOperations
.
find
(
Query
.
query
(
createRelation
Namepath
Criteria
(
userName
,
parentTag
)),
Tag
.
class
);
return
!
childs
.
isEmpty
();
}
return
false
;
...
...
@@ -305,7 +318,7 @@ public class TagService {
}
List
<
JsonNode
>
nodes
=
new
ArrayList
<>();
tags
.
forEach
(
p
->
{
JsonNode
node
=
new
JsonNode
(
p
.
getPath
(),
p
.
getId
(),
p
.
getPath
());
JsonNode
node
=
new
JsonNode
(
p
.
getPath
(),
p
.
getId
(),
p
.
getPath
()
,
p
.
getIdPath
()
);
nodes
.
add
(
node
);
});
JsonNode
root
=
JsonTreeHelper
.
toJsonTree
(
nodes
,
Constants
.
TAG_PATH_SEPARATOR
);
...
...
@@ -341,7 +354,7 @@ public class TagService {
}
List
<
JsonNode
>
nodes
=
new
ArrayList
<>();
tags
.
forEach
(
p
->
{
JsonNode
node
=
new
JsonNode
(
p
.
getPath
(),
p
.
getId
(),
p
.
getPath
());
JsonNode
node
=
new
JsonNode
(
p
.
getPath
(),
p
.
getId
(),
p
.
getPath
()
,
p
.
getIdPath
()
);
nodes
.
add
(
node
);
});
JsonNode
root
=
JsonTreeHelper
.
toJsonTree
(
nodes
,
Constants
.
TAG_PATH_SEPARATOR
);
...
...
@@ -362,6 +375,7 @@ public class TagService {
}
Query
q
=
createPageQuery
(
page
,
andCriterias
);
List
<
Tag
>
tags
=
mongoOperations
.
find
(
q
,
Tag
.
class
);
long
count
=
mongoOperations
.
count
(
q
,
Tag
.
class
);
page
.
setData
(
decoratorToExtTag
(
tags
,
userName
));
...
...
@@ -370,4 +384,8 @@ public class TagService {
}
public
List
<
SysTag
>
listSysTags
()
{
return
mongoOperations
.
findAll
(
SysTag
.
class
);
}
}
src/main/java/com/keymobile/tagmanager/util/Constants.java
View file @
04030b51
...
...
@@ -49,6 +49,9 @@ public final class Constants {
public
static
final
String
TAG_OPERABLE_TRUE
=
"1"
;
public
static
final
String
TAG_OPERABLE_FALSE
=
"0"
;
public
static
final
String
SYS_TAG_LOG_TYPE
=
"1"
;
public
static
final
String
COMMON_TAG_LOG_TYPE
=
"0"
;
public
static
final
String
PROCESS_AUDITSTATUS_APPLYING
=
"applying"
;
public
static
final
String
PROCESS_AUDITSTATUS_APPROVE
=
"approve"
;
...
...
src/main/java/com/keymobile/tagmanager/util/ExcelExportStylerCustomImpl.java
View file @
04030b51
package
com
.
keymobile
.
tagmanager
.
util
;
import
org.apache.poi.hssf.usermodel.HSSFFont
;
import
org.apache.poi.ss.usermodel.CellStyle
;
import
org.apache.poi.ss.usermodel.Font
;
import
org.apache.poi.ss.usermodel.HorizontalAlignment
;
import
org.apache.poi.ss.usermodel.VerticalAlignment
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
cn.afterturn.easypoi.excel.export.styler.AbstractExcelExportStyler
;
...
...
@@ -17,8 +18,8 @@ public class ExcelExportStylerCustomImpl extends AbstractExcelExportStyler imple
@Override
public
CellStyle
getHeaderStyle
(
short
headerColor
)
{
CellStyle
titleStyle
=
workbook
.
createCellStyle
();
titleStyle
.
setAlignment
(
CellStyle
.
ALIGN_
CENTER
);
titleStyle
.
setVerticalAlignment
(
CellStyle
.
VERTICAL_
CENTER
);
titleStyle
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
titleStyle
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
titleStyle
.
setWrapText
(
true
);
return
titleStyle
;
}
...
...
@@ -26,8 +27,8 @@ public class ExcelExportStylerCustomImpl extends AbstractExcelExportStyler imple
@Override
public
CellStyle
stringSeptailStyle
(
Workbook
workbook
,
boolean
isWarp
)
{
CellStyle
style
=
workbook
.
createCellStyle
();
style
.
setAlignment
(
CellStyle
.
ALIGN_
CENTER
);
style
.
setVerticalAlignment
(
CellStyle
.
VERTICAL_
CENTER
);
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
style
.
setDataFormat
(
STRING_FORMAT
);
if
(
isWarp
)
{
style
.
setWrapText
(
true
);
...
...
@@ -38,8 +39,8 @@ public class ExcelExportStylerCustomImpl extends AbstractExcelExportStyler imple
@Override
public
CellStyle
stringNoneStyle
(
Workbook
workbook
,
boolean
isWarp
)
{
CellStyle
style
=
workbook
.
createCellStyle
();
style
.
setAlignment
(
CellStyle
.
ALIGN_
CENTER
);
style
.
setVerticalAlignment
(
CellStyle
.
VERTICAL_
CENTER
);
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
style
.
setDataFormat
(
STRING_FORMAT
);
if
(
isWarp
)
{
style
.
setWrapText
(
true
);
...
...
@@ -51,12 +52,12 @@ public class ExcelExportStylerCustomImpl extends AbstractExcelExportStyler imple
public
CellStyle
getTitleStyle
(
short
color
)
{
CellStyle
titleStyle
=
workbook
.
createCellStyle
();
Font
headFont
=
workbook
.
createFont
();
headFont
.
setBold
weight
(
HSSFFont
.
BOLDWEIGHT_BOLD
);
headFont
.
setBold
(
true
);
headFont
.
setFontName
(
"宋体"
);
headFont
.
setFontHeightInPoints
((
short
)
11
);
titleStyle
.
setFont
(
headFont
);
titleStyle
.
setAlignment
(
CellStyle
.
ALIGN_
CENTER
);
titleStyle
.
setVerticalAlignment
(
CellStyle
.
VERTICAL_
CENTER
);
titleStyle
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
titleStyle
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
return
titleStyle
;
}
...
...
src/main/java/com/keymobile/tagmanager/util/JsonTreeHelper.java
View file @
04030b51
...
...
@@ -11,6 +11,7 @@ public class JsonTreeHelper {
public
String
nodeId
;
public
String
tagType
;
public
String
path
;
public
String
idPath
;
public
JsonNode
(
String
text
)
{
this
.
text
=
text
;
...
...
@@ -22,6 +23,13 @@ public class JsonTreeHelper {
this
.
nodeId
=
nodeId
;
}
public
JsonNode
(
String
text
,
String
nodeId
,
String
path
,
String
idPath
)
{
this
.
text
=
text
;
this
.
path
=
path
;
this
.
nodeId
=
nodeId
;
this
.
idPath
=
idPath
;
}
public
void
addChild
(
JsonNode
child
)
{
if
(
children
==
null
)
{
children
=
new
JsonNode
[]
{
child
};
...
...
@@ -51,7 +59,7 @@ public class JsonTreeHelper {
for
(
String
part
:
parts
)
{
JsonNode
subNode
=
null
;
if
(
current
.
getChildSize
()
==
0
)
{
subNode
=
new
JsonNode
(
part
,
jsonNode
.
nodeId
,
jsonNode
.
path
);
subNode
=
new
JsonNode
(
part
,
jsonNode
.
nodeId
,
jsonNode
.
path
,
jsonNode
.
idPath
);
current
.
addChild
(
subNode
);
}
else
{
for
(
JsonNode
node
:
current
.
children
)
{
...
...
@@ -59,7 +67,7 @@ public class JsonTreeHelper {
subNode
=
node
;
}
if
(
subNode
==
null
)
{
subNode
=
new
JsonNode
(
part
,
jsonNode
.
nodeId
,
jsonNode
.
path
);
subNode
=
new
JsonNode
(
part
,
jsonNode
.
nodeId
,
jsonNode
.
path
,
jsonNode
.
idPath
);
current
.
addChild
(
subNode
);
}
}
...
...
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