diff --git a/src/main/java/com/hisense/monitormanage/controller/EventController.java b/src/main/java/com/hisense/monitormanage/controller/EventController.java index 71610ed..b5b0bf9 100644 --- a/src/main/java/com/hisense/monitormanage/controller/EventController.java +++ b/src/main/java/com/hisense/monitormanage/controller/EventController.java @@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; @@ -143,6 +144,7 @@ public class EventController { @GetMapping("selectEvent") @ApiOperation("查询所有事件") public Result selectEvent(){ + List events = eventMapper.selectEvent(); Result success = Result.success(events); diff --git a/src/main/java/com/hisense/monitormanage/controller/FordController.java b/src/main/java/com/hisense/monitormanage/controller/FordController.java new file mode 100644 index 0000000..ca3824f --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/controller/FordController.java @@ -0,0 +1,53 @@ +package com.hisense.monitormanage.controller; + +import io.swagger.annotations.ApiOperation; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; + +@Controller +public class FordController { + + @GetMapping("components/**") + @ApiOperation("查询所有事件") + public void ford(HttpServletRequest request, HttpServletResponse response)throws Exception{ + + String imageDomain = "http://10.132.191.48:30080"; + + String uri = request.getRequestURI(); + String fordUrl = imageDomain + uri; + + URLConnection con = null; + + try { + URL url = new URL(fordUrl); + con = url.openConnection(); + + //允许写出 + con.setDoOutput(true); + //允许读入 + con.setDoInput(true); + //不使用缓存 + con.setUseCaches(false); + //得到响应流 + InputStream inputStream = con.getInputStream(); + + ServletOutputStream outputStream = response.getOutputStream(); + byte[] buffer = new byte[1024]; + int len = inputStream.read(buffer); + while (len != -1) { + outputStream.write(buffer, 0, len); + len = inputStream.read(buffer); + } + + }catch(Exception e) { + e.printStackTrace(); + } + } +}