AgentTradeBiz.java
3.71 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
package com.cjs.cms.biz.agent;
import java.io.File;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.cjs.cms.action.user.fund.UserBalanceAction;
import com.cjs.cms.dao.agent.HisOtcDeliverDao;
import com.cjs.cms.dao.user.AgentInfoDao;
import com.cjs.cms.model.user.AgentInfo;
import com.cjs.cms.util.file.FileUtil;
import com.cjs.cms.util.lang.DateEnum;
import com.cjs.cms.util.lang.DateUtil;
import com.cjs.cms.util.lang.StringUtil;
import com.cjs.cms.util.poi.ExcelConfig;
import com.cjs.cms.util.poi.ExcelUtil;
/**
* 交易明细
* @author tongxiaochuan
*
*/
@Service
public class AgentTradeBiz {
Logger log = LogManager.getLogger();
@Autowired
private HisOtcDeliverDao hisOtcDeliverDao;
@Value("${download.export}")
private String exportPath;
@Autowired
private AgentInfoDao agentInfoDao;
public Map<String, Object> checkMember(Map<String, Object> params) {
Map<String, Object> outmap = new HashMap<String, Object>();
if (!StringUtil.isBlank(params.get("agentNo"))
|| !StringUtil.isBlank(params.get("developer"))) {
List<AgentInfo> list = agentInfoDao.searchAgent(params);
if (list.size() > 0) {
outmap.put("resultCode", list.get(0).getAgentLevel());
return outmap;
}
if (list.size() == 0) {
outmap.put("resultCode", "-2");
return outmap;
}
}
outmap.put("resultCode", "-1");
return outmap;
}
public List<Map<String, Object>> queryTradeMember(Map<String, Object> params) {
List<Map<String, Object>> list = hisOtcDeliverDao.queryTradeMember(params);
for (Map<String, Object> map : list) {
if (!"0".equals(map.get("AGENT_LEVEL"))) {
map.put("AGENT_NO", "");
map.put("AGENT_CLIENT_ID", "");
}
}
return list;
}
public int queryTradeMemberTotal(Map<String, Object> params) {
return hisOtcDeliverDao.queryTradeMemberTotal(params);
}
public Map<String, Object> queryTradeMemberSum(Map<String, Object> params) {
return hisOtcDeliverDao.queryTradeMemberSum(params);
}
public File export(Map<String, Object> params) throws Exception {
String filename = "一级会员交易明细_" + DateUtil.getNow(DateEnum.UNSIGNED_DATE_TIME);
filename = FileUtil.makeMonthDir(exportPath) + filename + ".xlsx";
File targetFile = new File(filename);
ExcelConfig config = new ExcelConfig();
URI template = UserBalanceAction.class.getResource("/excel/member_trade.xlsx").toURI();
//查询导出的数据
List<Map<String, Object>> list = hisOtcDeliverDao.queryTradeMember(params);
// 先生成Excel文件
config.setSourceTemplate(new File(template));
config.setTargetFile(targetFile);
config.setData(list);
new ExcelUtil(config).writeExcel();
return targetFile;
}
//二级会员交易查询
public List<Map<String, Object>> queryTradeAgent(Map<String, Object> params) {
return hisOtcDeliverDao.queryTradeAgent(params);
}
public int queryTradeAgentTotal(Map<String, Object> params) {
return hisOtcDeliverDao.queryTradeAgentTotal(params);
}
public Map<String, Object> queryTradeAgentSum(Map<String, Object> params) {
return hisOtcDeliverDao.queryTradeAgentSum(params);
}
}