|
@@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.manage.common.ExcelErrorUtil;
|
|
|
import com.fdkankan.manage.common.PageInfo;
|
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
|
-import com.fdkankan.manage.entity.JyPlatform;
|
|
|
-import com.fdkankan.manage.entity.JyPlatformUserWait;
|
|
|
-import com.fdkankan.manage.entity.JyUser;
|
|
|
-import com.fdkankan.manage.entity.SysUser;
|
|
|
+import com.fdkankan.manage.entity.*;
|
|
|
import com.fdkankan.manage.service.*;
|
|
|
import com.fdkankan.manage.vo.JyUserPlatform;
|
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
@@ -21,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.management.relation.Role;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -45,6 +43,8 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
|
|
|
IJyUserService jyUserService;
|
|
|
@Autowired
|
|
|
ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ ISysRoleService sysRoleService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -138,12 +138,33 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
|
|
|
List<JyPlatform> jyPlatforms = platformService.listByIds(collect);
|
|
|
jyPlatforms.forEach(e -> map.put(e.getId(),e));
|
|
|
}
|
|
|
+ List<Integer> sysUserIds = jyUserPlatforms.stream().map(JyUserPlatform::getSysUserId).collect(Collectors.toList());
|
|
|
+ HashMap<Long,SysUser> sysUserMap = new HashMap<>();
|
|
|
+ HashMap<Long, SysRole> roleMap = new HashMap<>();
|
|
|
+ if(!sysUserIds.isEmpty()){
|
|
|
+ List<SysUser> sysUsers = sysUserService.listByIds(sysUserIds);
|
|
|
+ sysUsers.forEach(e -> sysUserMap.put(e.getId(),e));
|
|
|
+ List<Long> roleIds = sysUsers.stream().map(SysUser::getRoleId).collect(Collectors.toList());
|
|
|
+ if(!roleIds.isEmpty()){
|
|
|
+ List<SysRole> sysRoles = sysRoleService.listByIds(roleIds);
|
|
|
+ sysRoles.forEach(e -> roleMap.put(e.getId(),e));
|
|
|
+ }
|
|
|
+ }
|
|
|
for (JyUserPlatform jyUserPlatform : jyUserPlatforms) {
|
|
|
if(jyUserPlatform.getPlatformId()!=null){
|
|
|
JyPlatform jyPlatform =map.get(jyUserPlatform.getPlatformId());
|
|
|
if(jyPlatform != null){
|
|
|
jyUserPlatform.setPlatformName(jyPlatform.getPlatformName());
|
|
|
}
|
|
|
+ SysUser sysUser = sysUserMap.get(jyUserPlatform.getSysUserId());
|
|
|
+ if(sysUser != null){
|
|
|
+ jyUserPlatform.setRoleId(sysUser.getRoleId());
|
|
|
+ }
|
|
|
+
|
|
|
+ SysRole sysRole = roleMap.get(jyUserPlatform.getRoleId());
|
|
|
+ if(sysRole != null){
|
|
|
+ jyUserPlatform.setRoleName(sysRole.getRoleName());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return jyUserPlatforms;
|