Search in sources :

Example 11 with Club

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

the class DBUtil method getAllClub.

/**
 *********************************************************************************
 *
 * 小工具CRUD
 *
 *********************************************************************************
 */
/**
 * 从数据库获取所有俱乐部信息
 *
 * @time 2017年11月24日
 * @return
 */
public static Map<String, Club> getAllClub() {
    Map<String, Club> map = new HashMap<>();
    try {
        con = DBConnection.getConnection();
        String sql = "select * from club";
        ps = con.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
            Club club = new Club();
            club.setClubId(rs.getString(1));
            club.setName(rs.getString(2));
            club.setEdu(rs.getString(3));
            club.setZhuoFei(rs.getString(4));
            club.setYiJieSuan(rs.getString(5));
            club.setZhuoFei2(rs.getString(6));
            club.setZhuoFei3(rs.getString(7));
            club.setYiJieSuan2(rs.getString(8));
            club.setYiJieSuan3(rs.getString(9));
            club.setEdu2(rs.getString(10));
            club.setEdu3(rs.getString(11));
            club.setGudong(rs.getString(12));
            map.put(club.getClubId(), club);
        }
    } catch (SQLException e) {
        ErrorUtil.err("从数据库获取所有俱乐部信息失败", e);
    } finally {
        close(con, ps);
    }
    return map;
}
Also used : HashMap(java.util.HashMap) SQLException(java.sql.SQLException) Club(com.kendy.entity.Club) ResultSet(java.sql.ResultSet)

Example 12 with Club

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

the class LMController method refreshClubList.

// 同步俱乐部信息(缓存与数据库)
public static void refreshClubList() {
    // 锁定数据后同步到缓存中
    if (currentRecordList != null) {
        currentRecordList.forEach(record -> {
            String clubId = record.getClubId();
            if (allClubMap.get(clubId) == null) {
                allClubMap.put(clubId, new Club(clubId, record.getClubName(), "0"));
            }
        });
    }
    // 缓存数据全部更新到数据库
    if (allClubMap == null || allClubMap.size() == 0)
        return;
    allClubMap.values().forEach(club -> {
        try {
            if (!DBUtil.isHasClub(club.getClubId())) {
                DBUtil.addClub(club);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    });
    // 刷新每个俱乐部的列表
    refresh_eachClubList();
    // 这里更新俱乐部列表(静态访问)
    // _clubListView.setItems(null);
    // ObservableList<String> obList = FXCollections.observableArrayList();
    // allClubMap.values().forEach(club -> {
    // obList.add(club.getName()+"=="+club.getClubId()+"=="+club.getEdu());
    // });
    // _clubListView.setItems(obList);
    // 
    // //默认选择第一个
    // if(_clubListView.getItems() != null) {
    // _clubListView.getSelectionModel().select(0);
    // }
    // refreshClubListView();
    // 计算三个联盟的相关信息
    compute3LM();
    // 1表示加载联盟1的数据(依此类推)
    refreshClubListView(1);
}
Also used : Club(com.kendy.entity.Club)

Example 13 with Club

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

the class LMController method get_LM_Zhuofei.

/**
 * 获取不同联盟对应的桌费(已选择俱乐部)
 * @time 2017年12月15日
 * @param club
 * @param lmType
 * @return
 */
public String get_LM_Zhuofei() {
    final Club club = this.getSelectedClub();
    final int lmType = this.getCurrentLMType();
    String zhuoFei = "0";
    if (1 == lmType) {
        zhuoFei = club.getZhuoFei();
    } else if (2 == lmType) {
        zhuoFei = club.getZhuoFei2();
    } else if (3 == lmType) {
        zhuoFei = club.getZhuoFei3();
    }
    return zhuoFei;
}
Also used : Club(com.kendy.entity.Club)

Example 14 with Club

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

the class LMController method addNewClubAction.

/**
 * 新增俱乐部
 *
 * @time 2017年11月22日
 * @param event
 */
public void addNewClubAction(ActionEvent event) {
    InputDialog inputDlg = new InputDialog("增加", "待新增的俱乐部ID:", "俱乐部名称:");
    Optional<Pair<String, String>> result = inputDlg.getResult();
    result.ifPresent(entry -> {
        // 获取到原始的有效的团队ID及团队回水率
        String clubId = StringUtil.nvl(entry.getKey(), "");
        String clubName = StringUtil.nvl(entry.getValue(), "");
        if (StringUtil.isAnyBlank(clubId, clubName)) {
            ShowUtil.show("操作失败!原因:俱乐部ID或名称不能为空!!");
            return;
        }
        if (allClubMap.get(clubId) != null) {
            ShowUtil.show("操作失败!原因:俱乐部ID已存在!!!");
            return;
        }
        // 正式进入新增的编码
        Club club = new Club(clubId, clubName, "0");
        try {
            // 保存到数据库
            DBUtil.saveOrUpdateClub(club);
            // 刷新到刷新
            allClubMap.put(clubId, club);
            // 刷新表
            refreshClubList();
            ShowUtil.show("新增成功", 2);
            return;
        } catch (Exception e) {
            log.error("新增俱乐部失败");
        }
        // 新增俱乐部操作
        ShowUtil.show("新增失败!!");
    });
}
Also used : InputDialog(com.kendy.util.InputDialog) Club(com.kendy.entity.Club) Pair(javafx.util.Pair)

Example 15 with Club

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

the class LMController method updateClubAction.

/**
 * 更新俱乐部(额度)
 *
 * @time 2017年11月22日
 * @param event
 */
public void updateClubAction(ActionEvent event) {
    Club club = getSelectedClub();
    if (StringUtil.isBlank(club.getClubId())) {
        ShowUtil.show("请先选择俱乐部!");
        return;
    }
    String clubName = club.getName();
    String clubId = club.getClubId();
    InputDialog inputDlg = new InputDialog("修改:" + clubName, "联盟" + this.getCurrentLMType() + "的俱乐部新额度:");
    Optional<String> result = inputDlg.getTextResult();
    result.ifPresent(newClubEdu -> {
        // 判断
        if (StringUtil.isBlank(newClubEdu)) {
            ShowUtil.show("新额度不能为空!!");
            return;
        }
        newClubEdu = newClubEdu.trim();
        // club.setEdu(newClubEdu);
        set_LM_edu(club, this.getCurrentLMType(), newClubEdu);
        // 重新刷新俱乐部列表
        refreshClubList();
        refreshClubListView(this.getCurrentLMType());
        // 同步到数据库
        DBUtil.updateClub(club);
        // 更新俱乐部(额度)操作
        ShowUtil.show("更新俱乐部(额度)操作成功", 2);
    });
}
Also used : InputDialog(com.kendy.util.InputDialog) Club(com.kendy.entity.Club)

Aggregations

Club (com.kendy.entity.Club)19 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)7 List (java.util.List)7 ObservableList (javafx.collections.ObservableList)7 InputDialog (com.kendy.util.InputDialog)5 LMSumInfo (com.kendy.entity.LMSumInfo)4 Map (java.util.Map)4 ClubQuota (com.kendy.entity.ClubQuota)3 LinkedHashMap (java.util.LinkedHashMap)3 ClubBankModel (com.kendy.entity.ClubBankModel)2 LMDetailInfo (com.kendy.entity.LMDetailInfo)2 Record (com.kendy.entity.Record)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 DataConstans (application.DataConstans)1 MyController (application.MyController)1 PropertiesUtil (application.PropertiesUtil)1 DBUtil (com.kendy.db.DBUtil)1 ClubBankInfo (com.kendy.entity.ClubBankInfo)1