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
9179d002
Commit
9179d002
authored
May 18, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
login
parent
f959cb0c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
28 deletions
+31
-28
LoginController.java
...com/gic/haoban/manage/web/controller/LoginController.java
+31
-28
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/LoginController.java
View file @
9179d002
...
...
@@ -87,47 +87,49 @@ public class LoginController extends WebBaseController {
* @param response
*/
@RequestMapping
(
"login"
)
public
void
login
(
String
auth_code
,
HttpServletResponse
response
)
{
@IgnoreLogin
public
HaobanResponse
login
(
String
auth_code
,
HttpServletResponse
response
)
{
String
userJson
=
qywxCorpApiService
.
getLoginUserInfo
(
config
.
getCorpid
(),
auth_code
);
if
(
StringUtils
.
isBlank
(
userJson
))
{
logger
.
info
(
"
未查询到用户:auth_code:
{}"
,
auth_code
);
return
;
logger
.
info
(
"
企微登录失败auth_code=
{}"
,
auth_code
);
return
this
.
fail
(
"auth_code解析失败"
)
;
}
UserDTO
u
ser
=
JSON
.
parseObject
(
userJson
,
UserDTO
.
class
);
String
corpId
=
user
.
getCorpid
(
);
logger
.
info
(
"【企业微信登录】userId={},auth_code={},corpId={}"
,
user
.
getUserid
(),
auth_code
,
corpId
);
UserDTO
wxU
ser
=
JSON
.
parseObject
(
userJson
,
UserDTO
.
class
);
logger
.
info
(
"企微登录user={}"
,
JSON
.
toJSONString
(
wxUser
)
);
String
corpId
=
wxUser
.
getCorpid
(
);
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseApiService
.
getEnterpriseBycorpId
(
corpId
);
logger
.
info
(
"【企业微信】enterprise={}"
,
JSON
.
toJSONString
(
wxEnterprise
));
StaffDTO
loginStaff
=
null
;
if
(
wxEnterprise
!=
null
)
{
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
user
.
getUserid
(),
wxEnterprise
.
getWxEnterpriseId
());
if
(
null
==
wxEnterprise
)
{
logger
.
info
(
"微信企业不存在corpId={}"
,
corpId
);
return
this
.
fail
(
"微信企业不存在,corpId="
+
corpId
);
}
logger
.
info
(
"企微登录wxenterprise={}"
,
JSON
.
toJSONString
(
wxEnterprise
));
String
wxEnterpriseId
=
wxEnterprise
.
getWxEnterpriseId
()
;
StaffDTO
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
wxUser
.
getUserid
(),
wxEnterpriseId
);
if
(
loginStaff
==
null
)
{
if
(
wxEnterprise
!=
null
)
{
staffApiService
.
wxFristAdd
(
JSON
.
toJSONString
(
user
),
wxEnterprise
.
getWxEnterpriseId
());
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
user
.
getUserid
(),
wxEnterprise
.
getWxEnterpriseId
());
}
staffApiService
.
wxFristAdd
(
JSON
.
toJSONString
(
wxUser
),
wxEnterprise
.
getWxEnterpriseId
());
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
wxUser
.
getUserid
(),
wxEnterprise
.
getWxEnterpriseId
());
}
logger
.
info
(
"
【好办web登录】
staff={}"
,
JSON
.
toJSONString
(
loginStaff
));
logger
.
info
(
"
企微登录
staff={}"
,
JSON
.
toJSONString
(
loginStaff
));
if
(
loginStaff
==
null
)
{
return
;
return
this
.
fail
(
"登录失败,好办管理员不存在"
)
;
}
String
wxEnterpriseId
=
wxEnterprise
.
getWxEnterpriseId
();
List
<
EnterpriseDetailDTO
>
list
=
this
.
wxEnterpriseRelatedApiService
.
listEnterpriseByWxEnterpriseId
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
logger
.
info
(
"企微下无关联GIC商户"
);
return
;
}
String
gicEnterpriseId
=
list
.
get
(
0
).
getEnterpriseId
();
String
loginPhoneNumber
=
loginStaff
.
getPhoneNumber
();
if
(
StringUtils
.
isBlank
(
loginPhoneNumber
))
{
logger
.
info
(
"未配置手机号,staffId ={}"
,
loginStaff
.
getStaffId
());
return
;
return
this
.
fail
(
"登录失败,未配置手机号"
);
}
List
<
EnterpriseDetailDTO
>
list
=
this
.
wxEnterpriseRelatedApiService
.
listEnterpriseByWxEnterpriseId
(
wxEnterpriseId
,
loginPhoneNumber
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
logger
.
info
(
"企微下无管理GIC商户"
);
return
this
.
fail
(
"企微下无管理GIC商户"
);
}
String
gicEnterpriseId
=
list
.
get
(
0
).
getEnterpriseId
();
String
ret
=
this
.
doLogin
(
wxEnterpriseId
,
gicEnterpriseId
,
loginPhoneNumber
,
"gic"
,
response
);
if
(
StringUtils
.
isNotBlank
(
ret
))
{
return
this
.
fail
(
ret
)
;
}
else
{
return
this
.
success
(
null
)
;
}
this
.
doLogin
(
wxEnterpriseId
,
gicEnterpriseId
,
loginPhoneNumber
,
"gic"
,
response
);
}
/**
...
...
@@ -347,6 +349,7 @@ public class LoginController extends WebBaseController {
* @return
*/
@RequestMapping
(
"login-wx-enterprise-list"
)
@IgnoreLogin
public
HaobanResponse
loginWxEnterpriseList
(
String
random
)
{
// 判断是否存在random
AES
aes
=
SecureUtil
.
aes
(
LOGIN_KEY
.
getBytes
());
...
...
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