TrustApplyAction.java
5.94 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
package com.cjs.cms.action.report;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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.dao.ration.TrustApplyDao;
import com.cjs.cms.util.lang.JsonUtil;
import com.cjs.cms.util.lang.PageUtils;
/**
* 托管
*
* @author tongyufu
*
*/
@RestController
@RequestMapping("/report/trustApply")
public class TrustApplyAction {
Logger log = LogManager.getLogger();
@Autowired
private ReportBiz reportBiz;
@Autowired
private TrustApplyDao trustApplyDao;
/** 托管数量统计 */
@RequestMapping("querySum")
public String querySum(@RequestParam Map<String, Object> params) {
reportBiz.formatDate(params);
PageUtils.processOralcePage(params);
return JsonUtil.toPageJson(trustApplyDao.querySum(params),
trustApplyDao.querySumTotal(params));
}
/** 查询 */
@RequestMapping("search")
public String search(@RequestParam Map<String, Object> params) {
reportBiz.formatDate(params);
PageUtils.processOralcePage(params);
return JsonUtil.toPageJson(trustApplyDao.search(params), trustApplyDao.searchTotal(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.exportTrustApplyDetail(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("searchApply")
public String getTrustApply(@RequestParam Map<String, Object> params) {
reportBiz.formatDate(params);
PageUtils.processOralcePage(params);
Map<String, Object> footer = trustApplyDao.selectApplySumTotal(params);
if (footer == null) {
footer = new HashMap<String, Object>();
}
footer.put("APPLY_DATE", "汇总");
return JsonUtil.toPageJson(trustApplyDao.selectApply(params),
trustApplyDao.selectApplyTotal(params), footer);
}
/**
* 托管申请查询导出
* @param params
* @param request
* @return
* @throws Exception
*/
@RequestMapping("exportApply")
public ResponseEntity<byte[]> exportApply(@RequestParam Map<String, Object> params,
HttpServletRequest request) throws Exception {
reportBiz.formatDate(params);
params.put("rows", 999999);
PageUtils.processOralcePage(params);
File targetFile = reportBiz.exportTrustApplyList(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("online")
public String searchApplyOnline(@RequestParam Map<String, Object> params) {
reportBiz.formatDate(params);
PageUtils.processOralcePage(params);
return JsonUtil.toPageJson(trustApplyDao.selectToOnline(params),
trustApplyDao.selectToOnlineTotal(params));
}
/**
* 托管转赵涌在线导出
* @param params
* @param request
* @return
* @throws Exception
*/
@RequestMapping("exportOnline")
public ResponseEntity<byte[]> exportOnline(@RequestParam Map<String, Object> params,
HttpServletRequest request) throws Exception {
reportBiz.formatDate(params);
params.put("rows", 999999);
PageUtils.processOralcePage(params);
File targetFile = reportBiz.exportTrustApplyOnline(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);
}
/**
* 转赵涌在线
* @return
*
*/
@RequestMapping("/changeOnline")
public String changeOnline(@RequestParam Map<String, Object> params) {
return reportBiz.changeOnline(params);
}
/**
* 转赵涌在心
* 根据内部流转号查询托管信息
* @param innercirculatNo 内部流转号
* @return 托管信息
*/
@RequestMapping("/queryTrustApply")
public String queryTrustApply(String innerNo) {
return reportBiz.queryTrustApply(innerNo);
}
}