Commit 5147673ce0c679ff17486338047c24763bec9ef1
1 parent
5f019a15
fix:发送生产指示书时,附带项目号。
Showing
5 changed files
with
14 additions
and
4 deletions
src/main/java/com/order/erp/common/utils/EasyPdfUtils.java
... | ... | @@ -120,6 +120,11 @@ public class EasyPdfUtils { |
120 | 120 | producePdfVO.setProductionDepartment(productionDepartments.iterator().next()); |
121 | 121 | Optional<List<String>> firstElementFromSet1 = pdfVOList.stream().findFirst().map(OrderProducePdfVO::getPersonList); |
122 | 122 | List<String> personList = firstElementFromSet1.orElse(Collections.emptyList()); |
123 | + List<String> uniqueProjectNos = pdfVOList.stream() | |
124 | + .map(OrderProducePdfVO::getProjectNo) // 提取 projectNo | |
125 | + .distinct() // 去重 | |
126 | + .collect(Collectors.toList()); // 收集到 List | |
127 | + producePdfVO.setProjects(uniqueProjectNos); | |
123 | 128 | producePdfVO.setPersonList(personList); |
124 | 129 | return producePdfVO; |
125 | 130 | } | ... | ... |
src/main/java/com/order/erp/common/utils/EmailSendUtils.java
... | ... | @@ -141,11 +141,12 @@ public class EmailSendUtils { |
141 | 141 | * @param emailTemplateEnum 邮件事件类型 |
142 | 142 | * @param receiveemailList 收件人邮箱 |
143 | 143 | * @param pdfFile pdf文件 |
144 | + * @param projects 项目号 | |
144 | 145 | * @throws MessagingException |
145 | 146 | * @throws IOException |
146 | 147 | */ |
147 | 148 | //生产指示书以附件方式发送。 |
148 | - public void sendEmail(EmailTemplateEnum emailTemplateEnum, List<String> receiveemailList, File pdfFile) { | |
149 | + public void sendEmail(EmailTemplateEnum emailTemplateEnum, List<String> receiveemailList, File pdfFile,String projects) { | |
149 | 150 | if (CollectionUtils.isEmpty(receiveemailList) && emailTemplateEnum == null && ObjectUtils.isNull(pdfFile)) { |
150 | 151 | throw new BusinessException(ServerResultCode.PARAM_ERROR); |
151 | 152 | } |
... | ... | @@ -161,7 +162,7 @@ public class EmailSendUtils { |
161 | 162 | helper.setFrom(sendEmail); |
162 | 163 | helper.setTo(receiveemailListArray); |
163 | 164 | helper.setSentDate(new Date()); |
164 | - helper.setText(emailTemplateEnum.getContent()); | |
165 | + helper.setText(emailTemplateEnum.getContent()+projects); | |
165 | 166 | helper.addAttachment(pdfFile.getName(), pdfFile); |
166 | 167 | } catch (MessagingException e) { |
167 | 168 | throw new RuntimeException("邮件发送失败!"); | ... | ... |
src/main/java/com/order/erp/domain/EmailTemplateEnum.java
... | ... | @@ -31,7 +31,7 @@ public enum EmailTemplateEnum { |
31 | 31 | |
32 | 32 | END_CHECK_REPORT_TEMPLATE("尾期验货报告", "您好,请查收尾期验货报告 项目号为: ", 9L), |
33 | 33 | |
34 | - PRODUCE_INDICATE_REPORT("生产指示书","你好,请查收附件生产订单",10L), | |
34 | + PRODUCE_INDICATE_REPORT("生产指示书","你好,请查收附件生产订单 项目号为: ",10L), | |
35 | 35 | |
36 | 36 | PRODUCE_IDEA("产品意见信息","你好,请查收产品意见信息 项目号为: ",11L), |
37 | 37 | ... | ... |
src/main/java/com/order/erp/domain/vo/ProducePdfVO.java
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
... | ... | @@ -2641,7 +2641,7 @@ end |
2641 | 2641 | InputStream inputStream = url1.openStream(); |
2642 | 2642 | File file = FileUtil.inputStreamToFile(inputStream, "生产指示书_" + System.currentTimeMillis() + ".pdf"); |
2643 | 2643 | try { |
2644 | - emailSendUtils.sendEmail(EmailTemplateEnum.PRODUCE_INDICATE_REPORT, emails, file); | |
2644 | + emailSendUtils.sendEmail(EmailTemplateEnum.PRODUCE_INDICATE_REPORT, emails, file,String.join(",", producePdfVO.getProjects())); | |
2645 | 2645 | } finally { |
2646 | 2646 | if (file.exists()) { |
2647 | 2647 | file.delete(); | ... | ... |