调整优化-字段类型映射
continuous-integration/drone/push Build is passing Details

pull/1/head
YXY 1 year ago
parent f07f90e9e6
commit 3772a40881

@ -10,6 +10,7 @@ import com.ruoyi.flyingbook.mail.request.MailRequest;
import com.ruoyi.flyingbook.mapper.EventLogMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import javax.mail.*;
@ -19,10 +20,7 @@ import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author yuxiangyong
@ -50,7 +48,14 @@ public class MailHelper {
String from = MimeUtility.decodeText(message.getFrom()[0].toString());
InternetAddress internetAddress = new InternetAddress(from);
String receiveAddress = this.getReceiveAddress(message, null);
if (!from.contains(req.getSourceName())){
String sourceName = req.getSourceName();
String currentSourceName = null;
for (String sn : sourceName.split(",")) {
if (from.contains(sn)){
currentSourceName = sn;
}
}
if (StringUtils.isBlank(currentSourceName)){
continue;
}
msgSubject = String.format("主题:%s,发件人:%s(%s),收件人:%s",
@ -58,7 +63,7 @@ public class MailHelper {
internetAddress.getPersonal(),
internetAddress.getAddress(),
receiveAddress);
String recordId = syncLarkTable(message,add,req.getSourceName());
String recordId = syncLarkTable(message,add, currentSourceName);
this.buildLog(logs,msgSubject,recordId,null);
message.setFlag(Flags.Flag.SEEN, true);
} catch (Exception e) {
@ -137,13 +142,12 @@ public class MailHelper {
return new HashMap<>();
}
protected String getReceiveDate(Message message){
protected long getReceiveDate(Message message){
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(message.getReceivedDate());
return message.getReceivedDate().getTime();
} catch (MessagingException e) {
}
return null;
return 0L;
}
}

Loading…
Cancel
Save