use of com.sohu.cache.web.util.Page in project cachecloud by sohutv.
the class AppClientDataShowController method doException.
/**
* 客户端异常查询
*/
@RequestMapping("/exception")
public ModelAndView doException(HttpServletRequest request, HttpServletResponse response, Model model) {
// 1.1 应用信息
Long appId = NumberUtils.toLong(request.getParameter("appId"));
if (appId <= 0) {
return new ModelAndView("");
}
AppDesc appDesc = appService.getByAppId(appId);
model.addAttribute("appDesc", appDesc);
// 1.2 异常类型
int type = NumberUtil.toInt(request.getParameter("type"));
model.addAttribute("type", type);
// 1.3 客户端ip
String clientIp = request.getParameter("clientIp");
model.addAttribute("clientIp", clientIp);
// 1.4 日期格式转换
TimeBetween timeBetween = new TimeBetween();
try {
timeBetween = fillWithClientExceptionTime(request, model);
} catch (ParseException e) {
logger.error(e.getMessage(), e);
}
// 2. 分页查询异常
int totalCount = clientReportExceptionService.getAppExceptionCount(appId, timeBetween.getStartTime(), timeBetween.getEndTime(), type, clientIp);
int pageNo = NumberUtils.toInt(request.getParameter("pageNo"), 1);
int pageSize = NumberUtils.toInt(request.getParameter("pageSize"), 10);
Page page = new Page(pageNo, pageSize, totalCount);
model.addAttribute("page", page);
List<AppClientExceptionStat> appClientExceptionList = clientReportExceptionService.getAppExceptionList(appId, timeBetween.getStartTime(), timeBetween.getEndTime(), type, clientIp, page);
model.addAttribute("appClientExceptionList", appClientExceptionList);
return new ModelAndView("client/clientException");
}
use of com.sohu.cache.web.util.Page in project cachecloud by sohutv.
the class AppController method doAppList.
/**
* 应用列表
*
* @param userId
* @return
*/
@RequestMapping(value = "/list")
public ModelAndView doAppList(HttpServletRequest request, HttpServletResponse response, Model model, AppSearch appSearch) {
// 1.获取该用户能够读取的应用列表,没有返回申请页面
AppUser currentUser = getUserInfo(request);
model.addAttribute("currentUser", currentUser);
int userAppCount = appService.getUserAppCount(currentUser.getId());
if (userAppCount == 0 && !AppUserTypeEnum.ADMIN_USER.value().equals(currentUser.getType())) {
return new ModelAndView("redirect:/admin/app/init");
}
// 2.1 分页相关
int totalCount = appService.getAppDescCount(currentUser, appSearch);
int pageNo = NumberUtils.toInt(request.getParameter("pageNo"), 1);
int pageSize = NumberUtils.toInt(request.getParameter("pageSize"), 10);
Page page = new Page(pageNo, pageSize, totalCount);
model.addAttribute("page", page);
// 2.2 查询指定时间客户端异常
appSearch.setPage(page);
List<AppDesc> apps = appService.getAppDescList(currentUser, appSearch);
// 2.3 应用列表
List<AppDetailVO> appDetailList = new ArrayList<AppDetailVO>();
model.addAttribute("appDetailList", appDetailList);
// 3. 全局统计
long totalApplyMem = 0;
long totalUsedMem = 0;
long totalApps = 0;
if (apps != null && apps.size() > 0) {
for (AppDesc appDesc : apps) {
AppDetailVO appDetail = appStatsCenter.getAppDetail(appDesc.getAppId());
appDetailList.add(appDetail);
totalApplyMem += appDetail.getMem();
totalUsedMem += appDetail.getMemUsePercent() * appDetail.getMem() / 100.0;
totalApps++;
}
}
model.addAttribute("totalApps", totalApps);
model.addAttribute("totalApplyMem", totalApplyMem);
model.addAttribute("totalUsedMem", totalUsedMem);
return new ModelAndView("app/appList");
}
Aggregations