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
48a55ab0
...
48a55ab08a13d6540236ffde94d78d89c3138b76
authored
2022-01-27 16:49:18 +0800
by
xianghan@topdraw.cn
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.修改部分保存逻辑
1 parent
2ae7fe6d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
119 additions
and
56 deletions
member-service-impl/src/main/java/com/topdraw/MemberServiceApplication.java
member-service-impl/src/main/java/com/topdraw/business/module/member/relatedinfo/rest/MemberRelatedInfoController.java
member-service-impl/src/main/java/com/topdraw/business/process/domian/weixin/BuyVipBean.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/UserOperationController.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/MemberOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
member-service-impl/src/main/resources/config/application-dev.yml
member-service-impl/src/main/java/com/topdraw/MemberServiceApplication.java
View file @
48a55ab
...
...
@@ -2,6 +2,7 @@ package com.topdraw;
import
com.topdraw.utils.SpringContextHolder
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
...
...
@@ -20,10 +21,10 @@ import org.springframework.web.bind.annotation.CrossOrigin;
*/
@EnableJpaAuditing
@EnableAsync
@SpringBootApplication
(
exclude
=
{
SecurityAutoConfiguration
.
class
})
@EnableTransactionManagement
@EnableRetry
@EnableCaching
@SpringBootApplication
(
exclude
=
{
SecurityAutoConfiguration
.
class
})
public
class
MemberServiceApplication
extends
SpringBootServletInitializer
{
public
static
void
main
(
String
[]
args
)
{
...
...
@@ -40,3 +41,5 @@ public class MemberServiceApplication extends SpringBootServletInitializer {
return
new
SpringContextHolder
();
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/relatedinfo/rest/MemberRelatedInfoController.java
View file @
48a55ab
...
...
@@ -28,7 +28,7 @@ import java.util.Objects;
@Slf4j
@Api
(
tags
=
"MemberRelatedInfo管理"
)
@RestController
@RequestMapping
(
"/ucEngine/api/memberRelatedInfo
Controller
"
)
@RequestMapping
(
"/ucEngine/api/memberRelatedInfo"
)
@CrossOrigin
public
class
MemberRelatedInfoController
{
...
...
@@ -46,6 +46,7 @@ public class MemberRelatedInfoController {
@Log
@PostMapping
(
value
=
"/create"
)
@ApiOperation
(
"新增MemberRelatedInfo"
)
@AnonymousAccess
public
ResultInfo
create
(
@Validated
@RequestBody
MemberRelatedInfo
resources
)
{
MemberRelatedInfoService
.
create
(
resources
);
return
ResultInfo
.
success
();
...
...
@@ -86,6 +87,7 @@ public class MemberRelatedInfoController {
@Log
@DeleteMapping
(
value
=
"/delete/{id}"
)
@ApiOperation
(
"删除MemberRelatedInfo"
)
@AnonymousAccess
public
ResultInfo
delete
(
@PathVariable
Long
id
)
{
MemberRelatedInfoService
.
delete
(
id
);
return
ResultInfo
.
success
();
...
...
member-service-impl/src/main/java/com/topdraw/business/process/domian/weixin/BuyVipBean.java
View file @
48a55ab
...
...
@@ -12,4 +12,6 @@ import lombok.Data;
public
class
BuyVipBean
extends
WeiXinUserBean
{
private
Integer
vip
;
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/MemberOperationController.java
View file @
48a55ab
package
com
.
topdraw
.
business
.
process
.
rest
;
import
com.topdraw.annotation.AnonymousAccess
;
import
com.topdraw.annotation.Log
;
import
com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO
;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
import
com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria
;
import
com.topdraw.business.process.domian.weixin.BuyVipBean
;
import
com.topdraw.business.process.domian.weixin.WeiXinUserBean
;
...
...
@@ -15,15 +17,16 @@ import org.springframework.web.bind.annotation.*;
@Api
(
"会员处理"
)
@RestController
@RequestMapping
(
value
=
"/ucEngine/api/memberOperation
Controller
"
)
@RequestMapping
(
value
=
"/ucEngine/api/memberOperation"
)
public
class
MemberOperationController
{
@Autowired
private
MemberOperationService
memberOperationService
;
@Log
(
"获取会员
加密
信息并且检查vip状态"
)
@Log
(
"获取会员
基本
信息并且检查vip状态"
)
@GetMapping
(
"/getMemberProfileAndCheckVip/{appId}/{memberId}"
)
@ApiOperation
(
"获取会员加密信息并且检查vip状态"
)
@ApiOperation
(
"获取会员基本信息并且检查vip状态"
)
@AnonymousAccess
public
IResultInfo
getMemberProfileAndCheckVip
(
@PathVariable
(
value
=
"appId"
)
String
appId
,
@PathVariable
(
value
=
"memberId"
)
Long
memberId
)
{
MemberProfileDTO
memberProfileDTO
=
this
.
memberOperationService
.
getMemberProfileAndCheckVip
(
memberId
,
appId
);
return
ResultInfo
.
success
(
memberProfileDTO
);
...
...
@@ -32,9 +35,10 @@ public class MemberOperationController {
@Log
(
"购买vip"
)
@PutMapping
(
"/buyVip"
)
@ApiOperation
(
"购买vip"
)
@AnonymousAccess
public
ResultInfo
buyVip
(
@RequestBody
BuyVipBean
buyVipBean
)
{
memberOperationService
.
buyVip
(
buyVipBean
);
return
ResultInfo
.
success
();
MemberDTO
memberDTO
=
memberOperationService
.
buyVip
(
buyVipBean
);
return
ResultInfo
.
success
(
memberDTO
);
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
View file @
48a55ab
...
...
@@ -51,6 +51,17 @@ public class UserOperationController {
@Autowired
private
RedisUtils
redisUtils
;
@Log
(
"新增大屏账户同时创建会员信息"
)
@PostMapping
(
value
=
"/createUserAndCreateMember"
)
@ApiOperation
(
"新增大屏账户同时创建会员信息"
)
@AnonymousAccess
public
ResultInfo
createUserAndCreateMember
(
@Validated
@RequestBody
TempIptvUser
resources
)
{
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
resources
,
userTv
);
boolean
result
=
this
.
userTvOperationService
.
createMemberByUserTv
(
userTv
);
return
ResultInfo
.
success
(
result
);
}
@Log
(
"获取大屏绑定的小屏会员列表"
)
@GetMapping
(
value
=
"/findBindByPlatformAccount/{platformAccount}"
)
@AnonymousAccess
...
...
@@ -100,16 +111,7 @@ public class UserOperationController {
return
ResultInfo
.
success
(
result
);
}
@Log
(
"新增大屏账户同时创建会员信息"
)
@PostMapping
(
value
=
"/createUserAndCreateMember"
)
@ApiOperation
(
"新增大屏账户同时创建会员信息"
)
@AnonymousAccess
public
ResultInfo
createUserAndCreateMember
(
@Validated
@RequestBody
TempIptvUser
resources
)
{
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
resources
,
userTv
);
this
.
userTvOperationService
.
createMemberByUserTv
(
userTv
);
return
ResultInfo
.
success
();
}
@Log
(
"大屏用户解绑"
)
@PutMapping
(
value
=
"/unbind"
)
...
...
@@ -290,8 +292,17 @@ public class UserOperationController {
@ApiOperation
(
"保存大屏侧信息"
)
@AnonymousAccess
public
ResultInfo
saveUserInfo
(
@RequestBody
String
data
)
{
Assert
.
notNull
(
data
,
"用户数据不可为空"
);
JSONObject
json
=
JSONObject
.
parseObject
(
data
);
String
unionid
=
json
.
getString
(
"unionid"
);
Assert
.
state
(
StrUtil
.
isNotBlank
(
unionid
),
"unionid不可为空"
);
log
.
info
(
"resources :[{}]"
,
data
);
String
s
=
this
.
userTvOperationService
.
saveUserInfo
(
data
);
return
ResultInfo
.
success
(
s
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/MemberOperationServiceImpl.java
View file @
48a55ab
...
...
@@ -69,7 +69,6 @@ public class MemberOperationServiceImpl implements MemberOperationService {
memberVipHistory
.
setStatus
(
1
);
}
LocalDateTime
vipExpireTime
=
memberDTO
.
getVipExpireTime
();
LocalDateTime
now
=
LocalDateTime
.
now
();
//判断之前有没有买过,没买过,失效时间为一年后;
...
...
@@ -96,12 +95,10 @@ public class MemberOperationServiceImpl implements MemberOperationService {
Member
member
=
new
Member
();
BeanUtils
.
copyProperties
(
memberDTO
,
member
);
Long
memberId0
=
this
.
memberService
.
create
(
member
);
this
.
memberService
.
create
(
member
);
memberVipHistory
.
setVipExpireTime
(
member
.
getVipExpireTime
());
memberVipHistoryService
.
create
(
memberVipHistory
);
memberService
.
update
(
member
);
return
memberDTO
;
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
48a55ab
...
...
@@ -304,21 +304,22 @@ public class UserOperationServiceImpl implements UserOperationService {
*/
@Override
public
String
saveUserInfo
(
String
data
)
{
Assert
.
notNull
(
data
,
"用户数据不可为空"
);
JSONObject
json
=
JSONObject
.
parseObject
(
data
);
String
unionid
=
json
.
getString
(
"unionid"
);
Assert
.
state
(
StrUtil
.
isNotBlank
(
unionid
),
"unionid不可为空"
);
String
unionId
=
json
.
getString
(
"unionid"
);
String
result
=
""
;
// 订阅号appid
String
appId
=
json
.
getString
(
"dyAppid"
);
try
{
// 过期时间300S
this
.
redisUtils
.
set
(
RedisKeyUtil
.
genSeSuSubscribeKey
(
union
i
d
),
data
,
300
);
this
.
redisUtils
.
set
(
RedisKeyUtil
.
genSeSuSubscribeKey
(
union
I
d
),
data
,
300
);
// 若未传dyAppId。不走下面的流程
if
(
StrUtil
.
isNotBlank
(
appId
))
result
=
this
.
checkWeiXinUserAndSubscribeStatus
(
appId
,
unionid
);
result
=
this
.
checkWeiXinUserAndSubscribeStatus
(
appId
,
unionId
);
}
catch
(
Exception
e
)
{
log
.
error
(
" saveUserInfo get an error || data: {} || msg: {} "
,
data
,
e
.
getMessage
());
}
...
...
@@ -350,6 +351,12 @@ public class UserOperationServiceImpl implements UserOperationService {
return
SUBSCRIBE
;
}
/**
*
* @param unionid
* @param appId
* @return
*/
private
UserWeixinDTO
findUserWeiXinByUnionIdAndAppId
(
String
unionid
,
String
appId
)
{
return
this
.
userWeixinService
.
findFirstByUnionidAndAppid
(
unionid
,
appId
);
}
...
...
@@ -693,9 +700,21 @@ public class UserOperationServiceImpl implements UserOperationService {
*/
@Override
public
void
changeMainAccount
(
UserTv
resources
)
{
// 会员编码
String
memberCode
=
resources
.
getMemberCode
();
UserTvDTO
userTvDTO_0
=
this
.
findByPriorityMemberCode
(
memberCode
);
if
(
Objects
.
nonNull
(
userTvDTO_0
))
{
log
.
error
(
"Param ==>> memberCode ==> [{}]"
,
memberCode
);
if
(
userTvDTO_0
.
getPriorityMemberCode
().
equalsIgnoreCase
(
memberCode
))
throw
new
BadRequestException
(
"会员已是主账户,不能重复绑定"
);
throw
new
BadRequestException
(
"该会员已绑定其他账户,不能重复绑定"
);
}
// 大屏账户
UserTvDTO
userTvDTO
=
this
.
findByUserTv
(
resources
);
...
...
@@ -707,6 +726,12 @@ public class UserOperationServiceImpl implements UserOperationService {
}
private
UserTvDTO
findByPriorityMemberCode
(
String
memberCode
)
{
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findByPriorityMemberCode
(
memberCode
);
return
userTvDTO
;
}
/**
* 设置主会员
* @description 检查大屏账户有没有绑定小屏会员,如果没有绑定就将当前会员的code保存到大屏账户中
...
...
@@ -836,7 +861,9 @@ public class UserOperationServiceImpl implements UserOperationService {
public
boolean
createMemberByUserTv
(
UserTv
resources
)
{
String
platformAccount
=
resources
.
getPlatformAccount
();
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findByPlatformAccount
(
platformAccount
);
if
(
Objects
.
isNull
(
userTvDTO
))
{
Member
member
=
new
Member
();
// 大屏
member
.
setType
(
LocalConstants
.
MEMBER_PLATFORM_TYPE_VIS
);
...
...
@@ -846,8 +873,10 @@ public class UserOperationServiceImpl implements UserOperationService {
member
.
setType
(
1
);
Long
memberId
=
this
.
memberService
.
create
(
member
);
UserTv
userTv
=
new
UserTv
();
if
(
Objects
.
nonNull
(
memberId
))
{
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
resources
,
userTv
);
userTv
.
setPlatformAccount
(
platformAccount
);
userTv
.
setMemberCode
(
member
.
getCode
());
...
...
@@ -860,14 +889,19 @@ public class UserOperationServiceImpl implements UserOperationService {
userTv
.
setCreateBy
(
"system"
);
userTv
.
setUpdateBy
(
"system"
);
this
.
userTvService
.
create
(
userTv
);
return
true
;
}
}
else
{
return
false
;
}
else
{
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
userTvDTO
,
userTv
);
return
true
;
}
return
true
;
}
/**
...
...
@@ -1189,12 +1223,33 @@ public class UserOperationServiceImpl implements UserOperationService {
@Override
public
boolean
appletBind
(
BindBean
resources
)
{
Long
id
=
resources
.
getId
();
Long
platformUserId
=
resources
.
getPlatformUserId
();
// 大屏账户
UserTvDTO
userTvDTO
=
this
.
findUserIptvById
(
platformUserId
);
// 账户是否存在
if
(
Objects
.
isNull
(
userTvDTO
.
getId
())){
log
.
error
(
"Param ==> platformUserId ==> [{}]"
,
platformUserId
);
throw
new
EntityNotFoundException
(
UserTvDTO
.
class
,
"id"
,
"大屏账户不存在!"
);
}
// 是否绑定主账户
if
(
Objects
.
nonNull
(
userTvDTO
.
getId
()))
{
// 主账户
String
priorityMemberCode
=
userTvDTO
.
getPriorityMemberCode
();
if
(
StringUtils
.
isNotBlank
(
priorityMemberCode
))
throw
new
BadRequestException
(
"该账户已绑定其他会员,不能重复绑定"
);
}
// 微信账户
UserWeixinDTO
userWeixinDTO
=
this
.
userWeixinService
.
findById
(
id
);
// 账户是否存在
if
(
Objects
.
isNull
(
userWeixinDTO
.
getId
()))
{
log
.
error
(
"param ==> id ==> [{}]"
,
id
);
throw
new
EntityNotFoundException
(
UserWeixinDTO
.
class
,
"id"
,
userWeixinDTO
.
getId
().
toString
());
...
...
@@ -1202,37 +1257,25 @@ public class UserOperationServiceImpl implements UserOperationService {
// 会员
Long
memberId
=
userWeixinDTO
.
getMemberId
();
MemberDTO
memberDTO
=
this
.
findMemberById
(
memberId
);
if
(
Objects
.
isNull
(
memberDTO
.
getId
()))
{
if
(
Objects
.
isNull
(
memberId
))
{
log
.
error
(
"param ==> memberId ==> [{}]"
,
id
);
throw
new
EntityNotFoundException
(
MemberDTO
.
class
,
"id"
,
memberI
d
.
toString
());
throw
new
EntityNotFoundException
(
UserWeixinDTO
.
class
,
"id"
,
i
d
.
toString
());
}
// 已绑定大屏
Long
userIptvId
=
memberDTO
.
getUserIptvId
();
if
(
Objects
.
nonNull
(
userIptvId
)
&&
userIptvId
==
platformUserId
)
{
throw
new
BadRequestException
(
"不能重复绑定同一个账户"
);
MemberDTO
memberDTO
=
this
.
findMemberById
(
memberId
);
if
(
Objects
.
isNull
(
memberId
))
{
log
.
error
(
"param ==> memberId ==> [{}]"
,
id
);
throw
new
EntityNotFoundException
(
MemberDTO
.
class
,
"id"
,
memberId
.
toString
()
);
}
// 大屏账户
UserTvDTO
userTvDTO
=
this
.
findUserIptvById
(
platformUserId
);
if
(
Objects
.
nonNull
(
userTvDTO
.
getId
()))
{
// 主账户
String
priorityMemberCode
=
userTvDTO
.
getPriorityMemberCode
();
if
(
StringUtils
.
isEmpty
(
priorityMemberCode
))
{
String
code
=
memberDTO
.
getCode
();
userTvDTO
.
setPriorityMemberCode
(
code
);
// 主账户会员
String
code
=
memberDTO
.
getCode
();
userTvDTO
.
setPriorityMemberCode
(
code
);
// 更新大屏信息
this
.
doUpdateUserTv
(
userTvDTO
);
}
// 会员绑定大屏
this
.
bindIptvId
(
memberDTO
,
userTvDTO
);
}
// 更新大屏信息
this
.
doUpdateUserTv
(
userTvDTO
);
// 会员绑定大屏
this
.
bindIptvId
(
memberDTO
,
userTvDTO
);
return
true
;
}
...
...
member-service-impl/src/main/resources/config/application-dev.yml
View file @
48a55ab
...
...
@@ -79,6 +79,7 @@ jwt:
# 续期时间,2小时,单位毫秒
renew
:
7200000
#是否允许生成代码,生产环境设置为false
generator
:
enabled
:
true
...
...
Please
register
or
sign in
to post a comment