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
463c78ff
Commit
463c78ff
authored
May 18, 2017
by
Java-刘 彧阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据用户手机号查用户id接口增加
parent
abd92e39
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
+35
-0
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+24
-0
IUserService.java
...in/java/cn/quantgroup/xyqb/service/user/IUserService.java
+1
-0
UserServiceImpl.java
...cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
+10
-0
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
463c78ff
...
@@ -26,6 +26,7 @@ import java.text.ParseException;
...
@@ -26,6 +26,7 @@ import java.text.ParseException;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* Created by Miraculous on 2016/12/19.
* Created by Miraculous on 2016/12/19.
...
@@ -464,6 +465,29 @@ public class InnerController implements IBaseController {
...
@@ -464,6 +465,29 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
null
,
UserSpouseRet
.
getUserSpouseRet
(
userSpouse
));
return
JsonResult
.
buildSuccessResult
(
null
,
UserSpouseRet
.
getUserSpouseRet
(
userSpouse
));
}
}
@RequestMapping
(
"/user/findByPhones"
)
public
JsonResult
getUseridByPhones
(
@RequestParam
(
"userPhones"
)
String
userPhones
){
//todo now
if
(
StringUtils
.
isBlank
(
userPhones
)){
return
JsonResult
.
buildErrorStateResult
(
"传入用户手机号不可为空"
,
null
);
}
List
<
String
>
phones
=
JSONObject
.
parseObject
(
userPhones
,
new
TypeReference
<
List
<
String
>>()
{});
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
phones
))
{
if
(!(
phones
.
size
()>
500
))
{
List
<
User
>
users
=
userService
.
findByPhones
(
phones
);
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
users
))
{
return
JsonResult
.
buildSuccessResult
(
null
,
users
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
()));
}
else
{
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
}
}
return
JsonResult
.
buildErrorStateResult
(
"单次批量查询不可超过500个手机号"
,
null
);
}
return
JsonResult
.
buildErrorStateResult
(
"传入用户手机号不可为空"
,
null
);
}
/**
/**
* 重置密码接口,供内部人员使用(例如绝影)
* 重置密码接口,供内部人员使用(例如绝影)
* @param key
* @param key
...
...
src/main/java/cn/quantgroup/xyqb/service/user/IUserService.java
View file @
463c78ff
...
@@ -32,4 +32,5 @@ public interface IUserService {
...
@@ -32,4 +32,5 @@ public interface IUserService {
User
findById
(
Long
userId
);
User
findById
(
Long
userId
);
List
<
User
>
findByPhones
(
List
<
String
>
phones
);
}
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
View file @
463c78ff
...
@@ -7,6 +7,7 @@ import cn.quantgroup.xyqb.service.sms.ISmsService;
...
@@ -7,6 +7,7 @@ import cn.quantgroup.xyqb.service.sms.ISmsService;
import
cn.quantgroup.xyqb.service.user.ILkbUserService
;
import
cn.quantgroup.xyqb.service.user.ILkbUserService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
...
@@ -17,6 +18,7 @@ import org.springframework.data.redis.core.RedisTemplate;
...
@@ -17,6 +18,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
javax.persistence.criteria.Predicate
;
import
javax.transaction.Transactional
;
import
javax.transaction.Transactional
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.List
;
...
@@ -88,6 +90,14 @@ public class UserServiceImpl implements IUserService {
...
@@ -88,6 +90,14 @@ public class UserServiceImpl implements IUserService {
return
userRepository
.
findById
(
userId
);
return
userRepository
.
findById
(
userId
);
}
}
@Override
public
List
<
User
>
findByPhones
(
List
<
String
>
phones
)
{
return
userRepository
.
findAll
((
root
,
query
,
cb
)
->
{
query
.
where
(
root
.
get
(
"phoneNo"
).
as
(
String
.
class
).
in
(
phones
));
return
query
.
getRestriction
();
});
}
@Override
@Override
public
User
registerAndReturn
(
String
phoneNo
,
String
password
,
Long
registerFrom
)
{
public
User
registerAndReturn
(
String
phoneNo
,
String
password
,
Long
registerFrom
)
{
...
...
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