| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import liquibase.repackaged.org.apache.commons.lang3.StringUtils; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | // |
| | | return b; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean removeOwnersCommittee(List<Long> toLongList) { |
| | | for (Long aLong : toLongList) { |
| | | OwnersCommitteeEntity ownersCommittee = getOne(Wrappers.<OwnersCommitteeEntity>lambdaQuery().eq(OwnersCommitteeEntity::getId, aLong)); |
| | | // 更新负责人用户角色 |
| | | IUserService bean = SpringUtils.getBean(IUserService.class); |
| | | User userInfo = bean.getOne(Wrappers.<User>lambdaQuery().eq(User::getId, ownersCommittee.getPrincipalId())); |
| | | // 判断角色 |
| | | if (userInfo.getRoleId().contains("1759487358708310017")) { |
| | | userInfo.setRoleId(userInfo.getRoleId().replace("1759487358708310017", "")); |
| | | } |
| | | List<String> stringList = Arrays.asList(userInfo.getRoleId().split(",")); |
| | | // 查询是否对应有业委会负责人,如果有则删除,如果没有则不删除对应的角色 |
| | | List<String> arrayList = new ArrayList<>(); |
| | | for (String roleId : stringList) { |
| | | if (!roleId.equals("1759487358708310017")) { |
| | | arrayList.add(roleId); |
| | | } |
| | | } |
| | | userInfo.setRoleId(StringUtils.join(arrayList, ",")); |
| | | bean.updateById(userInfo); |
| | | return removeById(ownersCommittee); |
| | | } |
| | | return false; |
| | | } |
| | | } |