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
37c336a4
Commit
37c336a4
authored
Aug 17, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
观云台小程序
parent
3c198cd5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
131 additions
and
6 deletions
+131
-6
LoginController.java
...in/java/com/gic/cloud/web/controller/LoginController.java
+25
-6
EnterpriseVo.java
...xapp/src/main/java/com/gic/cloud/web/vo/EnterpriseVo.java
+96
-0
LoginUserVo.java
...wxapp/src/main/java/com/gic/cloud/web/vo/LoginUserVo.java
+10
-0
No files found.
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/LoginController.java
View file @
37c336a4
...
...
@@ -5,7 +5,9 @@ import com.gic.api.base.commons.ServiceResponse;
import
com.gic.cloud.dto.UserDTO
;
import
com.gic.cloud.service.UserApiService
;
import
com.gic.cloud.web.constant.ErrorCode
;
import
com.gic.cloud.web.vo.EnterpriseVo
;
import
com.gic.cloud.web.vo.LoginUserVo
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.service.EnterpriseApiService
;
...
...
@@ -20,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
...
...
@@ -57,12 +60,17 @@ public class LoginController {
userVo
.
setPhoneNumber
(
phoneNumber
);
userVo
.
setUserId
(
userDTOList
.
get
(
0
).
getUserId
());
userVo
.
setUserName
(
userDTOList
.
get
(
0
).
getUserName
());
enterpriseDTOList
.
stream
().
filter
(
enterpriseDTO
->
{
if
(
phoneNumber
.
equals
(
enterpriseDTO
.
getPhoneNumber
())){
userVo
.
setIsAdmin
(
1
);
return
true
;
enterpriseDTOList
.
stream
().
forEach
(
enterpriseDTO
->
{
if
(
enterpriseDTO
.
getEnterpriseId
().
intValue
()
==
enterpriseId
.
intValue
()){
if
(
phoneNumber
.
equals
(
enterpriseDTO
.
getPhoneNumber
())){
userVo
.
setIsAdmin
(
1
);
}
if
(
"basic"
.
equals
(
enterpriseDTO
.
getVersionCode
())){
userVo
.
setIsSingle
(
1
);
}
else
{
userVo
.
setIsSingle
(
0
);
}
}
return
false
;
});
RedisUtil
.
setCache
(
key
,
userVo
,
5
l
,
TimeUnit
.
MINUTES
);
RedisUtil
.
setCache
(
"userEnterpriseList:"
+
userVo
.
getUserId
(),
enterpriseDTOList
);
...
...
@@ -94,7 +102,18 @@ public class LoginController {
@RequestMapping
(
"all-enterprise"
)
public
RestResponse
allEnterprise
(
Integer
userId
){
Object
cache
=
RedisUtil
.
getCache
(
"userEnterpriseList:"
+
userId
);
return
RestResponse
.
success
(
cache
);
UserDTO
userDTO
=
this
.
userApiService
.
getUser
(
userId
).
getResult
();
List
<
EnterpriseDTO
>
enterpriseDTOList
=
(
List
<
EnterpriseDTO
>)
cache
;
List
<
EnterpriseVo
>
result
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
enterpriseDTOList
)){
result
=
enterpriseDTOList
.
stream
().
map
(
enterpriseDTO
->
{
EnterpriseVo
vo
=
EntityUtil
.
changeEntityByJSON
(
EnterpriseVo
.
class
,
enterpriseDTO
);
vo
.
setIsAdmin
((
userDTO
!=
null
&&
userDTO
.
getPhone
().
equals
(
enterpriseDTO
.
getPhoneNumber
()))
?
1
:
0
);
vo
.
setIsSingle
(
"basic"
.
equals
(
enterpriseDTO
.
getVersionCode
())
?
1
:
0
);
return
vo
;
}).
collect
(
Collectors
.
toList
());
}
return
RestResponse
.
success
(
result
);
}
@RequestMapping
(
"nation-code"
)
...
...
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/vo/EnterpriseVo.java
0 → 100644
View file @
37c336a4
package
com
.
gic
.
cloud
.
web
.
vo
;
public
class
EnterpriseVo
{
private
static
final
long
serialVersionUID
=
-
2344967926907229689L
;
private
Integer
enterpriseId
;
private
String
enterpriseName
;
private
String
companyName
;
private
String
logo
;
private
String
address
;
private
String
userName
;
private
String
phoneNumber
;
private
String
phoneAreaCode
;
private
Integer
isAdmin
=
0
;
/***是否单域**/
private
Integer
isSingle
=
1
;
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
String
getEnterpriseName
()
{
return
enterpriseName
;
}
public
void
setEnterpriseName
(
String
enterpriseName
)
{
this
.
enterpriseName
=
enterpriseName
;
}
public
String
getCompanyName
()
{
return
companyName
;
}
public
void
setCompanyName
(
String
companyName
)
{
this
.
companyName
=
companyName
;
}
public
String
getLogo
()
{
return
logo
;
}
public
void
setLogo
(
String
logo
)
{
this
.
logo
=
logo
;
}
public
String
getAddress
()
{
return
address
;
}
public
void
setAddress
(
String
address
)
{
this
.
address
=
address
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getPhoneNumber
()
{
return
phoneNumber
;
}
public
void
setPhoneNumber
(
String
phoneNumber
)
{
this
.
phoneNumber
=
phoneNumber
;
}
public
String
getPhoneAreaCode
()
{
return
phoneAreaCode
;
}
public
void
setPhoneAreaCode
(
String
phoneAreaCode
)
{
this
.
phoneAreaCode
=
phoneAreaCode
;
}
public
Integer
getIsAdmin
()
{
return
isAdmin
;
}
public
void
setIsAdmin
(
Integer
isAdmin
)
{
this
.
isAdmin
=
isAdmin
;
}
public
Integer
getIsSingle
()
{
return
isSingle
;
}
public
void
setIsSingle
(
Integer
isSingle
)
{
this
.
isSingle
=
isSingle
;
}
}
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/vo/LoginUserVo.java
View file @
37c336a4
...
...
@@ -7,6 +7,8 @@ public class LoginUserVo implements Serializable {
private
Integer
enterpriseId
;
private
String
userName
;
private
Integer
isAdmin
=
0
;
/***是否单域**/
private
Integer
isSingle
=
1
;
private
String
phoneNumber
;
private
String
areaCode
;
private
String
code
;
...
...
@@ -66,4 +68,12 @@ public class LoginUserVo implements Serializable {
public
void
setIsAdmin
(
Integer
isAdmin
)
{
this
.
isAdmin
=
isAdmin
;
}
public
Integer
getIsSingle
()
{
return
isSingle
;
}
public
void
setIsSingle
(
Integer
isSingle
)
{
this
.
isSingle
=
isSingle
;
}
}
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