|
@ -28,13 +28,16 @@ import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.constant.ReadFlagConstant; |
|
|
import com.epmet.constant.ReadFlagConstant; |
|
|
|
|
|
import com.epmet.dto.UserMessageDTO; |
|
|
import com.epmet.dto.form.UserMessageFormDTO; |
|
|
import com.epmet.dto.form.UserMessageFormDTO; |
|
|
import com.epmet.dto.form.UserResiInfoListFormDTO; |
|
|
import com.epmet.dto.form.UserResiInfoListFormDTO; |
|
|
import com.epmet.dto.result.UserResiInfoResultDTO; |
|
|
import com.epmet.dto.result.UserResiInfoResultDTO; |
|
|
import com.epmet.feign.MessageFeignClient; |
|
|
import com.epmet.feign.MessageFeignClient; |
|
|
|
|
|
import com.epmet.modules.constant.GroupMemberConstant; |
|
|
import com.epmet.modules.constant.UserMessageConstant; |
|
|
import com.epmet.modules.constant.UserMessageConstant; |
|
|
import com.epmet.modules.exception.ModuleErrorCode; |
|
|
import com.epmet.modules.exception.ModuleErrorCode; |
|
|
import com.epmet.modules.feign.EpmetUserFeignClient; |
|
|
import com.epmet.modules.feign.EpmetUserFeignClient; |
|
|
|
|
|
import com.epmet.modules.group.entity.ResiGroupEntity; |
|
|
import com.epmet.modules.group.service.ResiGroupService; |
|
|
import com.epmet.modules.group.service.ResiGroupService; |
|
|
import com.epmet.modules.group.service.ResiGroupStatisticalService; |
|
|
import com.epmet.modules.group.service.ResiGroupStatisticalService; |
|
|
import com.epmet.modules.member.dao.ResiGroupMemberDao; |
|
|
import com.epmet.modules.member.dao.ResiGroupMemberDao; |
|
@ -60,10 +63,9 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.text.DateFormat; |
|
|
import java.util.Arrays; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.List; |
|
|
import java.util.*; |
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 群组成员关系表 |
|
|
* 群组成员关系表 |
|
@ -425,19 +427,19 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public Result removeMember(RemoveMemberFormDTO removeMemberFormDTO) { |
|
|
public Result removeMember(RemoveMemberFormDTO removeMemberFormDTO) { |
|
|
Result result = new Result(); |
|
|
Result result = new Result(); |
|
|
//1、resi_group_member表中的status置为removed,删除标记置为1
|
|
|
//1、resi_group_member表中的status置为removed
|
|
|
ResiGroupMemberEntity entity = new ResiGroupMemberEntity(); |
|
|
ResiGroupMemberEntity entity = new ResiGroupMemberEntity(); |
|
|
entity.setId(removeMemberFormDTO.getMemerId()); |
|
|
entity.setId(removeMemberFormDTO.getMemberId()); |
|
|
entity.setStatus(MemberStateConstant.REMOVED); |
|
|
entity.setStatus(MemberStateConstant.REMOVED); |
|
|
baseDao.updateById(entity); |
|
|
baseDao.updateById(entity); |
|
|
//2、group_member_operation新增一条记录
|
|
|
//2、group_member_operation新增一条记录
|
|
|
ResiGroupMemberEntity resiGroupMemberEntity = baseDao.selectById(removeMemberFormDTO.getMemerId()); |
|
|
ResiGroupMemberEntity resiGroupMemberEntity = baseDao.selectById(removeMemberFormDTO.getMemberId()); |
|
|
if (null == resiGroupMemberEntity) { |
|
|
if (null == resiGroupMemberEntity) { |
|
|
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED); |
|
|
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED); |
|
|
result.error(ModuleErrorCode.DELETE_FAILED); |
|
|
result.error(ModuleErrorCode.DELETE_FAILED); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
groupMemeberOperationService.saveMemberOperation(removeMemberFormDTO, resiGroupMemberEntity); |
|
|
groupMemeberOperationService.saveMemberOperation(removeMemberFormDTO.getUserId(), MemberStateConstant.REMOVED, resiGroupMemberEntity); |
|
|
//3、修改resi_group_statistical表数据:成员总数-1,普通居民总数-1,热心居民或者党员数根据被删除的用户身份来判断
|
|
|
//3、修改resi_group_statistical表数据:成员总数-1,普通居民总数-1,热心居民或者党员数根据被删除的用户身份来判断
|
|
|
result = resiGroupStatisticalService.upGroupStatistical(removeMemberFormDTO, resiGroupMemberEntity); |
|
|
result = resiGroupStatisticalService.upGroupStatistical(removeMemberFormDTO, resiGroupMemberEntity); |
|
|
if (!result.success()) { |
|
|
if (!result.success()) { |
|
@ -450,7 +452,58 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD |
|
|
resiTopicService.upResiTopic(removeMemberFormDTO, resiGroupMemberEntity); |
|
|
resiTopicService.upResiTopic(removeMemberFormDTO, resiGroupMemberEntity); |
|
|
} |
|
|
} |
|
|
//5、评论和产品沟通后,说可以留着。
|
|
|
//5、评论和产品沟通后,说可以留着。
|
|
|
logger.info(ModuleErrorCode.DELETE_SUCCESS); |
|
|
logger.info(GroupMemberConstant.DELETE_SUCCESS); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param slientMemberFormDTO |
|
|
|
|
|
* @return com.epmet.commons.tools.utils.Result |
|
|
|
|
|
* @Author sun |
|
|
|
|
|
* @Description 楼院小组--禁言组成员 |
|
|
|
|
|
**/ |
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public Result slientMember(SlientMemberFormDTO slientMemberFormDTO) { |
|
|
|
|
|
Result result = new Result(); |
|
|
|
|
|
//1:修改组成员关系(resi_group_member)表数据状态为禁言
|
|
|
|
|
|
ResiGroupMemberEntity entity = new ResiGroupMemberEntity(); |
|
|
|
|
|
entity.setId(slientMemberFormDTO.getMemberId()); |
|
|
|
|
|
entity.setStatus(MemberStateConstant.SILENT); |
|
|
|
|
|
baseDao.updateById(entity); |
|
|
|
|
|
//2:组成员出入群记录(group_memeber_operation)表新增记录
|
|
|
|
|
|
ResiGroupMemberEntity resiGroupMemberEntity = baseDao.selectById(slientMemberFormDTO.getMemberId()); |
|
|
|
|
|
if (null == resiGroupMemberEntity) { |
|
|
|
|
|
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED); |
|
|
|
|
|
result.error(ModuleErrorCode.SLIENT_FAILED); |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
groupMemeberOperationService.saveMemberOperation(slientMemberFormDTO.getUserId(), MemberStateConstant.SILENT, resiGroupMemberEntity); |
|
|
|
|
|
//3:用户消息(user_message)表新增消息数据
|
|
|
|
|
|
ResiGroupEntity resiGroupEntity = resiGroupService.selectById(resiGroupMemberEntity.getResiGroupId()); |
|
|
|
|
|
if (null == resiGroupEntity) { |
|
|
|
|
|
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED); |
|
|
|
|
|
result.error(ModuleErrorCode.SLIENT_FAILED); |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); |
|
|
|
|
|
userMessageFormDTO.setCustomerId(resiGroupEntity.getCustomerId()); |
|
|
|
|
|
userMessageFormDTO.setGridId(resiGroupEntity.getGridId()); |
|
|
|
|
|
//被禁言用户Id
|
|
|
|
|
|
userMessageFormDTO.setUserId(resiGroupMemberEntity.getCustomerUserId()); |
|
|
|
|
|
userMessageFormDTO.setApp(slientMemberFormDTO.getApp()); |
|
|
|
|
|
userMessageFormDTO.setTitle(UserMessageConstant.GROUP_TITLE); |
|
|
|
|
|
DateFormat df = new SimpleDateFormat("yyyy.MM.dd hh:mm"); |
|
|
|
|
|
Calendar c = Calendar.getInstance(); |
|
|
|
|
|
//当前时间加7天
|
|
|
|
|
|
c.add(Calendar.DAY_OF_WEEK, Calendar.DAY_OF_WEEK); |
|
|
|
|
|
StringBuffer dateStr = new StringBuffer(df.format(new Date())).append("-").append(df.format(c.getTime())); |
|
|
|
|
|
String messageContent=String.format(UserMessageConstant.SLIENT_IN_GROUP, dateStr); |
|
|
|
|
|
userMessageFormDTO.setMessageContent(messageContent); |
|
|
|
|
|
userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
|
|
messageFeignClient.saveUserMessage(userMessageFormDTO); |
|
|
|
|
|
result.setMsg(GroupMemberConstant.SLIENT_SUCCESS); |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|