use of com.kendy.entity.Club in project financial by greatkendy123.
the class LMController method change_club_gudong_Action.
/**
* 修改俱乐部的股东
*
* @time 2018年1月20日
* @param event
*/
public void change_club_gudong_Action(ActionEvent event) {
Club club = getSelectedClub();
String clubId = club.getClubId();
if (StringUtil.isBlank(clubId)) {
ShowUtil.show("请先选择俱乐部!");
return;
}
// 输入框
String title = StringUtil.isBlank(club.getGudong()) ? "修改" : "修改(当前股东是" + club.getGudong() + ")";
Optional<String> result = new InputDialog(title, "俱乐部" + club.getName() + "的新股东").getTextResult();
if (result.isPresent()) {
String newGudong = result.get();
if (StringUtil.isBlank(newGudong)) {
ShowUtil.show("股东不能为空,修改失败!", 2);
} else {
club.setGudong(newGudong.trim().toUpperCase());
DBUtil.updateClub(club);
ShowUtil.show("修改成功!", 2);
}
}
}
use of com.kendy.entity.Club in project financial by greatkendy123.
the class LMController method initialize.
/**
* FXML DOM节点加载完毕后的初始化
*/
@Override
public void initialize(URL location, ResourceBundle resources) {
log.info("联盟对帐页面加载数据开始...");
// 绑定代理查询中的合计表
bindCellValue(lmDetailTableId, lmDetailZJ, lmDetailInsure, lmDetailPersonCount);
// 红色注释
lmDetailZJ.setCellFactory(MyController.getColorCellFactory(new LMDetailInfo()));
lmDetailInsure.setCellFactory(MyController.getColorCellFactory(new LMDetailInfo()));
// 绑定代理查询中的合计表
tableLMSum.setEditable(true);
bindCellValue(lmSumName, lmSumZJ, lmSumInsure, lmSumPersonCount);
// 红色注释
lmSumInsure.setCellFactory(MyController.getColorCellFactory(new LMSumInfo()));
lmSumZJ.setCellFactory(TextFieldTableCell.forTableColumn());
// shishiJine.setCellFactory(redAndEditCellFactory);
lmSumZJ.setOnEditCommit(new EventHandler<CellEditEvent<LMSumInfo, String>>() {
@Override
public void handle(CellEditEvent<LMSumInfo, String> t) {
String oldValue = t.getOldValue();
String newValue = t.getNewValue();
// 修改原值
LMSumInfo sumInfo = (LMSumInfo) t.getTableView().getItems().get(t.getTablePosition().getRow());
List<String> noAllowList = Arrays.asList("结余", "当天总帐");
if (sumInfo == null || noAllowList.contains(sumInfo.getLmSumName())) {
ShowUtil.show("此行不能编辑!");
sumInfo.setLmSumZJ(oldValue);
tableLMSum.refresh();
return;
}
if (sumInfo != null && "桌费".equals(sumInfo.getLmSumName()) && !("0".equals(newValue)) && !(newValue.contains("-"))) {
ShowUtil.show("桌费只能填写负数!");
sumInfo.setLmSumZJ(oldValue);
tableLMSum.refresh();
return;
}
// 因为桌费和已结算在战绩那列
String zf_or_yiJieSuan = sumInfo.getLmSumZJ();
try {
if (!StringUtil.isBlank(newValue))
Double.valueOf(newValue);
} catch (Exception e) {
ShowUtil.show(newValue + "是非法数据!!");
sumInfo.setLmSumZJ(oldValue);
tableLMSum.refresh();
return;
}
// 新旧两值相等,应该不操作
// 总和表赋新值
sumInfo.setLmSumZJ(newValue);
// 缓存赋新值(桌费或已结算)
Club club = getSelectedClub();
int lmType = getCurrentLMType();
if ("桌费".equals(sumInfo.getLmSumName())) {
// club.setZhuoFei(newValue);
// 将新桌费设置到不同联盟当中
set_LM_Zhuofei(club, lmType, newValue);
// add 2018-2-11 添加到历史联盟桌费
String date = StringUtil.isBlank(DataConstans.Date_Str) ? "2017-01-01" : DataConstans.Date_Str;
ClubZhuofei clubZhuofei = new ClubZhuofei(date, club.getClubId(), newValue, "联盟" + lmType);
DBUtil.saveOrUpdate_club_zhuofei(clubZhuofei);
} else if ("已结算".equals(sumInfo.getLmSumName())) {
// club.setYiJieSuan(newValue);
// 将新桌费设置到不同联盟当中
set_LM_YiJiesuan(club, lmType, newValue);
}
// 更新结余
updateTableLMSumOnly();
// 同步到数据库
DBUtil.updateClub(club);
// 设置合计桌费(这个没多大影响)
setNewSumOfZF();
}
});
// 设置俱乐部的ListView监听
initSingClubListen();
// 软件一打开就从从数据库中获取所有俱乐部信息
allClubMap = DBUtil.getAllClub();
_clubListView = clubListView;
refreshClubList();
// 同步所有俱乐部信息总列表
refresh_eachClubList();
// 设置合计桌费(这个没多大影响)
setNewSumOfZF();
log.info("联盟对帐页面加载数据完成!");
}
use of com.kendy.entity.Club in project financial by greatkendy123.
the class QuotaController method set_LM_club_info.
/**
* 设置单个联盟最新的结余
*
* @time 2017年12月18日
*/
public void set_LM_club_info() {
try {
if (LMTotalList.isEmpty()) {
return;
}
// {俱乐部ID : 俱乐部配额信息}
Map<String, ClubQuota> _single_LM_map = new HashMap<>();
// {联盟Index : {俱乐部ID : 俱乐部配额信息}} //后期如果性能慢的话,可以修改为这定个
// Map<String,Map<String,List<ClubQuota>>> totalMap = new HashMap<>();
int lmType = getCurrentLMType() - 1;
// 遍历这三个
Map<String, List<Record>> current_LM_Map = LMTotalList.get(lmType);
// LMController lmController= new LMController();
Map<String, List<LMSumInfo>> allClubSumMap = lmController.getAllClubSumMap(current_LM_Map);
allClubSumMap.forEach((clubId, sumList) -> {
Club club = allClubMap.get(clubId);
String sumZJ = getSumZJ(sumList);
String yiJieshan = lmController.get_LM_YiJiesuan(club, getCurrentLMType());
String zhuoFei = lmController.get_LM_Zhuofei(club, getCurrentLMType());
String jieyu = NumUtil.digit0(NumUtil.getNum(sumZJ) + NumUtil.getNum(yiJieshan) + NumUtil.getNum(zhuoFei));
// System.out.println(String.format("俱乐部:%s,总战绩:%s,桌费:%s,已结算:%s,===结余:%s",
// allClubMap.get(clubId).getName(),sumZJ,zhuoFei,yiJieshan,jieyu
// ));
List<ClubQuota> list = new ArrayList<>();
ClubQuota quota = new ClubQuota();
quota.setEuotaClubId(clubId);
quota.setQuotaClubName(club.getName());
quota.setQuotaJieyu(jieyu);
quota.setQuotaRest(jieyu);
_single_LM_map.put(clubId, quota);
});
single_LM_map.clear();
single_LM_map = _single_LM_map;
} catch (Exception e) {
ErrorUtil.err("设置单个联盟最新的结余出错,建议重启软件!", e);
}
}
use of com.kendy.entity.Club in project financial by greatkendy123.
the class QuotaController method addNegativeRest2CurrentClub.
/**
* 配额最后还有剩余为负数的则全部结转到当前俱乐部
* @time 2017年12月18日
*/
private void addNegativeRest2CurrentClub() {
String currentClubId = MyController.currentClubId.getText();
// Club winnerClub = allClubMap.get("555551");//555551为银河ATM的俱乐部ID
// 555551为银河ATM的俱乐部ID
Club winnerClub = allClubMap.get(currentClubId);
if (winnerClub == null) {
// ErrorUtil.err("当前俱乐部"+currentClubId+"不存在!!!请添加!!");
return;
}
tableQuota.getItems().parallelStream().filter(info -> NumUtil.getNum(info.getQuotaRest()) < 0).forEach(info -> {
String from, to, money = "";
to = winnerClub.getName();
money = NumUtil.digit0((-1) * NumUtil.getNum(info.getQuotaRest()));
from = info.getQuotaClubName();
// log.info(String.format("%s转%s到%s", from,money,to));
addRecord2TableQuotaPay(new QuotaMoneyInfo(winnerClub.getClubId(), from, money, to));
});
tableQuotaPay.refresh();
}
Aggregations