no message
Showing
4 changed files
with
22 additions
and
28 deletions
| ... | @@ -151,7 +151,7 @@ public class CourseController extends BaseController { | ... | @@ -151,7 +151,7 @@ public class CourseController extends BaseController { |
| 151 | fileBytes = byteArrayOutputStream.toByteArray(); | 151 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 152 | log.info("======fileBytes.length===="+fileBytes.length); | 152 | log.info("======fileBytes.length===="+fileBytes.length); |
| 153 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 153 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 154 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 154 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/json"); |
| 155 | } catch (Exception e) { | 155 | } catch (Exception e) { |
| 156 | log.info(e.getMessage()); | 156 | log.info(e.getMessage()); |
| 157 | } | 157 | } |
| ... | @@ -168,7 +168,7 @@ public class CourseController extends BaseController { | ... | @@ -168,7 +168,7 @@ public class CourseController extends BaseController { |
| 168 | byteArrayOutputStream.flush(); | 168 | byteArrayOutputStream.flush(); |
| 169 | fileBytes = byteArrayOutputStream.toByteArray(); | 169 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 170 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 170 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 171 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 171 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/octet-stream"); |
| 172 | } catch (Exception e) { | 172 | } catch (Exception e) { |
| 173 | log.info(e.getMessage()); | 173 | log.info(e.getMessage()); |
| 174 | } | 174 | } |
| ... | @@ -253,7 +253,7 @@ public class CourseController extends BaseController { | ... | @@ -253,7 +253,7 @@ public class CourseController extends BaseController { |
| 253 | byteArrayOutputStream.flush(); | 253 | byteArrayOutputStream.flush(); |
| 254 | fileBytes = byteArrayOutputStream.toByteArray(); | 254 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 255 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 255 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 256 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 256 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/json"); |
| 257 | } catch (Exception e) { | 257 | } catch (Exception e) { |
| 258 | log.info(e.getMessage()); | 258 | log.info(e.getMessage()); |
| 259 | } | 259 | } |
| ... | @@ -270,7 +270,7 @@ public class CourseController extends BaseController { | ... | @@ -270,7 +270,7 @@ public class CourseController extends BaseController { |
| 270 | byteArrayOutputStream.flush(); | 270 | byteArrayOutputStream.flush(); |
| 271 | fileBytes = byteArrayOutputStream.toByteArray(); | 271 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 272 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 272 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 273 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 273 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/octet-stream"); |
| 274 | } catch (Exception e) { | 274 | } catch (Exception e) { |
| 275 | log.info(e.getMessage()); | 275 | log.info(e.getMessage()); |
| 276 | } | 276 | } |
| ... | @@ -359,7 +359,7 @@ public class CourseController extends BaseController { | ... | @@ -359,7 +359,7 @@ public class CourseController extends BaseController { |
| 359 | fileBytes = byteArrayOutputStream.toByteArray(); | 359 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 360 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 360 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 361 | log.info("======fileBytes.length===="+fileBytes.length); | 361 | log.info("======fileBytes.length===="+fileBytes.length); |
| 362 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 362 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/json"); |
| 363 | log.info("json==============="+uploadResult.getUrl()); | 363 | log.info("json==============="+uploadResult.getUrl()); |
| 364 | } catch (Exception e) { | 364 | } catch (Exception e) { |
| 365 | log.error(e.getMessage()); | 365 | log.error(e.getMessage()); |
| ... | @@ -377,7 +377,7 @@ public class CourseController extends BaseController { | ... | @@ -377,7 +377,7 @@ public class CourseController extends BaseController { |
| 377 | byteArrayOutputStream.flush(); | 377 | byteArrayOutputStream.flush(); |
| 378 | fileBytes = byteArrayOutputStream.toByteArray(); | 378 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 379 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 379 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 380 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 380 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/octet-stream"); |
| 381 | } catch (Exception e) { | 381 | } catch (Exception e) { |
| 382 | log.info(e.getMessage()); | 382 | log.info(e.getMessage()); |
| 383 | } | 383 | } |
| ... | @@ -462,7 +462,7 @@ public class CourseController extends BaseController { | ... | @@ -462,7 +462,7 @@ public class CourseController extends BaseController { |
| 462 | byteArrayOutputStream.flush(); | 462 | byteArrayOutputStream.flush(); |
| 463 | fileBytes = byteArrayOutputStream.toByteArray(); | 463 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 464 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 464 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 465 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 465 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/json"); |
| 466 | } catch (Exception e) { | 466 | } catch (Exception e) { |
| 467 | log.info(e.getMessage()); | 467 | log.info(e.getMessage()); |
| 468 | } | 468 | } |
| ... | @@ -479,7 +479,7 @@ public class CourseController extends BaseController { | ... | @@ -479,7 +479,7 @@ public class CourseController extends BaseController { |
| 479 | byteArrayOutputStream.flush(); | 479 | byteArrayOutputStream.flush(); |
| 480 | fileBytes = byteArrayOutputStream.toByteArray(); | 480 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 481 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 481 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 482 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 482 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/octet-stream"); |
| 483 | } catch (Exception e) { | 483 | } catch (Exception e) { |
| 484 | log.info(e.getMessage()); | 484 | log.info(e.getMessage()); |
| 485 | } | 485 | } |
| ... | @@ -564,7 +564,7 @@ public class CourseController extends BaseController { | ... | @@ -564,7 +564,7 @@ public class CourseController extends BaseController { |
| 564 | byteArrayOutputStream.flush(); | 564 | byteArrayOutputStream.flush(); |
| 565 | fileBytes = byteArrayOutputStream.toByteArray(); | 565 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 566 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 566 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 567 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 567 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/json"); |
| 568 | } catch (Exception e) { | 568 | } catch (Exception e) { |
| 569 | log.info(e.getMessage()); | 569 | log.info(e.getMessage()); |
| 570 | } | 570 | } |
| ... | @@ -581,7 +581,7 @@ public class CourseController extends BaseController { | ... | @@ -581,7 +581,7 @@ public class CourseController extends BaseController { |
| 581 | byteArrayOutputStream.flush(); | 581 | byteArrayOutputStream.flush(); |
| 582 | fileBytes = byteArrayOutputStream.toByteArray(); | 582 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 583 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 583 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 584 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 584 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/octet-stream"); |
| 585 | } catch (Exception e) { | 585 | } catch (Exception e) { |
| 586 | log.info(e.getMessage()); | 586 | log.info(e.getMessage()); |
| 587 | } | 587 | } |
| ... | @@ -666,7 +666,7 @@ public class CourseController extends BaseController { | ... | @@ -666,7 +666,7 @@ public class CourseController extends BaseController { |
| 666 | byteArrayOutputStream.flush(); | 666 | byteArrayOutputStream.flush(); |
| 667 | fileBytes = byteArrayOutputStream.toByteArray(); | 667 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 668 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 668 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 669 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 669 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/json"); |
| 670 | } catch (Exception e) { | 670 | } catch (Exception e) { |
| 671 | log.info(e.getMessage()); | 671 | log.info(e.getMessage()); |
| 672 | } | 672 | } |
| ... | @@ -683,7 +683,7 @@ public class CourseController extends BaseController { | ... | @@ -683,7 +683,7 @@ public class CourseController extends BaseController { |
| 683 | byteArrayOutputStream.flush(); | 683 | byteArrayOutputStream.flush(); |
| 684 | fileBytes = byteArrayOutputStream.toByteArray(); | 684 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 685 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 685 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 686 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 686 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/octet-stream"); |
| 687 | } catch (Exception e) { | 687 | } catch (Exception e) { |
| 688 | log.info(e.getMessage()); | 688 | log.info(e.getMessage()); |
| 689 | } | 689 | } |
| ... | @@ -770,7 +770,7 @@ public class CourseController extends BaseController { | ... | @@ -770,7 +770,7 @@ public class CourseController extends BaseController { |
| 770 | byteArrayOutputStream.flush(); | 770 | byteArrayOutputStream.flush(); |
| 771 | fileBytes = byteArrayOutputStream.toByteArray(); | 771 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 772 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 772 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 773 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 773 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/json"); |
| 774 | } catch (Exception e) { | 774 | } catch (Exception e) { |
| 775 | log.info(e.getMessage()); | 775 | log.info(e.getMessage()); |
| 776 | } | 776 | } |
| ... | @@ -788,7 +788,7 @@ public class CourseController extends BaseController { | ... | @@ -788,7 +788,7 @@ public class CourseController extends BaseController { |
| 788 | byteArrayOutputStream.flush(); | 788 | byteArrayOutputStream.flush(); |
| 789 | fileBytes = byteArrayOutputStream.toByteArray(); | 789 | fileBytes = byteArrayOutputStream.toByteArray(); |
| 790 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); | 790 | byte[] encryptBytes = EncryptUtils.encryptByAes(fileBytes); |
| 791 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "text/plain"); | 791 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, "application/octet-stream"); |
| 792 | } catch (Exception e) { | 792 | } catch (Exception e) { |
| 793 | log.info(e.getMessage()); | 793 | log.info(e.getMessage()); |
| 794 | } | 794 | } | ... | ... |
| ... | @@ -136,7 +136,6 @@ security: | ... | @@ -136,7 +136,6 @@ security: |
| 136 | # actuator 监控配置 | 136 | # actuator 监控配置 |
| 137 | - /actuator | 137 | - /actuator |
| 138 | - /actuator/** | 138 | - /actuator/** |
| 139 | - /core/course/encrypt | ||
| 140 | 139 | ||
| 141 | # MyBatisPlus配置 | 140 | # MyBatisPlus配置 |
| 142 | # https://baomidou.com/config/ | 141 | # https://baomidou.com/config/ | ... | ... |
| ... | @@ -163,9 +163,7 @@ public class OssClient { | ... | @@ -163,9 +163,7 @@ public class OssClient { |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | public InputStream getObjectContent(String path) { | 165 | public InputStream getObjectContent(String path) { |
| 166 | path = path.replace("http://bp.douyaedu.com/legao/", ""); | 166 | path = path.replace(getUrl() + "/", ""); |
| 167 | log.info("============path==========="+path); | ||
| 168 | log.info("============properties.getBucketName()==========="+properties.getBucketName()); | ||
| 169 | S3Object object = client.getObject(properties.getBucketName(), path); | 167 | S3Object object = client.getObject(properties.getBucketName(), path); |
| 170 | return object.getObjectContent(); | 168 | return object.getObjectContent(); |
| 171 | } | 169 | } | ... | ... |
| ... | @@ -210,16 +210,13 @@ public class SysOssServiceImpl implements ISysOssService, OssService { | ... | @@ -210,16 +210,13 @@ public class SysOssServiceImpl implements ISysOssService, OssService { |
| 210 | OssClient storage = OssFactory.instance(); | 210 | OssClient storage = OssFactory.instance(); |
| 211 | UploadResult uploadResult; | 211 | UploadResult uploadResult; |
| 212 | try { | 212 | try { |
| 213 | // if(".pdf".equals(suffix) || ".mp4".equals(suffix) || ".json".equals(suffix) || ".ldr".equals(suffix)) { | 213 | if(".pdf".equals(suffix) || ".mp4".equals(suffix) || ".json".equals(suffix) || ".ldr".equals(suffix)) { |
| 214 | // byte[] encryptBytes = EncryptUtils.encryptByAes(file.getBytes()); | 214 | byte[] encryptBytes = EncryptUtils.encryptByAes(file.getBytes()); |
| 215 | // uploadResult = storage.uploadSuffix(encryptBytes, suffix, file.getContentType()); | 215 | uploadResult = storage.uploadSuffix(encryptBytes, suffix, file.getContentType()); |
| 216 | // } | 216 | } |
| 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()); | ||
| 222 | uploadResult = storage.upload(file.getBytes(), originalfileName, file.getContentType()); | ||
| 223 | } catch (IOException e) { | 220 | } catch (IOException e) { |
| 224 | throw new ServiceException(e.getMessage()); | 221 | throw new ServiceException(e.getMessage()); |
| 225 | } | 222 | } | ... | ... |
-
Please register or sign in to post a comment