QuotaUserBiz.java
1.56 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
package com.cjs.cms.biz.quota;
import java.io.File;
import java.net.URI;
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.quota.QuotaUserDao;
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;
/**
* 查询权益
* @author kongmingke
*
*/
@Service
public class QuotaUserBiz {
@Value("${download.export}")
private String exportPath;
@Autowired
private QuotaUserDao quotaUserDao;
/**
* 生成权益查询excel表
*/
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/quota_user.xlsx").toURI();
List<Map<String, Object>> list = quotaUserDao.searchQuota(params);
// 先生成Excel文件
config.setSourceTemplate(new File(template));
config.setTargetFile(targetFile);
config.setData(list);
new ExcelUtil(config).writeExcel();
return targetFile;
}
}