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
3a0216b5
Commit
3a0216b5
authored
May 24, 2017
by
Java-郭京峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户、联系人、地址信息入库
parent
f221d4d8
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
306 additions
and
52 deletions
+306
-52
pom.xml
pom.xml
+1
-1
MotanUserServiceImpl.java
.../xyqb/controller/external/motan/MotanUserServiceImpl.java
+24
-12
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+98
-0
UserDetail.java
src/main/java/cn/quantgroup/xyqb/entity/UserDetail.java
+2
-2
IUserService.java
...in/java/cn/quantgroup/xyqb/service/user/IUserService.java
+31
-0
UserServiceImpl.java
...cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
+114
-1
UserDetailVO.java
...java/cn/quantgroup/xyqb/service/user/vo/UserDetailVO.java
+2
-2
XyqbSessionContextHolder.java
.../cn/quantgroup/xyqb/session/XyqbSessionContextHolder.java
+0
-24
logback.xml
src/main/resources/config/dev/logback.xml
+4
-5
xyqb.properties
src/main/resources/config/dev/xyqb.properties
+4
-3
DemoApplicationTests.java
src/test/java/demo/DemoApplicationTests.java
+2
-2
TestUserLogin.java
src/test/java/user/TestUserLogin.java
+24
-0
No files found.
pom.xml
View file @
3a0216b5
...
...
@@ -257,7 +257,7 @@
<dependency>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
xyqb-user-rpc-commons
</artifactId>
<version>
1.1.
1
-SNAPSHOT
</version>
<version>
1.1.
2
-SNAPSHOT
</version>
</dependency>
<dependency>
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/motan/MotanUserServiceImpl.java
View file @
3a0216b5
...
...
@@ -6,45 +6,53 @@ import cn.quantgroup.motan.service.UserMotanService;
import
cn.quantgroup.motan.vo.UserSysResult
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.entity.enumerate.*
;
import
cn.quantgroup.xyqb.model.IdCardInfo
;
//import cn.quantgroup.xyqb.entity.enumerate.*;
import
cn.quantgroup.user.enums.*
;
import
cn.quantgroup.xyqb.model.*
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.model.LoginProperties
;
import
cn.quantgroup.xyqb.model.UserRet
;
import
cn.quantgroup.xyqb.model.session.LoginInfo
;
import
cn.quantgroup.xyqb.model.session.SessionStruct
;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
import
cn.quantgroup.xyqb.service.api.IUserApiService
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.http.IHttpService
;
import
cn.quantgroup.xyqb.service.merchant.IMerchantService
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
import
cn.quantgroup.xyqb.service.sms.ISmsService
;
import
cn.quantgroup.xyqb.service.user.*
;
import
cn.quantgroup.xyqb.service.user.vo.UserDetailVO
;
import
cn.quantgroup.xyqb.service.wechat.IWechatService
;
import
cn.quantgroup.xyqb.session.XyqbSessionContextHolder
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.google.common.collect.ImmutableMap
;
import
com.weibo.api.motan.config.springsupport.annotation.MotanService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.CollectionUtils
;
import
java.sql.Timestamp
;
import
java.text.ParseException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.stream.Collectors
;
import
static
cn
.
quantgroup
.
xyqb
.
constant
.
UserConstant
.
USER_ERROR_OR_PASSWORD_ERROR
;
/**
* Created by 11 on 2017/2/27.
*/
@Slf4j
@MotanService
(
basicService
=
"baseServiceConfig"
)
public
class
MotanUserServiceImpl
implements
UserMotanService
{
private
static
final
ObjectMapper
MAPPER
=
new
ObjectMapper
();
private
final
static
Random
random
=
new
Random
();
...
...
@@ -83,13 +91,15 @@ public class MotanUserServiceImpl implements UserMotanService {
@Autowired
private
IUserSpouseService
userSpouseService
;
@Value
(
"${xyqb.auth.url}"
)
private
String
xyqbAuthUrl
;
@Autowired
private
IHttpService
httpService
;
@Autowired
private
IUserApiService
userApiService
;
@Override
public
UserSysResult
<
XUser
>
saveUserRelatedInfo
(
UserRelatedBean
userRelatedBean
)
{
return
null
;
}
@Override
public
UserSysResult
<
XUser
>
findUserByPhoneNo
(
String
phoneNo
)
{
...
...
@@ -401,11 +411,12 @@ public class MotanUserServiceImpl implements UserMotanService {
return
returnSuccessValue
(
xAddress
);
}
@Override
public
UserSysResult
<
XUserExtInfo
>
updateUserExtInfo
(
Long
userId
,
cn
.
quantgroup
.
motan
.
enums
.
IncomeEnum
incomeEnum
,
cn
.
quantgroup
.
motan
.
enums
.
IncomeRangeEnum
incomeRangeEnum
,
cn
.
quantgroup
.
motan
.
enums
.
OccupationEnum
occupationEnum
,
cn
.
quantgroup
.
motan
.
enums
.
EducationEnum
educationEnum
,
Boolean
hasCar
,
Boolean
hasSocialSecurity
,
Boolean
hasHouse
,
Boolean
hasCreditCard
,
cn
.
quantgroup
.
motan
.
enums
.
MaritalStatus
maritalStatus
)
{
Long
userId
,
IncomeEnum
incomeEnum
,
IncomeRangeEnum
incomeRangeEnum
,
OccupationEnum
occupationEnum
,
EducationEnum
educationEnum
,
Boolean
hasCar
,
Boolean
hasSocialSecurity
,
Boolean
hasHouse
,
Boolean
hasCreditCard
,
MaritalStatus
maritalStatus
)
{
UserSysResult
<
XUserExtInfo
>
userSysResult
=
returnValue
(
null
,
null
);
if
(
null
==
userId
||
0L
==
userId
)
{
return
returnErrorValue
(
"用户id为空"
);
...
...
@@ -680,10 +691,11 @@ public class MotanUserServiceImpl implements UserMotanService {
}
@Override
/*
@Override
public UserSysResult<XLoginInfo> getLoginInfo(String token) {
SessionStruct sessionStruct = XyqbSessionContextHolder.getXSessionFromRedis(token);
if(null != sessionStruct){
LoginInfo loginInfo = new LoginInfo();
loginInfo.setUser(UserRet.getUserRet(sessionStruct.getValues().getUser()));
loginInfo.setToken(sessionStruct.getSid());
...
...
@@ -720,7 +732,7 @@ public class MotanUserServiceImpl implements UserMotanService {
xLoginInfo.setLoginContext(context);
return returnSuccessValue(xLoginInfo);
}
}
}
*/
/**
* 封装返回结果.
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
3a0216b5
package
cn
.
quantgroup
.
xyqb
.
controller
.
external
.
user
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.aspect.logcaller.LogHttpCaller
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.entity.*
;
...
...
@@ -11,10 +12,14 @@ import cn.quantgroup.xyqb.service.session.ISessionService;
import
cn.quantgroup.xyqb.service.user.*
;
import
cn.quantgroup.xyqb.service.user.vo.UserDetailVO
;
import
cn.quantgroup.xyqb.service.wechat.IWechatService
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.google.common.base.MoreObjects
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.joda.time.DateTime
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -28,6 +33,8 @@ import java.text.ParseException;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.concurrent.CopyOnWriteArrayList
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -38,6 +45,7 @@ import java.util.stream.Collectors;
public
class
InnerController
implements
IBaseController
{
private
static
final
org
.
slf4j
.
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
InnerController
.
class
);
private
final
static
Random
random
=
new
Random
();
@Autowired
private
IUserService
userService
;
...
...
@@ -58,6 +66,11 @@ public class InnerController implements IBaseController {
@Autowired
private
ISessionService
sessionService
;
@Autowired
private
ILkbUserService
lkbUserService
;
private
Long
BAITIAO_CHANNEL
=
222L
;
@RequestMapping
(
"/user/search/phoneNo"
)
@LogHttpCaller
public
JsonResult
findByPhoneNo
(
String
phoneNo
)
{
...
...
@@ -284,6 +297,8 @@ public class InnerController implements IBaseController {
}
}
@RequestMapping
(
"/address/search/user_id"
)
public
JsonResult
findAddressByUserId
(
Long
userId
)
{
if
(
userId
==
null
)
{
...
...
@@ -525,4 +540,87 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"用户密码重置失败."
,
null
);
}
/**
* 保存用户信息,地址信息,联系人信息
* @param registeredFrom
* @param channelId
* @param phoneNo
* @param name
* @param idNo
* @param provinceCode
* @param cityCode
* @param districtCode
* @param address
* @param contacts
* @return
*/
@RequestMapping
(
"/user/save_multi"
)
public
JsonResult
saveMulti
(
String
registeredFrom
,
String
channelId
,
String
phoneNo
,
String
name
,
String
idNo
,
String
provinceCode
,
String
province
,
String
cityCode
,
String
city
,
String
districtCode
,
String
district
,
String
address
,
String
contacts
)
{
LOGGER
.
info
(
"保存用户、联系人、地址信息:registeredFrom:[{}], phoneNo[{}],name[{}],idNo[{}],provinceCode[{}],cityCode[{}],districtCode[{}],"
+
"address[{}],contacts[{}]"
,
registeredFrom
,
phoneNo
,
name
,
idNo
,
provinceCode
,
cityCode
,
districtCode
,
address
,
contacts
);
if
(!
NumberUtils
.
isDigits
(
registeredFrom
)){
return
JsonResult
.
buildErrorStateResult
(
"注册渠道异常."
,
null
);
}
if
(!
NumberUtils
.
isDigits
(
phoneNo
)){
return
JsonResult
.
buildErrorStateResult
(
"手机号异常."
,
null
);
}
if
(
StringUtils
.
isBlank
(
name
)){
return
JsonResult
.
buildErrorStateResult
(
"用户名异常."
,
null
);
}
if
(!
NumberUtils
.
isDigits
(
idNo
)){
return
JsonResult
.
buildErrorStateResult
(
"用户身份证号异常."
,
null
);
}
if
(!
NumberUtils
.
isDigits
(
provinceCode
)){
return
JsonResult
.
buildErrorStateResult
(
"省份编号异常."
,
null
);
}
if
(
StringUtils
.
isBlank
(
province
)){
return
JsonResult
.
buildErrorStateResult
(
"省份异常."
,
null
);
}
if
(!
NumberUtils
.
isDigits
(
cityCode
)){
return
JsonResult
.
buildErrorStateResult
(
"城市编号异常."
,
null
);
}
if
(
StringUtils
.
isBlank
(
city
)){
return
JsonResult
.
buildErrorStateResult
(
"城市异常."
,
null
);
}
if
(!
NumberUtils
.
isDigits
(
districtCode
)){
return
JsonResult
.
buildErrorStateResult
(
"区县编号异常."
,
null
);
}
if
(
StringUtils
.
isBlank
(
district
)){
return
JsonResult
.
buildErrorStateResult
(
"区县异常."
,
null
);
}
if
(
StringUtils
.
isBlank
(
address
))
{
return
JsonResult
.
buildErrorStateResult
(
"详细地址异常."
,
null
);
}
channelId
=
MoreObjects
.
firstNonNull
(
channelId
,
"-1"
);
// 验证用户是否已存在
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
if
(
null
!=
user
){
return
JsonResult
.
buildErrorStateResult
(
"用户已存在,手机号被占用"
,
null
);
}
user
=
userService
.
registerAndReturn
(
Long
.
valueOf
(
registeredFrom
),
Long
.
valueOf
(
channelId
),
phoneNo
,
name
,
idNo
,
provinceCode
,
province
,
cityCode
,
city
,
districtCode
,
district
,
address
,
contacts
);
UserRet
userRet
=
UserRet
.
getUserRet
(
user
);
return
JsonResult
.
buildSuccessResult
(
null
,
userRet
);
}
}
\ No newline at end of file
src/main/java/cn/quantgroup/xyqb/entity/UserDetail.java
View file @
3a0216b5
...
...
@@ -75,10 +75,10 @@ public class UserDetail implements Serializable {
xUserDetail
.
setName
(
this
.
getName
());
xUserDetail
.
setIdNo
(
this
.
getIdNo
());
if
(
this
.
getIdType
()
!=
null
)
{
xUserDetail
.
setIdType
(
cn
.
quantgroup
.
motan
.
enums
.
IdType
.
valueOf
(
this
.
getIdType
().
name
()));
xUserDetail
.
setIdType
(
cn
.
quantgroup
.
user
.
enums
.
IdType
.
valueOf
(
this
.
getIdType
().
name
()));
}
if
(
this
.
getGender
()
!=
null
)
{
xUserDetail
.
setGender
(
cn
.
quantgroup
.
motan
.
enums
.
Gender
.
valueOf
(
this
.
getGender
().
name
()));
xUserDetail
.
setGender
(
cn
.
quantgroup
.
user
.
enums
.
Gender
.
valueOf
(
this
.
getGender
().
name
()));
}
xUserDetail
.
setEmail
(
this
.
getEmail
());
xUserDetail
.
setQq
(
this
.
getQq
());
...
...
src/main/java/cn/quantgroup/xyqb/service/user/IUserService.java
View file @
3a0216b5
...
...
@@ -36,4 +36,35 @@ public interface IUserService {
List
<
User
>
findByPhones
(
List
<
String
>
phones
);
User
registerAndReturn
(
String
phoneNo
,
String
password
,
Long
registerFrom
,
Long
btRegisterChannelId
);
/**
* 用户、联系人、地址信息注册
* @param registeredFrom
* @param channelId
* @param phoneNo
* @param name
* @param idNo
* @param provinceCode
* @param province
* @param cityCode
* @param city
* @param districtCode
* @param district
* @param address
* @param contacts
* @return
*/
User
registerAndReturn
(
Long
registeredFrom
,
Long
channelId
,
String
phoneNo
,
String
name
,
String
idNo
,
String
provinceCode
,
String
province
,
String
cityCode
,
String
city
,
String
districtCode
,
String
district
,
String
address
,
String
contacts
);
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
View file @
3a0216b5
package
cn
.
quantgroup
.
xyqb
.
service
.
user
.
impl
;
import
cn.quantgroup.user.enums.Relation
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.entity.Address
;
import
cn.quantgroup.xyqb.entity.Contact
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserBtRegister
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.repository.IAddressRepository
;
import
cn.quantgroup.xyqb.repository.IContactRepository
;
import
cn.quantgroup.xyqb.repository.IUserBtRegisterRepository
;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
import
cn.quantgroup.xyqb.service.sms.ISmsService
;
import
cn.quantgroup.xyqb.service.user.ILkbUserService
;
import
cn.quantgroup.xyqb.service.user.IUserBtRegisterService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
...
...
@@ -25,6 +35,7 @@ import javax.transaction.Transactional;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.concurrent.TimeUnit
;
/**
...
...
@@ -46,9 +57,21 @@ public class UserServiceImpl implements IUserService {
@Autowired
private
ISmsService
smsService
;
@Autowired
private
IAddressRepository
addressRepository
;
@Autowired
private
IUserBtRegisterService
userBtRegisterService
;
@Autowired
private
IContactRepository
contactRepository
;
@Autowired
private
IUserBtRegisterRepository
userBtRegisterRepository
;
private
Long
BAITIAO_CHANNEL
=
222L
;
private
final
static
Random
random
=
new
Random
();
@Override
public
User
findByPhoneInDb
(
String
phone
)
{
return
userRepository
.
findByPhoneNo
(
phone
);
...
...
@@ -116,6 +139,7 @@ public class UserServiceImpl implements IUserService {
return
user
;
}
@Override
public
boolean
register
(
String
phoneNo
,
String
password
,
Long
registerFrom
,
String
ip
,
Long
channelId
,
Long
btRegisterChannelId
)
{
String
uuid
=
lkbUserService
.
registerApp
(
phoneNo
,
password
);
...
...
@@ -180,7 +204,7 @@ public class UserServiceImpl implements IUserService {
}
@Override
@Transactional
(
value
=
Transactional
.
TxType
.
REQUIRED
)
@Transactional
(
value
=
Transactional
.
TxType
.
REQUIRED
,
rollbackOn
=
Exception
.
class
)
public
boolean
register
(
String
phoneNo
,
String
password
,
Long
registerFrom
,
String
userIp
,
Long
channelId
)
{
String
uuid
=
lkbUserService
.
registerApp
(
phoneNo
,
password
);
Timestamp
currentTime
=
new
Timestamp
(
System
.
currentTimeMillis
());
...
...
@@ -233,4 +257,93 @@ public class UserServiceImpl implements IUserService {
return
StringUtils
.
equals
(
PasswordUtil
.
MD5
(
password
.
toLowerCase
()
+
Constants
.
PASSWORD_SALT
),
user
.
getPassword
());
}
@Override
@Transactional
(
value
=
Transactional
.
TxType
.
REQUIRED
,
rollbackOn
=
Exception
.
class
)
public
User
registerAndReturn
(
Long
registeredFrom
,
Long
channelId
,
String
phoneNo
,
String
name
,
String
idNo
,
String
provinceCode
,
String
province
,
String
cityCode
,
String
city
,
String
districtCode
,
String
district
,
String
address
,
String
contacts
)
{
// 用户信息
User
user
=
new
User
();
user
.
setPhoneNo
(
phoneNo
);
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
user
.
setCreatedAt
(
now
);
user
.
setUpdatedAt
(
now
);
user
.
setEnable
(
true
);
UserBtRegister
userBtRegister
=
null
;
if
(
BAITIAO_CHANNEL
.
equals
(
channelId
))
{
user
.
setRegisteredFrom
(
channelId
);
userBtRegister
=
new
UserBtRegister
();
}
else
{
user
.
setRegisteredFrom
(
registeredFrom
);
}
String
randomCode
=
String
.
valueOf
(
random
.
nextInt
(
899999
)
+
100000
);
String
uuid
=
lkbUserService
.
registerApp
(
phoneNo
,
randomCode
);
user
.
setUuid
(
uuid
);
user
.
setPassword
(
PasswordUtil
.
MD5
(
randomCode
+
Constants
.
PASSWORD_SALT
));
user
=
userRepository
.
save
(
user
);
Long
userId
=
user
.
getId
();
if
(
null
!=
userBtRegister
){
userBtRegister
.
setUserId
(
userId
);
userBtRegister
.
setIsActive
(
true
);
userBtRegister
.
setRegisterBtMerchantId
(
registeredFrom
);
userBtRegister
.
setCreatedAt
(
now
);
userBtRegister
.
setUpdatedAt
(
now
);
userBtRegisterRepository
.
save
(
userBtRegister
);
}
// 地址信息
Address
addressObj
=
new
Address
();
addressObj
.
setUserId
(
userId
);
addressObj
.
setProvinceCode
(
Long
.
valueOf
(
provinceCode
));
addressObj
.
setProvince
(
province
);
addressObj
.
setCityCode
(
Long
.
valueOf
(
cityCode
));
addressObj
.
setCity
(
city
);
addressObj
.
setDistrictCode
(
Long
.
valueOf
(
districtCode
));
addressObj
.
setDistrict
(
district
);
addressObj
.
setAddress
(
address
);
addressObj
.
setCreatedAt
(
now
);
addressObj
.
setUpdateAt
(
now
);
addressRepository
.
save
(
addressObj
);
// 联系人信息
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
contacts
))
{
List
<
Contact
>
contactList
=
JSONObject
.
parseObject
(
contacts
,
new
TypeReference
<
List
<
Contact
>>()
{
});
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
contactList
))
{
convertContactList
(
userId
,
contactList
,
2
,
now
);
contactRepository
.
save
(
contactList
);
}
}
return
user
;
}
/**
*
* @param userId
* @param contacts
* @param number 联系人最大数量
* @param now
*/
private
void
convertContactList
(
Long
userId
,
List
<
Contact
>
contacts
,
int
number
,
Timestamp
now
)
{
int
count
=
1
;
for
(
Contact
c
:
contacts
)
{
if
(
count
>
number
)
{
break
;
}
c
.
setId
(
null
);
c
.
setUserId
(
userId
);
c
.
setRelation
(
c
.
getRelation
()
==
null
?
Relation
.
OTHER
:
c
.
getRelation
());
c
.
setCreatedAt
(
now
);
c
.
setUpdateAt
(
now
);
count
++;
}
}
}
src/main/java/cn/quantgroup/xyqb/service/user/vo/UserDetailVO.java
View file @
3a0216b5
...
...
@@ -68,10 +68,10 @@ public class UserDetailVO {
xUserDetail
.
setName
(
this
.
getName
());
xUserDetail
.
setIdNo
(
this
.
getIdNo
());
if
(
this
.
getIdType
()
!=
null
)
{
xUserDetail
.
setIdType
(
cn
.
quantgroup
.
motan
.
enums
.
IdType
.
valueOf
(
this
.
getIdType
().
name
()));
xUserDetail
.
setIdType
(
cn
.
quantgroup
.
user
.
enums
.
IdType
.
valueOf
(
this
.
getIdType
().
name
()));
}
if
(
this
.
getGender
()
!=
null
)
{
xUserDetail
.
setGender
(
cn
.
quantgroup
.
motan
.
enums
.
Gender
.
valueOf
(
this
.
getGender
().
name
()));
xUserDetail
.
setGender
(
cn
.
quantgroup
.
user
.
enums
.
Gender
.
valueOf
(
this
.
getGender
().
name
()));
}
xUserDetail
.
setEmail
(
this
.
getEmail
());
xUserDetail
.
setQq
(
this
.
getQq
());
...
...
src/main/java/cn/quantgroup/xyqb/session/XyqbSessionContextHolder.java
View file @
3a0216b5
...
...
@@ -105,28 +105,4 @@ public class XyqbSessionContextHolder {
public
static
void
releaseSession
()
{
threadSession
.
remove
();
}
public
static
SessionStruct
getXSessionFromRedis
(
String
token
)
{
if
(
token
==
null
||
token
.
length
()
!=
36
)
{
return
null
;
}
String
result
=
redisTemplate
.
opsForValue
().
get
(
Constants
.
Session
.
USER_SESSION_CACHE
+
token
);
if
(
StringUtils
.
isEmpty
(
result
))
{
return
null
;
}
try
{
SessionValue
values
=
JSON
.
parseObject
(
result
,
SessionValue
.
class
);
if
(
values
==
null
)
{
return
null
;
}
SessionStruct
sessionStruct
=
new
SessionStruct
();
sessionStruct
.
setSid
(
token
);
sessionStruct
.
setValues
(
values
);
return
sessionStruct
;
}
catch
(
Exception
ex
){
LOGGER
.
error
(
"序列化session出错"
,
ex
);
return
null
;
}
}
}
src/main/resources/config/dev/logback.xml
View file @
3a0216b5
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<appender
name=
"STDOUT"
class=
"cn.quantgroup.xyqb.util.log.WithOutPhoneRollingFileAppender"
>
<
!--<
appender name="STDOUT" class="cn.quantgroup.xyqb.util.log.WithOutPhoneRollingFileAppender">
<file>/home/quant_group/logs/xyqb_user.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/home/quant_group/logs/xyqb_user.log.%d{yyyy-MM-dd}</fileNamePattern>
<append>true</append>
<maxHistory>30</maxHistory>
</rollingPolicy>
<!--
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-->
</rollingPolicy>-->
<appender
name=
"STDOUT"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%d{ISO8601} [%thread] [%-5level] %logger{36} - %msg%n
</pattern>
</layout>
...
...
src/main/resources/config/dev/xyqb.properties
View file @
3a0216b5
configserver.disable
=
1
configserver.system
=
xyqb-user
xyqb.data.mysql.jdbc-url
=
jdbc:mysql://192.168.4.22:3306/xyqb_user?useUnicode=true&characterEncoding=UTF8
#
xyqb.data.mysql.jdbc-url=jdbc:mysql://192.168.4.163:3306/xyqb_user?useUnicode=true&characterEncoding=UTF8
#
xyqb.data.mysql.jdbc-url=jdbc:mysql://192.168.4.22:3306/xyqb_user?useUnicode=true&characterEncoding=UTF8
xyqb.data.mysql.jdbc-url
=
jdbc:mysql://192.168.4.163:3306/xyqb_user?useUnicode=true&characterEncoding=UTF8
xyqb.data.mysql.password
=
qatest
...
...
@@ -30,11 +30,12 @@ xyqb.redis.sentinel3.port=0
sms.is.debug
=
1
# LKB client
lkb.client.url
=
http://192.168.
192.163:8082
/LKBClient/openapi
lkb.client.url
=
http://192.168.
4.193:8083
/LKBClient/openapi
lkb.client.user.register.app
=
/new/register/registerApp.json
lkb.client.user.register.58jr
=
/new/register/jr58/saveUserInfo.json
lkb.client.user.update
=
/new/register/updateUser.json
# LKB import
lkb.import.url
=
http://spider.quantgroup.cn
...
...
src/test/java/demo/DemoApplicationTests.java
View file @
3a0216b5
...
...
@@ -36,8 +36,8 @@ public class DemoApplicationTests {
@Test
public
void
registerFast
()
{
JsonResult
jsonResult
=
userController
.
registerFast
(
"18611428880"
,
"000000"
,
null
,
null
,
""
);
Assert
.
assertEquals
(
jsonResult
.
getCode
(),
"0000"
);
//
JsonResult jsonResult = userController.registerFast("18611428880", "000000", null, null, "");
//
Assert.assertEquals(jsonResult.getCode(), "0000");
}
@Test
...
...
src/test/java/user/TestUserLogin.java
View file @
3a0216b5
package
user
;
import
cn.quantgroup.xyqb.Bootstrap
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.controller.external.user.InnerController
;
import
cn.quantgroup.xyqb.controller.internal.user.UserController
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
org.apache.commons.lang3.StringUtils
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -23,8 +27,28 @@ public class TestUserLogin {
@Autowired
private
UserController
userController
;
@Autowired
private
InnerController
innerController
;
@Test
public
void
testBull
()
{
String
contacts
=
null
;
boolean
notBlank
=
StringUtils
.
isNotBlank
(
contacts
);
System
.
out
.
println
(
"-----------------------------result:"
+
notBlank
);
}
@Test
public
void
testJson
()
{
JsonResult
addressByUserId
=
innerController
.
findAddressByUserId
(
22L
);
// JsonResult userByUserId = innerController.findUserByPhoneNo("17811111122");
System
.
out
.
println
(
"-------------result:"
+
addressByUserId
);
}
@Test
public
void
testUserLogin
()
{
Long
code
=
1L
;
String
format
=
String
.
format
(
Constants
.
ZERO_FILL_TEMPLATE
,
code
);
System
.
out
.
println
(
"-----------format:"
+
format
);
//访问xyqb-user拿到登录token
/*Long channelId = 1L;
String appChannel = "3";
...
...
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