Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
321794e9
Commit
321794e9
authored
Jul 29, 2022
by
翁国栋
Committed by
284718418@qq.com
Mar 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
8小时后台--
投保人员,导出调整
parent
1b5d1a58
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
9 deletions
+46
-9
src/main/java/cn/timer/api/controller/insure/InsureUserController.java
+44
-8
src/main/java/cn/timer/api/dto/insure/PolicyDto.java
+1
-0
src/main/resources/mapping/insure/InsureUserMapper.xml
+1
-1
No files found.
src/main/java/cn/timer/api/controller/insure/InsureUserController.java
View file @
321794e9
package
cn
.
timer
.
api
.
controller
.
insure
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
java.time.LocalDate
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
...
...
@@ -31,6 +37,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 被保人
...
...
@@ -97,14 +106,16 @@ public class InsureUserController{
return
ResultUtil
.
data
(
userList
);
}
@PostMapping
(
value
=
"/exportUserList"
)
@GetMapping
(
value
=
"/exportUserList"
)
@ApiOperation
(
value
=
"导出列表"
,
httpMethod
=
"GET"
,
notes
=
"导出列表"
)
public
void
exportUserList
(
@RequestParam
(
"policyId"
)
String
policyId
,
@RequestParam
(
"status"
)
String
status
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"policyDateStart"
)
String
policyDateStart
,
@RequestParam
(
"planId"
)
String
planId
,
@RequestParam
(
"categoryId"
)
String
categoryId
){
@RequestParam
(
"status"
)
String
status
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"policyDateStart"
)
String
policyDateStart
,
@RequestParam
(
"planId"
)
String
planId
,
@RequestParam
(
"categoryId"
)
String
categoryId
,
HttpServletRequest
request
,
HttpServletResponse
resp
){
LocalDate
localDate
=
LocalDate
.
now
();
PolicyDto
policyDto
=
new
PolicyDto
();
policyDto
.
setId
(
Integer
.
parseInt
(
policyId
));
policyDto
.
setStatus
(
status
);
...
...
@@ -112,9 +123,34 @@ public class InsureUserController{
policyDto
.
setPolicyDateStart
(
policyDateStart
);
policyDto
.
setPlanId
(
planId
);
policyDto
.
setCategoryId
(
categoryId
);
List
<
PolicyDto
>
list
=
insureUserMapper
.
selectPolicyList
(
policyDto
);
String
[]
rowName
=
new
String
[]{
"ID"
,
"name"
,
"ID_type"
,
"ID_number"
,
"Scheme_name"
,
"Date_start"
,
"Branch"
,
"Tricycle_frame_number"
,
"benefit_occupation_category"
};
Page
page
=
new
Page
();
page
.
setOffset
(
null
);
page
.
setTotalPage
(
null
);
policyDto
.
setPage
(
page
);
List
<
PolicyDto
>
userList
=
insureUserMapper
.
selectPolicyList
(
policyDto
);
String
[]
rowName
=
new
String
[]{
"编号"
,
"姓名"
,
"证件类型"
,
"证件号"
,
"保单号"
,
"状态"
,
"计划"
,
"保险生效时间"
,
"保险失效时间"
};
List
<
Object
[]>
list
=
null
;
// for ()
// XSSFWorkbook xssfWorkbook = ExcelUtils.exportExcel("导出人员清单.xlsx", rowName, list);
OutputStream
os
=
null
;
try
{
resp
.
setContentType
(
"application/octet-stream"
);
resp
.
setHeader
(
"content-disposition"
,
"attachment; filename="
+
URLEncoder
.
encode
(
localDate
+
"_"
+
list
.
size
()+
"名人员清单.xlsx"
,
"UTF-8"
));
resp
.
setCharacterEncoding
(
"UTF-8"
);
os
=
resp
.
getOutputStream
();
XSSFWorkbook
workbook
=
ExcelUtils
.
exportExcel
(
localDate
+
"_"
+
list
.
size
()+
"投保人列表导出.xlsx"
,
rowName
,
Collections
.
singletonList
(
list
.
stream
().
toArray
()));
workbook
.
write
(
os
);
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
os
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
src/main/java/cn/timer/api/dto/insure/PolicyDto.java
View file @
321794e9
...
...
@@ -47,4 +47,5 @@ public class PolicyDto {
private
String
monthD
;
private
String
userName
;
private
String
companyName
;
private
boolean
isAll
=
false
;
}
src/main/resources/mapping/insure/InsureUserMapper.xml
View file @
321794e9
...
...
@@ -338,7 +338,7 @@
</where>
order by iu.create_time desc
<if
test=
"
policyDto.page.offset != null and policyDto.page.totalPage !=nu
ll"
>
<if
test=
"
!policyDto.isA
ll"
>
LIMIT #{policyDto.page.offset},#{policyDto.page.totalPage}
</if>
...
...
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