码迷,mamicode.com
首页 > 其他好文 > 详细

导出功能

时间:2017-04-10 13:04:08      阅读:367      评论:0      收藏:0      [点我收藏+]

标签:小数   cell   round   param   ble   setborder   label   class   share   

package com.iyx.service.impl;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.math.RoundingMode;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.iyx.model.dao.ActivityMapper;
import com.iyx.model.dao.CommentMapper;
import com.iyx.model.dao.InformationMapper;
import com.iyx.model.dao.TeamUserMapper;
import com.iyx.model.dao.UserExtendMapper;
import com.iyx.model.dao.VigourMapper;
import com.iyx.model.entity.KpiItem;
import com.iyx.service.KpiItemService;

import common.util.CommonUtil;
import common.util.DateUtil;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.VerticalAlignment;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;

/**
* KPI统计
*
* @author zsl
*/
@Service
public class KpiItemServiceImpl implements KpiItemService {

@Autowired
private TeamUserMapper teamUserMapper;

@Autowired
private VigourMapper vigourMapper;

@Autowired
private CommentMapper commentMapper;

@Autowired
private ActivityMapper activityMapper;

@Autowired
private InformationMapper informationMapper;

@Autowired
private UserExtendMapper userExtendMapper;

// 创建工作簿
private WritableWorkbook workbook = null;

// 创建输出流
private OutputStream os = null;

// 创建工作表
private WritableSheet sheet = null;

// 字体样式: 用于标题居中
private WritableCellFormat wcf_center = null;

// 字体样式: 用于正文居左
private WritableCellFormat wcf_left = null;

// 设置单元格字体
private WritableFont NormalFont = null;
private WritableFont BoldFont = null;

@Override
public void saveOrUpdate(Object record) {
}

@Override
public void deleteById(Integer id) {
}

@Override
public Object selectById(Integer id) {
return null;
}

/**
* 小组活动统计
*/
@Override
public List<KpiItem> findActStatistics(String startTime, String endTime) {
long start = 0, end = 0;

// 获取起始毫秒数
if (CommonUtil.isEmpty(startTime)) {
start = DateUtil.getCurrentMonthStartTime();
} else {
start = DateUtil.getDate(startTime, DateUtil.f2).getTime();
}

// 获取结束毫秒数
if (CommonUtil.isEmpty(endTime)) {
end = DateUtil.getCurrentMonthEndTime();
} else {
end = DateUtil.getDate(endTime, DateUtil.f2).getTime();
}

// 查询小组活动数量
List<KpiItem> list = activityMapper.activityNum(start, end);
for (KpiItem kpiItem : list) {
// 获取小组长姓名
String nickName = findTeamName(kpiItem.getTeamId());
kpiItem.setNickName(nickName);
}
return list;
}

/**
* 查询统计小组的活动人数及购买比例
*/
@Override
public List<KpiItem> findActBuyStatistics(String startTime, String endTime) {

long start = 0, end = 0;

// 获取起始毫秒数
if (CommonUtil.isEmpty(startTime)) {
start = DateUtil.getCurrentMonthStartTime();
} else {
start = DateUtil.getDate(startTime, DateUtil.f2).getTime();
}

// 获取结束毫秒数
if (CommonUtil.isEmpty(endTime)) {
end = DateUtil.getCurrentMonthEndTime();
} else {
end = DateUtil.getDate(endTime, DateUtil.f2).getTime();
}

// 查询小组活动人数、购买比例
List<KpiItem> list = activityMapper.selectActStatistics(start, end);
for (KpiItem kpiItem : list) {

// 获取购买比例
double buyPercent = kpiItem.getBuyRatio();
NumberFormat nf = NumberFormat.getPercentInstance();// 转换百分数
nf.setMinimumFractionDigits(2);// 设置保留小数位
nf.setRoundingMode(RoundingMode.HALF_UP); // 设置舍入模式
String buyRatio = nf.format(buyPercent);
kpiItem.setVigGrade(buyRatio);

// 获取小组长姓名
String nickName = findTeamName(kpiItem.getTeamId());
kpiItem.setNickName(nickName);
}

return list;
}

/**
* 查询公司内部人员KPI动态量统计
*/
@Override
public List<KpiItem> findKpiVigourStatistics(String startTime, String endTime) {
long start = 0, end = 0;

// 设置当月起始时间
if (CommonUtil.isEmpty(startTime)) {
start = DateUtil.getCurrentMonthStartTime();
} else {
start = DateUtil.getDate(startTime, DateUtil.f2).getTime();
}

// 设置当月结束时间
if (CommonUtil.isEmpty(endTime)) {
end = DateUtil.getCurrentMonthEndTime();
} else {
end = DateUtil.getDate(endTime, DateUtil.f2).getTime();
}

// 查询用户id,name
List<KpiItem> list = teamUserMapper.selectKpiStatistics(start, end);
for (KpiItem kpiItem : list) {

// 获取用户某段时间的动态量总数
int vigourCount = countVigourNum(kpiItem.getUserId(), start, end);
kpiItem.setVigCount(vigourCount);

// 查询用户某个时间段的回复动态评论数
int vigourComment = countVigourComment(kpiItem.getUserId(), start, end);
kpiItem.setVigComment(vigourComment);

}
return list;
}

/**
* 查询用户某个月的动态量
*/
private int countVigourNum(Integer userId, long startTime, long endTime) {

// 计算用户某个时间段的动态量总数
int vigourCount = vigourMapper.vigourCount(userId, startTime, endTime);

return vigourCount;
}

/**
* 查询用户某个时间段的回复动态评论数
*
* @param userId
* 用户ID
* @param startTime
* 开始时间
* @param endTime
* 结束时间
* @return
*/
private int countVigourComment(Integer userId, long startTime, long endTime) {

// 查询用户某段时间的动态回复量
int vigourComment = commentMapper.vigourComment(userId, startTime, endTime);

return vigourComment;
}

/**
* 查询小组发动态的人数
*
* @param teamId
* 小组ID
* @param startTime
* 开始时间
* @param endTime
* 结束时间
* @return
*/
private int countTeamVigourNum(Integer teamId, long startTime, long endTime) {

int vigourTeamVitalityNum = vigourMapper.countVigourNum(teamId, startTime, endTime);

return vigourTeamVitalityNum;
}

/**
* 查询某个时间段的小组总人数
*
* @param teamId
* @param startTime
* @param endTime
* @return
*/
private int countTeamNum(Integer teamId, long startTime, long endTime) {
startTime = 0;
int vigourTeamNum = vigourMapper.countTeamNum(teamId, startTime, endTime);

return vigourTeamNum;
}

/**
* 查询统计小组资讯
*/
@Override
public List<KpiItem> findKpiInforStatistics(String startTime, String endTime) {
long start = 0, end = 0;

// 获取起始毫秒数
if (CommonUtil.isEmpty(startTime)) {
start = DateUtil.getCurrentMonthStartTime();
} else {
start = DateUtil.getDate(startTime, DateUtil.f2).getTime();
}

// 获取结束毫秒数
if (CommonUtil.isEmpty(endTime)) {
end = DateUtil.getCurrentMonthEndTime();
} else {
end = DateUtil.getDate(endTime, DateUtil.f2).getTime();
}

// 查询小组文章信息
List<KpiItem> list = informationMapper.selectInforNum(start, end);
for (KpiItem kpiItem : list) {
System.out.println(kpiItem);
// 获取小组文章阅读量
int inforBrowseNum = findInforReadNum(kpiItem.getTeamId(), start, end);
kpiItem.setInforBrowseNum(inforBrowseNum);

// 获取小组文章转发量
int inforShareNum = findInforShareNum(kpiItem.getTeamId(), start, end);
kpiItem.setInforShareNum(inforShareNum);

// 获取小组长姓名
String nickName = findTeamName(kpiItem.getTeamId());
kpiItem.setNickName(nickName);
}

return list;
}

/**
* 根据小组ID查询小组长姓名
*/
private String findTeamName(int teamId) {
List<String> teamName = userExtendMapper.selectTeamName(teamId);

// 转换字符串
StringBuffer buffer = new StringBuffer();
for (String names : teamName) {
buffer.append(names).append(",");
}
String nickName = buffer.substring(0, buffer.length() - 1).trim();

return nickName;
}

/**
* 查询小组文章阅读量
*
* @param teamId
* @param start
* @param end
* @return
*/
private int findInforReadNum(Integer teamId, long start, long end) {

int inforBrowseNum = informationMapper.selectInforReadNum(teamId, start, end);

return inforBrowseNum;
}

/**
* 查询小组文章转发量
*
* @param teamId
* @param start
* @param end
* @return
*/
private int findInforShareNum(Integer teamId, long start, long end) {

int inforBrowseNum = informationMapper.selectInforShareNum(teamId, start, end);

return inforBrowseNum;
}

/**
* 查询小组每月新增人数
*/
@Override
public List<KpiItem> findTeamNumStatistics(String startTime, String endTime) {
long start = 0, end = 0;

// 获取起始毫秒数
if (CommonUtil.isEmpty(startTime)) {
start = DateUtil.getCurrentMonthStartTime();
} else {
start = DateUtil.getDate(startTime, DateUtil.f2).getTime();
}

// 获取结束毫秒数
if (CommonUtil.isEmpty(endTime)) {
end = DateUtil.getCurrentMonthEndTime();
} else {
end = DateUtil.getDate(endTime, DateUtil.f2).getTime();
}

List<KpiItem> list = teamUserMapper.selectTeamUserNum(start, end);
for (KpiItem kpiItem : list) {

// 获取小组长姓名
String nickName = findTeamName(kpiItem.getTeamId());
kpiItem.setNickName(nickName);
}
return list;
}

/**
* 统计KPI小组动态
*/
@Override
public List<KpiItem> findTeamVitStatistics(String startTime, String endTime) {
long start = 0, end = 0;

// 设置当月起始时间
if (CommonUtil.isEmpty(startTime)) {
start = DateUtil.getCurrentMonthStartTime();
} else {
start = DateUtil.getDate(startTime, DateUtil.f2).getTime();
}

// 设置当月结束时间
if (CommonUtil.isEmpty(endTime)) {
end = DateUtil.getCurrentMonthEndTime();
} else {
end = DateUtil.getDate(endTime, DateUtil.f2).getTime();
}

List<KpiItem> list = teamUserMapper.selectTeamStatistics();
for (KpiItem kpiItem : list) {

// 获取小组某段时间的动态量总数
int vigourCount = countTeamVigNum(kpiItem.getTeamId(), start, end);
kpiItem.setVigCount(vigourCount);

// 查询小组某个时间段的回复动态评论数
int vigourComment = countTeamVigComment(kpiItem.getTeamId(), start, end);
kpiItem.setVigComment(vigourComment);

// 查询小组某个时间段发动态的人数
int vigourTeamVitalityNum = countTeamVigourNum(kpiItem.getTeamId(), start, end);
kpiItem.setVigVitalityNum(vigourTeamVitalityNum);

// 查询某个时间段的小组总人数
int vigourTeamNum = countTeamNum(kpiItem.getTeamId(), start, end);
kpiItem.setVigTeamNum(vigourTeamNum);

// 统计小组活跃度
double percent = (double) vigourTeamVitalityNum / (double) vigourTeamNum;

// 转换百分数
NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMinimumFractionDigits(2);// 设置保留小数位
nf.setRoundingMode(RoundingMode.HALF_UP); // 设置舍入模式

String vigourTeamVitality = nf.format(percent);
kpiItem.setVigVitality(vigourTeamVitality);

// 获取小组长姓名
String nickName = findTeamName(kpiItem.getTeamId());
kpiItem.setNickName(nickName);
}
return list;
}

/**
* 查询小组某个月的动态量
*/
private int countTeamVigNum(Integer teamId, long startTime, long endTime) {

// 计算用户某个时间段的动态量总数
int vigourCount = vigourMapper.findTeamVigCount(teamId, startTime, endTime);

return vigourCount;
}

/**
* 查询小组的动态回复数
*
* @param userId
* @param startTime
* @param endTime
* @return
*/
private int countTeamVigComment(Integer userId, long startTime, long endTime) {

// 查询用户某段时间的动态回复量
int vigourComment = commentMapper.findTeamVigComment(userId, startTime, endTime);

return vigourComment;
}

/**
* KPI統計导出Excel
*/
@Override
public String kpiExcel(String startTime, String endTime) {

String result = "Excel文件导出成功!";
try {

// 创建Excel表格
sheet = createExcel(startTime, endTime);

// 导出小组每月新增人数
writeTeamUserAdd(startTime, endTime, sheet);

// 导出小组每月活动数量
writeTeamAct(startTime, endTime, sheet);

// 导出小组活动统计购买比例
writeTeamActBuy(startTime, endTime, sheet);

// 导出小组资讯统计
writeTeamInfor(startTime, endTime, sheet);

// 导出小组动态统计
writeTeamVit(startTime, endTime, sheet);

// 导出公司人员动态统计
writeKpiVigour(startTime, endTime, sheet);

// 显示表格线
sheet.getSettings().setShowGridLines(true);

workbook.write();// 写入Excel

System.out.println("导出成功,关闭输出流");

} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (workbook != null) {
workbook.close();// 关闭工作簿
}
os.close();// 关闭输出流
} catch (WriteException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

}

return result;

}

