@Override public ExecuteResult<DumpHst> deleteDumpHst( User loginUser, Collection<String> ids, boolean isDelete, Locale locale) { ExecuteResult<DumpHst> executeResult = new ExecuteResult<DumpHst>(); DumpHst dumpHst = null; for (String id : ids) { if (isDelete) { dumpHstRepository.delete(id); } else { dumpHst = dumpHstRepository.findOne(id); dumpHst.setLastUpd(new Date()); dumpHst.setLastUpdBy(loginUser.getFirstName() + loginUser.getLastName()); dumpHst.setDeleteFlag("1"); dumpHstRepository.save(dumpHst); } } executeResult.setResult(dumpHst); executeResult.setSuccessMessage( messageSource.getMessage("omcc.system.dump.delete.success", null, locale)); return executeResult; }
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { HandlerMethod handlerMethod = (HandlerMethod) handler; ExecuteResult<Object> executeResult = new ExecuteResult<Object>(); HttpSession session = request.getSession(); boolean bl = false; User loginUser = (User) session.getAttribute("loginUser"); if (loginUser != null && loginUser.getAuthorFucIds() != null) { List<FunctionTree> fucList = loginUser.getAuthorFucIds(); bl = AuthorUtil.containsMethodName(fucList, handlerMethod.getMethod().getName()); if (bl) { } else { response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().print("权限不足"); } } return bl; }