|
|
@ -4,6 +4,7 @@ import com.mdp.core.entity.Tips; |
|
|
import com.mdp.core.err.BizException; |
|
|
import com.mdp.core.err.BizException; |
|
|
import com.mdp.core.utils.RequestUtils; |
|
|
import com.mdp.core.utils.RequestUtils; |
|
|
import com.mdp.core.utils.ResponseHelper; |
|
|
import com.mdp.core.utils.ResponseHelper; |
|
|
|
|
|
import com.mdp.msg.client.PushNotifyMsgService; |
|
|
import com.mdp.mybatis.PageUtils; |
|
|
import com.mdp.mybatis.PageUtils; |
|
|
import com.mdp.safe.client.entity.User; |
|
|
import com.mdp.safe.client.entity.User; |
|
|
import com.mdp.safe.client.utils.LoginUtils; |
|
|
import com.mdp.safe.client.utils.LoginUtils; |
|
|
@ -67,6 +68,11 @@ public class XmGroupUserController { |
|
|
XmPushMsgService pushMsgService; |
|
|
XmPushMsgService pushMsgService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
PushNotifyMsgService notifyMsgService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation( value = "查询xm_group_user信息列表",notes="listXmProjectGroupUser,条件之间是 and关系,模糊查询写法如 {studentName:'%才哥%'}") |
|
|
@ApiOperation( value = "查询xm_group_user信息列表",notes="listXmProjectGroupUser,条件之间是 and关系,模糊查询写法如 {studentName:'%才哥%'}") |
|
|
@ApiEntityParams(XmGroupUser.class) |
|
|
@ApiEntityParams(XmGroupUser.class) |
|
|
@ApiImplicitParams({ |
|
|
@ApiImplicitParams({ |
|
|
@ -114,26 +120,6 @@ public class XmGroupUserController { |
|
|
} |
|
|
} |
|
|
String pgClass=gu.getPgClass(); |
|
|
String pgClass=gu.getPgClass(); |
|
|
User user=LoginUtils.getCurrentUserInfo(); |
|
|
User user=LoginUtils.getCurrentUserInfo(); |
|
|
if("1".equals(pgClass)){ |
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtils.hasText(gu.getProductId())){ |
|
|
|
|
|
return ResponseHelper.failed("productId-0","请上送小组归属产品编号"); |
|
|
|
|
|
} |
|
|
|
|
|
XmProduct xmProduct=this.xmProductService.getProductFromCache(gu.getProductId()); |
|
|
|
|
|
if(xmProduct==null){ |
|
|
|
|
|
return ResponseHelper.failed("product-0","产品已不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
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","组长、副组长、组长助理以上人员可以添加小组成员。"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
if(!StringUtils.hasText(gu.getProjectId())){ |
|
|
if(!StringUtils.hasText(gu.getProjectId())){ |
|
|
return ResponseHelper.failed("projectId-0","请上送小组归属项目编号"); |
|
|
return ResponseHelper.failed("projectId-0","请上送小组归属项目编号"); |
|
|
} |
|
|
} |
|
|
@ -152,8 +138,6 @@ public class XmGroupUserController { |
|
|
return ResponseHelper.failed("not-leader-ass","组长、副组长、组长助理以上人员可以添加小组成员。"); |
|
|
return ResponseHelper.failed("not-leader-ass","组长、副组长、组长助理以上人员可以添加小组成员。"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(xmGroupUserService.countByWhere(gu)>0){ |
|
|
if(xmGroupUserService.countByWhere(gu)>0){ |
|
|
tips.setFailureMsg("该用户已在小组中"); |
|
|
tips.setFailureMsg("该用户已在小组中"); |
|
|
m.put("tips", tips); |
|
|
m.put("tips", tips); |
|
|
@ -166,6 +150,7 @@ public class XmGroupUserController { |
|
|
List<Map<String,Object>> users=new ArrayList<>(); |
|
|
List<Map<String,Object>> users=new ArrayList<>(); |
|
|
users.add(usermap); |
|
|
users.add(usermap); |
|
|
pushMsgService.pushJoinChannelGroupMsg(user.getBranchId(), gu.getGroupId(), users); |
|
|
pushMsgService.pushJoinChannelGroupMsg(user.getBranchId(), gu.getGroupId(), users); |
|
|
|
|
|
notifyMsgService.pushMsg(user,gu.getUserid(),gu.getUsername(),"7",gu.getProjectId(),gu.getGroupId(),"恭喜您加入项目【"+xmProject.getName()+"】"); |
|
|
if("1".equals(pgClass)){ |
|
|
if("1".equals(pgClass)){ |
|
|
xmGroupService.clearProductGroup(gu.getProductId()); |
|
|
xmGroupService.clearProductGroup(gu.getProductId()); |
|
|
xmRecordService.addXmGroupRecord(gu.getProductId(),gu.getGroupId(), "产品-团队-新增小组成员", "增加组员["+gu.getUsername()+"]",gu.getUserid(),null); |
|
|
xmRecordService.addXmGroupRecord(gu.getProductId(),gu.getGroupId(), "产品-团队-新增小组成员", "增加组员["+gu.getUsername()+"]",gu.getUserid(),null); |
|
|
@ -204,26 +189,6 @@ public class XmGroupUserController { |
|
|
} |
|
|
} |
|
|
String pgClass=gu.getPgClass(); |
|
|
String pgClass=gu.getPgClass(); |
|
|
User user=LoginUtils.getCurrentUserInfo(); |
|
|
User user=LoginUtils.getCurrentUserInfo(); |
|
|
if("1".equals(pgClass)){ |
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtils.hasText(gu.getProductId())){ |
|
|
|
|
|
return ResponseHelper.failed("productId-0","请上送小组归属产品编号"); |
|
|
|
|
|
} |
|
|
|
|
|
XmProduct xmProduct=this.xmProductService.getProductFromCache(gu.getProductId()); |
|
|
|
|
|
if(xmProduct==null){ |
|
|
|
|
|
return ResponseHelper.failed("product-0","产品已不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
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","组长、副组长、组长助理以上人员可以删除小组成员。"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
if(!StringUtils.hasText(gu.getProjectId())){ |
|
|
if(!StringUtils.hasText(gu.getProjectId())){ |
|
|
return ResponseHelper.failed("projectId-0","请上送小组归属项目编号"); |
|
|
return ResponseHelper.failed("projectId-0","请上送小组归属项目编号"); |
|
|
} |
|
|
} |
|
|
@ -242,22 +207,17 @@ public class XmGroupUserController { |
|
|
return ResponseHelper.failed("not-leader-ass","组长、副组长、组长助理以上人员可以删除小组成员。"); |
|
|
return ResponseHelper.failed("not-leader-ass","组长、副组长、组长助理以上人员可以删除小组成员。"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
xmGroupUserService.deleteByPk(gu); |
|
|
xmGroupUserService.deleteByPk(gu); |
|
|
Map<String,Object> usermap=new HashMap<>(); |
|
|
Map<String,Object> usermap=new HashMap<>(); |
|
|
usermap.put("userid", gu.getUserid()); |
|
|
usermap.put("userid", gu.getUserid()); |
|
|
usermap.put("username", gu.getUsername()); |
|
|
usermap.put("username", gu.getUsername()); |
|
|
List<Map<String,Object>> users=new ArrayList<>(); |
|
|
List<Map<String,Object>> users=new ArrayList<>(); |
|
|
users.add(usermap); |
|
|
users.add(usermap); |
|
|
pushMsgService.pushLeaveChannelGroupMsg(user.getBranchId(), gu.getGroupId(), users); |
|
|
|
|
|
if("1".equals(pgClass)){ |
|
|
|
|
|
|
|
|
notifyMsgService.pushMsg(user,gu.getUserid(),gu.getUsername(),"7",gu.getProjectId(),gu.getGroupId(),"您离开项目【"+xmProject.getName()+"】中的小组【"+gu.getGroupId()+"】"); |
|
|
|
|
|
|
|
|
xmGroupService.clearProductGroup(gu.getProductId()); |
|
|
|
|
|
xmRecordService.addXmGroupRecord(gu.getProductId(),gu.getGroupId(), "项目-团队-删除小组成员", "删除组员["+gu.getUsername()+"]",gu.getUserid(),null); |
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
pushMsgService.pushLeaveChannelGroupMsg(user.getBranchId(), gu.getGroupId(), users); |
|
|
xmGroupService.clearProjectGroup(gu.getProjectId()); |
|
|
xmGroupService.clearProjectGroup(gu.getProjectId()); |
|
|
xmRecordService.addXmGroupRecord(gu.getProjectId(),gu.getGroupId(), "项目-团队-删除小组成员", "删除组员["+gu.getUsername()+"]",gu.getUserid(),null); |
|
|
xmRecordService.addXmGroupRecord(gu.getProjectId(),gu.getGroupId(), "项目-团队-删除小组成员", "删除组员["+gu.getUsername()+"]",gu.getUserid(),null); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch (BizException e) { |
|
|
}catch (BizException e) { |
|
|
|