/**
* 创建excel文件
*
* @param startTime
* @param endTime
* @return
* @throws Exception
*/
private WritableSheet createExcel(String startTime, String endTime) throws Exception {

// 路径
String url = "C:/Users/Administrator/Desktop/Kpi统计" + startTime + "至" + endTime + ".xls";

// 创建输出流
os = new FileOutputStream(url);

// 创建工作簿
workbook = Workbook.createWorkbook(os);

// 创建工作表
sheet = workbook.createSheet("小组KPI统计", 0);

// 设置每一行的宽度
sheet.setColumnView(0, 25);
sheet.setColumnView(1, 25);
sheet.setColumnView(2, 20);
sheet.setColumnView(3, 20);
sheet.setColumnView(4, 20);
sheet.setColumnView(5, 20);
sheet.setColumnView(6, 20);

// 设置单元格字体
NormalFont = new WritableFont(WritableFont.ARIAL, 10);
BoldFont = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD);

// 字体样式: 用于正文居左
wcf_left = new WritableCellFormat(NormalFont);
wcf_left.setBorder(Border.ALL, BorderLineStyle.THIN);
wcf_left.setVerticalAlignment(VerticalAlignment.CENTRE);
wcf_left.setAlignment(Alignment.LEFT);
wcf_left.setWrap(false);

