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
4a2013da
Commit
4a2013da
authored
Dec 20, 2017
by
shenjinzhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
4ec6ab5c
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
50 deletions
+49
-50
src/main/java/com/zhiwei/chendong/ExcelReadAndWrite.java
+44
-45
src/main/resources/datasource.properties
+1
-1
target/change4weixin-3.0.1-SNAPSHOT/WEB-INF/classes/com/zhiwei/chendong/ExcelReadAndWrite$1.class
+0
-0
target/change4weixin-3.0.1-SNAPSHOT/WEB-INF/classes/com/zhiwei/chendong/ExcelReadAndWrite.class
+0
-0
target/change4weixin-3.0.1-SNAPSHOT/WEB-INF/classes/datasource.properties
+1
-1
target/change4weixin-3.0.1-SNAPSHOT/canvas.js
+1
-1
target/change4weixin.war
+0
-0
target/classes/datasource.properties
+1
-1
target/maven-archiver/pom.properties
+1
-1
No files found.
src/main/java/com/zhiwei/chendong/ExcelReadAndWrite.java
View file @
4a2013da
...
@@ -13,6 +13,7 @@ import java.io.PrintWriter;
...
@@ -13,6 +13,7 @@ import java.io.PrintWriter;
import
java.net.Socket
;
import
java.net.Socket
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.LinkedList
;
...
@@ -139,7 +140,10 @@ public class ExcelReadAndWrite {
...
@@ -139,7 +140,10 @@ public class ExcelReadAndWrite {
}
}
public
static
void
write
(
List
<
Weixin
>
list
,
String
mail
)
throws
Exception
{
public
static
void
write
(
List
<
Weixin
>
list
,
String
mail
)
throws
Exception
{
File
tempFile
=
new
File
(
url
);
Calendar
cal
=
Calendar
.
getInstance
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
String
inurl
=
url
+
(
int
)
(
Math
.
random
()
*
99
)
+
sdf
.
format
(
cal
.
getTime
())
+
".xls"
;
File
tempFile
=
new
File
(
inurl
);
// 若是文件不存在就创建新文件
// 若是文件不存在就创建新文件
if
(!
tempFile
.
exists
())
{
if
(!
tempFile
.
exists
())
{
tempFile
.
createNewFile
();
tempFile
.
createNewFile
();
...
@@ -148,12 +152,6 @@ public class ExcelReadAndWrite {
...
@@ -148,12 +152,6 @@ public class ExcelReadAndWrite {
WritableSheet
sheet
=
workbook
.
createSheet
(
"table1"
,
0
);
WritableSheet
sheet
=
workbook
.
createSheet
(
"table1"
,
0
);
// 一些临时变量,用于写到excel中
// 一些临时变量,用于写到excel中
Label
l
=
null
;
Label
l
=
null
;
// 预定义的一些字体和格式,格式: 字形 大小 加粗 倾斜 下划线 颜色
WritableFont
font1
=
new
WritableFont
(
WritableFont
.
ARIAL
,
14
,
WritableFont
.
BOLD
,
false
,
UnderlineStyle
.
NO_UNDERLINE
,
Colour
.
WHITE
);
WritableFont
font2
=
new
WritableFont
(
WritableFont
.
ARIAL
,
18
,
WritableFont
.
BOLD
,
false
,
UnderlineStyle
.
NO_UNDERLINE
,
Colour
.
WHITE
);
// 标题格式
// 标题格式
WritableFont
titleFont
=
new
WritableFont
(
WritableFont
.
ARIAL
,
14
,
WritableFont
.
NO_BOLD
,
false
,
WritableFont
titleFont
=
new
WritableFont
(
WritableFont
.
ARIAL
,
14
,
WritableFont
.
NO_BOLD
,
false
,
UnderlineStyle
.
NO_UNDERLINE
,
jxl
.
format
.
Colour
.
BLACK
);
UnderlineStyle
.
NO_UNDERLINE
,
jxl
.
format
.
Colour
.
BLACK
);
...
@@ -219,10 +217,10 @@ public class ExcelReadAndWrite {
...
@@ -219,10 +217,10 @@ public class ExcelReadAndWrite {
workbook
.
write
();
workbook
.
write
();
workbook
.
close
();
workbook
.
close
();
log
.
info
(
"内容写入成功"
);
log
.
info
(
"内容写入成功"
);
SendMailUtil
.
sendMessage
(
mail
,
url
,
"ccxe"
);
SendMailUtil
.
sendMessage
(
mail
,
in
url
,
"ccxe"
);
ExcelFile
ef
=
new
ExcelFile
();
ExcelFile
ef
=
new
ExcelFile
();
ef
.
setMail
(
mail
);
ef
.
setMail
(
mail
);
ef
.
setUrl
(
url
);
ef
.
setUrl
(
in
url
);
insert
(
ef
);
insert
(
ef
);
System
.
out
.
println
(
"发送完成"
);
System
.
out
.
println
(
"发送完成"
);
}
}
...
@@ -327,6 +325,8 @@ public class ExcelReadAndWrite {
...
@@ -327,6 +325,8 @@ public class ExcelReadAndWrite {
public
static
boolean
so
()
{
public
static
boolean
so
()
{
boolean
b
=
true
;
boolean
b
=
true
;
int
tip
=
0
;
int
tip
=
0
;
int
now
=
999
;
int
before
=
0
;
try
{
try
{
Thread
.
sleep
(
1000
*
5
);
Thread
.
sleep
(
1000
*
5
);
while
(
cut
)
{
// cut=true,插队中
while
(
cut
)
{
// cut=true,插队中
...
@@ -340,18 +340,6 @@ public class ExcelReadAndWrite {
...
@@ -340,18 +340,6 @@ public class ExcelReadAndWrite {
MainController
.
lists
.
get
(
0
).
setState
(
"运行中···"
);
MainController
.
lists
.
get
(
0
).
setState
(
"运行中···"
);
tip
=
0
;
tip
=
0
;
}
}
// Socket s = new Socket(host, port);
// InputStream in = s.getInputStream();
// BufferedReader reader = new BufferedReader(new
// InputStreamReader(in, "utf-8"));
// String str = reader.readLine();
// log.info(str);
//
// if (str.equals("{num:1}") || str.equals("{num:0}")) {
// b = false;
// }
// in.close();
// s.close();
try
(
Socket
s
=
new
Socket
(
host
,
port
);
try
(
Socket
s
=
new
Socket
(
host
,
port
);
PrintWriter
pw
=
new
PrintWriter
(
s
.
getOutputStream
());
PrintWriter
pw
=
new
PrintWriter
(
s
.
getOutputStream
());
BufferedReader
bufferedReader
=
new
BufferedReader
(
BufferedReader
bufferedReader
=
new
BufferedReader
(
...
@@ -359,13 +347,15 @@ public class ExcelReadAndWrite {
...
@@ -359,13 +347,15 @@ public class ExcelReadAndWrite {
pw
.
println
(
"getnum"
);
pw
.
println
(
"getnum"
);
pw
.
flush
();
pw
.
flush
();
String
str
=
bufferedReader
.
readLine
();
String
str
=
bufferedReader
.
readLine
();
System
.
out
.
println
(
"正常运行"
+
str
);
System
.
out
.
println
(
"正常运行"
+
str
);
Matcher
macher
=
Pattern
.
compile
(
"num:([0-9]+
?
)\\}"
).
matcher
(
str
);
Matcher
macher
=
Pattern
.
compile
(
"num:([0-9]+)\\}"
).
matcher
(
str
);
if
(
macher
.
find
())
{
if
(
macher
.
find
())
{
if
(
Integer
.
valueOf
(
macher
.
group
(
1
))
!=
0
)
if
(
Integer
.
valueOf
(
macher
.
group
(
1
))
!=
0
)
{
MainController
.
lists
.
get
(
0
).
setSurplusCount
(
Integer
.
valueOf
(
macher
.
group
(
1
)));
now
=
Integer
.
valueOf
(
macher
.
group
(
1
));
MainController
.
lists
.
get
(
0
).
setSurplusCount
(
now
);
}
}
}
if
(
str
.
contains
(
"0"
)
)
{
if
(
now
==
0
)
{
b
=
false
;
b
=
false
;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -387,7 +377,7 @@ public class ExcelReadAndWrite {
...
@@ -387,7 +377,7 @@ public class ExcelReadAndWrite {
pw
.
println
(
"getnum"
);
pw
.
println
(
"getnum"
);
pw
.
flush
();
pw
.
flush
();
String
str
=
bufferedReader
.
readLine
();
String
str
=
bufferedReader
.
readLine
();
System
.
out
.
println
(
"插队运行"
+
str
);
System
.
out
.
println
(
"插队运行"
+
str
);
if
(
str
.
contains
(
"0"
))
{
if
(
str
.
contains
(
"0"
))
{
b
=
false
;
b
=
false
;
}
}
...
@@ -555,22 +545,30 @@ public class ExcelReadAndWrite {
...
@@ -555,22 +545,30 @@ public class ExcelReadAndWrite {
}
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
for
(
Map
<
String
,
Object
>
ma
:
m
.
find
())
{
for
(
Map
<
String
,
Object
>
ma
:
m
.
find
())
{
if
(
ma
!=
null
&&
ma
.
get
(
"url"
)
!=
null
)
try
{
map
.
put
(
ma
.
get
(
"_id"
).
toString
(),
ma
.
get
(
"url"
).
toString
());
if
(
ma
!=
null
&&
ma
.
get
(
"url"
)
!=
null
)
map
.
put
(
ma
.
get
(
"_id"
).
toString
(),
ma
.
get
(
"url"
).
toString
());
}
catch
(
Exception
e
)
{
log
.
info
(
"错误信息+560{}"
+
e
.
getMessage
());
}
}
}
for
(
Weixin
w
:
list
)
{
for
(
Weixin
w
:
list
)
{
if
(
null
!=
w
.
getUrl
()
&&
w
.
getUrl
().
startsWith
(
"https://mp.weixin.qq.com/s"
)
try
{
||
w
.
getUrl
().
startsWith
(
"http://mp.weixin.qq.com/s"
))
{
if
(
null
!=
w
.
getUrl
()
&&
w
.
getUrl
().
startsWith
(
"https://mp.weixin.qq.com/s"
)
if
(
map
.
get
(
w
.
getUrl
())
!=
null
)
{
||
w
.
getUrl
().
startsWith
(
"http://mp.weixin.qq.com/s"
))
{
w
.
setGetUrl
(
map
.
get
(
w
.
getUrl
()));
if
(
map
.
get
(
w
.
getUrl
())
!=
null
)
{
w
.
setGetUrl
(
map
.
get
(
w
.
getUrl
()));
}
}
else
{
w
.
setGetUrl
(
w
.
getUrl
()
==
null
?
""
:
w
.
getUrl
());
}
}
}
else
{
}
catch
(
Exception
e
)
{
w
.
setGetUrl
(
w
.
getUrl
()
==
null
?
""
:
w
.
getUrl
());
log
.
info
(
"错误信息+574{}"
+
e
.
getMessage
());
}
}
}
}
write
(
list
,
e
.
getMail
());
write
(
list
,
e
.
getMail
());
//
delete(e.getUrl());
//
delete(e.getUrl());
MainController
.
lists
.
remove
(
MainController
.
lists
.
get
(
0
));
MainController
.
lists
.
remove
(
MainController
.
lists
.
get
(
0
));
e
=
null
;
e
=
null
;
}
}
...
@@ -590,6 +588,7 @@ public class ExcelReadAndWrite {
...
@@ -590,6 +588,7 @@ public class ExcelReadAndWrite {
/**
/**
* 删除文件
* 删除文件
*
* @param url
* @param url
* 文件的路径
* 文件的路径
*/
*/
...
@@ -600,17 +599,17 @@ public class ExcelReadAndWrite {
...
@@ -600,17 +599,17 @@ public class ExcelReadAndWrite {
}
}
log
.
info
(
"删除完成"
);
log
.
info
(
"删除完成"
);
}
}
public
static
void
insert
(
ExcelFile
ef
){
public
static
void
insert
(
ExcelFile
ef
)
{
m
.
insertFile
(
ef
);
m
.
insertFile
(
ef
);
}
}
public
static
List
<
ExcelFile
>
findEf
(){
public
static
List
<
ExcelFile
>
findEf
()
{
List
<
ExcelFile
>
list
=
m
.
findFile
();
List
<
ExcelFile
>
list
=
m
.
findFile
();
return
list
;
return
list
;
}
}
public
static
String
findById
(
String
id
){
public
static
String
findById
(
String
id
)
{
return
m
.
findByid
(
id
);
return
m
.
findByid
(
id
);
}
}
...
...
src/main/resources/datasource.properties
View file @
4a2013da
basefile
=
/home/nbzhiwei/upload/
new.xls
basefile
=
/home/nbzhiwei/upload/
#basefile=C:/Users/Administrator/Desktop/news222.xls
#basefile=C:/Users/Administrator/Desktop/news222.xls
timefileUrl
=
/home/nbzhiwei/upload
timefileUrl
=
/home/nbzhiwei/upload
#timefileUrl=C:/Users/Administrator/Desktop
#timefileUrl=C:/Users/Administrator/Desktop
...
...
target/change4weixin-3.0.1-SNAPSHOT/WEB-INF/classes/com/zhiwei/chendong/ExcelReadAndWrite$1.class
View file @
4a2013da
No preview for this file type
target/change4weixin-3.0.1-SNAPSHOT/WEB-INF/classes/com/zhiwei/chendong/ExcelReadAndWrite.class
View file @
4a2013da
No preview for this file type
target/change4weixin-3.0.1-SNAPSHOT/WEB-INF/classes/datasource.properties
View file @
4a2013da
basefile
=
/home/nbzhiwei/upload/
new.xls
basefile
=
/home/nbzhiwei/upload/
#basefile=C:/Users/Administrator/Desktop/news222.xls
#basefile=C:/Users/Administrator/Desktop/news222.xls
timefileUrl
=
/home/nbzhiwei/upload
timefileUrl
=
/home/nbzhiwei/upload
#timefileUrl=C:/Users/Administrator/Desktop
#timefileUrl=C:/Users/Administrator/Desktop
...
...
target/change4weixin-3.0.1-SNAPSHOT/canvas.js
View file @
4a2013da
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
z
:
o
(
v
,
"zIndex"
,
1
),
z
:
o
(
v
,
"zIndex"
,
1
),
o
:
o
(
v
,
"opacity"
,
1
),
o
:
o
(
v
,
"opacity"
,
1
),
c
:
o
(
v
,
"color"
,
"255,255,153"
),
c
:
o
(
v
,
"color"
,
"255,255,153"
),
n
:
o
(
v
,
"count"
,
20
0
)
n
:
o
(
v
,
"count"
,
19
0
)
}
}
}
}
function
k
()
{
function
k
()
{
...
...
target/change4weixin.war
View file @
4a2013da
No preview for this file type
target/classes/datasource.properties
View file @
4a2013da
basefile
=
/home/nbzhiwei/upload/
new.xls
basefile
=
/home/nbzhiwei/upload/
#basefile=C:/Users/Administrator/Desktop/news222.xls
#basefile=C:/Users/Administrator/Desktop/news222.xls
timefileUrl
=
/home/nbzhiwei/upload
timefileUrl
=
/home/nbzhiwei/upload
#timefileUrl=C:/Users/Administrator/Desktop
#timefileUrl=C:/Users/Administrator/Desktop
...
...
target/maven-archiver/pom.properties
View file @
4a2013da
#Generated by Maven
#Generated by Maven
#
Tue Dec 19 14:45:48
CST 2017
#
Wed Dec 20 12:02:17
CST 2017
version
=
3.0.1-SNAPSHOT
version
=
3.0.1-SNAPSHOT
groupId
=
com.zhiwei
groupId
=
com.zhiwei
artifactId
=
change4weixin
artifactId
=
change4weixin
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