Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
manager
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
reyun
manager
Commits
e87c86ca
Commit
e87c86ca
authored
Jan 31, 2018
by
manxiaoqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app排序
parent
d28522b6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
workspace.xml
.idea/workspace.xml
+0
-0
ContractController.java
src/main/java/common/controller/ContractController.java
+44
-0
No files found.
.idea/workspace.xml
View file @
e87c86ca
This diff is collapsed.
Click to expand it.
src/main/java/common/controller/ContractController.java
View file @
e87c86ca
package
common
.
controller
;
import
com.google.common.collect.ImmutableList
;
import
common.model.*
;
import
common.service.ContractService
;
import
common.service.MenuService
;
import
dic.OperateObjectTypeEnum
;
import
exception.TipException
;
import
org.apache.commons.io.IOUtils
;
import
org.joda.time.DateTime
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
security.annotation.CurrentAccount
;
import
util.NewUserLogThread
;
import
util.ResultModel
;
import
util.UserLogThread
;
import
util.ValidateUtil
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -34,6 +51,33 @@ public class ContractController {
return
ResultModel
.
OK
(
service
.
findAll
(
startDate
,
endDate
,
platform
));
}
@RequestMapping
(
value
=
"export"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResponseEntity
<
byte
[]>
export
(
@PathVariable
String
platform
,
@RequestParam
String
startDate
,
@RequestParam
String
endDate
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
List
<
Contract
>
contractList
=
service
.
findAll
(
startDate
,
endDate
,
platform
);
InputStream
in
=
null
;
byte
[]
content
=
new
byte
[
0
];
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"时间,合同编号,客户账号,签约方,销售,开始日期,结束日期,套餐类型,合同金额,折扣,收款金额,合同状态"
);
if
(
ValidateUtil
.
isValid
(
contractList
)){
for
(
Contract
c
:
contractList
){
sb
.
append
(
c
.
getDs
()).
append
(
c
.
getContractCode
()).
append
(
c
.
getEmail
()).
append
(
c
.
getCustomerBody
()).
append
(
c
.
getSaleName
())
.
append
(
c
.
getStartDate
()).
append
(
c
.
getEndDate
()).
append
(
c
.
getPriceLevelName
()).
append
(
c
.
getMoney
()).
append
(
c
.
getPayMoney
())
.
append
(
c
.
getStatus
());
}
}
content
=
sb
.
toString
().
getBytes
();
HttpHeaders
headers
=
new
HttpHeaders
();
response
.
setHeader
(
"filename"
,
"contraact.xls"
);
response
.
setHeader
(
"content-disposition"
,
"attachment; filename=contraact.xls"
);
response
.
setHeader
(
"Content-Type"
,
"application/vnd.ms-excel"
);
//返回文件字符串
return
new
ResponseEntity
<
byte
[]>(
content
,
headers
,
HttpStatus
.
CREATED
);
}
@RequestMapping
(
value
=
"findone"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResultModel
findOne
(
@CurrentAccount
User
loginAccount
,
@RequestParam
String
code
)
{
...
...
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