class="java">public Map getRandomPrizeResult(String activityNo) { Map resultMap = null; StringBuffer sqlBuf = new StringBuffer( "SELECT * FROM PRIZE_INFO PI WHERE PI.ACTIVITY_NO = ? ORDER BY PI.PRIZE_LEVEL ASC "); List list = null; try { list = Database.getToList(sqlBuf.toString(), new Object[] { activityNo }); if (list != null && list.size() > 0) { double randomDoubleValue = getRandomDoubleValue(); double prizeRateValue = 0; double prizeRateAdd = 0; String prizeName = ""; for (int i = 0; i < list.size(); i++) { prizeRateValue = Double.parseDouble((String) ((Map) list.get(i)).get("prize_rate")); prizeRateAdd += prizeRateValue; prizeName = (String) ((Map) list.get(i)).get("prize_name"); logger.info("奖品名称: " + prizeName + " 的中奖概率Top值为: " + prizeRateAdd); if (randomDoubleValue < prizeRateAdd) { resultMap = (Map) list.get(i); logger.info("用户中奖,奖品名称为: " + prizeName); break; } } } } catch (Exception e) { logger.error("获取用户在理论情况下,应该获取到的奖品信息异常", e.fillInStackTrace()); } return resultMap; }