77 changed files with 1615 additions and 124 deletions
@ -0,0 +1,10 @@ |
|||
package com.epmet.resi.group.dto.comment.form; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiCommentFormDTO |
|||
* @Author wangc |
|||
* @date 2020.04.01 17:14 |
|||
*/ |
|||
public class ResiCommentFormDTO { |
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.epmet.resi.group.dto.comment.result; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiCommentResultDTO |
|||
* @Author wangc |
|||
* @date 2020.04.01 17:07 |
|||
*/ |
|||
public class ResiCommentResultDTO { |
|||
} |
@ -0,0 +1,101 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.resi.group.dto.invitation; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 群邀请记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-31 |
|||
*/ |
|||
@Data |
|||
public class GroupInvitationDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键(可能跟epmet-user的personnel_invite的[邀请Id]关联) |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 邀请人id(customer_user.id) |
|||
*/ |
|||
private String inviterUserId; |
|||
|
|||
/** |
|||
* 邀请人所属客户id |
|||
*/ |
|||
private String inviterCustomerId; |
|||
|
|||
/** |
|||
* 邀请网格id |
|||
*/ |
|||
private String inviterGridId; |
|||
|
|||
/** |
|||
* 邀请小组id(resi_group.id) |
|||
*/ |
|||
private String resiGroupId; |
|||
|
|||
/** |
|||
* 邀请内容 |
|||
*/ |
|||
private String inviterContent; |
|||
|
|||
/** |
|||
* 邀请码有效截止时间(暂定XX天) |
|||
*/ |
|||
private Date validEndTime; |
|||
|
|||
/** |
|||
* 删除标记 0:未删除,1:已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人(customer_user.id) |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间(邀请时间) |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.epmet.resi.group.dto.invitation.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 同意邀请进组 |
|||
* @Author yinzuomei |
|||
* @Date 2020/3/31 23:45 |
|||
*/ |
|||
@Data |
|||
public class AccetInvitationFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 132547449950577938L; |
|||
|
|||
/** |
|||
* 邀请id |
|||
*/ |
|||
@NotBlank(message="邀请链接id不能为空") |
|||
private String invitationId; |
|||
|
|||
/** |
|||
* 当前登录用户id由TokenDto赋值 |
|||
*/ |
|||
@NotBlank(message="当前用户id不能为空") |
|||
private String userId; |
|||
|
|||
@NotBlank(message = "app不能为空") |
|||
private String app; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.epmet.resi.group.dto.invitation.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 生成邀请链接入参 |
|||
* @Author yinzuomei |
|||
* @Date 2020/3/31 22:46 |
|||
*/ |
|||
@Data |
|||
public class CreateGroupInvitationFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 5703017117444559566L; |
|||
|
|||
/** |
|||
* 要审核的组id |
|||
*/ |
|||
@NotBlank(message="groupId不能为空") |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 当前登录用户id由TokenDto赋值 |
|||
*/ |
|||
@NotBlank(message="当前用户id不能为空") |
|||
private String userId; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.epmet.resi.group.dto.invitation.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 根据群邀请连接查询群基本信息入参DTO |
|||
* @Author yinzuomei |
|||
* @Date 2020/3/31 23:12 |
|||
*/ |
|||
@Data |
|||
public class LinkGroupInfoFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 7069116393380944951L; |
|||
|
|||
/** |
|||
* 邀请id |
|||
*/ |
|||
@NotBlank(message="邀请链接id不能为空") |
|||
private String invitationId; |
|||
|
|||
/** |
|||
* 当前登录用户id由TokenDto赋值 |
|||
*/ |
|||
private String userId; |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.resi.group.dto.invitation.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 生成邀请链接返参 |
|||
* @Author yinzuomei |
|||
* @Date 2020/3/31 22:49 |
|||
*/ |
|||
@Data |
|||
public class CreateGroupInvitationResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 5142118627780324057L; |
|||
|
|||
/** |
|||
* 邀请id |
|||
*/ |
|||
private String invitationId; |
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.epmet.resi.group.dto.invitation.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 根据群邀请连接查询群基本信息入参DTO 小组邀请界面信息 |
|||
* @Author yinzuomei |
|||
* @Date 2020/3/31 23:18 |
|||
*/ |
|||
@Data |
|||
public class LinkGroupInfoResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 8860336693592035343L; |
|||
|
|||
/** |
|||
* 群组id |
|||
*/ |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 群组头像 |
|||
*/ |
|||
private String groupHeadPhoto; |
|||
|
|||
/** |
|||
* 组长名称!!!!!!!! |
|||
* 暂定街道-姓名 |
|||
*/ |
|||
private String leaderName; |
|||
|
|||
/** |
|||
* 群组名称 |
|||
*/ |
|||
private String groupName; |
|||
|
|||
/** |
|||
* 组介绍 |
|||
*/ |
|||
private String groupIntroduction; |
|||
|
|||
/** |
|||
* 成员总数 |
|||
*/ |
|||
private Integer totalMember; |
|||
|
|||
/** |
|||
* 党员总数 |
|||
*/ |
|||
private Integer totalPartyMember; |
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.epmet.resi.group.dto.topic.form; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiTopicOperationFormDTO |
|||
* @Author wangc |
|||
* @date 2020.04.01 15:32 |
|||
*/ |
|||
public class ResiTopicOperationFormDTO { |
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.epmet.resi.group.dto.topic.result; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiTopicDetailResultDTO |
|||
* @Author wangc |
|||
* @date 2020.04.01 16:03 |
|||
*/ |
|||
public class ResiTopicDetailResultDTO { |
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.epmet.modules.comment.controller; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiCommentController |
|||
* @Author wangc |
|||
* @date 2020.04.01 18:00 |
|||
*/ |
|||
public class ResiCommentController { |
|||
} |
@ -0,0 +1,97 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.invitation.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.modules.invitation.service.GroupInvitationService; |
|||
import com.epmet.resi.group.dto.invitation.form.AccetInvitationFormDTO; |
|||
import com.epmet.resi.group.dto.invitation.form.CreateGroupInvitationFormDTO; |
|||
import com.epmet.resi.group.dto.invitation.form.LinkGroupInfoFormDTO; |
|||
import com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO; |
|||
import com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
|
|||
/** |
|||
* 群邀请记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-31 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("invitation") |
|||
public class GroupInvitationController { |
|||
|
|||
@Autowired |
|||
private GroupInvitationService groupInvitationService; |
|||
|
|||
/** |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO> |
|||
* @Author yinzuomei |
|||
* @Description 生成邀请 |
|||
* @Date 2020/3/31 22:50 |
|||
**/ |
|||
@PostMapping("creategroupinvitation") |
|||
public Result<CreateGroupInvitationResultDTO> createGroupInvitation(@LoginUser TokenDto tokenDto, |
|||
@RequestBody CreateGroupInvitationFormDTO formDTO) { |
|||
formDTO.setUserId(tokenDto.getUserId()); |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return groupInvitationService.createGroupInvitation(formDTO); |
|||
} |
|||
|
|||
/** |
|||
* @param tokenDto |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @Author yinzuomei |
|||
* @Description 根据群邀请连接查询群基本信息 |
|||
* @Date 2020/3/31 23:11 |
|||
**/ |
|||
@PostMapping("getlinkgroupinfo") |
|||
public Result<LinkGroupInfoResultDTO> getLinkGroupInfo(@LoginUser TokenDto tokenDto, |
|||
@RequestBody LinkGroupInfoFormDTO formDTO) { |
|||
formDTO.setUserId(tokenDto.getUserId()); |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return groupInvitationService.getLinkGroupInfo(formDTO); |
|||
} |
|||
|
|||
/** |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @Author yinzuomei |
|||
* @Description 同意邀请进组 |
|||
* @Date 2020/3/31 23:47 |
|||
**/ |
|||
@PostMapping("acceptinvitation") |
|||
public Result accetInvitation(@LoginUser TokenDto tokenDto, |
|||
@RequestBody AccetInvitationFormDTO formDTO) { |
|||
formDTO.setUserId(tokenDto.getUserId()); |
|||
formDTO.setApp(tokenDto.getApp()); |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return groupInvitationService.accetInvitation(formDTO); |
|||
} |
|||
} |
@ -0,0 +1,44 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.invitation.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.modules.invitation.entity.GroupInvitationEntity; |
|||
import com.epmet.resi.group.dto.invitation.form.LinkGroupInfoFormDTO; |
|||
import com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* 群邀请记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-31 |
|||
*/ |
|||
@Mapper |
|||
public interface GroupInvitationDao extends BaseDao<GroupInvitationEntity> { |
|||
|
|||
/** |
|||
* @param groupId |
|||
* @return com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO |
|||
* @Author yinzuomei |
|||
* @Description 根据群邀请连接查询群基本信息 |
|||
* @Date 2020/3/31 23:22 |
|||
**/ |
|||
LinkGroupInfoResultDTO selectLinkGroupInfo(@Param("groupId") String groupId); |
|||
} |
@ -0,0 +1,128 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.invitation.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.modules.invitation.entity.GroupInvitationEntity; |
|||
import com.epmet.resi.group.dto.invitation.GroupInvitationDTO; |
|||
import com.epmet.resi.group.dto.invitation.form.AccetInvitationFormDTO; |
|||
import com.epmet.resi.group.dto.invitation.form.CreateGroupInvitationFormDTO; |
|||
import com.epmet.resi.group.dto.invitation.form.LinkGroupInfoFormDTO; |
|||
import com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO; |
|||
import com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 群邀请记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-31 |
|||
*/ |
|||
public interface GroupInvitationService extends BaseService<GroupInvitationEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<GroupInvitationDTO> |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
PageData<GroupInvitationDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<GroupInvitationDTO> |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
List<GroupInvitationDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return GroupInvitationDTO |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
GroupInvitationDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
void save(GroupInvitationDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
void update(GroupInvitationDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO> |
|||
* @param formDTO |
|||
* @Author yinzuomei |
|||
* @Description 生成邀请连接 |
|||
* @Date 2020/3/31 22:50 |
|||
**/ |
|||
Result<CreateGroupInvitationResultDTO> createGroupInvitation(CreateGroupInvitationFormDTO formDTO); |
|||
|
|||
/** |
|||
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO> |
|||
* @param formDTO |
|||
* @Author yinzuomei |
|||
* @Description 根据群邀请连接查询群基本信息 |
|||
* @Date 2020/3/31 23:20 |
|||
**/ |
|||
Result<LinkGroupInfoResultDTO> getLinkGroupInfo(LinkGroupInfoFormDTO formDTO); |
|||
|
|||
/** |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @param formDTO |
|||
* @Author yinzuomei |
|||
* @Description 同意邀请进组 |
|||
* @Date 2020/3/31 23:47 |
|||
**/ |
|||
Result accetInvitation(AccetInvitationFormDTO formDTO); |
|||
} |
@ -0,0 +1,252 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.invitation.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.modules.group.service.ResiGroupService; |
|||
import com.epmet.modules.invitation.dao.GroupInvitationDao; |
|||
import com.epmet.modules.invitation.entity.GroupInvitationEntity; |
|||
import com.epmet.modules.invitation.service.GroupInvitationService; |
|||
import com.epmet.modules.member.dao.ResiGroupMemberDao; |
|||
import com.epmet.modules.member.service.GroupMemeberOperationService; |
|||
import com.epmet.modules.member.service.ResiGroupMemberService; |
|||
import com.epmet.modules.utils.ModuleConstant; |
|||
import com.epmet.resi.group.constant.EnterGroupTypeConstant; |
|||
import com.epmet.resi.group.constant.GroupStateConstant; |
|||
import com.epmet.resi.group.constant.LeaderFlagConstant; |
|||
import com.epmet.resi.group.constant.MemberStateConstant; |
|||
import com.epmet.resi.group.dto.UserRoleDTO; |
|||
import com.epmet.resi.group.dto.group.ResiGroupDTO; |
|||
import com.epmet.resi.group.dto.invitation.GroupInvitationDTO; |
|||
import com.epmet.resi.group.dto.invitation.form.AccetInvitationFormDTO; |
|||
import com.epmet.resi.group.dto.invitation.form.CreateGroupInvitationFormDTO; |
|||
import com.epmet.resi.group.dto.invitation.form.LinkGroupInfoFormDTO; |
|||
import com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO; |
|||
import com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO; |
|||
import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; |
|||
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.*; |
|||
|
|||
/** |
|||
* 群邀请记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-31 |
|||
*/ |
|||
@Service |
|||
public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationDao, GroupInvitationEntity> implements GroupInvitationService { |
|||
|
|||
@Autowired |
|||
private ResiGroupMemberDao resiGroupMemberDao; |
|||
|
|||
@Autowired |
|||
private ResiGroupService resiGroupService; |
|||
|
|||
@Autowired |
|||
private ResiGroupMemberService resiGroupMemberService; |
|||
|
|||
@Autowired |
|||
private GroupMemeberOperationService groupMemeberOperationService; |
|||
|
|||
@Override |
|||
public PageData<GroupInvitationDTO> page(Map<String, Object> params) { |
|||
IPage<GroupInvitationEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, GroupInvitationDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<GroupInvitationDTO> list(Map<String, Object> params) { |
|||
List<GroupInvitationEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, GroupInvitationDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<GroupInvitationEntity> getWrapper(Map<String, Object> params) { |
|||
String id = (String) params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<GroupInvitationEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public GroupInvitationDTO get(String id) { |
|||
GroupInvitationEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, GroupInvitationDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(GroupInvitationDTO dto) { |
|||
GroupInvitationEntity entity = ConvertUtils.sourceToTarget(dto, GroupInvitationEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(GroupInvitationDTO dto) { |
|||
GroupInvitationEntity entity = ConvertUtils.sourceToTarget(dto, GroupInvitationEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO> |
|||
* @Author yinzuomei |
|||
* @Description 生成邀请连接 |
|||
* @Date 2020/3/31 22:50 |
|||
**/ |
|||
@Override |
|||
public Result<CreateGroupInvitationResultDTO> createGroupInvitation(CreateGroupInvitationFormDTO formDTO) { |
|||
//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、审核通过(讨论中)的群才可以分享邀请连接
|
|||
ResiGroupDTO resiGroupDTO = resiGroupService.get(formDTO.getGroupId()); |
|||
if(!GroupStateConstant.GROUP_APPROVED.equals(resiGroupDTO.getState())){ |
|||
return new Result<CreateGroupInvitationResultDTO>().error(ModuleConstant.CANNOT_SHARED); |
|||
} |
|||
//3、插入一条邀请记录
|
|||
GroupInvitationEntity groupInvitationEntity = new GroupInvitationEntity(); |
|||
groupInvitationEntity.setInviterUserId(formDTO.getUserId()); |
|||
groupInvitationEntity.setInviterCustomerId(resiGroupDTO.getCustomerId()); |
|||
groupInvitationEntity.setInviterGridId(resiGroupDTO.getGridId()); |
|||
//暂定7天有效期
|
|||
Calendar calendar = Calendar.getInstance(); |
|||
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + NumConstant.SEVEN); |
|||
groupInvitationEntity.setValidEndTime(calendar.getTime()); |
|||
insert(groupInvitationEntity); |
|||
CreateGroupInvitationResultDTO resultDTO = new CreateGroupInvitationResultDTO(); |
|||
resultDTO.setInvitationId(groupInvitationEntity.getId()); |
|||
return new Result<CreateGroupInvitationResultDTO>().ok(resultDTO); |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO> |
|||
* @Author yinzuomei |
|||
* @Description 根据群邀请连接查询群基本信息 |
|||
* @Date 2020/3/31 23:20 |
|||
**/ |
|||
@Override |
|||
public Result<LinkGroupInfoResultDTO> getLinkGroupInfo(LinkGroupInfoFormDTO formDTO) { |
|||
//校验是否存在该邀请连接
|
|||
Result<GroupInvitationDTO> validResult = this.checkLinkValid(formDTO.getInvitationId()); |
|||
if(!validResult.success()){ |
|||
return new Result<LinkGroupInfoResultDTO>().error(validResult.getCode(),validResult.getMsg()); |
|||
} |
|||
LinkGroupInfoResultDTO linkGroupInfoResultDTO = baseDao.selectLinkGroupInfo(validResult.getData().getResiGroupId()); |
|||
return new Result<LinkGroupInfoResultDTO>().ok(linkGroupInfoResultDTO); |
|||
} |
|||
|
|||
private Result<GroupInvitationDTO> checkLinkValid(String invitationId){ |
|||
//校验是否存在该邀请连接
|
|||
GroupInvitationDTO groupInvitationDTO = this.get(invitationId); |
|||
//Date1.after(Date2),当Date1大于Date2时,返回TRUE,当小于等于时,返回false;
|
|||
if (null == groupInvitationDTO) { |
|||
return new Result<GroupInvitationDTO>().error(EpmetErrorCode.LOSE_EFFICACY.getValue(),EpmetErrorCode.LOSE_EFFICACY.getName()); |
|||
} |
|||
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>().ok(groupInvitationDTO); |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @Author yinzuomei |
|||
* @Description 同意邀请进组 |
|||
* @Date 2020/3/31 23:47 |
|||
**/ |
|||
@Override |
|||
public Result accetInvitation(AccetInvitationFormDTO formDTO) { |
|||
//1、申请是否有效
|
|||
Result<GroupInvitationDTO> validResult = this.checkLinkValid(formDTO.getInvitationId()); |
|||
if(!validResult.success()){ |
|||
return new Result<LinkGroupInfoResultDTO>().error(validResult.getCode(),validResult.getMsg()); |
|||
} |
|||
//2、校验是否已经注册居民
|
|||
ResiGroupDTO resiGroupDTO = resiGroupService.get(validResult.getData().getResiGroupId()); |
|||
if (null != resiGroupDTO) { |
|||
UserRoleDTO userRoleDTO = resiGroupService.checkPartyMemberOrWarmHeated(formDTO.getApp(), |
|||
formDTO.getUserId(), |
|||
resiGroupDTO.getCustomerId()); |
|||
if (NumConstant.ZERO_STR.equals(userRoleDTO.getRegisteredResiFlag())) { |
|||
return new Result().error(EpmetErrorCode.CANNOT_JOIN_GROUP.getValue(),EpmetErrorCode.CANNOT_JOIN_GROUP.getName()); |
|||
} |
|||
} |
|||
//3、新增一条邀请入群、直接审核通过的入群记录
|
|||
GroupMemeberOperationDTO groupMemeberOperation = new GroupMemeberOperationDTO(); |
|||
groupMemeberOperation.setGroupId(resiGroupDTO.getId()); |
|||
groupMemeberOperation.setCustomerUserId(formDTO.getUserId()); |
|||
groupMemeberOperation.setGroupId(resiGroupDTO.getId()); |
|||
groupMemeberOperation.setOperateStatus(MemberStateConstant.APPROVED); |
|||
groupMemeberOperation.setEnterGroupType(EnterGroupTypeConstant.INVITED); |
|||
groupMemeberOperation.setCreatedBy(formDTO.getUserId()); |
|||
groupMemeberOperation.setOperateUserId(formDTO.getUserId()); |
|||
groupMemeberOperationService.save(groupMemeberOperation); |
|||
//4、直接加入群成员关系表
|
|||
ResiGroupMemberDTO resiGroupMemberDTO = new ResiGroupMemberDTO(); |
|||
resiGroupMemberDTO.setCustomerUserId(groupMemeberOperation.getCustomerUserId()); |
|||
resiGroupMemberDTO.setResiGroupId(groupMemeberOperation.getGroupId()); |
|||
resiGroupMemberDTO.setGroupLeaderFlag(LeaderFlagConstant.GROUP_MEMBER); |
|||
resiGroupMemberDTO.setEnterGroupType(groupMemeberOperation.getEnterGroupType()); |
|||
resiGroupMemberDTO.setStatus(MemberStateConstant.APPROVED); |
|||
resiGroupMemberDTO.setCreatedBy(groupMemeberOperation.getCustomerUserId()); |
|||
resiGroupMemberService.save(resiGroupMemberDTO); |
|||
//5、修改群统计值
|
|||
UserRoleDTO userRoleDTO = resiGroupService.checkPartyMemberOrWarmHeated(formDTO.getApp(), |
|||
formDTO.getUserId(), |
|||
resiGroupDTO.getCustomerId()); |
|||
resiGroupMemberDao.updateResiGroupStatistical(groupMemeberOperation.getGroupId(), userRoleDTO); |
|||
//6、发送消息 TODO
|
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.modules.invitation.dao.GroupInvitationDao"> |
|||
|
|||
<!-- 根据群邀请连接查询群基本信息 -根据groupId 查询群基本信息 --> |
|||
<select id="selectLinkGroupInfo" parameterType="map" resultType="com.epmet.resi.group.dto.invitation.result.LinkGroupInfoResultDTO"> |
|||
SELECT |
|||
rg.id AS groupId, |
|||
rg.GROUP_HEAD_PHOTO AS groupHeadPhoto, |
|||
rg.GROUP_NAME AS groupName, |
|||
rg.GROUP_INTRODUCTION AS groupIntroduction, |
|||
rgs.TOTAL_MEMBERS AS totalMember, |
|||
rgs.TOTAL_PARTY_MEMBERS AS totalPartyMember |
|||
FROM |
|||
resi_group rg |
|||
LEFT JOIN resi_group_statistical rgs ON ( rg.id = rgs.RESI_GROUP_ID ) |
|||
WHERE |
|||
rg.DEL_FLAG = '0' |
|||
AND rgs.DEL_FLAG = '0' |
|||
and rg.id=#{groupId} |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,65 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.resi.partymember.dto.warmhearted.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 居民端-热心居民申请-提交申请数据-配置入参 |
|||
* @author sun |
|||
*/ |
|||
@Data |
|||
public class ResiWarmheartedSubmitFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户Id CUSTOMER.id |
|||
*/ |
|||
@NotBlank(message = "客户ID不能为空") |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 网格Id |
|||
*/ |
|||
@NotBlank(message = "网格ID不能为空") |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 热心居民申请行为记录表Id |
|||
*/ |
|||
@NotBlank(message = "行为记录表ID不能为空") |
|||
private String resiWarmVisitId; |
|||
|
|||
/** |
|||
* 申请理由(300字) |
|||
*/ |
|||
@NotBlank(message = "申请理由不能为空") |
|||
private String reason; |
|||
|
|||
/** |
|||
* 用户Id |
|||
*/ |
|||
@NotBlank(message = "用户ID不能为空") |
|||
private String userId; |
|||
|
|||
} |
Loading…
Reference in new issue