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
b89a6ee4
Commit
b89a6ee4
authored
Nov 29, 2019
by
lanmw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
367267a8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
5 deletions
+32
-5
TagCtrl.java
src/main/java/com/keymobile/tagmanager/api/TagCtrl.java
+14
-4
Tag.java
src/main/java/com/keymobile/tagmanager/model/Tag.java
+9
-0
TagService.java
...ain/java/com/keymobile/tagmanager/service/TagService.java
+9
-1
Constants.java
src/main/java/com/keymobile/tagmanager/util/Constants.java
+0
-0
No files found.
src/main/java/com/keymobile/tagmanager/api/TagCtrl.java
View file @
b89a6ee4
package
com
.
keymobile
.
tagmanager
.
api
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -6,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.keymobile.tagmanager.exception.TagNotExistException
;
import
com.keymobile.tagmanager.model.Page
;
import
com.keymobile.tagmanager.model.Tag
;
import
com.keymobile.tagmanager.service.TagService
;
...
...
@@ -52,13 +55,13 @@ public class TagCtrl {
// @PreAuthorize("principal.authorities.?[authority.startsWith('ROLE_tagmanager_admin')].size() > 0")
@ApiOperation
(
value
=
"查询系统标签树"
,
notes
=
"查询系统标签树"
)
@GetMapping
(
value
=
"/querySystemTagAsTree"
)
public
JsonNode
[]
querySystemTagAsTree
(
@RequestParam
(
value
=
"parentId"
,
required
=
false
)
String
parentId
)
throws
Exception
{
public
JsonNode
[]
querySystemTagAsTree
(
@RequestParam
(
value
=
"parentId"
,
required
=
false
)
String
parentId
)
throws
TagNotExistException
{
return
tagService
.
querySystemTagAsTree
(
parentId
);
}
@ApiOperation
(
value
=
"查询个人标签树"
,
notes
=
"查询个人标签树"
)
@GetMapping
(
value
=
"/queryPersonalTagAsTree"
)
public
JsonNode
[]
queryPersonalTagAsTree
(
@RequestParam
(
value
=
"parentId"
,
required
=
false
)
String
parentId
)
throws
Exception
{
public
JsonNode
[]
queryPersonalTagAsTree
(
@RequestParam
(
value
=
"parentId"
,
required
=
false
)
String
parentId
)
throws
TagNotExistException
{
String
userName
=
UserInfoUtils
.
getUserName
();
return
tagService
.
queryPersonalTagAsTree
(
parentId
,
userName
);
}
...
...
@@ -68,7 +71,7 @@ public class TagCtrl {
public
Page
searchSystemTagByPage
(
@RequestParam
(
required
=
false
,
value
=
"keyword"
)
String
keyword
,
@RequestParam
(
required
=
false
,
value
=
"domain"
)
Integer
domain
,
@RequestParam
(
"pageNo"
)
Integer
pageNo
,
@RequestParam
(
"pageSize"
)
Integer
pageSize
)
throws
Exception
{
@RequestParam
(
"pageSize"
)
Integer
pageSize
)
{
return
tagService
.
searchSystemTagByPage
(
keyword
,
domain
,
new
Page
(
pageSize
,
pageNo
));
}
...
...
@@ -77,9 +80,16 @@ public class TagCtrl {
public
Page
searchPersonalTagByPage
(
@RequestParam
(
required
=
false
,
value
=
"keyword"
)
String
keyword
,
@RequestParam
(
required
=
false
,
value
=
"domain"
)
Integer
domain
,
@RequestParam
(
"pageNo"
)
Integer
pageNo
,
@RequestParam
(
"pageSize"
)
Integer
pageSize
)
throws
Exception
{
@RequestParam
(
"pageSize"
)
Integer
pageSize
)
{
String
userName
=
UserInfoUtils
.
getUserName
();
return
tagService
.
searchPersonalTagByPage
(
userName
,
keyword
,
domain
,
new
Page
(
pageSize
,
pageNo
));
}
@ApiOperation
(
value
=
"分享标签"
,
notes
=
"分享标签"
)
@PostMapping
(
value
=
"/shareTags"
)
public
void
shareTags
(
@RequestBody
List
<
String
>
tagIds
)
throws
Exception
{
tagService
.
shareTags
(
tagIds
);
}
}
src/main/java/com/keymobile/tagmanager/model/Tag.java
View file @
b89a6ee4
...
...
@@ -29,6 +29,7 @@ public class Tag implements Serializable{
private
String
creator
;
private
String
isOpen
=
Constants
.
TAG_CLOSE_STATUS
;
//0 不公开, 1, 公开
private
Integer
domain
;
private
boolean
dimension
=
false
;
//是否维度标签
public
Tag
()
{}
...
...
@@ -150,5 +151,13 @@ public class Tag implements Serializable{
this
.
domain
=
domain
;
}
public
boolean
isDimension
()
{
return
dimension
;
}
public
void
setDimension
(
boolean
dimension
)
{
this
.
dimension
=
dimension
;
}
}
src/main/java/com/keymobile/tagmanager/service/TagService.java
View file @
b89a6ee4
...
...
@@ -75,7 +75,7 @@ public class TagService {
Tag
t
=
mongoOperations
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"path"
).
is
(
tag
.
getPath
())
.
and
(
"creator"
).
is
(
userName
)),
Tag
.
class
);
if
(
t
!=
null
&&
!
t
.
getId
().
equals
(
tag
.
getId
()))
throw
new
TagDuplicateException
(
"tag ["
+
tag
.
getName
()
+
"] is already exist in target!"
);
throw
new
TagDuplicateException
(
"tag ["
+
tag
.
getName
()
+
"] is already exist in target!
, userName is ["
+
userName
+
"]
"
);
}
...
...
@@ -223,4 +223,12 @@ public class TagService {
return
false
;
}
public
void
shareTags
(
List
<
String
>
tagIds
)
{
Iterable
<
Tag
>
tags
=
tagRepository
.
findAllById
(
tagIds
);
tags
.
forEach
(
t
->
{
t
.
setIsOpen
(
Constants
.
TAG_OPEN_STATUS
);
});
tagRepository
.
saveAll
(
tags
);
}
}
src/main/java/com/keymobile/tagmanager/util/Constants.java
View file @
b89a6ee4
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