Browse Source
# Conflicts: # epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java # epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.javadev_shibei_match
34 changed files with 769 additions and 1 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,21 @@ |
|||||
package com.epmet.dataaggre.service.epmetuser; |
package com.epmet.dataaggre.service.epmetuser; |
||||
|
|
||||
|
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
/** |
/** |
||||
* @Author zxc |
* @Author zxc |
||||
* @DateTime 2020/12/25 上午9:20 |
* @DateTime 2020/12/25 上午9:20 |
||||
*/ |
*/ |
||||
public interface EpmetUserService { |
public interface EpmetUserService { |
||||
|
|
||||
|
/** |
||||
|
* @Description 根据UserIds查询 |
||||
|
* @Param userIds |
||||
|
* @author zxc |
||||
|
* @date 2021/3/30 上午11:07 |
||||
|
*/ |
||||
|
List<UserInfosResultDTO> selectUserInfosByUserIds(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,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,120 @@ |
|||||
|
package com.epmet.modules.group.service.impl; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.feign.GovIssueOpenFeignClient; |
||||
|
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.ResiTopicEntity; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* @param formDTO |
||||
|
* @Description 删除组员 |
||||
|
* @author sun |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void removeMember(ExitGroupFormDTO formDTO) { |
||||
|
//1.校验被删除人员是否是当前小组内成员
|
||||
|
int num = resiGroupMemberDao.checkUserInGroup(formDTO.getUserId(), formDTO.getGroupId()); |
||||
|
if (num < NumConstant.ONE) { |
||||
|
throw new RenException("当前待删除人员不是本小组成员"); |
||||
|
} |
||||
|
|
||||
|
//2.判断是否屏蔽本小组内历史话题
|
||||
|
List<String> delIdList = new ArrayList<>(); |
||||
|
if ("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()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//3.判断是否屏蔽本小组内历史评论
|
||||
|
if ("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("0"); |
||||
|
if (exitGroupRecordDao.insert(entity) < NumConstant.ONE) { |
||||
|
throw new RenException(String.format("新增退群记录表数据操作失败,小组Id【%s】被修改人Id【%s】", formDTO.getGroupId(), formDTO.getUserId())); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
Loading…
Reference in new issue