FundJourBiz.java
2.96 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
package com.cjs.cms.biz.report;
import java.io.File;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.pub.SysConfigDao;
import com.cjs.cms.dao.report.FundJourDao;
import com.cjs.cms.model.pub.SysConfigInfo;
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.poi.ExcelConfig;
import com.cjs.cms.util.poi.ExcelUtil;
/**
* 用户资金流水
*
*/
@Service
public class FundJourBiz {
@Autowired
private FundJourDao fundJour;
@Autowired
private SysConfigDao configDao;
@Value("${download.export}")
private String exportPath;
public List<Map<String, Object>> queryAccount(Map<String, Object> params) {
List<Map<String, Object>> list = fundJour.queryAccount(params);
Map<String, String> sysConfigMap = getSysConfig();
for (Map<String, Object> map : list) {//查询业务标识名称
String bussinessName = sysConfigMap.get(map.get("BUSINESS_FLAG") + "");
if (bussinessName != null && !"".equals(bussinessName)) {
map.put("BUSINESS_NAME", bussinessName);
}
}
return list;
}
/** 导出用户资金流水*/
public File exportFundJour(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/fund_jour_detail.xlsx").toURI();
List<Map<String, Object>> applys = fundJour.exportFundJour(params);
Map<String, String> sysConfigMap = getSysConfig();
for (Map<String, Object> map : applys) {//查询业务标识名称
String bussinessName = sysConfigMap.get(map.get("BUSINESS_FLAG") + "");
if (bussinessName != null && !"".equals(bussinessName)) {
map.put("BUSINESS_NAME", bussinessName);
}
}
// 先生成Excel文件
config.setSourceTemplate(new File(template));
config.setTargetFile(targetFile);
config.setData(applys);
new ExcelUtil(config).writeExcel();
return targetFile;
}
//拿到系统参数配置
public Map<String, String> getSysConfig() {
Map<String, String> sysConfig = new HashMap<String, String>();
List<SysConfigInfo> lists = configDao.search();
for (SysConfigInfo sysConfigInfo : lists) {
sysConfig.put(sysConfigInfo.getSysKey(), sysConfigInfo.getSysValue());
}
return sysConfig;
}
}