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
3a9035d7
...
3a9035d7a17255bd48ec74fe1718001f1361754d
authored
2022-01-25 15:54:02 +0800
by
xianghan@topdraw.cn
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.添加修改会员相关人员验证条件
2.转移h5登录接口 3.微信相关事件实现逻辑
1 parent
5ffd851f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
131 additions
and
24 deletions
member-service-impl/src/main/java/com/topdraw/business/module/member/relatedinfo/domain/MemberRelatedInfo.java
member-service-impl/src/main/java/com/topdraw/business/module/member/relatedinfo/domain/UpdateGroup.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/module/member/service/dto/MemberDTO.java
member-service-impl/src/main/java/com/topdraw/business/module/user/weixin/service/dto/UserWeixinQueryCriteria.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/UserOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/module/member/relatedinfo/domain/MemberRelatedInfo.java
View file @
3a9035d
...
...
@@ -5,6 +5,8 @@ import lombok.experimental.Accessors;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotNull
;
import
org.springframework.data.annotation.CreatedDate
;
import
org.springframework.data.annotation.LastModifiedDate
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
...
...
@@ -28,6 +30,7 @@ public class MemberRelatedInfo implements Serializable {
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
@NotNull
(
groups
=
{
UpdateGroup
.
class
})
private
Long
id
;
// 会员id
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/relatedinfo/domain/UpdateGroup.java
0 → 100644
View file @
3a9035d
package
com
.
topdraw
.
business
.
module
.
member
.
relatedinfo
.
domain
;
public
interface
UpdateGroup
{
}
member-service-impl/src/main/java/com/topdraw/business/module/member/relatedinfo/rest/MemberRelatedInfoController.java
View file @
3a9035d
package
com
.
topdraw
.
business
.
module
.
member
.
relatedinfo
.
rest
;
import
com.topdraw.annotation.AnonymousAccess
;
import
com.topdraw.business.module.member.relatedinfo.domain.UpdateGroup
;
import
com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO
;
import
com.topdraw.business.module.member.service.MemberService
;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
import
com.topdraw.common.ResultInfo
;
...
...
@@ -7,6 +10,8 @@ import com.topdraw.annotation.Log;
import
com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo
;
import
com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService
;
import
com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria
;
import
com.topdraw.exception.BadRequestException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.util.Assert
;
...
...
@@ -20,9 +25,10 @@ import java.util.Objects;
* @author XiangHan /api/MemberRelatedInfo
* @date 2021-10-22
*/
@Slf4j
@Api
(
tags
=
"MemberRelatedInfo管理"
)
@RestController
@RequestMapping
(
"/api/MemberRelatedInfo"
)
@RequestMapping
(
"/
ucEngine/
api/MemberRelatedInfo"
)
@CrossOrigin
public
class
MemberRelatedInfoController
{
...
...
@@ -45,21 +51,29 @@ public class MemberRelatedInfoController {
return
ResultInfo
.
success
();
}
@Log
@Log
(
"修改MemberRelatedInfo"
)
@PutMapping
(
value
=
"/update"
)
@ApiOperation
(
"修改MemberRelatedInfo"
)
public
ResultInfo
update
(
@Validated
@RequestBody
MemberRelatedInfo
resources
)
{
Long
memberId
=
resources
.
getMemberId
();
String
idCard
=
resources
.
getIdCard
();
Assert
.
notNull
(
memberId
,
"memberId can't be null"
);
Assert
.
notNull
(
idCard
,
"idCard can't be null"
);
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
memberId
);
if
(
Objects
.
nonNull
(
memberDTO
))
{
String
code
=
memberDTO
.
getCode
();
Assert
.
notNull
(
code
,
"code can't be null"
);
resources
.
setMemberCode
(
code
);
MemberRelatedInfoService
.
update
(
resources
);
@AnonymousAccess
public
ResultInfo
update
(
@Validated
(
value
=
{
UpdateGroup
.
class
})
@RequestBody
MemberRelatedInfo
resources
)
{
Long
id
=
resources
.
getId
();
MemberRelatedInfoDTO
memberRelatedInfoDTO
=
this
.
MemberRelatedInfoService
.
findById
(
id
);
if
(
memberRelatedInfoDTO
.
getId
()
!=
null
)
{
Long
memberId
=
memberRelatedInfoDTO
.
getMemberId
();
if
(
Objects
.
isNull
(
memberId
))
{
log
.
info
(
"id ==>> [{}]"
,
id
);
throw
new
BadRequestException
(
"memberId is null! please check member info"
);
}
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
memberId
);
if
(
Objects
.
nonNull
(
memberDTO
))
{
String
code
=
memberDTO
.
getCode
();
Assert
.
notNull
(
code
,
"code can't be null"
);
resources
.
setMemberCode
(
code
);
MemberRelatedInfoService
.
update
(
resources
);
}
}
return
ResultInfo
.
success
();
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/service/dto/MemberDTO.java
View file @
3a9035d
...
...
@@ -14,6 +14,9 @@ import java.time.LocalDateTime;
@Data
public
class
MemberDTO
implements
Serializable
{
// iptv绑定的主会员 0:否 1:是
private
Integer
iptvMajor
;
// vip过期时间
private
LocalDateTime
vipExpireTime
;
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/weixin/service/dto/UserWeixinQueryCriteria.java
View file @
3a9035d
package
com
.
topdraw
.
business
.
module
.
user
.
weixin
.
service
.
dto
;
import
com.topdraw.annotation.Query
;
import
lombok.Data
;
/**
...
...
@@ -9,6 +10,7 @@ import lombok.Data;
@Data
public
class
UserWeixinQueryCriteria
{
@Query
()
private
String
unionId
;
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
View file @
3a9035d
...
...
@@ -38,7 +38,6 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.*
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
...
...
@@ -119,6 +118,7 @@ public class UserOperationController {
@Log
(
"大屏用户解绑"
)
@PutMapping
(
value
=
"/unbind"
)
@ApiOperation
(
"大屏用户解绑"
)
@AnonymousAccess
public
ResultInfo
unbind
(
@Validated
(
value
=
{
UnbindGroup
.
class
})
@RequestBody
TempIptvUser
resources
)
{
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
resources
,
userTv
);
...
...
@@ -129,6 +129,7 @@ public class UserOperationController {
@Log
(
"大屏更换主账号"
)
@PutMapping
(
value
=
"/changeMainAccount"
)
@ApiOperation
(
"大屏更换主账号"
)
@AnonymousAccess
public
ResultInfo
changeMainAccount
(
@Validated
(
value
=
{
UnbindGroup
.
class
})
@RequestBody
TempIptvUser
resources
)
{
UserTv
userTv
=
new
UserTv
();
BeanUtils
.
copyProperties
(
resources
,
userTv
);
...
...
@@ -136,6 +137,15 @@ public class UserOperationController {
return
ResultInfo
.
success
(
"update success"
);
}
@Log
(
"微信服务号(H5)登录"
)
@PostMapping
(
"/serviceLogin"
)
@ApiOperation
(
"微信服务号(H5)登录"
)
@AnonymousAccess
public
ResultInfo
serviceLogin
(
@Validated
@RequestBody
WeiXinUserBean
resources
)
{
Object
o
=
this
.
userTvOperationService
.
serviceLogin
(
resources
);
return
ResultInfo
.
success
(
o
);
}
@Log
(
"微信小程序登录"
)
@PostMapping
(
"/appletLogin"
)
@ApiOperation
(
"微信小程序登录"
)
...
...
@@ -187,7 +197,9 @@ public class UserOperationController {
throw
new
BadRequestException
(
"非订阅号"
);
// 用户类型
JSONObject
userInfo
=
weixinRequestUtil
.
getUserInfo
(
wxInfoMap
,
openId
);
// JSONObject userInfo = weixinRequestUtil.getUserInfo(wxInfoMap, openId);
JSONObject
userInfo
=
new
JSONObject
();
userInfo
.
put
(
"unionid"
,
"oqDha5idQxR0WGPW2qHi-meHRtyg"
);
log
.
info
(
"userInfo is : {}"
,
userInfo
.
toJSONString
());
unionId
=
userInfo
.
get
(
"unionid"
).
toString
();
...
...
@@ -212,10 +224,13 @@ public class UserOperationController {
}
else
{
String
eventKey
=
subscribeBean
.
getEventKey
();
// 用户扫描带参二维码关注。发消息
// 去除固定前缀,获取二维码参数
eventKey
=
eventKey
.
substring
(
8
);
iptvUserInfo
=
com
.
alibaba
.
fastjson
.
JSONObject
.
parseObject
(
eventKey
);
if
(
StringUtils
.
isNotBlank
(
eventKey
))
{
// 用户扫描带参二维码关注。发消息
// 去除固定前缀,获取二维码参数
eventKey
=
eventKey
.
substring
(
8
);
iptvUserInfo
=
JSONObject
.
parseObject
(
eventKey
);
}
}
...
...
@@ -224,10 +239,6 @@ public class UserOperationController {
subscribeBean
.
setIptvUserInfo
(
iptvUserInfo
);
}
// 之后删除缓存信息
this
.
redisUtils
.
del
(
RedisKeyUtil
.
genSeSuSubscribeKey
(
unionId
));
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/UserOperationService.java
View file @
3a9035d
...
...
@@ -12,29 +12,99 @@ import java.util.List;
public
interface
UserOperationService
{
/**
* 保存大屏账户并创建会员
* @param resources
* @return
*/
boolean
createMemberByUserTv
(
UserTv
resources
);
/**
* 大屏解绑
* @param userTv
*/
void
unbind
(
UserTv
userTv
);
/**
* 大屏切换主账户(会员)
* @param userTv
*/
void
changeMainAccount
(
UserTv
userTv
);
/**
* 微信小程序登录
* @param resources
* @return
*/
UserWeixinDTO
appletLogin
(
WeiXinUserBean
resources
);
/**
* 微信公众号关注
* @param resources
* @return
*/
boolean
subscribe
(
SubscribeBean
resources
);
/**
* 微信公众号取关
* @param resources
* @return
*/
boolean
unsubscribe
(
SubscribeBean
resources
);
/**
* 保存账户
* @param data
* @return
*/
String
saveUserInfo
(
String
data
);
/**
* 获取用户授权并解析、保存用户手机号
* @param resources
* @return
*/
MemberProfile
saveUserWeixinPhone
(
WeiXinUserBean
resources
);
/**
*
* @param content
* @return
*/
boolean
sendQrCodeMessage
(
String
content
);
/**
* 大屏删除所有收藏
* @param content
* @return
*/
boolean
deleteAllCollection
(
String
content
);
/**
* 大屏删除收藏
* @param content
* @return
*/
boolean
deleteCollection
(
String
content
);
/**
* 大屏收藏
* @param content
* @return
*/
boolean
addCollection
(
String
content
);
/**
* 获取大屏绑定的小屏会员列表
* @param platformAccount
* @return
*/
List
<
MemberDTO
>
findBindByPlatformAccount
(
String
platformAccount
);
/**
* 服务号(H5)登录
* @param resources
* @return
*/
Object
serviceLogin
(
WeiXinUserBean
resources
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
3a9035d
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to post a comment