| | |
| | | } |
| | | //删除图 |
| | | public void delPic(int num, int picNum,String picUrl,String newPicUrl) { |
| | | String rootFile = CommonUtil.getRootFile();//主路径 |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("num",num); |
| | | if(picNum==1){ |
| | |
| | | wrapper.set("bom_agreement",newPicUrl); |
| | | } |
| | | int flag=mapper.update(null,wrapper); |
| | | if(flag>0){ |
| | | rootFile=rootFile.replace("doc_file",""); |
| | | if(flag>0&&picUrl.length()>0){ |
| | | String rootFile = CommonUtil.getRootFile();//主路径 |
| | | picUrl=picUrl.replace("doc_file",""); |
| | | //删除图片 |
| | | FileUtil.deleteFile(new File(rootFile+picUrl)); |
| | | } |
| | |
| | | if(picNum==6){ |
| | | picUrl=bomAcceptance.getBomAgreement(); |
| | | } |
| | | //后面图 |
| | | //后面图 |
| | | if(filePic!=null){ |
| | | //存储文件 |
| | | String originalFilename = filePic.getOriginalFilename(); |
| | |
| | | //编辑多个图片上传 |
| | | public Response updatePartPic(List<MultipartFile> multipartFileList, int num) throws IOException { |
| | | String rootFile = CommonUtil.getRootFile(); |
| | | rootFile=rootFile.replace("doc_file",""); |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("num",num); |
| | | wrapper.last("limit 1"); |
| | |
| | | } |
| | | String devRoot=rootFile.replace("doc_file", ""); |
| | | List<String> devPicList=new ArrayList<>(); |
| | | if(bomAcceptance.getDevPicleft()!=null||!bomAcceptance.getDevPicleft().isEmpty()){ |
| | | devPicList.add(bomAcceptance.getDevPicleft()); |
| | | } |
| | | if(bomAcceptance.getDevPicright()!=null||!bomAcceptance.getDevPicright().isEmpty()){ |
| | | devPicList.add(bomAcceptance.getDevPicright()); |
| | | } |
| | | if(bomAcceptance.getDevPicfront()!=null||!bomAcceptance.getDevPicfront().isEmpty()){ |
| | | devPicList.add(bomAcceptance.getDevPicfront()); |
| | | } |
| | | if(bomAcceptance.getDevPicback()!=null||!bomAcceptance.getDevPicback().isEmpty()){ |
| | | devPicList.add(bomAcceptance.getDevPicback()); |
| | | } |
| | | |
| | | devPicList.add(bomAcceptance.getDevPicleft()); |
| | | devPicList.add(bomAcceptance.getDevPicfront()); |
| | | devPicList.add(bomAcceptance.getDevPicright()); |
| | | devPicList.add(bomAcceptance.getDevPicback()); |
| | | String fileName="产品验收信息记录"; |
| | | //创建单个sheet |
| | | HSSFWorkbook wb = new HSSFWorkbook(); |
| | |
| | | ByteArrayOutputStream byteArrayOut = null; |
| | | for(int i=0;i<devPicList.size();i++){ |
| | | String picUrl=devPicList.get(i); |
| | | if(picUrl.length()==0){ |
| | | continue; |
| | | } |
| | | try { |
| | | byteArrayOut = new ByteArrayOutputStream(); |
| | | String path=devRoot+File.separator+picUrl; |
| | |
| | | cell=row.createCell(1); |
| | | if(bomAcceptance.getBomAgreement()!=null||!bomAcceptance.getBomAgreement().equals("")){ |
| | | String agreement=bomAcceptance.getBomAgreement(); |
| | | String agreementName = agreement.substring(agreement.lastIndexOf(".")+1); |
| | | String agreementName = agreement.substring(agreement.lastIndexOf(File.separator)+1); |
| | | agreementName = agreementName.substring(0,agreementName.lastIndexOf(".")); |
| | | cell.setCellValue(agreementName); |
| | | cell.setCellStyle(cellStyle); |
| | | } |