HisFundjourAction.java
3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.cjs.cms.action.report;
import java.io.File;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.cjs.cms.biz.report.FundJourBiz;
import com.cjs.cms.biz.report.ReportBiz;
import com.cjs.cms.dao.report.FundJourDao;
import com.cjs.cms.dao.report.HisFundjourDao;
import com.cjs.cms.util.lang.JsonUtil;
import com.cjs.cms.util.lang.PageUtils;
/**
*
* 出入金汇总
*
* @author kongmingke
*
*/
@RestController
@RequestMapping("/report/hisFundjour")
public class HisFundjourAction {
@Autowired
private HisFundjourDao hisFundJour;
@Autowired
private ReportBiz reportBiz;
@Autowired
private FundJourBiz jourBiz;
@Autowired
private FundJourDao fundJour;
@RequestMapping("/search")
public String search(@RequestParam Map<String, Object> params) {
PageUtils.processOralcePage(params);
reportBiz.formatDate(params);
return JsonUtil.toPageJson(hisFundJour.queryFundSum(params),
hisFundJour.queryFundSumTotal(params), hisFundJour.queryFundAmount(params));
}
@RequestMapping("/export")
public ResponseEntity<byte[]> export(@RequestParam Map<String, Object> params,
HttpServletRequest request) throws Exception {
reportBiz.formatDate(params);
params.put("rows", 999999);
PageUtils.processOralcePage(params);
File targetFile = reportBiz.exportHisFundJour(params);
HttpHeaders head = new HttpHeaders();
head.setContentType(MediaType.APPLICATION_OCTET_STREAM);
// 下载的文件名
head.setContentDispositionFormData("attachment",
new String(targetFile.getName().getBytes("UTF-8"), "ISO8859-1"));
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(targetFile), head,
HttpStatus.CREATED);
}
/**
* 用户资金流水
*/
@RequestMapping("/queryAccount")
public String queryAccount(@RequestParam Map<String, Object> params) {
PageUtils.processOralcePage(params);
if (params.get("currDate") != null && !"".equals(params.get("currDate") + "")) {
params.put("currDate", reportBiz.formatDate(params.get("currDate") + ""));
}
return JsonUtil.toPageJson(jourBiz.queryAccount(params),
fundJour.queryAccountTotal(params));
}
@RequestMapping("/exportAccount")
public ResponseEntity<byte[]> exportAccount(@RequestParam Map<String, Object> params,
HttpServletRequest request) throws Exception {
reportBiz.formatDate(params);
params.put("rows", 999999);
if (params.get("currDate") != null && !"".equals(params.get("currDate") + "")) {
params.put("currDate", reportBiz.formatDate(params.get("currDate") + ""));
}
File targetFile = jourBiz.exportFundJour(params);
HttpHeaders head = new HttpHeaders();
head.setContentType(MediaType.APPLICATION_OCTET_STREAM);
// 下载的文件名
head.setContentDispositionFormData("attachment",
new String(targetFile.getName().getBytes("UTF-8"), "ISO8859-1"));
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(targetFile), head,
HttpStatus.CREATED);
}
}