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
5ffd851f
...
5ffd851fee76439613df7fdb7f0c1a399e063297
authored
2022-01-24 21:22:44 +0800
by
xianghan@topdraw.cn
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
V1.0.2.REALESE
1 parent
2bf05374
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
133 additions
and
5 deletions
member-service-impl/src/main/java/com/topdraw/business/module/member/repository/MemberRepository.java
member-service-impl/src/main/java/com/topdraw/business/module/member/service/MemberService.java
member-service-impl/src/main/java/com/topdraw/business/module/member/service/impl/MemberServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/module/user/weixin/collection/service/UserCollectionService.java
member-service-impl/src/main/java/com/topdraw/business/module/user/weixin/collection/service/impl/UserCollectionServiceImpl.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/process/service/mapper/CollectionMq2DetailMapper.java
member-service-impl/src/main/java/com/topdraw/business/module/member/repository/MemberRepository.java
View file @
5ffd851
...
...
@@ -4,6 +4,7 @@ import com.topdraw.business.module.member.domain.Member;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
java.util.List
;
import
java.util.Optional
;
/**
...
...
@@ -13,4 +14,6 @@ import java.util.Optional;
public
interface
MemberRepository
extends
JpaRepository
<
Member
,
Long
>,
JpaSpecificationExecutor
<
Member
>
{
Optional
<
Member
>
findFirstByCode
(
String
code
);
List
<
Member
>
findByUserIptvId
(
Long
id
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/service/MemberService.java
View file @
5ffd851
...
...
@@ -68,4 +68,6 @@ public interface MemberService {
* @param member
*/
void
doUpdateMemberPoints
(
Member
member
);
List
<
MemberDTO
>
findByUserIptvId
(
Long
id
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/service/impl/MemberServiceImpl.java
View file @
5ffd851
...
...
@@ -179,5 +179,11 @@ public class MemberServiceImpl implements MemberService {
}
}
@Override
public
List
<
MemberDTO
>
findByUserIptvId
(
Long
id
)
{
List
<
Member
>
memberList
=
this
.
memberRepository
.
findByUserIptvId
(
id
);
return
memberMapper
.
toDto
(
memberList
);
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/weixin/collection/service/UserCollectionService.java
View file @
5ffd851
...
...
@@ -51,5 +51,5 @@ public interface UserCollectionService {
Optional
<
UserCollection
>
findFirstByUserIdAndTypeAndName
(
Long
id
,
Integer
type
,
String
name
);
void
save
(
UserCollection
userCollection
);
UserCollection
save
(
UserCollection
userCollection
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/weixin/collection/service/impl/UserCollectionServiceImpl.java
View file @
5ffd851
...
...
@@ -111,8 +111,9 @@ public class UserCollectionServiceImpl implements UserCollectionService {
}
@Override
public
void
save
(
UserCollection
userCollection
)
{
public
UserCollection
save
(
UserCollection
userCollection
)
{
this
.
userCollectionRepository
.
save
(
userCollection
);
return
userCollection
;
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
View file @
5ffd851
...
...
@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.topdraw.annotation.AnonymousAccess
;
import
com.topdraw.annotation.Log
;
import
com.topdraw.business.module.member.profile.domain.MemberProfile
;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
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
;
...
...
@@ -38,6 +39,7 @@ 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
;
...
...
@@ -54,6 +56,15 @@ public class UserOperationController {
@Autowired
private
RedisUtils
redisUtils
;
@Log
(
"获取大屏绑定的小屏会员列表"
)
@GetMapping
(
value
=
"/findBindByPlatformAccount/{platformAccount}"
)
@AnonymousAccess
public
ResultInfo
findBindByPlatformAccount
(
@PathVariable
(
"platformAccount"
)
String
platformAccount
)
{
log
.
info
(
"resources :[{}]"
,
platformAccount
);
List
<
MemberDTO
>
result
=
this
.
userTvOperationService
.
findBindByPlatformAccount
(
platformAccount
);
return
ResultInfo
.
success
(
result
);
}
@Log
(
"带参二维码"
)
@PostMapping
(
value
=
"/sendQrCodeMessage"
)
@ApiOperation
(
"带参二维码"
)
...
...
@@ -90,13 +101,14 @@ public class UserOperationController {
@AnonymousAccess
public
ResultInfo
addCollection
(
@RequestBody
String
content
)
{
log
.
info
(
"resources :[{}]"
,
content
);
boolean
result
=
t
rue
;
boolean
result
=
t
his
.
userTvOperationService
.
addCollection
(
content
)
;
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
);
...
...
@@ -127,6 +139,7 @@ public class UserOperationController {
@Log
(
"微信小程序登录"
)
@PostMapping
(
"/appletLogin"
)
@ApiOperation
(
"微信小程序登录"
)
@AnonymousAccess
public
ResultInfo
appletLogin
(
@Validated
@RequestBody
WeiXinUserBean
resources
)
{
UserWeixinDTO
result
=
this
.
userTvOperationService
.
appletLogin
(
resources
);
return
ResultInfo
.
success
(
result
);
...
...
@@ -240,9 +253,12 @@ public class UserOperationController {
* @author Hongyan Wang
* @date 2021/8/24 4:54 下午
*/
@Log
(
"保存大屏侧信息"
)
@PostMapping
(
value
=
"/saveUserInfo"
)
@ApiOperation
(
"保存大屏侧信息"
)
@AnonymousAccess
public
ResultInfo
saveUserInfo
(
@RequestBody
String
data
)
{
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/UserOperationService.java
View file @
5ffd851
package
com
.
topdraw
.
business
.
process
.
service
;
import
com.topdraw.business.module.member.profile.domain.MemberProfile
;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
import
com.topdraw.business.module.user.iptv.domain.UserTv
;
import
com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO
;
import
com.topdraw.business.process.domian.weixin.BuyVipBean
;
import
com.topdraw.business.process.domian.weixin.SubscribeBean
;
import
com.topdraw.business.process.domian.weixin.WeiXinUserBean
;
import
java.util.List
;
public
interface
UserOperationService
{
boolean
createMemberByUserTv
(
UserTv
resources
);
...
...
@@ -30,4 +33,8 @@ public interface UserOperationService {
boolean
deleteAllCollection
(
String
content
);
boolean
deleteCollection
(
String
content
);
boolean
addCollection
(
String
content
);
List
<
MemberDTO
>
findBindByPlatformAccount
(
String
platformAccount
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
5ffd851
package
com
.
topdraw
.
business
.
process
.
service
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.http.HttpUtil
;
...
...
@@ -34,6 +35,7 @@ import com.topdraw.business.process.domian.weixin.SubscribeBean;
import
com.topdraw.business.process.domian.weixin.UserCollectionMq
;
import
com.topdraw.business.process.domian.weixin.WeiXinUserBean
;
import
com.topdraw.business.process.service.UserOperationService
;
import
com.topdraw.business.process.service.mapper.CollectionMq2DetailMapper
;
import
com.topdraw.config.LocalConstants
;
import
com.topdraw.config.RedisKeyUtil
;
import
com.topdraw.exception.BadRequestException
;
...
...
@@ -97,6 +99,8 @@ public class UserOperationServiceImpl implements UserOperationService {
private
UserCollectionDetailService
userCollectionDetailService
;
@Autowired
private
UserCollectionDetailRepository
userCollectionDetailRepository
;
@Autowired
private
CollectionMq2DetailMapper
collectionMq2DetailMapper
;
...
...
@@ -853,7 +857,14 @@ public class UserOperationServiceImpl implements UserOperationService {
BeanUtils
.
copyProperties
(
resources
,
userTv
);
userTv
.
setPlatformAccount
(
platformAccount
);
userTv
.
setMemberCode
(
member
.
getCode
());
userTv
.
setNickname
(
platformAccount
);
userTv
.
setUsername
(
platformAccount
);
userTv
.
setLoginDays
(
1
);
userTv
.
setStatus
(
1
);
userTv
.
setActiveTime
(
TimestampUtil
.
now
());
userTv
.
setContinueDays
(
1
);
userTv
.
setCreateBy
(
"system"
);
userTv
.
setUpdateBy
(
"system"
);
this
.
userTvService
.
create
(
userTv
);
}
...
...
@@ -1077,6 +1088,70 @@ public class UserOperationServiceImpl implements UserOperationService {
return
true
;
}
@Override
public
boolean
addCollection
(
String
content
)
{
try
{
log
.
info
(
"receive UserCollection add message, content {}"
,
content
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
String
platformAccount
=
jsonObject
.
getString
(
"platformAccount"
);
String
data
=
jsonObject
.
getString
(
"data"
);
if
(
StringUtils
.
isBlank
(
data
)
||
!
data
.
startsWith
(
"["
))
{
return
false
;
}
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findByPlatformAccount
(
platformAccount
);
Long
tvUserId
=
userTvDTO
.
getId
();
List
<
UserCollectionMq
>
userCollectionMqList
=
JSONObject
.
parseArray
(
data
,
UserCollectionMq
.
class
);
if
(
userCollectionMqList
==
null
||
userCollectionMqList
.
isEmpty
())
{
return
false
;
}
Map
<
Long
,
List
<
UserCollectionMq
>>
collect
=
userCollectionMqList
.
stream
().
collect
(
Collectors
.
groupingBy
(
UserCollectionMq:
:
getUserCollectionId
));
for
(
Map
.
Entry
<
Long
,
List
<
UserCollectionMq
>>
entry
:
collect
.
entrySet
())
{
List
<
UserCollectionMq
>
value
=
entry
.
getValue
();
UserCollectionMq
userCollectionMq
=
value
.
get
(
0
);
if
(
StringUtils
.
isBlank
(
userCollectionMq
.
getName
()))
{
userCollectionMq
.
setName
(
"DEFAULT"
);
}
UserCollection
userCollection
=
this
.
userCollectionService
.
findFirstByUserIdAndTypeAndName
(
tvUserId
,
userCollectionMq
.
getType
(),
userCollectionMq
.
getName
()).
orElseGet
(
UserCollection:
:
new
);
userCollection
.
setAppId
(
userCollectionMq
.
getAppId
())
.
setUserId
(
tvUserId
)
.
setName
(
userCollectionMq
.
getName
())
.
setType
(
userCollectionMq
.
getType
())
.
setCount
(
userCollection
.
getCount
()
==
null
?
value
.
size
()
:
userCollection
.
getCount
()
+
value
.
size
());
UserCollection
userCollectionSave
=
this
.
userCollectionService
.
save
(
userCollection
);
for
(
UserCollectionMq
collectionMq
:
value
)
{
UserCollectionDetail
userCollectionDetail
=
collectionMq2DetailMapper
.
toEntity
(
collectionMq
);
Optional
<
UserCollectionDetail
>
userCollectionDetailOptional
=
userCollectionDetailRepository
.
findByDetailIdAndDetailTypeAndUserCollectionId
(
userCollectionDetail
.
getDetailId
(),
userCollectionDetail
.
getDetailType
(),
userCollectionSave
.
getId
());
//观影记录同一天只存一条记录
if
(
userCollectionDetailOptional
.
isPresent
()
&&
DateUtil
.
isSameDay
(
new
Date
(
userCollectionDetailOptional
.
get
().
getCreateTime
().
getTime
()),
new
Date
()))
{
userCollectionDetail
.
setId
(
userCollectionDetailOptional
.
get
().
getId
());
}
else
{
userCollectionDetail
.
setId
(
null
)
.
setUserCollectionId
(
userCollectionSave
.
getId
());
}
userCollectionDetailRepository
.
save
(
userCollectionDetail
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"CollectionAddConsumer || UserCollection add error || {}"
,
e
.
toString
(),
e
);
}
return
true
;
}
@Override
public
List
<
MemberDTO
>
findBindByPlatformAccount
(
String
platformAccount
)
{
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findByPlatformAccount
(
platformAccount
);
if
(
Objects
.
nonNull
(
userTvDTO
.
getId
()))
{
Long
id
=
userTvDTO
.
getId
();
return
this
.
memberService
.
findByUserIptvId
(
id
);
}
return
null
;
}
/**
* 保存、修改会员加密信息
* @param resources
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/mapper/CollectionMq2DetailMapper.java
0 → 100644
View file @
5ffd851
package
com
.
topdraw
.
business
.
process
.
service
.
mapper
;
import
com.topdraw.base.BaseMapper
;
import
com.topdraw.business.module.user.weixin.collection.domain.UserCollectionDetail
;
import
com.topdraw.business.process.domian.weixin.UserCollectionMq
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapping
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.ReportingPolicy
;
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
CollectionMq2DetailMapper
extends
BaseMapper
<
UserCollectionMq
,
UserCollectionDetail
>
{
@Override
@Mappings
({
@Mapping
(
target
=
"detailImg"
,
source
=
"images"
)
})
UserCollectionDetail
toEntity
(
UserCollectionMq
dto
);
}
Please
register
or
sign in
to post a comment