65 changed files with 2174 additions and 80 deletions
@ -0,0 +1,21 @@ |
|||
package com.epmet.dataaggre.dto.epmetuser.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/3/30 上午11:04 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class UserInfosResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 7129564173128153335L; |
|||
|
|||
private String userId; |
|||
private String userShowName; |
|||
private String headPhoto; |
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.epmet.dataaggre.dto.resigroup.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/3/30 上午9:34 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class CandidateListFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 6184071611057671961L; |
|||
|
|||
public interface CandidateListForm{} |
|||
|
|||
/** |
|||
* 小组ID |
|||
*/ |
|||
@NotBlank(message = "小组ID不能为空",groups = CandidateListForm.class) |
|||
private String groupId; |
|||
|
|||
@NotNull(message = "pageNo不能为空",groups = CandidateListForm.class) |
|||
private Integer pageNo; |
|||
|
|||
@NotNull(message = "pageSize不能为空",groups = CandidateListForm.class) |
|||
private Integer pageSize; |
|||
|
|||
private String customerId; |
|||
|
|||
} |
@ -0,0 +1,57 @@ |
|||
package com.epmet.dataaggre.dto.resigroup.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/3/30 上午9:15 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class CandidateListResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4720936429310456924L; |
|||
|
|||
/** |
|||
* resi_group_member.id: 成员id |
|||
*/ |
|||
private String memberId; |
|||
|
|||
/** |
|||
* 组员的用户id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 成员头像 |
|||
*/ |
|||
private String headPhoto; |
|||
|
|||
/** |
|||
* 成员的显示名称 |
|||
*/ |
|||
private String userShowName; |
|||
|
|||
/** |
|||
* 徽章Url集合 |
|||
*/ |
|||
private String leaderFlag; |
|||
|
|||
/** |
|||
* leader群主,member成员 |
|||
*/ |
|||
private List<String> badgeList; |
|||
|
|||
public CandidateListResultDTO() { |
|||
this.memberId = ""; |
|||
this.userId = ""; |
|||
this.headPhoto = ""; |
|||
this.userShowName = ""; |
|||
this.leaderFlag = ""; |
|||
this.badgeList = new ArrayList<>(); |
|||
} |
|||
} |
@ -0,0 +1,47 @@ |
|||
package com.epmet.dataaggre.redis; |
|||
|
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import com.epmet.dataaggre.constant.GroupConstant; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/3/30 下午1:39 |
|||
* @DESC |
|||
*/ |
|||
@Component |
|||
@Slf4j |
|||
public class ResiGroupRedis { |
|||
|
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
/** |
|||
* @Description 获取用户徽章 |
|||
* @Param customerId |
|||
* @Param userId |
|||
* @author zxc |
|||
* @date 2021/3/30 下午3:33 |
|||
*/ |
|||
public List<String> getBadgeInfoByUserId(String customerId,String userId){ |
|||
String key = GroupConstant.BADGE_KEY+customerId+":"+userId; |
|||
List<Object> result = redisUtils.getListLrange(key); |
|||
if (!CollectionUtils.isEmpty(result)){ |
|||
List<String> icons = new ArrayList<>(); |
|||
for (Object o : result) { |
|||
Map<String,String> map = (Map<String, String>) o; |
|||
icons.add(map.get(GroupConstant.BADGE_ICON)); |
|||
} |
|||
return icons; |
|||
} |
|||
return new ArrayList<>(); |
|||
} |
|||
|
|||
} |
@ -1,8 +1,29 @@ |
|||
package com.epmet.dataaggre.service.epmetuser; |
|||
|
|||
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/12/25 上午9:20 |
|||
*/ |
|||
public interface EpmetUserService { |
|||
|
|||
/** |
|||
* @Description 根据UserIds查询 |
|||
* @Param userIds |
|||
* @author zxc |
|||
* @date 2021/3/30 上午11:07 |
|||
*/ |
|||
List<UserInfosResultDTO> selectUserInfosByUserIds(List<String> userIds); |
|||
|
|||
/** |
|||
* @Description 查询是党员/热心居民的userId |
|||
* @Param userIds |
|||
* @author zxc |
|||
* @date 2021/4/1 上午9:08 |
|||
*/ |
|||
List<String> selectUserIdByCustomerId(List<String> userIds); |
|||
|
|||
} |
|||
|
@ -0,0 +1,43 @@ |
|||
package com.epmet.resi.group.dto.group.form; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author sun |
|||
* @Description 删除组员-接口入参 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class ExitGroupFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 9033824126731443502L; |
|||
/** |
|||
* 屏蔽突然的话题及评论,勾选:yes;不勾选:no |
|||
*/ |
|||
@NotBlank(message = "是否屏蔽话题及评论不能为空") |
|||
private String shieldFlag; |
|||
/** |
|||
* 组成员用户id |
|||
*/ |
|||
@NotBlank(message = "被删除用户Id不能为空") |
|||
private String userId; |
|||
/** |
|||
* 小组ID |
|||
*/ |
|||
@NotBlank(message = "小组Id不能为空") |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* OPERATE_USER_ID操作人id |
|||
*/ |
|||
private String operateUserId; |
|||
} |
@ -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.resi.group.dto.member; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 退群记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-29 |
|||
*/ |
|||
@Data |
|||
public class ExitGroupRecordDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 小组id |
|||
*/ |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 组成员用户id |
|||
*/ |
|||
private String memberUserId; |
|||
|
|||
/** |
|||
* 屏蔽他的话题及评论 yes:屏蔽 no:不屏蔽 |
|||
*/ |
|||
private String shieldFlag; |
|||
|
|||
/** |
|||
* 0:组长移除; |
|||
*/ |
|||
private String leaveType; |
|||
|
|||
/** |
|||
* 删除标识 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 当前操作人id |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -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.resi.group.dto.member; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 组长身份转让记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-29 |
|||
*/ |
|||
@Data |
|||
public class GroupLeaderTransferRecordDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 小组id |
|||
*/ |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 原组长userId |
|||
*/ |
|||
private String originalLeader; |
|||
|
|||
/** |
|||
* 新组长userId |
|||
*/ |
|||
private String newLeader; |
|||
|
|||
/** |
|||
* 组长自主转让resi,工作人员转让gov |
|||
*/ |
|||
private String type; |
|||
|
|||
/** |
|||
* 删除标识 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 当前操作人id即组长id |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.epmet.resi.group.dto.member.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 确认转让组-(工作端通用)入参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/3/30 10:06 |
|||
*/ |
|||
@Data |
|||
public class ConfirmTransferFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -6087185953287544147L; |
|||
|
|||
@NotBlank(message = "小组id不能为空") |
|||
private String groupId; |
|||
|
|||
@NotBlank(message = "新组长用户id不能为空") |
|||
private String newLeaderUserId; |
|||
|
|||
@NotBlank(message = "type不能为空:自主转让resi,工作人员转让gov") |
|||
private String type; |
|||
|
|||
/**************************以上是需要前端传入的参数*******************************************************/ |
|||
@NotBlank(message = "tokenDto中获取customerId为空") |
|||
private String customerId; |
|||
@NotBlank(message = "tokenDto中获取userId为空") |
|||
private String currentUserId; |
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.epmet.modules.group.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
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.group.service.ExitGroupService; |
|||
import com.epmet.resi.group.dto.group.form.ExitGroupFormDTO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
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 sun |
|||
* @dscription |
|||
*/ |
|||
@Slf4j |
|||
@RestController |
|||
@RequestMapping("exitgroup") |
|||
public class ExitGroupController { |
|||
@Autowired |
|||
private ExitGroupService exitGroupService; |
|||
|
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @Description 删除组员 |
|||
* @author sun |
|||
* 如果shieldFlag=yes, 则将讨论中的话题并且不存在正在审核的议题申请的置为已屏蔽 |
|||
* 不要忘了插入:exit_group_record |
|||
*/ |
|||
@PostMapping("removemember") |
|||
public Result removeMember(@LoginUser TokenDto tokenDto, @RequestBody ExitGroupFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
if(!"yes".equals(formDTO.getShieldFlag())&&!"no".equals(formDTO.getShieldFlag())){ |
|||
throw new RenException("参数错误,是否屏蔽历史话题参数值错误"); |
|||
} |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
formDTO.setOperateUserId(tokenDto.getUserId()); |
|||
exitGroupService.removeMember(formDTO); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.modules.group.service; |
|||
|
|||
import com.epmet.resi.group.dto.group.form.ExitGroupFormDTO; |
|||
|
|||
/** |
|||
* @author sun |
|||
* @dscription |
|||
*/ |
|||
public interface ExitGroupService { |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @Description 删除组员 |
|||
* @author sun |
|||
*/ |
|||
void removeMember(ExitGroupFormDTO formDTO); |
|||
|
|||
} |
@ -0,0 +1,197 @@ |
|||
package com.epmet.modules.group.service.impl; |
|||
|
|||
import com.epmet.commons.tools.constant.AppClientConstant; |
|||
import com.epmet.commons.tools.constant.Constant; |
|||
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.UserRoleFormDTO; |
|||
import com.epmet.dto.result.UserRoleResultDTO; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.feign.GovIssueOpenFeignClient; |
|||
import com.epmet.modules.constant.GroupMemberConstant; |
|||
import com.epmet.modules.group.dao.ResiGroupDao; |
|||
import com.epmet.modules.group.dao.ResiGroupStatisticalDao; |
|||
import com.epmet.modules.group.entity.ResiGroupEntity; |
|||
import com.epmet.modules.group.entity.ResiGroupStatisticalEntity; |
|||
import com.epmet.modules.group.redis.ResiGroupRedis; |
|||
import com.epmet.modules.group.service.ExitGroupService; |
|||
import com.epmet.modules.member.dao.ExitGroupRecordDao; |
|||
import com.epmet.modules.member.dao.GroupMemeberOperationDao; |
|||
import com.epmet.modules.member.dao.ResiGroupMemberDao; |
|||
import com.epmet.modules.member.entity.ExitGroupRecordEntity; |
|||
import com.epmet.modules.topic.dao.ResiTopicCommentDao; |
|||
import com.epmet.modules.topic.dao.ResiTopicDao; |
|||
import com.epmet.modules.topic.entity.ResiTopicOperationEntity; |
|||
import com.epmet.modules.topic.service.ResiTopicOperationService; |
|||
import com.epmet.resi.group.constant.TopicConstant; |
|||
import com.epmet.resi.group.dto.group.form.ExitGroupFormDTO; |
|||
import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author sun |
|||
* @dscription |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class ExitGroupServiceImpl implements ExitGroupService { |
|||
|
|||
@Autowired |
|||
private ResiGroupMemberDao resiGroupMemberDao; |
|||
@Autowired |
|||
private GroupMemeberOperationDao groupMemeberOperationDao; |
|||
@Autowired |
|||
private ExitGroupRecordDao exitGroupRecordDao; |
|||
@Autowired |
|||
private ResiTopicDao resiTopicDao; |
|||
@Autowired |
|||
private GovIssueOpenFeignClient govIssueOpenFeignClient; |
|||
@Autowired |
|||
private ResiTopicCommentDao resiTopicCommentDao; |
|||
@Autowired |
|||
private ResiTopicOperationService resiTopicOperationService; |
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
@Autowired |
|||
private ResiGroupStatisticalDao resiGroupStatisticalDao; |
|||
@Autowired |
|||
private ResiGroupRedis resiGroupRedis; |
|||
@Autowired |
|||
private ResiGroupDao resiGroupDao; |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @Description 删除组员 |
|||
* @author sun |
|||
*/ |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void removeMember(ExitGroupFormDTO formDTO) { |
|||
//0.组长自己不能删除自己
|
|||
if(formDTO.getUserId().equals(formDTO.getOperateUserId())){ |
|||
throw new RenException("群组长不能删除自己"); |
|||
} |
|||
|
|||
//1.校验被删除人员是否是当前小组内成员
|
|||
int num = resiGroupMemberDao.checkUserInGroup(formDTO.getUserId(), formDTO.getGroupId()); |
|||
if (num < NumConstant.ONE) { |
|||
throw new RenException("当前待删除人员不是本小组成员"); |
|||
} |
|||
|
|||
//2.判断是否屏蔽本小组内历史话题
|
|||
List<String> delIdList = new ArrayList<>(); |
|||
if (Constant.YES.equals(formDTO.getShieldFlag())) { |
|||
//2-1.查询当前被删除人员发表过的话题还未成为议题的并且只是谈论中的数据
|
|||
List<String> topicIdList = resiTopicDao.selectIdList(formDTO.getGroupId(), formDTO.getUserId()); |
|||
//2-2.查询当前未成为议题的话题但是提交了转议题申请的话题
|
|||
if (!CollectionUtils.isEmpty(topicIdList)) { |
|||
Result<List<String>> listResult = govIssueOpenFeignClient.notIssueToTopicIds(topicIdList); |
|||
if (!listResult.success()) { |
|||
throw new RenException(listResult.getInternalMsg()); |
|||
} |
|||
//获取只是单纯的话题既没有被转成议题又不存在转议题申请待审核数据
|
|||
delIdList = topicIdList.stream().filter(o -> !listResult.getData().contains(o)).collect(Collectors.toList()); |
|||
} |
|||
//2-3.屏蔽这些单纯的话题
|
|||
if (delIdList.size() > NumConstant.ZERO) { |
|||
resiTopicDao.upTopicList(delIdList, formDTO.getOperateUserId()); |
|||
//2-4.话题操作日志表批量新增记录
|
|||
List<ResiTopicOperationEntity> list = new ArrayList<>(); |
|||
delIdList.forEach(d->{ |
|||
ResiTopicOperationEntity entity = new ResiTopicOperationEntity(); |
|||
entity.setOperationType(TopicConstant.HIDDEN); |
|||
entity.setOperationReason(GroupMemberConstant.DELETE_MEMBER_REASON); |
|||
entity.setTopicId(d); |
|||
list.add(entity); |
|||
}); |
|||
resiTopicOperationService.insertBatch(list); |
|||
} |
|||
} |
|||
//去重
|
|||
if(delIdList.size()>NumConstant.ZERO){ |
|||
delIdList = delIdList.stream().distinct().collect(Collectors.toList()); |
|||
} |
|||
int count = delIdList.size(); |
|||
|
|||
//3.判断是否屏蔽本小组内历史评论
|
|||
if (Constant.YES.equals(formDTO.getShieldFlag())) { |
|||
//3-1.查询别人的话题但自己评论过的话题Id
|
|||
List<String> commetTopicList = resiTopicCommentDao.selectTopicIds(formDTO.getGroupId(), formDTO.getUserId()); |
|||
delIdList.addAll(commetTopicList); |
|||
//3-2.本小组内屏蔽自己创建的话题发表过的评论以及别人发表的话题自己评论过的评论
|
|||
if (delIdList.size() > NumConstant.ZERO) { |
|||
resiTopicCommentDao.upTopicCommentList(delIdList, formDTO.getUserId(), formDTO.getOperateUserId()); |
|||
} |
|||
} |
|||
|
|||
//4.修改组成员出入群记录表数据状态、删除组成员关系表数据、新增退群记录表数据
|
|||
//4-1.修改组成员出入群记录表数据状态
|
|||
GroupMemeberOperationDTO operationDTO = new GroupMemeberOperationDTO(); |
|||
operationDTO.setGroupId(formDTO.getGroupId()); |
|||
operationDTO.setCustomerUserId(formDTO.getUserId()); |
|||
operationDTO.setOperateUserId(formDTO.getOperateUserId()); |
|||
if (groupMemeberOperationDao.upByGroupAndUserId(operationDTO) < NumConstant.ONE) { |
|||
throw new RenException(String.format("修改组成员出入群记录表数据失败,小组Id【%s】被修改人Id【%s】", formDTO.getGroupId(), formDTO.getUserId())); |
|||
} |
|||
//4-2.删除组成员关系表数据并修改状态
|
|||
if (resiGroupMemberDao.delByGroupAndUserId(formDTO.getGroupId(), formDTO.getUserId()) < NumConstant.ONE) { |
|||
throw new RenException(String.format("删除组成员关系表数据操作失败,小组Id【%s】被修改人Id【%s】", formDTO.getGroupId(), formDTO.getUserId())); |
|||
} |
|||
//4-3.新增退群记录表数据
|
|||
ExitGroupRecordEntity entity = new ExitGroupRecordEntity(); |
|||
entity.setCustomerId(formDTO.getCustomerId()); |
|||
entity.setGroupId(formDTO.getGroupId()); |
|||
entity.setMemberUserId(formDTO.getUserId()); |
|||
entity.setShieldFlag(formDTO.getShieldFlag()); |
|||
entity.setLeaveType(NumConstant.ZERO_STR); |
|||
if (exitGroupRecordDao.insert(entity) < NumConstant.ONE) { |
|||
throw new RenException(String.format("新增退群记录表数据操作失败,小组Id【%s】被修改人Id【%s】", formDTO.getGroupId(), formDTO.getUserId())); |
|||
} |
|||
|
|||
//5.群组统计表修改数据
|
|||
//5-1.获取被删人员当前网格居民端角色信息
|
|||
ResiGroupEntity groupEntity = resiGroupDao.selectById(formDTO.getGroupId()); |
|||
UserRoleFormDTO dto = new UserRoleFormDTO(); |
|||
dto.setApp(AppClientConstant.APP_RESI); |
|||
dto.setUserId(formDTO.getUserId()); |
|||
dto.setCustomerId(formDTO.getCustomerId()); |
|||
dto.setGridId(groupEntity.getGridId()); |
|||
Result<List<UserRoleResultDTO>> resultUser = epmetUserOpenFeignClient.getUserRoleInfo(dto); |
|||
if (!resultUser.success()) { |
|||
throw new RenException(resultUser.getInternalMsg()); |
|||
} |
|||
List<UserRoleResultDTO> roleList = resultUser.getData(); |
|||
//5-2.群组统计表数据修改,缓存数据修改
|
|||
ResiGroupStatisticalEntity statisticalEntity = resiGroupStatisticalDao.selectByResiGroupId(formDTO.getGroupId()); |
|||
if (null == statisticalEntity) { |
|||
throw new RenException("未查询到群组统计数据,删除失败"); |
|||
} |
|||
statisticalEntity.setTotalMembers(statisticalEntity.getTotalMembers() - 1); |
|||
statisticalEntity.setTotalTopics(statisticalEntity.getTotalTopics()-count); |
|||
statisticalEntity.setTotalNormalMemebers(statisticalEntity.getTotalNormalMemebers() - 1); |
|||
roleList.forEach(r -> { |
|||
if (EpmetRoleKeyConstant.PARTYMEMBER.equals(r.getRoleKey())) {//党员总数减一
|
|||
statisticalEntity.setTotalPartyMembers(statisticalEntity.getTotalPartyMembers() - 1); |
|||
} |
|||
if (EpmetRoleKeyConstant.WARMHEARTED.equals(r.getRoleKey())) {//热心居民总数减一
|
|||
statisticalEntity.setTotalEarnestMemebers(statisticalEntity.getTotalEarnestMemebers() - 1); |
|||
} |
|||
}); |
|||
resiGroupStatisticalDao.updateById(statisticalEntity); |
|||
resiGroupRedis.delGroup(formDTO.getGroupId()); |
|||
resiGroupRedis.get(formDTO.getGroupId()); |
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
/** |
|||
* 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.member.controller; |
|||
|
|||
import com.epmet.modules.member.service.ExitGroupRecordService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
|
|||
/** |
|||
* 退群记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-29 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("exitgroup") |
|||
public class ExitGroupRecordController { |
|||
|
|||
@Autowired |
|||
private ExitGroupRecordService exitGroupRecordService; |
|||
|
|||
|
|||
} |
@ -0,0 +1,61 @@ |
|||
/** |
|||
* 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.member.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.member.service.GroupLeaderTransferRecordService; |
|||
import com.epmet.resi.group.dto.member.form.ConfirmTransferFormDTO; |
|||
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 2021-03-29 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("leadertransfer") |
|||
public class GroupLeaderTransferRecordController { |
|||
|
|||
@Autowired |
|||
private GroupLeaderTransferRecordService groupLeaderTransferRecordService; |
|||
|
|||
/** |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @param formDTO |
|||
* @author yinzuomei |
|||
* @description 确认转让组-(工作端通用) NEI:https://nei.netease.com/interface/detail/?pid=52286&id=355049
|
|||
* @Date 2021/3/30 10:08 |
|||
**/ |
|||
@PostMapping("confirmtransfer") |
|||
public Result confirmTransfer(@LoginUser TokenDto tokenDto, @RequestBody ConfirmTransferFormDTO formDTO){ |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
formDTO.setCurrentUserId(tokenDto.getUserId()); |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
groupLeaderTransferRecordService.confirmTransfer(formDTO); |
|||
return new Result(); |
|||
} |
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* 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.member.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.modules.member.entity.ExitGroupRecordEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 退群记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-29 |
|||
*/ |
|||
@Mapper |
|||
public interface ExitGroupRecordDao extends BaseDao<ExitGroupRecordEntity> { |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* 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.member.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.modules.member.entity.GroupLeaderTransferRecordEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 组长身份转让记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-29 |
|||
*/ |
|||
@Mapper |
|||
public interface GroupLeaderTransferRecordDao extends BaseDao<GroupLeaderTransferRecordEntity> { |
|||
|
|||
} |
@ -0,0 +1,63 @@ |
|||
/** |
|||
* 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.member.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 退群记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-29 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("exit_group_record") |
|||
public class ExitGroupRecordEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 小组id |
|||
*/ |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 组成员用户id |
|||
*/ |
|||
private String memberUserId; |
|||
|
|||
/** |
|||
* 屏蔽他的话题及评论 yes:屏蔽 no:不屏蔽 |
|||
*/ |
|||
private String shieldFlag; |
|||
|
|||
/** |
|||
* 0:组长移除; |
|||
*/ |
|||
private String leaveType; |
|||
|
|||
} |
@ -0,0 +1,63 @@ |
|||
/** |
|||
* 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.member.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 组长身份转让记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-29 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("group_leader_transfer_record") |
|||
public class GroupLeaderTransferRecordEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 小组id |
|||
*/ |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 原组长userId |
|||
*/ |
|||
private String originalLeader; |
|||
|
|||
/** |
|||
* 新组长userId |
|||
*/ |
|||
private String newLeader; |
|||
|
|||
/** |
|||
* 组长自主转让resi,工作人员转让gov |
|||
*/ |
|||
private String type; |
|||
|
|||
} |
@ -0,0 +1,95 @@ |
|||
/** |
|||
* 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.member.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.modules.member.entity.ExitGroupRecordEntity; |
|||
import com.epmet.resi.group.dto.member.ExitGroupRecordDTO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 退群记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-29 |
|||
*/ |
|||
public interface ExitGroupRecordService extends BaseService<ExitGroupRecordEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<ExitGroupRecordDTO> |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
PageData<ExitGroupRecordDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<ExitGroupRecordDTO> |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
List<ExitGroupRecordDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return ExitGroupRecordDTO |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
ExitGroupRecordDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
void save(ExitGroupRecordDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
void update(ExitGroupRecordDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,105 @@ |
|||
/** |
|||
* 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.member.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.modules.member.entity.GroupLeaderTransferRecordEntity; |
|||
import com.epmet.resi.group.dto.member.GroupLeaderTransferRecordDTO; |
|||
import com.epmet.resi.group.dto.member.form.ConfirmTransferFormDTO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 组长身份转让记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-29 |
|||
*/ |
|||
public interface GroupLeaderTransferRecordService extends BaseService<GroupLeaderTransferRecordEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<GroupLeaderTransferRecordDTO> |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
PageData<GroupLeaderTransferRecordDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<GroupLeaderTransferRecordDTO> |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
List<GroupLeaderTransferRecordDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return GroupLeaderTransferRecordDTO |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
GroupLeaderTransferRecordDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
void save(GroupLeaderTransferRecordDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
void update(GroupLeaderTransferRecordDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-03-29 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* @return void |
|||
* @param formDTO |
|||
* @author yinzuomei |
|||
* @description 确认转让组-(工作端通用) |
|||
* @Date 2021/3/30 10:11 |
|||
**/ |
|||
void confirmTransfer(ConfirmTransferFormDTO formDTO); |
|||
} |
@ -0,0 +1,99 @@ |
|||
/** |
|||
* 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.member.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.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.modules.member.dao.ExitGroupRecordDao; |
|||
import com.epmet.modules.member.entity.ExitGroupRecordEntity; |
|||
import com.epmet.modules.member.service.ExitGroupRecordService; |
|||
import com.epmet.resi.group.dto.member.ExitGroupRecordDTO; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 退群记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-29 |
|||
*/ |
|||
@Service |
|||
public class ExitGroupRecordServiceImpl extends BaseServiceImpl<ExitGroupRecordDao, ExitGroupRecordEntity> implements ExitGroupRecordService { |
|||
|
|||
@Override |
|||
public PageData<ExitGroupRecordDTO> page(Map<String, Object> params) { |
|||
IPage<ExitGroupRecordEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, ExitGroupRecordDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<ExitGroupRecordDTO> list(Map<String, Object> params) { |
|||
List<ExitGroupRecordEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, ExitGroupRecordDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<ExitGroupRecordEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<ExitGroupRecordEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public ExitGroupRecordDTO get(String id) { |
|||
ExitGroupRecordEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, ExitGroupRecordDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(ExitGroupRecordDTO dto) { |
|||
ExitGroupRecordEntity entity = ConvertUtils.sourceToTarget(dto, ExitGroupRecordEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(ExitGroupRecordDTO dto) { |
|||
ExitGroupRecordEntity entity = ConvertUtils.sourceToTarget(dto, ExitGroupRecordEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,226 @@ |
|||
/** |
|||
* 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.member.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.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.dto.form.UserMessageFormDTO; |
|||
import com.epmet.feign.EpmetMessageOpenFeignClient; |
|||
import com.epmet.modules.constant.UserMessageConstant; |
|||
import com.epmet.modules.group.service.ResiGroupService; |
|||
import com.epmet.modules.member.dao.GroupLeaderTransferRecordDao; |
|||
import com.epmet.modules.member.entity.GroupLeaderTransferRecordEntity; |
|||
import com.epmet.modules.member.redis.ResiGroupMemberRedis; |
|||
import com.epmet.modules.member.service.GroupLeaderTransferRecordService; |
|||
import com.epmet.modules.member.service.ResiGroupMemberService; |
|||
import com.epmet.modules.utils.ModuleConstant; |
|||
import com.epmet.resi.group.constant.LeaderFlagConstant; |
|||
import com.epmet.resi.group.dto.group.ResiGroupDTO; |
|||
import com.epmet.resi.group.dto.member.GroupLeaderTransferRecordDTO; |
|||
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; |
|||
import com.epmet.resi.group.dto.member.form.ConfirmTransferFormDTO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
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.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 组长身份转让记录表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-29 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class GroupLeaderTransferRecordServiceImpl extends BaseServiceImpl<GroupLeaderTransferRecordDao, GroupLeaderTransferRecordEntity> implements GroupLeaderTransferRecordService { |
|||
@Autowired |
|||
private ResiGroupMemberService resiGroupMemberService; |
|||
@Autowired |
|||
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|||
@Autowired |
|||
private ResiGroupService resiGroupService; |
|||
@Autowired |
|||
private ResiGroupMemberRedis resiGroupMemberRedis; |
|||
|
|||
@Override |
|||
public PageData<GroupLeaderTransferRecordDTO> page(Map<String, Object> params) { |
|||
IPage<GroupLeaderTransferRecordEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, GroupLeaderTransferRecordDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<GroupLeaderTransferRecordDTO> list(Map<String, Object> params) { |
|||
List<GroupLeaderTransferRecordEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, GroupLeaderTransferRecordDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<GroupLeaderTransferRecordEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<GroupLeaderTransferRecordEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public GroupLeaderTransferRecordDTO get(String id) { |
|||
GroupLeaderTransferRecordEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, GroupLeaderTransferRecordDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(GroupLeaderTransferRecordDTO dto) { |
|||
GroupLeaderTransferRecordEntity entity = ConvertUtils.sourceToTarget(dto, GroupLeaderTransferRecordEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(GroupLeaderTransferRecordDTO dto) { |
|||
GroupLeaderTransferRecordEntity entity = ConvertUtils.sourceToTarget(dto, GroupLeaderTransferRecordEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return void |
|||
* @author yinzuomei |
|||
* @description 确认转让组-(工作端通用) |
|||
* @Date 2021/3/30 10:11 |
|||
**/ |
|||
@Transactional(rollbackFor = Exception.class) |
|||
@Override |
|||
public void confirmTransfer(ConfirmTransferFormDTO formDTO) { |
|||
//原组长
|
|||
ResiGroupMemberDTO originalLeader = resiGroupMemberService.getGroupLeader(formDTO.getGroupId()); |
|||
if(formDTO.getNewLeaderUserId().equals(originalLeader.getCustomerUserId())){ |
|||
log.warn("候选人已经是组长"); |
|||
return; |
|||
} |
|||
//如果是居民端转让组,只能是当前组长操作
|
|||
if (ModuleConstant.APP_RESI.equals(formDTO.getType())) { |
|||
//当前用户如果不是组长,不允许提交
|
|||
if (!originalLeader.getCustomerUserId().equals(formDTO.getCurrentUserId())) { |
|||
//只有组长才可以操作
|
|||
throw new RenException(EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getCode(),EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getMsg()); |
|||
} |
|||
} |
|||
originalLeader.setGroupLeaderFlag(LeaderFlagConstant.GROUP_MEMBER); |
|||
resiGroupMemberService.update(originalLeader); |
|||
|
|||
//新组长赋值为组员
|
|||
ResiGroupMemberDTO newLeader=resiGroupMemberService.getResiGroupMember(formDTO.getGroupId(),formDTO.getNewLeaderUserId()); |
|||
newLeader.setGroupLeaderFlag(LeaderFlagConstant.GROUP_LEADER); |
|||
resiGroupMemberService.update(newLeader); |
|||
|
|||
//插入日志表
|
|||
GroupLeaderTransferRecordEntity entity = new GroupLeaderTransferRecordEntity(); |
|||
entity.setCustomerId(formDTO.getCustomerId()); |
|||
entity.setGroupId(formDTO.getGroupId()); |
|||
//原组长userId
|
|||
entity.setOriginalLeader(originalLeader.getCustomerUserId()); |
|||
entity.setNewLeader(formDTO.getNewLeaderUserId()); |
|||
entity.setType(formDTO.getType()); |
|||
insert(entity); |
|||
//发送站内信
|
|||
saveUserMessage(formDTO,originalLeader.getCustomerUserId()); |
|||
//新组长、原组长成员缓存更新
|
|||
this.updateGroupMemberInfo(originalLeader.getCustomerUserId(),formDTO.getNewLeaderUserId(),formDTO.getGroupId()); |
|||
} |
|||
|
|||
/** |
|||
* @return void |
|||
* @param originalLeaderUserId |
|||
* @param newLeaderUserId |
|||
* @param groupId |
|||
* @author yinzuomei |
|||
* @description 先删缓存,后查(没有会查数据库同时放进缓存) |
|||
* @Date 2021/3/31 10:09 |
|||
**/ |
|||
private void updateGroupMemberInfo(String originalLeaderUserId, String newLeaderUserId, String groupId) { |
|||
resiGroupMemberRedis.deleteMemberCatche(groupId,originalLeaderUserId); |
|||
resiGroupMemberRedis.deleteMemberCatche(groupId,newLeaderUserId); |
|||
resiGroupMemberRedis.get(groupId,originalLeaderUserId); |
|||
resiGroupMemberRedis.get(groupId,newLeaderUserId); |
|||
} |
|||
|
|||
private void saveUserMessage(ConfirmTransferFormDTO formDTO,String originalLeaderUserId) { |
|||
ResiGroupDTO resiGroupDTO=resiGroupService.get(formDTO.getGroupId()); |
|||
//组长自己操作:
|
|||
//组长将组转给组员后,成为组长的组员收到站内信“您有一条小组消息 您已成为【某某小组】的组长,请查看。
|
|||
//工作人员操作:
|
|||
//工作人员将组转给组员后,成为组长的组员收到站内信“您有一条小组消息 您已成为【某某小组】的组长,请查看。
|
|||
// 原组长收到站内信“您有一条小组消息 您已失去【某某小组】的组长身份,请查看。
|
|||
List<UserMessageFormDTO> msgList=new ArrayList<>(); |
|||
if(ModuleConstant.APP_GOV.equals(formDTO.getType())){ |
|||
//原组长
|
|||
UserMessageFormDTO originalLeader = new UserMessageFormDTO(); |
|||
originalLeader.setUserId(originalLeaderUserId); |
|||
originalLeader.setTitle(UserMessageConstant.GROUP_TITLE); |
|||
originalLeader.setReadFlag(ModuleConstant.UNREAD); |
|||
originalLeader.setApp(ModuleConstant.APP_RESI); |
|||
//小组所属的网格
|
|||
originalLeader.setGridId(resiGroupDTO.getGridId()); |
|||
originalLeader.setCustomerId(formDTO.getCustomerId()); |
|||
originalLeader.setMessageContent(String.format(UserMessageConstant.ORIGINAL_LEADER_DOWN,resiGroupDTO.getGroupName())); |
|||
|
|||
msgList.add(originalLeader); |
|||
} |
|||
//新组长
|
|||
UserMessageFormDTO newLeader = new UserMessageFormDTO(); |
|||
newLeader.setUserId(formDTO.getNewLeaderUserId()); |
|||
newLeader.setTitle(UserMessageConstant.GROUP_TITLE); |
|||
newLeader.setReadFlag(ModuleConstant.UNREAD); |
|||
newLeader.setApp(ModuleConstant.APP_RESI); |
|||
//小组所属的网格
|
|||
newLeader.setGridId(resiGroupDTO.getGridId()); |
|||
newLeader.setCustomerId(formDTO.getCustomerId()); |
|||
newLeader.setMessageContent(String.format(UserMessageConstant.NEW_LEADER_UP,resiGroupDTO.getGroupName())); |
|||
|
|||
msgList.add(newLeader); |
|||
if(!epmetMessageOpenFeignClient.saveUserMessageList(msgList).success()){ |
|||
log.warn("转让组发送站内信失败"); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
DROP TABLE IF EXISTS `group_leader_transfer_record`; |
|||
CREATE TABLE `group_leader_transfer_record` ( |
|||
`ID` varchar(64) NOT NULL COMMENT '主键', |
|||
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', |
|||
`GROUP_ID` varchar(64) NOT NULL COMMENT '小组id', |
|||
`ORIGINAL_LEADER` varchar(64) NOT NULL COMMENT '原组长userId', |
|||
`NEW_LEADER` varchar(64) NOT NULL COMMENT '新组长userId', |
|||
`TYPE` varchar(32) NOT NULL COMMENT '组长自主转让resi,工作人员转让gov', |
|||
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识', |
|||
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', |
|||
`CREATED_BY` varchar(64) NOT NULL COMMENT '当前操作人id即组长id', |
|||
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间', |
|||
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', |
|||
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间' |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='组长身份转让记录表'; |
@ -0,0 +1,15 @@ |
|||
DROP TABLE IF EXISTS `exit_group_record`; |
|||
CREATE TABLE `exit_group_record` ( |
|||
`ID` varchar(64) NOT NULL COMMENT '主键', |
|||
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', |
|||
`GROUP_ID` varchar(64) NOT NULL COMMENT '小组id', |
|||
`MEMBER_USER_ID` varchar(64) NOT NULL COMMENT '组成员用户id', |
|||
`SHIELD_FLAG` varchar(3) NOT NULL COMMENT '屏蔽他的话题及评论 yes:屏蔽 no:不屏蔽', |
|||
`LEAVE_TYPE` varchar(2) NOT NULL COMMENT '0:组长移除;', |
|||
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识', |
|||
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', |
|||
`CREATED_BY` varchar(64) NOT NULL COMMENT '当前操作人id', |
|||
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间', |
|||
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', |
|||
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间' |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='退群记录表'; |
@ -0,0 +1,8 @@ |
|||
<?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.member.dao.ExitGroupRecordDao"> |
|||
|
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,8 @@ |
|||
<?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.member.dao.GroupLeaderTransferRecordDao"> |
|||
|
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue