Search in sources :

Example 1 with JifenInfo

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

the class DBUtil method getJifenQuery.

/**
 * 积分查询
 */
public static List<JifenInfo> getJifenQuery(String jifenValue, String teamId, String startTime, String endTime, String limit) {
    List<JifenInfo> list = new LinkedList<>();
    try {
        con = DBConnection.getConnection();
        String sql = "SELECT " + "	(@i :=@i + 1) AS jfRankNo, " + "	hh.* " + "   FROM " + "	( " + "		SELECT DISTINCT " + "			playerName, " + "			floor( " + "				( " + "					sum(shouHuishui) - sum(chuHuishui) " + "				) / ? " + "			) AS jifenValue " + "		FROM " + "			( " + "				SELECT " + "					* " + "				FROM " + "					historyrecord " + "				WHERE " + "					teamId = ? " + "				AND updateTime >= ? " + "				AND updateTIme <= ? " + "			) h " + "		GROUP BY " + "			playerId " + "		ORDER BY " + "			jifenValue DESC " + "	) hh, " + "	(SELECT @i := 0) b " + "LIMIT ?";
        ps = con.prepareStatement(sql);
        ps.setInt(1, Integer.valueOf(jifenValue));
        ps.setString(2, teamId);
        ps.setString(3, startTime);
        ps.setString(4, endTime);
        ps.setInt(5, Integer.valueOf(limit));
        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
            list.add(new JifenInfo(rs.getString(1), rs.getString(2), rs.getString(3)));
        }
        return list;
    } catch (Exception e) {
        ErrorUtil.err("积分查询失败", e);
    } finally {
        close(con, ps);
    }
    return list;
}
Also used : JifenInfo(com.kendy.entity.JifenInfo) ResultSet(java.sql.ResultSet) LinkedList(java.util.LinkedList) SQLException(java.sql.SQLException)

Example 2 with JifenInfo

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

the class JifenService method jifenQuery.

// @SuppressWarnings("unchecked")
// public static void init_JFTeamSelect_Action(ComboBox<String> teamIDCombox,TextField jfTeamPercent) {
// teamIDCombox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {
// @Override
// public void changed(ObservableValue observable, Object oldValue, Object newValue) {
// Huishui hs = DataConstans.huishuiMap.get(newValue);
// if(hs != null) {
// jfTeamPercent.setText(hs.getJifenInput());
// }else {
// jfTeamPercent.setText("0");
// }
// 
// }
// });
// }
/**
 * 积分查询功能
 *
 * @param tableJifen 积分表
 * @param jfStartTime 开始时间 eg.2017-09-01
 * @param jfEndTime 结束时间 eg.2017-09-20
 * @param jifenInput 积分值 ,如1积分=10元
 * @param jifenRankLimit 限定查询前多少名
 * @param jfTeamIDCombox 选择团队
 * @author 泽涛
 */
public static void jifenQuery(TableView<JifenInfo> tableJifen, DatePicker jfStartTime, DatePicker jfEndTime, TextField jifenInput, TextField jifenRankLimit, ComboBox<String> jfTeamIDCombox) {
    // 获取各个值
    ObservableList<JifenInfo> obList = FXCollections.observableArrayList();
    String startTime = getFormatTime(jfStartTime.getValue());
    String endTime = getFormatTime(jfEndTime.getValue());
    String jfInput = jifenInput.getText();
    String limit = jifenRankLimit.getText();
    String teamId = jfTeamIDCombox.getSelectionModel().getSelectedItem();
    // 查询数据
    List<JifenInfo> list = DBUtil.getJifenQuery(jfInput, teamId, startTime, endTime, limit);
    // 更新积分表
    tableJifen.setItems(null);
    if (list != null && !list.isEmpty()) {
        for (JifenInfo info : list) {
            obList.add(info);
        }
        tableJifen.setItems(obList);
    } else {
        ShowUtil.show("查无数据!", 1);
    }
}
Also used : JifenInfo(com.kendy.entity.JifenInfo)

Aggregations

JifenInfo (com.kendy.entity.JifenInfo)2 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 LinkedList (java.util.LinkedList)1