|  | @@ -1,19 +1,29 @@
 | 
	
		
			
				|  |  |  package com.genersoft.iot.vmp.vmanager.streamPush;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.alibaba.excel.EasyExcel;
 | 
	
		
			
				|  |  | +import com.alibaba.excel.ExcelReader;
 | 
	
		
			
				|  |  | +import com.alibaba.excel.read.metadata.ReadSheet;
 | 
	
		
			
				|  |  |  import com.genersoft.iot.vmp.gb28181.bean.GbStream;
 | 
	
		
			
				|  |  |  import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
 | 
	
		
			
				|  |  | +import com.genersoft.iot.vmp.service.IMediaServerService;
 | 
	
		
			
				|  |  |  import com.genersoft.iot.vmp.service.IStreamPushService;
 | 
	
		
			
				|  |  | -import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
 | 
	
		
			
				|  |  | +import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler;
 | 
	
		
			
				|  |  | +import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
 | 
	
		
			
				|  |  |  import com.github.pagehelper.PageInfo;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiImplicitParam;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiImplicitParams;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | +import org.apache.poi.sl.usermodel.Sheet;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
		
			
				|  |  |  import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Controller;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | +import org.springframework.web.multipart.MultipartFile;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.io.IOException;
 | 
	
		
			
				|  |  | +import java.io.InputStream;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Api(tags = "推流信息管理")
 | 
	
		
			
				|  |  |  @Controller
 | 
	
	
		
			
				|  | @@ -26,6 +36,9 @@ public class StreamPushController {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private IStreamPushService streamPushService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IMediaServerService mediaServerService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @ApiOperation("推流列表查询")
 | 
	
		
			
				|  |  |      @ApiImplicitParams({
 | 
	
		
			
				|  |  |              @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
 | 
	
	
		
			
				|  | @@ -88,5 +101,28 @@ public class StreamPushController {
 | 
	
		
			
				|  |  |              return "fail";
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    @PostMapping(value = "upload")
 | 
	
		
			
				|  |  | +    @ResponseBody
 | 
	
		
			
				|  |  | +    public String uploadChannelFile(@RequestParam(value = "file") MultipartFile file){
 | 
	
		
			
				|  |  | +        if (file.isEmpty()) {
 | 
	
		
			
				|  |  | +            return "fail";
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        //获取文件流
 | 
	
		
			
				|  |  | +        InputStream inputStream = null;
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            String name = file.getName();
 | 
	
		
			
				|  |  | +            inputStream = file.getInputStream();
 | 
	
		
			
				|  |  | +        } catch (IOException e) {
 | 
	
		
			
				|  |  | +            e.printStackTrace();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        //传入参数
 | 
	
		
			
				|  |  | +        ExcelReader excelReader = EasyExcel.read(inputStream, StreamPushExcelDto.class,
 | 
	
		
			
				|  |  | +                new StreamPushUploadFileHandler(streamPushService, mediaServerService.getDefaultMediaServer().getId())).build();
 | 
	
		
			
				|  |  | +        ReadSheet readSheet = EasyExcel.readSheet(0).build();
 | 
	
		
			
				|  |  | +        excelReader.read(readSheet);
 | 
	
		
			
				|  |  | +        excelReader.finish();
 | 
	
		
			
				|  |  | +        return "success";
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }
 |