| | |
| | | import com.whyc.dto.FileDirPath; |
| | | import com.whyc.dto.MailDTO; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.ZipUtils; |
| | | import com.whyc.mapper.BOMFeedbakMapper; |
| | | import com.whyc.mapper.DocUserMapper; |
| | | import com.whyc.mapper.ProductHistoryMapper; |
| | |
| | | //查询发送者反馈不同状态 |
| | | public Response getSenderStatus(int[] flags,int pageCurr,int pageSize) { |
| | | PageHelper.startPage(pageCurr,pageSize); |
| | | List list=mapper.getSenderStatus(ActionUtil.getUser().getId(),flags); |
| | | List<BOMFeedback> list=mapper.getSenderStatus(ActionUtil.getUser().getId(),flags); |
| | | //获取路径 |
| | | String fileDirName = FileDirPath.getFileDirName(); |
| | | if(list!=null&&list.size()>0){ |
| | | for (int i=0;i<list.size();i++) { |
| | | BOMFeedback feedback=list.get(i); |
| | | String attachFilePath=fileDirName+File.separator+feedback.getFile(); |
| | | File start = new File(attachFilePath); |
| | | String[] files =new String[]{}; |
| | | List attachList=new ArrayList(); |
| | | if(start.exists()) { |
| | | files= start.list();//获取该文件夹下的所有文件名字 |
| | | if(files.length>=0){ |
| | | for(int j=0;j<files.length;j++) { |
| | | attachList.add(feedback.getFile()+files[j]); |
| | | } |
| | | } |
| | | } |
| | | feedback.setAttachFiles(attachList); |
| | | } |
| | | } |
| | | PageInfo pageInfo = new PageInfo(list); |
| | | return new Response().setII(1,list.size()>0,pageInfo,"发送者反馈"); |
| | | } |
| | |
| | | PageHelper.startPage(pageCurr,pageSize); |
| | | String name=ActionUtil.getUser().getName(); |
| | | long id=ActionUtil.getUser().getId(); |
| | | List list=new ArrayList(); |
| | | List<BOMFeedback> list=new ArrayList(); |
| | | if(name.equals("杨红兰")){ |
| | | //当是杨红兰查看时,只有杨红兰的排在最前面 |
| | | list=mapper.getRecevierYHL(id,name,flags); |
| | | }else{ |
| | | list=mapper.getRecevierStatus(id,flags); |
| | | } |
| | | //获取路径 |
| | | String fileDirName = FileDirPath.getFileDirName(); |
| | | if(list!=null&&list.size()>0){ |
| | | for (int i=0;i<list.size();i++) { |
| | | BOMFeedback feedback=list.get(i); |
| | | String attachFilePath=fileDirName+File.separator+feedback.getFile(); |
| | | File start = new File(attachFilePath); |
| | | String[] files =new String[]{}; |
| | | List attachList=new ArrayList(); |
| | | if(start.exists()) { |
| | | files= start.list();//获取该文件夹下的所有文件名字 |
| | | if(files.length>=0){ |
| | | for(int j=0;j<files.length;j++) { |
| | | attachList.add(feedback.getFile()+files[j]); |
| | | } |
| | | } |
| | | } |
| | | feedback.setAttachFiles(attachList); |
| | | } |
| | | } |
| | | PageInfo pageInfo = new PageInfo(list); |
| | | return new Response().setII(1,list.size()>0,pageInfo,"接收者反馈"); |
| | |
| | | //压缩包的路径及格式为: doc_file/feedback_bom/username_time.zip |
| | | String username = ActionUtil.getUser().getName(); |
| | | long time = date.getTime(); |
| | | String feedbackZipPath = "feedback_bom" + File.separator + username + "_" + time+".zip"; |
| | | List<File> fileList = new LinkedList<>(); |
| | | //String feedbackZipPath = "feedback_bom" + File.separator + username + "_" + time+".zip"; |
| | | //List<File> fileList = new LinkedList<>(); |
| | | String rootFile = CommonUtil.getRootFile(); |
| | | if(multipartFileList!=null && multipartFileList.size()!=0){ |
| | | String feedbackDirSuffix = "feedback_bom" + File.separator + username + File.separator + time + File.separator; |
| | | String feedbackDir = rootFile + feedbackDirSuffix; |
| | | File fileDir = new File(feedbackDir); |
| | | if (!fileDir.exists()) { |
| | | fileDir.mkdirs(); |
| | | } |
| | | for (int i = 0; i < multipartFileList.size(); i++) { |
| | | MultipartFile multipartFile = multipartFileList.get(i); |
| | | //存储文件 |
| | |
| | | String originalFilename = multipartFile.getOriginalFilename(); |
| | | String fileName = originalFilename.substring(0, originalFilename.lastIndexOf(".")); |
| | | String suffix = originalFilename.substring(originalFilename.lastIndexOf(".")); |
| | | String feedbackPath = "feedback_bom" + File.separator + fileName + "_" + time + suffix; |
| | | File file = new File(rootFile + feedbackPath); |
| | | if (!file.exists()) { |
| | | file.mkdirs(); |
| | | } |
| | | String feedbackPath = feedbackDir + fileName + suffix; |
| | | File file = new File(feedbackPath); |
| | | |
| | | multipartFile.transferTo(file); |
| | | fileList.add(file); |
| | | //fileList.add(file); |
| | | } |
| | | ZipUtils.toZip(fileList,new FileOutputStream(new File(rootFile+feedbackZipPath))); |
| | | feedback.setFile("doc_file" + File.separator + feedbackZipPath); |
| | | //ZipUtils.toZip(fileList,new FileOutputStream(new File(rootFile+feedbackZipPath))); |
| | | feedback.setFile("doc_file" + File.separator + feedbackDirSuffix); |
| | | } |
| | | //删除已经被压缩的文件 |
| | | for (File file : fileList) { |
| | | file.delete(); |
| | | } |
| | | //for (File file : fileList) { |
| | | // file.delete(); |
| | | //} |
| | | //保存 |
| | | feedback.setCreateTime(date); |
| | | feedback.setConfirmStatus(0); |
| | |
| | | public Response getListPage(BOMFeedback feedback, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<BOMFeedback> list = mapper.getListPage(feedback); |
| | | //获取路径 |
| | | String fileDirName = FileDirPath.getFileDirName(); |
| | | if(list!=null&&list.size()>0){ |
| | | for (int i=0;i<list.size();i++) { |
| | | BOMFeedback fb=list.get(i); |
| | | String attachFilePath=fileDirName+File.separator+fb.getFile(); |
| | | File start = new File(attachFilePath); |
| | | String[] files =new String[]{}; |
| | | List attachList=new ArrayList(); |
| | | if(start.exists()) { |
| | | files= start.list();//获取该文件夹下的所有文件名字 |
| | | if(files.length>=0){ |
| | | for(int j=0;j<files.length;j++) { |
| | | attachList.add(fb.getFile()+files[j]); |
| | | } |
| | | } |
| | | } |
| | | fb.setAttachFiles(attachList); |
| | | } |
| | | } |
| | | PageInfo pageInfo = new PageInfo(list); |
| | | return new Response().set(1,pageInfo); |
| | | |