@RequestMapping(value = "/match_save", method = RequestMethod.POST)
@ResponseBody//表示响应的主体。即不需要VIEW展现层模块,直接显示到客户端的内容。
public void match_save(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String json = request.getParameter("data");
ArrayList rows = (ArrayList) JSON.Decode(json);
String match_id = "";
String m_index = "";
String issue_no = "";
String lotteryType;
String league_name = "";
String home_team = "";
String guest_team = "";
String final_score = "";
String lose_rate = "";
String half_score = "";
String deuce_rate = "";
String win_rate = "";
String match_time = "";
for (int i = 0, l = rows.size(); i < l; i++) {
HashMap row = (HashMap) rows.get(i);
match_id = row.get("match_id") != null ? row.get("match_id")
.toString() : "";
issue_no = row.get("issue_no") != null ? row.get("issue_no")
.toString() : "";
m_index = row.get("m_index") != null ? row.get("m_index")
.toString() : "";
league_name = row.get("league_name") != null ? row.get(
"league_name").toString() : "";
lotteryType = row.get("lottery_type").toString();
home_team = row.get("home_team") != null ? row.get("home_team")
.toString() : "";
guest_team = row.get("guest_team") != null ? row.get("guest_team")
.toString() : "";
final_score = row.get("final_score") != null ? row.get(
"final_score").toString() : "";
half_score = row.get("half_score") != null ? row.get("half_score")
.toString() : "";
win_rate = row.get("win_rate") != null ? row.get("win_rate")
.toString() : "";
deuce_rate = row.get("deuce_rate") != null ? row.get("deuce_rate")
.toString() : "";
lose_rate = row.get("lose_rate") != null ? row.get("lose_rate")
.toString() : "";
match_time = row.get("match_time") != null ? row.get("match_time")
.toString() : "";
Match match = new Match();
match.setMatch_id(Integer.parseInt(match_id));
match.setIssue_no(issue_no);
match.setLottery_type(LotteryType.valueOf(lotteryType));
match.setM_index(Integer.parseInt(m_index));
match.setLeague_name(league_name);
match.setHome_team(home_team);
match.setGuest_team(guest_team);
match.setFinal_score(final_score);
match.setHalf_score(half_score);
match.setWin_rate(win_rate);
match.setDeuce_rate(deuce_rate);
match.setLose_rate(lose_rate);
match.setMatch_time(DateUtil.StringToDate_YYYY_MM_DD_HH_MM_SS(match_time));
footBallManager.saveMatch(match);
}
}
@ResponseBody//表示响应的主体。即不需要VIEW展现层模块,直接显示到客户端的内容。
public void match_save(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String json = request.getParameter("data");
ArrayList rows = (ArrayList) JSON.Decode(json);
String match_id = "";
String m_index = "";
String issue_no = "";
String lotteryType;
String league_name = "";
String home_team = "";
String guest_team = "";
String final_score = "";
String lose_rate = "";
String half_score = "";
String deuce_rate = "";
String win_rate = "";
String match_time = "";
for (int i = 0, l = rows.size(); i < l; i++) {
HashMap row = (HashMap) rows.get(i);
match_id = row.get("match_id") != null ? row.get("match_id")
.toString() : "";
issue_no = row.get("issue_no") != null ? row.get("issue_no")
.toString() : "";
m_index = row.get("m_index") != null ? row.get("m_index")
.toString() : "";
league_name = row.get("league_name") != null ? row.get(
"league_name").toString() : "";
lotteryType = row.get("lottery_type").toString();
home_team = row.get("home_team") != null ? row.get("home_team")
.toString() : "";
guest_team = row.get("guest_team") != null ? row.get("guest_team")
.toString() : "";
final_score = row.get("final_score") != null ? row.get(
"final_score").toString() : "";
half_score = row.get("half_score") != null ? row.get("half_score")
.toString() : "";
win_rate = row.get("win_rate") != null ? row.get("win_rate")
.toString() : "";
deuce_rate = row.get("deuce_rate") != null ? row.get("deuce_rate")
.toString() : "";
lose_rate = row.get("lose_rate") != null ? row.get("lose_rate")
.toString() : "";
match_time = row.get("match_time") != null ? row.get("match_time")
.toString() : "";
Match match = new Match();
match.setMatch_id(Integer.parseInt(match_id));
match.setIssue_no(issue_no);
match.setLottery_type(LotteryType.valueOf(lotteryType));
match.setM_index(Integer.parseInt(m_index));
match.setLeague_name(league_name);
match.setHome_team(home_team);
match.setGuest_team(guest_team);
match.setFinal_score(final_score);
match.setHalf_score(half_score);
match.setWin_rate(win_rate);
match.setDeuce_rate(deuce_rate);
match.setLose_rate(lose_rate);
match.setMatch_time(DateUtil.StringToDate_YYYY_MM_DD_HH_MM_SS(match_time));
footBallManager.saveMatch(match);
}
}