群发消息接口

This commit is contained in:
daihh
2023-02-07 11:10:36 +08:00
parent ef29bb077d
commit b7249f8811
2 changed files with 19 additions and 5 deletions

View File

@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.xboe.common.PageList;
import com.xboe.common.Pagination;
import com.xboe.common.utils.IDGenerator;
import com.xboe.common.utils.StringUtil;
import com.xboe.core.JsonResponse;
import com.xboe.core.api.ApiBaseController;
@@ -134,10 +135,24 @@ public class MessageApi extends ApiBaseController {
return badRequest("内容不能为空");
}
try {
//message.setIsRead(false);
// message.setMsgType(1);
// message.setMsgTime(LocalDateTime.now());
//MessageSender.send(message);
Message msg=new Message();
msg.setId(IDGenerator.generate());
// msg.setAcceptId(aid);
// msg.setAcceptName(aname);
msg.setContent(message.getContent());
msg.setConType("0");
msg.setIsRead(false);
msg.setMsgType(1);
msg.setPageParams(message.getPageParams());
msg.setPageType(message.getPageType());
msg.setRefId(message.getRefId());
msg.setRefType(message.getRefType());
msg.setSendAid(message.getSendAid());
msg.setSendName(message.getSendName());
msg.setSendType(1);
msg.setSource(message.getSource());
msg.setTitle(message.getTitle());
MessageSender.batchSend(message.getAcceptIds(),message.getAcceptNames(),msg);
return success(true);
} catch (Exception e) {
log.error("发布消息失败",e);

View File

@@ -55,7 +55,6 @@ public class MessageSender {
msg.setSendType(1);
msg.setSource(data.getSource());
msg.setTitle(data.getTitle());
msg.setContent(data.getContent());
msgList.add(msg);
}
messageService.batchSave(msgList);