UserFundAction.java
4.86 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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.ReportBiz;
import com.cjs.cms.biz.report.UserFundBiz;
import com.cjs.cms.dao.report.RebateClearDao;
import com.cjs.cms.dao.user.AppraisalDao;
import com.cjs.cms.util.lang.JsonUtil;
import com.cjs.cms.util.lang.PageUtils;
/**
* 用户资金查询
* @author tongxiaochuan
*
*/
@RestController
@RequestMapping("/report/fund")
public class UserFundAction {
@Autowired
private UserFundBiz userFundBiz;
@Autowired
private ReportBiz reportBiz;
@Autowired
private RebateClearDao rebateClearDao;
@Autowired
private AppraisalDao appraisalDao;
/**
* 查询用户红冲蓝补记录
* @param params
* @return
*/
@RequestMapping("record")
public String getFundChangeRecord(@RequestParam Map<String, Object> params) {
reportBiz.formatDate(params);
PageUtils.processOralcePage(params);
return JsonUtil.toPageJson(userFundBiz.search(params), userFundBiz.searchTotal(params));
}
/**
* 查询用户红冲蓝补记录导出
* @param params
* @return
*/
@RequestMapping("export")
public ResponseEntity<byte[]> exportFundChange(@RequestParam Map<String, Object> params,
HttpServletRequest request) throws Exception {
reportBiz.formatDate(params);
params.put("rows", 999999);
PageUtils.processOralcePage(params);
File targetFile = reportBiz.exportFundChange(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);
}
/**
* 返佣查询
* @param params
* @return
*/
@RequestMapping("rebate")
public String searchRebate(@RequestParam Map<String, Object> params) {
reportBiz.formatDate(params);
PageUtils.processOralcePage(params);
return JsonUtil.toPageJson(rebateClearDao.search(params),
rebateClearDao.searchTotal(params));
}
/**
* 返佣查询导出
* @param params
* @param request
* @return
* @throws Exception
*/
@RequestMapping("exportRebate")
public ResponseEntity<byte[]> exportRebateClear(@RequestParam Map<String, Object> params,
HttpServletRequest request) throws Exception {
reportBiz.formatDate(params);
params.put("rows", 999999);
PageUtils.processOralcePage(params);
File targetFile = reportBiz.exportRebateClear(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("appraisal")
public String appraisalCost(@RequestParam Map<String, Object> params) {
reportBiz.formatDate(params);
PageUtils.processOralcePage(params);
return JsonUtil.toPageJson(appraisalDao.search(params), appraisalDao.searchTotal(params));
}
@RequestMapping("exportAppraisal")
public ResponseEntity<byte[]> exportAppraisal(@RequestParam Map<String, Object> params,
HttpServletRequest request) throws Exception {
reportBiz.formatDate(params);
params.put("rows", 999999);
PageUtils.processOralcePage(params);
File targetFile = reportBiz.exportAppraisal(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);
}
}