| | |
| | | } |
| | | String suffix = pictureData.suggestFileExtension(); |
| | | String picturePath = approvingPath + File.separator + bom.getSubModel() + "." + suffix; |
| | | String picturePathFront = "doc_file" + File.separator + "product_submit" + File.separator + user.getName() + File.separator + dateFormat + File.separator + timeStamp + File.separator + bom.getSubModel() + "." + suffix; |
| | | String picturePathFront = "doc_file" + File.separator + "product_submit" + File.separator + user.getName() + File.separator + dateFormat + File.separator + timeStamp + File.separator + bom.getSubModel() + "-bom." + suffix; |
| | | byte[] data = pictureData.getData(); |
| | | FileOutputStream fileOutputStream = null; |
| | | File pictureFile = new File(picturePath); |
| | |
| | | File file = new File(fileUrl); |
| | | List<String> fileUrlList = new LinkedList<>(); |
| | | List<String> excelExcludeUrlList = null; |
| | | List<String> picUrlList = null; |
| | | List<String> picUrlList = new LinkedList<>(); |
| | | //存于物料下,bom内有对应 |
| | | List<String> materialUrlList = new LinkedList<>(); |
| | | //存于产品下,bom内没对应 |
| | |
| | | fileUrlList = FileUtil.getStaticFilePath(file, fileUrlList); |
| | | //图纸dwg 子件/产品 |
| | | excelExcludeUrlList = fileUrlList.stream().filter(url -> !(url.contains(".xls") || url.contains(".xlsx"))).collect(Collectors.toList()); |
| | | picUrlList = fileUrlList.stream().filter(url -> url.contains(".png") || url.contains(".jpeg")).collect(Collectors.toList()); |
| | | //picUrlList = fileUrlList.stream().filter(url -> url.contains(".png") || url.contains(".jpeg")).collect(Collectors.toList()); |
| | | |
| | | List<ProductBom> finalBomList = bomList; |
| | | excelExcludeUrlList.forEach(excelExcludeUr -> { |
| | | boolean existFlag = false; |
| | | for (ProductBom bom : finalBomList) { |
| | | String filename = excelExcludeUr.substring(excelExcludeUr.lastIndexOf(File.separator) + 1, excelExcludeUr.length() - 4); |
| | | String filename = excelExcludeUr.substring(excelExcludeUr.lastIndexOf(File.separator) + 1, excelExcludeUr.lastIndexOf(".")); |
| | | String fileFullName = excelExcludeUr.substring(excelExcludeUr.lastIndexOf(File.separator) + 1); |
| | | if (bom.getSubModel().toUpperCase().equals(filename.toUpperCase()) && excelExcludeUr.substring(excelExcludeUr.lastIndexOf(".")+1).equals("dwg")) { |
| | | materialUrlList.add(excelExcludeUr); |
| | |
| | | + File.separator + fileFullName); |
| | | break; |
| | | } |
| | | else if((bom.getSubModel().toUpperCase()+"-BOM").equals(filename.toUpperCase()) && (excelExcludeUr.substring(excelExcludeUr.lastIndexOf(".")+1).equals("png") ||excelExcludeUr.substring(excelExcludeUr.lastIndexOf(".")+1).equals("jpeg")) |
| | | ){ |
| | | picUrlList.add(excelExcludeUr); |
| | | existFlag = true; |
| | | |
| | | |
| | | bom.setPictureUrl("doc_file" + File.separator + "material" |
| | | + File.separator + fileFullName); |
| | | break; |
| | | } |
| | | } |
| | | if (!existFlag) { |
| | | productUrlList.add(excelExcludeUr); |
| | | } |
| | | }); |
| | | |
| | | //一定是有对应物料的,从bom内剥离的 |
| | | /*//一定是有对应物料的,包含从bom内剥离的(删除掉:上面已经处理) |
| | | picUrlList.forEach(picUrl -> { |
| | | for (ProductBom bom : finalBomList) { |
| | | String filename = picUrl.substring(picUrl.lastIndexOf(File.separator) + 1, picUrl.lastIndexOf(".")); |
| | | String fileFullName = picUrl.substring(picUrl.lastIndexOf(File.separator) + 1); |
| | | if (bom.getSubModel().toUpperCase().equals(filename.toUpperCase())) { |
| | | if ((bom.getSubModel().toUpperCase()+"-BOM").equals(filename.toUpperCase())) { |
| | | bom.setPictureUrl("doc_file" + File.separator + "material" |
| | | + File.separator + fileFullName); |
| | | break; |
| | | } |
| | | } |
| | | }); |
| | | });*/ |
| | | |
| | | //转移路径 |
| | | String projectDir = CommonUtil.getProjectDir(); |