|
|
@ -1,18 +1,16 @@ |
|
|
package com.xm.core.service; |
|
|
package com.xm.core.service; |
|
|
|
|
|
|
|
|
import com.mdp.core.entity.Tips; |
|
|
import com.mdp.core.entity.Tips; |
|
|
import com.mdp.safe.client.entity.Dept; |
|
|
|
|
|
import com.mdp.safe.client.entity.User; |
|
|
import com.mdp.safe.client.entity.User; |
|
|
import com.xm.core.QxTool; |
|
|
import com.xm.core.QxTool; |
|
|
import com.xm.core.entity.XmProject; |
|
|
import com.xm.core.entity.XmProject; |
|
|
import com.xm.core.service.client.SysClient; |
|
|
import com.xm.core.service.client.SysClient; |
|
|
|
|
|
import com.xm.core.vo.XmGroupVo; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.util.StringUtils; |
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -112,7 +110,7 @@ public class XmProjectQxService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if("2".equals(scopeQx)){//同项目 |
|
|
}else if("2".equals(scopeQx)){//同项目 |
|
|
List<Dept> groups=this.getProjectGroupsFromLocalCache(xmProject.getDeptid()); |
|
|
|
|
|
|
|
|
List<XmGroupVo> groups=this.getProjectGroupsFromLocalCache(xmProject.getId()); |
|
|
if( !headIsPm && !xmGroupService.checkUserExistsGroup(groups, head.getUserid())){ |
|
|
if( !headIsPm && !xmGroupService.checkUserExistsGroup(groups, head.getUserid())){ |
|
|
tips.setErrMsg("pdqx-scope-product-0",String.format("项目【%s】只开放给同一个项目团队人员,【%s】不在项目团队中。",xmProject.getId(),headUsername)); |
|
|
tips.setErrMsg("pdqx-scope-product-0",String.format("项目【%s】只开放给同一个项目团队人员,【%s】不在项目团队中。",xmProject.getId(),headUsername)); |
|
|
return tips; |
|
|
return tips; |
|
|
@ -126,8 +124,8 @@ public class XmProjectQxService { |
|
|
tips.setErrMsg("pdqx-scope-product-1",String.format("项目【%s】只开放给同一个项目团队人员,【%s】不在项目团队中。",xmProject.getId(),memUsername)); |
|
|
tips.setErrMsg("pdqx-scope-product-1",String.format("项目【%s】只开放给同一个项目团队人员,【%s】不在项目团队中。",xmProject.getId(),memUsername)); |
|
|
return tips; |
|
|
return tips; |
|
|
}else if("3".equals(scopeQx)){//同小组 |
|
|
}else if("3".equals(scopeQx)){//同小组 |
|
|
List<Dept> groups=this.getProjectGroupsFromLocalCache(xmProject.getId()); |
|
|
|
|
|
List<Dept> headGroups=groups; |
|
|
|
|
|
|
|
|
List<XmGroupVo> groups=this.getProjectGroupsFromLocalCache(xmProject.getId()); |
|
|
|
|
|
List<XmGroupVo> headGroups=groups; |
|
|
|
|
|
|
|
|
if( !headIsPm ){ |
|
|
if( !headIsPm ){ |
|
|
headGroups=xmGroupService.getUserGroups(groups,head.getUserid()); |
|
|
headGroups=xmGroupService.getUserGroups(groups,head.getUserid()); |
|
|
@ -140,7 +138,7 @@ public class XmProjectQxService { |
|
|
if(xmGroupService.checkUserIsProjectAdm(xmProject,memUserid)){ |
|
|
if(xmGroupService.checkUserIsProjectAdm(xmProject,memUserid)){ |
|
|
return tips; |
|
|
return tips; |
|
|
} |
|
|
} |
|
|
List<Dept> memGroups=xmGroupService.getUserGroups(headGroups,memUserid); |
|
|
|
|
|
|
|
|
List<XmGroupVo> memGroups=xmGroupService.getUserGroups(headGroups,memUserid); |
|
|
if( memGroups!=null && memGroups.size()>0 ){ |
|
|
if( memGroups!=null && memGroups.size()>0 ){ |
|
|
return tips; |
|
|
return tips; |
|
|
} |
|
|
} |
|
|
@ -219,7 +217,10 @@ public class XmProjectQxService { |
|
|
return tips; |
|
|
return tips; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<Dept> groups=getProjectGroupsFromLocalCache(xmProject.getId()); |
|
|
|
|
|
|
|
|
List<XmGroupVo> groups=getProjectGroupsFromLocalCache(xmProject.getId()); |
|
|
|
|
|
if(xmGroupService.checkUserIsOtherUserTeamHeadOrAss(groups, head.getUserid(), memUserid)){ |
|
|
|
|
|
return tips; |
|
|
|
|
|
} |
|
|
tips.setErrMsg("pdqx-transmit-0", |
|
|
tips.setErrMsg("pdqx-transmit-0", |
|
|
String.format("项目【%s】开启了上下级关系检查,您当前账户【%s】不属于账户【%s】的上级,无权操作。",xmProject.getId(),head.getUsername(),memUsername)); |
|
|
String.format("项目【%s】开启了上下级关系检查,您当前账户【%s】不属于账户【%s】的上级,无权操作。",xmProject.getId(),head.getUsername(),memUsername)); |
|
|
|
|
|
|
|
|
@ -231,7 +232,9 @@ public class XmProjectQxService { |
|
|
|
|
|
|
|
|
public Tips checkProjectQxBatch(XmProject xmProject,int teamType,User head,String ...memUserids){ |
|
|
public Tips checkProjectQxBatch(XmProject xmProject,int teamType,User head,String ...memUserids){ |
|
|
Tips tips=new Tips("成功"); |
|
|
Tips tips=new Tips("成功"); |
|
|
|
|
|
|
|
|
|
|
|
if(xmGroupService.checkUserIsProjectAdm(xmProject,head.getUserid())){ |
|
|
|
|
|
return tips; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
tips=this.checkProjectScopeQxBatch(xmProject,teamType,head,memUserids); |
|
|
tips=this.checkProjectScopeQxBatch(xmProject,teamType,head,memUserids); |
|
|
if(!tips.isOk()){ |
|
|
if(!tips.isOk()){ |
|
|
@ -281,7 +284,7 @@ public class XmProjectQxService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if("2".equals(scopeQx)){//同项目 |
|
|
}else if("2".equals(scopeQx)){//同项目 |
|
|
List<Dept> groups= xmGroupService.getSubDeptList(xmProject.getDeptid()); |
|
|
|
|
|
|
|
|
List<XmGroupVo> groups=this.getProjectGroupsFromLocalCache(xmProject.getId()); |
|
|
if( !headIsPm && !xmGroupService.checkUserExistsGroup(groups, head.getUserid())){ |
|
|
if( !headIsPm && !xmGroupService.checkUserExistsGroup(groups, head.getUserid())){ |
|
|
tips.setErrMsg("pdqx-scope-product-0",String.format("项目【%s】只开放给同一个项目团队人员,【%s】不在项目团队中。",xmProject.getId(),username)); |
|
|
tips.setErrMsg("pdqx-scope-product-0",String.format("项目【%s】只开放给同一个项目团队人员,【%s】不在项目团队中。",xmProject.getId(),username)); |
|
|
return tips; |
|
|
return tips; |
|
|
@ -297,8 +300,8 @@ public class XmProjectQxService { |
|
|
tips.setErrMsg("pdqx-scope-product-1",String.format("项目【%s】只开放给同一个项目团队人员,【%s】不在项目团队中。",xmProject.getId(),memUseridSet.stream().collect(Collectors.joining(",")))); |
|
|
tips.setErrMsg("pdqx-scope-product-1",String.format("项目【%s】只开放给同一个项目团队人员,【%s】不在项目团队中。",xmProject.getId(),memUseridSet.stream().collect(Collectors.joining(",")))); |
|
|
return tips; |
|
|
return tips; |
|
|
}else if("3".equals(scopeQx)){//同小组 |
|
|
}else if("3".equals(scopeQx)){//同小组 |
|
|
List<Dept> groups=this.getProjectGroupsFromLocalCache(xmProject.getId()); |
|
|
|
|
|
List<Dept> headGroups=groups; |
|
|
|
|
|
|
|
|
List<XmGroupVo> groups=this.getProjectGroupsFromLocalCache(xmProject.getId()); |
|
|
|
|
|
List<XmGroupVo> headGroups=groups; |
|
|
|
|
|
|
|
|
if( !headIsPm ){ |
|
|
if( !headIsPm ){ |
|
|
headGroups=xmGroupService.getUserGroups(groups,head.getUserid()); |
|
|
headGroups=xmGroupService.getUserGroups(groups,head.getUserid()); |
|
|
@ -311,7 +314,7 @@ public class XmProjectQxService { |
|
|
if(xmGroupService.checkUserIsProjectAdm(xmProject,memUserid)){ |
|
|
if(xmGroupService.checkUserIsProjectAdm(xmProject,memUserid)){ |
|
|
return tips; |
|
|
return tips; |
|
|
} |
|
|
} |
|
|
List<Dept> memGroups=xmGroupService.getUserGroups(headGroups,memUserid); |
|
|
|
|
|
|
|
|
List<XmGroupVo> memGroups=xmGroupService.getUserGroups(headGroups,memUserid); |
|
|
if( memGroups!=null && memGroups.size()>0 ){ |
|
|
if( memGroups!=null && memGroups.size()>0 ){ |
|
|
return tips; |
|
|
return tips; |
|
|
} |
|
|
} |
|
|
@ -323,8 +326,8 @@ public class XmProjectQxService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Dept> getProjectGroupsFromLocalCache(String deptid){ |
|
|
|
|
|
List<Dept> groupVoList= xmGroupService.getSubDeptList(deptid); |
|
|
|
|
|
|
|
|
List<XmGroupVo> getProjectGroupsFromLocalCache(String projectId){ |
|
|
|
|
|
List<XmGroupVo> groupVoList= xmGroupService.getProjectGroupVoList(projectId); |
|
|
|
|
|
|
|
|
return groupVoList; |
|
|
return groupVoList; |
|
|
} |
|
|
} |
|
|
@ -343,7 +346,7 @@ public class XmProjectQxService { |
|
|
if(memUseridSet.size()==0){ |
|
|
if(memUseridSet.size()==0){ |
|
|
return tips; |
|
|
return tips; |
|
|
} |
|
|
} |
|
|
List<Dept> groups=getProjectGroupsFromLocalCache(xmProject.getId()); |
|
|
|
|
|
|
|
|
List<XmGroupVo> groups=getProjectGroupsFromLocalCache(xmProject.getId()); |
|
|
for (String memUserid : memUseridSet) { |
|
|
for (String memUserid : memUseridSet) { |
|
|
if(xmGroupService.checkUserIsOtherUserTeamHeadOrAss(groups,headUserid,memUserid)){ |
|
|
if(xmGroupService.checkUserIsOtherUserTeamHeadOrAss(groups,headUserid,memUserid)){ |
|
|
return tips; |
|
|
return tips; |
|
|
|