Commit 5ed93c74 by chamberone

fix: 序列化问题修复

1 parent ca625cb2
...@@ -18,14 +18,4 @@ public class OrganizationDTO { ...@@ -18,14 +18,4 @@ public class OrganizationDTO {
*/ */
private String type; 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 { ...@@ -25,6 +25,6 @@ public class UserLoginDTO {
private List<RoleInfo> roles; private List<RoleInfo> roles;
private List<ResourceInfo> menus; private List<ResourceInfo> menus;
private List<OrganizationDTO> auths; //private List<OrganizationDTO> auths;
} }
...@@ -178,32 +178,51 @@ public class OrganizationServiceImpl implements OrganizationService { ...@@ -178,32 +178,51 @@ public class OrganizationServiceImpl implements OrganizationService {
case cluster: case cluster:
List<OrgClusterEntity> clusters = orgClusterDao.findByClusterIdIn(organizationIds); List<OrgClusterEntity> clusters = orgClusterDao.findByClusterIdIn(organizationIds);
if (CollectionUtils.isNotEmpty(clusters)) { if (CollectionUtils.isNotEmpty(clusters)) {
return clusters.stream().map( return clusters.stream().map(c -> {
c -> new OrganizationDTO(c.getClusterId(), c.getName(), OrganizationType.cluster.getValue())) OrganizationDTO organizationDTO = new OrganizationDTO();
.collect(Collectors.toList()); organizationDTO.setId(c.getClusterId());
organizationDTO.setName(c.getName());
organizationDTO.setType(OrganizationType.cluster.getValue());
return organizationDTO;
}).collect(Collectors.toList());
} }
break; break;
case branch: case branch:
List<OrgBranchEntity> branchs = orgBranchDao.findByBranchIdIn(organizationIds); List<OrgBranchEntity> branchs = orgBranchDao.findByBranchIdIn(organizationIds);
if (CollectionUtils.isNotEmpty(branchs)) { if (CollectionUtils.isNotEmpty(branchs)) {
return branchs.stream().map(c -> new OrganizationDTO(c.getBranchId(), c.getBranchName(), return branchs.stream().map(c -> {
OrganizationType.branch.getValue())).collect(Collectors.toList()); OrganizationDTO organizationDTO = new OrganizationDTO();
organizationDTO.setId(c.getBranchId());
organizationDTO.setName(c.getBranchName());
organizationDTO.setType(OrganizationType.branch.getValue());
return organizationDTO;
}
).collect(Collectors.toList());
} }
break; break;
case group: case group:
List<OrgGroupEntity> groups = orgGroupDao.findByGroupIdIn(organizationIds); List<OrgGroupEntity> groups = orgGroupDao.findByGroupIdIn(organizationIds);
if (CollectionUtils.isNotEmpty(groups)) { if (CollectionUtils.isNotEmpty(groups)) {
return groups.stream().map( return groups.stream().map(c -> {
c -> new OrganizationDTO(c.getGroupId(), c.getGroupName(), OrganizationType.group.getValue())) OrganizationDTO organizationDTO = new OrganizationDTO();
.collect(Collectors.toList()); organizationDTO.setId(c.getGroupId());
organizationDTO.setName(c.getGroupName());
organizationDTO.setType(OrganizationType.group.getValue());
return organizationDTO;
}).collect(Collectors.toList());
} }
break; break;
case team: case team:
List<OrgTeamEntity> teams = orgTeamDao.findByTeamIdIn(organizationIds); List<OrgTeamEntity> teams = orgTeamDao.findByTeamIdIn(organizationIds);
if (CollectionUtils.isNotEmpty(teams)) { if (CollectionUtils.isNotEmpty(teams)) {
return teams.stream() return teams.stream().map(c -> {
.map(c -> new OrganizationDTO(c.getTeamId(), c.getTeamName(), OrganizationType.team.getValue())) OrganizationDTO organizationDTO = new OrganizationDTO();
.collect(Collectors.toList()); organizationDTO.setId(c.getTeamId());
organizationDTO.setName(c.getTeamName());
organizationDTO.setType(OrganizationType.team.getValue());
return organizationDTO;
}).collect(Collectors.toList());
} }
break; break;
default: default:
......
...@@ -164,7 +164,7 @@ public class UserService { ...@@ -164,7 +164,7 @@ public class UserService {
} }
return orgs; return orgs;
}).flatMap(a -> a.stream()).collect(Collectors.toList()); }).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!