|
@@ -9,6 +9,7 @@ import com.fjhx.email.config.base.BaseEntity;
|
|
|
import com.fjhx.email.config.exception.ServiceException;
|
|
|
import com.fjhx.email.entity.*;
|
|
|
import com.fjhx.email.entity.dto.GetMessagePageDto;
|
|
|
+import com.fjhx.email.entity.dto.MailFolderInfo;
|
|
|
import com.fjhx.email.entity.dto.MailSyncInfo;
|
|
|
import com.fjhx.email.entity.dto.MailboxInfo;
|
|
|
import com.fjhx.email.entity.vo.MessageDetailVo;
|
|
@@ -144,6 +145,7 @@ public class MailServiceImpl implements IMailService {
|
|
|
}
|
|
|
|
|
|
folder.open(Folder.READ_ONLY);
|
|
|
+
|
|
|
for (MessageVo messageVo : wrapper.getRows()) {
|
|
|
Long uid = messageVo.getUid();
|
|
|
Message message = folder.getMessageByUID(uid);
|
|
@@ -253,6 +255,28 @@ public class MailServiceImpl implements IMailService {
|
|
|
return copy;
|
|
|
}
|
|
|
|
|
|
+ @SneakyThrows
|
|
|
+ @Override
|
|
|
+ public void setUnreadMessageCount(List<MailboxInfo> mailboxInfoList) {
|
|
|
+
|
|
|
+ for (MailboxInfo mailboxInfo : mailboxInfoList) {
|
|
|
+
|
|
|
+ IMAPStore imapStore = EmailUtil.getIMAPStore(mailboxInfo);
|
|
|
+
|
|
|
+ for (MailFolderInfo mailFolderInfo : mailboxInfo.getMailFolderInfoList()) {
|
|
|
+ IMAPFolder folder = (IMAPFolder) imapStore.getFolder(mailFolderInfo.getName());
|
|
|
+ folder.open(Folder.READ_WRITE);
|
|
|
+ int unreadMessageCount = folder.getUnreadMessageCount();
|
|
|
+ mailFolderInfo.setUnreadMessageCount(unreadMessageCount);
|
|
|
+ if (folder.isOpen()) {
|
|
|
+ folder.close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private void saveMessageDetail(Long messageId, MessageDetailVo messageDetailVo, Integer type) {
|
|
|
|
|
|
TransactionStatus transactionStatus = platformTransactionManager.getTransaction(transactionDefinition);
|