Commit 2699858f authored by 赵啸非's avatar 赵啸非

更新用户同步逻辑

parent 4c4dd1d9
package com.mortals.xhx.base.system.user.model;
import com.alibaba.fastjson.annotation.JSONField;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
import java.util.List;
/**
*
* Description:User
* date: 2021-9-26 16:11:48
*/
@Data
public class UserEntityExt extends BaseEntityLong {
/**
* 唯一标识
*/
@JSONField(serialize = false)
private String token;
/**
* 登录时间
*/
private Long loginTime;
/**
* 过期时间
*/
private Long expireTime;
private String siteName;
private String siteCode;
private String oldPassword;
private String newPassword;
private String siteIds;
/**
* 菜单栏
*/
private String menuUrl;
/**
* 所属区域code,多个逗号分隔
*/
private String areaCodes;
}
\ No newline at end of file
......@@ -33,6 +33,17 @@ import java.util.Set;
public interface UserService extends ICRUDCacheService<UserEntity,Long> {
/**
* 校验用户名与密码是否正确
*
* @param loginName
* @param password
* @return
* @throws AppException
*/
UserEntity doCheckUser(String loginName, String password) throws AppException;
/**
* 通过登录用户获取菜单功能权限
*
......
......@@ -77,6 +77,27 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
}
@Override
public UserEntity doCheckUser(String loginName, String password) throws AppException {
UserQuery params = new UserQuery();
params.setLoginName(loginName);
UserEntity sysUser = this.selectOne(params);
if (sysUser == null || !sysUser.getLoginName().equals(loginName)) {
return null;
}
try {
if (!sysUser.getLoginPwd().equals(SecurityUtil.md5DoubleEncoding(password))) {
return null;
}
} catch (Exception e) {
log.error("查询用户异常,loginName:" + loginName, e);
return null;
}
return sysUser;
}
@Override
protected void saveAfter(UserEntity entity, Context context) throws AppException {
updateUserRole(entity);
......
......@@ -53,14 +53,9 @@ import com.mortals.xhx.base.system.user.service.UserService;
@RequestMapping("user")
public class UserController extends BaseCRUDJsonBodyMappingController<UserService, UserEntity, Long> {
@Autowired
private UserService userService;
@Autowired
private RoleService roleService;
@Autowired
private RoleUserService roleUserService;
public UserController() {
super.setModuleDesc("用户信息");
}
......
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