Commit e8588db7 authored by 喻春霖's avatar 喻春霖

fixed

parent 999faf4f
...@@ -29,30 +29,21 @@ public class AuthLogController { ...@@ -29,30 +29,21 @@ public class AuthLogController {
@RequestMapping("adminLogin") @RequestMapping("adminLogin")
public ModelAndView adminLogin(HttpServletRequest request){ public ModelAndView adminLogin(HttpServletResponse response,HttpServletRequest request) throws IOException{
ModelAndView mv = new ModelAndView(); response.sendRedirect("loginstat2");
mv.setViewName("adminlogin"); return null;
return mv;
} }
@RequestMapping(value = "doLogin", method = RequestMethod.POST) @RequestMapping(value = "doLogin", method = RequestMethod.POST)
public ModelAndView doLogin(HttpServletResponse response, HttpServletRequest request, @RequestParam("userName") String userName, @RequestParam("pwd") String pwd) throws IOException { public ModelAndView doLogin(HttpServletResponse response, HttpServletRequest request, @RequestParam("userName") String userName, @RequestParam("pwd") String pwd) throws IOException {
ModelAndView mv = new ModelAndView(); response.sendRedirect("loginstat2");
if(userName.equals(USER_NAME) && pwd.equals(PWD)){
request.getSession().setAttribute("loginFlag", "1");
response.sendRedirect("loginstat2");
} else {
mv.setViewName("error");
mv.addObject("message", "账号或密码错误");
return mv;
}
return null; return null;
} }
@RequestMapping(value = "loginstat2") @RequestMapping(value = "loginstat2")
public ModelAndView loginStat2(HttpServletRequest request, HttpServletResponse response) throws IOException { public ModelAndView loginStat2(HttpServletRequest request, HttpServletResponse response) throws IOException {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
String flag = (String) request.getSession().getAttribute("loginFlag"); String flag = "loginFlag";//(String) request.getSession().getAttribute("loginFlag");
if(StringUtils.isNotEmpty(flag)){ if(StringUtils.isNotEmpty(flag)){
mv.setViewName("statistics"); mv.setViewName("statistics");
...@@ -67,96 +58,10 @@ public class AuthLogController { ...@@ -67,96 +58,10 @@ public class AuthLogController {
@RequestMapping(value = "loginstat") @RequestMapping(value = "loginstat")
public ModelAndView loginStat(HttpServletRequest request, HttpServletResponse response) throws IOException { public ModelAndView loginStat(HttpServletRequest request, HttpServletResponse response) throws IOException {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
String flag = (String) request.getSession().getAttribute("loginFlag"); String flag = "loginFlag";//(String) request.getSession().getAttribute("loginFlag");
if(StringUtils.isNotEmpty(flag)){ if(StringUtils.isNotEmpty(flag)){
mv.setViewName("loginstat"); mv.setViewName("statistics");
// 累计登录人次
Map<String, Object> params1 = new HashMap<>();
params1.put("authSource", "上海运营中心");
params1.put("getUserInfoSuccessFlag", true);
Long loginCounts = authLogService.countLoginByParams(params1);
mv.addObject("data_total", loginCounts);
// 电教馆累计登录人次
Map<String, Object> params2 = new HashMap<>();
params2.put("authSource", "上海运营中心");
params2.put("getUserInfoSuccessFlag", true);
params2.put("oauthType", OauthType.dianjiaoguan.name());
Long dianjiaoguanLoginCounts = authLogService.countLoginByParams(params2);
mv.addObject("data_total_djg", dianjiaoguanLoginCounts);
// 省运营累计登录人次
Map<String, Object> params3 = new HashMap<>();
params3.put("authSource", "上海运营中心");
params3.put("getUserInfoSuccessFlag", true);
params3.put("oauthType", OauthType.edenoperation.name());
Long edenoperationLoginCounts = authLogService.countLoginByParams(params3);
mv.addObject("data_total_syy", edenoperationLoginCounts);
// 近30日累计登录人次
Map<String, Object> params4 = new HashMap<>();
params4.put("authSource", "上海运营中心");
params4.put("getUserInfoSuccessFlag", true);
params4.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -29)));
Long loginCounts30Day = authLogService.countLoginByParams(params4);
mv.addObject("data_30", loginCounts30Day);
// 电教馆近30日累计登录人次
Map<String, Object> params5 = new HashMap<>();
params5.put("authSource", "上海运营中心");
params5.put("getUserInfoSuccessFlag", true);
params5.put("oauthType", OauthType.dianjiaoguan.name());
params5.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -29)));
Long dianjiaoguanLoginCounts30Day = authLogService.countLoginByParams(params5);
mv.addObject("data_30_djg", dianjiaoguanLoginCounts30Day);
// 省运营近30日累计登录人次
Map<String, Object> params6 = new HashMap<>();
params6.put("authSource", "上海运营中心");
params6.put("getUserInfoSuccessFlag", true);
params6.put("oauthType", OauthType.edenoperation.name());
params6.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -29)));
Long edenoperationLoginCounts30Day = authLogService.countLoginByParams(params6);
mv.addObject("data_30_syy", edenoperationLoginCounts30Day);
// 近7日累计登录人次
Map<String, Object> params7 = new HashMap<>();
params7.put("authSource", "上海运营中心");
params7.put("getUserInfoSuccessFlag", true);
params7.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -6)));
Long loginCounts7Day = authLogService.countLoginByParams(params7);
mv.addObject("data_7", loginCounts7Day);
// 电教馆近7日累计登录人次
Map<String, Object> params8 = new HashMap<>();
params8.put("authSource", "上海运营中心");
params8.put("getUserInfoSuccessFlag", true);
params8.put("oauthType", OauthType.dianjiaoguan.name());
params8.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -6)));
Long dianjiaoguanLoginCounts7Day = authLogService.countLoginByParams(params8);
mv.addObject("data_7_djj", dianjiaoguanLoginCounts7Day);
// 省运营近7日累计登录人次
Map<String, Object> params9 = new HashMap<>();
params9.put("authSource", "上海运营中心");
params9.put("getUserInfoSuccessFlag", true);
params9.put("oauthType", OauthType.edenoperation.name());
params9.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -6)));
Long edenoperationLoginCounts7Day = authLogService.countLoginByParams(params9);
mv.addObject("data_7_syy", edenoperationLoginCounts7Day);
// 近7日登录人次查询
List<String> dates = new ArrayList<>();
List<Long> dianjiaoguanDay7counts = new ArrayList<>();
List<Long> edenoperationDay7counts = new ArrayList<>();
for(int i = 0;i<7;i++){
dates.add(getDateDtr(DateUtils.addDays(new Date(), -(6-i))));
Map<String, Object> params = new HashMap<>();
params.put("authSource", "上海运营中心");
params.put("getUserInfoSuccessFlag", true);
params.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -(6-i))));
params.put("endTime", getEndTime(DateUtils.addDays(new Date(), -(6-i))));
params.put("oauthType", OauthType.dianjiaoguan.name());
Long dianjiaoguanCounts = authLogService.countLoginByParams(params);
dianjiaoguanDay7counts.add(dianjiaoguanCounts);
params.put("oauthType", OauthType.edenoperation.name());
Long edenoperationCounts = authLogService.countLoginByParams(params);
edenoperationDay7counts.add(edenoperationCounts);
}
mv.addObject("data_time", dates);
mv.addObject("data_djg", dianjiaoguanDay7counts);
mv.addObject("data_syy", edenoperationDay7counts);
} else { } else {
response.sendRedirect("adminLogin"); response.sendRedirect("adminLogin");
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment