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
d7fea15b
...
d7fea15b583ccaddc1d9ecdd95f2360a1e5d80a8
authored
2022-03-28 16:20:41 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.优化
1 parent
053fb7e1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
48 deletions
member-service-impl/src/main/java/com/topdraw/business/module/user/weixin/service/dto/UserWeixinDTO.java
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/module/user/weixin/service/dto/UserWeixinDTO.java
View file @
d7fea15
...
...
@@ -16,6 +16,8 @@ import java.io.Serializable;
@Data
public
class
UserWeixinDTO
implements
Serializable
{
private
String
memberCode
;
/** ID */
private
Long
id
;
...
...
@@ -94,13 +96,18 @@ public class UserWeixinDTO implements Serializable {
/** 授权时间 */
private
Timestamp
authTime
;
/** */
private
Integer
gender
;
/** */
private
String
country
;
/** */
private
String
province
;
/** */
private
String
city
;
/** */
private
Integer
sex
;
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
View file @
d7fea15
...
...
@@ -218,35 +218,49 @@ public class UserOperationController {
// 保存大小屏信息到redis同时返回小屏信息
UserWeixinDTO
userWeixinDTO
=
this
.
userOperationService
.
saveUserInfo
(
data
);
// 小屏账号不存在
if
(
Objects
.
isNull
(
userWeixinDTO
)
||
Objects
.
isNull
(
userWeixinDTO
.
getId
()))
{
result
=
UNSUBSCRIBE
;
resultList
.
add
(
result
);
resultList
.
add
(
platformAccount1
);
log
.
info
(
"saveUserInfo ==>> result ==>> [{}]"
,
resultList
);
return
ResultInfo
.
success
(
resultList
);
}
else
{
// 账号存在,未关注
if
(
userWeixinDTO
.
getStatus
()
!=
SUBSCRIBE_STATUS
)
{
result
=
UNSUBSCRIBE
;
}
// 小屏会员
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
userWeixinDTO
.
getMemberId
());
// 小屏用户不存在或者关注状态为未关注(0),返回未关注
if
(
Objects
.
isNull
(
userWeixinDTO
)
||
Objects
.
isNull
(
userWeixinDTO
.
getId
())
||
userWeixinDTO
.
getStatus
()
!=
SUBSCRIBE_STATUS
)
{
result
=
UNSUBSCRIBE
;
if
(
Objects
.
nonNull
(
memberDTO
))
{
// 检查是否绑定,返回绑定的大屏账户
UserTvDTO
userTvDTO
=
this
.
userOperationService
.
checkBind
(
memberDTO
);
if
(
Objects
.
nonNull
(
userTvDTO
))
{
// 绑定的大屏账号
platformAccount1
=
userTvDTO
.
getPlatformAccount
();
}
}
else
{
// 数据异常,没有会员
log
.
info
(
"userWeixinDTO ==>> [{}]"
,
userWeixinDTO
);
throw
new
EntityNotFoundException
(
MemberDTO
.
class
,
"code"
,
"member is null !!"
);
}
resultList
.
add
(
result
);
resultList
.
add
(
platformAccount1
);
log
.
info
(
"saveUserInfo ==>> result ==>> [{}]"
,
resultList
);
return
ResultInfo
.
success
(
resultList
);
}
/***************************************************************************************/
// 关注未绑定
// 关注
if
(
result
.
equalsIgnoreCase
(
SUBSCRIBE
))
{
// 未绑定
if
(
StringUtils
.
isBlank
(
platformAccount1
))
{
// redis中的大小屏信息
String
content
=
(
String
)
this
.
redisUtils
.
get
(
RedisKeyUtil
.
genSeSuSubscribeKey
(
unionid
));
JSONObject
iptvUserInfo
=
JSONObject
.
parseObject
(
content
);
...
...
@@ -270,20 +284,22 @@ public class UserOperationController {
String
image
=
RestTemplateClient
.
chooseImage
(
imageEncode
,
"image"
);
memberDTO
.
setAvatarUrl
(
StringUtils
.
isNotBlank
(
image
)
==
true
?
image:
headimgurlDecode
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"头像解析失败!!!"
);
e
.
printStackTrace
();
}
// 大小屏绑定,如果已经绑定了别的大屏,则不进行处理,返回已绑定的大屏信息
// 已绑定的大屏信息
UserTvDTO
userTvDTO
=
this
.
userOperationService
.
bind
(
memberDTO
,
platformAccount
);
if
(
userTvDTO
!=
null
)
{
platformAccount1
=
userTvDTO
.
getPlatformAccount
();
}
}
/****************************************************************************************/
}
}
resultList
.
add
(
result
);
resultList
.
add
(
platformAccount1
);
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
d7fea15
...
...
@@ -106,21 +106,15 @@ public class UserOperationServiceImpl implements UserOperationService {
@AsyncMqSend
public
void
asyncMemberAndUserTv4Iptv
(
MemberAndUserTvDTO
memberAndUserTv
)
{}
@AsyncMqSend
public
void
asyncWeixin
(
UserWeixinDTO
weixinDTO
)
{
messageProducer
.
sendMessage
(
JSON
.
toJSONString
(
weixinDTO
));
}
public
void
asyncWeixin
(
UserWeixinDTO
weixinDTO
)
{}
@AsyncMqSend
public
void
asyncUserTv
(
UserTvDTO
userTvDTO
)
{
messageProducer
.
sendMessage
(
JSON
.
toJSONString
(
userTvDTO
));
}
public
void
asyncUserTv
(
UserTvDTO
userTvDTO
)
{}
@AsyncMqSend
public
void
asyncMember
(
MemberDTO
memberDTO
)
{
messageProducer
.
sendMessage
(
JSON
.
toJSONString
(
memberDTO
));
}
@Autowired
private
MessageProducer
messageProducer
;
public
void
asyncAppletBind
(
MemberAndUserTvDTO
memberAndUserTvDTO
)
{}
@AsyncMqSend
public
void
asyncUnbind
(
MemberAndUserTvDTO
memberAndUserTvDTO
)
{}
@AsyncMqSend
public
void
asyncUnsubscribe
(
MemberAndWeixinUserDTO
memberAndWeixinUserDTO
)
{}
/**
* 创建大屏账户同时创建会员
...
...
@@ -197,7 +191,7 @@ public class UserOperationServiceImpl implements UserOperationService {
resources
.
setMemberId
(
_userWeixinDTO
.
getMemberId
());
UserWeixin
userWeixin
=
UserWeixinBuilder
.
build
(
resources
);
UserWeixinDTO
weixinDTO
=
this
.
createWeixinUser
(
userWeixin
,
memberDTO
.
getId
(),
memberDTO
.
getCode
());
weixinDTO
.
setMemberCode
(
memberDTO
.
getCode
());
// 同步至iptv
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncWeixin
(
weixinDTO
);
...
...
@@ -291,6 +285,8 @@ public class UserOperationServiceImpl implements UserOperationService {
UserWeixin
userWeixin
=
new
UserWeixin
();
BeanUtils
.
copyProperties
(
resources
,
userWeixin
);
userWeixin
.
setStatus
(
SUBSCRIBE_STATUS
);
// 创建小屏账户同时创建会员
this
.
createWeixinUserAndMember
(
userWeixin
);
...
...
@@ -300,7 +296,7 @@ public class UserOperationServiceImpl implements UserOperationService {
UserWeixinDTO
_userWeixinDTO
=
this
.
doUpdateUserWeiXinStatus
(
userWeixinDTO
,
SUBSCRIBE_STATUS
);
// 同步至iptv
this
.
asyncWeixin
(
_userWeixinDTO
);
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
())
.
asyncWeixin
(
_userWeixinDTO
);
}
// 大屏信息
...
...
@@ -356,11 +352,13 @@ public class UserOperationServiceImpl implements UserOperationService {
MemberDTO
_memberDTO
=
this
.
doUpdateMemberVip
(
memberDTO
,
0
);
// 同步至iptv
this
.
asyncMemberAndUserWeixin4Iptv
(
new
MemberAndWeixinUserDTO
(
memberDTO
,
userWeixinDTO
));
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncUnsubscribe
(
new
MemberAndWeixinUserDTO
(
_
memberDTO
,
userWeixinDTO
));
return
true
;
}
/**
* 更新大屏信息,同时判断是否已经关注,如果关注了则不跳转H5页面
* @param data
...
...
@@ -409,7 +407,6 @@ public class UserOperationServiceImpl implements UserOperationService {
this
.
findMemberByCode
(
memberCode
);
String
platformAccount
=
resources
.
getPlatformAccount
();
this
.
findByPlatformAccount
(
platformAccount
);
UserTvDTO
userTvDTO
=
this
.
findByPlatformAccount
(
platformAccount
);
...
...
@@ -428,7 +425,7 @@ public class UserOperationServiceImpl implements UserOperationService {
UserTvDTO
_userTvDTO
=
this
.
bondPriorityMember
(
userTvDTO
,
memberCode
,
"manual"
);
// 同步至iptv
this
.
asyncUserTv
(
_userTvDTO
);
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
())
.
asyncUserTv
(
_userTvDTO
);
}
/**
...
...
@@ -452,9 +449,10 @@ public class UserOperationServiceImpl implements UserOperationService {
UserTvDTO
_userTvDTO
=
this
.
resetMainAccount
(
memberCode
,
userTvDTO
.
getId
());
// 同步至iptv
this
.
asyncMemberAndUserTv4Iptv
(
new
MemberAndUserTvDTO
(
_memberDTO
,
_userTvDTO
));
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncUnbind
(
new
MemberAndUserTvDTO
(
_memberDTO
,
_userTvDTO
));
}
@Override
public
boolean
deleteAllCollection
(
String
content
)
{
try
{
...
...
@@ -699,7 +697,7 @@ public class UserOperationServiceImpl implements UserOperationService {
MemberDTO
_memberDTO
=
this
.
doUpdateMemberByMemberDTO
(
memberDTO
);
// 同步至iptv
this
.
asyncMemberAndUserTv4Iptv
(
new
MemberAndUserTvDTO
(
_memberDTO
,
_userTvDTO
));
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncAppletBind
(
new
MemberAndUserTvDTO
(
_memberDTO
,
_userTvDTO
));
return
true
;
}
...
...
@@ -780,7 +778,7 @@ public class UserOperationServiceImpl implements UserOperationService {
MemberDTO
_memberDTO
=
this
.
doUpdateMemberByMemberDTO
(
memberDTO
);
// 同步至iptv
this
.
asyncMemberAndUserTv4Iptv
(
new
MemberAndUserTvDTO
(
_memberDTO
,
_userTvDTO
));
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncAppletBind
(
new
MemberAndUserTvDTO
(
_memberDTO
,
_userTvDTO
));
return
null
;
}
...
...
@@ -898,16 +896,6 @@ public class UserOperationServiceImpl implements UserOperationService {
}
/**
*
* @param memberCode
* @return
*/
private
UserTvDTO
findByPriorityMemberCode
(
String
memberCode
)
{
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findByPriorityMemberCode
(
memberCode
);
return
userTvDTO
;
}
/**
* 设置主会员
* @description 检查大屏账户有没有绑定小屏会员,如果没有绑定就将当前会员的code保存到大屏账户中
* @param userTvDTO
...
...
@@ -927,7 +915,7 @@ public class UserOperationServiceImpl implements UserOperationService {
userTvDTO
.
setPriorityMemberCode
(
memberCode
);
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
userTvDTO
,
userTv
);
BeanUtils
.
copyProperties
(
userTvDTO
,
userTv
);
UserTvDTO
_userTvDTO
=
this
.
updateUserTv
(
userTv
);
return
_userTvDTO
;
...
...
@@ -951,7 +939,15 @@ public class UserOperationServiceImpl implements UserOperationService {
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findByPriorityMemberCode
(
memberCode
);
if
(
Objects
.
nonNull
(
userTvDTO
))
{
List
<
MemberDTO
>
memberDTOList
=
this
.
memberService
.
findByUserIptvId
(
id
);
userTvDTO
.
setPriorityMemberCode
(
null
);
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
userTvDTO
,
userTv
);
UserTvDTO
_userTvDTO
=
this
.
userTvService
.
update
(
userTv
);
return
_userTvDTO
;
/*List<MemberDTO> memberDTOList = this.memberService.findByUserIptvId(id);
if (CollectionUtils.isNotEmpty(memberDTOList)) {
// 过滤解绑的会员
...
...
@@ -984,7 +980,7 @@ public class UserOperationServiceImpl implements UserOperationService {
UserTvDTO _userTvDTO = this.userTvService.unbindPriorityMemberCode(userTv);
return _userTvDTO;
}
}
*/
}
...
...
Please
register
or
sign in
to post a comment