// 字体样式: 用于正文居中
wcf_center = new WritableCellFormat(BoldFont);
wcf_center.setBorder(Border.ALL, BorderLineStyle.THIN);
wcf_center.setVerticalAlignment(VerticalAlignment.CENTRE);
wcf_center.setAlignment(Alignment.CENTRE);
wcf_center.setWrap(false);

// 大标题
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月");
sheet.mergeCells(0, 0, 7, 0);
sheet.addCell(new Label(0, 0, simpleDateFormat.format(new Date()) + "KPI统计表", wcf_center));

return sheet;
}

/**
* 导出小组每月人数增长统计
*
* @param startTime
* @param endTime
* @param sheet
* @throws Exception
*/
private void writeTeamUserAdd(String startTime, String endTime, WritableSheet sheet) throws Exception {

// 小标题
sheet.addCell(new Label(0, 1, "统计小组每月新增人数", wcf_center)); // 第2列 第2格
sheet.addCell(new Label(0, 2, "小组名称", wcf_center)); // 第1列第2格
sheet.addCell(new Label(1, 2, "小组长", wcf_center)); // 第2列第3格
sheet.addCell(new Label(2, 2, "小组当月新增人数", wcf_center)); // 第3列第3格

// 查询小组每月人数增长统计导出
List<KpiItem> numList = findTeamNumStatistics(startTime, endTime);

// 正文
for (int i = 0; i < numList.size(); i++) {
KpiItem kpiItem = numList.get(i);
sheet.addCell(new Label(0, i + 3, kpiItem.getTitle().toString(), wcf_left));// 第1列第3格
sheet.addCell(new Label(1, i + 3, kpiItem.getNickName().toString(), wcf_left));// 第2列第3格
sheet.addCell(new Label(2, i + 3, kpiItem.getNum().toString(), wcf_center));// 第3列第3格
}
}

