| | |
| | | |
| | | /** |
| | | * index controller |
| | | * |
| | | * @author xuxueli 2015-12-19 16:13:16 |
| | | */ |
| | | @Controller |
| | | public class IndexController { |
| | | |
| | | @Resource |
| | | private XxlJobService xxlJobService; |
| | | @Resource |
| | | private LoginService loginService; |
| | | @Resource |
| | | private XxlJobService xxlJobService; |
| | | @Resource |
| | | private LoginService loginService; |
| | | |
| | | |
| | | @RequestMapping("/") |
| | | public String index(Model model) { |
| | | @RequestMapping("/") |
| | | public String index(Model model) { |
| | | |
| | | Map<String, Object> dashboardMap = xxlJobService.dashboardInfo(); |
| | | model.addAllAttributes(dashboardMap); |
| | | Map<String, Object> dashboardMap = xxlJobService.dashboardInfo(); |
| | | model.addAllAttributes(dashboardMap); |
| | | |
| | | return "index"; |
| | | } |
| | | return "index"; |
| | | } |
| | | |
| | | @RequestMapping("/chartInfo") |
| | | @ResponseBody |
| | | public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) { |
| | | @ResponseBody |
| | | public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) { |
| | | ReturnT<Map<String, Object>> chartInfo = xxlJobService.chartInfo(startDate, endDate); |
| | | return chartInfo; |
| | | } |
| | | |
| | | @RequestMapping("/toLogin") |
| | | @PermissionLimit(limit=false) |
| | | public ModelAndView toLogin(HttpServletRequest request, HttpServletResponse response,ModelAndView modelAndView) { |
| | | if (loginService.ifLogin(request, response) != null) { |
| | | modelAndView.setView(new RedirectView("/",true,false)); |
| | | return modelAndView; |
| | | } |
| | | return new ModelAndView("login"); |
| | | } |
| | | |
| | | @RequestMapping(value="login", method=RequestMethod.POST) |
| | | @ResponseBody |
| | | @PermissionLimit(limit=false) |
| | | public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember){ |
| | | boolean ifRem = (ifRemember!=null && ifRemember.trim().length()>0 && "on".equals(ifRemember))?true:false; |
| | | return loginService.login(request, response, userName, password, ifRem); |
| | | } |
| | | |
| | | @RequestMapping(value="logout", method=RequestMethod.POST) |
| | | @ResponseBody |
| | | @PermissionLimit(limit=false) |
| | | public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response){ |
| | | return loginService.logout(request, response); |
| | | } |
| | | |
| | | @RequestMapping("/help") |
| | | public String help() { |
| | | |
| | | /*if (!PermissionInterceptor.ifLogin(request)) { |
| | | return "redirect:/toLogin"; |
| | | }*/ |
| | | @RequestMapping("/toLogin") |
| | | @PermissionLimit(limit = false) |
| | | public ModelAndView toLogin(HttpServletRequest request, HttpServletResponse response, ModelAndView modelAndView) { |
| | | if (loginService.ifLogin(request, response) != null) { |
| | | modelAndView.setView(new RedirectView("/" , true, false)); |
| | | return modelAndView; |
| | | } |
| | | return new ModelAndView("login"); |
| | | } |
| | | |
| | | return "help"; |
| | | } |
| | | @RequestMapping(value = "login" , method = RequestMethod.POST) |
| | | @ResponseBody |
| | | @PermissionLimit(limit = false) |
| | | public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember) { |
| | | boolean ifRem = (ifRemember != null && ifRemember.trim().length() > 0 && "on".equals(ifRemember)) ? true : false; |
| | | return loginService.login(request, response, userName, password, ifRem); |
| | | } |
| | | |
| | | @InitBinder |
| | | public void initBinder(WebDataBinder binder) { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | dateFormat.setLenient(false); |
| | | binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); |
| | | } |
| | | |
| | | @RequestMapping(value = "logout" , method = RequestMethod.POST) |
| | | @ResponseBody |
| | | @PermissionLimit(limit = false) |
| | | public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response) { |
| | | return loginService.logout(request, response); |
| | | } |
| | | |
| | | @RequestMapping("/help") |
| | | public String help() { |
| | | |
| | | /*if (!PermissionInterceptor.ifLogin(request)) { |
| | | return "redirect:/toLogin"; |
| | | }*/ |
| | | |
| | | return "help"; |
| | | } |
| | | |
| | | @InitBinder |
| | | public void initBinder(WebDataBinder binder) { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | dateFormat.setLenient(false); |
| | | binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); |
| | | } |
| | | |
| | | } |