Browse Source

修复bug: 用户id>128时,用户信息修改报错

master
xie.bx 3 years ago
parent
commit
6622a5936b
  1. 8
      im-platform/pom.xml
  2. 4
      im-platform/src/main/java/com/bx/implatform/service/impl/GroupServiceImpl.java
  3. 2
      im-platform/src/main/java/com/bx/implatform/service/impl/UserServiceImpl.java
  4. 8
      im-server/pom.xml

8
im-platform/pom.xml

@ -114,13 +114,7 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<executions> <version>2.0.3.RELEASE</version>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

4
im-platform/src/main/java/com/bx/implatform/service/impl/GroupServiceImpl.java

@ -230,7 +230,7 @@ public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group> implements
if(groupMembers.isEmpty()){ if(groupMembers.isEmpty()){
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;
} }
// 拉取群信息 // 拉取群列表
List<Long> ids = groupMembers.stream().map((gm -> gm.getGroupId())).collect(Collectors.toList()); List<Long> ids = groupMembers.stream().map((gm -> gm.getGroupId())).collect(Collectors.toList());
QueryWrapper<Group> groupWrapper = new QueryWrapper(); QueryWrapper<Group> groupWrapper = new QueryWrapper();
groupWrapper.lambda().in(Group::getId, ids); groupWrapper.lambda().in(Group::getId, ids);
@ -238,7 +238,7 @@ public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group> implements
// 转vo // 转vo
List<GroupVO> vos = groups.stream().map(g -> { List<GroupVO> vos = groups.stream().map(g -> {
GroupVO vo = BeanUtils.copyProperties(g, GroupVO.class); GroupVO vo = BeanUtils.copyProperties(g, GroupVO.class);
GroupMember member = groupMembers.stream().filter(m -> g.getId() == m.getGroupId()).findFirst().get(); GroupMember member = groupMembers.stream().filter(m -> g.getId().equals(m.getGroupId())).findFirst().get();
vo.setAliasName(member.getAliasName()); vo.setAliasName(member.getAliasName());
vo.setRemark(member.getRemark()); vo.setRemark(member.getRemark());
return vo; return vo;

2
im-platform/src/main/java/com/bx/implatform/service/impl/UserServiceImpl.java

@ -86,7 +86,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
@Override @Override
public void update(UserVO vo) { public void update(UserVO vo) {
UserSession session = SessionContext.getSession(); UserSession session = SessionContext.getSession();
if(session.getId() != vo.getId()){ if(!session.getId().equals(vo.getId()) ){
throw new GlobalException(ResultCode.PROGRAM_ERROR,"不允许修改其他用户的信息!"); throw new GlobalException(ResultCode.PROGRAM_ERROR,"不允许修改其他用户的信息!");
} }
User user = this.getById(vo.getId()); User user = this.getById(vo.getId());

8
im-server/pom.xml

@ -44,13 +44,7 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<executions> <version>2.0.3.RELEASE</version>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

Loading…
Cancel
Save