|
@@ -2,17 +2,27 @@ package com.dragon.tj.portal.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.dragon.tj.portal.common.base.R;
|
|
|
+import com.dragon.tj.portal.common.convert.notice.NoticeInfoVOConvert;
|
|
|
import com.dragon.tj.portal.common.convert.notice.NoticeReqConvert;
|
|
|
import com.dragon.tj.portal.common.dto.notice.NoticeInfoReq;
|
|
|
import com.dragon.tj.portal.common.dto.notice.NoticeInfoSend;
|
|
|
import com.dragon.tj.portal.common.enums.message.MessageInfoErrorEnums;
|
|
|
import com.dragon.tj.portal.common.enums.message.MsgRecordTypeEnum;
|
|
|
+import com.dragon.tj.portal.common.enums.message.ReadStatusEnum;
|
|
|
import com.dragon.tj.portal.common.enums.message.ScopeEnums;
|
|
|
+import com.dragon.tj.portal.common.vo.message.MessageInfoParam;
|
|
|
+import com.dragon.tj.portal.common.vo.message.MessageInfoVO;
|
|
|
+import com.dragon.tj.portal.common.vo.message.MessagePageParam;
|
|
|
+import com.dragon.tj.portal.common.vo.notice.NoticeInfoParam;
|
|
|
+import com.dragon.tj.portal.common.vo.notice.NoticeInfoVO;
|
|
|
import com.dragon.tj.portal.component.exception.message.MessageInfoException;
|
|
|
import com.dragon.tj.portal.component.message.KafkaInitialConfiguration;
|
|
|
import com.dragon.tj.portal.component.message.MessageProducer;
|
|
|
+import com.dragon.tj.portal.entity.MessageInfo;
|
|
|
import com.dragon.tj.portal.entity.MsgRecord;
|
|
|
import com.dragon.tj.portal.entity.NoticeInfo;
|
|
|
import com.dragon.tj.portal.entity.NoticeInfoScope;
|
|
@@ -61,6 +71,9 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
|
|
|
@Autowired
|
|
|
private NoticeReqConvert noticeReqConvert;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private NoticeInfoVOConvert noticeInfoVOConvert;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public R send(NoticeInfoReq noticeInfoReq) {
|
|
@@ -72,6 +85,47 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
|
|
|
return R.ok(b);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public NoticeInfoVO detail(Long id) {
|
|
|
+ NoticeInfo noticeInfo = this.getById(id);
|
|
|
+ return noticeInfoVOConvert.toVo(noticeInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean update(NoticeInfoParam noticeInfoParam) {
|
|
|
+ NoticeInfo messageInfo = noticeInfoVOConvert.paramTo(noticeInfoParam);
|
|
|
+ return this.updateById(messageInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean read(Long id) {
|
|
|
+ NoticeInfo noticeInfo = this.getById(id);
|
|
|
+ Integer readStatus = noticeInfo.getReadStatus();
|
|
|
+ if (ReadStatusEnum.YES.value().equals(readStatus)) {
|
|
|
+ throw new MessageInfoException(MessageInfoErrorEnums.Code.MESSAGE_READ_ALREADY);
|
|
|
+ }
|
|
|
+ noticeInfo.setReadStatus(ReadStatusEnum.YES.value());
|
|
|
+ return this.updateById(noticeInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean reads(List<Long> ids) {
|
|
|
+ List<NoticeInfo> list = Lists.newArrayList();
|
|
|
+ ids.forEach(e -> {
|
|
|
+ MessageInfo messageInfo = new MessageInfo();
|
|
|
+ messageInfo.setReadStatus(ReadStatusEnum.YES.value());
|
|
|
+ messageInfo.setId(e);
|
|
|
+
|
|
|
+ });
|
|
|
+ return this.updateBatchById(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPage queryPage(Page page, MessagePageParam req) {
|
|
|
+ IPage<MessageInfo> queryPage = baseMapper.queryPage(page, req);
|
|
|
+ return queryPage;
|
|
|
+ }
|
|
|
+
|
|
|
private boolean transferIds(NoticeInfoReq noticeInfoReq) {
|
|
|
// 120101510000 120000450200
|
|
|
//120222197001010001 120222197001010002
|
|
@@ -117,6 +171,10 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
|
|
|
}
|
|
|
|
|
|
private void validate(NoticeInfoReq noticeInfoReq) {
|
|
|
+
|
|
|
+
|
|
|
+ //TODO 校验一下topic
|
|
|
+
|
|
|
String id = noticeInfoReq.getId();
|
|
|
Long t = noticeInfoReq.getT();
|
|
|
String scopeId = noticeInfoReq.getScopeId();
|