use of com.kendy.entity.LMSumInfo in project financial by greatkendy123.
the class LMController method exportSingleClubAction.
/**
********************************************************************************
*
* 导出Excel
*
**********************************************************************************
*/
/**
* 导出单个俱乐部帐单
*
* @time 2017年11月22日
* @param event
*/
public void exportSingleClubAction(ActionEvent event) {
Club club = getSelectedClub();
if (StringUtil.isBlank(club.getClubId())) {
ShowUtil.show("请先选择俱乐部!");
return;
}
String clubName = club.getName();
String clubId = club.getClubId();
String time = DataConstans.Date_Str;
if (StringUtil.isBlank(time)) {
// ShowUtil.show("导出失败! 您今天还没导入01场次的战绩,无法确认时间!!");
// return;
}
List<LMDetailInfo> list = new ArrayList<>();
ObservableList<LMDetailInfo> obList = tableLMDetail.getItems();
if (obList != null && obList.size() > 0) {
for (LMDetailInfo info : obList) {
list.add(info);
}
} else {
ShowUtil.show(clubName + "没有需要导出的数据!!");
return;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String title = clubName + "帐单-" + sdf.format(new Date());
log.info(title);
String[] rowsName = new String[] { "场次", "战绩", "保险", "人数" };
List<Object[]> dataList = new ArrayList<Object[]>();
Object[] objs = null;
for (LMDetailInfo info : list) {
objs = new Object[rowsName.length];
objs[0] = info.getLmDetailTableId();
objs[1] = info.getLmDetailZJ();
objs[2] = info.getLmDetailInsure();
objs[3] = info.getLmDetailPersonCount();
dataList.add(objs);
}
String[] rowsName2 = new String[] { "名称", "总战绩", "总保险", "总人数" };
List<Object[]> sumList = new ArrayList<>();
Object[] sumObjs = null;
ObservableList<LMSumInfo> ob_List = tableLMSum.getItems();
if (ob_List != null && ob_List.size() > 0) {
for (LMSumInfo info : ob_List) {
sumObjs = new Object[rowsName2.length];
sumObjs[0] = StringUtil.nvl(info.getLmSumName(), "");
sumObjs[1] = StringUtil.nvl(info.getLmSumZJ(), "");
sumObjs[2] = StringUtil.nvl(info.getLmSumInsure(), "");
sumObjs[3] = StringUtil.nvl(info.getLmSumPersonCount(), "");
sumList.add(sumObjs);
}
}
String out = "D:/" + title + System.currentTimeMillis();
ExportLMExcel ex = new ExportLMExcel(title, rowsName, dataList, out, rowsName2, sumList);
try {
ex.export();
log.info("导出单个联盟帐单完成!");
} catch (Exception e) {
ErrorUtil.err("导出单个联盟帐单失败", e);
}
}
use of com.kendy.entity.LMSumInfo in project financial by greatkendy123.
the class LMController method setDynamicTableData.
private void setDynamicTableData(TableView table, String clubId, Map<String, List<LMSumInfo>> allClubSumMap) {
List<LMSumInfo> list = allClubSumMap.get(clubId);
if (list != null && list.size() > 0) {
ObservableList obList = FXCollections.observableArrayList();
for (LMSumInfo info : list) {
obList.add(info);
}
table.setItems(obList);
}
}
use of com.kendy.entity.LMSumInfo in project financial by greatkendy123.
the class LMController method viewAllClubAction.
/**
* 查看所有俱乐部总帐单
*
* @time 2017年11月22日
* @param event
*/
public void viewAllClubAction(ActionEvent event) {
// 无数据就返回
int size = allClubMap.size();
if (allClubMap == null || allClubMap.size() == 0) {
ShowUtil.show("无数据可以导出");
return;
}
Map<String, List<Record>> current_LM_Map = LMTotalList.get(getCurrentLMType() - 1);
if (MapUtil.isNullOrEmpty(current_LM_Map)) {
ShowUtil.show("该联盟无数据可以导出");
return;
}
// 组装当前要展示的联盟的相应俱乐部
Map<String, Club> lmClubMap = getLMClub(current_LM_Map);
// 设置合计桌费(这个没多大影响)
setNewSumOfZF();
// 隐藏单个所有信息
showAllView();
// 点击所有俱乐部总帐按钮后的单个聪明数据统计 {俱乐部ID : 表内容}
Map<String, List<LMSumInfo>> allClubSumMap = getAllClubSumMap(current_LM_Map);
FlowPane flow = new FlowPane();
flow.setId(FLOW_PANE_ID);
flow.setMinWidth(668);
flow.setBorder(new Border(new BorderStroke(Color.BLUE, BorderStrokeStyle.SOLID, null, new BorderWidths(3))));
flow.setVgap(20);
flow.setHgap(20);
flow.setPadding(new Insets(10, 10, 10, 30));
// int size = allClubMap.size();
// if(allClubMap == null || allClubMap.size() ==0) {
// ShowUtil.show("无数据可以导出");
// return;
// }
// 表示第一列的宽度
final int talbeWidth = 300;
// 表示第一列的宽度
final int With1 = 80;
// 表示第二列的宽度
final int With2 = 70;
final int With3 = 70;
final int With4 = 60;
final int height = 115;
final String style = "-fx-alignment: CENTER;";
final String clubNameStyle = "-fx-background-color: #FFFFE0;";
// for(Map.Entry<String, Club> entry : allClubMap.entrySet()) {
for (Map.Entry<String, Club> entry : lmClubMap.entrySet()) {
Club club = entry.getValue();
String clubId = entry.getKey();
TableView table = new TableView();
table.setPrefHeight(height);
table.setPrefWidth(talbeWidth);
// 设置列
TableColumn col1 = new TableColumn(club.getName());
col1.setPrefWidth(With1);
col1.setStyle(style);
col1.setSortable(false);
col1.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumName"));
TableColumn col2 = new TableColumn("总战绩");
col2.setSortable(false);
col2.setStyle(style);
col2.setPrefWidth(With2);
col2.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumZJ"));
// 红色注释
col2.setCellFactory(MyController.getColorCellFactory(new LMSumInfo()));
TableColumn col3 = new TableColumn("总保险");
col3.setSortable(false);
col3.setStyle(style);
col3.setPrefWidth(With3);
col3.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumInsure"));
// 红色注释
col3.setCellFactory(MyController.getColorCellFactory(new LMSumInfo()));
TableColumn col4 = new TableColumn("总人数");
col4.setSortable(false);
col4.setStyle(style);
col4.setPrefWidth(With4);
col4.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumPersonCount"));
table.getColumns().addAll(col1, col2, col3, col4);
// 设置数据
setDynamicTableData(table, clubId, allClubSumMap);
flow.getChildren().add(table);
}
;
bigAnchorPane.getChildren().add(0, flow);
}
use of com.kendy.entity.LMSumInfo in project financial by greatkendy123.
the class LMController method getAllClubSumMap.
/**
* 点击所有俱乐部总帐按钮后的数据统计
* 2017-12-14 新增了单个联盟计算操作
*
* @time 2017年11月26日
* @return 所有俱乐部总帐Map
*/
public Map<String, List<LMSumInfo>> getAllClubSumMap(Map<String, List<Record>> current_LM_Map) {
Map<String, List<LMSumInfo>> map = new HashMap<>();
for (Map.Entry<String, List<Record>> entry : current_LM_Map.entrySet()) {
List<LMSumInfo> tempList = new ArrayList<>();
String clubId = entry.getKey();
List<Record> list = entry.getValue();
if (list == null) {
// 如果有回查功能就有可能出现这个问题
log.warn("根据详情找不到俱乐部信息:" + clubId);
map.put(clubId, tempList);
// 注意:这个后面要处理
continue;
}
// 求和统计,但不进行排序!!!!!!!!!!!!!!!!!!!!!!!!!!!
list = computSumList(list, false);
// 初始化数据
LMSumInfo info1 = new LMSumInfo();
info1.setLmSumName("当天总帐");
LMSumInfo info2 = new LMSumInfo();
info2.setLmSumName("桌费");
LMSumInfo info3 = new LMSumInfo();
info3.setLmSumName("玩家战绩");
// 统计数据
double sumOfEachClubZJ = 0d;
// 这个要全部全和
double sumOfEachClubInsure = 0d;
int sumOfEachClubPersonCount = 0;
for (Record record : list) {
sumOfEachClubZJ += NumUtil.getNum(record.getScore());
sumOfEachClubInsure += NumUtil.getNum(record.getInsurance());
sumOfEachClubPersonCount += NumUtil.getNum(record.getPersonCount());
}
info1.setLmSumZJ(NumUtil.digit0("" + sumOfEachClubZJ));
info1.setLmSumInsure(NumUtil.digit0("" + sumOfEachClubInsure));
info1.setLmSumPersonCount("" + sumOfEachClubPersonCount);
// 桌费
String zf = "";
// if(allClubMap.get(clubId) != null) zf = allClubMap.get(clubId).getZhuoFei();
if (allClubMap.get(clubId) != null) {
int lmType = getCurrentLMType();
zf = get_LM_Zhuofei(allClubMap.get(clubId), lmType);
}
info2.setLmSumZJ(getNavigateSumZJ(zf));
// 玩家战绩 联盟总账里的玩家战绩公式 = sum(当天总账-保险)
info3.setLmSumZJ(NumUtil.digit0(sumOfEachClubZJ - sumOfEachClubInsure));
tempList.add(info1);
tempList.add(info2);
tempList.add(info3);
map.put(clubId, tempList);
}
return map;
}
use of com.kendy.entity.LMSumInfo in project financial by greatkendy123.
the class LMController method setDataTableLMSum.
/**
* 更新单个俱乐部总和表
* 备注:需要用到最新的详情表数据
* @time 2017年11月25日
*/
public void setDataTableLMSum() {
// 初始化数据
LMSumInfo info4 = new LMSumInfo();
info4.setLmSumName("结余");
LMSumInfo info2 = new LMSumInfo();
info2.setLmSumName("桌费");
LMSumInfo info3 = new LMSumInfo();
info3.setLmSumName("已结算");
LMSumInfo info1 = new LMSumInfo();
info1.setLmSumName("当天总帐");
tableLMSum.setItems(null);
ObservableList<LMSumInfo> obList = FXCollections.observableArrayList();
obList.add(info1);
obList.add(info2);
obList.add(info3);
obList.add(info4);
tableLMSum.setItems(obList);
if (tableLMDetail == null && tableLMDetail.getItems() == null)
return;
// 桌费
// info2.setLmSumZJ(getSelectedClub().getZhuoFei());
// info3.setLmSumZJ(getSelectedClub().getYiJieSuan());
info2.setLmSumZJ(this.get_LM_Zhuofei());
info3.setLmSumZJ(this.get_LM_YiJiesuan());
// 统计数据
double sumOfEachClubZJ = 0d;
// 这个要全部全和
double sumOfEachClubInsure = 0d;
int sumOfEachClubPersonCount = 0;
for (LMDetailInfo detailInfo : tableLMDetail.getItems()) {
sumOfEachClubZJ += NumUtil.getNum(detailInfo.getLmDetailZJ());
sumOfEachClubInsure += NumUtil.getNum(detailInfo.getLmDetailInsure());
sumOfEachClubPersonCount += NumUtil.getNum(detailInfo.getLmDetailPersonCount());
}
info1.setLmSumZJ(NumUtil.digit0("" + sumOfEachClubZJ));
info1.setLmSumInsure(NumUtil.digit0("" + sumOfEachClubInsure));
info1.setLmSumPersonCount("" + sumOfEachClubPersonCount);
// 刷新才会显示
tableLMSum.refresh();
// 计算结余
// 里面会去刷新表
updateTableLMSumOnly();
}
Aggregations