Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张云鹏
/
uc-engine
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
6a3f28dd
...
6a3f28dd5bdd38433d85f71be8632512c47d4d80
authored
2022-03-18 16:38:39 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.退出大屏账户后,设置默认账户
1 parent
0ea9b74c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
View file @
6a3f28d
...
...
@@ -33,6 +33,7 @@ import com.topdraw.weixin.util.WeixinUtil;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.assertj.core.util.Arrays
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -44,6 +45,7 @@ import java.io.IOException;
import
java.net.URLDecoder
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Api
(
"账户处理"
)
@RestController
...
...
@@ -166,8 +168,44 @@ public class UserOperationController {
MemberDTO
memberDTO
=
this
.
memberService
.
getByCode
(
memberCode1
);
String
memberCode
=
memberDTO
.
getCode
();
if
(
StringUtils
.
isNotBlank
(
memberCode
))
{
String
platformAccount
=
userTv
.
getPlatformAccount
();
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findByPlatformAccount
(
platformAccount
);
if
(
Objects
.
isNull
(
userTvDTO
))
throw
new
EntityNotFoundException
(
UserTvDTO
.
class
,
"platformAccount"
,
"大屏账户不存在"
);
// 解绑
userTv
.
setMemberCode
(
memberCode
);
this
.
userTvOperationService
.
unbind
(
userTv
);
// 设置默认账号,以时间最早的为准
List
<
MemberDTO
>
memberDTOList
=
this
.
memberService
.
findByUserIptvId
(
userTvDTO
.
getId
());
if
(
CollectionUtils
.
isNotEmpty
(
memberDTOList
))
{
List
<
MemberDTO
>
collect
=
memberDTOList
.
stream
().
filter
(
memberDTO1
->
!
memberDTO1
.
getCode
().
equalsIgnoreCase
(
memberCode1
)).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
collect
)
){
if
(
collect
.
size
()
>
1
)
{
collect
.
sort
(
new
Comparator
<
MemberDTO
>()
{
@Override
public
int
compare
(
MemberDTO
memberDTO
,
MemberDTO
t1
)
{
return
t1
.
getBindIptvTime
().
compareTo
(
memberDTO
.
getBindIptvTime
());
}
});
}
// 有其他会员的话,绑定最早的一个会员
MemberDTO
memberDTO1
=
collect
.
get
(
0
);
userTvDTO
.
setPriorityMemberCode
(
memberDTO1
.
getCode
());
BeanUtils
.
copyProperties
(
userTvDTO
,
userTv
);
this
.
userTvService
.
update
(
userTv
);
}
}
}
else
{
throw
new
EntityNotFoundException
(
MemberDTO
.
class
,
"code"
,
"会员信息不存在!!"
);
}
}
...
...
Please
register
or
sign in
to post a comment