|
@@ -16,6 +16,7 @@ import com.yonge.cooleshow.biz.dal.dto.ImGroupNoticeDto;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.ImGroup;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.ImGroupNotice;
|
|
|
import com.yonge.cooleshow.biz.dal.service.ImGroupNoticeService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.ImGroupService;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.im.ImGroupNoticeWrapper;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
import com.yonge.toolset.base.page.PageInfo;
|
|
@@ -45,7 +46,7 @@ public class ImGroupNoticeServiceImpl extends ServiceImpl<ImGroupNoticeDao, ImGr
|
|
|
@Resource
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
@Resource
|
|
|
- private ImGroupDao imGroupDao;
|
|
|
+ private ImGroupService imGroupService;
|
|
|
@Resource
|
|
|
private ImPluginContext imPluginContext;
|
|
|
|
|
@@ -56,7 +57,7 @@ public class ImGroupNoticeServiceImpl extends ServiceImpl<ImGroupNoticeDao, ImGr
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void create(ImGroupNotice imGroupNotice) {
|
|
|
+ public void create(ImGroupNoticeDto imGroupNotice) {
|
|
|
Long userId = this.checkAdmin(imGroupNotice.getGroupId());
|
|
|
Date date = new Date();
|
|
|
imGroupNotice.setOperatorId(userId);
|
|
@@ -77,13 +78,14 @@ public class ImGroupNoticeServiceImpl extends ServiceImpl<ImGroupNoticeDao, ImGr
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public ImGroupNoticeWrapper.ImGroupNotice convertToImGroupNotice(ImGroupNotice imGroupNotice) {
|
|
|
+ public ImGroupNoticeWrapper.ImGroupNotice convertToImGroupNotice(ImGroupNoticeDto imGroupNotice) {
|
|
|
ImGroupNoticeWrapper.ImGroupNotice notice = ImGroupNoticeWrapper.ImGroupNotice.builder()
|
|
|
.id(imGroupNotice.getId())
|
|
|
.groupId(imGroupNotice.getGroupId())
|
|
|
.title(imGroupNotice.getTitle())
|
|
|
.content(imGroupNotice.getContent())
|
|
|
.topFlag(imGroupNotice.getTopFlag())
|
|
|
+ .clientType(imGroupNotice.getClientType())
|
|
|
.sentToNewMemberFlag(imGroupNotice.getSentToNewMemberFlag())
|
|
|
.operatorId(imGroupNotice.getOperatorId())
|
|
|
.delFlag(imGroupNotice.getDelFlag())
|
|
@@ -125,7 +127,7 @@ public class ImGroupNoticeServiceImpl extends ServiceImpl<ImGroupNoticeDao, ImGr
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void modify(ImGroupNotice imGroupNotice) {
|
|
|
+ public void modify(ImGroupNoticeDto imGroupNotice) {
|
|
|
if(Objects.isNull(baseMapper.selectById(imGroupNotice.getId()))){
|
|
|
throw new BizException("群公告不存在");
|
|
|
}
|
|
@@ -144,7 +146,9 @@ public class ImGroupNoticeServiceImpl extends ServiceImpl<ImGroupNoticeDao, ImGr
|
|
|
ImGroupNotice notice = baseMapper.selectById(imGroupNotice.getId());
|
|
|
revokeImGroupNoticeMessage(notice);
|
|
|
// 发送群公告消息
|
|
|
- String messageSeqId = sendGroupCustomNoticeMessage(convertToImGroupNotice(notice));
|
|
|
+ ImGroupNoticeDto dto = JSON.parseObject(JSON.toJSONString(notice), ImGroupNoticeDto.class);
|
|
|
+ dto.setClientType(imGroupNotice.getClientType());
|
|
|
+ String messageSeqId = sendGroupCustomNoticeMessage(convertToImGroupNotice(dto));
|
|
|
|
|
|
// 更新群公告消息ID
|
|
|
if (StringUtils.isNotBlank(messageSeqId)) {
|
|
@@ -154,7 +158,7 @@ public class ImGroupNoticeServiceImpl extends ServiceImpl<ImGroupNoticeDao, ImGr
|
|
|
}
|
|
|
|
|
|
public Long checkAdmin(String groupId){
|
|
|
- ImGroup imGroup = imGroupDao.selectById(groupId);
|
|
|
+ ImGroup imGroup = imGroupService.getById(groupId);
|
|
|
if(Objects.isNull(imGroup)){
|
|
|
throw new BizException("群信息不存在");
|
|
|
}
|
|
@@ -192,7 +196,7 @@ public class ImGroupNoticeServiceImpl extends ServiceImpl<ImGroupNoticeDao, ImGr
|
|
|
try {
|
|
|
// 发送群公告消息
|
|
|
messageSeqId = imPluginContext.getPluginService().sendGroupMessage(MessageWrapper.GroupMessage.builder()
|
|
|
- .senderId(notice.getOperatorId().toString())
|
|
|
+ .senderId(imGroupService.getImUserId(notice.getOperatorId().toString(), notice.getClientType()))
|
|
|
.groupId(notice.getGroupId())
|
|
|
.tencentMessage(messageBody)
|
|
|
.build());
|