Search in sources :

Example 1 with TGCommentInfo

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

the class TGExportExcelService method getPlayerCommentExcelModel.

/**
 * 玩家备注ExcelModel
 * @time 2018年3月18日
 * @return
 */
private TGExcelModel getPlayerCommentExcelModel() {
    TGExcelModel excelModel = new TGExcelModel();
    List<String> titleList = new LinkedList<>();
    List<Object[]> data = new LinkedList<>();
    List<String> titleSumList = new LinkedList<>();
    List<Object[]> dataSum = new LinkedList<>();
    titleList = new LinkedList<>(Arrays.asList("日期", "玩家ID", "玩家名称", "项目类型", "ID", "名称", "备注", "托管公司"));
    ObservableList<TGCommentInfo> items = tgController.tableTGComment.getItems();
    if (CollectUtil.isHaveValue(items)) {
        data = items.stream().map(info -> {
            Object[] obj = new Object[8];
            obj[0] = info.getTgCommentDate();
            obj[1] = info.getTgCommentPlayerId();
            obj[2] = info.getTgCommentPlayerName();
            obj[3] = info.getTgCommentType();
            obj[4] = info.getTgCommentId();
            obj[5] = info.getTgCommentName();
            obj[6] = info.getTgCommentBeizhu();
            obj[7] = info.getTgCommentCompany();
            return obj;
        }).collect(Collectors.toList());
    }
    ObservableList<String> sumItems = tgController.tgCommentSumView.getItems();
    if (CollectUtil.isHaveValue(sumItems)) {
        dataSum = sumItems.stream().map(info -> {
            Object[] obj = new Object[2];
            obj[0] = info.split(":")[0];
            obj[1] = info.split(":")[1];
            return obj;
        }).collect(Collectors.toList());
    }
    excelModel.setColumnList(titleList);
    excelModel.setData(data);
    excelModel.setColumnSumList(titleSumList);
    excelModel.setDataSum(dataSum);
    excelModel.setSheetName("玩家备注");
    return excelModel;
}
Also used : TGCommentInfo(com.kendy.entity.TGCommentInfo) TGExcelModel(com.kendy.entity.TGExcelModel) LinkedList(java.util.LinkedList)

Example 2 with TGCommentInfo

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

the class TGController method delTGCommentAction.

/**
 * 删除玩家备注记录
 * @time 2018年3月4日
 * @param event
 */
public void delTGCommentAction(ActionEvent event) {
    TGCommentInfo selectedItem = tableTGComment.getSelectionModel().getSelectedItem();
    if (selectedItem == null) {
        ShowUtil.show("先选择要删除的托管玩家备注记录!");
    } else {
        // 同步到数据库
        DBUtil.del_tg_comment_by_id(selectedItem.getTgCommentEntityId());
        refreshTableTGComment();
        ShowUtil.show("操作完成 ", 1);
    }
}
Also used : TGCommentInfo(com.kendy.entity.TGCommentInfo)

Example 3 with TGCommentInfo

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

the class DBUtil method get_all_tg_comment.

/**
 * 获取所有玩家备注
 *
 * @time 2018年3月4日
 * @return
 */
public static List<TGCommentInfo> get_all_tg_comment() {
    List<TGCommentInfo> list = new ArrayList<>();
    try {
        con = DBConnection.getConnection();
        String sql = "select * from tg_comment";
        ps = con.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
            // id,  tg_date,  tg_player_id,  tg_player_name,  tg_type, tg_id,  tg_name,  tg_beizhu
            TGCommentInfo comment = new TGCommentInfo(rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(7), rs.getString(8), rs.getString(9));
            list.add(comment);
        }
    } catch (SQLException e) {
        ErrorUtil.err("获取所有玩家备注失败", e);
    } finally {
        close(con, ps);
    }
    return list;
}
Also used : TGCommentInfo(com.kendy.entity.TGCommentInfo) SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet)

Example 4 with TGCommentInfo

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

the class TGAddCommentController method getSubmitData.

/**
 * 获取待提交的数据
 * @time 2018年3月3日
 * @return
 */
private TGCommentInfo getSubmitData() {
    // 获取当前托管公司
    String tgCompany = tgCompanyChoice.getSelectionModel().getSelectedItem();
    TGCommentInfo entity = new TGCommentInfo(UUID.randomUUID().toString(), MyController.tgController.getDateString(), FinalPlaerIdField.getText(), FinalPlaerNameField.getText(), typeChoice.getSelectionModel().getSelectedItem(), IDField.getText(), nameField.getText(), StringUtil.nvl(beizhuField.getText(), ""), tgCompany);
    return entity;
}
Also used : TGCommentInfo(com.kendy.entity.TGCommentInfo)

Example 5 with TGCommentInfo

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

the class TGAddCommentController method addTGCommentBtnAction.

/**
 * 按钮:确定提交托管开销数据
 *
 * @time 2018年3月3日
 * @param event
 */
public void addTGCommentBtnAction(ActionEvent event) {
    // 检验参数
    if (hasAnyParamBlank()) {
        ShowUtil.show("Sorry, 提交信息不完整,请查看!");
        return;
    }
    // 传递给主控制类处理逻辑 TODO
    TGCommentInfo tgCommentInfo = getSubmitData();
    TGController tgController = MyController.tgController;
    // 保存到数据库
    DBUtil.saveOrUpdate_tg_comment(tgCommentInfo);
    // 刷新界面
    if (equalsCurrentCompany())
        tgController.refreshTableTGComment();
    ShowUtil.show("添加完成", 1);
}
Also used : TGCommentInfo(com.kendy.entity.TGCommentInfo)

Aggregations

TGCommentInfo (com.kendy.entity.TGCommentInfo)5 TGExcelModel (com.kendy.entity.TGExcelModel)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1