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,6 +120,11 @@ public class EasyPdfUtils { | ||
120 | producePdfVO.setProductionDepartment(productionDepartments.iterator().next()); | 120 | producePdfVO.setProductionDepartment(productionDepartments.iterator().next()); |
121 | Optional<List<String>> firstElementFromSet1 = pdfVOList.stream().findFirst().map(OrderProducePdfVO::getPersonList); | 121 | Optional<List<String>> firstElementFromSet1 = pdfVOList.stream().findFirst().map(OrderProducePdfVO::getPersonList); |
122 | List<String> personList = firstElementFromSet1.orElse(Collections.emptyList()); | 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 | producePdfVO.setPersonList(personList); | 128 | producePdfVO.setPersonList(personList); |
124 | return producePdfVO; | 129 | return producePdfVO; |
125 | } | 130 | } |
src/main/java/com/order/erp/common/utils/EmailSendUtils.java
@@ -141,11 +141,12 @@ public class EmailSendUtils { | @@ -141,11 +141,12 @@ public class EmailSendUtils { | ||
141 | * @param emailTemplateEnum 邮件事件类型 | 141 | * @param emailTemplateEnum 邮件事件类型 |
142 | * @param receiveemailList 收件人邮箱 | 142 | * @param receiveemailList 收件人邮箱 |
143 | * @param pdfFile pdf文件 | 143 | * @param pdfFile pdf文件 |
144 | + * @param projects 项目号 | ||
144 | * @throws MessagingException | 145 | * @throws MessagingException |
145 | * @throws IOException | 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 | if (CollectionUtils.isEmpty(receiveemailList) && emailTemplateEnum == null && ObjectUtils.isNull(pdfFile)) { | 150 | if (CollectionUtils.isEmpty(receiveemailList) && emailTemplateEnum == null && ObjectUtils.isNull(pdfFile)) { |
150 | throw new BusinessException(ServerResultCode.PARAM_ERROR); | 151 | throw new BusinessException(ServerResultCode.PARAM_ERROR); |
151 | } | 152 | } |
@@ -161,7 +162,7 @@ public class EmailSendUtils { | @@ -161,7 +162,7 @@ public class EmailSendUtils { | ||
161 | helper.setFrom(sendEmail); | 162 | helper.setFrom(sendEmail); |
162 | helper.setTo(receiveemailListArray); | 163 | helper.setTo(receiveemailListArray); |
163 | helper.setSentDate(new Date()); | 164 | helper.setSentDate(new Date()); |
164 | - helper.setText(emailTemplateEnum.getContent()); | 165 | + helper.setText(emailTemplateEnum.getContent()+projects); |
165 | helper.addAttachment(pdfFile.getName(), pdfFile); | 166 | helper.addAttachment(pdfFile.getName(), pdfFile); |
166 | } catch (MessagingException e) { | 167 | } catch (MessagingException e) { |
167 | throw new RuntimeException("邮件发送失败!"); | 168 | throw new RuntimeException("邮件发送失败!"); |
src/main/java/com/order/erp/domain/EmailTemplateEnum.java
@@ -31,7 +31,7 @@ public enum EmailTemplateEnum { | @@ -31,7 +31,7 @@ public enum EmailTemplateEnum { | ||
31 | 31 | ||
32 | END_CHECK_REPORT_TEMPLATE("尾期验货报告", "您好,请查收尾期验货报告 项目号为: ", 9L), | 32 | END_CHECK_REPORT_TEMPLATE("尾期验货报告", "您好,请查收尾期验货报告 项目号为: ", 9L), |
33 | 33 | ||
34 | - PRODUCE_INDICATE_REPORT("生产指示书","你好,请查收附件生产订单",10L), | 34 | + PRODUCE_INDICATE_REPORT("生产指示书","你好,请查收附件生产订单 项目号为: ",10L), |
35 | 35 | ||
36 | PRODUCE_IDEA("产品意见信息","你好,请查收产品意见信息 项目号为: ",11L), | 36 | PRODUCE_IDEA("产品意见信息","你好,请查收产品意见信息 项目号为: ",11L), |
37 | 37 |
src/main/java/com/order/erp/domain/vo/ProducePdfVO.java
@@ -26,4 +26,8 @@ public class ProducePdfVO { | @@ -26,4 +26,8 @@ public class ProducePdfVO { | ||
26 | private Boolean isSend; | 26 | private Boolean isSend; |
27 | private List<String> personList; | 27 | private List<String> personList; |
28 | private Boolean isTrue; | 28 | private Boolean isTrue; |
29 | + /** | ||
30 | + * 项目号 | ||
31 | + * */ | ||
32 | + private List<String> projects; | ||
29 | } | 33 | } |
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
@@ -2641,7 +2641,7 @@ end | @@ -2641,7 +2641,7 @@ end | ||
2641 | InputStream inputStream = url1.openStream(); | 2641 | InputStream inputStream = url1.openStream(); |
2642 | File file = FileUtil.inputStreamToFile(inputStream, "生产指示书_" + System.currentTimeMillis() + ".pdf"); | 2642 | File file = FileUtil.inputStreamToFile(inputStream, "生产指示书_" + System.currentTimeMillis() + ".pdf"); |
2643 | try { | 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 | } finally { | 2645 | } finally { |
2646 | if (file.exists()) { | 2646 | if (file.exists()) { |
2647 | file.delete(); | 2647 | file.delete(); |