/**
* 导出小组每月活动数量
*
* @param startTime
* @param endTime
* @param sheet
* @throws Exception
*/
private void writeTeamAct(String startTime, String endTime, WritableSheet sheet) throws Exception {

// 小标题
List<KpiItem> numList = findTeamNumStatistics(startTime, endTime);
sheet.addCell(new Label(0, numList.size() + 5, "统计小组每月活动数量", wcf_center));
sheet.addCell(new Label(0, numList.size() + 6, "小组名称", wcf_center));
sheet.addCell(new Label(1, numList.size() + 6, "小组长", wcf_center));
sheet.addCell(new Label(2, numList.size() + 6, "小组活动数量", wcf_center));

// 查询小组活动数量统计导出
List<KpiItem> actList = findActStatistics(startTime, endTime);

// 正文
for (int i = 0; i < actList.size(); i++) {
KpiItem kpiItem = actList.get(i);
sheet.addCell(new Label(0, i + numList.size() + 7, kpiItem.getTitle().toString(), wcf_left));
sheet.addCell(new Label(1, i + numList.size() + 7, kpiItem.getNickName().toString(), wcf_left));
sheet.addCell(new Label(2, i + numList.size() + 7, kpiItem.getActTeamNum().toString(), wcf_center));
}
}

/**
* 导出小组活动统计购买比例
*
* @param startTime
* @param endTime
* @param sheet
* @throws Exception
*/
private void writeTeamActBuy(String startTime, String endTime, WritableSheet sheet) throws Exception {

List<KpiItem> numList = findTeamNumStatistics(startTime, endTime);
List<KpiItem> actList = findActStatistics(startTime, endTime);

// 小标题
int row = numList.size() + actList.size();
sheet.addCell(new Label(0, row + 9, "小组活动统计", wcf_center));
sheet.addCell(new Label(0, row + 10, "小组名称", wcf_center));
sheet.addCell(new Label(1, row + 10, "小组长", wcf_center));
sheet.addCell(new Label(2, row + 10, "小组活动名称", wcf_center));
sheet.addCell(new Label(3, row + 10, "活动参加人数", wcf_center));
sheet.addCell(new Label(4, row + 10, "活动购买人数", wcf_center));
sheet.addCell(new Label(5, row + 10, "活动购买比例", wcf_center));

// 查询小组活动人数及购买比例统计导出
List<KpiItem> actBuyList = findActBuyStatistics(startTime, endTime);

// 正文
for (int i = 0; i < actBuyList.size(); i++) {
KpiItem kpiItem = actBuyList.get(i);
sheet.addCell(new Label(0, i + row + 11, kpiItem.getTitle().toString(), wcf_left));
sheet.addCell(new Label(1, i + row + 11, kpiItem.getNickName().toString(), wcf_left));
sheet.addCell(new Label(2, i + row + 11, kpiItem.getVigName().toString(), wcf_center));
sheet.addCell(new Label(3, i + row + 11, kpiItem.getVigNum().toString(), wcf_center));
sheet.addCell(new Label(4, i + row + 11, kpiItem.getBuyNum().toString(), wcf_center));
sheet.addCell(new Label(5, i + row + 11, kpiItem.getVigGrade().toString(), wcf_center));
}
}

