|
|
|
@ -120,6 +120,8 @@ public class XmGroupUserController { |
|
|
|
} |
|
|
|
String pgClass=gu.getPgClass(); |
|
|
|
User user=LoginUtils.getCurrentUserInfo(); |
|
|
|
String name=""; |
|
|
|
if("0".equals(pgClass)){ |
|
|
|
if(!StringUtils.hasText(gu.getProjectId())){ |
|
|
|
return ResponseHelper.failed("projectId-0","请上送小组归属项目编号"); |
|
|
|
} |
|
|
|
@ -128,6 +130,7 @@ public class XmGroupUserController { |
|
|
|
if(xmProject==null){ |
|
|
|
return ResponseHelper.failed("product-0","产品已不存在"); |
|
|
|
} |
|
|
|
name=xmProject.getName(); |
|
|
|
if(!xmGroupService.checkUserIsProjectAdm(xmProject, user.getUserid())){ |
|
|
|
XmGroupVo xmGroupVo=this.xmGroupService.getProjectGroupFromCache(xmProject.getId(),gu.getGroupId()); |
|
|
|
if(xmGroupVo==null){ |
|
|
|
@ -138,6 +141,28 @@ public class XmGroupUserController { |
|
|
|
return ResponseHelper.failed("not-leader-ass","组长、副组长、组长助理以上人员可以添加小组成员。"); |
|
|
|
} |
|
|
|
} |
|
|
|
}else if("1".equals(pgClass)){ |
|
|
|
if(!StringUtils.hasText(gu.getProductId())){ |
|
|
|
return ResponseHelper.failed("productId-0","请上送小组归属产品编号"); |
|
|
|
} |
|
|
|
|
|
|
|
XmProduct product=this.xmProductService.getProductFromCache(gu.getProductId()); |
|
|
|
if(product==null){ |
|
|
|
return ResponseHelper.failed("product-0","产品已不存在"); |
|
|
|
} |
|
|
|
name=product.getProductName(); |
|
|
|
if(!xmGroupService.checkUserIsProductAdm(product, user.getUserid())){ |
|
|
|
XmGroupVo xmGroupVo=this.xmGroupService.getProductGroupFromCache(product.getId(),gu.getGroupId()); |
|
|
|
if(xmGroupVo==null){ |
|
|
|
return ResponseHelper.failed("group-0","小组已不存在"); |
|
|
|
} |
|
|
|
boolean isHead=xmGroupService.checkUserIsTeamHeadOrAss(xmGroupVo,user.getUserid()); |
|
|
|
if(isHead==false){ |
|
|
|
return ResponseHelper.failed("not-leader-ass","组长、副组长、组长助理以上人员可以添加小组成员。"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(xmGroupUserService.countByWhere(gu)>0){ |
|
|
|
tips.setFailureMsg("该用户已在小组中"); |
|
|
|
m.put("tips", tips); |
|
|
|
@ -150,7 +175,7 @@ public class XmGroupUserController { |
|
|
|
List<Map<String,Object>> users=new ArrayList<>(); |
|
|
|
users.add(usermap); |
|
|
|
pushMsgService.pushJoinChannelGroupMsg(user.getBranchId(), gu.getGroupId(), users); |
|
|
|
notifyMsgService.pushMsg(user,gu.getUserid(),gu.getUsername(),"7",gu.getProjectId(),gu.getGroupId(),"恭喜您加入项目【"+xmProject.getName()+"】"); |
|
|
|
notifyMsgService.pushMsg(user,gu.getUserid(),gu.getUsername(),"7",gu.getProjectId(),gu.getGroupId(),"恭喜您加入"+("0".equals(pgClass)?"项目":"产品")+"【"+name+"】"); |
|
|
|
if("1".equals(pgClass)){ |
|
|
|
xmGroupService.clearProductGroup(gu.getProductId()); |
|
|
|
xmRecordService.addXmGroupRecord(gu.getProductId(),gu.getGroupId(), "产品-团队-新增小组成员", "增加组员["+gu.getUsername()+"]",gu.getUserid(),null); |
|
|
|
@ -192,11 +217,13 @@ public class XmGroupUserController { |
|
|
|
if(!StringUtils.hasText(gu.getProjectId())){ |
|
|
|
return ResponseHelper.failed("projectId-0","请上送小组归属项目编号"); |
|
|
|
} |
|
|
|
|
|
|
|
String name=""; |
|
|
|
if("0".equals(pgClass)){ |
|
|
|
XmProject xmProject=this.xmProjectService.getProjectFromCache(gu.getProjectId()); |
|
|
|
if(xmProject==null){ |
|
|
|
return ResponseHelper.failed("project-0","项目已不存在"); |
|
|
|
} |
|
|
|
name=xmProject.getName(); |
|
|
|
if(!xmGroupService.checkUserIsProjectAdm(xmProject, user.getUserid())){ |
|
|
|
XmGroupVo xmGroupVo=this.xmGroupService.getProjectGroupFromCache(xmProject.getId(),gu.getGroupId()); |
|
|
|
if(xmGroupVo==null){ |
|
|
|
@ -207,18 +234,45 @@ public class XmGroupUserController { |
|
|
|
return ResponseHelper.failed("not-leader-ass","组长、副组长、组长助理以上人员可以删除小组成员。"); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
XmProduct xmProduct=this.xmProductService.getProductFromCache(gu.getProductId()); |
|
|
|
if(xmProduct==null){ |
|
|
|
return ResponseHelper.failed("productId-0","产品已不存在"); |
|
|
|
} |
|
|
|
name=xmProduct.getProductName(); |
|
|
|
if(!xmGroupService.checkUserIsProductAdm(xmProduct, user.getUserid())){ |
|
|
|
XmGroupVo xmGroupVo=this.xmGroupService.getProductGroupFromCache(xmProduct.getId(),gu.getGroupId()); |
|
|
|
if(xmGroupVo==null){ |
|
|
|
return ResponseHelper.failed("group-0","小组已不存在"); |
|
|
|
} |
|
|
|
boolean isHead=xmGroupService.checkUserIsTeamHeadOrAss(xmGroupVo,user.getUserid()); |
|
|
|
if(isHead==false){ |
|
|
|
return ResponseHelper.failed("not-leader-ass","组长、副组长、组长助理以上人员可以删除小组成员。"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
xmGroupUserService.deleteByPk(gu); |
|
|
|
Map<String,Object> usermap=new HashMap<>(); |
|
|
|
usermap.put("userid", gu.getUserid()); |
|
|
|
usermap.put("username", gu.getUsername()); |
|
|
|
List<Map<String,Object>> users=new ArrayList<>(); |
|
|
|
users.add(usermap); |
|
|
|
notifyMsgService.pushMsg(user,gu.getUserid(),gu.getUsername(),"7",gu.getProjectId(),gu.getGroupId(),"您离开项目【"+xmProject.getName()+"】中的小组【"+gu.getGroupId()+"】"); |
|
|
|
|
|
|
|
notifyMsgService.pushMsg(user,gu.getUserid(),gu.getUsername(),"7",gu.getProjectId(),gu.getGroupId(),"您离开"+("0".equals(pgClass)?"项目":"产品")+"【"+name+"】中的小组【"+gu.getGroupId()+"】"); |
|
|
|
|
|
|
|
pushMsgService.pushLeaveChannelGroupMsg(user.getBranchId(), gu.getGroupId(), users); |
|
|
|
|
|
|
|
if("1".equals(pgClass)){ |
|
|
|
xmGroupService.clearProductGroup(gu.getProductId()); |
|
|
|
xmRecordService.addXmProductRecord(gu.getProductId(), "产品-团队-删除小组成员", "删除组员["+gu.getUsername()+"]",gu.getUserid(),null); |
|
|
|
|
|
|
|
}else{ |
|
|
|
xmGroupService.clearProjectGroup(gu.getProjectId()); |
|
|
|
xmRecordService.addXmGroupRecord(gu.getProjectId(),gu.getGroupId(), "项目-团队-删除小组成员", "删除组员["+gu.getUsername()+"]",gu.getUserid(),null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}catch (BizException e) { |
|
|
|
tips=e.getTips(); |
|
|
|
|