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
17c7eea1
Commit
17c7eea1
authored
Jan 09, 2018
by
Java—红包—徐 然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改增加接口
parent
e94e42f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
171 additions
and
82 deletions
+171
-82
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+171
-82
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
17c7eea1
package
cn
.
quantgroup
.
xyqb
.
controller
.
external
.
user
;
package
cn
.
quantgroup
.
xyqb
.
controller
.
external
.
user
;
import
cn.quantgroup.user.enums.Relation
;
import
cn.quantgroup.user.enums.Relation
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.aspect.logcaller.LogHttpCaller
;
import
cn.quantgroup.xyqb.aspect.logcaller.LogHttpCaller
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.entity.enumerate.*
;
import
cn.quantgroup.xyqb.entity.enumerate.*
;
import
cn.quantgroup.xyqb.exception.UserNotExistException
;
import
cn.quantgroup.xyqb.model.*
;
import
cn.quantgroup.xyqb.model.*
;
import
cn.quantgroup.xyqb.service.api.IUserApiService
;
import
cn.quantgroup.xyqb.service.api.IUserApiService
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
...
@@ -25,15 +25,20 @@ import com.fasterxml.jackson.databind.ObjectMapper;
...
@@ -25,15 +25,20 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.google.common.base.MoreObjects
;
import
com.google.common.base.MoreObjects
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.Maps
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.UnsupportedEncodingException
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.*
;
...
@@ -82,12 +87,15 @@ public class InnerController implements IBaseController {
...
@@ -82,12 +87,15 @@ public class InnerController implements IBaseController {
@Value
(
"${xyqb.auth.url}"
)
@Value
(
"${xyqb.auth.url}"
)
private
String
hanguguanUrl
;
private
String
hanguguanUrl
;
private
final
String
pwdSalt
=
"_lkb"
;
private
static
final
ObjectMapper
MAPPER
=
new
ObjectMapper
();
private
static
final
ObjectMapper
MAPPER
=
new
ObjectMapper
();
static
{
static
{
MAPPER
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
MAPPER
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
MAPPER
.
configure
(
SerializationFeature
.
WRITE_ENUMS_USING_INDEX
,
true
);
MAPPER
.
configure
(
SerializationFeature
.
WRITE_ENUMS_USING_INDEX
,
true
);
}
}
private
static
final
char
[]
PWD_BASE
=
{
private
static
final
char
[]
PWD_BASE
=
{
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
...
@@ -127,16 +135,17 @@ public class InnerController implements IBaseController {
...
@@ -127,16 +135,17 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
}
}
User
user
=
userService
.
findByUuidInDb
(
uuid
);
User
user
=
userService
.
findByUuidInDb
(
uuid
);
if
(
null
!=
user
)
{
if
(
null
!=
user
)
{
if
(!
user
.
getEnable
())
{
if
(!
user
.
getEnable
())
{
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
}
}
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
UserInfo
info
=
new
UserInfo
(
user
,
userDetail
);
UserInfo
info
=
new
UserInfo
(
user
,
userDetail
);
return
JsonResult
.
buildSuccessResult
(
""
,
info
);
return
JsonResult
.
buildSuccessResult
(
""
,
info
);
}
}
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
}
}
@RequestMapping
(
"/userInfo/search/phone"
)
@RequestMapping
(
"/userInfo/search/phone"
)
@LogHttpCaller
@LogHttpCaller
public
JsonResult
findUserInfoByPhone
(
@RequestParam
(
value
=
"phone"
)
String
phone
)
{
public
JsonResult
findUserInfoByPhone
(
@RequestParam
(
value
=
"phone"
)
String
phone
)
{
...
@@ -146,12 +155,12 @@ public class InnerController implements IBaseController {
...
@@ -146,12 +155,12 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
}
}
User
user
=
userService
.
findByPhoneInDb
(
phone
);
User
user
=
userService
.
findByPhoneInDb
(
phone
);
if
(
null
!=
user
)
{
if
(
null
!=
user
)
{
if
(!
user
.
getEnable
())
{
if
(!
user
.
getEnable
())
{
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
}
}
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
UserInfo
info
=
new
UserInfo
(
user
,
userDetail
);
UserInfo
info
=
new
UserInfo
(
user
,
userDetail
);
return
JsonResult
.
buildSuccessResult
(
""
,
info
);
return
JsonResult
.
buildSuccessResult
(
""
,
info
);
}
}
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
...
@@ -177,9 +186,9 @@ public class InnerController implements IBaseController {
...
@@ -177,9 +186,9 @@ public class InnerController implements IBaseController {
@RequestMapping
(
"/user/save"
)
@RequestMapping
(
"/user/save"
)
public
JsonResult
saveUser
(
public
JsonResult
saveUser
(
String
phoneNo
,
Long
registeredFrom
,
Long
createdAt
,
Long
updatedAt
,
String
phoneNo
,
Long
registeredFrom
,
Long
createdAt
,
Long
updatedAt
,
String
password
,
String
uuid
)
{
String
password
,
String
uuid
)
{
LOGGER
.
info
(
"保存用户,phoneNo:{},registeredFrom;{},uuid:{}"
,
phoneNo
,
registeredFrom
,
uuid
);
LOGGER
.
info
(
"保存用户,phoneNo:{},registeredFrom;{},uuid:{}"
,
phoneNo
,
registeredFrom
,
uuid
);
//参数验证
//参数验证
if
(
StringUtils
.
isBlank
(
phoneNo
))
{
if
(
StringUtils
.
isBlank
(
phoneNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户手机号不能为空."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户手机号不能为空."
,
null
);
...
@@ -188,7 +197,7 @@ public class InnerController implements IBaseController {
...
@@ -188,7 +197,7 @@ public class InnerController implements IBaseController {
registeredFrom
=
0L
;
registeredFrom
=
0L
;
}
}
if
(
StringUtils
.
isBlank
(
password
))
{
if
(
StringUtils
.
isBlank
(
password
))
{
password
=
genRandomPwd
();
password
=
genRandomPwd
();
password
=
PasswordUtil
.
MD5
(
password
.
toLowerCase
()
+
Constants
.
PASSWORD_SALT
);
password
=
PasswordUtil
.
MD5
(
password
.
toLowerCase
()
+
Constants
.
PASSWORD_SALT
);
}
}
if
(
StringUtils
.
isBlank
(
uuid
))
{
if
(
StringUtils
.
isBlank
(
uuid
))
{
...
@@ -202,7 +211,7 @@ public class InnerController implements IBaseController {
...
@@ -202,7 +211,7 @@ public class InnerController implements IBaseController {
if
(
user
==
null
)
{
if
(
user
==
null
)
{
user
=
new
User
();
user
=
new
User
();
}
else
if
(!
user
.
getEnable
())
{
}
else
if
(!
user
.
getEnable
())
{
LOGGER
.
info
(
"用户已经注销,phoneNo:{},"
,
phoneNo
);
LOGGER
.
info
(
"用户已经注销,phoneNo:{},"
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"用户已经注销"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户已经注销"
,
null
);
}
}
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isEmpty
(
user
.
getUuid
()))
{
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isEmpty
(
user
.
getUuid
()))
{
...
@@ -218,7 +227,7 @@ public class InnerController implements IBaseController {
...
@@ -218,7 +227,7 @@ public class InnerController implements IBaseController {
user
=
userService
.
saveUser
(
user
);
user
=
userService
.
saveUser
(
user
);
UserRet
userRet
=
null
;
UserRet
userRet
=
null
;
if
(
user
!=
null
)
{
if
(
user
!=
null
)
{
userRet
=
MqUtils
.
sendRegisterMessage
(
registeredFrom
,
null
,
user
);
userRet
=
MqUtils
.
sendRegisterMessage
(
registeredFrom
,
null
,
user
);
}
}
return
JsonResult
.
buildSuccessResult
(
null
,
userRet
);
return
JsonResult
.
buildSuccessResult
(
null
,
userRet
);
}
}
...
@@ -229,8 +238,8 @@ public class InnerController implements IBaseController {
...
@@ -229,8 +238,8 @@ public class InnerController implements IBaseController {
*/
*/
@RequestMapping
(
"/user_detail/save"
)
@RequestMapping
(
"/user_detail/save"
)
public
JsonResult
saveUserDetail
(
Long
userId
,
String
phoneNo
,
String
name
,
String
idNo
,
public
JsonResult
saveUserDetail
(
Long
userId
,
String
phoneNo
,
String
name
,
String
idNo
,
String
email
,
Long
id
)
{
String
email
,
Long
id
)
{
LOGGER
.
info
(
"保存用户详细信息,phoneNo:{},userId;{},name:{},idNo:{},email;{}"
,
phoneNo
,
userId
,
name
,
idNo
,
email
);
LOGGER
.
info
(
"保存用户详细信息,phoneNo:{},userId;{},name:{},idNo:{},email;{}"
,
phoneNo
,
userId
,
name
,
idNo
,
email
);
//参数验证
//参数验证
if
(
userId
==
null
||
userId
==
0L
)
{
if
(
userId
==
null
||
userId
==
0L
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户id为空."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户id为空."
,
null
);
...
@@ -257,9 +266,9 @@ public class InnerController implements IBaseController {
...
@@ -257,9 +266,9 @@ public class InnerController implements IBaseController {
if
(
Objects
.
isNull
(
info
)
||
!
info
.
isValid
())
{
if
(
Objects
.
isNull
(
info
)
||
!
info
.
isValid
())
{
return
JsonResult
.
buildErrorStateResult
(
"身份证号码错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"身份证号码错误"
,
null
);
}
}
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
userId
);
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
userId
);
Timestamp
time
=
new
Timestamp
(
System
.
currentTimeMillis
());
Timestamp
time
=
new
Timestamp
(
System
.
currentTimeMillis
());
if
(
null
==
userDetail
)
{
if
(
null
==
userDetail
)
{
userDetail
=
new
UserDetail
();
userDetail
=
new
UserDetail
();
userDetail
.
setCreatedAt
(
time
);
userDetail
.
setCreatedAt
(
time
);
}
}
...
@@ -316,6 +325,7 @@ public class InnerController implements IBaseController {
...
@@ -316,6 +325,7 @@ public class InnerController implements IBaseController {
/**
/**
* 根据phone查找用户完整信息
* 根据phone查找用户完整信息
*
* @param phoneNo
* @param phoneNo
* @return
* @return
*/
*/
...
@@ -336,6 +346,7 @@ public class InnerController implements IBaseController {
...
@@ -336,6 +346,7 @@ public class InnerController implements IBaseController {
/**
/**
* 根据uuid查找用户完整信息
* 根据uuid查找用户完整信息
*
* @param uuid
* @param uuid
* @return
* @return
*/
*/
...
@@ -378,7 +389,7 @@ public class InnerController implements IBaseController {
...
@@ -378,7 +389,7 @@ public class InnerController implements IBaseController {
@RequestMapping
(
"/contact/save/contacts"
)
@RequestMapping
(
"/contact/save/contacts"
)
public
JsonResult
save2Contact
(
Long
userId
,
@RequestParam
(
value
=
"contacts"
)
String
contactsStr
)
{
public
JsonResult
save2Contact
(
Long
userId
,
@RequestParam
(
value
=
"contacts"
)
String
contactsStr
)
{
LOGGER
.
info
(
"保存用户联系人:userId:{}, contacts:{}"
,
userId
,
contactsStr
);
LOGGER
.
info
(
"保存用户联系人:userId:{}, contacts:{}"
,
userId
,
contactsStr
);
if
(
StringUtils
.
isEmpty
(
contactsStr
))
{
if
(
StringUtils
.
isEmpty
(
contactsStr
))
{
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
}
...
@@ -386,14 +397,15 @@ public class InnerController implements IBaseController {
...
@@ -386,14 +397,15 @@ public class InnerController implements IBaseController {
LOGGER
.
info
(
"用户ID不能为空"
);
LOGGER
.
info
(
"用户ID不能为空"
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
}
List
<
Contact
>
contacts
=
JSONObject
.
parseObject
(
contactsStr
,
new
TypeReference
<
List
<
Contact
>>(){});
List
<
Contact
>
contacts
=
JSONObject
.
parseObject
(
contactsStr
,
new
TypeReference
<
List
<
Contact
>>()
{
});
if
(
CollectionUtils
.
isEmpty
(
contacts
))
{
if
(
CollectionUtils
.
isEmpty
(
contacts
))
{
LOGGER
.
info
(
"联系人不能空"
);
LOGGER
.
info
(
"联系人不能空"
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
}
for
(
Contact
contact
:
contacts
)
{
for
(
Contact
contact
:
contacts
)
{
if
(!
contact
.
valid
())
{
if
(!
contact
.
valid
())
{
LOGGER
.
info
(
"用户手机号或姓名错误, phoneNo:{},name:{}"
,
contact
.
getPhoneNo
(),
contact
.
getName
());
LOGGER
.
info
(
"用户手机号或姓名错误, phoneNo:{},name:{}"
,
contact
.
getPhoneNo
(),
contact
.
getName
());
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
}
}
}
...
@@ -405,23 +417,23 @@ public class InnerController implements IBaseController {
...
@@ -405,23 +417,23 @@ public class InnerController implements IBaseController {
public
JsonResult
updateContact
(
@RequestParam
Long
contactId
,
@RequestParam
(
required
=
false
)
String
name
,
public
JsonResult
updateContact
(
@RequestParam
Long
contactId
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
phoneNo
,
@RequestParam
(
required
=
false
)
String
phoneNo
,
@RequestParam
(
required
=
false
)
Relation
relation
,
String
key
,
@RequestParam
(
required
=
false
)
Relation
relation
,
String
key
,
@RequestParam
String
reason
,
HttpServletRequest
request
)
{
@RequestParam
String
reason
,
HttpServletRequest
request
)
{
if
(!
"@qwsdedad131323213w!"
.
equals
(
key
)
||
contactId
==
null
)
{
if
(!
"@qwsdedad131323213w!"
.
equals
(
key
)
||
contactId
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"参数不合法"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"参数不合法"
,
null
);
}
}
if
(
StringUtils
.
isEmpty
(
name
)
&&
StringUtils
.
isEmpty
(
phoneNo
)
)
{
if
(
StringUtils
.
isEmpty
(
name
)
&&
StringUtils
.
isEmpty
(
phoneNo
)
)
{
return
JsonResult
.
buildErrorStateResult
(
"修改联系人修改条件不能都为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"修改联系人修改条件不能都为空"
,
null
);
}
}
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
LOGGER
.
info
(
"用户手机号错误, phoneNo:{}"
,
phoneNo
);
LOGGER
.
info
(
"用户手机号错误, phoneNo:{}"
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误"
,
null
);
}
}
if
(!
ValidationUtil
.
validateChinese
(
name
))
{
if
(!
ValidationUtil
.
validateChinese
(
name
))
{
LOGGER
.
info
(
"用户姓名错误, name:{}"
,
name
);
LOGGER
.
info
(
"用户姓名错误, name:{}"
,
name
);
return
JsonResult
.
buildErrorStateResult
(
"用户姓名错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户姓名错误"
,
null
);
}
}
if
(
StringUtils
.
isEmpty
(
reason
))
{
if
(
StringUtils
.
isEmpty
(
reason
))
{
return
JsonResult
.
buildErrorStateResult
(
"修改原因不能为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"修改原因不能为空"
,
null
);
}
}
Contact
contact
=
contactService
.
findById
(
contactId
);
Contact
contact
=
contactService
.
findById
(
contactId
);
...
@@ -429,7 +441,7 @@ public class InnerController implements IBaseController {
...
@@ -429,7 +441,7 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"修改联系人不存在"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"修改联系人不存在"
,
null
);
}
}
contact
=
contactService
.
saveContact
(
name
,
phoneNo
,
relation
,
contact
);
contact
=
contactService
.
saveContact
(
name
,
phoneNo
,
relation
,
contact
);
LOGGER
.
info
(
"修改后联系人信息:{},修改原因:{},操作ip:{}"
,
contact
,
reason
,
IPUtil
.
getRemoteIP
(
request
));
LOGGER
.
info
(
"修改后联系人信息:{},修改原因:{},操作ip:{}"
,
contact
,
reason
,
IPUtil
.
getRemoteIP
(
request
));
return
JsonResult
.
buildSuccessResult
(
"修改联系人成功"
,
contact
);
return
JsonResult
.
buildSuccessResult
(
"修改联系人成功"
,
contact
);
}
}
...
@@ -448,11 +460,11 @@ public class InnerController implements IBaseController {
...
@@ -448,11 +460,11 @@ public class InnerController implements IBaseController {
@RequestMapping
(
"/address/save"
)
@RequestMapping
(
"/address/save"
)
public
JsonResult
saveAddress
(
public
JsonResult
saveAddress
(
Long
userId
,
Long
provinceCode
,
Long
cityCode
,
String
city
,
Long
userId
,
Long
provinceCode
,
Long
cityCode
,
String
city
,
Long
districtCode
,
String
district
,
String
address
,
String
province
)
{
Long
districtCode
,
String
district
,
String
address
,
String
province
)
{
LOGGER
.
info
(
"保存地址详情:city:{},province:{},district:{}, address:{},userId:{}"
,
city
,
province
,
district
,
address
,
userId
);
LOGGER
.
info
(
"保存地址详情:city:{},province:{},district:{}, address:{},userId:{}"
,
city
,
province
,
district
,
address
,
userId
);
if
(
userId
==
null
||
provinceCode
==
null
||
cityCode
==
null
||
StringUtils
.
isBlank
(
address
))
{
if
(
userId
==
null
||
provinceCode
==
null
||
cityCode
==
null
||
StringUtils
.
isBlank
(
address
))
{
LOGGER
.
info
(
"错误保存地址详情,其中参数不能为空:city:{},province:{},district:{}, address:{},userId:{}"
,
city
,
province
,
district
,
address
,
userId
);
LOGGER
.
info
(
"错误保存地址详情,其中参数不能为空:city:{},province:{},district:{}, address:{},userId:{}"
,
city
,
province
,
district
,
address
,
userId
);
return
JsonResult
.
buildErrorStateResult
(
"参数不能为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"参数不能为空"
,
null
);
}
}
Address
addressObj
=
addressService
.
findByUserId
(
userId
);
Address
addressObj
=
addressService
.
findByUserId
(
userId
);
...
@@ -471,16 +483,16 @@ public class InnerController implements IBaseController {
...
@@ -471,16 +483,16 @@ public class InnerController implements IBaseController {
addressObj
.
setAddress
(
address
);
addressObj
.
setAddress
(
address
);
addressObj
.
setProvince
(
province
);
addressObj
.
setProvince
(
province
);
addressObj
=
addressService
.
save
(
addressObj
);
addressObj
=
addressService
.
save
(
addressObj
);
LOGGER
.
info
(
"保存后地址详情:{}"
,
addressObj
);
LOGGER
.
info
(
"保存后地址详情:{}"
,
addressObj
);
return
JsonResult
.
buildSuccessResult
(
null
,
AddressRet
.
address2AddressRet
(
addressObj
));
return
JsonResult
.
buildSuccessResult
(
null
,
AddressRet
.
address2AddressRet
(
addressObj
));
}
}
@RequestMapping
(
"/user_ext_info/update"
)
@RequestMapping
(
"/user_ext_info/update"
)
@LogHttpCaller
@LogHttpCaller
public
JsonResult
updateMarryStatus
(
public
JsonResult
updateMarryStatus
(
Long
userId
,
IncomeEnum
incomeEnum
,
IncomeRangeEnum
incomeRangeEnum
,
Long
userId
,
IncomeEnum
incomeEnum
,
IncomeRangeEnum
incomeRangeEnum
,
OccupationEnum
occupationEnum
,
EducationEnum
educationEnum
,
Boolean
hasCar
,
OccupationEnum
occupationEnum
,
EducationEnum
educationEnum
,
Boolean
hasCar
,
Boolean
hasSocialSecurity
,
Boolean
hasHouse
,
Boolean
hasCreditCard
,
MaritalStatus
maritalStatus
)
{
Boolean
hasSocialSecurity
,
Boolean
hasHouse
,
Boolean
hasCreditCard
,
MaritalStatus
maritalStatus
)
{
if
(
null
==
userId
)
{
if
(
null
==
userId
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户ID不能为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户ID不能为空"
,
null
);
}
}
...
@@ -583,19 +595,20 @@ public class InnerController implements IBaseController {
...
@@ -583,19 +595,20 @@ public class InnerController implements IBaseController {
* 按照用户主键查询用户综合信息模型
* 按照用户主键查询用户综合信息模型
* 综合信息模型包含:
* 综合信息模型包含:
* {
* {
*
账号信息
* 账号信息
*
个人信息
* 个人信息
*
扩展信息
* 扩展信息
*
地址信息
* 地址信息
*
联系人信息
* 联系人信息
* }
* }
*
* @param userId - 用户表主键
* @param userId - 用户表主键
* @return
* @return
*/
*/
@RequestMapping
(
"/user-association/search/userId"
)
@RequestMapping
(
"/user-association/search/userId"
)
@LogHttpCaller
@LogHttpCaller
public
JsonResult
findUserAssociationModelByUserId
(
Long
userId
)
{
public
JsonResult
findUserAssociationModelByUserId
(
Long
userId
)
{
if
(
Objects
.
isNull
(
userId
)
||
userId
<
0
)
{
if
(
Objects
.
isNull
(
userId
)
||
userId
<
0
)
{
return
JsonResult
.
buildErrorStateResult
(
""
,
""
);
return
JsonResult
.
buildErrorStateResult
(
""
,
""
);
}
}
UserAssociationModel
bean
=
new
UserAssociationModel
();
UserAssociationModel
bean
=
new
UserAssociationModel
();
...
@@ -619,19 +632,19 @@ public class InnerController implements IBaseController {
...
@@ -619,19 +632,19 @@ public class InnerController implements IBaseController {
}
}
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
userDetail
.
getUserId
());
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
userDetail
.
getUserId
());
if
(!
Objects
.
isNull
(
extInfo
))
{
if
(!
Objects
.
isNull
(
extInfo
))
{
if
(
null
==
extInfo
.
getEducationEnum
())
{
if
(
null
==
extInfo
.
getEducationEnum
())
{
bean
.
setEducationEnum
(
cn
.
quantgroup
.
user
.
enums
.
EducationEnum
.
UNKNOWN
.
getName
());
bean
.
setEducationEnum
(
cn
.
quantgroup
.
user
.
enums
.
EducationEnum
.
UNKNOWN
.
getName
());
}
else
{
}
else
{
bean
.
setEducationEnum
(
extInfo
.
getEducationEnum
().
getName
());
bean
.
setEducationEnum
(
extInfo
.
getEducationEnum
().
getName
());
}
}
if
(
null
==
extInfo
.
getOccupationEnum
())
{
if
(
null
==
extInfo
.
getOccupationEnum
())
{
bean
.
setOccupationEnum
(
cn
.
quantgroup
.
user
.
enums
.
OccupationEnum
.
UNKNOWN
.
getName
());
bean
.
setOccupationEnum
(
cn
.
quantgroup
.
user
.
enums
.
OccupationEnum
.
UNKNOWN
.
getName
());
}
else
{
}
else
{
bean
.
setOccupationEnum
(
extInfo
.
getOccupationEnum
().
getName
());
bean
.
setOccupationEnum
(
extInfo
.
getOccupationEnum
().
getName
());
}
}
if
(
null
==
extInfo
.
getMarryStatus
())
{
if
(
null
==
extInfo
.
getMarryStatus
())
{
bean
.
setMarryStatus
(
cn
.
quantgroup
.
user
.
enums
.
MaritalStatus
.
UNKNOWN
.
getDescription
());
bean
.
setMarryStatus
(
cn
.
quantgroup
.
user
.
enums
.
MaritalStatus
.
UNKNOWN
.
getDescription
());
}
else
{
}
else
{
bean
.
setMarryStatus
(
extInfo
.
getMarryStatus
().
getDescription
());
bean
.
setMarryStatus
(
extInfo
.
getMarryStatus
().
getDescription
());
}
}
}
}
...
@@ -664,10 +677,11 @@ public class InnerController implements IBaseController {
...
@@ -664,10 +677,11 @@ public class InnerController implements IBaseController {
/**
/**
* 获取用户综合信息
* 获取用户综合信息
*
* @param userDetail
* @param userDetail
* @return
* @return
*/
*/
private
UserAssociation
getUserAssociation
(
UserDetail
userDetail
){
private
UserAssociation
getUserAssociation
(
UserDetail
userDetail
)
{
UserAssociation
bean
=
new
UserAssociation
();
UserAssociation
bean
=
new
UserAssociation
();
if
(
null
!=
userDetail
)
{
if
(
null
!=
userDetail
)
{
Address
address
=
addressService
.
findByUserId
(
userDetail
.
getUserId
());
Address
address
=
addressService
.
findByUserId
(
userDetail
.
getUserId
());
...
@@ -686,19 +700,19 @@ public class InnerController implements IBaseController {
...
@@ -686,19 +700,19 @@ public class InnerController implements IBaseController {
bean
.
setAddress
(
address
.
getAddress
());
bean
.
setAddress
(
address
.
getAddress
());
}
}
if
(
null
!=
extInfo
)
{
if
(
null
!=
extInfo
)
{
if
(
null
==
extInfo
.
getEducationEnum
())
{
if
(
null
==
extInfo
.
getEducationEnum
())
{
bean
.
setEducationEnum
(
cn
.
quantgroup
.
user
.
enums
.
EducationEnum
.
UNKNOWN
.
getName
());
bean
.
setEducationEnum
(
cn
.
quantgroup
.
user
.
enums
.
EducationEnum
.
UNKNOWN
.
getName
());
}
else
{
}
else
{
bean
.
setEducationEnum
(
extInfo
.
getEducationEnum
().
getName
());
bean
.
setEducationEnum
(
extInfo
.
getEducationEnum
().
getName
());
}
}
if
(
null
==
extInfo
.
getOccupationEnum
())
{
if
(
null
==
extInfo
.
getOccupationEnum
())
{
bean
.
setOccupationEnum
(
cn
.
quantgroup
.
user
.
enums
.
OccupationEnum
.
UNKNOWN
.
getName
());
bean
.
setOccupationEnum
(
cn
.
quantgroup
.
user
.
enums
.
OccupationEnum
.
UNKNOWN
.
getName
());
}
else
{
}
else
{
bean
.
setOccupationEnum
(
extInfo
.
getOccupationEnum
().
getName
());
bean
.
setOccupationEnum
(
extInfo
.
getOccupationEnum
().
getName
());
}
}
if
(
null
==
extInfo
.
getMarryStatus
())
{
if
(
null
==
extInfo
.
getMarryStatus
())
{
bean
.
setMarryStatus
(
cn
.
quantgroup
.
user
.
enums
.
MaritalStatus
.
UNKNOWN
.
getDescription
());
bean
.
setMarryStatus
(
cn
.
quantgroup
.
user
.
enums
.
MaritalStatus
.
UNKNOWN
.
getDescription
());
}
else
{
}
else
{
bean
.
setMarryStatus
(
extInfo
.
getMarryStatus
().
getDescription
());
bean
.
setMarryStatus
(
extInfo
.
getMarryStatus
().
getDescription
());
}
}
}
}
...
@@ -733,6 +747,7 @@ public class InnerController implements IBaseController {
...
@@ -733,6 +747,7 @@ public class InnerController implements IBaseController {
}
}
return
contactRets
;
return
contactRets
;
}
}
@RequestMapping
(
"/user/wechat/phone_no"
)
@RequestMapping
(
"/user/wechat/phone_no"
)
@LogHttpCaller
@LogHttpCaller
public
JsonResult
queryOpenIdByPhoneNo
(
String
phoneNo
)
{
public
JsonResult
queryOpenIdByPhoneNo
(
String
phoneNo
)
{
...
@@ -768,6 +783,7 @@ public class InnerController implements IBaseController {
...
@@ -768,6 +783,7 @@ public class InnerController implements IBaseController {
/**
/**
* 清除用户缓存信息
* 清除用户缓存信息
*
* @param phoneNo
* @param phoneNo
* @return
* @return
*/
*/
...
@@ -785,6 +801,7 @@ public class InnerController implements IBaseController {
...
@@ -785,6 +801,7 @@ public class InnerController implements IBaseController {
LOGGER
.
info
(
"删除用户缓存信息,phoneNo:{},userId:{},"
,
user
.
getPhoneNo
(),
user
.
getId
());
LOGGER
.
info
(
"删除用户缓存信息,phoneNo:{},userId:{},"
,
user
.
getPhoneNo
(),
user
.
getId
());
return
JsonResult
.
buildSuccessResult
(
"用户缓存信息已经删除"
,
null
);
return
JsonResult
.
buildSuccessResult
(
"用户缓存信息已经删除"
,
null
);
}
}
@RequestMapping
(
"/user/spouse/save"
)
@RequestMapping
(
"/user/spouse/save"
)
public
JsonResult
saveSpouse
(
Long
userId
,
MaritalStatus
status
,
String
spousePhone
,
String
spouseName
)
{
public
JsonResult
saveSpouse
(
Long
userId
,
MaritalStatus
status
,
String
spousePhone
,
String
spouseName
)
{
if
(
userId
==
null
||
userId
==
0
)
{
if
(
userId
==
null
||
userId
==
0
)
{
...
@@ -849,6 +866,7 @@ public class InnerController implements IBaseController {
...
@@ -849,6 +866,7 @@ public class InnerController implements IBaseController {
/**
/**
* 手机号批量查询uuid
* 手机号批量查询uuid
*
* @param userPhones
* @param userPhones
* @return
* @return
*/
*/
...
@@ -857,6 +875,7 @@ public class InnerController implements IBaseController {
...
@@ -857,6 +875,7 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"主库不提供查询"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"主库不提供查询"
,
null
);
}
}
/**
/**
* 重置密码接口,供内部人员使用(例如绝影)
* 重置密码接口,供内部人员使用(例如绝影)
*/
*/
...
@@ -885,21 +904,21 @@ public class InnerController implements IBaseController {
...
@@ -885,21 +904,21 @@ public class InnerController implements IBaseController {
@RequestMapping
(
"/user/save_multi"
)
@RequestMapping
(
"/user/save_multi"
)
@LogHttpCaller
@LogHttpCaller
public
JsonResult
saveMulti
(
public
JsonResult
saveMulti
(
String
registeredFrom
,
String
registeredFrom
,
String
channelId
,
String
channelId
,
String
phoneNo
,
String
phoneNo
,
String
name
,
String
name
,
String
idNo
,
String
idNo
,
String
provinceCode
,
String
provinceCode
,
String
province
,
String
province
,
String
cityCode
,
String
cityCode
,
String
city
,
String
city
,
String
districtCode
,
String
districtCode
,
String
district
,
String
district
,
String
address
,
String
address
,
String
contacts
,
@RequestParam
(
defaultValue
=
"0"
,
required
=
false
)
Long
btRegisterChannelId
)
{
String
contacts
,
@RequestParam
(
defaultValue
=
"0"
,
required
=
false
)
Long
btRegisterChannelId
)
{
LOGGER
.
info
(
"[/innerapi/user/save_multi]保存用户、联系人、地址信息:registeredFrom:[{}], phoneNo[{}],name[{}],idNo[{}],provinceCode[{}],cityCode[{}],districtCode[{}],"
+
LOGGER
.
info
(
"[/innerapi/user/save_multi]保存用户、联系人、地址信息:registeredFrom:[{}], phoneNo[{}],name[{}],idNo[{}],provinceCode[{}],cityCode[{}],districtCode[{}],"
+
"address[{}],contacts[{}]"
,
registeredFrom
,
phoneNo
,
name
,
idNo
,
provinceCode
,
cityCode
,
districtCode
,
address
,
contacts
);
"address[{}],contacts[{}]"
,
registeredFrom
,
phoneNo
,
name
,
idNo
,
provinceCode
,
cityCode
,
districtCode
,
address
,
contacts
);
if
(!
NumberUtils
.
isDigits
(
registeredFrom
))
{
if
(!
NumberUtils
.
isDigits
(
registeredFrom
))
{
return
JsonResult
.
buildErrorStateResult
(
"注册渠道异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"注册渠道异常."
,
null
);
...
@@ -949,7 +968,7 @@ public class InnerController implements IBaseController {
...
@@ -949,7 +968,7 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"用户已存在,手机号被占用"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户已存在,手机号被占用"
,
null
);
}
}
user
=
userRegisterService
.
register
(
Long
.
valueOf
(
registeredFrom
),
Long
.
valueOf
(
channelId
),
phoneNo
,
name
,
idNo
,
provinceCode
,
province
,
cityCode
,
city
,
districtCode
,
district
,
address
,
contacts
,
btRegisterChannelId
);
user
=
userRegisterService
.
register
(
Long
.
valueOf
(
registeredFrom
),
Long
.
valueOf
(
channelId
),
phoneNo
,
name
,
idNo
,
provinceCode
,
province
,
cityCode
,
city
,
districtCode
,
district
,
address
,
contacts
,
btRegisterChannelId
);
UserRet
userRet
=
new
UserRet
(
user
);
UserRet
userRet
=
new
UserRet
(
user
);
return
JsonResult
.
buildSuccessResult
(
null
,
userRet
);
return
JsonResult
.
buildSuccessResult
(
null
,
userRet
);
...
@@ -975,11 +994,11 @@ public class InnerController implements IBaseController {
...
@@ -975,11 +994,11 @@ public class InnerController implements IBaseController {
@RequestMapping
(
"/contract/queryRegisterUsers"
)
@RequestMapping
(
"/contract/queryRegisterUsers"
)
@LogHttpCaller
@LogHttpCaller
public
JsonResult
findRegisterUserByTime
(
String
beginTime
,
String
endTime
)
{
public
JsonResult
findRegisterUserByTime
(
String
beginTime
,
String
endTime
)
{
if
(
null
==
beginTime
||
endTime
==
null
)
{
if
(
null
==
beginTime
||
endTime
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
}
List
<
User
>
userList
=
userService
.
findRegisterUserByTime
(
beginTime
,
endTime
);
List
<
User
>
userList
=
userService
.
findRegisterUserByTime
(
beginTime
,
endTime
);
return
JsonResult
.
buildSuccessResult
(
null
,
userList
);
return
JsonResult
.
buildSuccessResult
(
null
,
userList
);
}
}
...
@@ -996,13 +1015,13 @@ public class InnerController implements IBaseController {
...
@@ -996,13 +1015,13 @@ public class InnerController implements IBaseController {
if
(
null
==
str
||
!
str
.
equals
(
userId
.
toString
()))
{
if
(
null
==
str
||
!
str
.
equals
(
userId
.
toString
()))
{
return
JsonResult
.
buildErrorStateResult
(
"解密有误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"解密有误"
,
null
);
}
}
int
affectedRows
=
wechatService
.
forbiddenUserWeChat
(
userId
);
int
affectedRows
=
wechatService
.
forbiddenUserWeChat
(
userId
);
LOGGER
.
info
(
"用户微信禁用,userId:{},禁用的原因reason:{},受影响的行数affectedRows:{}"
,
userId
,
reason
,
affectedRows
);
LOGGER
.
info
(
"用户微信禁用,userId:{},禁用的原因reason:{},受影响的行数affectedRows:{}"
,
userId
,
reason
,
affectedRows
);
return
JsonResult
.
buildSuccessResult
(
"用户禁用微信成功"
,
affectedRows
);
return
JsonResult
.
buildSuccessResult
(
"用户禁用微信成功"
,
affectedRows
);
}
}
@RequestMapping
(
"/updateIdCard"
)
@RequestMapping
(
"/updateIdCard"
)
public
JsonResult
updateIdCard
(
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
idNo
,
public
JsonResult
updateIdCard
(
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
idNo
,
@RequestParam
String
phoneNo
,
@RequestParam
String
reason
,
@RequestParam
String
content
)
{
@RequestParam
String
phoneNo
,
@RequestParam
String
reason
,
@RequestParam
String
content
)
{
//密文
//密文
if
(
null
!=
content
)
{
if
(
null
!=
content
)
{
...
@@ -1012,18 +1031,18 @@ public class InnerController implements IBaseController {
...
@@ -1012,18 +1031,18 @@ public class InnerController implements IBaseController {
if
(
null
==
str
||
!
str
.
equals
(
phoneNo
))
{
if
(
null
==
str
||
!
str
.
equals
(
phoneNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"解密有误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"解密有误"
,
null
);
}
}
if
(
StringUtils
.
isBlank
(
name
)
&&
StringUtils
.
isBlank
(
idNo
))
{
if
(
StringUtils
.
isBlank
(
name
)
&&
StringUtils
.
isBlank
(
idNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"不能全为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"不能全为空"
,
null
);
}
}
if
(
StringUtils
.
isBlank
(
phoneNo
)
||
StringUtils
.
isBlank
(
reason
))
{
if
(
StringUtils
.
isBlank
(
phoneNo
)
||
StringUtils
.
isBlank
(
reason
))
{
return
JsonResult
.
buildErrorStateResult
(
"参数有误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"参数有误"
,
null
);
}
}
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
LOGGER
.
info
(
"手机号有误, phoneNo:{}"
,
phoneNo
);
LOGGER
.
info
(
"手机号有误, phoneNo:{}"
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误"
,
null
);
}
}
int
affectedRows
=
userDetailService
.
updateIdCard
(
name
,
idNo
,
phoneNo
);
int
affectedRows
=
userDetailService
.
updateIdCard
(
name
,
idNo
,
phoneNo
);
LOGGER
.
info
(
"更新用户的信息,name;{},idNo:{},phoneNo:{},操作的理由reason:{},受影响的行数affectedRows:{}"
,
name
,
idNo
,
phoneNo
,
reason
,
affectedRows
);
LOGGER
.
info
(
"更新用户的信息,name;{},idNo:{},phoneNo:{},操作的理由reason:{},受影响的行数affectedRows:{}"
,
name
,
idNo
,
phoneNo
,
reason
,
affectedRows
);
ImmutableMap
.
Builder
<
String
,
String
>
builder
=
ImmutableMap
.
builder
();
ImmutableMap
.
Builder
<
String
,
String
>
builder
=
ImmutableMap
.
builder
();
builder
.
put
(
"phoneNo"
,
phoneNo
);
builder
.
put
(
"phoneNo"
,
phoneNo
);
builder
.
put
(
"name"
,
name
);
builder
.
put
(
"name"
,
name
);
...
@@ -1055,8 +1074,8 @@ public class InnerController implements IBaseController {
...
@@ -1055,8 +1074,8 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误"
,
null
);
}
}
int
affectedRows
=
userService
.
forbiddenUser
(
enable
,
phoneNo
);
int
affectedRows
=
userService
.
forbiddenUser
(
enable
,
phoneNo
);
LOGGER
.
info
(
"禁用或者重启用户的理由,reason:{},手机号phoneNo:{},受影响的行数affectedRows:{}"
,
reason
,
phoneNo
,
affectedRows
);
LOGGER
.
info
(
"禁用或者重启用户的理由,reason:{},手机号phoneNo:{},受影响的行数affectedRows:{}"
,
reason
,
phoneNo
,
affectedRows
);
ImmutableMap
.
Builder
<
String
,
String
>
builder
=
ImmutableMap
.
builder
();
ImmutableMap
.
Builder
<
String
,
String
>
builder
=
ImmutableMap
.
builder
();
builder
.
put
(
"phoneNo"
,
phoneNo
);
builder
.
put
(
"phoneNo"
,
phoneNo
);
builder
.
put
(
"enable"
,
String
.
valueOf
(
enable
));
builder
.
put
(
"enable"
,
String
.
valueOf
(
enable
));
...
@@ -1067,6 +1086,7 @@ public class InnerController implements IBaseController {
...
@@ -1067,6 +1086,7 @@ public class InnerController implements IBaseController {
httpService
.
get
(
hanguguanUrl
.
concat
(
"/innerapi/forbiddenUserOrNot"
),
param
);
httpService
.
get
(
hanguguanUrl
.
concat
(
"/innerapi/forbiddenUserOrNot"
),
param
);
return
JsonResult
.
buildSuccessResult
(
"用户禁用或重启成功成功"
,
affectedRows
);
return
JsonResult
.
buildSuccessResult
(
"用户禁用或重启成功成功"
,
affectedRows
);
}
}
private
String
genRandomPwd
()
{
private
String
genRandomPwd
()
{
int
pwdMax
=
PWD_BASE
.
length
;
int
pwdMax
=
PWD_BASE
.
length
;
// 生成的随机数
// 生成的随机数
...
@@ -1085,4 +1105,73 @@ public class InnerController implements IBaseController {
...
@@ -1085,4 +1105,73 @@ public class InnerController implements IBaseController {
}
}
return
pwd
.
toString
();
return
pwd
.
toString
();
}
}
@LogHttpCaller
@RequestMapping
(
"/login"
)
public
JsonResult
login
(
@RequestParam
String
phoneNo
,
@RequestParam
String
password
)
{
User
user
=
checkPhoneNoAndPassword
(
phoneNo
,
password
);
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户名或密码不正确"
,
null
);
}
UserRet
model
=
new
UserRet
(
user
);
return
JsonResult
.
buildSuccessResult
(
"校验成功"
,
model
);
}
private
User
checkPhoneNoAndPassword
(
@RequestParam
String
phoneNo
,
@RequestParam
String
password
)
{
byte
[]
byPhoneNo
=
org
.
apache
.
commons
.
codec
.
binary
.
Base64
.
decodeBase64
(
phoneNo
);
String
bufPhoneNo
=
""
;
try
{
bufPhoneNo
=
new
String
(
byPhoneNo
,
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
LOGGER
.
error
(
"不支持的编码: "
,
e
);
}
if
(!
ValidationUtil
.
validatePhoneNo
(
bufPhoneNo
))
{
LOGGER
.
info
(
"手机号错误, phoneNo:{}"
,
bufPhoneNo
);
throw
new
UserNotExistException
(
"手机号错误"
);
}
byte
[]
byPassword
=
org
.
apache
.
commons
.
codec
.
binary
.
Base64
.
decodeBase64
(
password
);
String
bufPassword
=
""
;
try
{
bufPassword
=
new
String
(
byPassword
,
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
LOGGER
.
error
(
"不支持的编码: "
,
e
);
}
User
user
=
userService
.
findByPhoneWithCache
(
bufPhoneNo
);
if
(
user
==
null
||
!
user
.
getEnable
())
{
return
null
;
}
//验证密码
if
(!
validatePassword
(
bufPassword
,
user
.
getPassword
()))
{
return
null
;
}
return
user
;
}
private
boolean
validatePassword
(
String
paramPass
,
String
targetPassword
)
{
return
org
.
apache
.
commons
.
lang
.
StringUtils
.
defaultString
(
targetPassword
,
""
).
equals
(
PasswordUtil
.
MD5
(
paramPass
.
toLowerCase
()
+
pwdSalt
));
}
/**
* 查询用户是否存在
*
* @param phoneNo
* @return
*/
@RequestMapping
(
"/user/enable"
)
public
JsonResult
isEnable
(
String
phoneNo
)
{
boolean
flag
=
false
;
Map
validMap
=
Maps
.
newHashMap
();
validMap
.
put
(
"valid"
,
flag
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
if
(
user
!=
null
&&
user
.
getEnable
())
{
validMap
.
put
(
"valid"
,
true
);
return
JsonResult
.
buildSuccessResult
(
"查询成功"
,
validMap
);
}
return
JsonResult
.
buildErrorStateResult
(
"用户不存在"
,
validMap
);
}
}
}
\ No newline at end of file
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