Commit eec0aa22 by 杨林龙

1.22.0 实现特殊登陆标记功能

1 parent fb73eaf3
......@@ -106,6 +106,8 @@ public class LoginController {
User user = userService.findByAccount(loginBO.getAccount());
userService.verify(user, loginBO.getPassword());
// 有特殊校验的校验specialMark
userService.verifySpecialMark(user, loginBO.getSpecialMark());
Map<String, Object> rtnMap = new HashMap<>();
String token = userService.createToken(user);
......
......@@ -214,4 +214,14 @@ public class UserController {
return R.ok().data(userDTOList);
}
@GetMapping("/resetUID")
public R resetUid(@RequestParam("id") Long id) {
try {
userService.resetUID(id);
} catch (Exception e) {
return R.error().data("重置失败");
}
return R.ok().data("重置成功");
}
}
......@@ -95,6 +95,18 @@ public class User extends BaseEntity {
private Integer enableStatus;
/**
* 特殊登陆标记位 0为不特殊登陆,1为特殊登陆
*/
@Column(name = "special_login")
private Integer specialLogin;
/**
* 特殊登陆识别字符串
*/
@Column(name = "special_mark")
private String specialMark;
/**
* 密码加密盐
*/
private String salt;
......
......@@ -69,4 +69,5 @@ public interface UserMapper extends CommonBaseMapper<User> {
List<CUser> selectByRelUserIds(@Param("relUserIds") Collection<Long> relUserIds);
Integer resetUIDById(@Param("id") Long id);
}
\ No newline at end of file
......@@ -17,4 +17,8 @@ public class LoginBO {
private String captchaId;
/**
* 前端传的加密字符串
*/
private String specialMark;
}
......@@ -61,6 +61,12 @@ public class UserBO {
@NotNull
private Integer enableStatus;
/**
* 特殊登陆标记位 0为不特殊登陆,1为特殊登陆
*/
@NotNull
private Integer specialLogin;
private String remark;
private Long tenantId;
......
......@@ -19,6 +19,7 @@ import cn.com.glsx.shield.modules.service.permissionStrategy.PermissionStrategy;
import cn.com.glsx.shield.modules.util.ChineseCharacterUtil;
import cn.com.glsx.usercenter.api.dto.request.FindUserRequest;
import cn.com.glsx.usercenter.api.dto.request.SimpleAddUser;
import cn.com.glsx.usercenter.api.enums.SpecialLoginEnum;
import cn.hutool.core.lang.UUID;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.Page;
......@@ -628,6 +629,22 @@ public class UserService {
}
/**
* 当特殊标识打开时 校验加密字符串
*
* @param user 用户数据
* @param specialMark 加密字符串
*/
public void verifySpecialMark(User user, String specialMark) {
Integer specialLogin = user.getSpecialLogin();
if (SpecialLoginEnum.SPECIAL_LOGIN.getCode().equals(specialLogin)) {
// 如果是特殊登陆校验加密字符串
if (StringUtils.isNullOrEmpty(specialMark) || !Objects.equals(user.getSpecialMark(), specialMark)) {
throw new UserCenterException("此账户限制登录,请与管理员联系");
}
}
}
/**
* 验证密码
*
* @param user
......@@ -1089,4 +1106,14 @@ public class UserService {
User user = userMapper.selectById(userId);
return tenantMapper.selectById(user.getTenantId());
}
/**
* 根据用户ID重置UID 将UID设置为空
*
* @param id 用户ID
*/
public void resetUID(Long id) {
Integer num = userMapper.resetUIDById(id);
log.info("resetUID:" + num);
}
}
......@@ -18,6 +18,8 @@
<result column="enable_status" jdbcType="INTEGER" property="enableStatus"/>
<result column="global_type" jdbcType="TINYINT" property="globalType"/>
<result column="local_type" jdbcType="TINYINT" property="localType"/>
<result column="special_login" jdbcType="TINYINT" property="specialLogin"/>
<result column="special_mark" jdbcType="VARCHAR" property="specialMark"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="created_date" jdbcType="TIMESTAMP" property="createdDate"/>
<result column="created_by" jdbcType="INTEGER" property="createdBy"/>
......@@ -355,4 +357,10 @@
#{item}
</foreach>
</select>
<select id="resetUIDById" resultType="java.lang.Integer">
update t_user
set special_mark = null
where id = #{id}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!