瀏覽代碼

安全生产-取消线程并发发送邮件,使用trycatch过滤错误邮箱

sucheng 11 月之前
父節點
當前提交
27aaca30bb

+ 3 - 4
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/AspSafeAttachmentsServiceImpl.java

@@ -192,11 +192,10 @@ public class AspSafeAttachmentsServiceImpl extends ServiceImpl<AspSafeAttachment
             mailDo.setReceiveEmail(new String[]{userMap.get(key).getEmail()});
             mailDo.setNeedTransReceive(false);
             mailDo.setContent(mailContent.toString());
-            Thread thread = new Thread(() -> {
-                // 线程执行的任务代码
+            try {
                 sysConfigFeignService.sendTextMail(mailDo);
-            });
-            thread.start(); // 启动线程
+            } catch (Exception ignored) {
+            }
         });
 
     }

+ 3 - 4
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/AspSpecialEquipmentCertificateServiceImpl.java

@@ -177,11 +177,10 @@ public class AspSpecialEquipmentCertificateServiceImpl extends ServiceImpl<AspSp
             mailDo.setReceiveEmail(new String[]{userMap.get(key).getEmail()});
             mailDo.setNeedTransReceive(false);
             mailDo.setContent(mailContent.toString());
-            Thread thread = new Thread(() -> {
-                // 线程执行的任务代码
+            try {
                 sysConfigFeignService.sendTextMail(mailDo);
-            });
-            thread.start(); // 启动线程
+            } catch (Exception ignored) {
+            }
         });
 
     }

+ 3 - 4
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/CheckItemsServiceImpl.java

@@ -300,11 +300,10 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
             mailDo.setReceiveEmail(new String[]{userMap.get(key).getEmail()});
             mailDo.setNeedTransReceive(false);
             mailDo.setContent(mailContent.toString());
-            Thread thread = new Thread(() -> {
-                // 线程执行的任务代码
+            try {
                 sysConfigFeignService.sendTextMail(mailDo);
-            });
-            thread.start(); // 启动线程
+            } catch (Exception ignored) {
+            }
         });
 
     }