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
185b03f0
Commit
185b03f0
authored
Jun 15, 2017
by
技术部—现金贷—曾丽宾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加数据校验,分页导出功能
parent
b851d0de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
15 deletions
+83
-15
UserQueryLogController.java
.../controller/external/queryLog/UserQueryLogController.java
+83
-15
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/queryLog/UserQueryLogController.java
View file @
185b03f0
...
...
@@ -35,8 +35,6 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import
javax.servlet.http.HttpServletResponse
;
import
static
com
.
sun
.
xml
.
internal
.
ws
.
api
.
model
.
wsdl
.
WSDLBoundOperation
.
ANONYMOUS
.
required
;
/**
* Created by zenglibin on 17/06/13.
*/
...
...
@@ -65,7 +63,7 @@ public class UserQueryLogController {
public
JsonResult
queryLog
(
@RequestParam
(
required
=
false
)
String
beginDate
,
@RequestParam
(
required
=
false
)
String
endDate
,
Integer
pageId
,
Integer
pageSize
)
{
try
{
SimpleDateFormat
sf
=
new
SimpleDateFormat
(
"yyyy-MM-
DD HH:mm:ss
"
);
SimpleDateFormat
sf
=
new
SimpleDateFormat
(
"yyyy-MM-
dd
"
);
Date
date1
=
null
,
date2
=
null
;
if
(
beginDate
!=
null
&&
StringUtils
.
hasLength
(
beginDate
)){
date1
=
sf
.
parse
(
beginDate
);
...
...
@@ -103,11 +101,9 @@ public class UserQueryLogController {
//key=>phoneNo、idNo、userId
//checkKeysType;
//后台参数校验
String
[]
values
=
keyValues
.
split
(
";"
);
List
<
String
>
queryV
=
Arrays
.
asList
(
values
);
List
<
UserQueryInfo
>
userQueryInfos
=
new
ArrayList
<
UserQueryInfo
>();
Page
<
UserQueryInfo
>
userQueryInfoPage
=
null
;
List
<
UserDetail
>
userDetails
=
new
ArrayList
<
UserDetail
>();
Page
<
UserDetail
>
userDetailPage
=
null
;
List
<
Address
>
addresslist
=
new
ArrayList
<
Address
>();
...
...
@@ -165,7 +161,6 @@ public class UserQueryLogController {
}
//转换userDetail to userQueryInfo
for
(
UserDetail
ud:
userDetails
){
UserQueryInfo
uqi
=
new
UserQueryInfo
();
if
(
columns
.
contains
(
"idNo"
)){
...
...
@@ -208,7 +203,7 @@ public class UserQueryLogController {
uqi
.
setPages
(
userDetailPage
.
getTotalPages
());
uqi
.
setTotal
(
userDetailPage
.
getTotalElements
());
return
JsonResult
.
buildSuccessResult
(
"成功"
,
uqi
);
return
JsonResult
.
buildSuccessResult
(
"
查询
成功"
,
uqi
);
}
private
String
getBankCardsByPhoneNos
(
String
phoneNo
){
...
...
@@ -238,15 +233,87 @@ public class UserQueryLogController {
}
@RequestMapping
(
"/exportUserInfo"
)
public
void
exportExcel
(
final
HttpServletResponse
response
,
String
key
,
String
keyValues
,
String
userName
,
String
columns
){
public
JsonResult
exportExcel
(
final
HttpServletResponse
response
,
String
key
,
String
keyValues
,
String
userName
,
String
columns
){
List
<
UserQueryInfo
>
uqls
=
new
ArrayList
<
UserQueryInfo
>();
UserQueryInfo
uq
=
new
UserQueryInfo
();
uq
.
setUserId
(
123
l
);
uq
.
setAddress
(
"AAAAAAA"
);
uq
.
setPhoneNo
(
"15840001232"
);
uq
.
setIdNo
(
"362529199701235671"
);
uq
.
setBankCards
(
"6217564445877112"
);
uqls
.
add
(
uq
);
String
[]
values
=
keyValues
.
split
(
";"
);
List
<
String
>
queryV
=
Arrays
.
asList
(
values
);
List
<
UserQueryInfo
>
userQueryInfos
=
new
ArrayList
<
UserQueryInfo
>();
List
<
UserDetail
>
userDetails
=
new
ArrayList
<
UserDetail
>();
List
<
Address
>
addresslist
=
new
ArrayList
<
Address
>();
if
(
key
.
equals
(
"userId"
)){
List
<
Long
>
userIds
=
new
ArrayList
<
Long
>();
try
{
for
(
String
s:
queryV
){
if
(
s
.
length
()>
8
){
return
JsonResult
.
buildErrorStateResult
(
"查询的userId长度超过8位"
,
s
);
}
long
uid
=
Long
.
valueOf
(
s
);
userIds
.
add
(
uid
);
}
}
catch
(
Exception
e
){
return
JsonResult
.
buildErrorStateResult
(
"查询的userId有误"
,
null
);
}
userDetails
=
userDetailService
.
findByUserIdIn
(
userIds
);
}
else
if
(
key
.
equals
(
"phoneNo"
)){
for
(
String
pn:
queryV
){
if
(!
ValidationUtil
.
validatePhoneNo
(
pn
)){
return
JsonResult
.
buildErrorStateResult
(
"查询的手机号码格式有误"
,
pn
);
}
}
userDetails
=
userDetailService
.
findByPhoneNos
(
queryV
);
}
else
if
(
key
.
equals
(
"idNo"
)){
IdcardValidator
iv
=
new
IdcardValidator
();
for
(
String
idno:
queryV
){
if
(!
iv
.
is18Idcard
(
idno
)&&!
iv
.
is15Idcard
(
idno
)){
return
JsonResult
.
buildErrorStateResult
(
"查询的身份证号格式有误"
,
idno
);
}
}
userDetails
=
userDetailService
.
findByIdnos
(
queryV
);
}
if
(
columns
.
contains
(
"bankCard"
)){
//需加银行卡信息
}
if
(
columns
.
contains
(
"address"
)){
List
<
Long
>
uidss
=
new
ArrayList
<
Long
>();
//加地址信息
for
(
UserDetail
ud:
userDetails
){
uidss
.
add
(
ud
.
getUserId
());
}
if
(
uidss
!=
null
&&
uidss
.
size
()>
0
){
addresslist
=
addressService
.
findByUserIds
(
uidss
);
}
}
for
(
UserDetail
ud:
userDetails
){
UserQueryInfo
uqi
=
new
UserQueryInfo
();
if
(
columns
.
contains
(
"idNo"
)){
uqi
.
setIdNo
(
ud
.
getIdNo
());
}
if
(
columns
.
contains
(
"phoneNo"
)){
uqi
.
setPhoneNo
(
ud
.
getPhoneNo
());
}
if
(
columns
.
contains
(
"userId"
)){
uqi
.
setUserId
(
ud
.
getUserId
());
}
if
(
columns
.
contains
(
"address"
)){
Optional
<
Address
>
oad
=
addresslist
.
stream
().
filter
(
addr
->
addr
.
getUserId
()==
ud
.
getUserId
()).
findFirst
();
if
(
oad
.
isPresent
()){
uqi
.
setAddress
(
oad
.
get
().
toString
());
}
}
uqls
.
add
(
uqi
);
}
HSSFWorkbook
wb
=
new
HSSFWorkbook
();
// 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
...
...
@@ -304,6 +371,7 @@ public class UserQueryLogController {
{
e
.
printStackTrace
();
}
return
JsonResult
.
buildSuccessResult
(
"导出成功"
,
null
);
}
}
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