| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.FileUrlDTO; |
| | | import com.whyc.dto.Response; |
| | |
| | | }else { |
| | | File file = new File(fileUrl); |
| | | List<String> fileUrlList = new LinkedList<>(); |
| | | List<String> dwgUrlList = null; |
| | | List<String> excelExcludeUrlList = null; |
| | | List<String> picUrlList = null; |
| | | //存于物料下,bom内有对应 |
| | | List<String> materialUrlList = new LinkedList<>(); |
| | |
| | | |
| | | fileUrlList = FileUtil.getStaticFilePath(file, fileUrlList); |
| | | //图纸dwg 子件/产品 |
| | | dwgUrlList = fileUrlList.stream().filter(url -> url.contains(".dwg")).collect(Collectors.toList()); |
| | | 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()); |
| | | |
| | | List<ProductBom> finalBomList = bomList; |
| | | dwgUrlList.forEach(dwgUrl -> { |
| | | excelExcludeUrlList.forEach(excelExcludeUr -> { |
| | | boolean existFlag = false; |
| | | for (ProductBom bom : finalBomList) { |
| | | String filename = dwgUrl.substring(dwgUrl.lastIndexOf(File.separator) + 1, dwgUrl.length() - 4); |
| | | String fileFullName = dwgUrl.substring(dwgUrl.lastIndexOf(File.separator) + 1); |
| | | if (bom.getSubModel().toUpperCase().equals(filename.toUpperCase())) { |
| | | materialUrlList.add(dwgUrl); |
| | | String filename = excelExcludeUr.substring(excelExcludeUr.lastIndexOf(File.separator) + 1, excelExcludeUr.length() - 4); |
| | | 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); |
| | | existFlag = true; |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | if (!existFlag) { |
| | | productUrlList.add(dwgUrl); |
| | | productUrlList.add(excelExcludeUr); |
| | | } |
| | | }); |
| | | |
| | |
| | | materialFile.mkdirs(); |
| | | } |
| | | productUrlList.forEach(productUrl -> { |
| | | String dwgName = productUrl.substring(productUrl.lastIndexOf(File.separator) + 1, productUrl.length() - 4); |
| | | String fileName = productUrl.substring(productUrl.lastIndexOf(File.separator) + 1); |
| | | |
| | | try { |
| | | FileCopyUtils.copy(new File(productUrl), new File(productDir + File.separator + dwgName + ".dwg")); |
| | | FileCopyUtils.copy(new File(productUrl), new File(productDir + File.separator + fileName)); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |