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
10594020
...
10594020180333986cad67540c3b9d4722b20de0
authored
2022-08-19 15:39:47 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch '2.2.0-future' into 2.2.0-future-updatetask
2 parents
9087512d
f7479712
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
108 additions
and
25 deletions
member-service-impl/src/main/java/com/topdraw/business/module/user/app/repository/UserAppRepository.java
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/UserAppService.java
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/impl/UserAppServiceImpl.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/UserOperationService.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/PointsOperationServiceImpl.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/app/repository/UserAppRepository.java
View file @
1059402
...
...
@@ -61,4 +61,7 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec
" :#{#resources.gender}, NULL, now(), NULL, :#{#resources.tags}, "
+
" :#{#resources.description}, :#{#resources.createTime}, now());"
,
nativeQuery
=
true
)
void
saveByIdManual
(
@Param
(
"resources"
)
UserAppIdManual
userAppIdManual
);
Optional
<
UserApp
>
findByMemberId
(
Long
memberId
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/UserAppService.java
View file @
1059402
...
...
@@ -92,4 +92,6 @@ public interface UserAppService {
ResultInfo
saveAppAndBindWeixin4Vis
(
VisUserWeixin
resources
);
ResultInfo
saveAppAndBindQq4Vis
(
VisUserQq
resources
);
UserAppDTO
findByMemberId
(
Long
memberId
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/impl/UserAppServiceImpl.java
View file @
1059402
...
...
@@ -549,6 +549,12 @@ public class UserAppServiceImpl implements UserAppService {
return
ResultInfo
.
failure
(
null
);
}
@Override
@Transactional
(
readOnly
=
true
)
public
UserAppDTO
findByMemberId
(
Long
memberId
)
{
UserApp
userApp
=
this
.
userAppRepository
.
findByMemberId
(
memberId
).
orElseGet
(
UserApp:
:
new
);
return
this
.
userAppMapper
.
toDto
(
userApp
);
}
@Override
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
View file @
1059402
...
...
@@ -242,20 +242,14 @@ public class UserOperationController {
@ApiOperation
(
"app绑定大屏"
)
@AnonymousAccess
public
ResultInfo
appBind
(
@Validated
(
value
=
{
BindGroup
.
class
})
@RequestBody
BindBean
resources
)
{
log
.
info
(
"
UserOperationController ==> appletBind ==>> param ==> [{}]
"
,
resources
);
log
.
info
(
"
app绑定大屏, 参数 appBind# resources ==> {}
"
,
resources
);
Long
memberId
=
resources
.
getMemberId
();
if
(
Objects
.
isNull
(
memberId
))
{
return
ResultInfo
.
failure
(
"参数错误,memberId 不存在"
);
}
String
platformAccount
=
resources
.
getPlatformAccount
();
if
(
StringUtils
.
isBlank
(
platformAccount
))
{
return
ResultInfo
.
failure
(
"参数错误,大屏账号不存在"
);
return
ResultInfo
.
failure
(
"参数错误, memberId不得为空"
);
}
boolean
result
=
this
.
userOperationService
.
appBind
(
resources
);
return
ResultInfo
.
success
(
result
);
return
this
.
userOperationService
.
appBind
(
resources
);
}
@PostMapping
(
"/appUnbind"
)
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/UserOperationService.java
View file @
1059402
...
...
@@ -124,7 +124,7 @@ public interface UserOperationService {
* @param resources
* @return
*/
boolean
appBind
(
BindBean
resources
);
ResultInfo
appBind
(
BindBean
resources
);
/**
*
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/PointsOperationServiceImpl.java
View file @
1059402
...
...
@@ -204,7 +204,7 @@ public class PointsOperationServiceImpl implements PointsOperationService {
BeanUtils
.
copyProperties
(
pointsAvailableDTO
,
_tempPoints
);
BeanUtils
.
copyProperties
(
tempPoints
,
_tempPoints
);
_tempPoints
.
setPoints
(-(
Math
.
abs
(
points
)));
Long
totalPoints
=
currentPoints
+
tempPoints
.
getPoints
()
;
Long
totalPoints
=
currentPoints
-
points
;
this
.
doInsertTrPointsDetail
(
memberId
,
memberCode
,
_tempPoints
,
currentPoints
,
totalPoints
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
1059402
...
...
@@ -1272,7 +1272,6 @@ public class UserOperationServiceImpl implements UserOperationService {
// 更新大屏账户
this
.
userTvService
.
doUpdatePriorityMemberCode
(
userTv
);
userTvDTO
.
setPriorityMemberCode
(
memberDTO
.
getCode
());
}
...
...
@@ -1318,8 +1317,98 @@ public class UserOperationServiceImpl implements UserOperationService {
}
@Override
public
boolean
appBind
(
BindBean
resources
)
{
return
this
.
minaBind
(
resources
);
public
ResultInfo
appBind
(
BindBean
resources
)
{
Long
memberId
=
resources
.
getMemberId
();
String
platformAccount
=
resources
.
getPlatformAccount
();
// 大屏账户
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findByPlatformAccount
(
platformAccount
);
log
.
info
(
"查询大屏账号信息, appBind# userTvDTO ==>> {}"
,
userTvDTO
);
// 账户是否存在
if
(
Objects
.
isNull
(
userTvDTO
.
getId
()))
{
log
.
error
(
"大屏账号信息不存在, appBind# platformAccount ==> {}"
,
platformAccount
);
return
ResultInfo
.
failure
(
"大屏账号信息不存在, 请检查数据"
);
}
// app账户
if
(
Objects
.
nonNull
(
memberId
))
{
UserAppDTO
userAppDTO
=
this
.
userAppService
.
findByMemberId
(
memberId
);
log
.
info
(
"检查app账号是否存在, appBind# userAppDTO ==>> {}"
,
userAppDTO
);
// 账户是否存在
if
(
Objects
.
isNull
(
userAppDTO
.
getId
()))
{
log
.
error
(
"通过会员id无法找到对应的app账号, appBind# memberId ==> {}"
,
memberId
);
return
ResultInfo
.
failure
(
"app账号不存在,请检查数据"
);
}
}
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
memberId
);
log
.
info
(
"检查会员是否存在, appBind# memberDTO ==>> {}"
,
memberDTO
);
if
(
Objects
.
nonNull
(
memberDTO
.
getId
()))
{
Long
userIptvId
=
memberDTO
.
getUserIptvId
();
if
(
Objects
.
nonNull
(
userIptvId
))
{
log
.
error
(
"该会员已绑定,appBind# 会员id ==> {} | 绑定的大屏账号id ==>> "
,
memberDTO
.
getId
(),
userIptvId
);
return
ResultInfo
.
failure
(
GlobeExceptionMsg
.
ALREADY_BIND
);
}
}
else
{
log
.
error
(
"会员信息不存在,请检查数据, appBind# memberId ==>> {}"
,
memberId
);
return
ResultInfo
.
failure
(
"会员信息不存在,请检查数据"
);
}
// 主账户
String
priorityMemberCode
=
userTvDTO
.
getPriorityMemberCode
();
if
(
StringUtils
.
isBlank
(
priorityMemberCode
))
{
priorityMemberCode
=
memberDTO
.
getCode
();
log
.
info
(
"大屏账号为绑定主账号,开始设置主会员 priorityMemberCode ==>> {}"
,
priorityMemberCode
);
UserTv
userTv
=
new
UserTv
();
userTv
.
setId
(
userTvDTO
.
getId
());
userTv
.
setPriorityMemberCode
(
priorityMemberCode
);
// 更新大屏账户
this
.
userTvService
.
doUpdatePriorityMemberCode
(
userTv
);
userTvDTO
.
setPriorityMemberCode
(
memberDTO
.
getCode
());
}
Member
member
=
new
Member
();
member
.
setId
(
memberDTO
.
getId
());
member
.
setCode
(
memberDTO
.
getCode
());
String
platform
=
userTvDTO
.
getPlatform
();
// 绑定IPTV平台 0:未知;1:电信;2:移动;3:联通
Integer
bindIptvPlatformType
=
0
;
// 联通
if
(
UserConstant
.
platform_lt
.
contains
(
platform
))
{
bindIptvPlatformType
=
PLATFORM_LIST
[
3
];
}
// 移动
if
(
UserConstant
.
platform_yd
.
contains
(
platform
))
{
bindIptvPlatformType
=
PLATFORM_LIST
[
2
];
}
// 电信
if
(
UserConstant
.
platform_dx
.
contains
(
platform
))
{
bindIptvPlatformType
=
PLATFORM_LIST
[
1
];
}
member
.
setUserIptvId
(
userTvDTO
.
getId
());
member
.
setBindIptvTime
(
TimestampUtil
.
now
());
member
.
setBindIptvPlatformType
(
bindIptvPlatformType
);
log
.
info
(
"修改小屏会员对应的绑定关系,member ==>> {}"
,
member
);
// 修改会员信息
this
.
memberService
.
doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime
(
member
);
memberDTO
.
setPlatformAccount
(
platformAccount
);
log
.
info
(
"发送绑定消息至大屏,memberDTO ==>> {} || userTvDTO ==>> {}"
,
memberDTO
,
userTvDTO
);
// 同步至iptv
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
())
.
asyncMinaBind
(
new
MemberAndUserTvDTO
(
memberDTO
,
userTvDTO
));
UserTvSimpleDTO
userTvSimpleDTO
=
this
.
userTvService
.
findSimpleByPlatformAccount
(
platformAccount
);
if
(
Objects
.
nonNull
(
userTvSimpleDTO
.
getPlatformAccount
())
&&
StringUtils
.
isBlank
(
userTvSimpleDTO
.
getPriorityMemberCode
()))
{
userTvSimpleDTO
.
setPriorityMemberCode
(
priorityMemberCode
);
JSONObject
hashMap
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
userTvSimpleDTO
),
JSONObject
.
class
);
this
.
redisUtils
.
set
(
RedisKeyConstants
.
cacheVisUserByPlatformAccount
+
"::"
+
platformAccount
,
hashMap
);
}
return
ResultInfo
.
success
(
true
);
}
/**
...
...
@@ -1397,17 +1486,6 @@ public class UserOperationServiceImpl implements UserOperationService {
return
userTvDTO
;
}
private
void
updateUserTvSimplePriorityMemberCodeRedis
(
String
platformAccount
,
String
priorityMemberCode
){
// 修改缓存中MemberSimple的大屏主账号信息,因为执行任务之前会去检查主会员d
UserTvSimpleDTO
userTvSimpleDTO
=
this
.
userTvService
.
findSimpleByPlatformAccount
(
platformAccount
);
if
(
Objects
.
nonNull
(
userTvSimpleDTO
.
getPlatformAccount
())
&&
StringUtils
.
isBlank
(
userTvSimpleDTO
.
getPriorityMemberCode
()))
{
userTvSimpleDTO
.
setPriorityMemberCode
(
priorityMemberCode
);
JSONObject
hashMap
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
userTvSimpleDTO
),
JSONObject
.
class
);
this
.
redisUtils
.
set
(
RedisKeyConstants
.
cacheVisUserByPlatformAccount
+
"::"
+
platformAccount
,
hashMap
);
}
}
/**
*
* @param unionId 身份唯一标识
...
...
Please
register
or
sign in
to post a comment