|
@@ -52,10 +52,21 @@ public class OrganizationService {
|
|
if (markUser == null) {
|
|
if (markUser == null) {
|
|
throw new RuntimeException("机构信息有误");
|
|
throw new RuntimeException("机构信息有误");
|
|
}
|
|
}
|
|
- Organization organization1 = organizationRepo.findByName(organization.getName());
|
|
|
|
|
|
+ Organization organization1 = organizationRepo.findByName(markUser.getName());
|
|
if (organization1 != null) {
|
|
if (organization1 != null) {
|
|
throw new RuntimeException("机构名称已存在");
|
|
throw new RuntimeException("机构名称已存在");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ long distinctNameCount = organization.getMarkUsers().stream().map(m->m.getName()).distinct().count();
|
|
|
|
+ if(distinctNameCount == 1){
|
|
|
|
+ throw new RuntimeException("机构名称、项目经理名称不能相同");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ long distinctLoginNameCount = organization.getMarkUsers().stream().map(m->m.getLoginName()).distinct().count();
|
|
|
|
+ if(distinctLoginNameCount == 1){
|
|
|
|
+ throw new RuntimeException("机构账号、项目经理账号不能相同");
|
|
|
|
+ }
|
|
|
|
+
|
|
//机构名称
|
|
//机构名称
|
|
organization.setName(markUser.getName());
|
|
organization.setName(markUser.getName());
|
|
//默认启用
|
|
//默认启用
|