Commit 5ed93c74 by chamberone

fix: 序列化问题修复

1 parent ca625cb2
......@@ -18,14 +18,4 @@ public class OrganizationDTO {
*/
private String type;
// 添加默认构造方法,否则反序列化会报错
public OrganizationDTO() {
super();
}
public OrganizationDTO(String id, String name, String type) {
this.id = id;
this.name = name;
this.type = type;
}
}
......@@ -25,6 +25,6 @@ public class UserLoginDTO {
private List<RoleInfo> roles;
private List<ResourceInfo> menus;
private List<OrganizationDTO> auths;
//private List<OrganizationDTO> auths;
}
......@@ -178,32 +178,51 @@ public class OrganizationServiceImpl implements OrganizationService {
case cluster:
List<OrgClusterEntity> clusters = orgClusterDao.findByClusterIdIn(organizationIds);
if (CollectionUtils.isNotEmpty(clusters)) {
return clusters.stream().map(
c -> new OrganizationDTO(c.getClusterId(), c.getName(), OrganizationType.cluster.getValue()))
.collect(Collectors.toList());
return clusters.stream().map(c -> {
OrganizationDTO organizationDTO = new OrganizationDTO();
organizationDTO.setId(c.getClusterId());
organizationDTO.setName(c.getName());
organizationDTO.setType(OrganizationType.cluster.getValue());
return organizationDTO;
}).collect(Collectors.toList());
}
break;
case branch:
List<OrgBranchEntity> branchs = orgBranchDao.findByBranchIdIn(organizationIds);
if (CollectionUtils.isNotEmpty(branchs)) {
return branchs.stream().map(c -> new OrganizationDTO(c.getBranchId(), c.getBranchName(),
OrganizationType.branch.getValue())).collect(Collectors.toList());
return branchs.stream().map(c -> {
OrganizationDTO organizationDTO = new OrganizationDTO();
organizationDTO.setId(c.getBranchId());
organizationDTO.setName(c.getBranchName());
organizationDTO.setType(OrganizationType.branch.getValue());
return organizationDTO;
}
).collect(Collectors.toList());
}
break;
case group:
List<OrgGroupEntity> groups = orgGroupDao.findByGroupIdIn(organizationIds);
if (CollectionUtils.isNotEmpty(groups)) {
return groups.stream().map(
c -> new OrganizationDTO(c.getGroupId(), c.getGroupName(), OrganizationType.group.getValue()))
.collect(Collectors.toList());
return groups.stream().map(c -> {
OrganizationDTO organizationDTO = new OrganizationDTO();
organizationDTO.setId(c.getGroupId());
organizationDTO.setName(c.getGroupName());
organizationDTO.setType(OrganizationType.group.getValue());
return organizationDTO;
}).collect(Collectors.toList());
}
break;
case team:
List<OrgTeamEntity> teams = orgTeamDao.findByTeamIdIn(organizationIds);
if (CollectionUtils.isNotEmpty(teams)) {
return teams.stream()
.map(c -> new OrganizationDTO(c.getTeamId(), c.getTeamName(), OrganizationType.team.getValue()))
.collect(Collectors.toList());
return teams.stream().map(c -> {
OrganizationDTO organizationDTO = new OrganizationDTO();
organizationDTO.setId(c.getTeamId());
organizationDTO.setName(c.getTeamName());
organizationDTO.setType(OrganizationType.team.getValue());
return organizationDTO;
}).collect(Collectors.toList());
}
break;
default:
......
......@@ -164,7 +164,7 @@ public class UserService {
}
return orgs;
}).flatMap(a -> a.stream()).collect(Collectors.toList());
userDTO.setAuths(allOrgs);
//userDTO.setAuths(allOrgs);
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!