use of com.bc.pmpheep.back.vo.PmphGroupMemberVO in project pmph by BCSquad.
the class PmphGroupMemberServiceImpl method isFounderOrisAdmin.
@Override
public Boolean isFounderOrisAdmin(Long groupId, String sessionId) throws CheckedServiceException {
boolean flag = false;
PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
if (null == pmphUser || null == pmphUser.getId()) {
throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "用户为空");
}
Long memberId = pmphUser.getId();
PmphGroupMemberVO currentUser = pmphGroupMemberDao.getPmphGroupMemberByMemberId(groupId, memberId, false);
if (null != currentUser) {
if (currentUser.getIsFounder() || currentUser.getIsAdmin()) {
flag = true;
}
}
return flag;
}
use of com.bc.pmpheep.back.vo.PmphGroupMemberVO in project pmph by BCSquad.
the class PmphGroupMemberServiceImpl method addPmphGroupMembers.
@Override
public Integer addPmphGroupMembers(Long groupId, List<PmphGroupMember> pmphGroupMembers) throws CheckedServiceException {
if (null == pmphGroupMembers || pmphGroupMembers.size() == 0) {
throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.ILLEGAL_PARAM, "参数为空");
}
for (PmphGroupMember pmphGroupMember : pmphGroupMembers) {
Boolean isWriter = pmphGroupMember.getIsWriter();
isWriter = (isWriter == null || !isWriter) ? false : true;
PmphGroupMemberVO member = getPmphGroupMemberByMemberId(groupId, pmphGroupMember.getUserId(), isWriter);
if (null == member || member.getId() == null) {
if (StringUtil.isEmpty(pmphGroupMember.getDisplayName())) {
if (isWriter) {
pmphGroupMember.setDisplayName(writerUserService.get(pmphGroupMember.getUserId()).getRealname());
} else {
pmphGroupMember.setDisplayName(pmphUserService.get(pmphGroupMember.getUserId()).getRealname());
}
}
pmphGroupMember.setGroupId(groupId);
this.addPmphGroupMember(pmphGroupMember);
} else {
PmphGroupMember reUseMember = new PmphGroupMember();
reUseMember.setId(member.getId());
reUseMember.setIsDeleted(false);
pmphGroupMemberDao.updatePmphGroupMember(reUseMember);
}
}
return pmphGroupMembers.size();
}
use of com.bc.pmpheep.back.vo.PmphGroupMemberVO in project pmph by BCSquad.
the class PmphGroupMemberServiceImpl method listPmphGroupMember.
@Override
public List<PmphGroupMemberVO> listPmphGroupMember(Long groupId, String sessionId) throws CheckedServiceException {
if (null == groupId || groupId == 0) {
List<PmphGroupListVO> myPmphGroupListVOList = pmphGroupService.listPmphGroup(new PmphGroup(), sessionId);
if (null == myPmphGroupListVOList || myPmphGroupListVOList.size() == 0) {
throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "你没有小组!");
}
// 初始化页面时没有参数传入则直接调用初始化时小组排序的第一个小组id
groupId = myPmphGroupListVOList.get(0).getId();
}
List<PmphGroupMemberVO> list = pmphGroupMemberDao.listPmphGroupMember(groupId);
for (PmphGroupMemberVO pmphGroupMemberVO : list) {
if (pmphGroupMemberVO.getIsWriter()) {
pmphGroupMemberVO.setAvatar(RouteUtil.userAvatar(writerUserService.get(pmphGroupMemberVO.getUserId()).getAvatar()));
pmphGroupMemberVO.setUserType(Const.SENDER_TYPE_2);
} else {
pmphGroupMemberVO.setAvatar(RouteUtil.userAvatar(pmphUserService.get(pmphGroupMemberVO.getUserId()).getAvatar()));
pmphGroupMemberVO.setUserType(Const.SENDER_TYPE_1);
}
}
return list;
}
use of com.bc.pmpheep.back.vo.PmphGroupMemberVO in project pmph by BCSquad.
the class PmphGroupMemberServiceImpl method getPmphGroupMemberByMemberId.
@Override
public PmphGroupMemberVO getPmphGroupMemberByMemberId(Long groupId, Long userId, Boolean isWriter) throws CheckedServiceException {
if (null == userId) {
throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "组员id不能为空");
}
PmphGroupMemberVO pmphGroupMemberVO = pmphGroupMemberDao.getPmphGroupMemberByMemberId(groupId, userId, isWriter);
if (ObjectUtil.isNull(pmphGroupMemberVO)) {
return null;
// throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM,
// "你不是该小组的组员");
}
pmphGroupMemberVO.setAvatar(isWriter ? writerUserService.get(userId).getAvatar() : pmphUserService.get(userId).getAvatar());
return pmphGroupMemberVO;
}
Aggregations