Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张云鹏
/
uc-consumer
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
aae2399c
...
aae2399c5a4eb3747fbb800dd8b5e1a7790cc4a2
authored
2022-06-09 00:35:29 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.修改大屏侧小屏解绑和换绑的逻辑
1 parent
cf39040a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
17 deletions
src/main/java/com/topdraw/business/module/member/service/MemberService.java
src/main/java/com/topdraw/business/module/member/service/impl/MemberServiceImpl.java
src/main/java/com/topdraw/business/module/user/iptv/service/UserTvService.java
src/main/java/com/topdraw/business/module/user/iptv/service/impl/UserTvServiceImpl.java
src/main/java/com/topdraw/business/module/user/weixin/service/impl/UserWeixinServiceImpl.java
src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
src/main/java/com/topdraw/business/module/member/service/MemberService.java
View file @
aae2399
...
...
@@ -78,4 +78,6 @@ public interface MemberService {
* @param resources
*/
MemberDTO
doUpdateMemberExpAndLevel
(
Member
resources
);
MemberDTO
unbindUserIpTv
(
Member
member
);
}
...
...
src/main/java/com/topdraw/business/module/member/service/impl/MemberServiceImpl.java
View file @
aae2399
...
...
@@ -9,6 +9,8 @@ import com.topdraw.business.module.member.repository.MemberRepository;
import
com.topdraw.business.module.member.service.MemberService
;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
import
com.topdraw.business.module.member.service.mapper.MemberMapper
;
import
com.topdraw.business.module.user.iptv.service.UserTvService
;
import
com.topdraw.business.module.user.iptv.service.dto.UserTvDTO
;
import
com.topdraw.exception.BadRequestException
;
import
com.topdraw.exception.GlobeExceptionMsg
;
import
com.topdraw.utils.ValidationUtil
;
...
...
@@ -33,6 +35,8 @@ import java.util.Objects;
public
class
MemberServiceImpl
implements
MemberService
{
@Autowired
private
UserTvService
userTvService
;
@Autowired
private
MemberMapper
memberMapper
;
@Autowired
private
MemberRepository
memberRepository
;
...
...
@@ -109,6 +113,12 @@ public class MemberServiceImpl implements MemberService {
}
@Override
public
MemberDTO
unbindUserIpTv
(
Member
member
)
{
Member
_member
=
this
.
save
(
member
);
return
this
.
memberMapper
.
toDto
(
_member
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
MemberDTO
create
(
Member
resources
)
{
...
...
@@ -141,10 +151,22 @@ public class MemberServiceImpl implements MemberService {
log
.
info
(
"MemberServiceImpl ==>> update ==>> resources ==>> [{}]"
,
resources
);
try
{
MemberDTO
memberDTO
=
this
.
checkMember
(
resources
);
resources
.
setId
(
memberDTO
.
getId
());
resources
.
setCode
(
memberDTO
.
getCode
());
resources
.
setCreateTime
(
memberDTO
.
getCreateTime
());
String
platformAccount
=
resources
.
getPlatformAccount
();
if
(
StringUtils
.
isNotBlank
(
platformAccount
))
{
if
(
Objects
.
nonNull
(
resources
.
getUserIptvId
())){
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findByPlatformAccount
(
platformAccount
);
resources
.
setUserIptvId
(
userTvDTO
.
getId
());
}
}
else
{
resources
.
setUserIptvId
(
memberDTO
.
getUserIptvId
());
}
Member
_member
=
this
.
save
(
resources
);
return
this
.
memberMapper
.
toDto
(
_member
);
...
...
src/main/java/com/topdraw/business/module/user/iptv/service/UserTvService.java
View file @
aae2399
...
...
@@ -31,6 +31,7 @@ public interface UserTvService {
*/
UserTvDTO
update
(
UserTv
resources
);
/**
*
* @param resources
...
...
src/main/java/com/topdraw/business/module/user/iptv/service/impl/UserTvServiceImpl.java
View file @
aae2399
...
...
@@ -7,11 +7,11 @@ import com.topdraw.business.module.user.iptv.repository.UserTvRepository;
import
com.topdraw.business.module.user.iptv.service.UserTvService
;
import
com.topdraw.business.module.user.iptv.service.dto.UserTvDTO
;
import
com.topdraw.business.module.user.iptv.service.mapper.UserTvMapper
;
import
com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO
;
import
com.topdraw.exception.EntityNotFoundException
;
import
com.topdraw.exception.GlobeExceptionMsg
;
import
com.topdraw.utils.ValidationUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.dao.EmptyResultDataAccessException
;
import
org.springframework.stereotype.Service
;
...
...
@@ -96,9 +96,23 @@ public class UserTvServiceImpl implements UserTvService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
UserTvDTO
update
(
UserTv
resources
)
{
UserTv
userTv
=
this
.
userTvRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
UserTv:
:
new
);
ValidationUtil
.
isNull
(
userTv
.
getId
(),
"UserTv"
,
"id"
,
resources
.
getId
());
userTv
.
copy
(
resources
);
String
platformAccount
=
resources
.
getPlatformAccount
();
UserTvDTO
userTvDTO
=
this
.
findByPlatformAccount
(
platformAccount
);
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
userTvDTO
,
userTv
);
userTv
.
setId
(
userTvDTO
.
getId
());
userTv
.
setPlatformAccount
(
userTvDTO
.
getPlatformAccount
());
userTv
.
setMemberId
(
userTvDTO
.
getMemberId
());
String
priorityMemberCode
=
resources
.
getPriorityMemberCode
();
if
(
StringUtils
.
isNotBlank
(
priorityMemberCode
)){
userTv
.
setPriorityMemberCode
(
priorityMemberCode
);
}
else
{
userTv
.
setPriorityMemberCode
(
userTvDTO
.
getPriorityMemberCode
());
}
UserTv
_userTv
=
this
.
userTvRepository
.
save
(
userTv
);
return
this
.
userTvMapper
.
toDto
(
_userTv
);
}
...
...
@@ -106,10 +120,7 @@ public class UserTvServiceImpl implements UserTvService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
unbindPriorityMemberCode
(
UserTv
resources
)
{
UserTv
UserTv
=
this
.
userTvRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
com
.
topdraw
.
business
.
module
.
user
.
iptv
.
domain
.
UserTv
::
new
);
ValidationUtil
.
isNull
(
UserTv
.
getId
(),
"UserTv"
,
"id"
,
resources
.
getId
());
UserTv
.
copy
(
resources
);
this
.
userTvRepository
.
save
(
UserTv
);
this
.
userTvRepository
.
save
(
resources
);
}
@Override
...
...
src/main/java/com/topdraw/business/module/user/weixin/service/impl/UserWeixinServiceImpl.java
View file @
aae2399
package
com
.
topdraw
.
business
.
module
.
user
.
weixin
.
service
.
impl
;
import
com.topdraw.business.module.member.service.MemberService
;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
import
com.topdraw.business.module.user.weixin.domain.UserWeixin
;
import
com.topdraw.business.module.user.weixin.domain.UserWeixinBuilder
;
import
com.topdraw.business.module.user.weixin.repository.UserWeixinRepository
;
...
...
@@ -14,6 +16,9 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
javax.validation.constraints.NotNull
;
import
java.util.Objects
;
/**
* @author XiangHan
* @date 2021-12-16
...
...
@@ -23,8 +28,9 @@ import org.springframework.util.Assert;
public
class
UserWeixinServiceImpl
implements
UserWeixinService
{
@Autowired
private
MemberService
memberService
;
@Autowired
private
UserWeixinRepository
userWeixinRepository
;
@Autowired
private
UserWeixinMapper
userWeixinMapper
;
...
...
@@ -38,6 +44,11 @@ public class UserWeixinServiceImpl implements UserWeixinService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
UserWeixin
create
(
UserWeixin
resources
)
{
MemberDTO
memberDTO
=
memberService
.
findByCode
(
resources
.
getMemberCode
());
if
(
Objects
.
nonNull
(
memberDTO
))
{
Long
id
=
memberDTO
.
getId
();
resources
.
setMemberId
(
id
);
}
UserWeixin
build
=
UserWeixinBuilder
.
build
(
resources
);
this
.
userWeixinRepository
.
save
(
build
);
return
resources
;
...
...
@@ -46,6 +57,13 @@ public class UserWeixinServiceImpl implements UserWeixinService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
UserWeixin
resources
)
{
String
appid
=
resources
.
getAppid
();
String
openid
=
resources
.
getOpenid
();
UserWeixinDTO
userWeixinDTO
=
this
.
findFirstByAppIdAndOpenId
(
appid
,
openid
);
resources
.
setId
(
userWeixinDTO
.
getId
());
resources
.
setMemberId
(
userWeixinDTO
.
getMemberId
());
UserWeixin
UserWeixin
=
this
.
userWeixinRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
UserWeixin:
:
new
);
ValidationUtil
.
isNull
(
UserWeixin
.
getId
(),
"UserWeixin"
,
"id"
,
resources
.
getId
());
UserWeixin
.
copy
(
resources
);
...
...
src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
aae2399
...
...
@@ -200,16 +200,30 @@ public class UserOperationServiceImpl implements UserOperationService {
String
platformAccount
=
userTvDTO
.
getPlatformAccount
();
UserTvDTO
_userTvDTO
=
this
.
userTvService
.
findByPlatformAccount
(
platformAccount
);
if
(
Objects
.
nonNull
(
_userTvDTO
))
{
_userTvDTO
.
setPriorityMemberCode
(
null
);
//
this
.
updateUserTv
(
_userTvDTO
,
userTvDTO
);
this
.
unbindPriorityMemberCode
(
_
userTvDTO
);
String
code
=
memberDTO
.
getCode
();
MemberDTO
_memberDTO
=
this
.
memberService
.
findByCode
(
code
);
this
.
updateMember
(
_memberDTO
,
memberDTO
);
this
.
unbindUserIpTv
(
_memberDTO
);
}
private
void
unbindUserIpTv
(
MemberDTO
memberDTO
)
{
memberDTO
.
setUserIptvId
(
null
);
memberDTO
.
setBindIptvPlatformType
(
null
);
memberDTO
.
setBindIptvTime
(
null
);
Member
member
=
new
Member
();
BeanUtils
.
copyProperties
(
memberDTO
,
member
);
this
.
memberService
.
unbindUserIpTv
(
member
);
}
private
void
unbindPriorityMemberCode
(
UserTvDTO
userTvDTO
)
{
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
userTvDTO
,
userTv
);
this
.
userTvService
.
unbindPriorityMemberCode
(
userTv
);
}
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
rollbackFor
=
Exception
.
class
)
...
...
@@ -298,16 +312,13 @@ public class UserOperationServiceImpl implements UserOperationService {
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
rollbackFor
=
Exception
.
class
)
public
void
asyncUserTv
(
UserTvDTO
userTvDTO
)
{
log
.
info
(
"asyncUserTv ==>> userTvDTO ==>> {}"
,
userTvDTO
);
String
platformAccount
=
userTvDTO
.
getPlatformAccount
();
UserTvDTO
_userTvDTO
=
this
.
userTvService
.
findByPlatformAccount
(
platformAccount
);
if
(
Objects
.
nonNull
(
_userTvDTO
))
{
Long
id
=
_userTvDTO
.
getId
();
userTvDTO
.
setId
(
id
);
log
.
info
(
"db result ==>> _userTvDTO ==>> {}"
,
_userTvDTO
);
this
.
updateUserTv
(
_userTvDTO
,
userTvDTO
);
}
}
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
rollbackFor
=
Exception
.
class
)
public
void
asyncMember
(
MemberDTO
memberDTO
)
{
String
code
=
memberDTO
.
getCode
();
...
...
@@ -521,6 +532,7 @@ public class UserOperationServiceImpl implements UserOperationService {
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
userTvDTO
,
userTv
);
log
.
info
(
"updateUserTv ==>> userTv ==>> {}"
,
userTv
);
this
.
userTvService
.
update
(
userTv
);
}
}
...
...
Please
register
or
sign in
to post a comment