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
09ad151b
Commit
09ad151b
authored
Jan 10, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改获取个人标签接口
parent
850aaefd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
30 deletions
+48
-30
TagCtrl.java
src/main/java/com/keymobile/tagmanager/api/TagCtrl.java
+2
-1
TagService.java
...ain/java/com/keymobile/tagmanager/service/TagService.java
+46
-29
No files found.
src/main/java/com/keymobile/tagmanager/api/TagCtrl.java
View file @
09ad151b
...
...
@@ -125,7 +125,8 @@ public class TagCtrl {
//考虑一个用户对应多个机构的情况
List
<
String
>
orgIds
=
new
ArrayList
<>();
orgIds
.
add
(
deptIdPath
);
return
tagService
.
searchPersonalTagByPage
(
userName
,
orgIds
,
keyword
,
path
,
domain
,
new
Page
(
pageSize
,
pageNo
));
return
tagService
.
searchPersonalTagByPage
(
userName
,
orgIds
,
keyword
,
path
,
domain
,
new
Page
(
pageSize
,
pageNo
));
}
// @PreAuthorize("principal.authorities.?[authority.startsWith('ROLE_tagmanager_admin')].size() > 0")
...
...
src/main/java/com/keymobile/tagmanager/service/TagService.java
View file @
09ad151b
...
...
@@ -362,27 +362,31 @@ public class TagService {
//拼接个人维度标签树查询条件
private
Query
createDimensionTagQuery
(
List
<
String
>
companyOrgIdList
)
{
Criteria
criteriaOr
=
new
Criteria
();
for
(
String
companyOrgId
:
companyOrgIdList
)
{
Criteria
criteria
=
Criteria
.
where
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
)
.
and
(
"tagType"
).
is
(
Constants
.
TAG_PERSONAL_TYPE
)
.
and
(
"proDept"
).
is
(
companyOrgId
);
//加入or条件中
criteriaOr
.
orOperator
(
criteria
);
.
and
(
"tagType"
).
is
(
Constants
.
TAG_PERSONAL_TYPE
);
List
<
Criteria
>
criteriaOrList
=
new
ArrayList
<>();
for
(
String
companyOrgId
:
companyOrgIdList
)
{
Criteria
criteriaPro
=
Criteria
.
where
(
"proDept"
).
is
(
companyOrgId
);
criteriaOrList
.
add
(
criteriaPro
);
}
return
Query
.
query
(
criteriaOr
).
with
(
Sort
.
by
(
getDefaultTagOrders
()));
criteriaOr
.
orOperator
(
criteriaOrList
.
toArray
(
new
Criteria
[
0
]));
criteria
.
andOperator
(
criteriaOr
);
return
Query
.
query
(
criteria
).
with
(
Sort
.
by
(
getDefaultTagOrders
()));
}
//根据机构获取当前维度标签的所有子标签
private
List
<
Tag
>
getDimensionSubTag
(
Tag
parentTag
,
List
<
String
>
companyOrgIdList
)
{
Criteria
criteriaOr
=
new
Criteria
();
for
(
String
companyOrgId
:
companyOrgIdList
)
{
List
<
Criteria
>
criteriaOrList
=
new
ArrayList
<>();
Criteria
criteria
=
Criteria
.
where
(
"path"
)
.
regex
(
"^"
+
parentTag
.
getPath
()
+
Constants
.
TAG_PATH_SEPARATOR
)
.
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
)
.
and
(
"proDept"
).
is
(
companyOrgId
);
//加入or条件中
criteriaOr
.
orOperator
(
criteria
);
.
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
);
for
(
String
companyOrgId
:
companyOrgIdList
)
{
Criteria
criteriaPro
=
Criteria
.
where
(
"proDept"
).
is
(
companyOrgId
);
criteriaOr
List
.
add
(
criteriaPro
);
}
List
<
Tag
>
dirs
=
mongoOperations
.
find
(
new
Query
().
addCriteria
(
criteriaOr
)
criteriaOr
.
orOperator
(
criteriaOrList
.
toArray
(
new
Criteria
[
0
]));
criteria
.
andOperator
(
criteriaOr
);
List
<
Tag
>
dirs
=
mongoOperations
.
find
(
new
Query
().
addCriteria
(
criteria
)
.
with
(
Sort
.
by
(
getDefaultTagOrders
())),
Tag
.
class
);
dirs
.
add
(
parentTag
);
return
dirs
;
...
...
@@ -409,12 +413,12 @@ public class TagService {
List
<
Criteria
>
criteriaOrList
=
new
ArrayList
<>();
for
(
String
companyOrgId
:
companyOrgIdList
)
{
Criteria
criteriaDim
=
Criteria
.
where
(
"proDept"
).
is
(
companyOrgId
)
.
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
);
//标签是维度管理员机构的
.
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
);
//标签是维度
且是公司
管理员机构的
criteriaOrList
.
add
(
criteriaDim
);
}
for
(
String
companyOrgId
:
companyOrgIdList
)
{
Criteria
criteriaShare
=
Criteria
.
where
(
"proDept"
).
is
(
companyOrgId
)
.
and
(
"isOpen"
).
is
(
Constants
.
TAG_OPEN_STATUS
);
//公司机构id是companyId和是共享状态的
.
and
(
"isOpen"
).
is
(
Constants
.
TAG_OPEN_STATUS
);
//公司机构id是companyId和是共享状态的
非维度标签
criteriaOrList
.
add
(
criteriaShare
);
}
for
(
String
orgId
:
orgIds
)
{
...
...
@@ -429,24 +433,27 @@ public class TagService {
//根据父标签查找子标签
private
List
<
Tag
>
getNewPersonSubTag
(
Tag
parentTag
,
String
userId
,
List
<
String
>
orgIds
,
List
<
String
>
companyOrgIdList
)
{
List
<
Criteria
>
criteriaOrList
=
new
ArrayList
<>();
Criteria
criteriaOr
=
new
Criteria
();
Criteria
criteria
=
Criteria
.
where
(
"path"
)
.
regex
(
"^"
+
parentTag
.
getPath
()
+
Constants
.
TAG_PATH_SEPARATOR
)
.
and
(
"tagType"
).
is
(
Constants
.
TAG_PERSONAL_TYPE
);
for
(
String
companyOrgId
:
companyOrgIdList
)
{
Criteria
criteriaDim
=
Criteria
.
where
(
"proDept"
).
is
(
companyOrgId
)
.
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
);
//标签是维度管理员机构的
criteria
.
orOperator
(
criteriaDim
);
criteriaOrList
.
add
(
criteriaDim
);
}
for
(
String
companyOrgId
:
companyOrgIdList
)
{
Criteria
criteriaShare
=
Criteria
.
where
(
"proDept"
).
is
(
companyOrgId
)
.
and
(
"isOpen"
).
is
(
Constants
.
TAG_OPEN_STATUS
);
//公司机构id是companyId和是共享状态的
criteria
.
orOperator
(
criteriaShare
);
criteria
OrList
.
add
(
criteriaShare
);
}
for
(
String
orgId
:
orgIds
)
{
Criteria
criteriaUser
=
Criteria
.
where
(
"dept"
).
is
(
orgId
).
and
(
"tagUser"
).
is
(
userId
);
criteria
.
orOperator
(
criteriaUser
);
criteria
OrList
.
add
(
criteriaUser
);
}
criteriaOr
.
orOperator
(
criteriaOrList
.
toArray
(
new
Criteria
[
0
]));
criteria
.
andOperator
(
criteriaOr
);
List
<
Tag
>
dirs
=
mongoOperations
.
find
(
new
Query
().
addCriteria
(
criteria
)
.
with
(
Sort
.
by
(
getDefaultTagOrders
())),
Tag
.
class
);
dirs
.
add
(
parentTag
);
...
...
@@ -463,15 +470,19 @@ public class TagService {
private
Criteria
createPersonalDimensionTagCriteria
(
String
userName
,
String
path
,
List
<
String
>
companyOrgIdList
)
throws
TagNotExistException
{
Criteria
criteriaOr
=
new
Criteria
();
for
(
String
companyOrgId
:
companyOrgIdList
)
{
List
<
Criteria
>
criteriaOrList
=
new
ArrayList
<>();
Criteria
criteria
=
Criteria
.
where
(
"tagType"
).
is
(
Constants
.
TAG_PERSONAL_TYPE
)
.
and
(
"proDept"
).
is
(
companyOrgId
).
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
);
criteriaOr
.
orOperator
(
criteria
);
.
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
);
for
(
String
companyOrgId
:
companyOrgIdList
)
{
Criteria
criteriaPro
=
Criteria
.
where
(
"proDept"
).
is
(
companyOrgId
);
criteriaOrList
.
add
(
criteriaPro
);
}
criteriaOr
.
orOperator
(
criteriaOrList
.
toArray
(
new
Criteria
[
0
]));
criteria
.
andOperator
(
criteriaOr
);
if
(
StringUtils
.
isNotBlank
(
path
))
{
criteria
Or
.
and
(
"path"
).
regex
(
"^"
+
path
);
criteria
.
and
(
"path"
).
regex
(
"^"
+
path
);
}
return
criteria
Or
;
return
criteria
;
}
//拼接查找系统标签条件
private
Criteria
createSystemTagCriteria
(
String
path
)
{
...
...
@@ -501,12 +512,13 @@ public class TagService {
List
<
String
>
companyOrgIdList
,
String
path
)
throws
TagNotExistException
{
Criteria
criteria
=
Criteria
.
where
(
"tagType"
).
is
(
Constants
.
TAG_PERSONAL_TYPE
);
Criteria
criteriaOr
=
new
Criteria
();
List
<
Criteria
>
criteriaOrList
=
new
ArrayList
<>();
for
(
String
orgId
:
orgIds
)
{
Criteria
criteriaUser
=
Criteria
.
where
(
"dept"
).
is
(
orgId
).
and
(
"tagUser"
).
is
(
userName
);
if
(
StringUtils
.
isNotBlank
(
path
))
{
criteriaUser
.
and
(
"path"
).
regex
(
"^"
+
path
);
}
criteriaOr
.
orOperator
(
criteriaUser
);
criteriaOr
List
.
add
(
criteriaUser
);
}
for
(
String
companyOrgId
:
companyOrgIdList
)
{
Criteria
criteriaUser
=
Criteria
.
where
(
"proDept"
).
is
(
companyOrgId
)
...
...
@@ -514,8 +526,9 @@ public class TagService {
if
(
StringUtils
.
isNotBlank
(
path
))
{
criteriaUser
.
and
(
"path"
).
regex
(
"^"
+
path
);
}
criteriaOr
.
orOperator
(
criteriaUser
);
criteriaOr
List
.
add
(
criteriaUser
);
}
criteriaOr
.
orOperator
(
criteriaOrList
.
toArray
(
new
Criteria
[
0
]));
criteria
.
andOperator
(
criteriaOr
);
return
criteria
;
}
...
...
@@ -531,12 +544,16 @@ public class TagService {
//拼接获取维度标签条件
private
Query
createPersonalExcludeOpenTypeTagQuery
(
String
userName
,
List
<
String
>
companyOrgIdList
)
{
Criteria
criteriaOr
=
new
Criteria
();
for
(
String
companyOrgId
:
companyOrgIdList
)
{
List
<
Criteria
>
criteriaOrList
=
new
ArrayList
<>();
Criteria
criteria
=
Criteria
.
where
(
"tagType"
).
is
(
Constants
.
TAG_PERSONAL_TYPE
)
.
and
(
"dept"
).
is
(
companyOrgId
).
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
);
criteriaOr
.
orOperator
(
criteria
);
.
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
);
for
(
String
companyOrgId
:
companyOrgIdList
)
{
Criteria
criteriaDept
=
Criteria
.
where
(
"dept"
).
is
(
companyOrgId
);
criteriaOrList
.
add
(
criteriaDept
);
}
return
Query
.
query
(
criteriaOr
)
criteriaOr
.
orOperator
(
criteriaOrList
.
toArray
(
new
Criteria
[
0
]));
criteria
.
andOperator
(
criteriaOr
);
return
Query
.
query
(
criteria
)
.
with
(
Sort
.
by
(
getDefaultTagOrders
()));
}
...
...
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