|
@ -155,20 +155,12 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD |
|
|
* @param formDTO |
|
|
* @param formDTO |
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO> |
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO> |
|
|
* @Author yinzuomei |
|
|
* @Author yinzuomei |
|
|
* @Description 生成邀请连接 |
|
|
* @Description 生成邀请群成员连接 |
|
|
* @Date 2020/3/31 22:50 |
|
|
* @Date 2020/3/31 22:50 |
|
|
**/ |
|
|
**/ |
|
|
@Override |
|
|
@Override |
|
|
public Result<CreateGroupInvitationResultDTO> createGroupInvitation(CreateGroupInvitationFormDTO formDTO) { |
|
|
public Result<CreateGroupInvitationResultDTO> createGroupInvitation(CreateGroupInvitationFormDTO formDTO) { |
|
|
//1、只有群主可以邀请新成员
|
|
|
//1、只有群主可以邀请新成员(这块界面限制死了,只有群主才能看到邀请新成员按钮)
|
|
|
ResiGroupMemberDTO resiGroupMemberDTO = resiGroupMemberDao.selectGroupMemberInfo(formDTO.getGroupId(), formDTO.getUserId()); |
|
|
|
|
|
if (null == resiGroupMemberDTO) { |
|
|
|
|
|
return new Result<>(); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != resiGroupMemberDTO && !LeaderFlagConstant.GROUP_LEADER.equals(resiGroupMemberDTO.getGroupLeaderFlag())) { |
|
|
|
|
|
return new Result<CreateGroupInvitationResultDTO>().error(EpmetErrorCode.ONLY_LEADER_CAN_INVITE.getValue(), |
|
|
|
|
|
EpmetErrorCode.ONLY_LEADER_CAN_INVITE.getName()); |
|
|
|
|
|
} |
|
|
|
|
|
//2、审核通过(讨论中)的群才可以分享邀请连接
|
|
|
//2、审核通过(讨论中)的群才可以分享邀请连接
|
|
|
ResiGroupDTO resiGroupDTO = resiGroupService.get(formDTO.getGroupId()); |
|
|
ResiGroupDTO resiGroupDTO = resiGroupService.get(formDTO.getGroupId()); |
|
|
if (!GroupStateConstant.GROUP_APPROVED.equals(resiGroupDTO.getState())) { |
|
|
if (!GroupStateConstant.GROUP_APPROVED.equals(resiGroupDTO.getState())) { |
|
@ -179,7 +171,7 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD |
|
|
groupInvitationEntity.setInviterUserId(formDTO.getUserId()); |
|
|
groupInvitationEntity.setInviterUserId(formDTO.getUserId()); |
|
|
groupInvitationEntity.setInviterCustomerId(resiGroupDTO.getCustomerId()); |
|
|
groupInvitationEntity.setInviterCustomerId(resiGroupDTO.getCustomerId()); |
|
|
groupInvitationEntity.setInviterGridId(resiGroupDTO.getGridId()); |
|
|
groupInvitationEntity.setInviterGridId(resiGroupDTO.getGridId()); |
|
|
//暂定7天有效期
|
|
|
//暂定14天有效期
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + NumConstant.FOURTEEN); |
|
|
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + NumConstant.FOURTEEN); |
|
|
groupInvitationEntity.setValidEndTime(calendar.getTime()); |
|
|
groupInvitationEntity.setValidEndTime(calendar.getTime()); |
|
@ -210,7 +202,6 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD |
|
|
ResiGroupMemberDTO resiGroupMemberDTO = resiGroupMemberDao.selectGroupMemberInfo(groupInvitationDTO.getResiGroupId(), formDTO.getUserId()); |
|
|
ResiGroupMemberDTO resiGroupMemberDTO = resiGroupMemberDao.selectGroupMemberInfo(groupInvitationDTO.getResiGroupId(), formDTO.getUserId()); |
|
|
if (null != resiGroupMemberDTO && !MemberStateConstant.REMOVED.equals(resiGroupMemberDTO.getStatus())) { |
|
|
if (null != resiGroupMemberDTO && !MemberStateConstant.REMOVED.equals(resiGroupMemberDTO.getStatus())) { |
|
|
linkGroupInfoResultDTO.setInGroup(Constant.YES); |
|
|
linkGroupInfoResultDTO.setInGroup(Constant.YES); |
|
|
// return new Result<LinkGroupInfoResultDTO>().ok(linkGroupInfoResultDTO);
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
linkGroupInfoResultDTO.setInGroup(Constant.NO); |
|
|
linkGroupInfoResultDTO.setInGroup(Constant.NO); |
|
|
} |
|
|
} |
|
@ -282,10 +273,10 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD |
|
|
GroupInvitationDTO groupInvitationDTO = this.get(invitationId); |
|
|
GroupInvitationDTO groupInvitationDTO = this.get(invitationId); |
|
|
//Date1.after(Date2),当Date1大于Date2时,返回TRUE,当小于等于时,返回false;
|
|
|
//Date1.after(Date2),当Date1大于Date2时,返回TRUE,当小于等于时,返回false;
|
|
|
if (null == groupInvitationDTO) { |
|
|
if (null == groupInvitationDTO) { |
|
|
return new Result<GroupInvitationDTO>().error(EpmetErrorCode.LOSE_EFFICACY.getValue(), EpmetErrorCode.LOSE_EFFICACY.getName()); |
|
|
return new Result<GroupInvitationDTO>().error(EpmetErrorCode.LOSE_EFFICACY.getCode(), EpmetErrorCode.LOSE_EFFICACY.getMsg()); |
|
|
} |
|
|
} |
|
|
if (null != groupInvitationDTO && !groupInvitationDTO.getValidEndTime().after(new Date())) { |
|
|
if (null != groupInvitationDTO && !groupInvitationDTO.getValidEndTime().after(new Date())) { |
|
|
return new Result<GroupInvitationDTO>().error(EpmetErrorCode.LOSE_EFFICACY.getValue(), EpmetErrorCode.LOSE_EFFICACY.getName()); |
|
|
return new Result<GroupInvitationDTO>().error(EpmetErrorCode.LOSE_EFFICACY.getCode(), EpmetErrorCode.LOSE_EFFICACY.getMsg()); |
|
|
} |
|
|
} |
|
|
ResiGroupEntity resiGroupEntity = resiGroupDao.selectById(groupInvitationDTO.getResiGroupId()); |
|
|
ResiGroupEntity resiGroupEntity = resiGroupDao.selectById(groupInvitationDTO.getResiGroupId()); |
|
|
if (null == resiGroupEntity) { |
|
|
if (null == resiGroupEntity) { |
|
@ -323,7 +314,7 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD |
|
|
formDTO.getUserId(), |
|
|
formDTO.getUserId(), |
|
|
resiGroupDTO.getCustomerId()); |
|
|
resiGroupDTO.getCustomerId()); |
|
|
if (NumConstant.ZERO_STR.equals(userRoleDTO.getRegisteredResiFlag())) { |
|
|
if (NumConstant.ZERO_STR.equals(userRoleDTO.getRegisteredResiFlag())) { |
|
|
return new Result().error(EpmetErrorCode.CANNOT_JOIN_GROUP.getValue(), EpmetErrorCode.CANNOT_JOIN_GROUP.getName()); |
|
|
return new Result().error(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode(), EpmetErrorCode.CANNOT_JOIN_GROUP.getMsg()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//3、新增一条邀请入群、直接审核通过的入群记录
|
|
|
//3、新增一条邀请入群、直接审核通过的入群记录
|
|
|