baizonghao
2023-03-14 bd8147d7890bf60d88e4007c1af726ba5f364cf5
拼接地址
1个文件已修改
12 ■■■■■ 已修改文件
ycl-platform/src/main/java/com/ycl/controller/platformApi/AlarmController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/platformApi/AlarmController.java
@@ -17,7 +17,6 @@
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
@@ -28,8 +27,6 @@
@RestController
@RequestMapping("/API")
public class AlarmController {
    private IVideoAlarmReportService videoAlarmReportService;
    @Autowired
@@ -64,14 +61,15 @@
    @ApiOperation(value = "获取图片")
    @GetMapping(value = "/img", produces = MediaType.IMAGE_PNG_VALUE)
    @GetMapping(value = "/img", produces = {MediaType.IMAGE_JPEG_VALUE, MediaType.IMAGE_PNG_VALUE})
//    @GetMapping(value = "/img")
    @ResponseBody
    public byte[] getImages(HttpServletResponse response, @RequestParam String fileUrl) {
    public byte[] getImages(HttpServletResponse response, @RequestParam String fileUrl, @RequestParam String OSSAccessKeyId, @RequestParam String Signature) {
        try {
            URL url = new URL(fileUrl);
            URL url = new URL(fileUrl + "&OSSAccessKeyId=" + OSSAccessKeyId +"&Signature=" + Signature);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("GET");
            conn.setConnectTimeout(5 * 1000);
            conn.setConnectTimeout(10 * 1000);
            conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
            InputStream inputStream = conn.getInputStream();// 通过输入流获取图片数据