Commit 153e55c7 by 阳浪

消息优化

parent 9df7c716
......@@ -2,11 +2,15 @@ package com.yizhi.message.application.controller.remote;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yizhi.core.application.event.EventWrapper;
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.vo.MessageRemindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
......@@ -27,6 +31,8 @@ import java.util.List;
public class RemoteMessageAccountComtroller {
@Autowired
private MessageAccountService messageAccountService;
@Autowired
private MessageEventHandler messageEventHandler;
/**
* 用于触发事件,直接发送消息
......@@ -43,6 +49,15 @@ public class RemoteMessageAccountComtroller {
return false;
}
@PostMapping("/processBizEvent")
public void processBizEvent(@RequestBody EventWrapper<com.yizhi.core.application.vo.MessageRemindVo> ew) {
MessageRemindVo mrv = new MessageRemindVo();
BeanUtils.copyProperties(ew.getData(),mrv);
EventWrapper<MessageRemindVo> ewNew = new EventWrapper<MessageRemindVo>(ew.getId(),mrv);
messageEventHandler.handle(ewNew);
}
@GetMapping("/getList")
@ApiOperation(value = "获取列表", response = Integer.class)
public List<MessageAccount> getList(@RequestParam("taskType") Integer taskType, @RequestParam("taskId") Long taskId) {
......
package com.yizhi.message.application.event;
import com.yizhi.core.application.event.EventWrapper;
import com.yizhi.message.application.constans.Constans;
import com.yizhi.message.application.vo.MessageRemindVo;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: shengchenglong
* @Date: 2018/4/18 11:14
*/
@RestController
public class MessageEventListener{
@Autowired
private MessageEventHandler messageEventHandler;
@PostMapping("/remote/manage/messageAccount/processBizEvent")
public void processBizEvent(@RequestBody EventWrapper<MessageRemindVo> ew) {
messageEventHandler.handle(ew);
}
}
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