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
2477a356
...
2477a356f80f414fd24d6964db06b2ab99de06fe
authored
2022-06-19 23:31:11 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.优化部分程序,清理警告信息
1 parent
f916b030
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
361 additions
and
611 deletions
member-service-impl/src/main/java/com/topdraw/business/module/member/viphistory/rest/MemberVipHistoryController.java
member-service-impl/src/main/java/com/topdraw/business/module/member/viphistory/service/MemberVipHistoryService.java
member-service-impl/src/main/java/com/topdraw/business/module/member/viphistory/service/impl/MemberVipHistoryServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/module/rights/constant/RightTypeConstants.java
member-service-impl/src/main/java/com/topdraw/business/module/task/template/constant/TaskEventType.java
member-service-impl/src/main/java/com/topdraw/business/process/rest/MemberOperationController.java
member-service-impl/src/main/java/com/topdraw/business/process/rest/PointsOperationController.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/process/service/impl/member/MemberOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/member/MemberProfileOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/service/member/MemberOperationService.java
member-service-impl/src/main/java/com/topdraw/business/process/service/member/MemberProfileOperationService.java
member-service-impl/src/main/java/com/topdraw/config/RedisKeyConstants.java
member-service-impl/src/main/java/com/topdraw/config/UceRedisConfig.java
member-service-impl/src/test/java/com/topdraw/test/business/process/service/MemberOperationServiceTest.java
member-service-impl/src/main/java/com/topdraw/business/module/member/viphistory/rest/MemberVipHistoryController.java
deleted
100644 → 0
View file @
f916b03
package
com
.
topdraw
.
business
.
module
.
member
.
viphistory
.
rest
;
import
com.topdraw.business.module.member.viphistory.domain.MemberVipHistory
;
import
com.topdraw.business.process.service.member.MemberOperationService
;
import
com.topdraw.common.ResultInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author luerlong
* @date 2021-12-10
*/
@Api
(
tags
=
"会员vip历史管理"
)
@RestController
@RequestMapping
(
"/uce/memberVipHistory"
)
public
class
MemberVipHistoryController
{
@Autowired
private
MemberOperationService
memberOperationService
;
@PostMapping
@ApiOperation
(
"新增MemberVipHistory"
)
public
ResultInfo
create
(
@Validated
@RequestBody
MemberVipHistory
resources
)
{
this
.
memberOperationService
.
createVipHistory
(
resources
);
return
ResultInfo
.
success
();
}
}
member-service-impl/src/main/java/com/topdraw/business/module/member/viphistory/service/MemberVipHistoryService.java
View file @
2477a35
...
...
@@ -24,7 +24,7 @@ public interface MemberVipHistoryService {
*
* @param resources
*/
void
create
(
MemberVipHistory
resources
);
MemberVipHistoryDTO
create
(
MemberVipHistory
resources
);
/**
*
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/viphistory/service/impl/MemberVipHistoryServiceImpl.java
View file @
2477a35
...
...
@@ -52,15 +52,14 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@AsyncMqSend
public
void
create
(
MemberVipHistory
resources
)
{
public
MemberVipHistoryDTO
create
(
MemberVipHistory
resources
)
{
log
.
info
(
"MemberVipHistoryServiceImpl ==>> MemberVipHistoryServiceImpl ==>> param ==>> [{}]"
,
resources
);
MemberDTO
memberDTO
=
this
.
checkMember
(
resources
);
MemberVipHistory
memberVipHistory
=
MemberVipHistoryBuilder
.
build
(
resources
);
MemberVipHistory
vipHistory
=
this
.
memberVipHistoryRepository
.
save
(
memberVipHistory
);
vipHistory
.
setMemberCode
(
memberDTO
.
getCode
());
return
this
.
memberVipHistoryMapper
.
toDto
(
vipHistory
);
}
@Override
...
...
member-service-impl/src/main/java/com/topdraw/business/module/rights/constant/RightTypeConstants.java
0 → 100644
View file @
2477a35
package
com
.
topdraw
.
business
.
module
.
rights
.
constant
;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/6/18 16:06
* @version: :
* @modified By:
* @since : modified in 2022/6/18 16:06
*/
public
interface
RightTypeConstants
{
// 优惠券
int
DISCOUNT_COUPON
=
1
;
// 观影券
int
VIEW_COUPON
=
2
;
// 参加活动
int
JOIN_ACTIVITY
=
3
;
// 积分商品
int
POINTS_GOODS
=
4
;
// IPTV产品包
int
IPTV_PRODUCT
=
5
;
// IPTV观影权益
int
IPTV_VIEW
=
6
;
}
member-service-impl/src/main/java/com/topdraw/business/module/task/template/constant/TaskEventType.java
0 → 100644
View file @
2477a35
package
com
.
topdraw
.
business
.
module
.
task
.
template
.
constant
;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/6/18 14:30
* @version: :
* @modified By:
* @since : modified in 2022/6/18 14:30
*/
public
interface
TaskEventType
{
//类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置;
// 8:播放记录;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他
int
LOGIN
=
1
;
int
VIEW
=
2
;
int
ACTIVITY
=
3
;
int
ORDER
=
4
;
int
MEMBER_PRIORITY
=
5
;
int
SIGN
=
6
;
int
COMPLETE_INFO
=
7
;
int
PLAY
=
8
;
int
BINDING
=
10
;
int
POINTS_TRANS
=
11
;
int
POINTS_EXCHANGE_GOODS
=
30
;
int
SYSTEM_OPERATE
=
98
;
int
OHHER
=
99
;
}
member-service-impl/src/main/java/com/topdraw/business/process/rest/MemberOperationController.java
View file @
2477a35
...
...
@@ -2,25 +2,20 @@ package com.topdraw.business.process.rest;
import
com.topdraw.annotation.AnonymousAccess
;
import
com.topdraw.business.module.common.validated.UpdateGroup
;
import
com.topdraw.business.module.member.domain.Member
;
import
com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO
;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
import
com.topdraw.business.process.domian.member.MemberOperationBean
;
import
com.topdraw.business.process.domian.weixin.BuyVipBean
;
import
com.topdraw.business.process.service.member.MemberOperationService
;
import
com.topdraw.common.IResultInfo
;
import
com.topdraw.common.ResultInfo
;
import
com.topdraw.exception.BadRequestException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.sql.Timestamp
;
import
java.util.Objects
;
@Api
(
"会员处理"
)
...
...
@@ -38,21 +33,11 @@ public class MemberOperationController {
@AnonymousAccess
public
ResultInfo
updateVipByMemberId
(
@Validated
(
value
=
{
UpdateGroup
.
class
})
@RequestBody
MemberOperationBean
resources
)
{
log
.
info
(
"member ==>> doUpdateVipByCode ==>> param ==>> [{}]"
,
resources
);
Integer
vip
=
resources
.
getVip
();
Timestamp
vipExpireTime
=
resources
.
getVipExpireTime
();
Long
memberId
=
resources
.
getMemberId
();
MemberDTO
memberDTO
=
this
.
memberOperationService
.
findById
(
memberId
);
resources
.
setMemberCode
(
memberDTO
.
getCode
());
Member
member
=
new
Member
();
BeanUtils
.
copyProperties
(
memberDTO
,
member
);
if
(
Objects
.
nonNull
(
vip
))
{
member
.
setVip
(
vip
);
}
if
(
Objects
.
nonNull
(
vipExpireTime
))
{
member
.
setVipExpireTime
(
vipExpireTime
);
}
this
.
memberOperationService
.
doUpdateMemberVipAndVipExpireTime
(
member
);
return
ResultInfo
.
success
();
return
this
.
updateVipByMemberCode
(
resources
);
}
@RequestMapping
(
value
=
"/updateVipByMemberCode"
)
...
...
@@ -71,28 +56,9 @@ public class MemberOperationController {
log
.
error
(
"参数错误,vip为空或者小于0 , vip ==>> {}"
,
vip
);
return
ResultInfo
.
failure
(
"参数错误,vip为空或者小于0"
);
}
Timestamp
vipExpireTime
=
resources
.
getVipExpireTime
();
Member
member
=
new
Member
();
member
.
setCode
(
memberCode
);
member
.
setVip
(
vip
);
member
.
setVipExpireTime
(
vipExpireTime
);
MemberDTO
memberDTO
=
this
.
memberOperationService
.
doUpdateMemberVipAndVipExpireTime
(
member
);
this
.
createVipHistory
(
memberDTO
.
getId
(),
memberDTO
.
getCode
(),
vip
,
vipExpireTime
);
return
ResultInfo
.
success
();
}
private
void
createVipHistory
(
Long
memberId
,
String
code
,
Integer
vip
,
Timestamp
vipExpireTime
){
BuyVipBean
buyVipBean
=
new
BuyVipBean
();
buyVipBean
.
setMemberId
(
memberId
);
buyVipBean
.
setMemberCode
(
code
);
buyVipBean
.
setVip
(
vip
);
buyVipBean
.
setVipExpireTime
(
vipExpireTime
);
this
.
memberOperationService
.
buyVipByMemberId
(
buyVipBean
);
MemberDTO
memberDTO
=
this
.
memberOperationService
.
doUpdateVipByMemberCode
(
resources
);
return
ResultInfo
.
success
(
memberDTO
);
}
...
...
@@ -104,27 +70,6 @@ public class MemberOperationController {
MemberProfileDTO
memberProfileDTO
=
this
.
memberOperationService
.
getMemberProfileAndCheckVip
(
memberId
,
appId
);
return
ResultInfo
.
success
(
memberProfileDTO
);
}
@PutMapping
(
"/buyVip"
)
@ApiOperation
(
"购买vip"
)
@AnonymousAccess
@Deprecated
public
ResultInfo
buyVip
(
@RequestBody
BuyVipBean
buyVipBean
)
{
/* // 小程序账户id
Long id = buyVipBean.getId();
if (Objects.isNull(id))
throw new BadRequestException("参数异常: id is null !");
// vip等级
Integer vip = buyVipBean.getVip();
if (Objects.isNull(vip) || vip <= 0)
throw new BadRequestException("vip 等级有误");
MemberDTO memberDTO = this.memberOperationService.buyVip(buyVipBean);
return ResultInfo.success(memberDTO);*/
return
null
;
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/PointsOperationController.java
View file @
2477a35
...
...
@@ -61,23 +61,26 @@ public class PointsOperationController {
@AnonymousAccess
public
ResultInfo
addPoints
(
@Validated
@RequestBody
TempPoints
tempPoints
)
{
log
.
info
(
"手动发放积分,参数 ==>>{} "
,
tempPoints
);
Long
memberId
=
tempPoints
.
getMemberId
();
if
(
Objects
.
isNull
(
memberId
))
{
log
.
error
(
"积分发放失败,参数错误,会员id 不存在"
);
return
ResultInfo
.
failure
(
"积分发放失败,参数错误"
);
}
Long
points
=
tempPoints
.
getPoints
();
if
(
Objects
.
isNull
(
points
)
||
points
<=
0L
)
{
log
.
error
(
"积分发放失败,参数错误,积分不存在或者积分小于0"
);
return
ResultInfo
.
failure
(
"积分发放失败,参数错误"
);
}
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
memberId
);
if
(
Objects
.
nonNull
(
memberDTO
))
{
String
code
=
memberDTO
.
getCode
();
tempPoints
.
setMemberCode
(
code
);
if
(
Objects
.
nonNull
(
memberDTO
.
getId
()))
{
tempPoints
.
setMemberId
(
memberDTO
.
getId
());
tempPoints
.
setMemberCode
(
memberDTO
.
getCode
());
this
.
pointsOperationService
.
grantPointsByManualByTempPoints
(
tempPoints
);
}
return
ResultInfo
.
success
();
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
View file @
2477a35
...
...
@@ -14,6 +14,7 @@ import com.topdraw.business.module.user.iptv.domain.UserTv;
import
com.topdraw.business.module.user.iptv.service.dto.UserTvDTO
;
import
com.topdraw.business.module.user.weixin.domain.UserWeixin
;
import
com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO
;
import
com.topdraw.business.process.domian.member.MemberOperationBean
;
import
com.topdraw.business.process.domian.weixin.*
;
import
com.topdraw.business.process.service.UserOperationService
;
import
com.topdraw.business.process.service.member.MemberOperationService
;
...
...
@@ -89,30 +90,14 @@ public class UserOperationController {
Long
memberId
=
userWeixinDTO
.
getMemberId
();
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
memberId
);
Member
member
=
new
Member
();
member
.
setId
(
memberDTO
.
getId
());
member
.
setCode
(
memberDTO
.
getCode
());
if
(
Objects
.
nonNull
(
vip
))
{
member
.
setVip
(
vip
);
}
if
(
Objects
.
nonNull
(
vipExpireTime
))
{
member
.
setVipExpireTime
(
vipExpireTime
);
}
this
.
memberOperationService
.
doUpdateMemberVipAndVipExpireTime
(
member
);
this
.
createVipHistory
(
userId
,
vip
,
vipExpireTime
);
return
ResultInfo
.
success
();
}
MemberOperationBean
memberOperationBean
=
new
MemberOperationBean
();
memberOperationBean
.
setMemberCode
(
memberDTO
.
getCode
());
memberOperationBean
.
setVip
(
vip
);
memberOperationBean
.
setVipExpireTime
(
vipExpireTime
);
MemberDTO
memberDTO1
=
this
.
memberOperationService
.
doUpdateVipByMemberCode
(
memberOperationBean
);
private
void
createVipHistory
(
Long
weixinUserId
,
Integer
vip
,
Timestamp
vipExpireTime
){
BuyVipBean
buyVipBean
=
new
BuyVipBean
();
buyVipBean
.
setId
(
weixinUserId
);
buyVipBean
.
setVip
(
vip
);
buyVipBean
.
setVipExpireTime
(
vipExpireTime
);
this
.
memberOperationService
.
buyVipByUserId
(
buyVipBean
);
return
ResultInfo
.
success
(
memberDTO1
);
}
@PostMapping
(
value
=
"/createWeixinUserAndCreateMember"
)
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/UserOperationService.java
View file @
2477a35
...
...
@@ -160,10 +160,4 @@ public interface UserOperationService {
*/
UserTvDTO
updateUserTv
(
UserTv
resources
);
/**
* 修改大屏账号vis_user_id
* @param resources
* @return
*/
UserTvDTO
updateUserTvVisUserId
(
UserTv
resources
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/PointsOperationServiceImpl.java
View file @
2477a35
...
...
@@ -90,6 +90,7 @@ public class PointsOperationServiceImpl implements PointsOperationService {
if
(
Objects
.
isNull
(
expireTime
)){
tempPoints
.
setExpireTime
(
TimestampUtil
.
localDateTime2Timestamp
(
DateUtil
.
getLastDateTimeSecondYear
()));
}
this
.
refresh
(
tempPoints
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
2477a35
...
...
@@ -54,7 +54,6 @@ import org.springframework.data.domain.Sort;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Base64Utils
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -95,7 +94,7 @@ public class UserOperationServiceImpl implements UserOperationService {
/** 取消关注 */
private
static
final
Integer
UNSUBSCRIBE_STATUS
=
0
;
private
static
final
Integer
SUBSCRIBE_STATUS
=
1
;
// 服务域 0:电信 1:联通 2:移动 3:其他
private
static
final
Integer
[]
PLATFORM_LIST
=
new
Integer
[]{
0
,
1
,
2
,
3
};
@Value
(
"${uc.app.h5AppId:wxca962918dfeed88c}"
)
...
...
@@ -104,26 +103,6 @@ public class UserOperationServiceImpl implements UserOperationService {
@Value
(
"${uc.app.appletAppid:wxc57d42de3d351cec}"
)
private
String
appletAppid
;
@AsyncMqSend
public
void
asyncMemberAndUserWeixin4Iptv
(
MemberAndWeixinUserDTO
memberAndWeixinUserDTO
)
{}
@AsyncMqSend
public
void
asyncMemberAndUserTv4Iptv
(
MemberAndUserTvDTO
memberAndUserTv
)
{}
@AsyncMqSend
public
void
asyncWeixin
(
UserWeixinDTO
weixinDTO
)
{}
@AsyncMqSend
public
void
asyncUserTv
(
UserTvDTO
userTvDTO
)
{}
@AsyncMqSend
public
void
asyncUserTvChangeMainAccount
(
UserTvDTO
userTvDTO
)
{}
@AsyncMqSend
public
void
asyncAppletBind
(
MemberAndUserTvDTO
memberAndUserTvDTO
)
{}
@AsyncMqSend
public
void
asyncUnbind
(
MemberAndUserTvDTO
memberAndUserTvDTO
)
{}
@AsyncMqSend
public
void
asyncUnsubscribe
(
MemberAndWeixinUserDTO
memberAndWeixinUserDTO
)
{}
@AsyncMqSend
public
void
asyncSubscribe
(
MemberAndWeixinUserDTO
memberAndWeixinUserDTO
)
{}
/**
* 创建大屏账户同时创建会员
*
...
...
@@ -134,8 +113,6 @@ public class UserOperationServiceImpl implements UserOperationService {
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
readOnly
=
true
,
rollbackFor
=
Exception
.
class
)
public
UserTvDTO
createTvUserAndMember
(
UserTv
resources
)
{
boolean
flag
=
true
;
// 大屏账户
String
platformAccount
=
resources
.
getPlatformAccount
();
...
...
@@ -144,10 +121,8 @@ public class UserOperationServiceImpl implements UserOperationService {
// 无账号
if
(
Objects
.
isNull
(
userTvDTO
))
{
String
platformAccountEncode
=
platformAccount
;
if
(
flag
)
{
platformAccountEncode
=
Base64Utils
.
encodeToString
(
platformAccount
.
getBytes
());
}
String
platformAccountEncode
=
Base64Utils
.
encodeToString
(
platformAccount
.
getBytes
());
// x_member
Member
member
=
MemberBuilder
.
build
(
LocalConstants
.
MEMBER_PLATFORM_TYPE_VIS
,
...
...
@@ -204,7 +179,7 @@ public class UserOperationServiceImpl implements UserOperationService {
/**
* 创建小屏账户同时创建会员
* @param resources
* @param resources
微信信息
* @return UserWeixinDTO
*/
@Override
...
...
@@ -239,7 +214,7 @@ public class UserOperationServiceImpl implements UserOperationService {
if
(
Objects
.
nonNull
(
_userWeixinDTO
.
getMemberId
()))
{
// 有其他账号的话,将此账号与对应的会员进行绑定
MemberDTO
memberDTO
=
this
.
findMember
ById
(
_userWeixinDTO
.
getMemberId
());
MemberDTO
memberDTO
=
this
.
memberService
.
find
ById
(
_userWeixinDTO
.
getMemberId
());
userWeixinDTO
.
setMemberId
(
memberDTO
.
getId
());
userWeixinDTO
.
setMemberCode
(
memberDTO
.
getCode
());
if
(
StringUtils
.
isBlank
(
userWeixinDTO
.
getUnionid
()))
{
...
...
@@ -247,17 +222,15 @@ public class UserOperationServiceImpl implements UserOperationService {
}
UserWeixin
userWeixin
=
new
UserWeixin
();
BeanUtils
.
copyProperties
(
userWeixinDTO
,
userWeixin
);
UserWeixinDTO
_userWeixinDTO1
=
this
.
updateWeixin
(
userWeixin
);
return
_userWeixinDTO1
;
return
this
.
updateWeixin
(
userWeixin
);
}
else
{
// 有其他账号但都无会员,新建会员并将此账号绑定新建的这个会员
Member
_member
=
MemberBuilder
.
build
(
LocalConstants
.
MEMBER_PLATFORM_TYPE_WEIXIN
,
Member
member
=
MemberBuilder
.
build
(
LocalConstants
.
MEMBER_PLATFORM_TYPE_WEIXIN
,
headimgurl
,
nickname
,
vip
,
sex
);
MemberDTO
memberDTO
=
this
.
createMember
(
_
member
);
MemberDTO
memberDTO
=
this
.
createMember
(
member
);
if
(
Objects
.
nonNull
(
memberDTO
))
{
userWeixinDTO
.
setMemberId
(
memberDTO
.
getId
());
...
...
@@ -267,8 +240,7 @@ public class UserOperationServiceImpl implements UserOperationService {
}
UserWeixin
userWeixin
=
new
UserWeixin
();
BeanUtils
.
copyProperties
(
userWeixinDTO
,
userWeixin
);
UserWeixinDTO
_userWeixinDTO1
=
this
.
updateWeixin
(
userWeixin
);
return
_userWeixinDTO1
;
return
this
.
updateWeixin
(
userWeixin
);
}
...
...
@@ -277,11 +249,11 @@ public class UserOperationServiceImpl implements UserOperationService {
}
else
{
// 该账号存在但无其他账号,新建会员
Member
_
member
=
Member
member
=
MemberBuilder
.
build
(
LocalConstants
.
MEMBER_PLATFORM_TYPE_WEIXIN
,
headimgurl
,
nickname
,
vip
,
sex
);
MemberDTO
memberDTO
=
this
.
createMember
(
_
member
);
MemberDTO
memberDTO
=
this
.
createMember
(
member
);
if
(
Objects
.
nonNull
(
memberDTO
))
{
userWeixinDTO
.
setMemberId
(
memberDTO
.
getId
());
...
...
@@ -291,8 +263,7 @@ public class UserOperationServiceImpl implements UserOperationService {
}
UserWeixin
userWeixin
=
new
UserWeixin
();
BeanUtils
.
copyProperties
(
userWeixinDTO
,
userWeixin
);
UserWeixinDTO
_userWeixinDTO1
=
this
.
updateWeixin
(
userWeixin
);
return
_userWeixinDTO1
;
return
this
.
updateWeixin
(
userWeixin
);
}
...
...
@@ -374,11 +345,10 @@ public class UserOperationServiceImpl implements UserOperationService {
return
userWeixinDTO
;
}
/**
* 服务号登录
* @param resources
* @return
* @param resources
微信信息
* @return
UserWeixinDTO
*/
@Override
public
UserWeixinDTO
serviceLogin
(
UserWeixin
resources
)
{
...
...
@@ -387,14 +357,13 @@ public class UserOperationServiceImpl implements UserOperationService {
UserWeixinDTO
userWeixinDTO
=
this
.
createWeixinUserAndMember
(
resources
);
// 为了保证返回的同一用户
UserWeixinDTO
userWeixinDTO_0
=
this
.
getFirstId
(
userWeixinDTO
);
return
userWeixinDTO_0
;
return
this
.
getFirstId
(
userWeixinDTO
);
}
/**
* 小程序登录
* @param resources
* @return
* @param resources
微信
* @return
UserWeixinDTO
*/
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRES_NEW
,
readOnly
=
false
,
rollbackFor
=
Exception
.
class
)
...
...
@@ -404,8 +373,7 @@ public class UserOperationServiceImpl implements UserOperationService {
UserWeixinDTO
userWeixinDTO
=
this
.
createWeixinUserAndMember
(
resources
);
// 为了保证返回的同一用户
UserWeixinDTO
userWeixinDTO_0
=
this
.
getFirstId
(
userWeixinDTO
);
return
userWeixinDTO_0
;
return
this
.
getFirstId
(
userWeixinDTO
);
}
/**
...
...
@@ -417,8 +385,8 @@ public class UserOperationServiceImpl implements UserOperationService {
* 2). 大屏账户保存小屏会员的code
* 3). 小屏会员中保存大屏的id
* @description 大小屏绑定,大屏账户保存小屏会员编码
* @param resources
* @return
* @param resources
关注信息
* @return
boolean
*/
@Override
public
boolean
subscribe
(
SubscribeBean
resources
)
{
...
...
@@ -431,13 +399,15 @@ public class UserOperationServiceImpl implements UserOperationService {
// 小屏账户
UserWeixinDTO
userWeixinDTO
=
this
.
userWeixinService
.
findFirstByUnionIdAndAppIdAndOpenId
(
unionId
,
appId
,
openId
);
MemberDTO
memberDTO
=
null
;
MemberDTO
memberDTO
;
if
(
Objects
.
isNull
(
userWeixinDTO
.
getId
())
||
StringUtils
.
isBlank
(
userWeixinDTO
.
getUnionid
())
||
Objects
.
isNull
(
userWeixinDTO
.
getMemberId
()))
{
UserWeixin
userWeixin
=
new
UserWeixin
();
BeanUtils
.
copyProperties
(
resources
,
userWeixin
);
userWeixin
.
setStatus
(
SUBSCRIBE_STATUS
);
userWeixin
.
setNickname
(
nickname
);
userWeixin
.
setHeadimgurl
(
headImgUrl
);
// 创建小屏账户同时创建会员
userWeixinDTO
=
this
.
createWeixinUserAndMember
(
userWeixin
,
1
);
...
...
@@ -502,9 +472,9 @@ public class UserOperationServiceImpl implements UserOperationService {
/**
*
* @param memberDTO
* @param subscribe
* @param sourceInfo
* @param memberDTO
会员
* @param subscribe
关注状态
* @param sourceInfo
来源描述
*/
private
void
saveWechatSubscribeRecord
(
MemberDTO
memberDTO
,
String
sourceInfo
,
int
subscribe
)
{
...
...
@@ -550,8 +520,8 @@ public class UserOperationServiceImpl implements UserOperationService {
/**
* 微信公众号取消关注
* @param resources
* @return
* @param resources
参数
* @return
boolean
*/
@Override
public
boolean
unsubscribe
(
SubscribeBean
resources
)
{
...
...
@@ -607,8 +577,7 @@ public class UserOperationServiceImpl implements UserOperationService {
try
{
if
(
StringUtils
.
isNotBlank
(
headimgurl
))
{
String
headimgurlDecode
=
URLDecoder
.
decode
(
headimgurl
,
"UTF-8"
);
String
image
=
RestTemplateClient
.
netImage
(
headimgurlDecode
);
return
image
;
return
RestTemplateClient
.
netImage
(
headimgurlDecode
);
}
}
catch
(
Exception
e
)
{
log
.
info
(
"头像解析失败!!!"
);
...
...
@@ -620,8 +589,8 @@ public class UserOperationServiceImpl implements UserOperationService {
/**
* 更新大屏信息,同时判断是否已经关注,如果关注了则不跳转H5页面
* @param data
* @return
* @param data
参数
* @return
UserWeixinDTO
*/
@Override
public
UserWeixinDTO
saveUserInfo
(
String
data
)
{
...
...
@@ -631,7 +600,6 @@ public class UserOperationServiceImpl implements UserOperationService {
JSONObject
json
=
JSONObject
.
parseObject
(
data
);
String
unionId
=
json
.
getString
(
"unionid"
);
// 订阅号appid
// String appId = json.getString("dyAppid");
String
appId
=
json
.
getString
(
"appid"
);
try
{
...
...
@@ -661,8 +629,7 @@ public class UserOperationServiceImpl implements UserOperationService {
// 若未传dyAppId。不走下面的流程
if
(
StrUtil
.
isNotBlank
(
appId
))
{
UserWeixinDTO
userWeixinDTO
=
this
.
findUserWeiXinByUnionIdAndAppId
(
unionId
,
appId
);
return
userWeixinDTO
;
return
this
.
findUserWeiXinByUnionIdAndAppId
(
unionId
,
appId
);
}
}
catch
(
Exception
e
)
{
...
...
@@ -674,7 +641,8 @@ public class UserOperationServiceImpl implements UserOperationService {
/**
* 大屏更换主账号
* @param resources
* @param resources 大屏账号信息
* @return boolean
*/
@Override
public
boolean
changeMainAccount
(
UserTv
resources
)
{
...
...
@@ -697,7 +665,6 @@ public class UserOperationServiceImpl implements UserOperationService {
}
// 设置主会员
// UserTvDTO _userTvDTO = this.bondPriorityMember(userTvDTO, memberCode, "manual");
UserTv
userTv
=
new
UserTv
();
userTv
.
setId
(
userTvDTO
.
getId
());
userTv
.
setPriorityMemberCode
(
memberCode
);
...
...
@@ -710,7 +677,8 @@ public class UserOperationServiceImpl implements UserOperationService {
/**
* 大屏解绑
* @param resources
* @param resources 大屏解绑参数
* @return boolean
*/
@Override
public
boolean
tvUnbind
(
TvUnBindBean
resources
)
{
...
...
@@ -1029,25 +997,24 @@ public class UserOperationServiceImpl implements UserOperationService {
memberDTO
.
setPlatformAccount
(
platformAccount
);
// 同步至iptv
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
())
.
async
Applet
Bind
(
new
MemberAndUserTvDTO
(
memberDTO
,
userTvDTO
));
.
async
Mina
Bind
(
new
MemberAndUserTvDTO
(
memberDTO
,
userTvDTO
));
return
true
;
}
/**
*
* @param
memberDTO
* @param platformAccount
* @return
* @param
resource 会员信息
* @param platformAccount
大屏账号
* @return
UserTvDTO
*/
@Override
public
UserTvDTO
bind
(
MemberDTO
memberDTO
,
String
platformAccount
)
{
public
UserTvDTO
bind
(
MemberDTO
resource
,
String
platformAccount
)
{
log
.
info
(
"bind start"
);
MemberDTO
memberDTO1
=
this
.
memberService
.
findByCode
(
memberDTO
.
getCode
());
log
.
info
(
"查询会员信息 ==>> {}"
,
memberDTO1
);
if
(
Objects
.
nonNull
(
memberDTO1
.
getUserIptvId
()))
{
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findById
(
memberDTO1
.
getUserIptvId
());
return
userTvDTO
;
MemberDTO
memberDTO
=
this
.
memberService
.
findByCode
(
resource
.
getCode
());
log
.
info
(
"查询会员信息 ==>> {}"
,
memberDTO
);
if
(
Objects
.
nonNull
(
memberDTO
.
getUserIptvId
()))
{
return
this
.
userTvService
.
findById
(
memberDTO
.
getUserIptvId
());
}
// 大屏账户
...
...
@@ -1057,9 +1024,17 @@ public class UserOperationServiceImpl implements UserOperationService {
throw
new
BadRequestException
(
GlobeExceptionMsg
.
IPTV_IS_NULL
);
}
// mq同步数据时使用
memberDTO
.
setPlatformAccount
(
platformAccount
);
// 大屏是否绑定主账号,如果绑定了主账户则不操作大屏账户表
String
priorityMemberCode
=
userTvDTO
.
getPriorityMemberCode
();
if
(
StringUtils
.
isBlank
(
priorityMemberCode
))
{
UserTv
userTv
=
new
UserTv
();
userTv
.
setId
(
userTvDTO
.
getId
());
userTv
.
setPriorityMemberCode
(
memberDTO
.
getCode
());
userTvDTO
=
this
.
userTvService
.
doUpdatePriorityMemberCode
(
userTv
);
}
Member
member
=
new
Member
();
// 构建小屏会员对象,绑定user_iptv_id字段
String
platform
=
userTvDTO
.
getPlatform
();
// 绑定IPTV平台 0:未知;1:电信;2:移动;3:联通
...
...
@@ -1076,172 +1051,46 @@ public class UserOperationServiceImpl implements UserOperationService {
if
(
UserConstant
.
platform_dx
.
contains
(
platform
))
{
bindIptvPlatformType
=
PLATFORM_LIST
[
1
];
}
member
DTO
.
setUserIptvId
(
userTvDTO
.
getId
());
member
DTO
.
setBindIptvTime
(
TimestampUtil
.
now
());
member
DTO
.
setBindIptvPlatformType
(
bindIptvPlatformType
);
member
DTO
.
setPlatformAccount
(
platformAccount
);
member
.
setUserIptvId
(
userTvDTO
.
getId
());
member
.
setBindIptvTime
(
TimestampUtil
.
now
());
member
.
setBindIptvPlatformType
(
bindIptvPlatformType
);
member
.
setPlatformAccount
(
platformAccount
);
// 大屏是否绑定主账号,如果绑定了主账户则不操作大屏账户表
UserTvDTO
_userTvDTO
=
this
.
bondPriorityMember
(
userTvDTO
,
memberDTO
.
getCode
(),
"auto"
);
if
(
Objects
.
isNull
(
_userTvDTO
))
{
_userTvDTO
=
userTvDTO
;
}
// 修改会员
MemberDTO
_memberDTO
=
this
.
doUpdateMemberByMemberDTO
(
memberDTO
);
_memberDTO
.
setPlatformAccount
(
platformAccount
);
memberDTO
=
this
.
memberService
.
doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime
(
member
);
memberDTO
.
setPlatformAccount
(
platformAccount
);
log
.
info
(
"发送到大屏侧的消息对象 会员信息 ==>> {} || 账号信息 ==>> {}"
,
_memberDTO
,
_
userTvDTO
);
log
.
info
(
"发送到大屏侧的消息对象 会员信息 ==>> {} || 账号信息 ==>> {}"
,
memberDTO
,
userTvDTO
);
// 同步至iptv
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
async
AppletBind
(
new
MemberAndUserTvDTO
(
_memberDTO
,
_
userTvDTO
));
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
async
MinaBind
(
new
MemberAndUserTvDTO
(
memberDTO
,
userTvDTO
));
return
null
;
return
userTvDTO
;
}
/**
*
* @param unionid
* @param appId
* @return
*/
private
UserWeixinDTO
findUserWeiXinByUnionIdAndAppId
(
String
unionid
,
String
appId
)
{
return
this
.
userWeixinService
.
findFirstByUnionidAndAppid
(
unionid
,
appId
);
}
/**
* 修改会员vip状态
*/
private
MemberDTO
doUpdateMemberVip
(
MemberDTO
memberDTO
,
Integer
vip1
)
{
if
(
memberDTO
!=
null
)
{
Integer
vip
=
memberDTO
.
getVip
();
vip
=
(
vip
==
null
?
0
:
vip
);
// 未购买付费会员
if
(
vip
<=
1
)
{
memberDTO
.
setVip
(
vip1
);
Member
member
=
new
Member
();
member
.
setId
(
memberDTO
.
getId
());
member
.
setCode
(
memberDTO
.
getCode
());
member
.
setVipExpireTime
(
null
);
// this.memberService.update(member);
this
.
memberService
.
doUpdateMemberVipAndVipExpireTime
(
member
);
return
memberDTO
;
}
}
return
null
;
}
/**
* 获取小屏会员
* @param userWeixinDTO
* @return
*/
private
MemberDTO
findMemberByUserWeixinDTO
(
UserWeixinDTO
userWeixinDTO
)
{
Long
memberId
=
userWeixinDTO
.
getMemberId
();
if
(
Objects
.
nonNull
(
memberId
))
{
MemberDTO
memberDTO
=
this
.
findMemberById
(
memberId
);
return
memberDTO
;
}
return
null
;
}
/**
* 修改微信公众号关注状态
* @param status 0:取消关注 1:关注
*/
private
UserWeixinDTO
doUpdateUserWeiXinStatus
(
String
appId
,
String
openId
,
Integer
status
)
{
UserWeixinDTO
userWeixinDTO
=
this
.
userWeixinService
.
findFirstByAppIdAndOpenId
(
appId
,
openId
);
if
(
Objects
.
nonNull
(
userWeixinDTO
.
getId
()))
{
UserWeixin
userWeixin
=
new
UserWeixin
();
userWeixin
.
setId
(
userWeixinDTO
.
getId
());
userWeixin
.
setStatus
(
status
);
userWeixinDTO
=
this
.
userWeixinService
.
doUpdateWeixinStatus
(
userWeixin
);
return
userWeixinDTO
;
}
return
userWeixinDTO
;
}
/**
* 修改微信公众号关注状态
* @param status 0:取消关注 1:关注
* @param unionId 身份唯一标识
* @param appId 应用标识
* @return UserWeixinDTO
*/
public
UserWeixinDTO
doUpdateUserWeiXinStatus
(
UserWeixinDTO
userWeixinDTO
,
Integer
status
)
{
userWeixinDTO
.
setStatus
(
status
);
UserWeixin
userWeixin
=
new
UserWeixin
();
BeanUtils
.
copyProperties
(
userWeixinDTO
,
userWeixin
);
this
.
userWeixinService
.
update
(
userWeixin
);
return
userWeixinDTO
;
private
UserWeixinDTO
findUserWeiXinByUnionIdAndAppId
(
String
unionId
,
String
appId
)
{
return
this
.
userWeixinService
.
findFirstByUnionidAndAppid
(
unionId
,
appId
);
}
/**
* 获取会员
* @param memberId
* @return
* @param memberId
会员id
* @return
MemberDTO
*/
private
MemberDTO
findMemberById
(
Long
memberId
)
{
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
memberId
);
return
memberDTO
;
}
/**
* 获取小屏会员
* @param appId
* @param openId
* @return
*/
private
MemberDTO
findMemberByAppIdAndOpenId
(
String
appId
,
String
openId
)
{
UserWeixinDTO
userWeixinDTO
=
this
.
userWeixinService
.
findFirstByAppIdAndOpenId
(
appId
,
openId
);
if
(
Objects
.
nonNull
(
userWeixinDTO
))
{
Long
memberId
=
userWeixinDTO
.
getMemberId
();
return
this
.
findMemberById
(
memberId
);
}
return
null
;
}
/**
* 设置主会员
* @description 检查大屏账户有没有绑定小屏会员,如果没有绑定就将当前会员的code保存到大屏账户中
* @param userTvDTO
* @param memberCode
* @param auto manual:手动 auto:自动
*/
private
UserTvDTO
bondPriorityMember
(
UserTvDTO
userTvDTO
,
String
memberCode
,
String
auto
)
{
if
(
auto
.
equalsIgnoreCase
(
"auto"
))
{
// 主账户
String
priorityMemberCode
=
userTvDTO
.
getPriorityMemberCode
();
if
(
StringUtils
.
isNotEmpty
(
priorityMemberCode
))
{
return
null
;
}
}
userTvDTO
.
setPriorityMemberCode
(
memberCode
);
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
userTvDTO
,
userTv
);
UserTvDTO
_userTvDTO
=
this
.
updateUserTvUnsyncIptv
(
userTv
);
return
_userTvDTO
;
return
this
.
memberService
.
findById
(
memberId
);
}
/**
*
* @param userTv
* @return
* @param userTv
大屏账号
* @return
UserTvDTO
*/
private
UserTvDTO
updateUserTvUnsyncIptv
(
UserTv
userTv
){
return
this
.
userTvService
.
update
(
userTv
);
...
...
@@ -1316,37 +1165,15 @@ public class UserOperationServiceImpl implements UserOperationService {
userTv
.
setPlatform
(
userTvDTO
.
getPlatformAccount
());
userTv
.
setPriorityMemberCode
(
bindMemberCode
);
// 绑定新的主账号
UserTvDTO
_userTvDTO
=
this
.
userTvService
.
doUpdatePriorityMemberCode
(
userTv
);
return
_userTvDTO
;
return
this
.
userTvService
.
doUpdatePriorityMemberCode
(
userTv
);
}
}
/**
* 修改会员
* @param memberDTO
*/
private
MemberDTO
doUpdateMemberByMemberDTO
(
MemberDTO
memberDTO
){
Member
member
=
new
Member
();
BeanUtils
.
copyProperties
(
memberDTO
,
member
);
member
.
setUpdateTime
(
TimestampUtil
.
now
());
log
.
info
(
"doUpdateMemberByMemberDTO=====?>>member ==>> [{}]"
,
member
);
return
this
.
doUpdateMember
(
member
);
}
/**
* 修改会员
* @param member
*/
private
MemberDTO
doUpdateMember
(
Member
member
){
return
this
.
memberService
.
update
(
member
);
}
/**
*
* @param unionId
* @return
* @param unionId
身份标识
* @return
UserWeixinDTO
*/
private
UserWeixinDTO
findFirstByUnionId
(
String
unionId
)
{
return
this
.
userWeixinService
.
findFirstByUnionId
(
unionId
);
...
...
@@ -1355,7 +1182,7 @@ public class UserOperationServiceImpl implements UserOperationService {
/**
* 同一用户有多个微信APP的情况下展示同一个账户信息
* 原则:那个先创建就用那个id
* @param userWeixinDTO
* @param userWeixinDTO
微信信息
*/
private
UserWeixinDTO
getFirstId
(
UserWeixinDTO
userWeixinDTO
)
{
String
unionid
=
userWeixinDTO
.
getUnionid
();
...
...
@@ -1402,9 +1229,9 @@ public class UserOperationServiceImpl implements UserOperationService {
/**
* 获取小屏账户
* @param appId
* @param openId
* @return
* @param appId
应用标识
* @param openId
应用唯一标识
* @return
UserWeixinDTO
*/
private
UserWeixinDTO
findFirstByAppIdAndOpenId
(
String
appId
,
String
openId
)
{
return
this
.
userWeixinService
.
findFirstByAppIdAndOpenId
(
appId
,
openId
);
...
...
@@ -1412,8 +1239,8 @@ public class UserOperationServiceImpl implements UserOperationService {
/**
*
* @param member
* @return
* @param member
会员信息
* @return
MemberDTO
*/
private
MemberDTO
createMember
(
Member
member
){
return
this
.
memberService
.
create
(
member
);
...
...
@@ -1421,53 +1248,49 @@ public class UserOperationServiceImpl implements UserOperationService {
/**
*
* @param resources
* @param memberId
* @return
* @param resources
大屏账号信息
* @param memberId
会员id
* @return
UserTvDTO
*/
private
UserTvDTO
createTvUser
(
UserTv
resources
,
Long
memberId
,
String
memberCode
){
resources
.
setMemberId
(
memberId
);
resources
.
setMemberCode
(
memberCode
);
UserTvDTO
userTvDTO
=
this
.
userTvService
.
create
(
resources
);
return
userTvDTO
;
return
this
.
userTvService
.
create
(
resources
);
}
/**
*
* @param resource
* @param memberId
* @param memberCode
* @return
* @param resource
微信信息
* @param memberId
会员id
* @param memberCode
会员code
* @return
UserWeixinDTO
*/
private
UserWeixinDTO
createWeixinUser
(
UserWeixin
resource
,
Long
memberId
,
String
memberCode
){
if
(
Objects
.
nonNull
(
memberId
))
resource
.
setMemberId
(
memberId
);
if
(
StringUtils
.
isNotBlank
(
memberCode
))
resource
.
setMemberCode
(
memberCode
);
UserWeixinDTO
userWeixinDTO
=
this
.
userWeixinService
.
create
(
resource
);
return
userWeixinDTO
;
return
this
.
userWeixinService
.
create
(
resource
);
}
/**
*
* @param memberDTO
* @return
* @param memberDTO
会员信息
* @return
UserTvDTO
*/
@Override
public
UserTvDTO
checkBind
(
MemberDTO
memberDTO
)
{
MemberDTO
memberDTO1
=
this
.
memberService
.
findByCode
(
memberDTO
.
getCode
());
if
(
Objects
.
nonNull
(
memberDTO1
.
getUserIptvId
()))
{
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findById
(
memberDTO1
.
getUserIptvId
());
return
userTvDTO
;
return
this
.
userTvService
.
findById
(
memberDTO1
.
getUserIptvId
());
}
return
null
;
}
/**
*
* @param platformAccount
* @return
* @param platformAccount
大屏账号
* @return
UserTvDTO
*/
@Override
public
UserTvDTO
findByPlatformAccount
(
String
platformAccount
)
{
...
...
@@ -1495,8 +1318,7 @@ public class UserOperationServiceImpl implements UserOperationService {
return
false
;
}
boolean
b
=
this
.
tvUnbindAndSetNewPriorityMemberCode
(
memberDTO
,
userTvDTO
);
return
b
;
return
this
.
tvUnbindAndSetNewPriorityMemberCode
(
memberDTO
,
userTvDTO
);
}
private
boolean
tvUnbindAndSetNewPriorityMemberCode
(
MemberDTO
memberDTO
,
UserTvDTO
userTvDTO
)
{
...
...
@@ -1559,8 +1381,7 @@ public class UserOperationServiceImpl implements UserOperationService {
@Override
public
UserWeixinDTO
findById
(
Long
userId
)
{
UserWeixinDTO
userWeixinDTO
=
this
.
userWeixinService
.
findById
(
userId
);
return
userWeixinDTO
;
return
this
.
userWeixinService
.
findById
(
userId
);
}
@Override
...
...
@@ -1580,7 +1401,7 @@ public class UserOperationServiceImpl implements UserOperationService {
Long
memberId
=
userTvDTO
.
getMemberId
();
if
(
Objects
.
nonNull
(
memberId
))
{
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
memberId
);
resources
.
setMemberCode
(
memberDTO
.
getCode
());
userTvDTO
.
setMemberCode
(
memberDTO
.
getCode
());
}
// 同步至iptv
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncUserTv
(
userTvDTO
);
...
...
@@ -1588,19 +1409,24 @@ public class UserOperationServiceImpl implements UserOperationService {
}
@Override
public
UserTvDTO
updateUserTvVisUserId
(
UserTv
resources
)
{
UserTvDTO
userTvDTO
=
this
.
userTvService
.
update
(
resources
);
Long
memberId
=
userTvDTO
.
getMemberId
();
if
(
Objects
.
nonNull
(
memberId
))
{
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
memberId
);
resources
.
setMemberCode
(
memberDTO
.
getCode
());
}
@AsyncMqSend
public
void
asyncMemberAndUserWeixin4Iptv
(
MemberAndWeixinUserDTO
memberAndWeixinUserDTO
)
{}
@AsyncMqSend
public
void
asyncMemberAndUserTv4Iptv
(
MemberAndUserTvDTO
memberAndUserTv
)
{}
@AsyncMqSend
public
void
asyncWeixin
(
UserWeixinDTO
weixinDTO
)
{}
@AsyncMqSend
public
void
asyncUserTv
(
UserTvDTO
userTvDTO
)
{}
@AsyncMqSend
public
void
asyncUserTvChangeMainAccount
(
UserTvDTO
userTvDTO
)
{}
@AsyncMqSend
public
void
asyncMinaBind
(
MemberAndUserTvDTO
memberAndUserTvDTO
)
{}
@AsyncMqSend
public
void
asyncUnbind
(
MemberAndUserTvDTO
memberAndUserTvDTO
)
{}
@AsyncMqSend
public
void
asyncUnsubscribe
(
MemberAndWeixinUserDTO
memberAndWeixinUserDTO
)
{}
@AsyncMqSend
public
void
asyncSubscribe
(
MemberAndWeixinUserDTO
memberAndWeixinUserDTO
)
{}
// 同步至iptv
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncUserTv
(
userTvDTO
);
return
userTvDTO
;
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/member/MemberOperationServiceImpl.java
View file @
2477a35
...
...
@@ -9,13 +9,12 @@ import com.topdraw.business.module.member.service.MemberService;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
import
com.topdraw.business.module.member.viphistory.domain.MemberVipHistory
;
import
com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService
;
import
com.topdraw.business.module.
user.weixin.domain.UserWeixin
;
import
com.topdraw.business.module.
member.viphistory.service.dto.MemberVipHistoryDTO
;
import
com.topdraw.business.module.user.weixin.service.UserWeixinService
;
import
com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO
;
import
com.topdraw.business.process.domian.
weixin.BuyVip
Bean
;
import
com.topdraw.business.process.domian.
member.MemberOperation
Bean
;
import
com.topdraw.business.process.service.member.MemberOperationService
;
import
com.topdraw.config.RedisKeyConstants
;
import
com.topdraw.exception.EntityNotFoundException
;
import
com.topdraw.util.TimestampUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.aop.framework.AopContext
;
...
...
@@ -27,7 +26,6 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.Assert
;
import
java.sql.Timestamp
;
import
java.time.LocalDateTime
;
import
java.util.Objects
;
@Service
...
...
@@ -45,81 +43,17 @@ public class MemberOperationServiceImpl implements MemberOperationService {
@Autowired
private
MemberVipHistoryService
memberVipHistoryService
;
@AsyncMqSend
public
void
asyncUpdateMemberVip
(
MemberDTO
memberDTO
)
{}
@Override
public
MemberDTO
buyVipByUserId
(
BuyVipBean
resources
)
{
// 小程序账户id
Long
id
=
resources
.
getId
();
// 查询微信账户
UserWeixinDTO
userWeixin
=
this
.
findWeiXinById
(
id
);
Long
memberId
=
userWeixin
.
getMemberId
();
resources
.
setMemberId
(
memberId
);
return
this
.
buyVipByMemberId
(
resources
);
}
@Override
public
MemberDTO
buyVipByMemberId
(
BuyVipBean
resources
)
{
Timestamp
vipExpireTime1
=
resources
.
getVipExpireTime
();
Integer
vip1
=
resources
.
getVip
();
Long
memberId
=
resources
.
getMemberId
();
//
MemberDTO
memberDTO
=
this
.
findById
(
memberId
);
String
memberCode
=
memberDTO
.
getCode
();
Integer
vip
=
memberDTO
.
getVip
();
//
Timestamp
vipExpireTime
=
memberDTO
.
getVipExpireTime
();
if
(
Objects
.
nonNull
(
vipExpireTime1
))
{
vipExpireTime
=
vipExpireTime1
;
}
//判断之前有没有买过,没买过,失效时间为一年后;
if
(
Objects
.
isNull
(
vipExpireTime1
))
{
if
(
ObjectUtil
.
isNull
(
vipExpireTime
))
{
LocalDateTime
now
=
LocalDateTime
.
now
();
vipExpireTime
=
TimestampUtil
.
localDateTime2Timestamp
(
now
.
plusYears
(
1L
));
}
else
{
LocalDateTime
localDateTime
=
TimestampUtil
.
timestamp2LocalDateTime
(
vipExpireTime
).
plusYears
(
1L
);
vipExpireTime
=
TimestampUtil
.
localDateTime2Timestamp
(
localDateTime
);
}
}
Member
member
=
new
Member
();
member
.
setVip
(
vip1
);
member
.
setVipExpireTime
(
vipExpireTime
);
this
.
doUpdateMemberVipAndVipExpireTime
(
member
);
public
void
asyncUpdateMemberVipAndVipExpireTime
(
MemberDTO
memberDTO
)
{}
MemberVipHistory
memberVipHistory
=
new
MemberVipHistory
();
memberVipHistory
.
setMemberId
(
memberId
).
setVip
(
vip1
).
setBeforeVip
(
vip
);
if
(
ObjectUtil
.
equal
(
vip1
,
vip
))
{
memberVipHistory
.
setStatus
(
1
);
}
memberVipHistory
.
setMemberCode
(
memberCode
);
memberVipHistory
.
setVipExpireTime
(
member
.
getVipExpireTime
());
this
.
createVipHistory
(
memberVipHistory
);
@AsyncMqSend
public
void
asyncCreateMemberVipHistory
(
MemberVipHistoryDTO
memberVipHistoryDTO
)
{}
return
memberDTO
;
}
@Override
public
void
createVipHistory
(
MemberVipHistory
memberVipHistory
){
this
.
memberVipHistoryService
.
create
(
memberVipHistory
);
}
@AsyncMqSend
@Override
public
MemberDTO
update
(
Member
resources
)
{
MemberDTO
memberDTO
=
this
.
memberService
.
update
(
resources
);
return
memberDTO
;
return
this
.
memberService
.
update
(
resources
);
}
@Override
...
...
@@ -127,22 +61,6 @@ public class MemberOperationServiceImpl implements MemberOperationService {
return
this
.
memberService
.
findByCode
(
code
);
}
private
UserWeixinDTO
findWeiXinById
(
Long
id
)
{
UserWeixinDTO
userWeixinDTO
=
this
.
userWeixinService
.
findById
(
id
);
if
(
Objects
.
isNull
(
userWeixinDTO
))
{
throw
new
EntityNotFoundException
(
UserWeixin
.
class
,
"id"
,
userWeixinDTO
.
getId
().
toString
());
}
return
userWeixinDTO
;
}
@Override
public
MemberDTO
doUpdateMember
(
Member
resources
)
{
Long
id
=
resources
.
getId
();
Assert
.
notNull
(
id
,
"ERROR MSG: MemberOperationServiceImpl -> doUpdateMemberInfo -> id not be null!!"
);
return
this
.
update
(
resources
);
}
@Override
public
MemberDTO
doInsertMember
(
Member
resources
)
{
return
this
.
memberService
.
create
(
resources
);
...
...
@@ -159,7 +77,6 @@ public class MemberOperationServiceImpl implements MemberOperationService {
return
this
.
memberService
.
doUpdateMemberExpAndLevel
(
resources
);
}
@Override
public
MemberDTO
doUpdateMemberPoints
(
Member
resources
)
{
return
this
.
memberService
.
doUpdateMemberPoints
(
resources
);
...
...
@@ -174,23 +91,56 @@ public class MemberOperationServiceImpl implements MemberOperationService {
@Override
// @CachePut(cacheNames = RedisKeyConstants.cacheMemberById, key = "#member.id")
public
MemberDTO
doUpdateMemberVipAndVipExpireTime
(
Member
member
)
{
MemberDTO
memberDTO1
=
this
.
memberService
.
findByCode
(
member
.
getCode
());
public
MemberDTO
doUpdateMemberVipAndVipExpireTime
(
Member
resource
)
{
MemberDTO
memberDTO1
=
this
.
memberService
.
findByCode
(
resource
.
getCode
());
Member
member
1
=
new
Member
();
member
1
.
setId
(
memberDTO1
.
getId
());
member
1
.
setCode
(
memberDTO1
.
getCode
());
member
1
.
setVip
(
member
.
getVip
());
member
1
.
setVipExpireTime
(
member
.
getVipExpireTime
());
MemberDTO
memberDTO
_
=
this
.
memberService
.
doUpdateMemberVipAndVipExpireTime
(
member1
);
Member
member
=
new
Member
();
member
.
setId
(
memberDTO1
.
getId
());
member
.
setCode
(
memberDTO1
.
getCode
());
member
.
setVip
(
resource
.
getVip
());
member
.
setVipExpireTime
(
resource
.
getVipExpireTime
());
MemberDTO
memberDTO
=
this
.
memberService
.
doUpdateMemberVipAndVipExpireTime
(
member
);
((
MemberOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncUpdateMemberVip
(
memberDTO_
);
((
MemberOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncUpdateMemberVipAndVipExpireTime
(
memberDTO
);
return
memberDTO
;
}
@Override
public
MemberDTO
doUpdateVipByMemberCode
(
MemberOperationBean
resources
)
{
Integer
nowVip
=
resources
.
getVip
();
Long
memberId
=
resources
.
getMemberId
();
Timestamp
vipExpireTime
=
resources
.
getVipExpireTime
();
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
memberId
);
String
memberCode
=
memberDTO
.
getCode
();
Integer
vip
=
memberDTO
.
getVip
();
Member
member
=
new
Member
();
member
.
setId
(
memberDTO
.
getId
());
member
.
setCode
(
memberCode
);
member
.
setVip
(
vip
);
member
.
setVipExpireTime
(
vipExpireTime
);
MemberDTO
memberDTO_
=
this
.
memberService
.
doUpdateMemberVipAndVipExpireTime
(
member
);
((
MemberOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncUpdateMemberVipAndVipExpireTime
(
memberDTO_
);
MemberVipHistory
memberVipHistory
=
new
MemberVipHistory
();
memberVipHistory
.
setMemberId
(
memberId
).
setVip
(
nowVip
).
setBeforeVip
(
vip
);
memberVipHistory
.
setMemberCode
(
memberCode
);
memberVipHistory
.
setVipExpireTime
(
vipExpireTime
);
MemberVipHistoryDTO
memberVipHistoryDTO
=
this
.
memberVipHistoryService
.
create
(
memberVipHistory
);
((
MemberOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncCreateMemberVipHistory
(
memberVipHistoryDTO
);
return
memberDTO_
;
}
@Override
public
MemberProfileDTO
getMemberProfileAndCheckVip
(
Long
memberId
,
String
app
i
d
)
{
public
MemberProfileDTO
getMemberProfileAndCheckVip
(
Long
memberId
,
String
app
I
d
)
{
// 会员加密信息
MemberProfileDTO
memberProfileDTO_0
=
this
.
findMemberProfileByMemberId
(
memberId
);
...
...
@@ -199,13 +149,11 @@ public class MemberOperationServiceImpl implements MemberOperationService {
MemberDTO
memberDTO
=
this
.
findById
(
memberId
);
// 初始化会员加密信息
MemberProfileDTO
memberProfileDTO_1
=
this
.
configMemberProfile
(
memberProfileDTO_0
,
memberDTO
,
appid
);
return
memberProfileDTO_1
;
return
this
.
configMemberProfile
(
memberProfileDTO_0
,
memberDTO
,
appId
);
}
private
MemberProfileDTO
configMemberProfile
(
MemberProfileDTO
memberProfileDTO_0
,
MemberDTO
memberDTO
,
String
app
i
d
)
{
private
MemberProfileDTO
configMemberProfile
(
MemberProfileDTO
memberProfileDTO_0
,
MemberDTO
memberDTO
,
String
app
I
d
)
{
if
(
Objects
.
isNull
(
memberProfileDTO_0
))
return
memberProfileDTO_0
;
...
...
@@ -217,11 +165,11 @@ public class MemberOperationServiceImpl implements MemberOperationService {
// 过期时间
Timestamp
vipExpireTime
=
memberDTO
.
getVipExpireTime
();
L
ong
timeLong
=
0L
;
l
ong
timeLong
=
0L
;
if
(
ObjectUtil
.
isNotNull
(
vipExpireTime
))
{
// 检查vip
MemberDTO
memberDTO1
=
this
.
checkVipStatus
(
memberDTO
,
vipExpireTime
,
appi
d
);
MemberDTO
memberDTO1
=
this
.
checkVipStatus
(
memberDTO
,
vipExpireTime
,
appI
d
);
// 更新会员信息
Member
member
=
new
Member
();
...
...
@@ -259,10 +207,10 @@ public class MemberOperationServiceImpl implements MemberOperationService {
* 1.当前vip如果过期则查看是否有vip历史变动
* 2.如果vip变动历史有记录则获取vip变动记录
* 3.如果vip没有记录则查看是否关注了公众号
* @param vipExpireTime
* @return
* @param vipExpireTime
过期时间
* @return
MemberDTO
*/
private
MemberDTO
checkVipStatus
(
MemberDTO
memberDTO
,
Timestamp
vipExpireTime
,
String
app
i
d
)
{
private
MemberDTO
checkVipStatus
(
MemberDTO
memberDTO
,
Timestamp
vipExpireTime
,
String
app
I
d
)
{
Long
memberId
=
memberDTO
.
getId
();
Timestamp
nowTime
=
TimestampUtil
.
now
();
...
...
@@ -271,16 +219,16 @@ public class MemberOperationServiceImpl implements MemberOperationService {
if
(
nowTime
.
compareTo
(
vipExpireTime
)
>=
0
)
{
Integer
vip
=
0
;
Timestamp
vipExpireTime1
=
memberDTO
.
getVipExpireTime
()
;
Timestamp
vipExpireTime1
;
//查询小于失效时间的那条记录 查不到 取微信表里 关注状态
MemberVipHistory
memberVipHistory
=
this
.
memberVipHistoryService
.
findByTime
(
memberId
,
nowTime
);
if
(
ObjectUtil
.
isNull
(
memberVipHistory
.
getId
()))
{
UserWeixinDTO
userWei
xin
=
this
.
userWeixinService
.
findFirstByMemberIdAndAppid
(
memberId
,
appi
d
);
UserWeixinDTO
userWei
Xin
=
this
.
userWeixinService
.
findFirstByMemberIdAndAppid
(
memberId
,
appI
d
);
// 微信公众号关注的状态 0:未关注 1:关注
Integer
status
=
userWei
x
in
.
getStatus
();
Integer
status
=
userWei
X
in
.
getStatus
();
if
(
status
!=
1
)
vip
=
0
;
else
vip
=
1
;
vipExpireTime1
=
null
;
...
...
@@ -300,8 +248,8 @@ public class MemberOperationServiceImpl implements MemberOperationService {
/**
* 查询会员加密信息
* @param memberId
* @return
* @param memberId
会员id
* @return
MemberProfileDTO
*/
private
MemberProfileDTO
findMemberProfileByMemberId
(
Long
memberId
)
{
return
this
.
memberProfileService
.
findByMemberId
(
memberId
);
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/member/MemberProfileOperationServiceImpl.java
View file @
2477a35
...
...
@@ -11,13 +11,11 @@ import com.topdraw.business.process.service.dto.MemberProfileAndMemberDTO;
import
com.topdraw.business.process.service.member.MemberProfileOperationService
;
import
com.topdraw.exception.EntityExistException
;
import
com.topdraw.exception.EntityNotFoundException
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.aop.framework.AopContext
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.validation.constraints.NotNull
;
import
java.util.Objects
;
...
...
@@ -39,25 +37,16 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation
private
MemberService
memberService
;
@AsyncMqSend
public
void
async
MemberProfile
(
MemberProfileDTO
memberProfile
DTO
){}
public
void
async
UpdateMemberProfileAndSyncMember
(
MemberProfileAndMemberDTO
memberProfileAndMember
DTO
){}
@AsyncMqSend
public
void
asyncMemberProfileAndMember
(
MemberProfileAndMemberDTO
memberProfileAndMemberDTO
){}
@AsyncMqSend
public
void
asyncCreateMemberProfile
(
MemberProfileDTO
memberProfileDTO
)
{}
@Override
public
MemberProfileDTO
update
(
MemberProfile
resources
)
{
MemberProfileDTO
memberProfileDTO
=
this
.
memberProfileService
.
update
(
resources
);
memberProfileDTO
.
setMemberCode
(
resources
.
getMemberCode
());
((
MemberProfileOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncMemberProfile
(
memberProfileDTO
);
return
memberProfileDTO
;
}
public
void
asyncCreateMemberProfileAndSyncMember
(
MemberProfileDTO
memberProfileDTO
)
{}
@Override
public
MemberProfileDTO
updateMemberProfileAndMember
(
MemberProfile
resources
)
{
Long
id
=
resources
.
getId
();
MemberProfileDTO
_memberProfile
=
this
.
memberProfileService
.
findById
(
id
);
Long
memberId
=
_memberProfile
.
getMemberId
();
MemberProfileDTO
memberProfile
=
this
.
memberProfileService
.
findById
(
id
);
Long
memberId
=
memberProfile
.
getMemberId
();
resources
.
setMemberId
(
memberId
);
MemberDTO
memberDTO
=
this
.
memberService
.
checkMember
(
resources
.
getMemberId
(),
resources
.
getMemberCode
());
...
...
@@ -68,7 +57,7 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation
memberProfileDTO
.
setMemberCode
(
memberDTO
.
getCode
());
((
MemberProfileOperationServiceImpl
)
AopContext
.
currentProxy
())
.
async
MemberProfileAnd
Member
(
new
MemberProfileAndMemberDTO
(
memberProfileDTO
,
memberDTO
));
.
async
UpdateMemberProfileAndSync
Member
(
new
MemberProfileAndMemberDTO
(
memberProfileDTO
,
memberDTO
));
return
memberProfileDTO
;
}
...
...
@@ -88,7 +77,7 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation
this
.
createMemberProfileAndSyncMember
(
memberProfileDTO
,
memberDTO
);
((
MemberProfileOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncCreateMemberProfile
(
memberProfileDTO
);
((
MemberProfileOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncCreateMemberProfile
AndSyncMember
(
memberProfileDTO
);
}
else
{
...
...
@@ -112,13 +101,11 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation
private
void
syncMember
(
MemberProfileDTO
memberProfileDTO
,
MemberDTO
memberDTO
)
{
Member
member
=
new
Member
();
member
.
setId
(
memberDTO
.
getId
());
member
.
setCode
(
memberDTO
.
getCode
());
member
.
setAvatarUrl
(
memberProfileDTO
.
getAvatarUrl
());
member
.
setNickname
(
memberProfileDTO
.
getRealname
());
member
.
setGender
(
memberProfileDTO
.
getGender
());
// this.memberService.update(member);
this
.
memberService
.
doUpdateMemberAvatarUrlAndNicknameAndGender
(
member
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/member/MemberOperationService.java
View file @
2477a35
...
...
@@ -4,6 +4,7 @@ import com.topdraw.business.module.member.domain.Member;
import
com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO
;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
import
com.topdraw.business.module.member.viphistory.domain.MemberVipHistory
;
import
com.topdraw.business.process.domian.member.MemberOperationBean
;
import
com.topdraw.business.process.domian.weixin.BuyVipBean
;
public
interface
MemberOperationService
{
...
...
@@ -31,26 +32,6 @@ public interface MemberOperationService {
MemberProfileDTO
getMemberProfileAndCheckVip
(
Long
memberId
,
String
appid
);
/**
*
* @param resources
* @return
*/
MemberDTO
buyVipByUserId
(
BuyVipBean
resources
);
/**
*
* @param resources
* @return
*/
MemberDTO
buyVipByMemberId
(
BuyVipBean
resources
);
/**
*
* @param memberVipHistory
*/
void
createVipHistory
(
MemberVipHistory
memberVipHistory
);
/**
* 修改会员
* @param resources
*/
...
...
@@ -60,12 +41,6 @@ public interface MemberOperationService {
*
* @param resources
*/
MemberDTO
doUpdateMember
(
Member
resources
);
/**
*
* @param resources
*/
MemberDTO
doInsertMember
(
Member
resources
);
/**
...
...
@@ -91,4 +66,10 @@ public interface MemberOperationService {
* @param member
*/
MemberDTO
doUpdateMemberVipAndVipExpireTime
(
Member
member
);
/**
*
* @param resources
*/
MemberDTO
doUpdateVipByMemberCode
(
MemberOperationBean
resources
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/member/MemberProfileOperationService.java
View file @
2477a35
...
...
@@ -6,12 +6,6 @@ import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
public
interface
MemberProfileOperationService
{
/**
* 修改
* @param resources
*/
MemberProfileDTO
update
(
MemberProfile
resources
);
/**
* 修改会员属性并同步会员信息
* @param resources
*/
...
...
member-service-impl/src/main/java/com/topdraw/config/RedisKeyConstants.java
0 → 100644
View file @
2477a35
package
com
.
topdraw
.
config
;
/**
* @author :
* @description:\
* @function :
* @date :Created in 2022/6/18 13:25
* @version: :
* @modified By:
* @since : modified in 2022/6/18 13:25
*/
public
interface
RedisKeyConstants
{
String
cacheMemberById
=
"uce::member::id"
;
String
updateCacheMemberById
=
"uce::updateMember::id"
;
String
updateCachePointsByMemberId
=
"uce::updatePoints::memberId"
;
String
updateCacheExpByMemberId
=
"uce::updateExp::memberId"
;
String
updateCacheCouponByMemberId
=
"uce::updateCoupon::memberId"
;
String
cacheUserTvByPlatformAccount
=
"uce::userTv::platformAccount"
;
String
cacheTaskProcessByMemberId
=
"uce::taskProcess::memberId"
;
String
cacheTaskByTaskTemplateId
=
"uce::task::taskTemplateId"
;
}
member-service-impl/src/main/java/com/topdraw/config/UceRedisConfig.java
0 → 100644
View file @
2477a35
package
com
.
topdraw
.
config
;
import
com.fasterxml.jackson.annotation.JsonAutoDetect
;
import
com.fasterxml.jackson.annotation.PropertyAccessor
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CachingConfigurerSupport
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.data.redis.cache.RedisCacheConfiguration
;
import
org.springframework.data.redis.cache.RedisCacheManager
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer
;
import
java.time.Duration
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/6/19 16:30
* @version: :
* @modified By:
* @since : modified in 2022/6/19 16:30
*/
@Slf4j
@Configuration
public
class
UceRedisConfig
{
@Autowired
private
RedisConfig
redisConfig
;
@Autowired
private
RedisConnectionFactory
redisConnectionFactory
;
@Bean
(
value
=
"uceRedisTemplate"
)
public
RedisTemplate
<
Object
,
Object
>
uceRedisTemplate
()
{
return
redisConfig
.
redisTemplate
(
redisConnectionFactory
);
}
/**
* 自定义缓存管理器
*/
@Bean
(
value
=
"uceCacheManagemer"
)
@Primary
public
RedisCacheManager
cacheManager
(
RedisConnectionFactory
factory
)
{
RedisCacheConfiguration
config
=
RedisCacheConfiguration
.
defaultCacheConfig
();
Set
<
String
>
cacheNames
=
new
HashSet
<>();
// cacheNames.add("car");
// cacheNames.add(RedisKeyConstants.cacheTaskByEvent);
cacheNames
.
add
(
RedisKeyConstants
.
cacheTaskProcessByMemberId
);
ConcurrentHashMap
<
String
,
RedisCacheConfiguration
>
configMap
=
new
ConcurrentHashMap
<>();
// configMap.put("car", config.entryTtl(Duration.ofMinutes(6L)));
configMap
.
put
(
RedisKeyConstants
.
cacheTaskProcessByMemberId
,
config
.
entryTtl
(
Duration
.
ofDays
(
1
)));
// configMap.put(RedisKeyConstants.cacheTaskByEvent, config);
//需要先初始化缓存名称,再初始化其它的配置。
RedisCacheManager
cacheManager
=
RedisCacheManager
.
builder
(
factory
).
initialCacheNames
(
cacheNames
).
withInitialCacheConfigurations
(
configMap
).
build
();
return
cacheManager
;
}
}
member-service-impl/src/test/java/com/topdraw/test/business/process/service/MemberOperationServiceTest.java
View file @
2477a35
...
...
@@ -23,35 +23,6 @@ public class MemberOperationServiceTest extends BaseTest {
}
@Test
public
void
doUpdateMemberInfo
()
{
Member
member
=
new
Member
();
member
.
setId
(
2L
);
member
.
setCode
(
String
.
valueOf
(
IdWorker
.
generator
()));
member
.
setType
(
1
);
member
.
setStatus
(
1
);
member
.
setNickname
(
"nickname"
);
member
.
setDescription
(
"description"
);
member
.
setGender
(
1
);
member
.
setBirthday
(
"birthday"
);
member
.
setAvatarUrl
(
"avatarUrl"
);
member
.
setGroups
(
"groups"
);
member
.
setTags
(
"tags"
);
member
.
setVip
(
1
);
member
.
setLevel
(
1
);
member
.
setExp
(
10L
);
member
.
setPoints
(
5L
);
member
.
setDuePoints
(
0L
);
member
.
setCouponAmount
(
1L
);
member
.
setDueCouponAmount
(
0L
);
member
.
setUserIptvId
(
1L
);
member
.
setBindIptvPlatformType
(
0
);
member
.
setUpdateTime
(
TimestampUtil
.
now
());
String
s
=
JSONObject
.
toJSONString
(
member
);
this
.
memberOperationService
.
doUpdateMember
(
member
);
}
@Test
public
void
doInsertMember
()
{
Member
member
=
new
Member
();
member
.
setCode
(
String
.
valueOf
(
IdWorker
.
generator
()));
...
...
Please
register
or
sign in
to post a comment