Search in sources :

Example 1 with HistoryRecord

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

the class DBUtil method saveHistoryRecord.

/**
 * 保存导入的战绩表,供会员和积分查询
 * @param list
 */
public static void saveHistoryRecord(final List<HistoryRecord> list) {
    try {
        con = DBConnection.getConnection();
        String sql = "";
        for (HistoryRecord hr : list) {
            sql = "insert into historyrecord values(?,?,?,?,?,?,?,?)";
            ps = con.prepareStatement(sql);
            ps.setString(1, hr.getPlayerId());
            ps.setString(2, hr.getPlayerName());
            ps.setString(3, hr.getTeamId().toUpperCase());
            ps.setString(4, hr.getYszj());
            ps.setString(5, hr.getShishou());
            ps.setString(6, hr.getChuHuishui());
            ps.setString(7, hr.getShouHuishui());
            // ps.setDate(8,  new Date(hr.getUpdateTime().getTime()));
            ps.setString(8, hr.getUpdateTime().toString());
            ps.execute();
        }
    } catch (Exception e) {
        ErrorUtil.err("保存导入的战绩表失败", e);
    } finally {
        close(con, ps);
    }
}
Also used : HistoryRecord(com.kendy.entity.HistoryRecord) SQLException(java.sql.SQLException)

Example 2 with HistoryRecord

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

the class MyController method saveHistoryRecord.

/**
 * 保存当前导入的战绩表,用于会员查询和积分查询
 * @throws Exception
 */
public void saveHistoryRecord() throws Exception {
    List<TeamHuishuiInfo> list = DataConstans.Dangju_Team_Huishui_List;
    List<HistoryRecord> ls = new ArrayList<>();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    if (list != null && list.size() > 0) {
        for (TeamHuishuiInfo hs : list) {
            /**
             * @param playerId
             * @param playerName
             * @param teamId
             * @param shishou
             * @param yszj
             * @param chuHuishui
             * @param shouHuishui
             * @param updateTime
             */
            ls.add(new HistoryRecord(hs.getWanjiaId(), hs.getWanjia(), hs.getTuan(), hs.getShishou(), hs.getZj(), hs.getChuHuishui(), hs.getShouHuishui(), hs.getUpdateTime()));
        }
        if (!ls.isEmpty()) {
            DBUtil.saveHistoryRecord(ls);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) TeamHuishuiInfo(com.kendy.entity.TeamHuishuiInfo) HistoryRecord(com.kendy.entity.HistoryRecord) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

HistoryRecord (com.kendy.entity.HistoryRecord)2 TeamHuishuiInfo (com.kendy.entity.TeamHuishuiInfo)1 SQLException (java.sql.SQLException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1