Commit e5e8f7d2 by 阳浪

消息优化

parent 153e55c7
......@@ -7,9 +7,13 @@ import com.yizhi.message.application.constans.Constans;
import com.yizhi.message.application.domain.MessageAccount;
import com.yizhi.message.application.event.MessageEventHandler;
import com.yizhi.message.application.service.MessageAccountService;
import com.yizhi.message.application.service.MessageRemindService;
import com.yizhi.message.application.vo.MessageRemindVo;
import com.yizhi.message.application.vo.MessageTaskRemindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
......@@ -29,10 +33,11 @@ import java.util.List;
@Api(tags = "用户消息接口,后端内部调用接口,不给前端用")
@RequestMapping("/remote/manage/messageAccount")
public class RemoteMessageAccountComtroller {
private static final Logger LOGGER = LoggerFactory.getLogger(RemoteMessageAccountComtroller.class);
@Autowired
private MessageAccountService messageAccountService;
@Autowired
private MessageEventHandler messageEventHandler;
private MessageRemindService messageRemindService;
/**
* 用于触发事件,直接发送消息
......@@ -50,11 +55,24 @@ public class RemoteMessageAccountComtroller {
}
@PostMapping("/processBizEvent")
public void processBizEvent(@RequestBody EventWrapper<com.yizhi.core.application.vo.MessageRemindVo> ew) {
public void processBizEvent(@RequestBody com.yizhi.core.application.vo.MessageRemindVo data) {
MessageRemindVo mrv = new MessageRemindVo();
BeanUtils.copyProperties(ew.getData(),mrv);
EventWrapper<MessageRemindVo> ewNew = new EventWrapper<MessageRemindVo>(ew.getId(),mrv);
messageEventHandler.handle(ewNew);
BeanUtils.copyProperties(data,mrv);
LOGGER.info("收到消息,开始保存待发消息,其remindVo:"+ mrv);
if (mrv != null) {
if(CollectionUtils.isEmpty(data.getMessageTaskRemindVos())){
data.getMessageTaskRemindVos().stream().forEach(mtv->{
MessageTaskRemindVo m = new MessageTaskRemindVo();
BeanUtils.copyProperties(mtv,m);
mrv.getMessageTaskRemindVos().add(m);
}
);
}
messageRemindService.insertMessageRemind(mrv);
}else {
LOGGER.info("remindVo"+mrv+"接到的消息内容为空!!!");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment