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
99a9491d
...
99a9491db8497025b91887549af1cf9b24f32b91
authored
2022-07-02 21:04:41 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.添加app账号维护接口
1 parent
225e5813
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
223 additions
and
105 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/repository/UserAppRepository.java
member-service-impl/src/main/java/com/topdraw/business/module/user/app/rest/UserAppController.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/UserAppService.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/module/user/app/service/impl/UserAppServiceImpl.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 @
99a9491
...
...
@@ -23,6 +23,12 @@ import java.io.Serializable;
@Table
(
name
=
"uc_user_app_bind"
)
public
class
UserAppBind
implements
Serializable
{
@Transient
private
String
username
;
@Transient
private
String
password
;
// 主键
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/repository/UserAppBindRepository.java
View file @
99a9491
...
...
@@ -19,18 +19,38 @@ public interface UserAppBindRepository extends JpaRepository<UserAppBind, Long>,
Optional
<
UserAppBind
>
findFirstByAccount
(
String
account
);
@Modifying
@Query
(
value
=
"UPDATE `uc_user_app_bind` SET `status` = 0 , `update_time` = now() WHERE `account` = ?1 "
,
nativeQuery
=
true
)
Integer
cancelUserAppBind
(
String
account
);
@Query
(
value
=
"UPDATE `uc_user_app_bind` SET `status` = 0 , `update_time` = now() WHERE `account` = ?1
AND `account_type` = ?2
"
,
nativeQuery
=
true
)
Integer
cancelUserAppBind
(
String
account
,
Integer
accountType
);
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
);
@Query
(
value
=
"UPDATE `uc_user_app_bind` SET `status` = :#{#resources.status}, `update_time` = now(), "
+
" `user_app_id` = :#{#resources.userAppId}, `nickname` = :#{#resources.nickname} "
+
" WHERE `account` = :#{#resources.account} AND accountType = :#{#resources.accountType}"
,
nativeQuery
=
true
)
Integer
updateThirdAccount
(
@Param
(
"resources"
)
UserAppBind
resources
);
@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
);
" `user_app_id` = :#{#resources.userAppId} WHERE `account` = :#{#resources.account} AND accountType = :#{#resources.accountType}"
,
nativeQuery
=
true
)
Integer
updateThirdAccountStatusAndUserAppId
(
@Param
(
"resources"
)
UserAppBind
resources
);
@Modifying
@Query
(
value
=
"UPDATE `uc_user_app_bind` SET `status` = 1, `update_time` = now(), "
+
" `user_app_id` = :#{#resources.userAppId} WHERE `account` = :#{#resources.account} AND accountType = :#{#resources.accountType}"
,
nativeQuery
=
true
)
Integer
updateValidStatusAndUserAppId
(
@Param
(
"resources"
)
UserAppBind
resources
);
@Modifying
@Query
(
value
=
"UPDATE `uc_user_app_bind` SET `update_time` = now(), `nickname` = :#{#resources.nickname} "
+
" WHERE `account` = :#{#resources.account} AND `account_type` = :#{#resources.accountType}"
,
nativeQuery
=
true
)
Integer
updateThirdAccountNickname
(
@Param
(
"resources"
)
UserAppBind
resources
);
@Modifying
@Query
(
value
=
"UPDATE `uc_user_app_bind` SET `update_time` = now(), `nickname` = :#{#resources.nickname}, `status` = 1, `user_app_id` = :#{#resources.userAppId} "
+
" WHERE `account` = :#{#resources.account} AND `account_type` = :#{#resources.accountType}"
,
nativeQuery
=
true
)
Integer
updateValidStatusAndUserAppIdAndNickname
(
@Param
(
"resources"
)
UserAppBind
resources
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/repository/UserAppRepository.java
View file @
99a9491
...
...
@@ -3,6 +3,8 @@ package com.topdraw.business.module.user.app.repository;
import
com.topdraw.business.module.user.app.domain.UserApp
;
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
java.util.Optional
;
...
...
@@ -16,4 +18,7 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec
Optional
<
UserApp
>
findByUsernameAndPassword
(
String
username
,
String
password
);
@Modifying
@Query
(
value
=
"UPDATE `uc_user_app` SET `update_time` = now(), `last_active_time` = now() WHERE `username` = ?1"
,
nativeQuery
=
true
)
Integer
updateLastActiveTime
(
String
username
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/rest/UserAppController.java
View file @
99a9491
package
com
.
topdraw
.
business
.
module
.
user
.
app
.
rest
;
import
com.topdraw.annotation.AnonymousAccess
;
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.service.UserAppBindService
;
import
com.topdraw.business.module.user.app.service.dto.UserAppBindDTO
;
import
com.topdraw.business.module.user.app.service.dto.UserAppDTO
;
import
com.topdraw.common.ResultInfo
;
import
com.topdraw.annotation.Log
;
import
com.topdraw.business.module.user.app.domain.UserApp
;
import
com.topdraw.business.module.user.app.service.UserAppService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.*
;
import
java.util.Objects
;
/**
* @author XiangHan
* @date 2022-06-27
...
...
@@ -23,35 +30,99 @@ public class UserAppController {
@Autowired
private
UserAppService
userAppService
;
@Autowired
private
UserAppBindService
userAppBindService
;
@Log
@PostMapping
@ApiOperation
(
"
新增UserApp
"
)
@PostMapping
(
value
=
"/updateLastActiveTime"
)
@ApiOperation
(
"
修改app账号最新登录时间
"
)
@AnonymousAccess
public
ResultInfo
create
(
@Validated
@RequestBody
UserApp
resources
)
{
log
.
info
(
"新增App账号 ==>> param ==>> [addLogin#{}]"
,
resources
);
public
ResultInfo
updateLastActiveTime
(
@Validated
@RequestBody
UserAppBind
resources
)
{
log
.
info
(
"保存第三方账号 ==>> param ==>> [updateLastActiveTime#{}]"
,
resources
);
String
username
=
resources
.
getUsername
();
if
(
StringUtils
.
isBlank
(
username
))
{
log
.
error
(
"修改app账号最新登录时间失败,参数错误,app账号不得为空,[updateLastActiveTime#{}]"
,
resources
);
return
ResultInfo
.
failure
(
"修改app账号最新登录时间失败,参数错误,app账号不得为空"
);
}
boolean
result
=
this
.
userAppService
.
updateLastActiveTime
(
resources
);
return
ResultInfo
.
success
(
result
);
}
this
.
userAppService
.
create
(
resources
);
return
ResultInfo
.
success
();
@Log
@PostMapping
(
value
=
"/saveThirdAccount"
)
@ApiOperation
(
"保存第三方账号"
)
@AnonymousAccess
public
ResultInfo
saveThirdAccount
(
@Validated
@RequestBody
UserAppBind
resources
)
{
log
.
info
(
"保存第三方账号, 参数 ==>> [saveUserBindApp#{}]"
,
resources
);
String
username
=
resources
.
getUsername
();
if
(
StringUtils
.
isBlank
(
username
))
{
log
.
error
(
"修改app账号最新登录时间失败,参数错误,app账号不得为空,[updateLastActiveTime#{}]"
,
resources
);
return
ResultInfo
.
failure
(
"修改app账号最新登录时间失败,参数错误,app账号不得为空"
);
}
UserAppDTO
userAppDTO
=
this
.
userAppService
.
findByUsername
(
username
);
if
(
Objects
.
nonNull
(
userAppDTO
.
getId
()))
{
Long
id
=
userAppDTO
.
getId
();
resources
.
setUserAppId
(
id
);
}
UserAppBindDTO
userAppBindDTO
=
this
.
userAppBindService
.
create
(
resources
);
return
ResultInfo
.
success
(
userAppBindDTO
);
}
@Log
@P
utMapping
@ApiOperation
(
"修改
UserApp
"
)
@P
ostMapping
(
value
=
"/updateValidStatusAndUserAppIdAndNickname"
)
@ApiOperation
(
"修改
第三方账号
"
)
@AnonymousAccess
public
ResultInfo
update
(
@Validated
@RequestBody
UserApp
resources
)
{
this
.
userAppService
.
update
(
resources
);
return
ResultInfo
.
success
();
public
ResultInfo
updateValidStatusAndUserAppIdAndNickname
(
@Validated
@RequestBody
UserAppBind
resources
)
{
log
.
info
(
"修改第三方账号 ==>> param ==>> [updateThirdAccountStatusAndUserAppId#{}]"
,
resources
);
String
username
=
resources
.
getUsername
();
if
(
StringUtils
.
isBlank
(
username
))
{
log
.
error
(
"修改app账号最新登录时间失败,参数错误,app账号不得为空,[updateLastActiveTime#{}]"
,
resources
);
return
ResultInfo
.
failure
(
"修改app账号最新登录时间失败,参数错误,app账号不得为空"
);
}
String
account
=
resources
.
getAccount
();
Integer
accountType
=
resources
.
getAccountType
();
if
(
StringUtils
.
isBlank
(
account
)
||
Objects
.
isNull
(
accountType
))
{
log
.
error
(
"检查app账号是否绑定了第三方账号失败, 参数错误, 第三方账号或者第三方账号类型不得为空 [checkThirdAccount# resources ==>> {}]"
,
resources
);
return
ResultInfo
.
failure
(
"检查第三方账号是否绑定了第三方账号失败, 参数错误, 第三方账号或者第三方账号类型不得为空"
);
}
UserAppDTO
userAppDTO
=
this
.
userAppService
.
findByUsername
(
username
);
if
(
Objects
.
nonNull
(
userAppDTO
.
getId
()))
{
Long
id
=
userAppDTO
.
getId
();
resources
.
setUserAppId
(
id
);
}
else
{
log
.
error
(
"修改第三方账号, 参数错误, app账号不得为空 [updateValidStatusAndUserAppIdAndNickname# resources ==>> {}]"
,
resources
);
return
ResultInfo
.
failure
(
"修改第三方账号, 参数错误, app账号不得为空"
);
}
boolean
result
=
this
.
userAppBindService
.
updateValidStatusAndUserAppIdAndNickname
(
resources
);
return
ResultInfo
.
success
(
result
);
}
@Log
@
DeleteMapping
(
value
=
"/{id}
"
)
@ApiOperation
(
"
删除UserApp
"
)
@
PostMapping
(
value
=
"/updateThirdAccountStatusAndUserAppId
"
)
@ApiOperation
(
"
修改第三方账号昵称
"
)
@AnonymousAccess
public
ResultInfo
delete
(
@PathVariable
Long
id
)
{
this
.
userAppService
.
delete
(
id
);
return
ResultInfo
.
success
();
public
ResultInfo
updateThirdAccountNickname
(
@Validated
@RequestBody
UserAppBind
resources
)
{
log
.
info
(
"修改第三方账号 ==>> param ==>> [updateThirdAccountNickname#{}]"
,
resources
);
String
account
=
resources
.
getAccount
();
Integer
accountType
=
resources
.
getAccountType
();
if
(
StringUtils
.
isBlank
(
account
)
||
Objects
.
isNull
(
accountType
))
{
log
.
error
(
"修改第三方账号昵称, 参数错误, 第三方账号或者第三方账号类型不得为空 [checkThirdAccount# resources ==>> {}]"
,
resources
);
return
ResultInfo
.
failure
(
"修改第三方账号昵称, 参数错误, 第三方账号或者第三方账号类型不得为空"
);
}
String
nickname
=
resources
.
getNickname
();
if
(
StringUtils
.
isBlank
(
nickname
))
{
log
.
error
(
"修改第三方账号昵称, 参数错误, 昵称不得为空 [updateThirdAccountNickname# resources ==>> {}]"
,
resources
);
return
ResultInfo
.
failure
(
"修改第三方账号昵称, 参数错误, 昵称不得为空"
);
}
boolean
result
=
this
.
userAppBindService
.
updateThirdAccountNickname
(
resources
);
return
ResultInfo
.
success
(
result
);
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/UserAppBindService.java
View file @
99a9491
...
...
@@ -20,7 +20,7 @@ public interface UserAppBindService {
*
* @param resources
*/
void
create
(
UserAppBind
resources
);
UserAppBindDTO
create
(
UserAppBind
resources
);
/**
*
...
...
@@ -46,7 +46,7 @@ public interface UserAppBindService {
* @param account
* @return
*/
Integer
cancelUserAppBind
(
String
account
);
boolean
cancelUserAppBind
(
String
account
,
Integer
accountType
);
/**
*
...
...
@@ -58,7 +58,22 @@ public interface UserAppBindService {
/**
*
* @param resources
* @return
*/
boolean
updateThirdAccount
(
UserAppBind
resources
);
/**
*
* @param resources
* @return
*/
boolean
updateThirdAccountNickname
(
UserAppBind
resources
);
/**
*
* @param resources
* @return
*/
Integer
updateUserAppBind
(
UserAppBind
userAppBind
);
boolean
updateValidStatusAndUserAppIdAndNickname
(
UserAppBind
resources
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/UserAppService.java
View file @
99a9491
package
com
.
topdraw
.
business
.
module
.
user
.
app
.
service
;
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.service.dto.UserAppDTO
;
/**
...
...
@@ -25,29 +26,6 @@ public interface UserAppService {
/**
* 检查账号和秘密
* @param username
* @param password
* @return
*/
UserAppDTO
findByUsernameAndPassword
(
String
username
,
String
password
);
/**
* 检查账号和验证码
* @param username
* @param VerificationCode
* @return
*/
UserAppDTO
findByUsernameAndVerificationCode
(
String
username
,
String
VerificationCode
);
/**
* 检查通过第三方账号
* @param relationAccount
* @return
*/
UserAppDTO
findByRelationAccount
(
String
relationAccount
);
/**
*
* @param resources
*/
...
...
@@ -65,4 +43,10 @@ public interface UserAppService {
*/
void
delete
(
Long
id
);
/**
*
* @param resources
* @return
*/
boolean
updateLastActiveTime
(
UserAppBind
resources
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/impl/UserAppBindServiceImpl.java
View file @
99a9491
...
...
@@ -36,8 +36,9 @@ public class UserAppBindServiceImpl implements UserAppBindService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
create
(
UserAppBind
resources
)
{
this
.
userAppBindRepository
.
save
(
resources
);
public
UserAppBindDTO
create
(
UserAppBind
resources
)
{
UserAppBind
userAppBind
=
this
.
userAppBindRepository
.
save
(
resources
);
return
this
.
userAppBindMapper
.
toDto
(
userAppBind
);
}
@Override
...
...
@@ -66,8 +67,8 @@ public class UserAppBindServiceImpl implements UserAppBindService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Integer
cancelUserAppBind
(
String
account
)
{
return
this
.
userAppBindRepository
.
cancelUserAppBind
(
account
)
;
public
boolean
cancelUserAppBind
(
String
account
,
Integer
accountType
)
{
return
this
.
userAppBindRepository
.
cancelUserAppBind
(
account
,
accountType
)
>
0
;
}
@Override
...
...
@@ -79,8 +80,20 @@ public class UserAppBindServiceImpl implements UserAppBindService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Integer
updateUserAppBind
(
UserAppBind
userAppBind
)
{
return
this
.
userAppBindRepository
.
updateUserAppBind
(
userAppBind
);
public
boolean
updateThirdAccount
(
UserAppBind
resources
)
{
return
this
.
userAppBindRepository
.
updateThirdAccount
(
resources
)
>
0
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
updateThirdAccountNickname
(
UserAppBind
resources
)
{
return
this
.
userAppBindRepository
.
updateThirdAccountNickname
(
resources
)
>
0
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
updateValidStatusAndUserAppIdAndNickname
(
UserAppBind
resources
)
{
return
this
.
userAppBindRepository
.
updateValidStatusAndUserAppIdAndNickname
(
resources
)
>
0
;
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/impl/UserAppServiceImpl.java
View file @
99a9491
package
com
.
topdraw
.
business
.
module
.
user
.
app
.
service
.
impl
;
import
com.topdraw.business.module.member.domain.Member
;
import
com.topdraw.business.module.member.domain.MemberBuilder
;
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.user.app.domain.UserApp
;
import
com.topdraw.business.module.user.app.domain.UserAppBind
;
import
com.topdraw.utils.ValidationUtil
;
import
com.topdraw.business.module.user.app.repository.UserAppRepository
;
import
com.topdraw.business.module.user.app.service.UserAppService
;
...
...
@@ -52,27 +48,6 @@ public class UserAppServiceImpl implements UserAppService {
}
@Override
@Transactional
(
readOnly
=
true
)
public
UserAppDTO
findByUsernameAndPassword
(
String
username
,
String
password
)
{
UserApp
userApp
=
this
.
userAppRepository
.
findByUsernameAndPassword
(
username
,
password
).
orElseGet
(
UserApp:
:
new
);
return
this
.
userAppMapper
.
toDto
(
userApp
);
}
@Override
@Transactional
(
readOnly
=
true
)
public
UserAppDTO
findByUsernameAndVerificationCode
(
String
username
,
String
VerificationCode
)
{
// TDDO 需要接入短信网关
UserApp
userApp
=
null
;
return
this
.
userAppMapper
.
toDto
(
userApp
);
}
@Override
@Transactional
(
readOnly
=
true
)
public
UserAppDTO
findByRelationAccount
(
String
relationAccount
)
{
return
null
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
UserAppDTO
create
(
UserApp
resources
)
{
UserApp
userApp
=
this
.
userAppRepository
.
save
(
resources
);
...
...
@@ -102,5 +77,11 @@ public class UserAppServiceImpl implements UserAppService {
this
.
userAppRepository
.
delete
(
UserApp
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
updateLastActiveTime
(
UserAppBind
resources
)
{
return
this
.
userAppRepository
.
updateLastActiveTime
(
resources
.
getUsername
())
>
0
;
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
View file @
99a9491
...
...
@@ -10,6 +10,7 @@ import com.topdraw.business.module.common.validated.UpdateGroup;
import
com.topdraw.business.module.member.service.MemberService
;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
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.service.dto.UserAppDTO
;
import
com.topdraw.business.module.user.iptv.domain.UserTv
;
import
com.topdraw.business.module.user.iptv.service.dto.UserTvDTO
;
...
...
@@ -27,7 +28,6 @@ import com.topdraw.exception.GlobeExceptionMsg;
import
com.topdraw.resttemplate.RestTemplateClient
;
import
com.topdraw.util.Base64Util
;
import
com.topdraw.util.JSONUtil
;
import
com.topdraw.util.RegexUtil
;
import
com.topdraw.utils.RedisUtils
;
import
com.topdraw.weixin.util.WeChatConstants
;
import
com.topdraw.weixin.util.WeixinUtil
;
...
...
@@ -107,10 +107,10 @@ public class UserOperationController {
}
@Log
@PostMapping
(
value
=
"/appBind
User
Account"
)
@PostMapping
(
value
=
"/appBind
Third
Account"
)
@ApiOperation
(
"app账号绑定第三方账号"
)
@AnonymousAccess
public
ResultInfo
appBind
UserAccount
(
@Validated
@RequestBody
UserApp
resources
)
{
public
ResultInfo
appBind
ThirdAccount
(
@Validated
@RequestBody
UserAppBind
resources
)
{
log
.
info
(
"app账号绑定第三方账号,参数 ==>> [appBindUserAccount#{}]"
,
resources
);
String
username
=
resources
.
getUsername
();
...
...
@@ -134,7 +134,7 @@ public class UserOperationController {
return
ResultInfo
.
failure
(
"app账号绑定第三方账号,参数错误,第三方账号类型不得为空"
);
}
boolean
result
=
this
.
userOperationService
.
appBind
User
Account
(
resources
);
boolean
result
=
this
.
userOperationService
.
appBind
Third
Account
(
resources
);
return
ResultInfo
.
success
(
result
);
}
...
...
@@ -145,21 +145,28 @@ public class UserOperationController {
public
ResultInfo
updateUserApp
(
@Validated
@RequestBody
UserApp
resources
)
{
log
.
info
(
"修改app账号信息 ==>> param ==>> [updateUserApp#{}]"
,
resources
);
return
ResultInfo
.
success
();
UserAppDTO
userAppDTO
=
this
.
userOperationService
.
updateUserApp
(
resources
);
return
ResultInfo
.
success
(
userAppDTO
);
}
@Log
@PostMapping
(
value
=
"/cancelUserAppBind"
)
@ApiOperation
(
"取消关联第三方账号"
)
@AnonymousAccess
public
ResultInfo
cancelUserAppBind
(
@Validated
@RequestBody
UserApp
resources
)
{
log
.
info
(
"
修改app账号信息 ==>> param
==>> [updateUserApp#{}]"
,
resources
);
public
ResultInfo
cancelUserAppBind
(
@Validated
@RequestBody
UserApp
Bind
resources
)
{
log
.
info
(
"
取消关联第三方账号, 参数
==>> [updateUserApp#{}]"
,
resources
);
String
account
=
resources
.
getAccount
();
if
(
StringUtils
.
isBlank
(
account
))
{
log
.
error
(
"参数错误,第三方账号不能为空"
);
return
ResultInfo
.
failure
(
"参数错误,第三方账号不能为空"
);
log
.
error
(
"取消关联第三方账号失败,参数错误了,第三方账号不能为空"
);
return
ResultInfo
.
failure
(
"取消关联第三方账号失败,参数错误,第三方账号不能为空"
);
}
// 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号
Integer
accountType
=
resources
.
getAccountType
();
if
(
Objects
.
isNull
(
accountType
))
{
log
.
error
(
"取消关联第三方账号失败,参数错误,第三方账号类型不得为空"
);
return
ResultInfo
.
failure
(
"取消关联第三方账号失败,参数错误,第三方账号类型不得为空"
);
}
boolean
result
=
this
.
userOperationService
.
cancelUserAppBind
(
resources
);
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/UserOperationService.java
View file @
99a9491
...
...
@@ -2,6 +2,7 @@ package com.topdraw.business.process.service;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
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.service.dto.UserAppDTO
;
import
com.topdraw.business.module.user.iptv.domain.UserTv
;
import
com.topdraw.business.module.user.iptv.service.dto.UserTvDTO
;
...
...
@@ -182,13 +183,19 @@ public interface UserOperationService {
* @param resources
* @return
*/
boolean
cancelUserAppBind
(
UserApp
resources
);
boolean
cancelUserAppBind
(
UserApp
Bind
resources
);
/**
*
* @param resources
* @return
*/
boolean
appBind
UserAccount
(
UserApp
resources
);
boolean
appBind
ThirdAccount
(
UserAppBind
resources
);
/**
*
* @param resources
* @return
*/
UserAppDTO
updateUserApp
(
UserApp
resources
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
99a9491
...
...
@@ -83,10 +83,10 @@ public class UserOperationServiceImpl implements UserOperationService {
@Autowired
private
UserAppService
userAppService
;
@Autowired
private
UserAppBindService
userAppBindService
;
@Autowired
private
UserWeixinService
userWeixinService
;
@Autowired
private
UserAppBindService
userAppBindService
;
@Autowired
private
UserWeixinRepository
userWeixinRepository
;
@Autowired
private
UserCollectionService
userCollectionService
;
...
...
@@ -152,31 +152,40 @@ public class UserOperationServiceImpl implements UserOperationService {
}
@Override
public
boolean
cancelUserAppBind
(
UserApp
resources
)
{
public
boolean
cancelUserAppBind
(
UserApp
Bind
resources
)
{
String
account
=
resources
.
getAccount
();
UserAppBindDTO
userAppBindDTO
=
this
.
userAppBindService
.
findFirstByAccount
(
account
);
Integer
accountType
=
resources
.
getAccountType
();
UserAppBindDTO
userAppBindDTO
=
this
.
userAppBindService
.
findFirstByAccountAndAccountType
(
account
,
accountType
);
if
(
Objects
.
nonNull
(
userAppBindDTO
.
getId
()))
{
Integer
count
=
this
.
userAppBindService
.
cancelUserAppBind
(
account
);
if
(
count
==
1
)
{
return
true
;
}
return
this
.
userAppBindService
.
cancelUserAppBind
(
account
,
accountType
);
}
return
false
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
appBindUserAccount
(
UserApp
resources
)
{
public
boolean
appBindThirdAccount
(
UserAppBind
resources
)
{
String
username
=
resources
.
getUsername
();
UserAppDTO
userAppDTO
=
this
.
userAppService
.
findByUsername
(
username
);
if
(
Objects
.
isNull
(
userAppDTO
.
getId
()))
{
return
false
;
}
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
;
resources
.
setUserAppId
(
userAppDTO
.
getId
()
);
return
this
.
userAppBindService
.
updateValidStatusAndUserAppIdAndNickname
(
resources
)
;
}
return
false
;
}
@Override
public
UserAppDTO
updateUserApp
(
UserApp
resources
)
{
return
this
.
userAppService
.
update
(
resources
);
}
/**
* 创建大屏账户同时创建会员
*
...
...
Please
register
or
sign in
to post a comment