| | |
| | | /*0120开头的物料上传后,系统自动发邮件对应人员:吴浚、陈卓、熊家杰、钱镜元、於奇 |
| | | 0108、0109开头的物料上传后,系统自动发邮件对应人员:喻艳、袁成、熊志平、叶胜蓝 */ |
| | | List<String> materialCodeList = materialList.stream().map(Material::getSubCode).collect(Collectors.toList()); |
| | | DocUser user = ActionUtil.getUser(); |
| | | MailDTO mailDTO = new MailDTO(); |
| | | //从materialList中查找 subCode以0120开头的所有物料集合 |
| | | List<Material> materialCodeList0120 = materialList.stream().filter(material -> material.getSubCode().startsWith("0120")).collect(Collectors.toList()); |
| | | //从materialList中查找 subCode以0108或0109开头的所有物料集合 |
| | | List<Material> materialCodeList0809 = materialList.stream().filter(material -> material.getSubCode().startsWith("0108") || material.getSubCode().startsWith("0109")).collect(Collectors.toList()); |
| | | |
| | | mailDTO.setTitle("【物料上传提醒】"); |
| | | if(materialCodeList.stream().anyMatch(b->b.startsWith("0120"))){ |
| | | List<MailUser> mailUserList = mailUserService.getMailUserList(5); |
| | | mailDTO.setMailList(mailUserList.stream().map(MailUser::getMail).collect(Collectors.toList())); |
| | | mailDTO.setContent(user.getName()+"在文档管理平台上传了0120开头的物料,请知晓"); |
| | | mailService.sendMail(mailDTO); |
| | | } |
| | | if (materialCodeList.stream().anyMatch(b->b.startsWith("0108")||b.startsWith("0109"))){ |
| | | List<MailUser> mailUserList = mailUserService.getMailUserList(6); |
| | | mailDTO.setMailList(mailUserList.stream().map(MailUser::getMail).collect(Collectors.toList())); |
| | | mailDTO.setContent(user.getName()+"在文档管理平台上传了0108或0109开头的物料,请知晓"); |
| | | mailService.sendMail(mailDTO); |
| | | //如果存在,则创建邮件对象 |
| | | if(materialCodeList0120.size()>0 || materialCodeList0809.size()>0) { |
| | | DocUser user = ActionUtil.getUser(); |
| | | MailDTO mailDTO = new MailDTO(); |
| | | String now = DateUtil.YYYY_MM_DD_HH_MM_SS.format(new Date()); |
| | | mailDTO.setTitle("【物料上传提醒】"); |
| | | if(materialCodeList0120.size()>0){ |
| | | String subCodeJoin = materialCodeList0120.stream().map(Material::getSubCode).collect(Collectors.joining(",")); |
| | | String subNameJoin = materialCodeList0120.stream().map(Material::getSubName).collect(Collectors.joining(",")); |
| | | String subModelJoin = materialCodeList0120.stream().map(Material::getSubModel).collect(Collectors.joining(",")); |
| | | |
| | | List<MailUser> mailUserList = mailUserService.getMailUserList(5); |
| | | mailDTO.setMailList(mailUserList.stream().map(MailUser::getMail).collect(Collectors.toList())); |
| | | mailDTO.setContent(user.getName() + "在文档管理平台"+now+"上传了0120开头的物料,详细信息如下:\n物料编码:"+subCodeJoin+"\n物料名称:"+subNameJoin+"\n规格型号:"+subModelJoin); |
| | | mailService.sendMail(mailDTO); |
| | | } |
| | | if (materialCodeList0809.size()>0) { |
| | | String subCodeJoin = materialCodeList0809.stream().map(Material::getSubCode).collect(Collectors.joining(",")); |
| | | String subNameJoin = materialCodeList0809.stream().map(Material::getSubName).collect(Collectors.joining(",")); |
| | | String subModelJoin = materialCodeList0809.stream().map(Material::getSubModel).collect(Collectors.joining(",")); |
| | | |
| | | List<MailUser> mailUserList = mailUserService.getMailUserList(6); |
| | | mailDTO.setMailList(mailUserList.stream().map(MailUser::getMail).collect(Collectors.toList())); |
| | | mailDTO.setContent(user.getName() + "在文档管理平台"+now+"上传了0108或0109开头的物料,详细信息如下:\n物料编码:"+subCodeJoin+"\n物料名称:"+subNameJoin+"\n规格型号:"+subModelJoin); |
| | | mailService.sendMail(mailDTO); |
| | | } |
| | | } |
| | | return new Response().set(1,true,"新增完成"); |
| | | } |
| | |
| | | Date now = new Date(); |
| | | //long timestamp = now.getTime(); |
| | | String formattedTimestamp = DateUtil.YYYY_MM_DD_HH_MM_SS_UNION.format(now); |
| | | String formattedNow = DateUtil.YYYY_MM_DD_HH_MM_SS.format(now); |
| | | |
| | | boolean dirFileExist = true; |
| | | if(!dirFile.exists()){ |
| | | dirFile.mkdirs(); |
| | | dirFileExist = false; |
| | | } |
| | | StringBuilder fileNameJoin = new StringBuilder(); |
| | | for (int i = 0; i < multipartFileList.size(); i++) { |
| | | MultipartFile multipartFile = multipartFileList.get(i); |
| | | String originalFilename = multipartFile.getOriginalFilename(); |
| | | fileNameJoin.append(originalFilename).append(","); |
| | | File zipFile = new File(dirPath + File.separator + originalFilename.substring(0,originalFilename.lastIndexOf(".")) + "_" + formattedTimestamp + originalFilename.substring(originalFilename.lastIndexOf("."))); |
| | | multipartFile.transferTo(zipFile); |
| | | } |
| | | //fileNameJoin去除最后一个元素 |
| | | fileNameJoin.deleteCharAt(fileNameJoin.length()-1); |
| | | /*//解压文件夹,删除原zip文件 |
| | | String unPackageDir = dirPath + File.separator + timestamp; |
| | | Zip4jUtil.unPackZip(zipFile, null, unPackageDir); |
| | |
| | | 0108、0109开头的物料上传后,系统自动发邮件对应人员:喻艳、袁成、熊志平、叶胜蓝 */ |
| | | MailDTO mailDTO = new MailDTO(); |
| | | DocUser user = ActionUtil.getUser(); |
| | | Material materialById = mapper.getMaterialById(material.getId()); |
| | | mailDTO.setTitle("【附件更新提醒】"); |
| | | if(subCode.startsWith("0120")){ |
| | | List<MailUser> mailUserList = mailUserService.getMailUserList(5); |
| | | mailDTO.setMailList(mailUserList.stream().map(MailUser::getMail).collect(Collectors.toList())); |
| | | mailDTO.setContent(user.getName()+"在文档管理平台上传了"+subCode+"物料的附件,请知晓"); |
| | | mailDTO.setContent(user.getName()+"在文档管理平台"+formattedNow+"上传了附件,详细信息如下:\n物料编码:"+subCode+"\n物料名称:"+materialById.getSubName()+"\n物料型号:"+subModel+"\n附件名称:"+fileNameJoin.toString()); |
| | | mailService.sendMail(mailDTO); |
| | | }else if (subCode.startsWith("0108")|| subCode.startsWith("0109")){ |
| | | List<MailUser> mailUserList = mailUserService.getMailUserList(6); |
| | | mailDTO.setMailList(mailUserList.stream().map(MailUser::getMail).collect(Collectors.toList())); |
| | | mailDTO.setContent(user.getName()+"在文档管理平台上传了"+subCode+"物料的附件,请知晓"); |
| | | mailDTO.setContent(user.getName()+"在文档管理平台"+formattedNow+"上传了附件,详细信息如下:\n物料编码:"+subCode+"\n物料名称:"+materialById.getSubName()+"\n物料型号:"+subModel+"\n附件名称:"+fileNameJoin.toString()); |
| | | mailService.sendMail(mailDTO); |
| | | } |
| | | return new Response().set(1,true,"上传完成"); |
| | |
| | | Date now = new Date(); |
| | | //long timestamp = now.getTime(); |
| | | String formattedTimestamp = DateUtil.YYYY_MM_DD_HH_MM_SS_UNION.format(now); |
| | | String formattedNow = DateUtil.YYYY_MM_DD_HH_MM_SS.format(now); |
| | | |
| | | if (!dirFile.exists()) { |
| | | dirFile.mkdirs(); |
| | |
| | | |
| | | /*0120开头的物料上传后,系统自动发邮件对应人员:吴浚、陈卓、熊家杰、钱镜元、於奇 |
| | | 0108、0109开头的物料上传后,系统自动发邮件对应人员:喻艳、袁成、熊志平、叶胜蓝 */ |
| | | Material materialById = mapper.getMaterialById(material.getId()); |
| | | MailDTO mailDTO = new MailDTO(); |
| | | DocUser user = ActionUtil.getUser(); |
| | | mailDTO.setTitle("【图纸图片更新提醒】"); |
| | | if(subCode.startsWith("0120")){ |
| | | List<MailUser> mailUserList = mailUserService.getMailUserList(5); |
| | | mailDTO.setMailList(mailUserList.stream().map(MailUser::getMail).collect(Collectors.toList())); |
| | | mailDTO.setContent(user.getName()+"在文档管理平台上传了"+subCode+"物料的图纸或图片,请知晓"); |
| | | mailDTO.setContent(user.getName()+"在文档管理平台"+formattedNow+"上传了图纸或图片,详细信息如下:\n物料编码:"+subCode+"\n物料名称:"+materialById.getSubName()+"\n物料型号:"+subModel+"\n图纸图片名称:"+originalFilename); |
| | | mailService.sendMail(mailDTO); |
| | | }else if (subCode.startsWith("0108")|| subCode.startsWith("0109")){ |
| | | List<MailUser> mailUserList = mailUserService.getMailUserList(6); |
| | | mailDTO.setMailList(mailUserList.stream().map(MailUser::getMail).collect(Collectors.toList())); |
| | | mailDTO.setContent(user.getName()+"在文档管理平台上传了"+subCode+"物料的图纸或图片,请知晓"); |
| | | mailDTO.setContent(user.getName()+"在文档管理平台"+formattedNow+"上传了图纸或图片,详细信息如下:\n物料编码:"+subCode+"\n物料名称:"+materialById.getSubName()+"\n物料型号:"+subModel+"\n图纸图片名称:"+originalFilename); |
| | | mailService.sendMail(mailDTO); |
| | | } |
| | | return new Response().set(1, true, "上传完成"); |