|
@@ -14,10 +14,13 @@ import cc.smtweb.framework.core.db.DbEngine; |
|
|
import cc.smtweb.framework.core.exception.BizException; |
|
|
import cc.smtweb.framework.core.exception.BizException; |
|
|
import cc.smtweb.framework.core.session.SessionManager; |
|
|
import cc.smtweb.framework.core.session.SessionManager; |
|
|
import cc.smtweb.framework.core.session.UserSession; |
|
|
import cc.smtweb.framework.core.session.UserSession; |
|
|
|
|
|
import cc.smtweb.framework.core.util.CommUtil; |
|
|
import cc.smtweb.system.bpm.web.sys.user.party.Party; |
|
|
import cc.smtweb.system.bpm.web.sys.user.party.Party; |
|
|
import cc.smtweb.system.bpm.web.sys.user.party.PartyCache; |
|
|
import cc.smtweb.system.bpm.web.sys.user.party.PartyCache; |
|
|
|
|
|
import cc.smtweb.system.bpm.web.sys.user.role.RoleCache; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.User; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.User; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.UserCache; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.UserCache; |
|
|
|
|
|
import cc.smtweb.system.bpm.web.sys.user.user.UserRoleCache; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
@@ -153,7 +156,39 @@ public class AuthService { |
|
|
CacheManager.getIntance().refresh(); |
|
|
CacheManager.getIntance().refresh(); |
|
|
return R.success(); |
|
|
return R.success(); |
|
|
} |
|
|
} |
|
|
|
|
|
// 加载个人信息 |
|
|
|
|
|
public R userInfo(@SwBody SwMap params, UserSession us) { |
|
|
|
|
|
SwMap data = new SwMap(); |
|
|
|
|
|
|
|
|
|
|
|
User user = (User) UserCache.getInstance().get(us.getUserId()).clone(); |
|
|
|
|
|
user.setId(us.getUserId()); |
|
|
|
|
|
user.put("create_time", user.getCreate()); |
|
|
|
|
|
user.put("sur_party", PartyCache.getInstance().get(us.getPartyId())); |
|
|
|
|
|
user.put("sur_roles", RoleCache.getInstance().getNamesByIds(UserRoleCache.getInstance().getRoleIdByUP(us.getUserId(), us.getPartyId()))); |
|
|
|
|
|
data.put("userInfo", user); |
|
|
|
|
|
|
|
|
|
|
|
return R.success(data); |
|
|
|
|
|
} |
|
|
|
|
|
// 修改个人信息 |
|
|
|
|
|
public R saveUser(@SwBody SwMap params, UserSession us) { |
|
|
|
|
|
SwMap userInfo = params.readMap("userInfo"); |
|
|
|
|
|
User user = UserCache.getInstance().get(us.getUserId()); |
|
|
|
|
|
user.getData().putAll(userInfo); |
|
|
|
|
|
DbEngine.getInstance().findDao(User.ENTITY_NAME).updateEntity(user); |
|
|
|
|
|
UserCache.getInstance().put(user); |
|
|
|
|
|
return R.success(); |
|
|
|
|
|
} |
|
|
|
|
|
// 修改密码 |
|
|
|
|
|
public R changePwd(@SwBody SwMap params, UserSession us) { |
|
|
|
|
|
String old_pwd = params.readString("old_pwd"); |
|
|
|
|
|
String new_pwd = params.readString("new_pwd"); |
|
|
|
|
|
User user = UserCache.getInstance().get(us.getUserId()); |
|
|
|
|
|
if (!LoginHelper.verifyPwd(user, old_pwd)) { |
|
|
|
|
|
return R.error("旧密码错误"); |
|
|
|
|
|
} |
|
|
|
|
|
LoginHelper.resetUserPwd(user, new_pwd); |
|
|
|
|
|
return R.success(); |
|
|
|
|
|
} |
|
|
// 创建前端登录对象值对象 |
|
|
// 创建前端登录对象值对象 |
|
|
private LoginAckVO createLoginAckVO(User user,UserSession userSession){ |
|
|
private LoginAckVO createLoginAckVO(User user,UserSession userSession){ |
|
|
LoginAckVO loginAckVO = new LoginAckVO(); |
|
|
LoginAckVO loginAckVO = new LoginAckVO(); |
|
|