Skip to content

Commit

Permalink
DictService save delete method add @transactional
Browse files Browse the repository at this point in the history
  • Loading branch information
think-gem committed Apr 4, 2015
1 parent b007106 commit 02e6c63
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
Binary file modified db/sys/jeesite_data.xls
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.web.util.WebUtils;
import org.springframework.stereotype.Service;

Expand Down Expand Up @@ -63,14 +65,6 @@ public String getMessageParam() {
return messageParam;
}

protected void setFailureAttribute(ServletRequest request, AuthenticationException ae) {
request.setAttribute(getFailureKeyAttribute(), ae.getClass().getName());
if (ae.getMessage() != null && StringUtils.startsWith(ae.getMessage(), "msg:")){
String message = StringUtils.replace(ae.getMessage(), "msg:", "");
request.setAttribute(getMessageParam(), message);
}
}

/**
* 登录成功之后跳转URL
*/
Expand All @@ -88,4 +82,28 @@ protected void issueSuccessRedirect(ServletRequest request,
// super.issueSuccessRedirect(request, response);
// }
}

/**
* 登录失败调用事件
*/
@Override
protected boolean onLoginFailure(AuthenticationToken token,
AuthenticationException e, ServletRequest request, ServletResponse response) {
String className = e.getClass().getName(), message = "";
if (IncorrectCredentialsException.class.getName().equals(className)
|| UnknownAccountException.class.getName().equals(className)){
message = "用户或密码错误, 请重试.";
}
else if (e.getMessage() != null && StringUtils.startsWith(e.getMessage(), "msg:")){
message = StringUtils.replace(e.getMessage(), "msg:", "");
}
else{
message = "系统出现点问题,请稍后再试!";
e.printStackTrace(); // 输出到控制台
}
request.setAttribute(getFailureKeyAttribute(), className);
request.setAttribute(getMessageParam(), message);
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public List<String> findTypeList(){
return dao.findTypeList(new Dict());
}

@Override
@Transactional(readOnly = false)
public void save(Dict dict) {
super.save(dict);
CacheUtils.remove(DictUtils.CACHE_DICT_MAP);
}
@Override

@Transactional(readOnly = false)
public void delete(Dict dict) {
super.delete(dict);
CacheUtils.remove(DictUtils.CACHE_DICT_MAP);
Expand Down

0 comments on commit 02e6c63

Please sign in to comment.