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
8633adb5
Commit
8633adb5
authored
Jan 10, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改获取维度标签接口
parent
c350b05b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
49 deletions
+10
-49
TagService.java
...ain/java/com/keymobile/tagmanager/service/TagService.java
+10
-49
No files found.
src/main/java/com/keymobile/tagmanager/service/TagService.java
View file @
8633adb5
...
...
@@ -263,25 +263,7 @@ public class TagService {
public
JsonNode
[]
queryPersonalTagExcludeOpenTypeAsTree
(
String
parentId
,
String
userName
,
String
dept
)
throws
TagNotExistException
{
List
<
Tag
>
tags
=
new
ArrayList
<>();
//根据普通用户机构id获取机构信息
Org
org
=
authService
.
getOrgs
(
dept
);
if
(
org
==
null
)
{
throw
new
TagNotExistException
(
"get org by id error;"
);
}
//获取机构fullname
String
fullname
=
org
.
getFullName
();
//分隔fullname
String
[]
fullnames
=
fullname
.
split
(
","
);
//如果fullname没有两层结构
if
(
fullnames
.
length
<
2
)
{
throw
new
TagNotExistException
(
"get org by id the fullname:"
+
fullname
+
" at least 2 level;"
);
}
String
companyPath
=
fullnames
[
0
]+
Constants
.
TAG_PATH_SEPARATOR
+
fullnames
[
1
];
//根据companyPath获取机构信息
Org
companyOrg
=
authService
.
findByFullName
(
companyPath
);
if
(
companyOrg
==
null
)
{
throw
new
TagNotExistException
(
"get company org by fullname is null;"
);
}
String
companyOrgId
=
String
.
valueOf
(
companyOrg
.
getId
());
String
companyOrgId
=
this
.
getCompanyOrgIdByUserOrgId
(
dept
);
if
(
StringUtils
.
isEmpty
(
parentId
))
{
tags
=
mongoOperations
.
find
(
createPersonalExcludeOpenTypeTagQuery
(
userName
,
companyOrgId
),
Tag
.
class
);
}
...
...
@@ -351,7 +333,7 @@ public class TagService {
private
Query
createDimensionTagQuery
(
String
dept
)
{
return
Query
.
query
(
Criteria
.
where
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
)
.
and
(
"tagType"
).
is
(
Constants
.
TAG_PERSONAL_TYPE
)
.
and
(
"
d
ept"
).
is
(
dept
))
.
and
(
"
proD
ept"
).
is
(
dept
))
.
with
(
Sort
.
by
(
getDefaultTagOrders
()));
}
//根据机构获取当前维度标签的所有子标签
...
...
@@ -359,7 +341,7 @@ public class TagService {
List
<
Tag
>
dirs
=
mongoOperations
.
find
(
new
Query
().
addCriteria
(
Criteria
.
where
(
"path"
)
.
regex
(
"^"
+
parentTag
.
getPath
()
+
Constants
.
TAG_PATH_SEPARATOR
)
.
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
)
.
and
(
"
d
ept"
).
is
(
companyOrgId
))
.
and
(
"
proD
ept"
).
is
(
companyOrgId
))
.
with
(
Sort
.
by
(
getDefaultTagOrders
())),
Tag
.
class
);
dirs
.
add
(
parentTag
);
return
dirs
;
...
...
@@ -376,7 +358,7 @@ public class TagService {
String
companyId
)
{
Criteria
criteria
=
Criteria
.
where
(
"tagType"
).
is
(
"1"
);
//获取自定义标签
criteria
.
orOperator
(
Criteria
.
where
(
"
d
ept"
).
is
(
companyId
)
Criteria
.
where
(
"
proD
ept"
).
is
(
companyId
)
.
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
),
//标签是维度管理员机构的
Criteria
.
where
(
"dept"
).
is
(
deptId
).
and
(
"tagUser"
).
is
(
userId
),
//标签是普通用户结构且普通用户名创建
Criteria
.
where
(
"proDept"
).
is
(
companyId
)
...
...
@@ -392,7 +374,7 @@ public class TagService {
.
regex
(
"^"
+
parentTag
.
getPath
()
+
Constants
.
TAG_PATH_SEPARATOR
)
.
and
(
"tagType"
).
is
(
Constants
.
TAG_PERSONAL_TYPE
)
.
orOperator
(
Criteria
.
where
(
"
d
ept"
).
is
(
companyId
)
Criteria
.
where
(
"
proD
ept"
).
is
(
companyId
)
.
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
),
//标签是维度管理员机构的
Criteria
.
where
(
"dept"
).
is
(
deptId
).
and
(
"tagUser"
).
is
(
userId
),
//标签是普通用户结构且普通用户名创建
Criteria
.
where
(
"proDept"
).
is
(
companyId
)
...
...
@@ -415,7 +397,7 @@ public class TagService {
//根据当前用户所属机构获取公司结构id
String
companyOrgId
=
this
.
getCompanyOrgIdByUserOrgId
(
dept
);
Criteria
criteria
=
Criteria
.
where
(
"tagType"
).
is
(
Constants
.
TAG_PERSONAL_TYPE
)
.
and
(
"
d
ept"
).
is
(
companyOrgId
).
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
);
.
and
(
"
proD
ept"
).
is
(
companyOrgId
).
and
(
"dimensionType"
).
is
(
Constants
.
TAG_DIMENSION_TRUE
);
if
(
StringUtils
.
isNotBlank
(
path
))
{
criteria
.
and
(
"path"
).
regex
(
"^"
+
path
);
}
...
...
@@ -488,6 +470,10 @@ public class TagService {
// public JsonNode[] queryPersonalTagAsTree(String parentId, String userName, String dept) throws TagNotExistException {
// List<Tag> tags = new ArrayList<>();
// if (StringUtils.isEmpty(parentId)) {
...
...
@@ -515,13 +501,6 @@ public class TagService {
.
with
(
Sort
.
by
(
getDefaultTagOrders
()));
}
public
List
<
Tag
>
getPersonSubTag
(
Tag
parentTag
,
String
userName
)
{
List
<
Tag
>
dirs
=
mongoOperations
.
find
(
new
Query
().
addCriteria
(
Criteria
.
where
(
"path"
)
.
regex
(
"^"
+
parentTag
.
getPath
()
+
Constants
.
TAG_PATH_SEPARATOR
)
...
...
@@ -534,28 +513,10 @@ public class TagService {
return
dirs
;
}
private
Criteria
createPathRegexQuery
(
String
path
)
{
return
Criteria
.
where
(
"path"
).
regex
(
"^"
+
path
);
}
public
List
<
SysTag
>
listSysTags
()
{
return
mongoOperations
.
findAll
(
SysTag
.
class
);
}
...
...
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