/**
* 导出小组资讯统计
*
* @param startTime
* @param endTime
* @param sheet
* @throws Exception
*/
private void writeTeamInfor(String startTime, String endTime, WritableSheet sheet) throws Exception {

List<KpiItem> numList = findTeamNumStatistics(startTime, endTime);
List<KpiItem> actList = findActStatistics(startTime, endTime);
List<KpiItem> actBuyList = findActBuyStatistics(startTime, endTime);

// 小标题
int row = numList.size() + actList.size() + actBuyList.size();
sheet.addCell(new Label(0, row + 13, "小组资讯统计", wcf_center));
sheet.addCell(new Label(0, row + 14, "小组名称", wcf_center));
sheet.addCell(new Label(1, row + 14, "小组长", wcf_center));
sheet.addCell(new Label(2, row + 14, "文章数量", wcf_center));
sheet.addCell(new Label(3, row + 14, "文章阅读数量", wcf_center));
sheet.addCell(new Label(4, row + 14, "文章转发量", wcf_center));

// 查询小组资讯统计导出
List<KpiItem> inforList = findKpiInforStatistics(startTime, endTime);

// 正文
for (int i = 0; i < inforList.size(); i++) {
KpiItem kpiItem = inforList.get(i);
sheet.addCell(new Label(0, i + row + 15, kpiItem.getTitle().toString(), wcf_left));
sheet.addCell(new Label(1, i + row + 15, kpiItem.getNickName().toString(), wcf_left));
sheet.addCell(new Label(2, i + row + 15, kpiItem.getInforNum().toString(), wcf_center));
sheet.addCell(new Label(3, i + row + 15, kpiItem.getInforBrowseNum().toString(), wcf_center));
sheet.addCell(new Label(4, i + row + 15, kpiItem.getInforShareNum().toString(), wcf_center));
}
}

