Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
Project
Project
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
曲欣亮
common
Commits
ce55671f
Commit
ce55671f
authored
Apr 26, 2020
by
张永
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.linkfern.com/key/common.git
parents
6f644eb1
2a73609a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1194 additions
and
1158 deletions
+1194
-1158
pom.xml
pom.xml
+125
-120
FileUtil.java
src/main/java/com/egolm/common/FileUtil.java
+8
-28
FtpUtil.java
src/main/java/com/egolm/common/FtpUtil.java
+206
-206
HttpUtil.java
src/main/java/com/egolm/common/HttpUtil.java
+5
-4
StringUtil.java
src/main/java/com/egolm/common/StringUtil.java
+2
-1
JdbcTemplate.java
src/main/java/com/egolm/common/jdbc/JdbcTemplate.java
+682
-633
ReverseUtil.java
src/main/java/com/egolm/common/jdbc/dialect/ReverseUtil.java
+166
-166
No files found.
pom.xml
View file @
ce55671f
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.egolm
</groupId>
<artifactId>
common
</artifactId>
<version>
0.0.1-RELEASE
</version>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-webmvc
</artifactId>
<version>
4.2.4.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-jdbc
</artifactId>
<version>
4.2.4.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-redis
</artifactId>
<version>
1.8.3.RELEASE
</version>
</dependency>
<dependency>
<groupId>
cglib
</groupId>
<artifactId>
cglib-full
</artifactId>
<version>
2.0.2
</version>
</dependency>
<dependency>
<groupId>
com.belerweb
</groupId>
<artifactId>
pinyin4j
</artifactId>
<version>
2.5.0
</version>
</dependency>
<dependency>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
1.2.16
</version>
</dependency>
<dependency>
<groupId>
commons-codec
</groupId>
<artifactId>
commons-codec
</artifactId>
<version>
1.10
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.8.2
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<version>
3.0.1
</version>
</dependency>
<dependency>
<groupId>
javax.persistence
</groupId>
<artifactId>
persistence-api
</artifactId>
<version>
1.0.2
</version>
</dependency>
<dependency>
<groupId>
javax.mail
</groupId>
<artifactId>
javax.mail-api
</artifactId>
<version>
1.5.0-b01
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
3.8
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk16
</artifactId>
<version>
1.46
</version>
</dependency>
<dependency>
<groupId>
com.jcraft
</groupId>
<artifactId>
jsch
</artifactId>
<version>
0.1.54
</version>
</dependency>
<dependency>
<groupId>
commons-net
</groupId>
<artifactId>
commons-net
</artifactId>
<version>
3.4
</version>
</dependency>
<dependency>
<groupId>
dom4j
</groupId>
<artifactId>
dom4j
</artifactId>
<version>
1.6.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
<version>
4.5.2
</version>
</dependency>
<dependency>
<groupId>
commons-httpclient
</groupId>
<artifactId>
commons-httpclient
</artifactId>
<version>
3.1
</version>
</dependency>
<dependency>
<groupId>
com.sun.mail
</groupId>
<artifactId>
javax.mail
</artifactId>
<version>
1.6.1
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.3
</version>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
</configuration>
</plugin>
</plugins>
</build>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.egolm
</groupId>
<artifactId>
common
</artifactId>
<version>
0.0.1-RELEASE
</version>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-webmvc
</artifactId>
<version>
4.2.4.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-jdbc
</artifactId>
<version>
4.2.4.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-redis
</artifactId>
<version>
1.8.3.RELEASE
</version>
</dependency>
<dependency>
<groupId>
cglib
</groupId>
<artifactId>
cglib-full
</artifactId>
<version>
2.0.2
</version>
</dependency>
<dependency>
<groupId>
com.belerweb
</groupId>
<artifactId>
pinyin4j
</artifactId>
<version>
2.5.0
</version>
</dependency>
<dependency>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
1.2.16
</version>
</dependency>
<dependency>
<groupId>
commons-codec
</groupId>
<artifactId>
commons-codec
</artifactId>
<version>
1.10
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.8.2
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<version>
3.0.1
</version>
</dependency>
<dependency>
<groupId>
javax.persistence
</groupId>
<artifactId>
persistence-api
</artifactId>
<version>
1.0.2
</version>
</dependency>
<dependency>
<groupId>
javax.mail
</groupId>
<artifactId>
javax.mail-api
</artifactId>
<version>
1.5.0-b01
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
3.8
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk16
</artifactId>
<version>
1.46
</version>
</dependency>
<dependency>
<groupId>
com.jcraft
</groupId>
<artifactId>
jsch
</artifactId>
<version>
0.1.54
</version>
</dependency>
<dependency>
<groupId>
commons-net
</groupId>
<artifactId>
commons-net
</artifactId>
<version>
3.4
</version>
</dependency>
<dependency>
<groupId>
dom4j
</groupId>
<artifactId>
dom4j
</artifactId>
<version>
1.6.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
<version>
4.5.2
</version>
</dependency>
<dependency>
<groupId>
commons-httpclient
</groupId>
<artifactId>
commons-httpclient
</artifactId>
<version>
3.1
</version>
</dependency>
<dependency>
<groupId>
com.sun.mail
</groupId>
<artifactId>
javax.mail
</artifactId>
<version>
1.6.1
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.62
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.3
</version>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
src/main/java/com/egolm/common/FileUtil.java
View file @
ce55671f
...
...
@@ -14,7 +14,6 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.ObjectInputStream
;
import
java.io.ObjectOutputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStreamWriter
;
import
java.io.UnsupportedEncodingException
;
import
java.io.Writer
;
...
...
@@ -363,18 +362,23 @@ public class FileUtil {
public
static
byte
[]
streamToBytes
(
InputStream
instream
)
{
byte
[]
bytes
=
null
;
ByteArrayOutputStream
baos
=
null
;
try
{
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
(
102400
);
baos
=
new
ByteArrayOutputStream
(
102400
);
byte
[]
b
=
new
byte
[
102400
];
int
n
;
while
((
n
=
instream
.
read
(
b
))
!=
-
1
)
{
baos
.
write
(
b
,
0
,
n
);
}
instream
.
close
();
baos
.
close
();
bytes
=
baos
.
toByteArray
();
}
catch
(
Exception
e
)
{
throw
new
FileUtilException
(
"将输入流转换为字节数组异常"
,
e
);
}
finally
{
try
{
baos
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
bytes
;
}
...
...
@@ -549,30 +553,6 @@ public class FileUtil {
}
/**
*
* @Title: inputStreamToFile
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param: @param ins
* @param: @param file
* @return: void
* @throws
*/
public
static
void
inputStreamToFile
(
InputStream
ins
,
File
file
)
{
try
{
OutputStream
os
=
new
FileOutputStream
(
file
);
int
bytesRead
=
0
;
byte
[]
buffer
=
new
byte
[
8192
];
while
((
bytesRead
=
ins
.
read
(
buffer
,
0
,
8192
))
!=
-
1
)
{
os
.
write
(
buffer
,
0
,
bytesRead
);
}
os
.
close
();
ins
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
static
Object
fileToObject
(
File
file
)
{
FileInputStream
fis
=
null
;
ObjectInputStream
ois
=
null
;
...
...
src/main/java/com/egolm/common/FtpUtil.java
View file @
ce55671f
This diff is collapsed.
Click to expand it.
src/main/java/com/egolm/common/HttpUtil.java
View file @
ce55671f
...
...
@@ -13,6 +13,7 @@ import java.net.URLEncoder;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -104,8 +105,8 @@ public class HttpUtil {
System
.
out
.
println
(
requestUrl
);
connection
=
createConnection
(
requestUrl
,
proxy
);
connection
.
setRequestMethod
(
"GET"
);
connection
.
setRequestProperty
(
"Accept-Charset"
,
charset
);
connection
.
setRequestProperty
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
//
connection.setRequestProperty("Accept-Charset", charset);
//
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
if
(
header
!=
null
)
{
for
(
String
key
:
header
.
keySet
())
{
connection
.
setRequestProperty
(
key
,
header
.
get
(
key
));
...
...
@@ -177,6 +178,7 @@ public class HttpUtil {
try
{
bytes
=
FileUtil
.
streamToBytes
(
connection
.
getInputStream
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
bytes
=
FileUtil
.
streamToBytes
(
connection
.
getErrorStream
());
}
Map
<
String
,
List
<
String
>>
responseHeaders
=
connection
.
getHeaderFields
();
...
...
@@ -258,8 +260,7 @@ public class HttpUtil {
for
(
Object
key
:
parameters
.
keySet
())
{
Object
val
=
parameters
.
get
(
key
);
String
sKey
=
String
.
valueOf
(
key
);
Object
[]
sVals
=
(
val
==
null
?
null
:
(
val
instanceof
Object
[]
?
(
Object
[])
val
:
new
Object
[]
{
val
}));
Object
[]
sVals
=
(
val
==
null
?
null
:
(
val
instanceof
Object
[]
?
(
Object
[])
val
:
(
val
instanceof
Collection
<?>
?
((
Collection
<?>)
val
).
toArray
()
:
new
Object
[]
{
val
})));
if
(
sVals
!=
null
&&
sVals
.
length
>
0
)
{
for
(
Object
sVal
:
sVals
)
{
if
(
StringUtil
.
isNotEmpty
(
sVal
))
{
...
...
src/main/java/com/egolm/common/StringUtil.java
View file @
ce55671f
...
...
@@ -1001,7 +1001,8 @@ public class StringUtil {
public
static
String
[]
searchNumber
(
String
string
)
{
List
<
String
>
numbers
=
new
ArrayList
<
String
>();
Pattern
pattern
=
Pattern
.
compile
(
"[\\d]+(\\.?[\\d]+)?"
);
String
regexText
=
"\\d+(\\.\\d+)?"
;
Pattern
pattern
=
Pattern
.
compile
(
regexText
);
Matcher
matcher
=
pattern
.
matcher
(
string
);
while
(
matcher
.
find
())
{
numbers
.
add
(
matcher
.
group
(
0
));
...
...
src/main/java/com/egolm/common/jdbc/JdbcTemplate.java
View file @
ce55671f
This diff is collapsed.
Click to expand it.
src/main/java/com/egolm/common/jdbc/dialect/ReverseUtil.java
View file @
ce55671f
This diff is collapsed.
Click to expand it.
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