|
|
@@ -30,21 +30,16 @@ import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.io.FilenameUtils;
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
import org.apache.poi.util.TempFile;
|
|
|
-import org.bytedeco.javacv.FFmpegFrameGrabber;
|
|
|
-import org.bytedeco.javacv.Frame;
|
|
|
-import org.bytedeco.javacv.Java2DFrameConverter;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageImpl;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import javax.imageio.ImageIO;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.transaction.Transactional;
|
|
|
-import java.awt.image.BufferedImage;
|
|
|
import java.io.*;
|
|
|
-import java.net.FileNameMap;
|
|
|
-import java.net.URLConnection;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
@@ -252,24 +247,6 @@ public class ProgrammeService {
|
|
|
+ RandomStringUtils.randomAlphabetic(8)
|
|
|
+ "." + FilenameUtils.getExtension(uploadFile.getName());
|
|
|
String url = storageService.uploadFromInputStream(new FileInputStream(uploadFile), videoPath);
|
|
|
-
|
|
|
-// InputStream is2 = new FileInputStream(uploadFile);
|
|
|
-//
|
|
|
-// FFmpegFrameGrabber g = new FFmpegFrameGrabber(is2);
|
|
|
-// g.start();
|
|
|
-//
|
|
|
-// Frame frame = g.grabKeyFrame();
|
|
|
-// Java2DFrameConverter converter = new Java2DFrameConverter();
|
|
|
-// BufferedImage image = converter.convert(frame);
|
|
|
-// ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
|
|
|
-// ImageIO.write(image, "jpeg", baos1);
|
|
|
-// String posterPath = String.format("application/image/%s.jpg",
|
|
|
-// new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date())
|
|
|
-// + RandomStringUtils.randomAlphabetic(8));
|
|
|
-// String posterUrl = storageService
|
|
|
-// .uploadFromInputStream(new ByteArrayInputStream(baos1.toByteArray()), posterPath);
|
|
|
-// g.stop();
|
|
|
-
|
|
|
VideoObject vo = new VideoObject();
|
|
|
// vo.setPoster(posterUrl);
|
|
|
vo.setSrc(url);
|
|
|
@@ -308,6 +285,28 @@ public class ProgrammeService {
|
|
|
return storageService.uploadFromInputStream(new FileInputStream(uploadFile), path);
|
|
|
}
|
|
|
|
|
|
+ public void excelTemp(HttpServletResponse response) throws IOException {
|
|
|
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
|
+ File file = new File(this.getClass().getResource("/templates/Programme.xlsx").getFile());
|
|
|
+ InputStream is = new FileInputStream(file);
|
|
|
+
|
|
|
+ byte[] buffer = new byte[1024];
|
|
|
+ int len;
|
|
|
+ while ((len = is.read(buffer)) > -1) {
|
|
|
+ outputStream.write(buffer, 0, len);
|
|
|
+ }
|
|
|
+ outputStream.flush();
|
|
|
+
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
+ response.setHeader("Content-Disposition", "attachment; filename=" + "Programme.xlsx");
|
|
|
+
|
|
|
+ ServletOutputStream sos = response.getOutputStream();
|
|
|
+ sos.write(outputStream.toByteArray());
|
|
|
+
|
|
|
+ sos.flush();
|
|
|
+ outputStream.close();
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional(rollbackOn = Exception.class)
|
|
|
public Map<String, String> group(Arrange arrange) {
|
|
|
boolean flag = true;
|