Commit 8655d729 by admin

修改了连接方式和邮件推送的邮件

parent 6869def3
......@@ -94,12 +94,13 @@ public class ESUtil {
// }
List<String> sources = new ArrayList<String>();
String path = PushFinanceByTime.class.getClassLoader().getResource("pushFiles/weibo.xls").getPath();
// Document doc = con.find("financePush", "excelPath", new Document().append("name", "longSource"));
// if (doc != null) {
// if (doc.getString("url") != null) {
// path = doc.getString("url");
// }
// }
// Document doc = con.find("financePush", "excelPath", new
// Document().append("name", "longSource"));
// if (doc != null) {
// if (doc.getString("url") != null) {
// path = doc.getString("url");
// }
// }
sources = new ReadExcel().getExcel(path);
Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR_OF_DAY, -3);
......@@ -143,8 +144,8 @@ public class ESUtil {
}
}
keys = new ReadExcel().getExcel(path);
Client esClient = ESClient.getInstance();
try {
Client esClient = ESClient.getInstance();
for (String key : keys) {
// 搜索数据
SearchRequestBuilder srb = esClient.prepareSearch(Config.getVal("indexName." + type));
......@@ -172,8 +173,8 @@ public class ESUtil {
SimpleDateFormat myFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String url = hit.getSource().get("url") != null ? String.valueOf(hit.getSource().get("url"))
: String.valueOf(hit.getId());
if(!url.contains("http")) {
url=String.valueOf(map.get("id"));
if (!url.contains("http")) {
url = String.valueOf(map.get("id"));
}
if (type.equals("weibo")) {
n.setUrl(url);
......@@ -183,7 +184,7 @@ public class ESUtil {
n.setTitle(String.valueOf(map.get("roottext")));
}
try {
n.setTime(map.get("time")+"");
n.setTime(map.get("time") + "");
} catch (Exception e) {
n.setTime("");
}
......@@ -206,6 +207,8 @@ public class ESUtil {
log.info("金融结束");
} catch (Exception e) {
log.error("es检索出错,错误信息【{}】", e);
} finally {
esClient.close();
}
for (NewsResult news : result) {
for (String source : sources) {
......
......@@ -33,11 +33,11 @@ public class SendMailUtil {
// 发送邮件的邮箱号(若有授权码则密码输入授权码)
public static String myEmailAccount2 = "ccxe4zhishu@126.com";
public static String myEmailPassword2 = "1q2w3e4r5t";
public static String myEmailAccount = "ccxerisk@sina.com";
public static String myEmailAccount = "jryqccxe@zhiweidata.com";
public static String myEmailPassword = "1q2w3e4r";
// 发件人邮箱的 SMTP 服务器地址, 必须准确, 不同邮件服务器地址不同, 一般(只是一般, 绝非绝对)格式为: smtp.xxx.com
// 网易163邮箱的 SMTP 服务器地址为: smtp.163.com
public static String myEmailSMTPHost = "smtp.sina.com";
public static String myEmailSMTPHost = "smtp.ym.163.com";
public static String myEmailSMTPHost2 = "smtp.126.com";
/**
......
......@@ -10,7 +10,7 @@ log4j.appender.LOG.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} %m%n
#ERROR
log4j.appender.ERROR=org.apache.log4j.RollingFileAppender
log4j.appender.ERROR.Threshold=error
log4j.appender.ERROR.File=${catalina.home}/log/error.log
log4j.appender.ERROR.File=${catalina.home}/log/change4weixin.log
log4j.appender.ERROR.MaxFileSize=10MB
log4j.appender.ERROR.MaxBackupIndex=10
log4j.appender.ERROR.layout=org.apache.log4j.PatternLayout
......
......@@ -10,7 +10,7 @@ log4j.appender.LOG.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} %m%n
#ERROR
log4j.appender.ERROR=org.apache.log4j.RollingFileAppender
log4j.appender.ERROR.Threshold=error
log4j.appender.ERROR.File=${catalina.home}/log/error.log
log4j.appender.ERROR.File=${catalina.home}/log/change4weixin.log
log4j.appender.ERROR.MaxFileSize=10MB
log4j.appender.ERROR.MaxBackupIndex=10
log4j.appender.ERROR.layout=org.apache.log4j.PatternLayout
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment