Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
4ea75dad
Commit
4ea75dad
authored
May 02, 2017
by
minminyan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构returnValue方法,添加接口saveUserDetail实现,findUserSpouseByUserId实现,
等实现
parent
3526c3a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
147 additions
and
44 deletions
+147
-44
MotanUserServiceImpl.java
.../xyqb/controller/external/motan/MotanUserServiceImpl.java
+147
-44
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/motan/MotanUserServiceImpl.java
View file @
4ea75dad
...
@@ -75,29 +75,31 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -75,29 +75,31 @@ public class MotanUserServiceImpl implements UserMotanService {
private
IUserExtInfoService
userExtInfoService
;
private
IUserExtInfoService
userExtInfoService
;
@Autowired
@Autowired
private
IWechatService
wechatService
;
private
IWechatService
wechatService
;
@Autowired
private
IUserSpouseService
userSpouseService
;
@Override
@Override
public
UserSysResult
<
XUser
>
findUserByPhoneNo
(
String
phoneNo
)
{
public
UserSysResult
<
XUser
>
findUserByPhoneNo
(
String
phoneNo
)
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
return
return
Value
(
null
,
"手机号格式不正确"
);
return
return
ErrorValue
(
"手机号格式不正确"
);
}
}
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
return
return
Value
(
fromUser
(
user
),
""
);
return
return
SuccessValue
(
fromUser
(
user
)
);
}
}
@Override
@Override
public
UserSysResult
<
XUser
>
findUserByUuid
(
String
uuid
)
{
public
UserSysResult
<
XUser
>
findUserByUuid
(
String
uuid
)
{
if
(
StringUtils
.
isBlank
(
uuid
))
{
if
(
StringUtils
.
isBlank
(
uuid
))
{
return
return
Value
(
null
,
"参数不能为空"
);
return
return
ErrorValue
(
"参数不能为空"
);
}
}
User
user
=
userService
.
findByUuidInDb
(
uuid
);
User
user
=
userService
.
findByUuidInDb
(
uuid
);
return
return
Value
(
fromUser
(
user
),
""
);
return
return
SuccessValue
(
fromUser
(
user
)
);
}
}
@Override
@Override
public
UserSysResult
<
XUser
>
saveUser
(
UserBean
userBean
)
{
public
UserSysResult
<
XUser
>
saveUser
(
UserBean
userBean
)
{
if
(
null
==
userBean
||
!
ValidationUtil
.
validatePhoneNo
(
userBean
.
getPhoneNo
()))
{
if
(
null
==
userBean
||
!
ValidationUtil
.
validatePhoneNo
(
userBean
.
getPhoneNo
()))
{
return
return
Value
(
null
,
userBean
==
null
?
"要保存的用户对象不能为null"
:
"手机号不正确"
);
return
return
ErrorValue
(
userBean
==
null
?
"要保存的用户对象不能为null"
:
"手机号不正确"
);
}
}
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
User
user
=
userService
.
findByPhoneWithCache
(
userBean
.
getPhoneNo
());
User
user
=
userService
.
findByPhoneWithCache
(
userBean
.
getPhoneNo
());
...
@@ -120,17 +122,17 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -120,17 +122,17 @@ public class MotanUserServiceImpl implements UserMotanService {
user
.
setUuid
(
userBean
.
getUuid
());
user
.
setUuid
(
userBean
.
getUuid
());
user
.
setRegisteredFrom
(
userBean
.
getRegisteredFrom
());
user
.
setRegisteredFrom
(
userBean
.
getRegisteredFrom
());
User
saveUser
=
userService
.
saveUser
(
user
);
User
saveUser
=
userService
.
saveUser
(
user
);
return
return
Value
(
fromUser
(
saveUser
),
""
);
return
return
SuccessValue
(
fromUser
(
saveUser
)
);
}
}
@Override
@Override
public
UserSysResult
<
XUserDetail
>
findUserDetailByUserId
(
Long
userId
)
{
public
UserSysResult
<
XUserDetail
>
findUserDetailByUserId
(
Long
userId
)
{
if
(
userId
==
null
||
userId
.
longValue
()
<
1
)
{
if
(
userId
==
null
||
userId
.
longValue
()
<
1
)
{
return
return
Value
(
null
,
"参数必须是正整数"
);
return
return
ErrorValue
(
"参数必须是正整数"
);
}
}
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
userId
);
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
userId
);
XUserDetail
xUserDetail
=
fromUserDetail
(
userDetail
);
XUserDetail
xUserDetail
=
fromUserDetail
(
userDetail
);
return
return
Value
(
xUserDetail
,
""
);
return
return
SuccessValue
(
xUserDetail
);
}
}
private
XUserDetail
fromUserDetail
(
UserDetail
userDetail
)
{
private
XUserDetail
fromUserDetail
(
UserDetail
userDetail
)
{
...
@@ -143,8 +145,12 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -143,8 +145,12 @@ public class MotanUserServiceImpl implements UserMotanService {
xUserDetail
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
xUserDetail
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
xUserDetail
.
setName
(
userDetail
.
getName
());
xUserDetail
.
setName
(
userDetail
.
getName
());
xUserDetail
.
setIdNo
(
userDetail
.
getIdNo
());
xUserDetail
.
setIdNo
(
userDetail
.
getIdNo
());
xUserDetail
.
setIdType
(
cn
.
quantgroup
.
motan
.
enums
.
IdType
.
valueOf
(
userDetail
.
getIdType
().
getName
()));
if
(
userDetail
.
getIdType
()
!=
null
)
{
xUserDetail
.
setGender
(
cn
.
quantgroup
.
motan
.
enums
.
Gender
.
valueOf
(
userDetail
.
getGender
().
getName
()));
xUserDetail
.
setIdType
(
cn
.
quantgroup
.
motan
.
enums
.
IdType
.
valueOf
(
userDetail
.
getIdType
().
name
()));
}
if
(
userDetail
.
getGender
()
!=
null
)
{
xUserDetail
.
setGender
(
cn
.
quantgroup
.
motan
.
enums
.
Gender
.
valueOf
(
userDetail
.
getGender
().
name
()));
}
xUserDetail
.
setEmail
(
userDetail
.
getEmail
());
xUserDetail
.
setEmail
(
userDetail
.
getEmail
());
xUserDetail
.
setQq
(
userDetail
.
getQq
());
xUserDetail
.
setQq
(
userDetail
.
getQq
());
xUserDetail
.
setId
(
userDetail
.
getId
());
xUserDetail
.
setId
(
userDetail
.
getId
());
...
@@ -173,26 +179,26 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -173,26 +179,26 @@ public class MotanUserServiceImpl implements UserMotanService {
@Override
@Override
public
UserSysResult
<
XUser
>
findUserByUserId
(
Long
id
)
{
public
UserSysResult
<
XUser
>
findUserByUserId
(
Long
id
)
{
if
(
id
==
null
||
id
.
longValue
()
<
1
)
{
if
(
id
==
null
||
id
.
longValue
()
<
1
)
{
return
return
Value
(
null
,
"参数必须是正整数"
);
return
return
ErrorValue
(
"参数必须是正整数"
);
}
}
User
user
=
userService
.
findById
(
id
);
User
user
=
userService
.
findById
(
id
);
return
return
Value
(
fromUser
(
user
),
""
);
return
return
SuccessValue
(
fromUser
(
user
)
);
}
}
@Override
@Override
public
UserSysResult
<
XUserDetail
>
findUserDetailByPhone
(
String
phoneNo
)
{
public
UserSysResult
<
XUserDetail
>
findUserDetailByPhone
(
String
phoneNo
)
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
return
return
Value
(
null
,
"手机号格式不正确"
);
return
return
ErrorValue
(
"手机号格式不正确"
);
}
}
UserDetail
userDetail
=
userDetailService
.
findByPhoneNo
(
phoneNo
);
UserDetail
userDetail
=
userDetailService
.
findByPhoneNo
(
phoneNo
);
return
return
Value
(
fromUserDetail
(
userDetail
),
""
);
return
return
SuccessValue
(
fromUserDetail
(
userDetail
)
);
}
}
@Override
@Override
public
UserSysResult
<
XUserDetail
>
updateUserDetail
(
UserDetailUpdateBean
userDetailUpdateBean
)
{
public
UserSysResult
<
XUserDetail
>
updateUserDetail
(
UserDetailUpdateBean
userDetailUpdateBean
)
{
if
(
null
==
userDetailUpdateBean
)
{
if
(
null
==
userDetailUpdateBean
)
{
return
return
Value
(
null
,
"要保存的用户详情对象不能为null"
);
return
return
ErrorValue
(
"要保存的用户详情对象不能为null"
);
}
}
UserDetail
userDetail
=
new
UserDetail
();
UserDetail
userDetail
=
new
UserDetail
();
if
(
null
!=
userDetailUpdateBean
.
getId
()
&&
userDetailUpdateBean
.
getId
()
>
0L
)
{
if
(
null
!=
userDetailUpdateBean
.
getId
()
&&
userDetailUpdateBean
.
getId
()
>
0L
)
{
...
@@ -210,27 +216,70 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -210,27 +216,70 @@ public class MotanUserServiceImpl implements UserMotanService {
userDetail
.
setGender
(
idCardService
.
getIdCardInfo
(
userDetailUpdateBean
.
getIdNo
()).
getGender
());
userDetail
.
setGender
(
idCardService
.
getIdCardInfo
(
userDetailUpdateBean
.
getIdNo
()).
getGender
());
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
log
.
error
(
"根据身份证获取性别出错,userDetailUpdateBean:{}"
,
JSON
.
toJSONString
(
userDetailUpdateBean
),
e
);
log
.
error
(
"根据身份证获取性别出错,userDetailUpdateBean:{}"
,
JSON
.
toJSONString
(
userDetailUpdateBean
),
e
);
return
return
Value
(
null
,
"根据身份证获取性别出错."
);
return
return
ErrorValue
(
"根据身份证获取性别出错."
);
}
}
userDetail
.
setEmail
(
userDetailUpdateBean
.
getEmail
());
userDetail
.
setEmail
(
userDetailUpdateBean
.
getEmail
());
userDetail
=
userDetailService
.
saveUserDetail
(
userDetail
);
userDetail
=
userDetailService
.
saveUserDetail
(
userDetail
);
if
(
userDetail
!=
null
)
{
if
(
userDetail
!=
null
)
{
XUserDetail
xUserDetail
=
convertObject
(
JSON
.
toJSONString
(
userDetail
),
new
TypeReference
<
XUserDetail
>()
{
XUserDetail
xUserDetail
=
convertObject
(
JSON
.
toJSONString
(
userDetail
),
new
TypeReference
<
XUserDetail
>()
{
});
});
return
return
Value
(
xUserDetail
,
""
);
return
return
SuccessValue
(
xUserDetail
);
}
}
return
return
Value
(
null
,
"保存失败"
);
return
return
ErrorValue
(
"保存失败"
);
}
}
@Override
@Override
public
UserSysResult
<
XUserDetail
>
saveUserDetail
(
UserDetailSaveBean
userDetailSaveBean
)
{
public
UserSysResult
<
XUserDetail
>
saveUserDetail
(
UserDetailSaveBean
userDetailSaveBean
)
{
return
null
;
if
(
userDetailSaveBean
==
null
)
{
return
returnErrorValue
(
"数据不能为空"
);
}
Long
userId
=
userDetailSaveBean
.
getUserId
();
if
(
userId
==
null
||
userId
==
0L
)
{
return
returnErrorValue
(
"用户id为空"
);
}
if
(
StringUtils
.
isBlank
(
userDetailSaveBean
.
getPhoneNo
()))
{
return
returnErrorValue
(
"用户手机号为空"
);
}
if
(
StringUtils
.
isBlank
(
userDetailSaveBean
.
getName
()))
{
return
returnErrorValue
(
"用户名为空"
);
}
if
(
StringUtils
.
isBlank
(
userDetailSaveBean
.
getIdNo
()))
{
return
returnErrorValue
(
"用户身份证为空"
);
}
Timestamp
time
=
new
Timestamp
(
System
.
currentTimeMillis
());
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
userId
);
if
(
userDetail
==
null
)
{
userDetail
=
new
UserDetail
();
userDetail
.
setUserId
(
userId
);
userDetail
.
setCreatedAt
(
time
);
userDetail
.
setUpdatedAt
(
time
);
}
else
{
userDetail
.
setUpdatedAt
(
time
);
}
userDetail
.
setName
(
userDetail
.
getName
());
userDetail
.
setPhoneNo
(
userDetail
.
getPhoneNo
());
userDetail
.
setIdType
(
IdType
.
ID_CARD
);
if
(
StringUtils
.
isNotBlank
(
userDetail
.
getIdNo
()))
{
try
{
userDetail
.
setGender
(
idCardService
.
getIdCardInfo
(
userDetail
.
getIdNo
()).
getGender
());
}
catch
(
ParseException
e
)
{
log
.
error
(
"根据身份证获取性别出错,身份证号码:{}"
,
userDetail
.
getIdNo
(),
e
);
return
returnErrorValue
(
"身份证信息出错"
);
}
userDetail
.
setIdNo
(
userDetail
.
getIdNo
());
}
userDetail
.
setEmail
(
userDetail
.
getEmail
());
userDetail
=
userDetailService
.
saveUserDetail
(
userDetail
);
if
(
userDetail
!=
null
)
{
return
returnSuccessValue
(
fromUserDetail
(
userDetail
));
}
return
returnErrorValue
(
"操作失败"
);
}
}
@Override
@Override
public
UserSysResult
<
XLoginInfo
>
appLoginAndFetchLoginInfo
(
AppLoginParam
appLoginParam
,
String
requestIp
)
{
public
UserSysResult
<
XLoginInfo
>
appLoginAndFetchLoginInfo
(
AppLoginParam
appLoginParam
,
String
requestIp
)
{
if
(!
ValidationUtil
.
validatePhoneNo
(
appLoginParam
.
getPhoneNo
()))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
appLoginParam
.
getPhoneNo
()))
{
return
return
Value
(
null
,
"账户或者密码错误"
);
return
return
ErrorValue
(
"账户或者密码错误"
);
}
}
log
.
info
(
"第三方用户登录, loginFrom:{}, requestIp:{}"
,
appLoginParam
.
getRegisterFrom
(),
requestIp
);
log
.
info
(
"第三方用户登录, loginFrom:{}, requestIp:{}"
,
appLoginParam
.
getRegisterFrom
(),
requestIp
);
...
@@ -239,11 +288,11 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -239,11 +288,11 @@ public class MotanUserServiceImpl implements UserMotanService {
user
=
register
(
appLoginParam
.
getRegisterFrom
(),
appLoginParam
.
getPhoneNo
(),
appLoginParam
.
getIdNo
(),
appLoginParam
.
getName
());
user
=
register
(
appLoginParam
.
getRegisterFrom
(),
appLoginParam
.
getPhoneNo
(),
appLoginParam
.
getIdNo
(),
appLoginParam
.
getName
());
}
}
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
return
Value
(
null
,
"账户或者密码错误"
);
return
return
ErrorValue
(
"账户或者密码错误"
);
}
}
Merchant
merchant
=
merchantService
.
findMerchantByName
(
appLoginParam
.
getKey
());
Merchant
merchant
=
merchantService
.
findMerchantByName
(
appLoginParam
.
getKey
());
if
(
merchant
==
null
)
{
if
(
merchant
==
null
)
{
return
return
Value
(
null
,
"无效的商户"
);
return
return
ErrorValue
(
"无效的商户"
);
}
}
LoginProperties
loginProperties
=
new
LoginProperties
();
LoginProperties
loginProperties
=
new
LoginProperties
();
loginProperties
.
setChannelId
(
appLoginParam
.
getChannelId
());
loginProperties
.
setChannelId
(
appLoginParam
.
getChannelId
());
...
@@ -264,7 +313,7 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -264,7 +313,7 @@ public class MotanUserServiceImpl implements UserMotanService {
log
.
info
(
"第三方用户获取信息登录成功, loginFrom:{}, phoneNo:{},appChannel:{}"
,
appLoginParam
.
getRegisterFrom
(),
appLoginParam
.
getPhoneNo
(),
appLoginParam
.
getAppChannel
());
log
.
info
(
"第三方用户获取信息登录成功, loginFrom:{}, phoneNo:{},appChannel:{}"
,
appLoginParam
.
getRegisterFrom
(),
appLoginParam
.
getPhoneNo
(),
appLoginParam
.
getAppChannel
());
XLoginInfo
xLoginInfo
=
convertObject
(
JSON
.
toJSONString
(
loginInfo
),
new
TypeReference
<
XLoginInfo
>()
{
XLoginInfo
xLoginInfo
=
convertObject
(
JSON
.
toJSONString
(
loginInfo
),
new
TypeReference
<
XLoginInfo
>()
{
});
});
return
return
Value
(
xLoginInfo
,
""
);
return
return
SuccessValue
(
xLoginInfo
);
}
}
private
<
T
>
T
convertObject
(
String
json
,
TypeReference
typeReference
)
{
private
<
T
>
T
convertObject
(
String
json
,
TypeReference
typeReference
)
{
...
@@ -294,16 +343,16 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -294,16 +343,16 @@ public class MotanUserServiceImpl implements UserMotanService {
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
userId
);
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
userId
);
List
<
XContact
>
xContacts
=
convertObject
(
JSON
.
toJSONString
(
contacts
),
new
TypeReference
<
List
<
XContact
>>()
{
List
<
XContact
>
xContacts
=
convertObject
(
JSON
.
toJSONString
(
contacts
),
new
TypeReference
<
List
<
XContact
>>()
{
});
});
return
return
Value
(
xContacts
,
""
);
return
return
SuccessValue
(
xContacts
);
}
}
@Override
@Override
public
UserSysResult
<
List
<
XContact
>>
saveContacts
(
Long
userId
,
List
<
XContact
>
contacts
)
{
public
UserSysResult
<
List
<
XContact
>>
saveContacts
(
Long
userId
,
List
<
XContact
>
contacts
)
{
if
(
null
==
userId
||
userId
==
0L
)
{
if
(
null
==
userId
||
userId
==
0L
)
{
return
return
Value
(
null
,
"保存联系人列表失败,用户id为空"
);
return
return
ErrorValue
(
"保存联系人列表失败,用户id为空"
);
}
}
if
(
CollectionUtils
.
isEmpty
(
contacts
))
{
if
(
CollectionUtils
.
isEmpty
(
contacts
))
{
return
return
Value
(
null
,
"保存联系人列表失败,列表为空"
);
return
return
ErrorValue
(
"保存联系人列表失败,列表为空"
);
}
}
//做一次类型转换,
//做一次类型转换,
String
jsonContacts
=
JSON
.
toJSONString
(
contacts
);
String
jsonContacts
=
JSON
.
toJSONString
(
contacts
);
...
@@ -313,7 +362,7 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -313,7 +362,7 @@ public class MotanUserServiceImpl implements UserMotanService {
});
});
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"联系人列表转换错误"
,
e
);
log
.
error
(
"联系人列表转换错误"
,
e
);
return
return
Value
(
null
,
"联系人转换错误"
);
return
return
ErrorValue
(
"联系人转换错误"
);
}
}
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
for
(
Contact
c
:
contactList
)
{
for
(
Contact
c
:
contactList
)
{
...
@@ -326,27 +375,26 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -326,27 +375,26 @@ public class MotanUserServiceImpl implements UserMotanService {
List
<
Contact
>
result
=
contactService
.
save
(
contactList
);
List
<
Contact
>
result
=
contactService
.
save
(
contactList
);
List
<
XContact
>
xResult
=
convertObject
(
JSON
.
toJSONString
(
result
),
new
TypeReference
<
List
<
XContact
>>()
{
List
<
XContact
>
xResult
=
convertObject
(
JSON
.
toJSONString
(
result
),
new
TypeReference
<
List
<
XContact
>>()
{
});
});
return
return
Value
(
xResult
,
""
);
return
return
SuccessValue
(
xResult
);
}
}
@Override
@Override
public
UserSysResult
<
XAddress
>
findAddressByUserId
(
Long
userId
)
{
public
UserSysResult
<
XAddress
>
findAddressByUserId
(
Long
userId
)
{
UserSysResult
<
XAddress
>
userSysResult
=
return
Value
(
null
,
null
);
UserSysResult
<
XAddress
>
userSysResult
=
return
ErrorValue
(
null
);
Address
address
=
addressService
.
findByUserId
(
userId
);
Address
address
=
addressService
.
findByUserId
(
userId
);
if
(
null
==
address
)
{
if
(
null
==
address
)
{
return
userSysResult
;
return
userSysResult
;
}
}
XAddress
xAddress
=
convertObject
(
JSON
.
toJSONString
(
address
),
new
TypeReference
<
XAddress
>()
{
XAddress
xAddress
=
convertObject
(
JSON
.
toJSONString
(
address
),
new
TypeReference
<
XAddress
>()
{
});
});
return
return
Value
(
xAddress
,
""
);
return
return
SuccessValue
(
xAddress
);
}
}
@Override
@Override
public
UserSysResult
<
XAddress
>
saveAddress
(
Long
userId
,
Long
provinceCode
,
String
province
,
Long
cityCode
,
String
city
,
public
UserSysResult
<
XAddress
>
saveAddress
(
Long
userId
,
Long
provinceCode
,
String
province
,
Long
cityCode
,
String
city
,
Long
districtCode
,
String
district
,
String
address
)
{
Long
districtCode
,
String
district
,
String
address
)
{
UserSysResult
<
XAddress
>
userSysResult
=
returnValue
(
null
,
null
);
if
(
null
==
userId
||
null
==
provinceCode
||
null
==
cityCode
)
{
if
(
null
==
userId
||
null
==
provinceCode
||
null
==
cityCode
)
{
return
userSysResult
;
return
returnErrorValue
(
"参数不能为空"
)
;
}
}
Address
addressObj
=
addressService
.
findByUserId
(
userId
);
Address
addressObj
=
addressService
.
findByUserId
(
userId
);
if
(
addressObj
==
null
)
{
if
(
addressObj
==
null
)
{
...
@@ -366,7 +414,7 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -366,7 +414,7 @@ public class MotanUserServiceImpl implements UserMotanService {
addressObj
=
addressService
.
save
(
addressObj
);
addressObj
=
addressService
.
save
(
addressObj
);
XAddress
xAddress
=
convertObject
(
JSON
.
toJSONString
(
addressObj
),
new
TypeReference
<
XAddress
>()
{
XAddress
xAddress
=
convertObject
(
JSON
.
toJSONString
(
addressObj
),
new
TypeReference
<
XAddress
>()
{
});
});
return
return
Value
(
xAddress
,
""
);
return
return
SuccessValue
(
xAddress
);
}
}
@Override
@Override
...
@@ -376,7 +424,7 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -376,7 +424,7 @@ public class MotanUserServiceImpl implements UserMotanService {
Boolean
hasSocialSecurity
,
Boolean
hasHouse
,
Boolean
hasCreditCard
,
cn
.
quantgroup
.
motan
.
enums
.
MaritalStatus
maritalStatus
)
{
Boolean
hasSocialSecurity
,
Boolean
hasHouse
,
Boolean
hasCreditCard
,
cn
.
quantgroup
.
motan
.
enums
.
MaritalStatus
maritalStatus
)
{
UserSysResult
<
XUserExtInfo
>
userSysResult
=
returnValue
(
null
,
null
);
UserSysResult
<
XUserExtInfo
>
userSysResult
=
returnValue
(
null
,
null
);
if
(
null
==
userId
||
0L
==
userId
)
{
if
(
null
==
userId
||
0L
==
userId
)
{
return
return
Value
(
null
,
"用户id为空"
);
return
return
ErrorValue
(
"用户id为空"
);
}
}
UserExtInfo
info
=
userExtInfoService
.
findByUserId
(
userId
);
UserExtInfo
info
=
userExtInfoService
.
findByUserId
(
userId
);
if
(
info
==
null
)
{
if
(
info
==
null
)
{
...
@@ -413,17 +461,17 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -413,17 +461,17 @@ public class MotanUserServiceImpl implements UserMotanService {
info
=
userExtInfoService
.
save
(
info
);
info
=
userExtInfoService
.
save
(
info
);
XUserExtInfo
userExtInfo
=
convertObject
(
JSON
.
toJSONString
(
info
),
new
TypeReference
<
XUserExtInfo
>()
{
XUserExtInfo
userExtInfo
=
convertObject
(
JSON
.
toJSONString
(
info
),
new
TypeReference
<
XUserExtInfo
>()
{
});
});
return
return
Value
(
userExtInfo
,
""
);
return
return
SuccessValue
(
userExtInfo
);
}
}
@Override
@Override
public
UserSysResult
<
String
>
queryOpenIdByXyqbUserId
(
Long
userId
)
{
public
UserSysResult
<
String
>
queryOpenIdByXyqbUserId
(
Long
userId
)
{
if
(
userId
==
null
||
userId
<
1
)
{
if
(
userId
==
null
||
userId
<
1
)
{
return
return
Value
(
null
,
"用户id不能为空"
);
return
return
ErrorValue
(
"用户id不能为空"
);
}
}
WechatUserInfo
wechatUserInfo
=
wechatService
.
queryOpenIdByUserId
(
userId
);
WechatUserInfo
wechatUserInfo
=
wechatService
.
queryOpenIdByUserId
(
userId
);
if
(
wechatUserInfo
==
null
)
{
if
(
wechatUserInfo
==
null
)
{
return
return
Value
(
null
,
"wechat信息为空"
);
return
return
ErrorValue
(
"wechat信息为空"
);
}
}
return
returnValue
(
wechatUserInfo
.
getOpenId
(),
"success"
);
return
returnValue
(
wechatUserInfo
.
getOpenId
(),
"success"
);
}
}
...
@@ -436,24 +484,46 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -436,24 +484,46 @@ public class MotanUserServiceImpl implements UserMotanService {
@Override
@Override
public
UserSysResult
<
String
>
queryOpenIdByPhoneNo
(
String
phoneNo
)
{
public
UserSysResult
<
String
>
queryOpenIdByPhoneNo
(
String
phoneNo
)
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
return
return
Value
(
null
,
"手机号格式不正确"
);
return
return
ErrorValue
(
"手机号格式不正确"
);
}
}
WechatUserInfo
wechatUserInfo
=
wechatService
.
findWechatUserInfoByPhoneNo
(
phoneNo
);
WechatUserInfo
wechatUserInfo
=
wechatService
.
findWechatUserInfoByPhoneNo
(
phoneNo
);
String
openId
=
null
==
wechatUserInfo
?
null
:
wechatUserInfo
.
getOpenId
();
String
openId
=
null
==
wechatUserInfo
?
null
:
wechatUserInfo
.
getOpenId
();
return
return
Value
(
openId
,
null
);
return
return
SuccessValue
(
openId
);
}
}
@Override
@Override
public
UserSysResult
<
UserRegisterTrace
>
findRegisterTraceByPhoneNo
(
String
phoneNo
)
{
public
UserSysResult
<
UserRegisterTrace
>
findRegisterTraceByPhoneNo
(
String
phoneNo
)
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
return
return
Value
(
null
,
"手机号格式不正确"
);
return
return
ErrorValue
(
"手机号格式不正确"
);
}
}
return
null
;
return
null
;
}
}
@Override
@Override
public
UserSysResult
<
XUserSpouse
>
findUserSpouseByUserId
(
Long
userId
)
{
public
UserSysResult
<
XUserSpouse
>
findUserSpouseByUserId
(
Long
userId
)
{
return
null
;
if
(
userId
==
null
||
userId
==
0
)
{
return
returnErrorValue
(
"用户不能为空"
);
}
UserSpouse
userSpouse
=
userSpouseService
.
findByUserId
(
userId
);
if
(
userSpouse
==
null
)
{
userSpouse
=
new
UserSpouse
(
userId
);
userSpouse
.
setStatus
(
MaritalStatus
.
UNKNOWN
);
}
return
returnSuccessValue
(
fromUserSpouse
(
userSpouse
));
}
private
XUserSpouse
fromUserSpouse
(
UserSpouse
userSpouse
)
{
if
(
userSpouse
==
null
)
{
return
null
;
}
XUserSpouse
xUserSpouse
=
new
XUserSpouse
();
xUserSpouse
.
setUserId
(
userSpouse
.
getUserId
());
xUserSpouse
.
setSpousePhone
(
userSpouse
.
getSpousePhone
());
xUserSpouse
.
setSpouseName
(
userSpouse
.
getSpouseName
());
xUserSpouse
.
setCreatedAt
(
userSpouse
.
getCreatedAt
());
xUserSpouse
.
setUpdateAt
(
userSpouse
.
getUpdateAt
());
xUserSpouse
.
setStatus
(
cn
.
quantgroup
.
motan
.
enums
.
MaritalStatus
.
valueOf
(
userSpouse
.
getStatus
().
name
()));
return
xUserSpouse
;
}
}
@Override
@Override
...
@@ -468,7 +538,7 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -468,7 +538,7 @@ public class MotanUserServiceImpl implements UserMotanService {
return
null
;
return
null
;
}
}
List
<
XUserDetail
>
xUserDetails
=
userDetails
.
stream
().
map
(
user
->
fromUserDetail
(
user
)).
collect
(
Collectors
.
toList
());
List
<
XUserDetail
>
xUserDetails
=
userDetails
.
stream
().
map
(
user
->
fromUserDetail
(
user
)).
collect
(
Collectors
.
toList
());
return
return
Value
(
xUserDetails
,
null
);
return
return
SuccessValue
(
xUserDetails
);
}
}
@Override
@Override
...
@@ -482,8 +552,33 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -482,8 +552,33 @@ public class MotanUserServiceImpl implements UserMotanService {
}
}
@Override
@Override
public
UserSysResult
<
XUserSpouse
>
saveUserSpouse
(
XUserSpouse
userSpouse
)
{
public
UserSysResult
<
XUserSpouse
>
saveUserSpouse
(
XUserSpouse
xUserSpouse
)
{
return
null
;
if
(
xUserSpouse
.
getUserId
()
==
null
||
xUserSpouse
.
getUserId
()
==
0
)
{
return
returnErrorValue
(
"用户不能为空"
);
}
cn
.
quantgroup
.
motan
.
enums
.
MaritalStatus
status
=
xUserSpouse
.
getStatus
();
String
spousePhone
=
xUserSpouse
.
getSpousePhone
();
String
spouseName
=
xUserSpouse
.
getSpouseName
();
if
(
xUserSpouse
.
getStatus
()
==
cn
.
quantgroup
.
motan
.
enums
.
MaritalStatus
.
MARRIED
)
{
if
(!
ValidationUtil
.
validatePhoneNo
(
spousePhone
))
{
return
returnErrorValue
(
"手机号格式错误"
);
}
if
(
StringUtils
.
isBlank
(
spouseName
))
{
return
returnErrorValue
(
"配偶姓名不能为空"
);
}
}
UserSpouse
userSpouse
=
userSpouseService
.
findByUserId
(
xUserSpouse
.
getUserId
());
Timestamp
timestamp
=
new
Timestamp
(
System
.
currentTimeMillis
());
if
(
userSpouse
==
null
)
{
userSpouse
=
new
UserSpouse
(
xUserSpouse
.
getUserId
());
userSpouse
.
setCreatedAt
(
timestamp
);
}
userSpouse
.
setSpouseName
(
status
==
cn
.
quantgroup
.
motan
.
enums
.
MaritalStatus
.
MARRIED
?
spouseName
:
""
);
userSpouse
.
setSpousePhone
(
status
==
cn
.
quantgroup
.
motan
.
enums
.
MaritalStatus
.
MARRIED
?
spousePhone
:
""
);
userSpouse
.
setStatus
(
MaritalStatus
.
valueOf
(
status
.
name
()));
userSpouse
.
setUpdateAt
(
timestamp
);
userSpouse
=
userSpouseService
.
save
(
userSpouse
);
return
returnSuccessValue
(
fromUserSpouse
(
userSpouse
));
}
}
@Override
@Override
...
@@ -516,6 +611,14 @@ public class MotanUserServiceImpl implements UserMotanService {
...
@@ -516,6 +611,14 @@ public class MotanUserServiceImpl implements UserMotanService {
return
userSysResult
;
return
userSysResult
;
}
}
private
<
T
>
UserSysResult
<
T
>
returnErrorValue
(
String
message
)
{
return
returnValue
(
null
,
message
);
}
private
<
T
>
UserSysResult
<
T
>
returnSuccessValue
(
T
t
)
{
return
returnValue
(
t
,
""
);
}
/**
/**
* 注册新用户
* 注册新用户
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment