Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
change4weixin
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenjinzhu
change4weixin
Commits
8655d729
Commit
8655d729
authored
May 07, 2018
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了连接方式和邮件推送的邮件
parent
6869def3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
14 deletions
+17
-14
src/main/java/com/zhiwei/finance/ESUtil.java
+13
-10
src/main/java/sendmail/SendMailUtil.java
+2
-2
src/main/resources/log4j.properties
+1
-1
target/classes/log4j.properties
+1
-1
No files found.
src/main/java/com/zhiwei/finance/ESUtil.java
View file @
8655d729
...
@@ -94,12 +94,13 @@ public class ESUtil {
...
@@ -94,12 +94,13 @@ public class ESUtil {
// }
// }
List
<
String
>
sources
=
new
ArrayList
<
String
>();
List
<
String
>
sources
=
new
ArrayList
<
String
>();
String
path
=
PushFinanceByTime
.
class
.
getClassLoader
().
getResource
(
"pushFiles/weibo.xls"
).
getPath
();
String
path
=
PushFinanceByTime
.
class
.
getClassLoader
().
getResource
(
"pushFiles/weibo.xls"
).
getPath
();
// Document doc = con.find("financePush", "excelPath", new Document().append("name", "longSource"));
// Document doc = con.find("financePush", "excelPath", new
// if (doc != null) {
// Document().append("name", "longSource"));
// if (doc.getString("url") != null) {
// if (doc != null) {
// path = doc.getString("url");
// if (doc.getString("url") != null) {
// }
// path = doc.getString("url");
// }
// }
// }
sources
=
new
ReadExcel
().
getExcel
(
path
);
sources
=
new
ReadExcel
().
getExcel
(
path
);
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
Calendar
.
HOUR_OF_DAY
,
-
3
);
cal
.
add
(
Calendar
.
HOUR_OF_DAY
,
-
3
);
...
@@ -143,8 +144,8 @@ public class ESUtil {
...
@@ -143,8 +144,8 @@ public class ESUtil {
}
}
}
}
keys
=
new
ReadExcel
().
getExcel
(
path
);
keys
=
new
ReadExcel
().
getExcel
(
path
);
Client
esClient
=
ESClient
.
getInstance
();
try
{
try
{
Client
esClient
=
ESClient
.
getInstance
();
for
(
String
key
:
keys
)
{
for
(
String
key
:
keys
)
{
// 搜索数据
// 搜索数据
SearchRequestBuilder
srb
=
esClient
.
prepareSearch
(
Config
.
getVal
(
"indexName."
+
type
));
SearchRequestBuilder
srb
=
esClient
.
prepareSearch
(
Config
.
getVal
(
"indexName."
+
type
));
...
@@ -172,8 +173,8 @@ public class ESUtil {
...
@@ -172,8 +173,8 @@ public class ESUtil {
SimpleDateFormat
myFmt
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
myFmt
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
url
=
hit
.
getSource
().
get
(
"url"
)
!=
null
?
String
.
valueOf
(
hit
.
getSource
().
get
(
"url"
))
String
url
=
hit
.
getSource
().
get
(
"url"
)
!=
null
?
String
.
valueOf
(
hit
.
getSource
().
get
(
"url"
))
:
String
.
valueOf
(
hit
.
getId
());
:
String
.
valueOf
(
hit
.
getId
());
if
(!
url
.
contains
(
"http"
))
{
if
(!
url
.
contains
(
"http"
))
{
url
=
String
.
valueOf
(
map
.
get
(
"id"
));
url
=
String
.
valueOf
(
map
.
get
(
"id"
));
}
}
if
(
type
.
equals
(
"weibo"
))
{
if
(
type
.
equals
(
"weibo"
))
{
n
.
setUrl
(
url
);
n
.
setUrl
(
url
);
...
@@ -183,7 +184,7 @@ public class ESUtil {
...
@@ -183,7 +184,7 @@ public class ESUtil {
n
.
setTitle
(
String
.
valueOf
(
map
.
get
(
"roottext"
)));
n
.
setTitle
(
String
.
valueOf
(
map
.
get
(
"roottext"
)));
}
}
try
{
try
{
n
.
setTime
(
map
.
get
(
"time"
)
+
""
);
n
.
setTime
(
map
.
get
(
"time"
)
+
""
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
n
.
setTime
(
""
);
n
.
setTime
(
""
);
}
}
...
@@ -206,6 +207,8 @@ public class ESUtil {
...
@@ -206,6 +207,8 @@ public class ESUtil {
log
.
info
(
"金融结束"
);
log
.
info
(
"金融结束"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"es检索出错,错误信息【{}】"
,
e
);
log
.
error
(
"es检索出错,错误信息【{}】"
,
e
);
}
finally
{
esClient
.
close
();
}
}
for
(
NewsResult
news
:
result
)
{
for
(
NewsResult
news
:
result
)
{
for
(
String
source
:
sources
)
{
for
(
String
source
:
sources
)
{
...
...
src/main/java/sendmail/SendMailUtil.java
View file @
8655d729
...
@@ -33,11 +33,11 @@ public class SendMailUtil {
...
@@ -33,11 +33,11 @@ public class SendMailUtil {
// 发送邮件的邮箱号(若有授权码则密码输入授权码)
// 发送邮件的邮箱号(若有授权码则密码输入授权码)
public
static
String
myEmailAccount2
=
"ccxe4zhishu@126.com"
;
public
static
String
myEmailAccount2
=
"ccxe4zhishu@126.com"
;
public
static
String
myEmailPassword2
=
"1q2w3e4r5t"
;
public
static
String
myEmailPassword2
=
"1q2w3e4r5t"
;
public
static
String
myEmailAccount
=
"
ccxerisk@sin
a.com"
;
public
static
String
myEmailAccount
=
"
jryqccxe@zhiweidat
a.com"
;
public
static
String
myEmailPassword
=
"1q2w3e4r"
;
public
static
String
myEmailPassword
=
"1q2w3e4r"
;
// 发件人邮箱的 SMTP 服务器地址, 必须准确, 不同邮件服务器地址不同, 一般(只是一般, 绝非绝对)格式为: smtp.xxx.com
// 发件人邮箱的 SMTP 服务器地址, 必须准确, 不同邮件服务器地址不同, 一般(只是一般, 绝非绝对)格式为: smtp.xxx.com
// 网易163邮箱的 SMTP 服务器地址为: smtp.163.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"
;
public
static
String
myEmailSMTPHost2
=
"smtp.126.com"
;
/**
/**
...
...
src/main/resources/log4j.properties
View file @
8655d729
...
@@ -10,7 +10,7 @@ log4j.appender.LOG.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} %m%n
...
@@ -10,7 +10,7 @@ log4j.appender.LOG.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} %m%n
#ERROR
#ERROR
log4j.appender.ERROR
=
org.apache.log4j.RollingFileAppender
log4j.appender.ERROR
=
org.apache.log4j.RollingFileAppender
log4j.appender.ERROR.Threshold
=
error
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.MaxFileSize
=
10MB
log4j.appender.ERROR.MaxBackupIndex
=
10
log4j.appender.ERROR.MaxBackupIndex
=
10
log4j.appender.ERROR.layout
=
org.apache.log4j.PatternLayout
log4j.appender.ERROR.layout
=
org.apache.log4j.PatternLayout
...
...
target/classes/log4j.properties
View file @
8655d729
...
@@ -10,7 +10,7 @@ log4j.appender.LOG.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} %m%n
...
@@ -10,7 +10,7 @@ log4j.appender.LOG.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} %m%n
#ERROR
#ERROR
log4j.appender.ERROR
=
org.apache.log4j.RollingFileAppender
log4j.appender.ERROR
=
org.apache.log4j.RollingFileAppender
log4j.appender.ERROR.Threshold
=
error
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.MaxFileSize
=
10MB
log4j.appender.ERROR.MaxBackupIndex
=
10
log4j.appender.ERROR.MaxBackupIndex
=
10
log4j.appender.ERROR.layout
=
org.apache.log4j.PatternLayout
log4j.appender.ERROR.layout
=
org.apache.log4j.PatternLayout
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment