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
7bfe629e
...
7bfe629ea6301abccc904cb9fd8276d0ef82019f
authored
2022-07-01 15:16:54 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.添加app绑定第三方账号的接口
1 parent
d90e60eb
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
107 additions
and
9 deletions
member-service-impl/src/main/java/com/topdraw/business/module/user/app/domain/UserAppBind.java
member-service-impl/src/main/java/com/topdraw/business/module/user/app/repository/UserAppBindRepository.java
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/UserAppBindService.java
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/dto/UserAppBindDTO.java
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/impl/UserAppBindServiceImpl.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/user/app/domain/UserAppBind.java
View file @
7bfe629
...
...
@@ -45,6 +45,10 @@ public class UserAppBind implements Serializable {
@Column
(
name
=
"status"
,
nullable
=
false
)
private
Integer
status
;
// 昵称
@Column
(
name
=
"nickname"
,
nullable
=
false
)
private
String
nickname
;
// 创建时间
@CreatedDate
@Column
(
name
=
"create_time"
)
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/repository/UserAppBindRepository.java
View file @
7bfe629
...
...
@@ -5,6 +5,8 @@ import org.springframework.data.jpa.repository.JpaRepository;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.query.Param
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Optional
;
...
...
@@ -19,4 +21,16 @@ public interface UserAppBindRepository extends JpaRepository<UserAppBind, Long>,
@Modifying
@Query
(
value
=
"UPDATE `uc_user_app_bind` SET `status` = 0 , `update_time` = now() WHERE `account` = ?1 "
,
nativeQuery
=
true
)
Integer
cancelUserAppBind
(
String
account
);
Optional
<
UserAppBind
>
findFirstByAccountAndAccountType
(
String
account
,
Integer
accountType
);
@Modifying
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Query
(
value
=
"UPDATE `uc_user_app_bind` SET `status` = 1, `update_time` = now() WHERE `account` = ?1, accountType = ?2"
,
nativeQuery
=
true
)
Integer
updateUserAppBindStatus2Valid
(
String
account
,
Integer
accountType
);
@Modifying
@Query
(
value
=
"UPDATE `uc_user_app_bind` SET `status` = :#{#resources.status}, `update_time` = now(), "
+
" `user_app_id` = :#{#resources.userAppId}, `nickname` = :#{#resources.nickname} WHERE `account` = ?1, accountType = ?2"
,
nativeQuery
=
true
)
Integer
updateUserAppBind
(
@Param
(
"resources"
)
UserAppBind
userAppBind
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/UserAppBindService.java
View file @
7bfe629
...
...
@@ -47,4 +47,18 @@ public interface UserAppBindService {
* @return
*/
Integer
cancelUserAppBind
(
String
account
);
/**
*
* @param account
* @param accountType
* @return
*/
UserAppBindDTO
findFirstByAccountAndAccountType
(
String
account
,
Integer
accountType
);
/**
*
* @return
*/
Integer
updateUserAppBind
(
UserAppBind
userAppBind
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/dto/UserAppBindDTO.java
View file @
7bfe629
...
...
@@ -27,6 +27,9 @@ public class UserAppBindDTO implements Serializable {
// 绑定状态 0:解绑;1 绑定
private
Integer
status
;
// 昵称
private
String
nickname
;
// 创建时间
private
Timestamp
createTime
;
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/impl/UserAppBindServiceImpl.java
View file @
7bfe629
...
...
@@ -70,5 +70,18 @@ public class UserAppBindServiceImpl implements UserAppBindService {
return
this
.
userAppBindRepository
.
cancelUserAppBind
(
account
);
}
@Override
@Transactional
(
readOnly
=
true
)
public
UserAppBindDTO
findFirstByAccountAndAccountType
(
String
account
,
Integer
accountType
)
{
UserAppBind
userAppBind
=
this
.
userAppBindRepository
.
findFirstByAccountAndAccountType
(
account
,
accountType
).
orElseGet
(
UserAppBind:
:
new
);
return
this
.
userAppBindMapper
.
toDto
(
userAppBind
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Integer
updateUserAppBind
(
UserAppBind
userAppBind
)
{
return
this
.
userAppBindRepository
.
updateUserAppBind
(
userAppBind
);
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
View file @
7bfe629
...
...
@@ -107,6 +107,38 @@ public class UserOperationController {
}
@Log
@PostMapping
(
value
=
"/appBindUserAccount"
)
@ApiOperation
(
"app账号绑定第三方账号"
)
@AnonymousAccess
public
ResultInfo
appBindUserAccount
(
@Validated
@RequestBody
UserApp
resources
)
{
log
.
info
(
"app账号绑定第三方账号,参数 ==>> [appBindUserAccount#{}]"
,
resources
);
String
username
=
resources
.
getUsername
();
if
(
StringUtils
.
isBlank
(
username
))
{
log
.
error
(
"app账号绑定第三方账号,参数错误,账号不得为空 "
);
return
ResultInfo
.
failure
(
"app账号绑定第三方账号,参数错误,账号不得为空"
);
}
String
account
=
resources
.
getAccount
();
if
(
StringUtils
.
isNotBlank
(
account
))
{
if
(
Objects
.
isNull
(
resources
.
getAccountType
()))
{
log
.
error
(
"app账号绑定第三方账号,参数错误,第三方账号不得为空"
);
return
ResultInfo
.
failure
(
"app账号绑定第三方账号,参数错误,第三方账号不得为空"
);
}
}
// 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号
Integer
accountType
=
resources
.
getAccountType
();
if
(
Objects
.
isNull
(
accountType
))
{
log
.
error
(
"app账号绑定第三方账号,参数错误,第三方账号类型不得为空"
);
return
ResultInfo
.
failure
(
"app账号绑定第三方账号,参数错误,第三方账号类型不得为空"
);
}
boolean
result
=
this
.
userOperationService
.
appBindUserAccount
(
resources
);
return
ResultInfo
.
success
(
result
);
}
@Log
@PostMapping
(
value
=
"/updateUserApp"
)
@ApiOperation
(
"修改app账号信息"
)
@AnonymousAccess
...
...
@@ -136,7 +168,7 @@ public class UserOperationController {
@PostMapping
(
"/appBind"
)
@ApiOperation
(
"
微信小程序
绑定大屏"
)
@ApiOperation
(
"
app
绑定大屏"
)
@AnonymousAccess
public
ResultInfo
appBind
(
@Validated
(
value
=
{
BindGroup
.
class
})
@RequestBody
BindBean
resources
)
{
log
.
info
(
"UserOperationController ==> appletBind ==>> param ==> [{}]"
,
resources
);
...
...
@@ -156,7 +188,7 @@ public class UserOperationController {
}
@PostMapping
(
"/appUnbind"
)
@ApiOperation
(
"
小屏
解绑"
)
@ApiOperation
(
"
app
解绑"
)
@AnonymousAccess
public
ResultInfo
appUnbind
(
@Validated
(
value
=
{
UnbindGroup
.
class
})
@RequestBody
WeixinUnBindBean
weixinUnBindBean
)
{
log
.
info
(
"UserOperationController ==> minaUnbind ==>> param ==> [{}]"
,
weixinUnBindBean
);
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/UserOperationService.java
View file @
7bfe629
...
...
@@ -183,4 +183,12 @@ public interface UserOperationService {
* @return
*/
boolean
cancelUserAppBind
(
UserApp
resources
);
/**
*
* @param resources
* @return
*/
boolean
appBindUserAccount
(
UserApp
resources
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
7bfe629
...
...
@@ -12,10 +12,7 @@ import com.topdraw.business.module.member.domain.MemberTypeConstant;
import
com.topdraw.business.module.member.service.MemberService
;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
import
com.topdraw.business.module.member.service.dto.MemberSimpleDTO
;
import
com.topdraw.business.module.user.app.domain.UserApp
;
import
com.topdraw.business.module.user.app.domain.UserAppBind
;
import
com.topdraw.business.module.user.app.domain.UserAppBindBuilder
;
import
com.topdraw.business.module.user.app.domain.UserAppBuilder
;
import
com.topdraw.business.module.user.app.domain.*
;
import
com.topdraw.business.module.user.app.service.UserAppBindService
;
import
com.topdraw.business.module.user.app.service.UserAppService
;
import
com.topdraw.business.module.user.app.service.dto.UserAppBindDTO
;
...
...
@@ -167,6 +164,19 @@ public class UserOperationServiceImpl implements UserOperationService {
return
false
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
appBindUserAccount
(
UserApp
resources
)
{
String
account
=
resources
.
getAccount
();
Integer
accountType
=
resources
.
getAccountType
();
UserAppBindDTO
userAppBindDTO
=
this
.
userAppBindService
.
findFirstByAccountAndAccountType
(
account
,
accountType
);
if
(
Objects
.
nonNull
(
userAppBindDTO
.
getId
())){
Integer
count
=
null
;
//this.userAppBindService.update(account, accountType, UserAppStatusConstant.VALID_STATUS);
return
count
>
0
;
}
return
false
;
}
/**
* 创建大屏账户同时创建会员
*
...
...
@@ -174,7 +184,7 @@ public class UserOperationServiceImpl implements UserOperationService {
* @return UserTvDTO
*/
@Override
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
readOnly
=
true
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
UserTvDTO
createTvUserAndMember
(
UserTv
resources
)
{
// 大屏账户
...
...
@@ -1130,7 +1140,7 @@ public class UserOperationServiceImpl implements UserOperationService {
userTv
.
setId
(
userTvDTO
.
getId
());
userTv
.
setPriorityMemberCode
(
memberDTO
.
getCode
());
userTvDTO
=
this
.
userTvService
.
doUpdatePriorityMemberCode
(
userTv
);
this
.
userTvService
.
doUpdatePriorityMemberCode
(
userTv
);
}
Member
member
=
new
Member
();
...
...
@@ -1156,7 +1166,7 @@ public class UserOperationServiceImpl implements UserOperationService {
member
.
setPlatformAccount
(
platformAccount
);
// 修改会员
memberDTO
=
this
.
memberService
.
doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime
(
member
);
this
.
memberService
.
doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime
(
member
);
memberDTO
.
setPlatformAccount
(
platformAccount
);
...
...
Please
register
or
sign in
to post a comment