|
@@ -12,6 +12,7 @@ import com.gree.mall.manager.bean.policy.*;
|
|
|
import com.gree.mall.manager.commonmapper.PolicyCMapper;
|
|
|
import com.gree.mall.manager.constant.Constant;
|
|
|
import com.gree.mall.manager.enums.*;
|
|
|
+import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
import com.gree.mall.manager.plus.entity.*;
|
|
|
import com.gree.mall.manager.plus.service.*;
|
|
@@ -32,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.mail.MessagingException;
|
|
|
+import javax.mail.Session;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
@@ -269,14 +271,18 @@ public class AgreementLogic {
|
|
|
//发邮件
|
|
|
try {
|
|
|
this.sendEmailFile(mailboxSendRecordPolicies, mailboxSendRecord, mailbox,emailUtilsNew);
|
|
|
- mailboxSendRecord.setSendStatus("OK");
|
|
|
- mailboxSendRecord.setSendTime(new Date());
|
|
|
- mailboxSendRecord.updateById();
|
|
|
+ MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
|
|
|
+ mailboxSendRecord1.setId(mailboxSendRecord.getId());
|
|
|
+ mailboxSendRecord1.setSendStatus("OK");
|
|
|
+ mailboxSendRecord1.setSendTime(new Date());
|
|
|
+ mailboxSendRecord1.updateById();
|
|
|
} catch (Exception e) {
|
|
|
log.error("发送意外保险失败"+e.toString());
|
|
|
- mailboxSendRecord.setSendStatus("NO");
|
|
|
- mailboxSendRecord.setSendTime(new Date());
|
|
|
- mailboxSendRecord.updateById();
|
|
|
+ MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
|
|
|
+ mailboxSendRecord1.setId(mailboxSendRecord.getId());
|
|
|
+ mailboxSendRecord1.setSendStatus("NO");
|
|
|
+ mailboxSendRecord1.setSendTime(new Date());
|
|
|
+ mailboxSendRecord1.updateById();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -285,14 +291,18 @@ public class AgreementLogic {
|
|
|
//发邮件
|
|
|
try {
|
|
|
this.sendEmailFileEm(mailboxSendRecordPolicies, mailboxSendRecord, mailbox,emailUtilsNew);
|
|
|
- mailboxSendRecord.setSendStatus("OK");
|
|
|
- mailboxSendRecord.setSendTime(new Date());
|
|
|
- mailboxSendRecord.updateById();
|
|
|
+ MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
|
|
|
+ mailboxSendRecord1.setId(mailboxSendRecord.getId());
|
|
|
+ mailboxSendRecord1.setSendStatus("OK");
|
|
|
+ mailboxSendRecord1.setSendTime(new Date());
|
|
|
+ mailboxSendRecord1.updateById();
|
|
|
} catch (Exception e) {
|
|
|
log.error("发送雇主保险失败"+e.toString());
|
|
|
- mailboxSendRecord.setSendStatus("NO");
|
|
|
- mailboxSendRecord.setSendTime(new Date());
|
|
|
- mailboxSendRecord.updateById();
|
|
|
+ MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
|
|
|
+ mailboxSendRecord1.setId(mailboxSendRecord.getId());
|
|
|
+ mailboxSendRecord1.setSendStatus("NO");
|
|
|
+ mailboxSendRecord1.setSendTime(new Date());
|
|
|
+ mailboxSendRecord1.updateById();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -302,14 +312,18 @@ public class AgreementLogic {
|
|
|
//发邮件
|
|
|
try {
|
|
|
this.sendEmailFileIn(mailboxSendRecordPolicies, mailboxSendRecord, mailbox,emailUtilsNew);
|
|
|
- mailboxSendRecord.setSendStatus("OK");
|
|
|
- mailboxSendRecord.setSendTime(new Date());
|
|
|
- mailboxSendRecord.updateById();
|
|
|
+ MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
|
|
|
+ mailboxSendRecord1.setId(mailboxSendRecord.getId());
|
|
|
+ mailboxSendRecord1.setSendStatus("OK");
|
|
|
+ mailboxSendRecord1.setSendTime(new Date());
|
|
|
+ mailboxSendRecord1.updateById();
|
|
|
} catch (Exception e) {
|
|
|
log.error("发送工伤保险失败"+e.toString());
|
|
|
- mailboxSendRecord.setSendStatus("NO");
|
|
|
- mailboxSendRecord.setSendTime(new Date());
|
|
|
- mailboxSendRecord.updateById();
|
|
|
+ MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
|
|
|
+ mailboxSendRecord1.setId(mailboxSendRecord.getId());
|
|
|
+ mailboxSendRecord1.setSendStatus("NO");
|
|
|
+ mailboxSendRecord1.setSendTime(new Date());
|
|
|
+ mailboxSendRecord1.updateById();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -349,9 +363,10 @@ public class AgreementLogic {
|
|
|
//发送邮箱
|
|
|
|
|
|
//分发邮件
|
|
|
-
|
|
|
+ Session session = emailUtilsNew.loadMailSession();
|
|
|
for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
|
|
|
- emailUtilsNew.send(s, mailbox.getSendMailbox(), "工伤险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
|
|
|
+
|
|
|
+ emailUtilsNew.send(session,s, mailbox.getSendMailbox(), "工伤险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
|
|
|
+ mailbox.getSendName() + "保险人员名单详情见附件", filePath);
|
|
|
}
|
|
|
|
|
@@ -400,9 +415,9 @@ public class AgreementLogic {
|
|
|
|
|
|
|
|
|
//分发邮件
|
|
|
-
|
|
|
+ Session session = emailUtilsNew.loadMailSession();
|
|
|
for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
|
|
|
- emailUtilsNew.send(s, mailbox.getSendMailbox(), "雇主险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
|
|
|
+ emailUtilsNew.send(session,s, mailbox.getSendMailbox(), "雇主险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
|
|
|
+ mailbox.getSendName() + "保险人员名单详情见附件", filePath);
|
|
|
}
|
|
|
|
|
@@ -453,9 +468,9 @@ public class AgreementLogic {
|
|
|
|
|
|
|
|
|
//分发邮件
|
|
|
-
|
|
|
+ Session session = emailUtilsNew.loadMailSession();
|
|
|
for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
|
|
|
- emailUtilsNew.send(s, mailbox.getSendMailbox(), "意外险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
|
|
|
+ emailUtilsNew.send(session,s, mailbox.getSendMailbox(), "意外险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
|
|
|
+ mailbox.getSendName() + "保险人员名单详情见附件", filePath);
|
|
|
}
|
|
|
|