| | |
| | | flag=true; |
| | | for (int i=0;i<fileNames.length;i++){ |
| | | if(!fileNames[i].contains("-dwg.pdf")&&!fileNames[i].contains("-doc.pdf")) |
| | | list.add(material.getFileUrl()+fileNames[i]); |
| | | list.add(material.getFileUrl()+File.separator+fileNames[i]); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return new Response().setII(1,flag,list,"文件列表返回"); |
| | | } |
| | | //根据物料型号('-','_'之前的部分)查询物料的历史版本 |
| | | public Response getMaterialVersion(String subModel) { |
| | | List list=mapper.getMaterialVersion(subModel); |
| | | return new Response().setII(1,list.size()>0,list,"物料历史版本数据返回"); |
| | | } |
| | | //根据物料id查询物料信息 |
| | | public Response getMaterialById(int materialId) { |
| | | Material material=mapper.getMaterialById(materialId); |
| | | String fileDirName = FileDirPath.getFileDirName(); |
| | | List list=new ArrayList(); |
| | | if(material.getFileUrl()!=null&&!material.getFileUrl().isEmpty()){ |
| | | File file = new File(fileDirName+File.separator+material.getFileUrl()); |
| | | if(file.exists()) { |
| | | String[] fileNames = file.list();//获取该文件夹下的所有文件以及目录的名字 |
| | | if(fileNames.length>0){ |
| | | for (int i=0;i<fileNames.length;i++){ |
| | | if(!fileNames[i].contains("-dwg.pdf")&&!fileNames[i].contains("-doc.pdf")) |
| | | list.add(material.getFileUrl()+File.separator+fileNames[i]); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | return new Response().setIII(1,material!=null,material,list,"物料历史版本数据返回"); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param multipartFile 被追加的附件 |
| | | * @param material |
| | | * @return 返回被追加文件的文件夹路径 |
| | | */ |
| | | public Response addAttachment(MultipartFile multipartFile, Material material) { |
| | | String dirPath = "doc_file" + File.separator + "material" + File.separator + material.getId() + material.getSubCode() + material.getSubModel(); |
| | | //TODO |
| | | return new Response().setII(1,"上传完成"); |
| | | } |
| | | } |