SendEvent.java 915 B

12345678910111213141516171819202122
  1. package com.sooka.sponest.data.housingconstruction.handler;
  2. import com.sooka.sponest.data.housingconstruction.domain.eventEntity.SensorEventVo;
  3. import com.sooka.sponest.data.housingconstruction.feignClient.service.RemoteHousingconstructionEventService;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.stereotype.Component;
  6. @Component
  7. public class SendEvent {
  8. @Autowired
  9. private RemoteHousingconstructionEventService eventService;
  10. public void sendEvent(String template, String eventName, String threshold, String current, SensorEventVo eventVo, String eventCode){
  11. String format = String.format(template, eventName, threshold, current);
  12. System.out.println("format ====> " + format);
  13. eventVo.setEventTypeXl(eventCode);
  14. eventVo.setEventDescription(format);
  15. //发送事件
  16. eventService.sendEvent(eventVo);
  17. }
  18. }