AgentTradeAction.java
3.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
package com.cjs.cms.action.agent;
import java.io.File;
import java.util.HashMap;
import java.util.List;
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.agent.AgentTradeBiz;
import com.cjs.cms.biz.report.ReportBiz;
import com.cjs.cms.dao.user.AgentInfoDao;
import com.cjs.cms.model.user.AgentInfo;
import com.cjs.cms.util.lang.JsonUtil;
import com.cjs.cms.util.lang.PageUtils;
import com.cjs.cms.util.lang.StringUtil;
import com.cjs.cms.util.web.TimeInterval;
/**
* 代理商
*
* @author tongxiaochuan
*
*/
@RestController
@RequestMapping("/agent")
public class AgentTradeAction {
@Autowired
private AgentTradeBiz agentBiz;
@Autowired
private ReportBiz reportBiz;
@Autowired
private AgentInfoDao agentInfoDao;
// @RequestMapping("check")
// public Map<String, Object> checkLevel(@RequestParam Map<String, Object> params) {
// return agentBiz.checkMember(params);
// }
/**
* 查询一级会员交易明细
* @param params
* @return
*/
@RequestMapping("/trade/member")
public String queryMemberTrade(@RequestParam Map<String, Object> params) {
PageUtils.processOralcePage(params);
reportBiz.formatDate(params);
if (!StringUtil.isBlank(params.get("developer"))) {
Map<String, Object> search = new HashMap<String, Object>();
search.put("developer", params.get("developer"));
List<AgentInfo> list = agentInfoDao.searchAgent(search);
if (list.size() > 0) {
params.put("agentNo", list.get(0).getAgentNo());
}
}
return JsonUtil.toPageJson(agentBiz.queryTradeMember(params),
agentBiz.queryTradeMemberTotal(params), agentBiz.queryTradeMemberSum(params));
}
@TimeInterval("10")
@RequestMapping("/trade/member/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 = agentBiz.export(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("/trade/agent")
// public String queryAgentTrade(@RequestParam Map<String, Object> params) {
// PageUtils.processOralcePage(params);
// reportBiz.formatDate(params);
// if (!StringUtil.isBlank(params.get("developer"))) {
// Map<String, Object> search = new HashMap<String, Object>();
// search.put("fundAccount", params.get("developer"));
// List<AgentInfo> list = agentInfoDao.searchAgent(search);
// if (list.size() > 0) {
// params.put("agentNo", list.get(0).getAgentNo());
// }
// }
// return JsonUtil.toPageJson(agentBiz.queryTradeAgent(params),
// agentBiz.queryTradeAgentTotal(params), agentBiz.queryTradeAgentSum(params));
// }
}