Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
Project
Project
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
station
YeeAmosFireAutoSysRoot
Commits
a29fffcf
Commit
a29fffcf
authored
Jun 11, 2020
by
maoying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
风险点关联巡检点部门,责任人,电话显示修改
parent
fa4e9e03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
22 deletions
+74
-22
RemoteSecurityService.java
...eejoin/amos/fas/business/feign/RemoteSecurityService.java
+60
-0
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+14
-22
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/feign/RemoteSecurityService.java
View file @
a29fffcf
...
...
@@ -4,6 +4,7 @@ package com.yeejoin.amos.fas.business.feign;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Joiner
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
...
...
@@ -14,11 +15,15 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@Service
(
"remoteSecurityService"
)
public
class
RemoteSecurityService
{
...
...
@@ -214,6 +219,61 @@ public class RemoteSecurityService {
}
return
agencyUserModel
;
}
/**
* 根据用户ids获取用户实体列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
public
Map
<
String
,
AgencyUserModel
>
getUsersMap
(
String
toke
,
String
product
,
String
appKey
,
Set
<
Object
>
userIds
){
List
<
AgencyUserModel
>
users
=
listUserByUserIds
(
toke
,
product
,
appKey
,
Joiner
.
on
(
","
).
join
(
userIds
));
Map
<
String
,
AgencyUserModel
>
userMap
=
new
HashMap
<>();
if
(
users
!=
null
){
userMap
=
users
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
v
->
v
,
(
v1
,
v2
)
->
v1
));
}
return
userMap
;
}
/**
* 根据用户ids获取用户名称列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
public
Map
<
String
,
String
>
getUserRealName
(
String
toke
,
String
product
,
String
appKey
,
Set
<
Object
>
userIds
){
List
<
AgencyUserModel
>
users
=
listUserByUserIds
(
toke
,
product
,
appKey
,
Joiner
.
on
(
","
).
join
(
userIds
));
Map
<
String
,
String
>
userMap
=
new
HashMap
<>();
if
(
users
!=
null
){
userMap
=
users
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
));
}
return
userMap
;
}
/**
* 根据部门ids获取部门名称
* @param toke
* @param product
* @param appKey
* @param depIds
* @return
*/
public
Map
<
Long
,
String
>
getDepName
(
String
toke
,
String
product
,
String
appKey
,
Set
<
Object
>
depIds
){
List
<
DepartmentModel
>
depts
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
depIds
)){
depts
=
this
.
listDepartmentByDeptIds
(
toke
,
product
,
appKey
,
Joiner
.
on
(
","
).
join
(
depIds
));
}
Map
<
Long
,
String
>
deptMap
=
new
HashMap
<>();
if
(
depts
!=
null
){
deptMap
=
depts
.
stream
().
collect
(
Collectors
.
toMap
(
DepartmentModel:
:
getSequenceNbr
,
DepartmentModel:
:
getDepartmentName
));
}
return
deptMap
;
}
//用户id获取用户信息
public
AgencyUserModel
getUserById
(
String
toke
,
String
product
,
String
appKey
,
String
userId
)
{
if
(
userId
==
null
||
userId
.
equals
(
""
))
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
a29fffcf
...
...
@@ -543,33 +543,25 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if
(!
CollectionUtils
.
isEmpty
(
content
)){
Set
<
Object
>
userIds
=
content
.
stream
().
filter
(
x
->
!
StringUtils
.
isEmpty
(
x
.
get
(
"userId"
))).
map
(
arg0
->
arg0
.
get
(
"userId"
)).
collect
(
Collectors
.
toSet
());
Set
<
Object
>
deptIds
=
content
.
stream
().
filter
(
x
->
!
StringUtils
.
isEmpty
(
x
.
get
(
"deptId"
))).
map
(
arg0
->
arg0
.
get
(
"deptId"
)).
collect
(
Collectors
.
toSet
());
List
<
AgencyUserModel
>
users
=
new
ArrayList
<>();
Map
<
String
,
AgencyUserModel
>
userMap
=
new
HashMap
<>();
if
(!
CollectionUtils
.
isEmpty
(
userIds
)){
users
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
Joiner
.
on
(
","
).
join
(
userIds
)
);
userMap
=
remoteSecurityService
.
getUsersMap
(
toke
,
product
,
appKey
,
userIds
);
}
// Map<String, String> userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
Map
<
String
,
String
>
userMap
=
new
HashMap
<>();
if
(
users
!=
null
){
userMap
=
users
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
));
}
List
<
DepartmentModel
>
depts
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
deptIds
)){
depts
=
remoteSecurityService
.
listDepartmentByDeptIds
(
toke
,
product
,
appKey
,
Joiner
.
on
(
","
).
join
(
deptIds
));
}
// Map<Long, String > deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
Map
<
Long
,
String
>
deptMap
=
new
HashMap
<>();
if
(
depts
!=
null
){
deptMap
=
depts
.
stream
().
collect
(
Collectors
.
toMap
(
DepartmentModel:
:
getSequenceNbr
,
DepartmentModel:
:
getDepartmentName
)
);
if
(
!
CollectionUtils
.
isEmpty
(
deptIds
)
){
deptMap
=
remoteSecurityService
.
getDepName
(
toke
,
product
,
appKey
,
deptIds
);
}
// content.forEach(e -> {
// e.put("userName",userMap.get(e.get("userId")));
// e.put("deptName",deptMap.get(e.get("deptId")));
// e.put("tel",userMap.get(String.valueOf(e.get("deptId")+"tel")));
// });
for
(
int
i
=
0
;
i
<
content
.
size
();
i
++){
content
.
get
(
i
).
put
(
"userName"
,
userMap
.
get
(
content
.
get
(
i
).
get
(
"userId"
)));
content
.
get
(
i
).
put
(
"deptName"
,
deptMap
.
get
(
content
.
get
(
i
).
get
(
"deptId"
)));
content
.
get
(
i
).
put
(
"tel"
,
userMap
.
get
(
String
.
valueOf
(
content
.
get
(
i
).
get
(
"deptId"
)+
"tel"
)));
if
(
content
.
get
(
i
).
get
(
"userId"
)
!=
null
&&
userMap
.
containsKey
(
content
.
get
(
i
).
get
(
"userId"
))){
AgencyUserModel
user
=
userMap
.
get
(
content
.
get
(
i
).
get
(
"userId"
));
content
.
get
(
i
).
put
(
"userName"
,
user
.
getRealName
());
content
.
get
(
i
).
put
(
"tel"
,
user
.
getMobile
());
}
if
(
content
.
get
(
i
).
get
(
"deptId"
)
!=
null
&&
deptMap
.
containsKey
(
Long
.
valueOf
(
content
.
get
(
i
).
get
(
"deptId"
).
toString
()))){
content
.
get
(
i
).
put
(
"deptName"
,
deptMap
.
get
(
Long
.
valueOf
(
content
.
get
(
i
).
get
(
"deptId"
).
toString
())));
}
}
}
return
new
PageImpl
<>(
content
,
pageable
,
total
);
...
...
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