Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
attendance-performance-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
attendance-performance-platform
Commits
14453f52
Commit
14453f52
authored
Apr 28, 2024
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
H5登录逻辑处理
parent
8de65dc3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
14 deletions
+72
-14
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/ApiLoginController.java
...java/com/mortals/xhx/busiz/h5/web/ApiLoginController.java
+14
-14
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/DingTalkLoginController.java
...com/mortals/xhx/busiz/h5/web/DingTalkLoginController.java
+58
-0
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/ApiLoginController.java
View file @
14453f52
...
@@ -80,21 +80,21 @@ public class ApiLoginController extends BaseJsonBodyController {
...
@@ -80,21 +80,21 @@ public class ApiLoginController extends BaseJsonBodyController {
}
}
UserEntity
userEntity
=
null
;
UserEntity
userEntity
=
null
;
try
{
try
{
//
if (ObjectUtils.isEmpty(loginForm.getCode())) {
if
(
ObjectUtils
.
isEmpty
(
loginForm
.
getCode
()))
{
//
throw new AppException("钉钉code不能为空!");
throw
new
AppException
(
"钉钉code不能为空!"
);
//
}
}
//
//根据code 查询钉钉用户id
//根据code 查询钉钉用户id
//
Rest<String> personRest = dingPersonService.getPersonByCode(loginForm.getCode());
Rest
<
String
>
personRest
=
dingPersonService
.
getPersonByCode
(
loginForm
.
getCode
());
//
if (personRest.getCode() != YesNoEnum.YES.getValue()) {
if
(
personRest
.
getCode
()
!=
YesNoEnum
.
YES
.
getValue
())
{
//
throw new AppException(DING_AUTH_FAIL,String.format("获取钉钉用户异常,%s", personRest.getMsg()));
throw
new
AppException
(
DING_AUTH_FAIL
,
String
.
format
(
"获取钉钉用户异常,%s"
,
personRest
.
getMsg
()));
//
}
}
userEntity
=
userService
.
doLogin
(
loginName
,
password
,
ip
);
userEntity
=
userService
.
doLogin
(
loginName
,
password
,
ip
);
//
//
if (!ObjectUtils.isEmpty(loginForm.getCode())) {
if
(!
ObjectUtils
.
isEmpty
(
loginForm
.
getCode
()))
{
//
//更新绑定钉钉
//更新绑定钉钉
//
userEntity.setDingUserId(loginForm.getCode());
userEntity
.
setDingUserId
(
loginForm
.
getCode
());
//
userService.getUserDao().update(userEntity);
userService
.
getUserDao
().
update
(
userEntity
);
//
}
}
StaffEntity
staffEntity
=
null
;
StaffEntity
staffEntity
=
null
;
if
(
userEntity
.
getCustomerId
()!=
null
){
if
(
userEntity
.
getCustomerId
()!=
null
){
staffEntity
=
staffService
.
getCache
(
userEntity
.
getCustomerId
().
toString
());
staffEntity
=
staffService
.
getCache
(
userEntity
.
getCustomerId
().
toString
());
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/DingTalkLoginController.java
View file @
14453f52
...
@@ -41,6 +41,9 @@ import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
...
@@ -41,6 +41,9 @@ import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
import
com.mortals.xhx.module.staff.model.StaffEntity
;
import
com.mortals.xhx.module.staff.model.StaffEntity
;
import
com.mortals.xhx.module.staff.model.StaffQuery
;
import
com.mortals.xhx.module.staff.model.StaffQuery
;
import
com.mortals.xhx.module.staff.service.StaffService
;
import
com.mortals.xhx.module.staff.service.StaffService
;
import
com.mortals.xhx.module.window.model.WindowOwnerEntity
;
import
com.mortals.xhx.module.window.model.WindowOwnerQuery
;
import
com.mortals.xhx.module.window.service.WindowOwnerService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
...
@@ -52,6 +55,7 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -52,6 +55,7 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.*;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.*;
...
@@ -77,6 +81,8 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
...
@@ -77,6 +81,8 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
@Autowired
@Autowired
private
IDingPersonService
dingPersonService
;
private
IDingPersonService
dingPersonService
;
@Autowired
private
WindowOwnerService
windowOwnerService
;
@RequestMapping
(
"authlogin"
)
@RequestMapping
(
"authlogin"
)
...
@@ -107,6 +113,32 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
...
@@ -107,6 +113,32 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
}
}
data
.
put
(
"id"
,
userEntity
.
getId
());
data
.
put
(
"id"
,
userEntity
.
getId
());
if
(
userEntity
!=
null
)
{
StaffEntity
staffEntity
=
null
;
if
(
userEntity
.
getCustomerId
()
!=
null
)
{
staffEntity
=
staffService
.
getCache
(
userEntity
.
getCustomerId
().
toString
());
}
if
(
staffEntity
!=
null
)
{
WindowOwnerEntity
windowOwnerEntity
=
windowOwnerService
.
selectOne
(
new
WindowOwnerQuery
().
staffId
(
staffEntity
.
getId
()));
if
(
windowOwnerEntity
==
null
)
{
userEntity
.
setUserType
(
1
);
//工作人员
}
else
{
if
(
windowOwnerEntity
.
getInspect
()
==
1
)
{
userEntity
.
setUserType
(
3
);
//具有巡检的窗口负责人
}
else
{
userEntity
.
setUserType
(
2
);
//普通窗口负责人
}
if
(
StringUtils
.
isNotEmpty
(
windowOwnerEntity
.
getStaffIds
()))
{
List
<
Long
>
staffIdList
=
Arrays
.
asList
(
windowOwnerEntity
.
getStaffIds
().
split
(
","
)).
stream
().
map
(
s
->
Long
.
parseLong
(
s
.
trim
())).
collect
(
Collectors
.
toList
());
windowOwnerEntity
.
setStaffCount
(
staffIdList
.
size
());
}
else
{
windowOwnerEntity
.
setStaffCount
(
0
);
}
windowOwnerEntity
.
setWindowOwnerDetailList
(
null
);
data
.
put
(
"windowOwner"
,
windowOwnerEntity
);
}
}
}
data
.
put
(
"userType"
,
userEntity
.
getUserType
());
data
.
put
(
"userType"
,
userEntity
.
getUserType
());
userEntity
.
setLoginTime
(
System
.
currentTimeMillis
());
userEntity
.
setLoginTime
(
System
.
currentTimeMillis
());
userEntity
.
setToken
(
IdUtil
.
fastSimpleUUID
());
userEntity
.
setToken
(
IdUtil
.
fastSimpleUUID
());
...
@@ -206,6 +238,32 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
...
@@ -206,6 +238,32 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
String
token
=
authTokenService
.
getToken
(
request
);
String
token
=
authTokenService
.
getToken
(
request
);
data
.
put
(
"id"
,
user
.
getId
());
data
.
put
(
"id"
,
user
.
getId
());
data
.
put
(
"token"
,
token
);
data
.
put
(
"token"
,
token
);
if
(
userEntity
!=
null
)
{
StaffEntity
staffEntity
=
null
;
if
(
userEntity
.
getCustomerId
()
!=
null
)
{
staffEntity
=
staffService
.
getCache
(
userEntity
.
getCustomerId
().
toString
());
}
if
(
staffEntity
!=
null
)
{
WindowOwnerEntity
windowOwnerEntity
=
windowOwnerService
.
selectOne
(
new
WindowOwnerQuery
().
staffId
(
staffEntity
.
getId
()));
if
(
windowOwnerEntity
==
null
)
{
userEntity
.
setUserType
(
1
);
//工作人员
}
else
{
if
(
windowOwnerEntity
.
getInspect
()
==
1
)
{
userEntity
.
setUserType
(
3
);
//具有巡检的窗口负责人
}
else
{
userEntity
.
setUserType
(
2
);
//普通窗口负责人
}
if
(
StringUtils
.
isNotEmpty
(
windowOwnerEntity
.
getStaffIds
()))
{
List
<
Long
>
staffIdList
=
Arrays
.
asList
(
windowOwnerEntity
.
getStaffIds
().
split
(
","
)).
stream
().
map
(
s
->
Long
.
parseLong
(
s
.
trim
())).
collect
(
Collectors
.
toList
());
windowOwnerEntity
.
setStaffCount
(
staffIdList
.
size
());
}
else
{
windowOwnerEntity
.
setStaffCount
(
0
);
}
windowOwnerEntity
.
setWindowOwnerDetailList
(
null
);
data
.
put
(
"windowOwner"
,
windowOwnerEntity
);
}
}
}
data
.
put
(
"userType"
,
userEntity
.
getUserType
());
data
.
put
(
"userType"
,
userEntity
.
getUserType
());
ret
.
put
(
KEY_RESULT_DATA
,
data
);
ret
.
put
(
KEY_RESULT_DATA
,
data
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
...
...
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