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
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1071 additions
and
53 deletions
+1071
-53
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
+534
-0
Tag.java
src/main/java/com/keymobile/tagmanager/model/Tag.java
+52
-1
TagFileService.java
...java/com/keymobile/tagmanager/service/TagFileService.java
+233
-19
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
package
com
.
keymobile
.
tagmanager
.
model
;
import
java.io.Serializable
;
import
javax.persistence.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
cn.afterturn.easypoi.excel.annotation.Excel
;
import
cn.afterturn.easypoi.handler.inter.IExcelDataModel
;
import
cn.afterturn.easypoi.handler.inter.IExcelModel
;
@Document
(
collection
=
"SysTag"
)
public
class
SysTag
implements
Serializable
,
IExcelModel
,
IExcelDataModel
{
// const formdata=[{"name":"name","type":{"name":"string"},"cnName":"名称","order":1,"indexed":true,"id":false,"required":true},{"name":"cnName","type":{"name":"string"},"cnName":"中文名称","order":2,"indexed":true,"id":false,"required":false},{"name":"comment","type":{"name":"string"},"cnName":"说明","order":3,"indexed":true,"id":false,"required":false},{"name":"serialNumber","type":{"name":"string"},"cnName":"序号","order":4,"indexed":false,"id":false,"required":false},{"name":"systemCode","type":{"name":"string"},"cnName":"系统代码","order":5,"indexed":false,"id":false,"required":true},{"name":"systemType","type":{"name":"string"},"cnName":"系统类型","order":6,"indexed":false,"id":false,"required":false},{"name":"alias","type":{"name":"string"},"cnName":"曾用名/别名","order":7,"indexed":false,"id":false,"required":false},{"name":"devNo","type":{"name":"string"},"cnName":"开发支出资产主数据号","order":8,"indexed":false,"id":false,"required":false},{"name":"intangibleNo","type":{"name":"string"},"cnName":"无形资产主数据号","order":9,"indexed":false,"id":false,"required":false},{"name":"itemNo","type":{"name":"string"},"cnName":"立项号","order":10,"indexed":false,"id":false,"required":false},{"name":"businessDomain","type":{"name":"string"},"cnName":"业务域","order":11,"indexed":false,"id":false,"required":false},{"name":"businessFlow","type":{"name":"string"},"cnName":"业务流","order":12,"indexed":false,"id":false,"required":false},{"name":"catalog","type":{"name":"string"},"cnName":"所属板块","order":13,"indexed":false,"id":false,"required":true},{"name":"dept","type":{"name":"string"},"cnName":"所属部门","order":14,"indexed":false,"id":false,"required":false},{"name":"systemIntroduction","type":{"name":"string"},"cnName":"系统简介","order":15,"indexed":false,"id":false,"required":false},{"name":"URL","type":{"name":"string"},"cnName":"网址","order":16,"indexed":false,"id":false,"required":false},{"name":"ip","type":{"name":"string"},"cnName":"IP地址","order":17,"indexed":false,"id":false,"required":false},{"name":"contact","type":{"name":"string"},"cnName":"系统当前联系人","order":18,"indexed":false,"id":false,"required":false},{"name":"businessSystemNo","type":{"name":"string"},"cnName":"业务系统编号","order":19,"indexed":false,"id":false,"required":false},{"name":"documents","type":{"name":"string"},"cnName":"项目过程文档","order":20,"indexed":false,"id":false,"required":false},{"name":"systemPersonInCharge","type":{"name":"string"},"cnName":"系统创建负责人","order":21,"indexed":false,"id":false,"required":false},{"name":"personnelList","type":{"name":"string"},"cnName":"研发人员名单","order":22,"indexed":false,"id":false,"required":false},{"name":"userList","type":{"name":"string"},"cnName":"系统授权用户清单","order":23,"indexed":false,"id":false,"required":false},{"name":"systemFunction","type":{"name":"string"},"cnName":"系统功能点","order":24,"indexed":false,"id":false,"required":false},{"name":"moduleDescription","type":{"name":"string"},"cnName":"系统功能模块描述","order":25,"indexed":false,"id":false,"required":false},{"name":"callRelationship","type":{"name":"string"},"cnName":"系统调用关系","order":26,"indexed":false,"id":false,"required":false},{"name":"capabilityBlock","type":{"name":"string"},"cnName":"对应的能力块","order":27,"indexed":false,"id":false,"required":false},{"name":"masterData","type":{"name":"string"},"cnName":"主要数据","order":28,"indexed":false,"id":false,"required":false},{"name":"functionClassification","type":{"name":"string"},"cnName":"系统功能分类","order":29,"indexed":false,"id":false,"required":false},{"name":"importantSystem","type":{"name":"string"},"cnName":"是否重要信息系统","order":30,"indexed":false,"id":false,"required":false},{"name":"organ","type":{"name":"string"},"cnName":"使用机构","order":31,"indexed":false,"id":false,"required":false},{"name":"serviceObject","type":{"name":"string"},"cnName":"服务对象","order":32,"indexed":false,"id":false,"required":false},{"name":"businessDepartment","type":{"name":"string"},"cnName":"业务负责部门","order":33,"indexed":false,"id":false,"required":false},{"name":"constructionDepartment","type":{"name":"string"},"cnName":"系统建设部门","order":34,"indexed":false,"id":false,"required":false},{"name":"operationDepartment","type":{"name":"string"},"cnName":"系统运维部门","order":35,"indexed":false,"id":false,"required":false},{"name":"serviceWindow","type":{"name":"string"},"cnName":"运行服务窗口","order":36,"indexed":false,"id":false,"required":false},{"name":"systemOnlineTime","type":{"name":"string"},"cnName":"系统上线时间","order":37,"indexed":false,"id":false,"required":false},{"name":"systemOfflineTime","type":{"name":"string"},"cnName":"系统下线时间","order":38,"indexed":false,"id":false,"required":false},{"name":"mainVersion","type":{"name":"string"},"cnName":"应用系统主版本","order":39,"indexed":false,"id":false,"required":false},{"name":"securityProtectionLevel","type":{"name":"string"},"cnName":"系统安全保护等级","order":40,"indexed":false,"id":false,"required":false},{"name":"maintenanceClassification","type":{"name":"string"},"cnName":"系统维护分类","order":41,"indexed":false,"id":false,"required":false},{"name":"nodeName","type":{"name":"string"},"cnName":"节点名称","order":42,"indexed":false,"id":false,"required":false},{"name":"hardware","type":{"name":"string"},"cnName":"硬件","order":43,"indexed":false,"id":false,"required":false},{"name":"softwareAndVersionNo","type":{"name":"string"},"cnName":"系统软件及版本号","order":44,"indexed":false,"id":false,"required":false},{"name":"locationOfDeployment","type":{"name":"string"},"cnName":"部署地点","order":45,"indexed":false,"id":false,"required":false},{"name":"disasterPreparedness","type":{"name":"string"},"cnName":"灾备情况","order":46,"indexed":false,"id":false,"required":false},{"name":"thirdPartyConnection","type":{"name":"string"},"cnName":"第三方连接","order":47,"indexed":false,"id":false,"required":false},{"name":"systemAssociation","type":{"name":"string"},"cnName":"系统关联关系","order":48,"indexed":false,"id":false,"required":false},{"name":"otherInstructions","type":{"name":"string"},"cnName":"其他说明项","order":49,"indexed":false,"id":false,"required":false},{"name":"informationApplicationDepartment","type":{"name":"string"},"cnName":"信息申报部门","order":50,"indexed":false,"id":false,"required":false},{"name":"fillingPerson","type":{"name":"string"},"cnName":"填表人","order":51,"indexed":false,"id":false,"required":false},{"name":"upgradingTime","type":{"name":"string"},"cnName":"升级改造时间","order":52,"indexed":false,"id":false,"required":false},{"name":"mainContentsOfUpgrading","type":{"name":"string"},"cnName":"升级改造主要内容","order":53,"indexed":false,"id":false,"required":false},{"name":"dateOfChange","type":{"name":"string"},"cnName":"变更日期","order":54,"indexed":false,"id":false,"required":false},{"name":"counterpartSector","type":{"name":"string"},"cnName":"对口部门","order":55,"indexed":false,"id":false,"required":false},{"name":"personInCharge","type":{"name":"string"},"cnName":"负责人","order":56,"indexed":false,"id":false,"required":false},{"name":"recordCreationDate","type":{"name":"string"},"cnName":"记录创建日期","order":57,"indexed":false,"id":false,"required":false},{"name":"recordUpdateDate","type":{"name":"string"},"cnName":"记录更新日期","order":58,"indexed":false,"id":false,"required":false},{"name":"on-lineDate","type":{"name":"string"},"cnName":"上线日期","order":59,"indexed":false,"id":false,"required":false},{"name":"systemState","type":{"name":"string"},"cnName":"系统状态","order":60,"indexed":false,"id":false,"required":false}]
@Id
private
String
id
;
@Excel
(
name
=
"名称"
,
orderNum
=
"1"
,
width
=
30
)
private
String
name
;
@Excel
(
name
=
"中文名称"
,
orderNum
=
"2"
,
width
=
30
)
private
String
cnName
;
@Excel
(
name
=
"说明"
,
orderNum
=
"3"
,
width
=
30
)
private
String
comment
;
@Excel
(
name
=
"序号"
,
orderNum
=
"4"
,
width
=
30
)
private
String
serialNumber
;
@Excel
(
name
=
"系统代码"
,
orderNum
=
"5"
,
width
=
30
)
private
String
systemCode
;
@Excel
(
name
=
"系统类型"
,
orderNum
=
"6"
,
width
=
30
)
private
String
systemType
;
@Excel
(
name
=
"曾用名/别名"
,
orderNum
=
"7"
,
width
=
30
)
private
String
alias
;
@Excel
(
name
=
"开发支出资产主数据号"
,
orderNum
=
"8"
,
width
=
30
)
private
String
devNo
;
@Excel
(
name
=
"无形资产主数据号"
,
orderNum
=
"9"
,
width
=
30
)
private
String
intangibleNo
;
@Excel
(
name
=
"立项号"
,
orderNum
=
"10"
,
width
=
30
)
private
String
itemNo
;
@Excel
(
name
=
"业务域"
,
orderNum
=
"11"
,
width
=
30
)
private
String
businessDomain
;
@Excel
(
name
=
"业务流"
,
orderNum
=
"12"
,
width
=
30
)
private
String
businessFlow
;
@Excel
(
name
=
"所属板块"
,
orderNum
=
"13"
,
width
=
30
)
private
String
catalog
;
@Excel
(
name
=
"所属部门"
,
orderNum
=
"14"
,
width
=
30
)
private
String
dept
;
@Excel
(
name
=
"系统简介"
,
orderNum
=
"15"
,
width
=
30
)
private
String
systemIntroduction
;
@Excel
(
name
=
"网址"
,
orderNum
=
"16"
,
width
=
30
)
private
String
URL
;
@Excel
(
name
=
"IP地址"
,
orderNum
=
"17"
,
width
=
30
)
private
String
ip
;
@Excel
(
name
=
"系统当前联系人"
,
orderNum
=
"18"
,
width
=
30
)
private
String
contact
;
@Excel
(
name
=
"业务系统编号"
,
orderNum
=
"19"
,
width
=
30
)
private
String
businessSystemNo
;
@Excel
(
name
=
"项目过程文档"
,
orderNum
=
"20"
,
width
=
30
)
private
String
documents
;
@Excel
(
name
=
"系统创建负责人"
,
orderNum
=
"21"
,
width
=
30
)
private
String
systemPersonInCharge
;
@Excel
(
name
=
"研发人员名单"
,
orderNum
=
"22"
,
width
=
30
)
private
String
personnelList
;
@Excel
(
name
=
"系统授权用户清单"
,
orderNum
=
"23"
,
width
=
30
)
private
String
userList
;
@Excel
(
name
=
"系统功能点"
,
orderNum
=
"24"
,
width
=
30
)
private
String
systemFunction
;
@Excel
(
name
=
"系统功能模块描述"
,
orderNum
=
"25"
,
width
=
30
)
private
String
moduleDescription
;
@Excel
(
name
=
"系统调用关系"
,
orderNum
=
"26"
,
width
=
30
)
private
String
callRelationship
;
@Excel
(
name
=
"对应的能力块"
,
orderNum
=
"27"
,
width
=
30
)
private
String
capabilityBlock
;
@Excel
(
name
=
"主要数据"
,
orderNum
=
"28"
,
width
=
30
)
private
String
masterData
;
@Excel
(
name
=
"系统功能分类"
,
orderNum
=
"29"
,
width
=
30
)
private
String
functionClassification
;
@Excel
(
name
=
"是否重要信息系统"
,
orderNum
=
"30"
,
width
=
30
)
private
String
importantSystem
;
@Excel
(
name
=
"使用机构"
,
orderNum
=
"31"
,
width
=
30
)
private
String
organ
;
@Excel
(
name
=
"服务对象"
,
orderNum
=
"32"
,
width
=
30
)
private
String
serviceObject
;
@Excel
(
name
=
"业务负责部门"
,
orderNum
=
"33"
,
width
=
30
)
private
String
businessDepartment
;
@Excel
(
name
=
"系统建设部门"
,
orderNum
=
"34"
,
width
=
30
)
private
String
constructionDepartment
;
@Excel
(
name
=
"系统运维部门"
,
orderNum
=
"35"
,
width
=
30
)
private
String
operationDepartment
;
@Excel
(
name
=
"运行服务窗口"
,
orderNum
=
"36"
,
width
=
30
)
private
String
serviceWindow
;
@Excel
(
name
=
"系统上线时间"
,
orderNum
=
"37"
,
width
=
30
)
private
String
systemOnlineTime
;
@Excel
(
name
=
"系统下线时间"
,
orderNum
=
"38"
,
width
=
30
)
private
String
systemOfflineTime
;
@Excel
(
name
=
"应用系统主版本"
,
orderNum
=
"39"
,
width
=
30
)
private
String
mainVersion
;
@Excel
(
name
=
"系统安全保护等级"
,
orderNum
=
"40"
,
width
=
30
)
private
String
securityProtectionLevel
;
@Excel
(
name
=
"系统维护分类"
,
orderNum
=
"41"
,
width
=
30
)
private
String
maintenanceClassification
;
@Excel
(
name
=
"节点名称"
,
orderNum
=
"42"
,
width
=
30
)
private
String
nodeName
;
@Excel
(
name
=
"硬件"
,
orderNum
=
"43"
,
width
=
30
)
private
String
hardware
;
@Excel
(
name
=
"系统软件及版本号"
,
orderNum
=
"44"
,
width
=
30
)
private
String
softwareAndVersionNo
;
@Excel
(
name
=
"部署地点"
,
orderNum
=
"45"
,
width
=
30
)
private
String
locationOfDeployment
;
@Excel
(
name
=
"灾备情况"
,
orderNum
=
"46"
,
width
=
30
)
private
String
disasterPreparedness
;
@Excel
(
name
=
"第三方连接"
,
orderNum
=
"47"
,
width
=
30
)
private
String
thirdPartyConnection
;
@Excel
(
name
=
"系统关联关系"
,
orderNum
=
"48"
,
width
=
30
)
private
String
systemAssociation
;
@Excel
(
name
=
"其他说明项"
,
orderNum
=
"49"
,
width
=
30
)
private
String
otherInstructions
;
@Excel
(
name
=
"信息申报部门"
,
orderNum
=
"50"
,
width
=
30
)
private
String
informationApplicationDepartment
;
@Excel
(
name
=
"填表人"
,
orderNum
=
"51"
,
width
=
30
)
private
String
fillingPerson
;
@Excel
(
name
=
"升级改造时间"
,
orderNum
=
"52"
,
width
=
30
)
private
String
upgradingTime
;
@Excel
(
name
=
"升级改造主要内容"
,
orderNum
=
"53"
,
width
=
30
)
private
String
mainContentsOfUpgrading
;
@Excel
(
name
=
"变更日期"
,
orderNum
=
"54"
,
width
=
30
)
private
String
dateOfChange
;
@Excel
(
name
=
"对口部门"
,
orderNum
=
"55"
,
width
=
30
)
private
String
counterpartSector
;
@Excel
(
name
=
"负责人"
,
orderNum
=
"56"
,
width
=
30
)
private
String
personInCharge
;
@Excel
(
name
=
"记录创建日期"
,
orderNum
=
"57"
,
width
=
30
)
private
String
recordCreationDate
;
@Excel
(
name
=
"记录更新日期"
,
orderNum
=
"58"
,
width
=
30
)
private
String
recordUpdateDate
;
@Excel
(
name
=
"上线日期"
,
orderNum
=
"59"
,
width
=
30
)
private
String
onLineDate
;
@Excel
(
name
=
"系统状态"
,
orderNum
=
"60"
,
width
=
30
)
private
String
systemState
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCnName
()
{
return
cnName
;
}
public
void
setCnName
(
String
cnName
)
{
this
.
cnName
=
cnName
;
}
public
String
getComment
()
{
return
comment
;
}
public
void
setComment
(
String
comment
)
{
this
.
comment
=
comment
;
}
public
String
getSerialNumber
()
{
return
serialNumber
;
}
public
void
setSerialNumber
(
String
serialNumber
)
{
this
.
serialNumber
=
serialNumber
;
}
public
String
getSystemCode
()
{
return
systemCode
;
}
public
void
setSystemCode
(
String
systemCode
)
{
this
.
systemCode
=
systemCode
;
}
public
String
getSystemType
()
{
return
systemType
;
}
public
void
setSystemType
(
String
systemType
)
{
this
.
systemType
=
systemType
;
}
public
String
getAlias
()
{
return
alias
;
}
public
void
setAlias
(
String
alias
)
{
this
.
alias
=
alias
;
}
public
String
getDevNo
()
{
return
devNo
;
}
public
void
setDevNo
(
String
devNo
)
{
this
.
devNo
=
devNo
;
}
public
String
getIntangibleNo
()
{
return
intangibleNo
;
}
public
void
setIntangibleNo
(
String
intangibleNo
)
{
this
.
intangibleNo
=
intangibleNo
;
}
public
String
getItemNo
()
{
return
itemNo
;
}
public
void
setItemNo
(
String
itemNo
)
{
this
.
itemNo
=
itemNo
;
}
public
String
getBusinessDomain
()
{
return
businessDomain
;
}
public
void
setBusinessDomain
(
String
businessDomain
)
{
this
.
businessDomain
=
businessDomain
;
}
public
String
getBusinessFlow
()
{
return
businessFlow
;
}
public
void
setBusinessFlow
(
String
businessFlow
)
{
this
.
businessFlow
=
businessFlow
;
}
public
String
getCatalog
()
{
return
catalog
;
}
public
void
setCatalog
(
String
catalog
)
{
this
.
catalog
=
catalog
;
}
public
String
getDept
()
{
return
dept
;
}
public
void
setDept
(
String
dept
)
{
this
.
dept
=
dept
;
}
public
String
getSystemIntroduction
()
{
return
systemIntroduction
;
}
public
void
setSystemIntroduction
(
String
systemIntroduction
)
{
this
.
systemIntroduction
=
systemIntroduction
;
}
public
String
getURL
()
{
return
URL
;
}
public
void
setURL
(
String
uRL
)
{
URL
=
uRL
;
}
public
String
getIp
()
{
return
ip
;
}
public
void
setIp
(
String
ip
)
{
this
.
ip
=
ip
;
}
public
String
getContact
()
{
return
contact
;
}
public
void
setContact
(
String
contact
)
{
this
.
contact
=
contact
;
}
public
String
getBusinessSystemNo
()
{
return
businessSystemNo
;
}
public
void
setBusinessSystemNo
(
String
businessSystemNo
)
{
this
.
businessSystemNo
=
businessSystemNo
;
}
public
String
getDocuments
()
{
return
documents
;
}
public
void
setDocuments
(
String
documents
)
{
this
.
documents
=
documents
;
}
public
String
getSystemPersonInCharge
()
{
return
systemPersonInCharge
;
}
public
void
setSystemPersonInCharge
(
String
systemPersonInCharge
)
{
this
.
systemPersonInCharge
=
systemPersonInCharge
;
}
public
String
getPersonnelList
()
{
return
personnelList
;
}
public
void
setPersonnelList
(
String
personnelList
)
{
this
.
personnelList
=
personnelList
;
}
public
String
getUserList
()
{
return
userList
;
}
public
void
setUserList
(
String
userList
)
{
this
.
userList
=
userList
;
}
public
String
getSystemFunction
()
{
return
systemFunction
;
}
public
void
setSystemFunction
(
String
systemFunction
)
{
this
.
systemFunction
=
systemFunction
;
}
public
String
getModuleDescription
()
{
return
moduleDescription
;
}
public
void
setModuleDescription
(
String
moduleDescription
)
{
this
.
moduleDescription
=
moduleDescription
;
}
public
String
getCallRelationship
()
{
return
callRelationship
;
}
public
void
setCallRelationship
(
String
callRelationship
)
{
this
.
callRelationship
=
callRelationship
;
}
public
String
getCapabilityBlock
()
{
return
capabilityBlock
;
}
public
void
setCapabilityBlock
(
String
capabilityBlock
)
{
this
.
capabilityBlock
=
capabilityBlock
;
}
public
String
getMasterData
()
{
return
masterData
;
}
public
void
setMasterData
(
String
masterData
)
{
this
.
masterData
=
masterData
;
}
public
String
getFunctionClassification
()
{
return
functionClassification
;
}
public
void
setFunctionClassification
(
String
functionClassification
)
{
this
.
functionClassification
=
functionClassification
;
}
public
String
getImportantSystem
()
{
return
importantSystem
;
}
public
void
setImportantSystem
(
String
importantSystem
)
{
this
.
importantSystem
=
importantSystem
;
}
public
String
getOrgan
()
{
return
organ
;
}
public
void
setOrgan
(
String
organ
)
{
this
.
organ
=
organ
;
}
public
String
getServiceObject
()
{
return
serviceObject
;
}
public
void
setServiceObject
(
String
serviceObject
)
{
this
.
serviceObject
=
serviceObject
;
}
public
String
getBusinessDepartment
()
{
return
businessDepartment
;
}
public
void
setBusinessDepartment
(
String
businessDepartment
)
{
this
.
businessDepartment
=
businessDepartment
;
}
public
String
getConstructionDepartment
()
{
return
constructionDepartment
;
}
public
void
setConstructionDepartment
(
String
constructionDepartment
)
{
this
.
constructionDepartment
=
constructionDepartment
;
}
public
String
getOperationDepartment
()
{
return
operationDepartment
;
}
public
void
setOperationDepartment
(
String
operationDepartment
)
{
this
.
operationDepartment
=
operationDepartment
;
}
public
String
getServiceWindow
()
{
return
serviceWindow
;
}
public
void
setServiceWindow
(
String
serviceWindow
)
{
this
.
serviceWindow
=
serviceWindow
;
}
public
String
getSystemOnlineTime
()
{
return
systemOnlineTime
;
}
public
void
setSystemOnlineTime
(
String
systemOnlineTime
)
{
this
.
systemOnlineTime
=
systemOnlineTime
;
}
public
String
getSystemOfflineTime
()
{
return
systemOfflineTime
;
}
public
void
setSystemOfflineTime
(
String
systemOfflineTime
)
{
this
.
systemOfflineTime
=
systemOfflineTime
;
}
public
String
getMainVersion
()
{
return
mainVersion
;
}
public
void
setMainVersion
(
String
mainVersion
)
{
this
.
mainVersion
=
mainVersion
;
}
public
String
getSecurityProtectionLevel
()
{
return
securityProtectionLevel
;
}
public
void
setSecurityProtectionLevel
(
String
securityProtectionLevel
)
{
this
.
securityProtectionLevel
=
securityProtectionLevel
;
}
public
String
getMaintenanceClassification
()
{
return
maintenanceClassification
;
}
public
void
setMaintenanceClassification
(
String
maintenanceClassification
)
{
this
.
maintenanceClassification
=
maintenanceClassification
;
}
public
String
getNodeName
()
{
return
nodeName
;
}
public
void
setNodeName
(
String
nodeName
)
{
this
.
nodeName
=
nodeName
;
}
public
String
getHardware
()
{
return
hardware
;
}
public
void
setHardware
(
String
hardware
)
{
this
.
hardware
=
hardware
;
}
public
String
getSoftwareAndVersionNo
()
{
return
softwareAndVersionNo
;
}
public
void
setSoftwareAndVersionNo
(
String
softwareAndVersionNo
)
{
this
.
softwareAndVersionNo
=
softwareAndVersionNo
;
}
public
String
getLocationOfDeployment
()
{
return
locationOfDeployment
;
}
public
void
setLocationOfDeployment
(
String
locationOfDeployment
)
{
this
.
locationOfDeployment
=
locationOfDeployment
;
}
public
String
getDisasterPreparedness
()
{
return
disasterPreparedness
;
}
public
void
setDisasterPreparedness
(
String
disasterPreparedness
)
{
this
.
disasterPreparedness
=
disasterPreparedness
;
}
public
String
getThirdPartyConnection
()
{
return
thirdPartyConnection
;
}
public
void
setThirdPartyConnection
(
String
thirdPartyConnection
)
{
this
.
thirdPartyConnection
=
thirdPartyConnection
;
}
public
String
getSystemAssociation
()
{
return
systemAssociation
;
}
public
void
setSystemAssociation
(
String
systemAssociation
)
{
this
.
systemAssociation
=
systemAssociation
;
}
public
String
getOtherInstructions
()
{
return
otherInstructions
;
}
public
void
setOtherInstructions
(
String
otherInstructions
)
{
this
.
otherInstructions
=
otherInstructions
;
}
public
String
getInformationApplicationDepartment
()
{
return
informationApplicationDepartment
;
}
public
void
setInformationApplicationDepartment
(
String
informationApplicationDepartment
)
{
this
.
informationApplicationDepartment
=
informationApplicationDepartment
;
}
public
String
getFillingPerson
()
{
return
fillingPerson
;
}
public
void
setFillingPerson
(
String
fillingPerson
)
{
this
.
fillingPerson
=
fillingPerson
;
}
public
String
getUpgradingTime
()
{
return
upgradingTime
;
}
public
void
setUpgradingTime
(
String
upgradingTime
)
{
this
.
upgradingTime
=
upgradingTime
;
}
public
String
getMainContentsOfUpgrading
()
{
return
mainContentsOfUpgrading
;
}
public
void
setMainContentsOfUpgrading
(
String
mainContentsOfUpgrading
)
{
this
.
mainContentsOfUpgrading
=
mainContentsOfUpgrading
;
}
public
String
getDateOfChange
()
{
return
dateOfChange
;
}
public
void
setDateOfChange
(
String
dateOfChange
)
{
this
.
dateOfChange
=
dateOfChange
;
}
public
String
getCounterpartSector
()
{
return
counterpartSector
;
}
public
void
setCounterpartSector
(
String
counterpartSector
)
{
this
.
counterpartSector
=
counterpartSector
;
}
public
String
getPersonInCharge
()
{
return
personInCharge
;
}
public
void
setPersonInCharge
(
String
personInCharge
)
{
this
.
personInCharge
=
personInCharge
;
}
public
String
getRecordCreationDate
()
{
return
recordCreationDate
;
}
public
void
setRecordCreationDate
(
String
recordCreationDate
)
{
this
.
recordCreationDate
=
recordCreationDate
;
}
public
String
getRecordUpdateDate
()
{
return
recordUpdateDate
;
}
public
void
setRecordUpdateDate
(
String
recordUpdateDate
)
{
this
.
recordUpdateDate
=
recordUpdateDate
;
}
public
String
getOnLineDate
()
{
return
onLineDate
;
}
public
void
setOnLineDate
(
String
onLineDate
)
{
this
.
onLineDate
=
onLineDate
;
}
public
String
getSystemState
()
{
return
systemState
;
}
public
void
setSystemState
(
String
systemState
)
{
this
.
systemState
=
systemState
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
@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
;
}
@org
.
springframework
.
data
.
annotation
.
Transient
private
String
errMsg
;
@org
.
springframework
.
data
.
annotation
.
Transient
private
int
excelRowNum
;
}
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
package
com
.
keymobile
.
tagmanager
.
service
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort.Direction
;
import
org.springframework.data.domain.Sort.Order
;
import
org.springframework.data.mongodb.core.MongoOperations
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.keymobile.tagmanager.model.ImportLog
;
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
;
import
com.keymobile.tagmanager.util.DateUtils
;
import
com.keymobile.tagmanager.util.ExcelUtils
;
import
cn.afterturn.easypoi.excel.ExcelImportUtil
;
import
cn.afterturn.easypoi.excel.entity.ImportParams
;
import
cn.afterturn.easypoi.excel.entity.result.ExcelImportResult
;
import
cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult
;
import
cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler
;
@Service
public
class
TagFileService
{
@Autowired
private
MongoOperations
mongoOperations
;
@Autowired
private
TagRepository
tagRepository
;
public
int
exportExcel
(
String
userName
,
HttpServletResponse
response
)
{
List
<
Tag
>
toExportTags
=
mongoOperations
.
find
(
Query
.
query
(
Criteria
.
where
(
"creator"
).
is
(
userName
)
.
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
)),
Tag
.
class
);
...
...
@@ -30,27 +50,221 @@ public class TagFileService {
ExcelUtils
.
exportExcel
(
toExportTags
,
null
,
"sheet1"
,
Tag
.
class
,
"标签.xlsx"
,
response
);
return
toExportTags
.
size
();
}
public
int
importExcel
(
String
userName
,
MultipartFile
file
,
Class
<
Tag
>
class1
)
{
List
<
Tag
>
tags
=
ExcelUtils
.
importExcel
(
file
,
0
,
1
,
Tag
.
class
);
int
importCount
=
0
;
for
(
Tag
t
:
tags
)
{
if
(
checkIsValid
(
t
))
{
t
.
setLevel
(
t
.
getPath
().
split
(
","
).
length
);
t
.
setCreator
(
userName
);
t
.
setDimensionType
(
Constants
.
TAG_DIMENSION_TRUE
);
t
.
setCreateDate
(
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd"
));
mongoOperations
.
save
(
t
);
importCount
++;
public
String
importExcel
(
String
userName
,
MultipartFile
file
)
throws
Exception
{
ImportLog
importLog
=
new
ImportLog
(
UUID
.
randomUUID
().
toString
());
importLog
.
setCreator
(
userName
);
mongoOperations
.
save
(
importLog
);
new
Thread
(
new
ExcelImportExecutor
(
userName
,
file
,
importLog
)).
start
();
return
"ok"
;
}
public
String
importSysExcel
(
String
userName
,
MultipartFile
file
)
throws
Exception
{
ImportLog
importLog
=
new
ImportLog
(
UUID
.
randomUUID
().
toString
());
importLog
.
setType
(
Constants
.
SYS_TAG_LOG_TYPE
);
importLog
.
setCreator
(
userName
);
mongoOperations
.
save
(
importLog
);
new
Thread
(
new
SysExcelImportExecutor
(
userName
,
file
,
importLog
)).
start
();
return
"ok"
;
}
class
SysExcelVerifyHandler
implements
IExcelVerifyHandler
<
SysTag
>
{
private
Map
<
String
,
SysTag
>
codeSysTags
;
private
Map
<
String
,
SysTag
>
nameSysTags
;
public
SysExcelVerifyHandler
(
Map
<
String
,
SysTag
>
codeSysTags
,
Map
<
String
,
SysTag
>
nameSysTags
)
{
this
.
codeSysTags
=
codeSysTags
;
this
.
nameSysTags
=
nameSysTags
;
}
@Override
public
ExcelVerifyHandlerResult
verifyHandler
(
SysTag
t
)
{
ExcelVerifyHandlerResult
result
=
new
ExcelVerifyHandlerResult
(
true
);
if
(
codeSysTags
.
get
(
t
.
getSystemCode
())
!=
null
)
{
result
.
setSuccess
(
false
);
result
.
setMsg
(
String
.
format
(
"系统代码[%s]已经存在"
,
t
.
getSystemCode
()));
}
if
(
nameSysTags
.
get
(
t
.
getName
())
!=
null
)
{
result
.
setSuccess
(
false
);
result
.
setMsg
(
String
.
format
(
"名称[%s]已经存在"
,
t
.
getName
()));
}
return
result
;
}
}
class
SysExcelImportExecutor
implements
Runnable
{
private
MultipartFile
file
;
private
ImportLog
importLog
;
public
SysExcelImportExecutor
(
String
userName
,
MultipartFile
file
,
ImportLog
importLog
)
{
this
.
file
=
file
;
this
.
importLog
=
importLog
;
}
@Override
public
void
run
()
{
List
<
SysTag
>
tags
=
mongoOperations
.
findAll
(
SysTag
.
class
);
Map
<
String
,
SysTag
>
codeSysTags
=
tags
.
stream
().
collect
(
Collectors
.
toMap
(
SysTag:
:
getSystemCode
,
tag
->
tag
));
Map
<
String
,
SysTag
>
nameSysTags
=
tags
.
stream
().
collect
(
Collectors
.
toMap
(
SysTag:
:
getName
,
tag
->
tag
));
try
{
ImportParams
params
=
new
ImportParams
();
params
.
setTitleRows
(
0
);
params
.
setHeadRows
(
1
);
params
.
setNeedVerify
(
true
);
params
.
setVerifyHandler
(
new
SysExcelVerifyHandler
(
codeSysTags
,
nameSysTags
));
ExcelImportResult
<
SysTag
>
excelImportResult
=
ExcelImportUtil
.
importExcelMore
(
file
.
getInputStream
(),
SysTag
.
class
,
params
);
List
<
String
>
successIds
=
new
ArrayList
<>();
List
<
SysTag
>
sysTags
=
excelImportResult
.
getList
();
boolean
hasOtherFail
=
false
;
for
(
SysTag
t
:
sysTags
)
{
t
.
setId
(
UUID
.
randomUUID
().
toString
());
mongoOperations
.
save
(
t
);
successIds
.
add
(
t
.
getId
());
}
excelImportResult
.
getFailList
().
forEach
(
tag
->
{
importLog
.
appendErrorMsg
(
String
.
format
(
"第%s行, %s"
,
tag
.
getRowNum
()
+
params
.
getTitleRows
()
+
params
.
getReadRows
(),
tag
.
getErrorMsg
()));
});
importLog
.
setHasFailNum
(!
excelImportResult
.
getFailList
().
isEmpty
()
||
hasOtherFail
);
importLog
.
setTotalNum
(
excelImportResult
.
getList
().
size
()
+
excelImportResult
.
getFailList
().
size
());
importLog
.
setSuccessIds
(
successIds
);
importLog
.
setReport
(
importLog
.
generateReport
());
}
catch
(
Exception
e
)
{
importLog
.
appendErrorMsg
(
e
.
getCause
().
getMessage
());
}
finally
{
importLog
.
setEndTime
(
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
importLog
.
setHasFinish
(
true
);
mongoOperations
.
save
(
importLog
);
}
}
}
class
ExcelImportExecutor
implements
Runnable
{
private
String
userName
;
private
MultipartFile
file
;
private
ImportLog
importLog
;
public
ExcelImportExecutor
(
String
userName
,
MultipartFile
file
,
ImportLog
importLog
)
{
this
.
userName
=
userName
;
this
.
file
=
file
;
this
.
importLog
=
importLog
;
}
@Override
public
void
run
()
{
List
<
Tag
>
dimensionTags
=
mongoOperations
.
find
(
Query
.
query
(
Criteria
.
where
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
)),
Tag
.
class
);
Map
<
String
,
Tag
>
pathTags
=
dimensionTags
.
stream
().
collect
(
Collectors
.
toMap
(
Tag:
:
getPath
,
tag
->
tag
));
try
{
ImportParams
params
=
new
ImportParams
();
params
.
setTitleRows
(
0
);
params
.
setHeadRows
(
1
);
params
.
setNeedVerify
(
true
);
params
.
setVerifyHandler
(
new
ExcelVerifyHandler
(
pathTags
));
ExcelImportResult
<
Tag
>
excelImportResult
=
ExcelImportUtil
.
importExcelMore
(
file
.
getInputStream
(),
Tag
.
class
,
params
);
List
<
String
>
successIds
=
new
ArrayList
<>();
List
<
Tag
>
tags
=
excelImportResult
.
getList
();
tags
.
forEach
(
tag
->
{
tag
.
setId
(
UUID
.
randomUUID
().
toString
());
pathTags
.
put
(
tag
.
getPath
(),
tag
);
});
boolean
hasOtherFail
=
false
;
for
(
Tag
t
:
tags
)
{
String
parentIdPath
=
""
;
if
(
t
.
getPath
().
split
(
Constants
.
TAG_PATH_SEPARATOR
).
length
>
1
)
{
String
parentPath
=
t
.
getPath
().
substring
(
0
,
t
.
getPath
().
lastIndexOf
(
Constants
.
TAG_PATH_SEPARATOR
));
if
(
pathTags
.
get
(
parentPath
)
==
null
)
{
importLog
.
appendErrorMsg
(
String
.
format
(
"第%s行, 路径为[%s]的标签找不到父节点"
,
t
.
getRowNum
(),
t
.
getPath
()));
hasOtherFail
=
true
;
continue
;
}
else
{
//主题域,HSE,物资
String
[]
ts
=
parentPath
.
split
(
Constants
.
TAG_PATH_SEPARATOR
);
List
<
String
>
parentIdList
=
new
LinkedList
<>();
List
<
String
>
path
=
new
LinkedList
<>();
for
(
int
a
=
0
;
a
<
ts
.
length
;
a
++)
{
path
.
add
(
ts
[
a
]);
parentIdList
.
add
(
pathTags
.
get
(
String
.
join
(
Constants
.
TAG_PATH_SEPARATOR
,
path
)).
getId
());
}
parentIdPath
=
String
.
join
(
Constants
.
TAG_PATH_SEPARATOR
,
parentIdList
);
}
}
t
.
setIdPath
(
parentIdPath
+
Constants
.
TAG_PATH_SEPARATOR
+
t
.
getId
());
t
.
setLevel
(
t
.
getPath
().
split
(
","
).
length
);
t
.
setCreator
(
userName
);
t
.
setDimensionType
(
Constants
.
TAG_DIMENSION_TRUE
);
t
.
setCreateDate
(
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd"
));
t
.
setImportId
(
importLog
.
getId
());
t
=
tagRepository
.
save
(
t
);
successIds
.
add
(
t
.
getId
());
}
excelImportResult
.
getFailList
().
forEach
(
tag
->
{
importLog
.
appendErrorMsg
(
String
.
format
(
"第%s行, %s"
,
tag
.
getRowNum
()
+
params
.
getTitleRows
()
+
params
.
getReadRows
(),
tag
.
getErrorMsg
()));
});
importLog
.
setHasFailNum
(!
excelImportResult
.
getFailList
().
isEmpty
()
||
hasOtherFail
);
importLog
.
setTotalNum
(
excelImportResult
.
getList
().
size
()
+
excelImportResult
.
getFailList
().
size
());
importLog
.
setSuccessIds
(
successIds
);
importLog
.
setReport
(
importLog
.
generateReport
());
}
catch
(
Exception
e
)
{
importLog
.
appendErrorMsg
(
e
.
getCause
().
getMessage
());
}
finally
{
importLog
.
setEndTime
(
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
importLog
.
setHasFinish
(
true
);
mongoOperations
.
save
(
importLog
);
}
}
}
class
ExcelVerifyHandler
implements
IExcelVerifyHandler
<
Tag
>
{
private
Map
<
String
,
Tag
>
tags
;
public
ExcelVerifyHandler
(
Map
<
String
,
Tag
>
tags
)
{
this
.
tags
=
tags
;
}
return
importCount
;
@Override
public
ExcelVerifyHandlerResult
verifyHandler
(
Tag
t
)
{
ExcelVerifyHandlerResult
result
=
new
ExcelVerifyHandlerResult
(
true
);
if
(!
Constants
.
TAG_SYSTEM_TYPE
.
equals
(
t
.
getTagType
())
&&
!
Constants
.
TAG_PERSONAL_TYPE
.
equals
(
t
.
getTagType
()))
{
result
.
setSuccess
(
false
);
result
.
setMsg
(
String
.
format
(
"标签类型错误,不能为[%s]"
,
t
.
getTagType
()));
}
if
(
tags
.
get
(
t
.
getPath
())
!=
null
&&
tags
.
get
(
t
.
getPath
()).
getTagType
().
equals
(
t
.
getTagType
()))
{
result
.
setSuccess
(
false
);
result
.
setMsg
(
String
.
format
(
"标签类型为[%s], 路径为[%s]的标签已经存在"
,
Constants
.
TAG_PERSONAL_TYPE
.
equals
(
t
.
getTagType
())
?
"个人标签"
:
"系统标签"
,
t
.
getPath
()));
}
if
(!
t
.
getPath
().
endsWith
(
t
.
getName
()))
{
result
.
setSuccess
(
false
);
result
.
setMsg
(
String
.
format
(
"名称和路径不匹配,名称为[%s],路径为[%s]"
,
t
.
getName
(),
t
.
getPath
()));
}
return
result
;
}
}
public
Page
listImportlogByPage
(
Page
page
)
{
Query
q
=
createImportlogPageQuery
(
page
);
List
<
ImportLog
>
logs
=
mongoOperations
.
find
(
q
,
ImportLog
.
class
);
long
count
=
mongoOperations
.
count
(
q
,
ImportLog
.
class
);
page
.
setData
(
logs
);
page
.
setTotal
(
count
);
return
page
;
}
private
Query
createImportlogPageQuery
(
Page
page
)
{
Query
q
=
new
Query
();
q
.
addCriteria
(
Criteria
.
where
(
"type"
).
is
(
Constants
.
COMMON_TAG_LOG_TYPE
));
q
.
skip
(
page
.
getOffset
());
q
.
limit
(
page
.
getPageSize
());
q
.
with
(
Sort
.
by
(
Arrays
.
asList
(
new
Order
(
Direction
.
DESC
,
"startTime"
))));
return
q
;
}
private
boolean
checkIsValid
(
Tag
t
)
{
t
=
mongoOperations
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"path"
)
.
is
(
t
.
getPath
()).
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
)),
Tag
.
class
);
return
t
==
null
;
public
void
undoImportExcel
(
String
importlogId
)
{
mongoOperations
.
remove
(
Query
.
query
(
Criteria
.
where
(
"importId"
).
is
(
importlogId
)),
Tag
.
class
);
}
}
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