|
@@ -8,10 +8,14 @@ import com.dragon.tj.portal.auth.web.service.SysDeptService;
|
|
|
import com.dragon.tj.portal.common.base.R;
|
|
|
import com.dragon.tj.portal.common.constants.BusinessConstants;
|
|
|
import com.dragon.tj.portal.common.convert.MessageReqConvert;
|
|
|
+import com.dragon.tj.portal.common.convert.mesage.MessageInfoVOConvert;
|
|
|
import com.dragon.tj.portal.common.dto.message.MessageInfoReq;
|
|
|
import com.dragon.tj.portal.common.dto.message.MessageInfoSend;
|
|
|
import com.dragon.tj.portal.common.enums.MessageInfoErrorEnums;
|
|
|
import com.dragon.tj.portal.common.enums.ScopeEnums;
|
|
|
+import com.dragon.tj.portal.common.enums.message.ReadStatusEnum;
|
|
|
+import com.dragon.tj.portal.common.vo.message.MessageInfoParam;
|
|
|
+import com.dragon.tj.portal.common.vo.message.MessageInfoVO;
|
|
|
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;
|
|
@@ -51,22 +55,38 @@ public class MessageInfoServiceImpl extends ServiceImpl<MessageInfoMapper, Messa
|
|
|
@Autowired
|
|
|
private MessageReqConvert messageReqConvert;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MessageInfoVOConvert messageInfoVOConvert;
|
|
|
+
|
|
|
@Override
|
|
|
public R push(MessageInfoReq messageInfoReq, LoginUser loginUser) {
|
|
|
- return R.ok(this.doMessage(messageInfoReq,loginUser));
|
|
|
+ return R.ok(this.doMessage(messageInfoReq, loginUser));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @author huey China.
|
|
|
- * @Description : 预先处理 TODO message 没走字典
|
|
|
- * @Date Created in 2023/6/16 11:25
|
|
|
- */
|
|
|
- private boolean doMessage(MessageInfoReq messageInfoReq, LoginUser loginUser) {
|
|
|
+ @Override
|
|
|
+ public MessageInfoVO detail(Long id) {
|
|
|
+ MessageInfo messageInfo = this.getById(id);
|
|
|
+ return messageInfoVOConvert.toVo(messageInfo);
|
|
|
+ }
|
|
|
|
|
|
- this.validate(messageInfoReq);
|
|
|
- return this.transferIds(messageInfoReq,loginUser);
|
|
|
+ @Override
|
|
|
+ public boolean update(MessageInfoParam messageInfoParam) {
|
|
|
+ MessageInfo messageInfo = messageInfoVOConvert.paramTo(messageInfoParam);
|
|
|
+ return this.updateById(messageInfo);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean read(Long id) {
|
|
|
+ MessageInfo messageInfo = this.getById(id);
|
|
|
+ Integer readStatus = messageInfo.getReadStatus();
|
|
|
+ if (ReadStatusEnum.YES.value().equals(readStatus)) {
|
|
|
+ throw new MessageInfoException(MessageInfoErrorEnums.Code.MESSAGE_READ_ALREADY);
|
|
|
+ }
|
|
|
+ messageInfo.setReadStatus(ReadStatusEnum.YES.value());
|
|
|
+ return this.updateById(messageInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @author huey China.
|
|
|
* @Description :
|
|
@@ -81,7 +101,7 @@ public class MessageInfoServiceImpl extends ServiceImpl<MessageInfoMapper, Messa
|
|
|
Set<String> messageClientIds = this.getMessageClientIds(messageType, scopeIds);
|
|
|
|
|
|
if (CollUtil.isNotEmpty(messageClientIds)) {
|
|
|
- MessageInfoSend messageInfoSend = this.doSaveMessageInfo(messageInfoReq, messageClientIds,loginUser);
|
|
|
+ MessageInfoSend messageInfoSend = this.doSaveMessageInfo(messageInfoReq, messageClientIds, loginUser);
|
|
|
isSend = producer.send(KafkaInitialConfiguration.sseTopic, JSON.toJSONString(messageInfoSend));
|
|
|
}
|
|
|
return isSend;
|
|
@@ -152,6 +172,17 @@ public class MessageInfoServiceImpl extends ServiceImpl<MessageInfoMapper, Messa
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * @author huey China.
|
|
|
+ * @Description : 预先处理 TODO message 没走字典
|
|
|
+ * @Date Created in 2023/6/16 11:25
|
|
|
+ */
|
|
|
+ private boolean doMessage(MessageInfoReq messageInfoReq, LoginUser loginUser) {
|
|
|
+
|
|
|
+ this.validate(messageInfoReq);
|
|
|
+ return this.transferIds(messageInfoReq, loginUser);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @author huey China.
|
|
|
* @Description : md5 验证消息唯一性
|