Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
fa04669a
Commit
fa04669a
authored
Apr 19, 2021
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登陆接口
parent
0c841bf4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
11 deletions
+41
-11
LoginController.java
...com/gic/haoban/manage/web/controller/LoginController.java
+41
-11
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/LoginController.java
View file @
fa04669a
...
...
@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.EnterpriseDetailDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.WxApplicationDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
...
...
@@ -25,7 +24,6 @@ import com.gic.redis.data.util.RedisUtil;
import
com.gic.wechat.api.dto.qywx.UserDTO
;
import
com.gic.wechat.api.service.qywx.QywxCorpApiService
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -43,6 +41,7 @@ import java.io.UnsupportedEncodingException;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@RestController
...
...
@@ -190,8 +189,8 @@ public class LoginController extends WebBaseController{
//运维登录
@IgnoreLogin
@RequestMapping
(
"gic-login"
)
public
ModelAndView
ywLogin
(
String
random
,
HttpServletResponse
response
)
{
//判断是否存在random
public
ModelAndView
gicLogin
(
String
random
,
String
wxEnterpriseId
,
HttpServletResponse
response
)
{
//判断是否存在random
AES
aes
=
SecureUtil
.
aes
(
LOGIN_KEY
.
getBytes
());
String
o
=
aes
.
decryptStr
(
random
);
if
(
o
==
null
){
...
...
@@ -202,7 +201,6 @@ public class LoginController extends WebBaseController{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
o
);
String
gicEnterpriseId
=
jsonObject
.
getString
(
"enterpriseId"
);
String
loginPhoneNumber
=
jsonObject
.
getString
(
"phoneNumber"
);
String
wxEnterpriseId
=
jsonObject
.
getString
(
"wxEnterpriseId"
);
List
<
WxEnterpriseDTO
>
enterpriseDTOList
=
wxEnterpriseRelatedApiService
.
listWxEnterpriseByEid
(
gicEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
enterpriseDTOList
))
{
logger
.
info
(
"登录失败,不存在对应企业:{}"
,
o
);
...
...
@@ -210,18 +208,22 @@ public class LoginController extends WebBaseController{
return
model
;
}
WxEnterpriseDTO
detailDTO
=
null
;
if
(!
StringUtils
.
isBlank
(
wxEnterpriseId
))
{
//todo 销售线索页面
}
else
{
if
(!
StringUtils
.
isNotBlank
(
wxEnterpriseId
))
{
detailDTO
=
enterpriseDTOList
.
stream
().
filter
(
dto
->
dto
.
getWxEnterpriseId
().
equals
(
wxEnterpriseId
)).
findFirst
().
orElse
(
null
);
}
else
if
(
enterpriseDTOList
.
size
()
>
1
)
{
detailDTO
=
enterpriseDTOList
.
get
(
0
);
}
else
{
logger
.
info
(
"登陆选择多个企业:{}"
,
JSONObject
.
toJSONString
(
enterpriseDTOList
));
ModelAndView
model
=
new
ModelAndView
(
new
RedirectView
(
"/haoban-3/#/login"
,
false
,
false
));
return
model
;
}
if
(
null
==
detailDTO
)
{
logger
.
info
(
"登录失败,不存在对应企业:{}"
,
o
);
ModelAndView
model
=
new
ModelAndView
(
new
RedirectView
(
"/haoban-3/#/gic-error"
,
false
,
false
));
return
model
;
}
enterpriseDTOList
.
stream
().
filter
(
dto
->
dto
.
getWxEnterpriseId
().
equals
(
wxEnterpriseId
))
//TODO 销售线索 多个选择
StaffDTO
staff
=
staffApiService
.
selectByNationcodeAndPhoneNumber
(
detailDTO
.
getWxEnterpriseId
(),
"86"
,
loginPhoneNumber
);
if
(
null
==
staff
)
{
...
...
@@ -229,7 +231,7 @@ public class LoginController extends WebBaseController{
ModelAndView
model
=
new
ModelAndView
(
new
RedirectView
(
"/haoban-3/#/gic-error"
,
false
,
false
));
return
model
;
}
String
wxEnterpriseId
=
detailDTO
.
getWxEnterpriseId
();
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
2
);
if
(
null
==
application
)
{
logger
.
info
(
"登录企业应用 没授权!{}"
);
...
...
@@ -280,7 +282,35 @@ public class LoginController extends WebBaseController{
return
null
;
}
@RequestMapping
(
"login-wx-enterprise-list"
)
public
HaobanResponse
loginOut
(
String
random
)
{
//判断是否存在random
AES
aes
=
SecureUtil
.
aes
(
LOGIN_KEY
.
getBytes
());
String
o
=
aes
.
decryptStr
(
random
);
if
(
o
==
null
)
{
logger
.
info
(
"解密异常"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_5
);
}
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
o
);
String
gicEnterpriseId
=
jsonObject
.
getString
(
"enterpriseId"
);
String
wxEnterpriseId
=
jsonObject
.
getString
(
"wxEnterpriseId"
);
List
<
WxEnterpriseDTO
>
enterpriseDTOList
=
wxEnterpriseRelatedApiService
.
listWxEnterpriseByEid
(
gicEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
enterpriseDTOList
))
{
logger
.
info
(
"登录失败,不存在对应企业:{}"
,
o
);
return
resultResponse
(
HaoBanErrCode
.
ERR_6
);
}
if
(!
StringUtils
.
isNotBlank
(
wxEnterpriseId
))
{
List
<
WxEnterpriseDTO
>
enterpriseDTOS
=
enterpriseDTOList
.
stream
().
filter
(
dto
->
dto
.
getWxEnterpriseId
().
equals
(
wxEnterpriseId
)).
collect
(
Collectors
.
toList
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
enterpriseDTOS
);
}
else
{
logger
.
info
(
"登陆选择多个企业:{}"
,
JSONObject
.
toJSONString
(
enterpriseDTOList
));
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
enterpriseDTOList
);
}
}
@RequestMapping
(
"login-out"
)
public
HaobanResponse
loginOut
()
{
...
...
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