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
2cd36de6
...
2cd36de62f83d99a6059fb7a9d32771765043143
authored
2022-05-16 18:46:14 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.优化
1 parent
9585ccf4
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
138 additions
and
42 deletions
member-service-impl/src/main/java/com/topdraw/business/module/contact/vis/rest/ActivityAddressController.java
member-service-impl/src/main/java/com/topdraw/business/module/member/profile/domain/MemberProfile.java
member-service-impl/src/main/java/com/topdraw/business/module/member/profile/domain/MemberProfileBuilder.java
member-service-impl/src/main/java/com/topdraw/business/module/member/profile/rest/MemberProfileController.java
member-service-impl/src/main/java/com/topdraw/business/module/member/profile/service/MemberProfileService.java
member-service-impl/src/main/java/com/topdraw/business/module/member/profile/service/impl/MemberProfileServiceImpl.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/process/domian/member/MemberOperationBean.java
member-service-impl/src/main/java/com/topdraw/business/process/rest/MemberOperationController.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/impl/member/MemberProfileOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/service/member/MemberProfileOperationService.java
member-service-impl/src/main/java/com/topdraw/business/module/contact/vis/rest/ActivityAddressController.java
View file @
2cd36de
...
...
@@ -6,10 +6,11 @@ import com.topdraw.business.module.contact.vis.service.dto.ActivityAddressDTO;
import
com.topdraw.common.ResultInfo
;
import
com.topdraw.business.module.contact.vis.domain.ActivityAddress
;
import
com.topdraw.business.module.contact.vis.service.ActivityAddressService
;
import
com.topdraw.exception.BadRequestException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.Assert
;
import
org.springframework.util.StringUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.*
;
...
...
@@ -33,17 +34,22 @@ public class ActivityAddressController {
@GetMapping
(
value
=
"/findByPlatformAccountAndActivityId"
)
@ApiOperation
(
"查询指定活动事件的中奖人联系方式"
)
@AnonymousAccess
public
ResultInfo
findByPlatformAccountAndActivityId
(
@Validated
@RequestBody
ActivityAddress
resources
)
{
log
.
info
(
"activityAddress ==>> findByPlatformAccountAndActivityId ==>> resources ==>> {}"
,
resources
);
String
platformAccount
=
resources
.
getPlatformAccount
();
if
(!
StringUtils
.
hasText
(
platformAccount
))
{
Assert
.
notNull
(
platformAccount
,
"platformAccount is null"
);
public
ResultInfo
findByPlatformAccountAndActivityId
(
@RequestParam
(
value
=
"platformAccount"
)
String
platformAccount
,
@RequestParam
(
value
=
"activityId"
)
Long
activityId
)
{
log
.
info
(
"activityAddress ==>> findByPlatformAccountAndActivityId ==>> platformAccount ==>> {}"
,
platformAccount
);
log
.
info
(
"activityAddress ==>> findByPlatformAccountAndActivityId ==>> activityId ==>> {}"
,
activityId
);
if
(
StringUtils
.
isBlank
(
platformAccount
))
{
throw
new
BadRequestException
(
"platformAccount is nul"
);
}
Long
activityId
=
resources
.
getActivityId
();
if
(
Objects
.
isNull
(
activityId
))
{
Assert
.
notNull
(
activityId
,
"activityId is nul
l"
);
throw
new
BadRequestException
(
"activityId is nu
l"
);
}
ActivityAddressDTO
activityAddressDTO
=
this
.
activityAddressService
.
findByPlatformAccountAndActivityId
(
resources
);
ActivityAddress
activityAddress
=
new
ActivityAddress
();
activityAddress
.
setPlatformAccount
(
platformAccount
);
activityAddress
.
setActivityId
(
activityId
);
ActivityAddressDTO
activityAddressDTO
=
this
.
activityAddressService
.
findByPlatformAccountAndActivityId
(
activityAddress
);
return
ResultInfo
.
success
(
activityAddressDTO
);
}
...
...
@@ -63,32 +69,32 @@ public class ActivityAddressController {
public
ResultInfo
createOrUpdateActivityAddress
(
@Validated
@RequestBody
ActivityAddress
resources
)
{
log
.
info
(
"activityAddress ==>> createOrUpdateActivityAddress ==>> params ==>> {}"
,
resources
);
String
platformAccount
=
resources
.
getPlatformAccount
();
if
(
!
StringUtils
.
hasText
(
platformAccount
))
{
Assert
.
notNull
(
platformAccount
,
"platformAccount is null"
);
if
(
StringUtils
.
isBlank
(
platformAccount
))
{
throw
new
BadRequestException
(
"platformAccount is null"
);
}
Long
appId
=
resources
.
getAppId
();
if
(
Objects
.
isNull
(
appId
))
{
Assert
.
notNull
(
appId
,
"appId is null"
);
throw
new
BadRequestException
(
"appId is null"
);
}
Long
activityId
=
resources
.
getActivityId
();
if
(
Objects
.
isNull
(
activityId
))
{
Assert
.
notNull
(
activityId
,
"activityId is null"
);
throw
new
BadRequestException
(
"activityId is null"
);
}
Long
userId
=
resources
.
getUserId
();
if
(
Objects
.
isNull
(
userId
))
{
Assert
.
notNull
(
userId
,
"visUserId is null"
);
throw
new
BadRequestException
(
"visUserId is null"
);
}
String
name
=
resources
.
getName
();
if
(
!
StringUtils
.
hasText
(
name
))
{
Assert
.
notNull
(
name
,
"name is null"
);
if
(
StringUtils
.
isBlank
(
name
))
{
throw
new
BadRequestException
(
"name is null"
);
}
String
cellphone
=
resources
.
getCellphone
();
if
(
!
StringUtils
.
hasText
(
cellphone
))
{
Assert
.
notNull
(
cellphone
,
"cellphone is null"
);
if
(
StringUtils
.
isBlank
(
cellphone
))
{
throw
new
BadRequestException
(
"cellphone is null"
);
}
String
address
=
resources
.
getAddress
();
if
(
!
StringUtils
.
hasText
(
address
))
{
Assert
.
notNull
(
address
,
"address is null"
);
if
(
StringUtils
.
isBlank
(
address
))
{
throw
new
BadRequestException
(
"address is null"
);
}
ActivityAddressDTO
activityAddressDTO
=
this
.
activityAddressService
.
createOrUpdateActivityAddress
(
resources
);
return
ResultInfo
.
success
(
activityAddressDTO
);
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/profile/domain/MemberProfile.java
View file @
2cd36de
package
com
.
topdraw
.
business
.
module
.
member
.
profile
.
domain
;
import
com.topdraw.business.module.common.validated.CreateGroup
;
import
com.topdraw.business.module.common.validated.UpdateGroup
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
...
...
@@ -44,6 +45,7 @@ public class MemberProfile implements Serializable {
/** 会员id */
@Column
(
name
=
"member_id"
,
nullable
=
false
)
@NotNull
(
message
=
"memberId not be null!!"
,
groups
=
{
CreateGroup
.
class
})
private
Long
memberId
;
/** 姓名 */
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/profile/domain/MemberProfileBuilder.java
View file @
2cd36de
...
...
@@ -5,6 +5,8 @@ import com.topdraw.exception.GlobeExceptionMsg;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.util.Assert
;
import
java.util.Objects
;
public
class
MemberProfileBuilder
{
public
static
MemberProfile
build
(
Member
member
){
...
...
@@ -67,13 +69,13 @@ public class MemberProfileBuilder {
memberProfile
.
setCountry
(
stringIsNull
(
resources
.
getCountry
()));
memberProfile
.
setDistrict
(
stringIsNull
(
resources
.
getDistrict
()));
memberProfile
.
setCity
(
stringIsNull
(
resources
.
getCity
()));
memberProfile
.
setIdCard
(
StringUtils
.
isBlank
(
resources
.
getIdCard
())
?
"000000000000000000"
:
resources
.
getIdCard
());
memberProfile
.
setIdCard
(
StringUtils
.
isBlank
(
resources
.
getIdCard
())
?
"000000000000000000"
:
resources
.
getIdCard
());
memberProfile
.
setProvince
(
stringIsNull
(
resources
.
getProvince
()));
memberProfile
.
setEmail
(
stringIsNull
(
resources
.
getEmail
()));
memberProfile
.
setDescription
(
stringIsNull
(
resources
.
getDescription
()));
memberProfile
.
setPhone
(
stringIsNull
(
resources
.
getPhone
()));
memberProfile
.
setConstellation
(
stringIsNull
(
resources
.
getConstellation
()));
memberProfile
.
setBirthday
(
stringIsNull
(
resources
.
getBirthday
()
));
memberProfile
.
setBirthday
(
Objects
.
isNull
(
resources
.
getBirthday
())
?
"1900-01-01"
:
resources
.
getBirthday
(
));
return
memberProfile
;
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/profile/rest/MemberProfileController.java
View file @
2cd36de
...
...
@@ -2,6 +2,7 @@ package com.topdraw.business.module.member.profile.rest;
import
com.topdraw.annotation.AnonymousAccess
;
import
com.topdraw.aop.log.Log
;
import
com.topdraw.business.module.common.validated.CreateGroup
;
import
com.topdraw.business.module.common.validated.UpdateGroup
;
import
com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO
;
import
com.topdraw.business.process.service.member.MemberProfileOperationService
;
...
...
@@ -53,4 +54,19 @@ public class MemberProfileController {
MemberProfileDTO
memberProfileDTO
=
this
.
memberProfileOperationService
.
updateMemberProfileAndMember
(
resources
);
return
ResultInfo
.
success
(
memberProfileDTO
);
}
@Log
(
"新增会员属性"
)
@RequestMapping
(
value
=
"/create"
)
@ApiOperation
(
"新增会员属性"
)
@AnonymousAccess
@Deprecated
public
ResultInfo
create
(
@Validated
(
value
=
{
CreateGroup
.
class
})
@RequestBody
MemberProfile
resources
)
{
log
.
info
(
"memberProfile ==>> update ==>> resources ===>> [{}]"
,
resources
);
MemberProfileDTO
memberProfileDTO
=
this
.
memberProfileOperationService
.
createMemberProfileAndSyncMember
(
resources
);
log
.
info
(
"memberProfile ==>> update ==>> result ===>> [{}]"
,
memberProfileDTO
);
return
ResultInfo
.
success
(
memberProfileDTO
);
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/profile/service/MemberProfileService.java
View file @
2cd36de
...
...
@@ -23,28 +23,28 @@ public interface MemberProfileService {
* @param resources 会员基本信息
* @return
*/
MemberProfile
create
(
MemberProfile
resources
);
MemberProfile
DTO
create
(
MemberProfile
resources
);
/**
* 默认属性
* @param resources
* @return
*/
MemberProfile
createDefault
(
MemberProfile
resources
);
MemberProfile
DTO
createDefault
(
MemberProfile
resources
);
/**
* 通过会员创建默认属性
* @param resources
* @return
*/
MemberProfile
createDefault
(
Member
resources
);
MemberProfile
DTO
createDefault
(
Member
resources
);
/**
* 通过会员id创建默认属性
* @param resources
* @return
*/
MemberProfile
createDefaultByMemberId
(
Long
resources
);
MemberProfile
DTO
createDefaultByMemberId
(
Long
resources
);
/**
* 修改
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/profile/service/impl/MemberProfileServiceImpl.java
View file @
2cd36de
...
...
@@ -53,7 +53,7 @@ public class MemberProfileServiceImpl implements MemberProfileService {
public
MemberProfileDTO
findByMemberId
(
Long
memberId
)
{
log
.
info
(
"MemberProfileDTO ==>> findByMemberId ==>> resources ===>> [{}]"
,
memberId
);
MemberProfile
memberProfile
=
this
.
memberProfileRepository
.
findByMemberId
(
memberId
).
orElseGet
(
MemberProfile:
:
new
);
ValidationUtil
.
isNull
(
memberProfile
.
getId
(),
"MemberProfile"
,
"memberId"
,
memberId
);
//
ValidationUtil.isNull(memberProfile.getId(),"MemberProfile","memberId",memberId);
return
this
.
memberProfileMapper
.
toDto
(
memberProfile
);
}
...
...
@@ -67,33 +67,35 @@ public class MemberProfileServiceImpl implements MemberProfileService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
MemberProfile
create
(
MemberProfile
resources
)
{
public
MemberProfile
DTO
create
(
MemberProfile
resources
)
{
log
.
info
(
"MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]"
,
resources
);
// 检查会员
this
.
checkMember
(
resources
);
this
.
memberProfileRepository
.
save
(
resources
);
MemberProfile
_memberProfile
=
this
.
memberProfileRepository
.
save
(
resources
);
return
resources
;
MemberProfileDTO
memberProfileDTO
=
new
MemberProfileDTO
();
BeanUtils
.
copyProperties
(
_memberProfile
,
memberProfileDTO
);
return
memberProfileDTO
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
MemberProfile
createDefault
(
MemberProfile
resources
)
{
public
MemberProfile
DTO
createDefault
(
MemberProfile
resources
)
{
MemberProfile
memberProfile
=
MemberProfileBuilder
.
build
(
resources
);
return
this
.
create
(
memberProfile
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
MemberProfile
createDefault
(
Member
resources
)
{
public
MemberProfile
DTO
createDefault
(
Member
resources
)
{
MemberProfile
memberProfile
=
MemberProfileBuilder
.
build
(
resources
);
return
this
.
create
(
memberProfile
);
}
@Override
public
MemberProfile
createDefaultByMemberId
(
Long
resources
)
{
public
MemberProfile
DTO
createDefaultByMemberId
(
Long
resources
)
{
MemberProfile
memberProfile
=
MemberProfileBuilder
.
build
(
resources
);
return
this
.
create
(
memberProfile
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/member/service/impl/MemberServiceImpl.java
View file @
2cd36de
...
...
@@ -55,8 +55,6 @@ public class MemberServiceImpl implements MemberService {
@Override
public
MemberDTO
findById
(
Long
id
)
{
Member
member
=
this
.
memberRepository
.
findById
(
id
).
orElseGet
(
Member:
:
new
);
// ValidationUtil.isNull(member.getId(),"Member","id",id);
return
this
.
memberMapper
.
toDto
(
member
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/domian/member/MemberOperationBean.java
View file @
2cd36de
package
com
.
topdraw
.
business
.
process
.
domian
.
member
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.sql.Timestamp
;
import
java.time.LocalDateTime
;
/**
* @author :
...
...
@@ -25,4 +23,6 @@ public class MemberOperationBean {
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private
Timestamp
vipExpireTime
;
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/MemberOperationController.java
View file @
2cd36de
...
...
@@ -4,11 +4,13 @@ import com.topdraw.annotation.AnonymousAccess;
import
com.topdraw.aop.log.Log
;
import
com.topdraw.business.module.common.validated.UpdateGroup
;
import
com.topdraw.business.module.member.domain.Member
;
import
com.topdraw.business.module.member.profile.domain.MemberProfile
;
import
com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO
;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
import
com.topdraw.business.process.domian.member.MemberOperationBean
;
import
com.topdraw.business.process.domian.weixin.BuyVipBean
;
import
com.topdraw.business.process.service.member.MemberOperationService
;
import
com.topdraw.business.process.service.member.MemberProfileOperationService
;
import
com.topdraw.common.IResultInfo
;
import
com.topdraw.common.ResultInfo
;
import
com.topdraw.exception.BadRequestException
;
...
...
@@ -34,6 +36,7 @@ public class MemberOperationController {
@Autowired
private
MemberOperationService
memberOperationService
;
@Log
(
"手动修改vip"
)
@RequestMapping
(
value
=
"/updateVipByMemberId"
)
@ApiOperation
(
"手动修改vip"
)
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
2cd36de
...
...
@@ -173,7 +173,7 @@ public class UserOperationServiceImpl implements UserOperationService {
Integer
sex
=
resources
.
getSex
();
// 检查小屏账户是否存在
UserWeixinDTO
userWeixinDTO
=
this
.
findFirstByUnionIdAndAppIdAndOpenId
(
unionId
,
appId
,
openId
);
UserWeixinDTO
userWeixinDTO
=
this
.
findFirstByUnionIdAndAppIdAndOpenId
(
unionId
,
appId
,
openId
);
if
(
Objects
.
nonNull
(
userWeixinDTO
.
getId
()))
{
log
.
error
(
"createWeixinUserAndMember ==>> result ==>> [{}]"
,
userWeixinDTO
);
throw
new
BadRequestException
(
GlobeExceptionMsg
.
OPERATION_FORBID
+
"==>> "
+
GlobeExceptionMsg
.
ENTITY_ALREADY_EXISTS
);
...
...
@@ -183,22 +183,25 @@ public class UserOperationServiceImpl implements UserOperationService {
UserWeixinDTO
_userWeixinDTO
=
this
.
findFirstByUnionId
(
unionId
);
if
(
Objects
.
nonNull
(
_userWeixinDTO
.
getId
()))
{
Assert
.
notNull
(
_userWeixinDTO
.
getMemberId
(),
GlobeExceptionMsg
.
MEMBER_ID_IS_NULL
);
Assert
.
notNull
(
_userWeixinDTO
.
getMemberId
(),
GlobeExceptionMsg
.
MEMBER_ID_IS_NULL
);
// 小屏会员
MemberDTO
memberDTO
=
this
.
findMemberById
(
_userWeixinDTO
.
getMemberId
());
if
(
Objects
.
nonNull
(
memberDTO
))
{
resources
.
setMemberId
(
_userWeixinDTO
.
getMemberId
());
UserWeixin
userWeixin
=
UserWeixinBuilder
.
build
(
resources
);
UserWeixinDTO
weixinDTO
=
this
.
createWeixinUser
(
userWeixin
,
memberDTO
.
getId
(),
memberDTO
.
getCode
());
weixinDTO
.
setMemberCode
(
memberDTO
.
getCode
());
// 同步至iptv
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncWeixin
(
weixinDTO
);
return
weixinDTO
;
}
throw
new
EntityNotFoundException
(
MemberDTO
.
class
,
"code"
,
GlobeExceptionMsg
.
MEMBER_CODE_IS_NULL
);
throw
new
EntityNotFoundException
(
MemberDTO
.
class
,
"code"
,
GlobeExceptionMsg
.
MEMBER_CODE_IS_NULL
);
}
else
{
...
...
@@ -206,6 +209,7 @@ public class UserOperationServiceImpl implements UserOperationService {
Member
_member
=
MemberBuilder
.
build
(
LocalConstants
.
MEMBER_PLATFORM_TYPE_WEIXIN
,
headimgurl
,
nickname
,
0
,
sex
);
MemberDTO
memberDTO
=
this
.
createMember
(
_member
);
if
(
Objects
.
nonNull
(
memberDTO
))
{
...
...
@@ -213,12 +217,13 @@ public class UserOperationServiceImpl implements UserOperationService {
UserWeixinDTO
_userWeixinDTO1
=
this
.
createWeixinUser
(
userWeixin
,
memberDTO
.
getId
(),
memberDTO
.
getCode
());
// 同步至iptv
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncMemberAndUserWeixin4Iptv
(
new
MemberAndWeixinUserDTO
(
memberDTO
,
_userWeixinDTO1
));
((
UserOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncMemberAndUserWeixin4Iptv
(
new
MemberAndWeixinUserDTO
(
memberDTO
,
_userWeixinDTO1
));
return
_userWeixinDTO1
;
}
throw
new
EntityNotFoundException
(
MemberDTO
.
class
,
"code"
,
GlobeExceptionMsg
.
MEMBER_CODE_IS_NULL
);
throw
new
EntityNotFoundException
(
MemberDTO
.
class
,
"code"
,
GlobeExceptionMsg
.
MEMBER_CODE_IS_NULL
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/member/MemberProfileOperationServiceImpl.java
View file @
2cd36de
package
com
.
topdraw
.
business
.
process
.
service
.
impl
.
member
;
import
com.topdraw.aspect.AsyncMqSend
;
import
com.topdraw.business.module.member.domain.Member
;
import
com.topdraw.business.module.member.profile.domain.MemberProfile
;
import
com.topdraw.business.module.member.profile.service.MemberProfileService
;
import
com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO
;
...
...
@@ -8,12 +9,16 @@ import com.topdraw.business.module.member.service.MemberService;
import
com.topdraw.business.module.member.service.dto.MemberDTO
;
import
com.topdraw.business.process.service.dto.MemberProfileAndMemberDTO
;
import
com.topdraw.business.process.service.member.MemberProfileOperationService
;
import
com.topdraw.exception.EntityExistException
;
import
com.topdraw.exception.EntityNotFoundException
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.aop.framework.AopContext
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.validation.constraints.NotNull
;
import
java.util.Objects
;
/**
...
...
@@ -37,6 +42,8 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation
public
void
asyncMemberProfile
(
MemberProfileDTO
memberProfileDTO
){}
@AsyncMqSend
public
void
asyncMemberProfileAndMember
(
MemberProfileAndMemberDTO
memberProfileAndMemberDTO
){}
@AsyncMqSend
public
void
asyncCreateMemberProfile
(
MemberProfileDTO
memberProfileDTO
)
{}
@Override
public
MemberProfileDTO
update
(
MemberProfile
resources
)
{
...
...
@@ -65,4 +72,52 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation
return
memberProfileDTO
;
}
@Override
public
MemberProfileDTO
createMemberProfileAndSyncMember
(
MemberProfile
resources
)
{
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
resources
.
getMemberId
());
if
(
Objects
.
isNull
(
memberDTO
.
getId
()))
throw
new
EntityNotFoundException
(
MemberDTO
.
class
,
"code"
,
memberDTO
.
getCode
());
MemberProfileDTO
_memberProfileDTO
=
this
.
memberProfileService
.
findByMemberId
(
resources
.
getMemberId
());
if
(
Objects
.
isNull
(
_memberProfileDTO
.
getId
()))
{
MemberProfileDTO
memberProfileDTO
=
this
.
memberProfileService
.
createDefault
(
resources
);
memberProfileDTO
.
setMemberCode
(
memberDTO
.
getCode
());
this
.
createMemberProfileAndSyncMember
(
memberProfileDTO
,
memberDTO
);
((
MemberProfileOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncCreateMemberProfile
(
memberProfileDTO
);
}
else
{
throw
new
EntityExistException
(
MemberProfileDTO
.
class
,
"id"
,
_memberProfileDTO
.
getId
().
toString
());
}
return
null
;
}
private
void
createMemberProfile
(
MemberProfileDTO
memberProfileDTO
)
{
MemberProfile
memberProfile
=
new
MemberProfile
();
BeanUtils
.
copyProperties
(
memberProfileDTO
,
memberProfile
);
this
.
memberProfileService
.
createDefault
(
memberProfile
);
}
private
void
createMemberProfileAndSyncMember
(
MemberProfileDTO
memberProfileDTO
,
MemberDTO
memberDTO
)
{
this
.
createMemberProfile
(
memberProfileDTO
);
this
.
syncMember
(
memberProfileDTO
,
memberDTO
);
}
private
void
syncMember
(
MemberProfileDTO
memberProfileDTO
,
MemberDTO
memberDTO
)
{
memberDTO
.
setAvatarUrl
(
memberProfileDTO
.
getAvatarUrl
());
memberDTO
.
setNickname
(
memberProfileDTO
.
getRealname
());
memberDTO
.
setGender
(
memberProfileDTO
.
getGender
());
Member
member
=
new
Member
();
BeanUtils
.
copyProperties
(
memberDTO
,
member
);
this
.
memberService
.
update
(
member
);
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/member/MemberProfileOperationService.java
View file @
2cd36de
...
...
@@ -17,4 +17,11 @@ public interface MemberProfileOperationService {
*/
MemberProfileDTO
updateMemberProfileAndMember
(
MemberProfile
resources
);
/**
*
* @param resources
* @return
*/
MemberProfileDTO
createMemberProfileAndSyncMember
(
MemberProfile
resources
);
}
...
...
Please
register
or
sign in
to post a comment