Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-data-cloud
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
base_platform_enterprise
gic-data-cloud
Commits
f63f53aa
Commit
f63f53aa
authored
Sep 03, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加日志
parent
a855ebf3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
20 deletions
+27
-20
LoginController.java
...in/java/com/gic/cloud/web/controller/LoginController.java
+27
-20
No files found.
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/LoginController.java
View file @
f63f53aa
...
@@ -73,7 +73,7 @@ public class LoginController {
...
@@ -73,7 +73,7 @@ public class LoginController {
}
}
});
});
RedisUtil
.
setCache
(
key
,
userVo
,
5
l
,
TimeUnit
.
MINUTES
);
RedisUtil
.
setCache
(
key
,
userVo
,
5
l
,
TimeUnit
.
MINUTES
);
RedisUtil
.
setCache
(
"userEnterpriseList:"
+
userVo
.
getUserId
(),
enterpriseDTOList
);
//
RedisUtil.setCache("userEnterpriseList:"+userVo.getUserId(), enterpriseDTOList);
return
RestResponse
.
success
(
enterpriseId
);
return
RestResponse
.
success
(
enterpriseId
);
}
else
{
}
else
{
return
RestResponse
.
failure
(
ErrorCode
.
SYSTEMERROR
.
getCode
(),
smsSendResult
.
getMessage
());
return
RestResponse
.
failure
(
ErrorCode
.
SYSTEMERROR
.
getCode
(),
smsSendResult
.
getMessage
());
...
@@ -101,28 +101,35 @@ public class LoginController {
...
@@ -101,28 +101,35 @@ public class LoginController {
@RequestMapping
(
"all-enterprise"
)
@RequestMapping
(
"all-enterprise"
)
public
RestResponse
allEnterprise
(
Integer
userId
){
public
RestResponse
allEnterprise
(
Integer
userId
){
Object
cache
=
RedisUtil
.
getCache
(
"userEnterpriseList:"
+
userId
);
UserDTO
userDTO
=
this
.
userApiService
.
getUser
(
userId
).
getResult
();
UserDTO
userDTO
=
this
.
userApiService
.
getUser
(
userId
).
getResult
();
if
(
userDTO
==
null
){
return
RestResponse
.
success
();
}
List
<
UserDTO
>
userDTOList
=
this
.
userApiService
.
listUserByPhone
(
userDTO
.
getNationCode
(),
userDTO
.
getPhone
()).
getResult
();
List
<
UserDTO
>
userDTOList
=
this
.
userApiService
.
listUserByPhone
(
userDTO
.
getNationCode
(),
userDTO
.
getPhone
()).
getResult
();
List
<
EnterpriseDTO
>
enterpriseDTOList
=
(
List
<
EnterpriseDTO
>)
cache
;
log
.
info
(
"userDTOList:{}"
,
JSON
.
toJSONString
(
userDTOList
));
List
<
EnterpriseVo
>
result
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
userDTOList
)){
if
(
CollectionUtils
.
isNotEmpty
(
enterpriseDTOList
)){
List
<
Integer
>
enterpriseIdList
=
userDTOList
.
stream
().
map
(
user
->
user
.
getEnterpriseId
()).
collect
(
Collectors
.
toList
());
result
=
enterpriseDTOList
.
stream
().
map
(
enterpriseDTO
->
{
List
<
EnterpriseDTO
>
enterpriseDTOList
=
this
.
enterpriseApiService
.
listEnterpriseByIds
(
enterpriseIdList
).
getResult
();
EnterpriseVo
vo
=
EntityUtil
.
changeEntityByJSON
(
EnterpriseVo
.
class
,
enterpriseDTO
);
List
<
EnterpriseVo
>
result
=
new
ArrayList
<>();
vo
.
setIsSingle
(
"basic"
.
equals
(
enterpriseDTO
.
getVersionCode
())
?
1
:
0
);
if
(
CollectionUtils
.
isNotEmpty
(
enterpriseDTOList
)){
if
(
CollectionUtils
.
isNotEmpty
(
userDTOList
)){
result
=
enterpriseDTOList
.
stream
().
map
(
enterpriseDTO
->
{
userDTOList
.
stream
().
forEach
(
user
->
{
EnterpriseVo
vo
=
EntityUtil
.
changeEntityByJSON
(
EnterpriseVo
.
class
,
enterpriseDTO
);
if
(
user
.
getEnterpriseId
().
intValue
()
==
enterpriseDTO
.
getEnterpriseId
().
intValue
()){
vo
.
setIsSingle
(
"basic"
.
equals
(
enterpriseDTO
.
getVersionCode
())
?
1
:
0
);
vo
.
setIsAdmin
((
user
.
getPhone
().
equals
(
enterpriseDTO
.
getPhoneNumber
()))
?
1
:
0
);
if
(
CollectionUtils
.
isNotEmpty
(
userDTOList
)){
vo
.
setUserName
(
user
.
getUserName
());
userDTOList
.
stream
().
forEach
(
user
->
{
vo
.
setUserId
(
user
.
getUserId
());
if
(
user
.
getEnterpriseId
().
intValue
()
==
enterpriseDTO
.
getEnterpriseId
().
intValue
()){
}
vo
.
setIsAdmin
((
user
.
getPhone
().
equals
(
enterpriseDTO
.
getPhoneNumber
()))
?
1
:
0
);
});
vo
.
setUserName
(
user
.
getUserName
());
}
vo
.
setUserId
(
user
.
getUserId
());
return
vo
;
}
}).
collect
(
Collectors
.
toList
());
});
}
return
vo
;
}).
collect
(
Collectors
.
toList
());
}
return
RestResponse
.
success
(
result
);
}
}
return
RestResponse
.
success
(
result
);
return
RestResponse
.
success
();
}
}
@RequestMapping
(
"nation-code"
)
@RequestMapping
(
"nation-code"
)
...
...
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