|
|
@ -19,6 +19,7 @@ package com.epmet.modules.act.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
import com.epmet.commons.tools.constant.Constant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
@ -33,8 +34,11 @@ import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.constant.ReadFlagConstant; |
|
|
|
import com.epmet.dto.form.UserMessageFormDTO; |
|
|
|
import com.epmet.dto.result.GridInfoResultDTO; |
|
|
|
import com.epmet.dto.result.UserBaseInfoResultDTO; |
|
|
|
import com.epmet.feign.EpmetMessageOpenFeignClient; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.modules.act.dao.ActOperationRecordDao; |
|
|
@ -49,6 +53,7 @@ import com.epmet.modules.act.service.ActCategoryDictService; |
|
|
|
import com.epmet.modules.act.service.ActSignInRecordService; |
|
|
|
import com.epmet.modules.act.service.GroupActInfoService; |
|
|
|
import com.epmet.modules.constant.GroupActConstant; |
|
|
|
import com.epmet.modules.constant.UserMessageConstant; |
|
|
|
import com.epmet.modules.group.service.ResiGroupService; |
|
|
|
import com.epmet.modules.member.service.ResiGroupMemberService; |
|
|
|
import com.epmet.resi.group.dto.act.GroupActIdDTO; |
|
|
@ -108,6 +113,9 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private ActSignInRecordService actSignInRecordService; |
|
|
|
@Autowired |
|
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
|
|
|
|
|
/** |
|
|
|
* 003、发布(编辑)组织活动 |
|
|
|
* |
|
|
@ -145,11 +153,13 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr |
|
|
|
//构造活动内容表
|
|
|
|
List<GroupActContentEntity> contentList = constructText(groupActInfoEntity.getId(), formDTO.getCustomerId(), formDTO.getTextList()); |
|
|
|
List<GroupActContentEntity> imgList = constructImg(groupActInfoEntity.getId(), formDTO.getCustomerId(), formDTO.getImgList()); |
|
|
|
List<ResiGroupMemberDTO> memberDTOList=resiGroupMemberService.getMemberList(formDTO.getGroupId()); |
|
|
|
List<ActReadRecordEntity> readRecordEntityList=constructReadRec(groupActInfoEntity.getId(), |
|
|
|
formDTO.getCustomerId(), |
|
|
|
formDTO.getGroupId(), |
|
|
|
formDTO.getPublishUserId(), |
|
|
|
groupDTO.getGridId()); |
|
|
|
groupDTO.getGridId(), |
|
|
|
memberDTOList); |
|
|
|
//2、插入活动内容
|
|
|
|
contentList.forEach(textContentEntity->{ |
|
|
|
groupActContentDao.insert(textContentEntity); |
|
|
@ -163,14 +173,44 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr |
|
|
|
readRecordEntityList.forEach(readRecordEntity->{ |
|
|
|
actReadRecordDao.insert(readRecordEntity); |
|
|
|
}); |
|
|
|
//5、发送站内信
|
|
|
|
sendMessage(memberDTOList,formDTO,groupActInfoEntity,groupDTO); |
|
|
|
|
|
|
|
result.setGroupActId(groupActInfoEntity.getId()); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
private List<ActReadRecordEntity> constructReadRec(String groupActId, String customerId, String groupId,String publishUserId,String gridId) { |
|
|
|
private void sendMessage(List<ResiGroupMemberDTO> memberDTOList, PublishGroupActFormDTO formDTO, GroupActInfoEntity groupActInfoEntity,ResiGroupDTO resiGroupDTO) { |
|
|
|
|
|
|
|
List<UserMessageFormDTO> list = new ArrayList<>(); |
|
|
|
memberDTOList.forEach(memberDTO -> { |
|
|
|
//不需要给当前操作人发送
|
|
|
|
if (!formDTO.getPublishUserId().equals(memberDTO.getCustomerUserId())) { |
|
|
|
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); |
|
|
|
userMessageFormDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
userMessageFormDTO.setUserId(memberDTO.getCustomerUserId()); |
|
|
|
userMessageFormDTO.setGridId(resiGroupDTO.getGridId()); |
|
|
|
userMessageFormDTO.setApp(AppClientConstant.APP_RESI); |
|
|
|
userMessageFormDTO.setTitle(UserMessageConstant.GROUP_TITLE); |
|
|
|
userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
if(StringUtils.isNotBlank(formDTO.getGroupActId())){ |
|
|
|
// 活动修改后,站内信通知全组成员“您有一条小组消息 【某某小组】更新了********活动详情,请查看。
|
|
|
|
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.CHANGED_GROUP_ACT, resiGroupDTO.getGroupName(), groupActInfoEntity.getTitle())); |
|
|
|
}else{ |
|
|
|
// 活动发布,站内信通知全组成员“您有一条小组消息 【某某小组】发布了*******活动,请查看。
|
|
|
|
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.PUBLISH_GROUP_ACT, resiGroupDTO.getGroupName(), groupActInfoEntity.getTitle())); |
|
|
|
} |
|
|
|
list.add(userMessageFormDTO); |
|
|
|
} |
|
|
|
}); |
|
|
|
Result sendMessageRes = epmetMessageOpenFeignClient.saveUserMessageList(list); |
|
|
|
if (!sendMessageRes.success()) { |
|
|
|
log.warn("发布(编辑)组织活动,发送站内信异常"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private List<ActReadRecordEntity> constructReadRec(String groupActId, String customerId, String groupId,String publishUserId,String gridId,List<ResiGroupMemberDTO> memberDTOList) { |
|
|
|
List<ActReadRecordEntity> list=new ArrayList<>(); |
|
|
|
List<ResiGroupMemberDTO> memberDTOList=resiGroupMemberService.getMemberList(groupId); |
|
|
|
memberDTOList.forEach(memberDTO->{ |
|
|
|
ActReadRecordEntity actReadRecordEntity=new ActReadRecordEntity(); |
|
|
|
actReadRecordEntity.setCustomerId(customerId); |
|
|
@ -589,12 +629,40 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr |
|
|
|
actOperationRecordEntity.setNote(formDTO.getReason()); |
|
|
|
actOperationRecordDao.insert(actOperationRecordEntity); |
|
|
|
|
|
|
|
baseDao.updateById(actInfoEntity); |
|
|
|
//6、发送站内信
|
|
|
|
sendUserMessageForCancelAct(actInfoEntity,formDTO.getUserId()); |
|
|
|
|
|
|
|
GroupActIdDTO resultDTO=new GroupActIdDTO(); |
|
|
|
resultDTO.setGroupActId(formDTO.getGroupActId()); |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
private void sendUserMessageForCancelAct(GroupActInfoEntity actInfoEntity,String currentUserId) { |
|
|
|
ResiGroupDTO resiGroupDTO = resiGroupService.get(actInfoEntity.getGroupId()); |
|
|
|
if (null != resiGroupDTO) { |
|
|
|
List<ResiGroupMemberDTO> memberDTOList = resiGroupMemberService.getMemberList(actInfoEntity.getGroupId()); |
|
|
|
List<UserMessageFormDTO> list = new ArrayList<>(); |
|
|
|
memberDTOList.forEach(memberDTO -> { |
|
|
|
//不需要给当前操作人发送
|
|
|
|
if (!currentUserId.equals(memberDTO.getCustomerUserId())) { |
|
|
|
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); |
|
|
|
userMessageFormDTO.setCustomerId(actInfoEntity.getCustomerId()); |
|
|
|
userMessageFormDTO.setUserId(memberDTO.getCustomerUserId()); |
|
|
|
userMessageFormDTO.setGridId(actInfoEntity.getGridId()); |
|
|
|
userMessageFormDTO.setApp(AppClientConstant.APP_RESI); |
|
|
|
userMessageFormDTO.setTitle(UserMessageConstant.GROUP_TITLE); |
|
|
|
userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.CANCEL_GROUP_ACT, resiGroupDTO.getGroupName(), actInfoEntity.getTitle())); |
|
|
|
list.add(userMessageFormDTO); |
|
|
|
} |
|
|
|
}); |
|
|
|
Result sendMessageRes = epmetMessageOpenFeignClient.saveUserMessageList(list); |
|
|
|
if (!sendMessageRes.success()) { |
|
|
|
log.warn("发布(编辑)组织活动,发送站内信异常"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询活动主信息 |
|
|
|
* |
|
|
|