8f4ba851 by chentao

no message

1 parent 05d3b9f4
...@@ -308,6 +308,7 @@ public class CourseController extends BaseController { ...@@ -308,6 +308,7 @@ public class CourseController extends BaseController {
308 } else { 308 } else {
309 String originalfileName = sysOss.getOriginalName(); 309 String originalfileName = sysOss.getOriginalName();
310 String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length()); 310 String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length());
311 log.info("==========suffix=========="+suffix);
311 UploadResult uploadResult = null; 312 UploadResult uploadResult = null;
312 if (".pdf".equals(suffix)) { 313 if (".pdf".equals(suffix)) {
313 byte[] fileBytes = null; 314 byte[] fileBytes = null;
...@@ -347,6 +348,7 @@ public class CourseController extends BaseController { ...@@ -347,6 +348,7 @@ public class CourseController extends BaseController {
347 byte[] fileBytes = null; 348 byte[] fileBytes = null;
348 try { 349 try {
349 InputStream inputStream = storage.getObjectContent(sysOss.getUrl()); 350 InputStream inputStream = storage.getObjectContent(sysOss.getUrl());
351 log.info("======inputStream===="+inputStream.available());
350 ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); 352 ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
351 byte[] buffer = new byte[8192]; // 或者根据实际情况选择合适的缓冲区大小 353 byte[] buffer = new byte[8192]; // 或者根据实际情况选择合适的缓冲区大小
352 int bytesRead; 354 int bytesRead;
...@@ -356,6 +358,7 @@ public class CourseController extends BaseController { ...@@ -356,6 +358,7 @@ public class CourseController extends BaseController {
356 byteArrayOutputStream.flush(); 358 byteArrayOutputStream.flush();
357 fileBytes = byteArrayOutputStream.toByteArray(); 359 fileBytes = byteArrayOutputStream.toByteArray();
358 byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); 360 byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes);
361 log.info("======fileBytes.length===="+fileBytes.length);
359 uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); 362 uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain");
360 log.info("json==============="+uploadResult.getUrl()); 363 log.info("json==============="+uploadResult.getUrl());
361 } catch (Exception e) { 364 } catch (Exception e) {
......
...@@ -217,6 +217,8 @@ public class SysOssServiceImpl implements ISysOssService, OssService { ...@@ -217,6 +217,8 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
217 // else{ 217 // else{
218 // uploadResult = storage.upload(file.getBytes(), originalfileName, file.getContentType()); 218 // uploadResult = storage.upload(file.getBytes(), originalfileName, file.getContentType());
219 // } 219 // }
220 log.info("==========originalfileName========="+originalfileName);
221 log.info("==========getContentType========="+file.getContentType());
220 uploadResult = storage.upload(file.getBytes(), originalfileName, file.getContentType()); 222 uploadResult = storage.upload(file.getBytes(), originalfileName, file.getContentType());
221 } catch (IOException e) { 223 } catch (IOException e) {
222 throw new ServiceException(e.getMessage()); 224 throw new ServiceException(e.getMessage());
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!