Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gdtel-gztel-school-center
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴学德
gdtel-gztel-school-center
Commits
af8d5f6d
Commit
af8d5f6d
authored
Oct 19, 2020
by
黎配弘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除一些无效的代码
parent
a09b3090
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
60 deletions
+68
-60
common/src/main/java/com/winsun/utils/HTTPSClient.java
+54
-58
service-manager/src/main/java/com/winsun/service/impl/ExportExcelServiceImpl.java
+14
-2
No files found.
common/src/main/java/com/winsun/utils/HTTPSClient.java
View file @
af8d5f6d
...
...
@@ -39,10 +39,8 @@ public class HTTPSClient {
/**
* 向指定 URL 发送POST方法的请求
*
* @param url
* 发送请求的 URL
* @param param
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
// 不走代理
...
...
@@ -75,7 +73,7 @@ public class HTTPSClient {
e
.
printStackTrace
();
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
finally
{
}
finally
{
try
{
httpClient
.
close
();
}
catch
(
IOException
e
)
{
...
...
@@ -90,10 +88,8 @@ public class HTTPSClient {
/**
* 向指定 URL 发送POST方法的请求
*
* @param url
* 发送请求的 URL
* @param param
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
// 走代理
...
...
@@ -105,7 +101,6 @@ public class HTTPSClient {
StringEntity
s
=
new
StringEntity
(
param
,
"UTF-8"
);
// 中文乱码在此解决
s
.
setContentType
(
"application/json"
);
httpPost
.
setEntity
(
s
);
HttpResponse
res
;
try
{
HttpHost
proxy
=
new
HttpHost
(
"172.18.101.170"
,
3128
);
...
...
@@ -121,7 +116,7 @@ public class HTTPSClient {
e
.
printStackTrace
();
}
catch
(
IllegalStateException
e
)
{
e
.
printStackTrace
();
}
finally
{
}
finally
{
try
{
httpClient
.
close
();
}
catch
(
IOException
e
)
{
...
...
@@ -136,10 +131,8 @@ public class HTTPSClient {
/**
* 向指定 URL 发送POST方法的请求
*
* @param url
* 发送请求的 URL
* @param param
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public
static
String
sendCodePost
(
String
url
,
String
param
)
{
...
...
@@ -153,7 +146,6 @@ public class HTTPSClient {
s
.
setContentType
(
"application/json"
);
httpPost
.
setEntity
(
s
);
HttpResponse
res
;
try
{
HttpHost
proxy
=
new
HttpHost
(
"172.18.101.170"
,
3128
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
200000
).
setConnectTimeout
(
200000
).
setProxy
(
proxy
).
build
();
...
...
@@ -168,7 +160,7 @@ public class HTTPSClient {
e
.
printStackTrace
();
}
catch
(
IllegalStateException
e
)
{
e
.
printStackTrace
();
}
finally
{
}
finally
{
try
{
httpClient
.
close
();
}
catch
(
IOException
e
)
{
...
...
@@ -228,10 +220,8 @@ public class HTTPSClient {
/**
* 向指定 URL 发送POST方法的请求
*
* @param url
* 发送请求的 URL
* @param param
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public
static
String
sendPosts
(
String
url
,
String
param
)
{
...
...
@@ -252,7 +242,7 @@ public class HTTPSClient {
conn
.
setDoOutput
(
true
);
conn
.
setDoInput
(
true
);
// 获取URLConnection对象对应的输出流
out
=
new
PrintWriter
(
new
OutputStreamWriter
(
conn
.
getOutputStream
(),
"utf-8"
));
out
=
new
PrintWriter
(
new
OutputStreamWriter
(
conn
.
getOutputStream
(),
"utf-8"
));
// 发送请求参数
out
.
print
(
param
);
// flush输出流的缓冲
...
...
@@ -271,26 +261,30 @@ public class HTTPSClient {
// 使用finally块来关闭输出流、输入流
finally
{
if
(
out
!=
null
)
{
try
{
try
{
out
.
close
();
}
catch
(
Exception
ex
)
{}
}
catch
(
Exception
ex
)
{
}
}
if
(
in
!=
null
)
{
try
{
try
{
in
.
close
();
}
catch
(
IOException
ex
)
{}
}
catch
(
IOException
ex
)
{
}
}
try
{
try
{
if
(
conn
.
getInputStream
()
!=
null
)
{
conn
.
getInputStream
().
close
();
}
}
catch
(
IOException
ex
)
{}
}
catch
(
IOException
ex
)
{
}
try
{
try
{
if
(
conn
.
getOutputStream
()
!=
null
)
{
conn
.
getOutputStream
().
close
();
}
}
catch
(
IOException
ex
)
{}
}
catch
(
IOException
ex
)
{
}
}
return
result
;
}
...
...
@@ -329,7 +323,8 @@ public class HTTPSClient {
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
200000
).
setConnectTimeout
(
200000
).
setProxy
(
proxy
).
build
();
httpPost
.
setConfig
(
requestConfig
);
CloseableHttpResponse
result
=
httpClient
.
execute
(
httpPost
);
string
=
EntityUtils
.
toString
(
result
.
getEntity
(),
"utf-8"
);
;
string
=
EntityUtils
.
toString
(
result
.
getEntity
(),
"utf-8"
);
;
}
catch
(
ClientProtocolException
e
)
{
e
.
printStackTrace
();
...
...
@@ -343,32 +338,33 @@ public class HTTPSClient {
/**
* 发送xml请求到server端
*
* @param url xml请求数据地址
* @param xmlString 发送的xml数据流
* @return null发送失败,否则返回响应内容
* @throws IOException
*/
public
static
String
sendPostXml
(
String
url
,
String
xmlString
)
throws
IOException
{
public
static
String
sendPostXml
(
String
url
,
String
xmlString
)
throws
IOException
{
//创建httpclient工具对象
HttpClient
client
=
new
HttpClient
();
//创建post请求方法
PostMethod
myPost
=
new
PostMethod
(
url
);
//设置请求超时时间
client
.
setConnectionTimeout
(
3000
*
1000
);
client
.
setConnectionTimeout
(
3000
*
1000
);
String
responseString
=
null
;
InputStream
inputStream
=
null
;
BufferedReader
br
=
null
;
try
{
try
{
//设置请求头部类型
myPost
.
setRequestHeader
(
"Content-Type"
,
"text/xml"
);
myPost
.
setRequestHeader
(
"charset"
,
"utf-8"
);
myPost
.
setRequestHeader
(
"Content-Type"
,
"text/xml"
);
myPost
.
setRequestHeader
(
"charset"
,
"utf-8"
);
//设置请求体,即xml文本内容,一种是直接获取xml内容字符串,一种是读取xml文件以流的形式
myPost
.
setRequestBody
(
xmlString
);
int
statusCode
=
client
.
executeMethod
(
myPost
);
//只有请求成功200了,才做处理
if
(
statusCode
==
HttpStatus
.
SC_OK
){
if
(
statusCode
==
HttpStatus
.
SC_OK
)
{
inputStream
=
myPost
.
getResponseBodyAsStream
();
br
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
,
"utf-8"
));
br
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
,
"utf-8"
));
StringBuffer
stringBuffer
=
new
StringBuffer
();
String
str
=
""
;
while
((
str
=
br
.
readLine
())
!=
null
)
{
...
...
@@ -376,14 +372,14 @@ public class HTTPSClient {
}
responseString
=
stringBuffer
.
toString
();
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
}
finally
{
myPost
.
releaseConnection
();
if
(
null
!=
inputStream
)
if
(
null
!=
inputStream
)
inputStream
.
close
();
if
(
null
!=
br
)
if
(
null
!=
br
)
br
.
close
();
}
return
responseString
;
...
...
@@ -491,30 +487,30 @@ public class HTTPSClient {
menu_xsgj
=
URLEncoder
.
encode
(
menu_xsgj
,
"UTF-8"
);
menu_fhdj
=
URLEncoder
.
encode
(
menu_fhdj
,
"UTF-8"
);
menu_userInfo
=
URLEncoder
.
encode
(
menu_userInfo
,
"UTF-8"
);
menu_userInfo
=
URLEncoder
.
encode
(
menu_userInfo
,
"UTF-8"
);
menu_register
=
URLEncoder
.
encode
(
menu_register
,
"UTF-8"
);
menu_czzj
=
URLEncoder
.
encode
(
menu_czzj
,
"UTF-8"
);
menu_twzf
=
URLEncoder
.
encode
(
menu_twzf
,
"UTF-8"
);
menu_yrym
=
URLEncoder
.
encode
(
menu_yrym
,
"UTF-8"
);
menu_czzj
=
URLEncoder
.
encode
(
menu_czzj
,
"UTF-8"
);
menu_twzf
=
URLEncoder
.
encode
(
menu_twzf
,
"UTF-8"
);
menu_yrym
=
URLEncoder
.
encode
(
menu_yrym
,
"UTF-8"
);
//menu_blzc = URLEncoder.encode(menu_blzc, "UTF-8");
//part3
menu_tdhd
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_tdhd
);
menu_grhd
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_grhd
);
menu_lshd
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_lshd
);
menu_tdhd
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_tdhd
);
menu_grhd
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_grhd
);
menu_lshd
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_lshd
);
menu_xsgj
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_xsgj
);
menu_fhdj
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_fhdj
);
menu_xsgj
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_xsgj
);
menu_fhdj
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_fhdj
);
menu_ywdj
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_ywdj
);
menu_xscx
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_xscx
);
menu_ywdj
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_ywdj
);
menu_xscx
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_xscx
);
menu_register
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_register
);
menu_userInfo
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_userInfo
);
menu_czzj
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_czzj
);
menu_twzf
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_twzf
);
menu_yrym
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_yrym
);
menu_register
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_register
);
menu_userInfo
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_userInfo
);
menu_czzj
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_czzj
);
menu_twzf
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_twzf
);
menu_yrym
=
Weixin
.
replace
(
"redirect_uri="
,
"redirect_uri="
+
menu_yrym
);
//menu_blzc = Weixin.replace("redirect_uri=", "redirect_uri="+ menu_blzc);
JSONArray
menu
=
new
JSONArray
();
...
...
service-manager/src/main/java/com/winsun/service/impl/ExportExcelServiceImpl.java
View file @
af8d5f6d
package
com
.
winsun
.
service
.
impl
;
import
com.winsun.auth.core.util.IOUtils
;
import
com.winsun.bean.ExportExcel
;
import
com.winsun.service.ExportExcelService
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -37,7 +36,20 @@ public class ExportExcelServiceImpl implements ExportExcelService {
}
catch
(
Exception
e
)
{
log
.
error
(
"下载excel文件异常"
+
e
.
getMessage
(),
e
);
}
finally
{
IOUtils
.
closeQuite
(
fileInputStream
,
in
);
if
(
fileInputStream
!=
null
)
{
try
{
fileInputStream
.
close
();
}
catch
(
Exception
e
){
}
}
if
(
in
!=
null
)
{
try
{
in
.
close
();
}
catch
(
Exception
e
){
}
}
}
}
}
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