Search in sources :

Example 1 with ClubZhuofei

use of com.kendy.entity.ClubZhuofei in project financial by greatkendy123.

the class DBUtil method get_LM1_all_club_zhuofei.

/**
 * 获取联盟1的所有历史桌费
 *
 * @time 2018年2月11日
 * @return
 */
public static List<ClubZhuofei> get_LM1_all_club_zhuofei() {
    List<ClubZhuofei> list = new ArrayList<>();
    try {
        con = DBConnection.getConnection();
        String sql = "select cz.time, cz.clubId, cz.zhuofei, cz.lmType, c.name, c.gudong from  club_zhuofei cz  " + "LEFT JOIN club c on cz.clubId = c.clubId where cz.lmType='联盟1'";
        ps = con.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
            ClubZhuofei zhuofei = new ClubZhuofei(rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5), rs.getString(6));
            list.add(zhuofei);
        }
    } catch (SQLException e) {
        ErrorUtil.err("获取所有历史桌费失败", e);
    } finally {
        close(con, ps);
    }
    return list;
}
Also used : ClubZhuofei(com.kendy.entity.ClubZhuofei) SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet)

Example 2 with ClubZhuofei

use of com.kendy.entity.ClubZhuofei 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("联盟对帐页面加载数据完成!");
}
Also used : ClubZhuofei(com.kendy.entity.ClubZhuofei) LMSumInfo(com.kendy.entity.LMSumInfo) Club(com.kendy.entity.Club) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) CellEditEvent(javafx.scene.control.TableColumn.CellEditEvent) LMDetailInfo(com.kendy.entity.LMDetailInfo)

Aggregations

ClubZhuofei (com.kendy.entity.ClubZhuofei)2 ArrayList (java.util.ArrayList)2 Club (com.kendy.entity.Club)1 LMDetailInfo (com.kendy.entity.LMDetailInfo)1 LMSumInfo (com.kendy.entity.LMSumInfo)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 List (java.util.List)1 ObservableList (javafx.collections.ObservableList)1 CellEditEvent (javafx.scene.control.TableColumn.CellEditEvent)1