| | |
| | | private BomAcceptanceMapper mapper; |
| | | |
| | | //上传产品验收信息 |
| | | public Response uploadBomAcceptance(MultipartFile fileLeft, MultipartFile fileRight, MultipartFile fileFront, MultipartFile fileBack, List<MultipartFile> multipartFileList, BomAcceptance bomAcceptance) throws IOException { |
| | | public Response uploadBomAcceptance(MultipartFile fileLeft, MultipartFile fileRight, MultipartFile fileFront, MultipartFile fileBack |
| | | ,MultipartFile Agreement, List<MultipartFile> multipartFileList, BomAcceptance bomAcceptance) throws IOException { |
| | | Date date = new Date(); |
| | | long time = date.getTime(); |
| | | String rootFile = CommonUtil.getRootFile(); |
| | |
| | | fileFront.transferTo(new File(path)); |
| | | bomAcceptance.setDevPicfront("doc_file" + File.separator + devDirSuffix+originalFilename); |
| | | } |
| | | //左视图 |
| | | //后面图 |
| | | if(fileBack!=null){ |
| | | //存储文件 |
| | | String originalFilename = fileBack.getOriginalFilename(); |
| | |
| | | createFilefolderIFNotExist(path); |
| | | fileBack.transferTo(new File(path)); |
| | | bomAcceptance.setDevPicback("doc_file" + File.separator + devDirSuffix+originalFilename); |
| | | } |
| | | String agreeDirSuffix = "acceptance_bom" + File.separator + time + File.separator+ "agree" + File.separator; |
| | | String agreeDir = rootFile + agreeDirSuffix; |
| | | //协议 |
| | | if(Agreement!=null){ |
| | | //存储文件 |
| | | String originalFilename = Agreement.getOriginalFilename(); |
| | | String fileName = originalFilename.substring(0, originalFilename.lastIndexOf(".")); |
| | | String suffix = originalFilename.substring(originalFilename.lastIndexOf(".")); |
| | | String path = agreeDir + fileName + suffix; |
| | | createFilefolderIFNotExist(path); |
| | | Agreement.transferTo(new File(path)); |
| | | bomAcceptance.setBomAgreement("doc_file" + File.separator + agreeDirSuffix+originalFilename); |
| | | } |
| | | mapper.insert(bomAcceptance); |
| | | return new Response().set(1,true,"上传成功"); |
| | |
| | | if(list!=null&&list.size()>0){ |
| | | for (BomAcceptance acceptance:list) { |
| | | String filePath=rootFile+acceptance.getSparePicpart(); |
| | | acceptance.setSparePicpart("doc_file"+File.separator+acceptance.getSparePicpart()); |
| | | //获取文件夹下所有的图片名 |
| | | acceptance.setNameList(FileUtil.getFileNameWithOutDirectory(filePath)); |
| | | } |