/**
* 导出小组动态统计
*
* @param startTime
* @param endTime
* @param sheet
* @throws Exception
*/
private void writeTeamVit(String startTime, String endTime, WritableSheet sheet) throws Exception {

List<KpiItem> numList = findTeamNumStatistics(startTime, endTime);
List<KpiItem> actList = findActStatistics(startTime, endTime);
List<KpiItem> actBuyList = findActBuyStatistics(startTime, endTime);
List<KpiItem> inforList = findKpiInforStatistics(startTime, endTime);

// 小标题
int row = numList.size() + actList.size() + actBuyList.size() + inforList.size();
sheet.addCell(new Label(0, row + 17, "小组动态统计", wcf_center));
sheet.addCell(new Label(0, row + 18, "小组名称", wcf_center));
sheet.addCell(new Label(1, row + 18, "小组长", wcf_center));
sheet.addCell(new Label(2, row + 18, "小组发动态总数", wcf_center));
sheet.addCell(new Label(3, row + 18, "小组回复动态总数", wcf_center));
sheet.addCell(new Label(4, row + 18, "小组动态人数", wcf_center));
sheet.addCell(new Label(5, row + 18, "小组总人数", wcf_center));
sheet.addCell(new Label(6, row + 18, "小组活跃度", wcf_center));

// 查询小组动态统计导出
List<KpiItem> vigList = findTeamVitStatistics(startTime, endTime);

// 正文
for (int i = 0; i < vigList.size(); i++) {
KpiItem kpiItem = vigList.get(i);
sheet.addCell(new Label(0, i + row + 19, kpiItem.getTitle().toString(), wcf_left));
sheet.addCell(new Label(1, i + row + 19, kpiItem.getNickName().toString(), wcf_left));
sheet.addCell(new Label(2, i + row + 19, kpiItem.getVigCount().toString(), wcf_center));
sheet.addCell(new Label(3, i + row + 19, kpiItem.getVigComment().toString(), wcf_center));
sheet.addCell(new Label(4, i + row + 19, kpiItem.getVigVitalityNum().toString(), wcf_center));
sheet.addCell(new Label(5, i + row + 19, kpiItem.getVigTeamNum().toString(), wcf_center));
sheet.addCell(new Label(6, i + row + 19, kpiItem.getVigVitality().toString(), wcf_center));
}

}

/**
* 导出公司人员动态统计
*
* @param startTime
* @param endTime
* @param sheet
* @throws Exception
*/
private void writeKpiVigour(String startTime, String endTime, WritableSheet sheet) throws Exception {

List<KpiItem> numList = findTeamNumStatistics(startTime, endTime);
List<KpiItem> actList = findActStatistics(startTime, endTime);
List<KpiItem> actBuyList = findActBuyStatistics(startTime, endTime);
List<KpiItem> inforList = findKpiInforStatistics(startTime, endTime);
List<KpiItem> vigList = findTeamVitStatistics(startTime, endTime);

// 小标题
int row = numList.size() + actList.size() + actBuyList.size() + inforList.size() + vigList.size();
sheet.addCell(new Label(0, row + 21, "公司人员动态统计", wcf_center));
sheet.addCell(new Label(0, row + 22, "姓名", wcf_center));
sheet.addCell(new Label(1, row + 22, "发动态数", wcf_center));
sheet.addCell(new Label(2, row + 22, "回复动态评论数", wcf_center));

// 查询小组动态统计导出
List<KpiItem> vigourList = findKpiVigourStatistics(startTime, endTime);

// 正文
for (int i = 0; i < vigourList.size(); i++) {
KpiItem kpiItem = vigourList.get(i);
sheet.addCell(new Label(0, i + row + 23, kpiItem.getNickName().toString(), wcf_left));
sheet.addCell(new Label(1, i + row + 23, kpiItem.getVigCount().toString(), wcf_center));
sheet.addCell(new Label(2, i + row + 23, kpiItem.getVigComment().toString(), wcf_center));
}
}

}

导出功能

标签:小数   cell   round   param   ble   setborder   label   class   share   

原文地址:http://www.cnblogs.com/zslslir/p/6688207.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!