admin
2020-05-12 2ec42a5aacea35d2918f0e17f07685cf5b4d25c8
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -253,6 +253,31 @@
      }
      return null;
   }
   private ImgInfo uploadOriginalPicture(MultipartFile file) {
      try {
         InputStream inputStream = file.getInputStream();
         String contentType = file.getContentType();
         String type = contentType.substring(contentType.indexOf("/") + 1);
         String filePath = FilePathEnum.goodsEvaluate.getPath() + UUID.randomUUID().toString().replace("-", "") + "."+ type;
         BufferedImage sourceImg = ImageIO.read(inputStream);
         ImgInfo info = new ImgInfo();
         int width = sourceImg.getWidth();
         int height = sourceImg.getHeight();
         String picLink = COSManager.getInstance().uploadFile(file.getInputStream(), filePath).getUrl();
         info.setH(height);
         info.setW(width);
         info.setUrl(picLink);
         return info;
      } catch (Exception e) {
         e.printStackTrace();
      }
      return null;
   }
   private String uploadPicture(File file, String contentType) throws Exception {
      InputStream inputStream = new FileInputStream(file);
@@ -1104,7 +1129,7 @@
         for (int i = 0; i < 9; i++) {
            MultipartFile file = fileRequest.getFile("file" + i);
            if (file != null) {
               ImgInfo info = uploadVideoPicture(file);
               ImgInfo info = uploadOriginalPicture(file);
               ImgInfo imgInfo0 = new ImgInfo();
               imgInfo0.setId(UUID.randomUUID().toString().replace("-", ""));
               imgInfo0.setLarge(false);
@@ -1138,6 +1163,11 @@
         }
      }
      
      // 一张图显示为大图
      if (tempList.size() == 1) {
         tempList.get(0).setLarge(true);
      }
      if (tempList.size() > 0) {
         listImg.addAll(tempList);
      }