// 导出中奖记录 @Get("exportRecord/{activityId:[0-9]+}") public String exportRecord( final Invocation inv, @Param("activityId") final Integer activityId, @Param("start") final Integer start, @Param("end") final Integer end) { int startRow = 0; int total = 0; if (start != null && end != null) { if (start > 0) startRow = start - 1; total = end - start + 1; if (total > Globals.EXCEL_MAX_EXPORT_NUMBER) { return "@<script>alert('" + "导出数量超过" + Globals.EXCEL_MAX_EXPORT_NUMBER + "');window.history.go(-1);</script>"; } } else { total = actGuessGameConfService.countAllPrizeRecord(activityId); if (total > Globals.EXCEL_MAX_EXPORT_NUMBER) { return "@<script>alert('" + "导出数量超过" + Globals.EXCEL_MAX_EXPORT_NUMBER + ",请分段导出" + "');window.history.go(-1);</script>"; } } actGuessGameConfService.exportPrizeRecord(activityId, inv, startRow, total); return null; }
@ActOptRequired @Get("gameadmin/{activityId:[0-9]+}") public String gameadmin( final Invocation inv, @Param("activityId") final Integer activityId, @Param("currentPage") final int currentPage, @Param("count") final int count, @Param("upid") final Integer userPluginId) { Pagination<ActGuessGameAdmin> paginationRecord = actGuessGameConfService.getGameAdminPage(activityId, currentPage, Globals.PAGE_SHOW_NUMBER); inv.addModel("bJoinType", actGuessGameConfService.getJoinType(activityId)); inv.addModel("recordVos", paginationRecord); inv.addModel("activityId", activityId); inv.addModel("userPluginId", userPluginId); return "guessgame/gameadmin"; }
/** * 修改 * * @param inv * @param actGuessGameConf * @param startTime * @param endTime * @return * @throws Exception */ @Post("edit_do") public String edit_do( final Invocation inv, ActGuessGameConf actGuessGameConf, @Param("createTime") final Date createTime, @Param("activityTime") final String activityTime) throws Exception { if (activityTime == null || activityTime.length() == 0) { inv.addModel("tip", "非法操作,请重试"); inv.addModel( "backUrl", ReadProperties.getPara("httpPath") + "/pluginadmin/guessgame/edit/" + actGuessGameConf.getActivityId()); return "../pc/tip.jsp"; } if (activityTime.length() != 0) { String[] time = activityTime.split(" - "); actGuessGameConf.setStartTime(DateUtils.converDate(time[0])); actGuessGameConf.setEndTime(DateUtils.converDate(time[1])); } actGuessGameConf.setCreateTime(createTime); actGuessGameConfService.update(actGuessGameConf); inv.getResponse().sendRedirect(WebApplicationUtils.getBasePath() + "/pc/my/actList"); return null; }
@Post("delete") public String delete(final Invocation inv, @Param("id") final Integer id) { int res = actGuessGameConfService.delete(id); if (res == 0) { return "@json:" + "{\"status\":\"" + "1" + "\"}"; } else { return "@json:" + "{\"status\":\"" + "0" + "\"}"; } }
// 修改兑换状态 @Post("changeOpStatus") public String changeOpStatus(final Invocation inv, @Param("id") final Integer id) { String res = actGuessGameConfService.changeOpStatus(id); if (res == null) { return "@json:" + "{\"status\":\"" + "1" + "\"}"; } else { return "@json:" + "{\"status\":\"" + "0" + "\",\"exchangeTime\":\"" + res + "\"}"; } }
@Post("editGame") public String editGame(final Invocation inv, @Param("id") final Integer id) { ActGuessGameAdmin admin = actGuessGameConfService.editGame(id); if (admin == null) { return "@json:" + "{\"status\":\"" + "1" + "\"}"; } else { return "@json:" + "{\"status\":\"" + "0" + "\",\"admin\":" + JsonUtils.toJson(admin) + "}"; } }
/** * 编辑活动跳转 * * @param inv * @param id 活动id activityId * @return * @throws Exception */ @ActOptRequired @Get("edit/{activityId:[0-9]+}") public String edit(final Invocation inv, @Param("activityId") final Integer activityId) throws Exception { ActGuessGameConf actGuessGameConf = actGuessGameConfService.findByActId(activityId); if (actGuessGameConf != null) { inv.addModel("conf", actGuessGameConf); } return "guessgame/edit"; }
@Post("addGame/{activityId:[0-9]+}") public String addGame( final Invocation inv, ActGuessGameAdmin actGuessGameAdmin, @Param("activityTime") final String activityTime) throws Exception { if (activityTime.length() != 0) { String[] time = activityTime.split(" - "); actGuessGameAdmin.setStartTime(DateUtils.converDate(time[0])); actGuessGameAdmin.setEndTime(DateUtils.converDate(time[1])); } actGuessGameAdmin.setUpdateTime(new Date()); int ret = actGuessGameConfService.addGame(actGuessGameAdmin); if (ret == 0) { return "@<script>alert('新增失败');window.history.go(-1);</script>"; } else { inv.getResponse() .sendRedirect( WebApplicationUtils.getContextPath() + "/pluginadmin/guessgame/gameadmin/" + actGuessGameAdmin.getActivityId()); return null; } }