use of com.kendy.entity.TGKaixiaoInfo in project financial by greatkendy123.
the class TGExportExcelService method getKaixiaoExcelModel.
/**
* 开销ExcelModel
* @time 2018年3月18日
* @return
*/
private TGExcelModel getKaixiaoExcelModel() {
TGExcelModel excelModel = new TGExcelModel();
List<String> titleList = new LinkedList<>();
List<Object[]> data = new LinkedList<>();
List<String> titleSumList = new LinkedList<>();
List<Object[]> dataSum = new LinkedList<>();
titleList = new LinkedList<>(Arrays.asList("日期", "玩家名称", "支出项目", "开销金额", "托管公司"));
ObservableList<TGKaixiaoInfo> items = tgController.tableTGKaixiao.getItems();
if (CollectUtil.isHaveValue(items)) {
data = items.stream().map(info -> {
Object[] obj = new Object[5];
obj[0] = info.getTgKaixiaoDate();
obj[1] = info.getTgKaixiaoPlayerName();
obj[2] = info.getTgKaixiaoPayItem();
obj[3] = info.getTgKaixiaoMoney();
obj[4] = info.getTgKaixiaoCompany();
return obj;
}).collect(Collectors.toList());
}
ObservableList<String> sumItems = tgController.tgKaixiaoSumView.getItems();
if (CollectUtil.isHaveValue(sumItems)) {
dataSum = sumItems.stream().map(info -> {
Object[] obj = new Object[2];
obj[0] = info.split(":")[0];
obj[1] = info.split(":")[1];
return obj;
}).collect(Collectors.toList());
}
excelModel.setColumnList(titleList);
excelModel.setData(data);
excelModel.setColumnSumList(titleSumList);
excelModel.setDataSum(dataSum);
excelModel.setSheetName("开销");
return excelModel;
}
Aggregations