🐛 修复了一些已知的问题
🐛 修复了一些已知的问题
This commit is contained in:
commit
66a212c7f4
4
pom.xml
4
pom.xml
@ -163,7 +163,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-to-slf4j</artifactId>
|
<artifactId>log4j-to-slf4j</artifactId>
|
||||||
<version>2.16.0</version>
|
<version>2.17.0</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
@ -174,7 +174,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-api</artifactId>
|
<artifactId>log4j-api</artifactId>
|
||||||
<version>2.16.0</version>
|
<version>2.17.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -158,4 +158,11 @@ public interface UserMapper extends Mapper<User> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean hasAdminPermission(@Param("email") String email);
|
boolean hasAdminPermission(@Param("email") String email);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证账号是否重复
|
||||||
|
* @param account
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer selectCountByAccount(@Param("account") String account);
|
||||||
}
|
}
|
@ -65,9 +65,8 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
|||||||
} else {
|
} else {
|
||||||
user = new User();
|
user = new User();
|
||||||
String nickname = email.split("@")[0];
|
String nickname = email.split("@")[0];
|
||||||
nickname = checkNickname(nickname);
|
user.setNickname(checkNickname(nickname));
|
||||||
user.setNickname(nickname);
|
user.setAccount(checkAccount(nickname));
|
||||||
user.setAccount(nickname);
|
|
||||||
user.setEmail(email);
|
user.setEmail(email);
|
||||||
user.setPassword(Utils.entryptPassword(password));
|
user.setPassword(Utils.entryptPassword(password));
|
||||||
user.setCreatedTime(new Date());
|
user.setCreatedTime(new Date());
|
||||||
@ -101,6 +100,16 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
|||||||
return nickname;
|
return nickname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String checkAccount(String account) {
|
||||||
|
account = formatNickname(account);
|
||||||
|
Integer result = userMapper.selectCountByAccount(account);
|
||||||
|
if (result > 0) {
|
||||||
|
StringBuilder stringBuilder = new StringBuilder(account);
|
||||||
|
return checkNickname(stringBuilder.append("_").append(System.currentTimeMillis()).toString());
|
||||||
|
}
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map login(String account, String password) {
|
public Map login(String account, String password) {
|
||||||
Map map = new HashMap(1);
|
Map map = new HashMap(1);
|
||||||
|
@ -116,7 +116,7 @@ public class NotificationUtils {
|
|||||||
notificationDTO.setDataTitle("关注提醒");
|
notificationDTO.setDataTitle("关注提醒");
|
||||||
if (Objects.nonNull(follow)) {
|
if (Objects.nonNull(follow)) {
|
||||||
user = userService.findById(follow.getFollowerId().toString());
|
user = userService.findById(follow.getFollowerId().toString());
|
||||||
notificationDTO.setDataUrl(getFollowLink(follow.getFollowingType(), user.getNickname()));
|
notificationDTO.setDataUrl(getFollowLink(follow.getFollowingType(), user.getAccount()));
|
||||||
notificationDTO.setAuthor(genAuthor(user));
|
notificationDTO.setAuthor(genAuthor(user));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -116,5 +116,8 @@
|
|||||||
select if(count(fur.id_role) = 0, false, true) from forest_user_role fur join forest_user fu on fur.id_user = fu.id
|
select if(count(fur.id_role) = 0, false, true) from forest_user_role fur join forest_user fu on fur.id_user = fu.id
|
||||||
where fu.email = #{email} and exists(select id_role from forest_role fr where instr(fr.input_code, 'admin') > 0 and fr.id = fur.id_role)
|
where fu.email = #{email} and exists(select id_role from forest_role fr where instr(fr.input_code, 'admin') > 0 and fr.id = fur.id_role)
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectCountByAccount" resultType="java.lang.Integer">
|
||||||
|
select count(*) from forest_user where account = #{account}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user