use of com.kendy.entity.Player in project financial by greatkendy123.
the class LM_ExcelReaderUtil method readRecord_NewVersion.
/**
* 战绩导入到小工具(新版本)
*
* @time 2018年1月10日
* @param file
* @return
*/
public static List<Record> readRecord_NewVersion(File file) {
List<Record> result = new ArrayList<Record>();
try {
FileInputStream is = new FileInputStream(file);
XSSFWorkbook workbook = new XSSFWorkbook(is);
// 桌号
String name = file.getName();
String tableId = name.substring(name.lastIndexOf("-") + 1, name.lastIndexOf("."));
tableId = "第" + tableId + "局";
XSSFSheet sheet = (XSSFSheet) workbook.getSheetAt(0);
// Iterate through each rows one by one
Iterator<Row> rowIterator = sheet.iterator();
while (rowIterator.hasNext()) {
Row row = rowIterator.next();
if (row.getCell(0) == null) {
break;
}
Record record = new Record();
if (row.getRowNum() != 0) {
int count2 = row.getLastCellNum();
String dateStr = "";
for (int cn = 0; cn < row.getLastCellNum(); cn++) {
Cell cell = row.getCell(cn);
record.setTableId(tableId);
if (cell == null) {
log.error("cell 为null,继续下一个循环");
continue;
} else {
switch(cn) {
case 4:
record.setBlind(cell.getStringCellValue());
break;
case 8:
record.setPlayerId(cell.getStringCellValue());
break;
case 10:
record.setClubId(cell.getStringCellValue());
log.info("====" + cell.getStringCellValue());
break;
case 11:
record.setClubName(cell.getStringCellValue());
break;
case 16:
record.setInsuranceEach(cell.getStringCellValue());
break;
case 17:
record.setInsurance(cell.getStringCellValue());
break;
case 19:
record.setScore(cell.getStringCellValue());
break;
case 20:
dateStr = cell.getStringCellValue().split(" ")[0];
if ("结束时间".equals(dateStr))
break;
// add 导入的第一局作为当天的时间
if (StringUtil.isBlank(DataConstans.Date_Str)) {
DataConstans.Date_Str = dateStr;
} else {
try {
if (sdf.parse(dateStr).after(sdf.parse(DataConstans.Date_Str))) {
dateStr = DataConstans.Date_Str;
}
} catch (Exception e) {
log.error("XXXXXXX 导入的第一局作为当天的时间软件失败 XXXXXX", e);
}
}
record.setDay(dateStr);
break;
}
}
}
if ("结束时间".equals(dateStr))
continue;
// 数据库 key: 时间#第次#俱乐部ID#玩家ID
String id = record.getDay() + "#" + record.getTableId() + "#" + record.getClubId() + "#" + record.getPlayerId();
record.setId(id);
Player _p = DataConstans.membersMap.get(record.getPlayerId());
if (_p == null)
record.setTeamId(_p == null ? "" : _p.getTeamName());
result.add(record);
}
}
is.close();
} catch (Exception e) {
ErrorUtil.err("当场战绩导入到联盟Tab失败", e);
}
return result;
}
use of com.kendy.entity.Player in project financial by greatkendy123.
the class MemberService method updateMemberTable.
/**
* 更新人员表
*
* @time 2017年10月28日
* @param tableMemberZJ
* @param wanjiaId
* @param memberSumOfZJ
*/
public static void updateMemberTable(TableView<MemberZJInfo> tableMemberZJ, String wanjiaId, Label memberSumOfZJ) {
// 根据名称获取团队ID
Player wanjia = DataConstans.membersMap.get(wanjiaId);
String teamId = "";
if (wanjia != null && !StringUtil.isBlank(wanjia.getTeamName())) {
teamId = wanjia.getTeamName();
}
ObservableList<MemberZJInfo> obList = FXCollections.observableArrayList();
// 战绩
String zj = "";
// 战绩总和
Double sumOfZJ = 0d;
if (DataConstans.Total_Team_Huishui_Map.size() != 0) {
List<TeamHuishuiInfo> list = DataConstans.Total_Team_Huishui_Map.get(teamId);
if (list != null) {
for (TeamHuishuiInfo info : list) {
if (info.getWanjiaId().equals(wanjiaId)) {
zj = info.getShishou();
obList.add(new MemberZJInfo(info.getTableId(), zj));
sumOfZJ += MoneyService.getNum(zj);
}
}
}
}
// 赋值总和
memberSumOfZJ.setText(MoneyService.digit0(sumOfZJ));
// 刷新表
tableMemberZJ.setItems(obList);
tableMemberZJ.refresh();
}
use of com.kendy.entity.Player in project financial by greatkendy123.
the class CombineIDController method select2parentAction.
/**
* 加载父ID和名称
* @param event
*/
public void select2parentAction(ActionEvent event) {
String selectedMemberName = (String) leftPlayerListView.getFocusModel().getFocusedItem();
if (StringUtil.isBlank(selectedMemberName)) {
ShowUtil.show("请先选择父ID!");
return;
} else {
if (DataConstans.Combine_Sub_Id_Map.containsKey(getIdFromStr(selectedMemberName))) {
ShowUtil.show(selectedMemberName + "本身是子ID!请先解除与其他父ID(" + DataConstans.Combine_Sub_Id_Map.get(getIdFromStr(selectedMemberName)) + ")的关系!");
return;
}
}
parentIdField.setText(selectedMemberName);
// 根据父ID加载所有子节点 大傻哥111 543999226
String superId = getIdFromStr(selectedMemberName);
Set<String> subIdSet = DataConstans.Combine_Super_Id_Map.get(superId);
rightPlayerListView.setItems(null);
if (subIdSet == null) {
return;
}
ObservableList<String> obList = FXCollections.observableArrayList();
Player player;
String playerName;
for (String subId : subIdSet) {
player = DataConstans.membersMap.get(subId);
if (player != null) {
playerName = player.getPlayerName();
obList.add(playerName + " " + subId);
} else {
ShowUtil.show("匹配不到子ID信息,子ID为:" + subId);
}
}
rightPlayerListView.setItems(obList);
rightPlayerListView.refresh();
}
use of com.kendy.entity.Player in project financial by greatkendy123.
the class DelController method updateNewGudongAction.
public void updateNewGudongAction(ActionEvent event) {
String newGD = newGudong.getText();
newGD = StringUtil.isBlank(newGD) ? "" : newGD.trim();
if (StringUtil.isBlank(newGD)) {
ShowUtil.show("请先输入玩家的新股东!!");
return;
}
String selectedMemberName = (String) delMemberListView.getFocusModel().getFocusedItem();
if (StringUtil.isBlank(selectedMemberName)) {
ShowUtil.show("请先选择要修改股东的玩家!!");
return;
}
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("警告");
alert.setHeaderText(null);
alert.setContentText(selectedMemberName + " 哥,你确定要修改该玩家的股东为" + newGD + "??");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
try {
// 1,获取玩家ID
String playerId = getIdFromStr(selectedMemberName);
// 2,修改缓存中的人员信息
Player player = DataConstans.membersMap.get(playerId);
player.setGudong(newGD);
// 3,同步到数据库
DBUtil.updateMember(player);
// 4,同步实时上码中的数据(实时金额不用)
// 5 修改其他所设及的玩家或数据缓存,如父子ID TODO
ShowUtil.show("修改成功", 2);
} catch (Exception e) {
ShowUtil.show("修改玩家股东失败,原因:" + e.getMessage());
e.printStackTrace();
}
}
}
use of com.kendy.entity.Player in project financial by greatkendy123.
the class DelController method updatePlayerNamerAction.
/**
* 新增修改用户名称功能
*
* @time 2017年10月29日
* @param event
*/
public void updatePlayerNamerAction(ActionEvent event) {
String newName = newPlayerName.getText();
newName = StringUtil.isBlank(newName) ? "" : newName.trim();
if (StringUtil.isBlank(newName)) {
ShowUtil.show("请先输入玩家的新名称!!");
return;
}
String selectedMemberName = (String) delMemberListView.getFocusModel().getFocusedItem();
if (StringUtil.isBlank(selectedMemberName)) {
ShowUtil.show("请先选择要修改名称的玩家!!");
return;
}
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("警告");
alert.setHeaderText(null);
alert.setContentText(selectedMemberName + " 哥,你确定要修改该玩家名称为" + newName + "??");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
try {
String playerId = getIdFromStr(selectedMemberName);
// 1 理新常量表中的member
Player player = DataConstans.membersMap.get(playerId);
if (player != null) {
player.setPlayerName(newName);
} else {
ShowUtil.show("用户不存在!");
return;
}
// 2 更新实时金额表
String oldName = selectedMemberName.replace(playerId, "");
oldName = oldName.trim();
MoneyService.updatePlayerName(playerId, oldName, newName);
// 3 更新数据库
DBUtil.updateMember(player);
// 4 更新其他(特补充)
MoneyService.flush_SSJE_table();
// 5 提示成功
ShowUtil.show("修改成功", 2);
} catch (Exception e) {
ShowUtil.show("修改失败,原因:" + e.getMessage());
e.printStackTrace();
}
}
}
Aggregations