Administrator
2020-02-23 434aac7e177dc414131d87bd1b23ecfce1fc8c55
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -771,7 +771,8 @@
      ImgInfo imgVideo = null;
      List<String> listDel = new ArrayList<String>();
      List<String> listOld = new ArrayList<String>();
      List<ImgInfo> listOldImgInfo = new ArrayList<ImgInfo>();
      // 处理图片
      List<ImgInfo> resultList = resultObj.getImgList();
      if (resultList != null && resultList.size() > 0) {
@@ -780,6 +781,7 @@
            if (type == ImgEnum.video) {
               imgVideo = info;
            } else if (type == ImgEnum.img) {
               listOldImgInfo.add(info);
               String url = info.getUrl();
               if (!StringUtil.isNullOrEmpty(url)) {
                  listOld.add(url);
@@ -850,29 +852,38 @@
               if (fileRequest != null) {
                  MultipartFile file = fileRequest.getFile("file" + i);
                  if (file != null) {
                     InputStream inputStream = file.getInputStream();
                     BufferedImage sourceImg = ImageIO.read(inputStream);
                     int width = sourceImg.getWidth();
                     int height = sourceImg.getHeight();
                     picLink = uploadPicture(file);
                     ImgInfo imgInfo0 = new ImgInfo();
                     imgInfo0.setId(UUID.randomUUID().toString().replace("-", ""));
                     imgInfo0.setLarge(false);
                     imgInfo0.setPid(pid);
                     imgInfo0.setUrl(listpic.get(i));
                     imgInfo0.setUrlHD(listpic.get(i));
                     imgInfo0.setType(ImgEnum.img);
                     imgVideo.setW(width);
                     imgVideo.setH(height);
                     listImg.add(imgInfo0);
                     continue;
                  }
               }
               
               if (picLink.startsWith("http")) {
                  listpic.add(picLink);
                  if(listOldImgInfo != null) {
                     for (ImgInfo imgInfo:listOldImgInfo) {
                        String url = imgInfo.getUrl();
                        if (picLink.equals(url)){
                           listImg.add(imgInfo);
                           break;
                        }
                     }
                  }
               }
            }
         }
      }
      if (listpic != null && listpic.size() > 0) {
         for (int i = 0; i < listpic.size(); i++) {
            ImgInfo imgInfo0 = new ImgInfo();
            imgInfo0.setId(UUID.randomUUID().toString().replace("-", ""));
            imgInfo0.setW(1);
            imgInfo0.setH(1);
            imgInfo0.setLarge(false);
            imgInfo0.setPid(pid);
            imgInfo0.setUrl(listpic.get(i));
            imgInfo0.setUrlHD(listpic.get(i));
            imgInfo0.setType(ImgEnum.img);
            listImg.add(imgInfo0);
         }
      }