| | |
| | | import com.whyc.dto.FileDirPath; |
| | | import com.whyc.dto.MailDTO; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.*; |
| | | import com.whyc.mapper.BOMFeedbakMapper; |
| | | import com.whyc.mapper.DocUserMapper; |
| | | import com.whyc.mapper.ProductHistoryMapper; |
| | | import com.whyc.pojo.BOMFeedback; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.pojo.Product; |
| | | import com.whyc.pojo.ProductHistory; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.DateUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Resource |
| | | private ProductHistoryMapper phisMapper; |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | //统计 |
| | | public Map<String, Integer> getFkStatistic(DocUser user,Map<String, Integer> map) { |
| | | int sendFk=0; |
| | |
| | | if(list!=null&&list.size()>0){ |
| | | for (int i=0;i<list.size();i++) { |
| | | BOMFeedback feedback=list.get(i); |
| | | fileDirName=fileDirName+File.separator+feedback.getFile(); |
| | | File start = new File(fileDirName); |
| | | 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()+File.separator+files[j]); |
| | | attachList.add(feedback.getFile()+files[j]); |
| | | } |
| | | } |
| | | } |
| | |
| | | if(list!=null&&list.size()>0){ |
| | | for (int i=0;i<list.size();i++) { |
| | | BOMFeedback feedback=list.get(i); |
| | | fileDirName=fileDirName+File.separator+feedback.getFile(); |
| | | File start = new File(fileDirName); |
| | | 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()+File.separator+files[j]); |
| | | attachList.add(feedback.getFile()+files[j]); |
| | | } |
| | | } |
| | | } |
| | |
| | | * @param feedback |
| | | * @return |
| | | */ |
| | | @Transactional |
| | | public Response confirmFeedback(BOMFeedback feedback) { |
| | | DocUser user = ActionUtil.getUser(); |
| | | int userId = user.getId().intValue(); |
| | |
| | | int count=mapper.update(null,wrapper); |
| | | bl=count>0; |
| | | msg="接收者确认反馈"; |
| | | |
| | | if(confirmStatus == 2){ |
| | | //解锁产品 |
| | | Integer productId = mapper.selectById(id).getProductId(); |
| | | Product product = productService.getById(productId); |
| | | if(product!=null){ |
| | | int version=product.getVersion(); |
| | | if(version!=-1){ |
| | | phisService.setpHistoryEnable(product.getParentCode(),product.getCustomCode(),version,1,"问题反馈后"+ username +"确认不需要修改bom,系统执行产品解锁",DateUtil.YYYY_MM_DD_HH_MM_SS.format(product.getVersionTime())); |
| | | } |
| | | }else{ |
| | | ProductHistory phis = phisService.getById(productId); |
| | | phisService.setpHistoryEnable(phis.getParentCode(),phis.getCustomCode(),phis.getVersion(),1,"问题反馈后"+ username +"确认不需要修改bom,系统执行产品解锁",DateUtil.YYYY_MM_DD_HH_MM_SS.format(phis.getVersionTime())); |
| | | } |
| | | } |
| | | } |
| | | return new Response().set(1,bl,msg); |
| | | } |
| | |
| | | //String feedbackZipPath = "feedback_bom" + File.separator + username + "_" + time+".zip"; |
| | | //List<File> fileList = new LinkedList<>(); |
| | | String rootFile = CommonUtil.getRootFile(); |
| | | 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(); |
| | | } |
| | | 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 subject = "【Bom问题反馈】-"+senderName; |
| | | String content = feedback.getContent(); |
| | | //邮件内容,添加产品的相关信息 |
| | | Product product = productService.getById(feedback.getProductId()); |
| | | |
| | | String content ="产品料号:"+product.getParentCode() + "\n产品名称:"+product.getParentName() + "\n产品型号:"+product.getParentModel() + "\n版本时间:"+ DateUtil.YYYY_MM_DD_HH_MM_SS.format(product.getVersionTime()) + "\n定制单号:"+product.getCustomCode() + "\n产品反馈内容:"+ feedback.getContent(); |
| | | |
| | | MailDTO mailDTO = new MailDTO(); |
| | | mailDTO.setTitle(subject); |
| | |
| | | if(list!=null&&list.size()>0){ |
| | | for (int i=0;i<list.size();i++) { |
| | | BOMFeedback fb=list.get(i); |
| | | fileDirName=fileDirName+File.separator+fb.getFile(); |
| | | File start = new File(fileDirName); |
| | | 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()+File.separator+files[j]); |
| | | attachList.add(fb.getFile()+files[j]); |
| | | } |
| | | } |
| | | } |