Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
08a4cb3b
Commit
08a4cb3b
authored
Nov 20, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master-background-bug' into dev
parents
11da718f
6e5144da
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
358 additions
and
86 deletions
+358
-86
GlobalExceptionHandler.java
...iaoqi/security/common/handler/GlobalExceptionHandler.java
+30
-4
PlatformExceptionHandler.java
...oqi/security/common/handler/PlatformExceptionHandler.java
+21
-3
HttpRequestUtil.java
.../github/wxiaoqi/security/common/util/HttpRequestUtil.java
+0
-73
HttpUtils.java
...va/com/github/wxiaoqi/security/common/util/HttpUtils.java
+301
-0
OrderVehicleCrosstownBiz.java
...com/xxfc/platform/order/biz/OrderVehicleCrosstownBiz.java
+4
-4
EmailSendController.java
...fc/platform/universal/controller/EmailSendController.java
+2
-2
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/handler/GlobalExceptionHandler.java
View file @
08a4cb3b
...
@@ -6,7 +6,7 @@ import com.github.wxiaoqi.security.common.exception.auth.ClientTokenException;
...
@@ -6,7 +6,7 @@ import com.github.wxiaoqi.security.common.exception.auth.ClientTokenException;
import
com.github.wxiaoqi.security.common.exception.auth.UserInvalidException
;
import
com.github.wxiaoqi.security.common.exception.auth.UserInvalidException
;
import
com.github.wxiaoqi.security.common.exception.auth.UserTokenException
;
import
com.github.wxiaoqi.security.common.exception.auth.UserTokenException
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.github.wxiaoqi.security.common.util.Http
RequestUtil
;
import
com.github.wxiaoqi.security.common.util.Http
Utils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpHeaders
;
...
@@ -21,6 +21,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExcep
...
@@ -21,6 +21,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExcep
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.io.StringWriter
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
org
.
springframework
.
http
.
HttpStatus
.
NOT_EXTENDED
;
import
static
org
.
springframework
.
http
.
HttpStatus
.
NOT_EXTENDED
;
...
@@ -69,7 +71,15 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
...
@@ -69,7 +71,15 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
if
(
0
==
ex
.
getStatus
())
{
if
(
0
==
ex
.
getStatus
())
{
response
.
setStatus
(
500
);
response
.
setStatus
(
500
);
}
}
HttpRequestUtil
.
httpGet
(
"http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content="
+
ex
.
getStackTrace
().
toString
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"toUser"
,
"jiaoruizhen@126.com"
);
map
.
put
(
"subject"
,
"服务器异常"
);
map
.
put
(
"content"
,
ex
.
getMessage
());
try
{
HttpUtils
.
doPost
(
"http://10.5.52.3:8765"
,
"/api/universal/mail/app/unauth/send"
,
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
return
new
BaseResponse
(
ex
.
getStatus
(),
ex
.
getMessage
());
return
new
BaseResponse
(
ex
.
getStatus
(),
ex
.
getMessage
());
}
}
...
@@ -82,10 +92,26 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
...
@@ -82,10 +92,26 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
StringWriter
stringWriter
=
new
StringWriter
();
StringWriter
stringWriter
=
new
StringWriter
();
cause
.
printStackTrace
(
new
PrintWriter
(
stringWriter
));
cause
.
printStackTrace
(
new
PrintWriter
(
stringWriter
));
logger
.
error
(
cause
.
getMessage
(),
ex
);
logger
.
error
(
cause
.
getMessage
(),
ex
);
HttpRequestUtil
.
httpGet
(
"http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content="
+
stringWriter
.
toString
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"toUser"
,
"jiaoruizhen@126.com"
);
map
.
put
(
"subject"
,
"服务器异常"
);
map
.
put
(
"content"
,
stringWriter
.
toString
());
try
{
HttpUtils
.
doPost
(
"http://10.5.52.3:8765"
,
"/api/universal/mail/app/unauth/send"
,
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
return
new
BaseResponse
(
5000
,
"Server exception: "
+
ex
.
getMessage
());
return
new
BaseResponse
(
5000
,
"Server exception: "
+
ex
.
getMessage
());
}
}
HttpRequestUtil
.
httpGet
(
"http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content="
+
ex
.
getStackTrace
().
toString
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"toUser"
,
"jiaoruizhen@126.com"
);
map
.
put
(
"subject"
,
"服务器异常"
);
map
.
put
(
"content"
,
ex
.
getMessage
());
try
{
HttpUtils
.
doPost
(
"http://10.5.52.3:8765"
,
"/api/universal/mail/app/unauth/send"
,
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
return
new
BaseResponse
(
CommonConstants
.
EX_OTHER_CODE
,
ex
.
getMessage
());
return
new
BaseResponse
(
CommonConstants
.
EX_OTHER_CODE
,
ex
.
getMessage
());
}
}
}
}
ace-common/src/main/java/com/github/wxiaoqi/security/common/handler/PlatformExceptionHandler.java
View file @
08a4cb3b
...
@@ -4,7 +4,7 @@ package com.github.wxiaoqi.security.common.handler;
...
@@ -4,7 +4,7 @@ package com.github.wxiaoqi.security.common.handler;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.Http
RequestUtil
;
import
com.github.wxiaoqi.security.common.util.Http
Utils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
...
@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
...
@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.io.StringWriter
;
import
java.util.HashMap
;
import
java.util.Map
;
@RestControllerAdvice
(
"com.xxfc.platform"
)
@RestControllerAdvice
(
"com.xxfc.platform"
)
@Slf4j
@Slf4j
...
@@ -35,11 +37,27 @@ public class PlatformExceptionHandler {
...
@@ -35,11 +37,27 @@ public class PlatformExceptionHandler {
StringWriter
stringWriter
=
new
StringWriter
();
StringWriter
stringWriter
=
new
StringWriter
();
cause
.
printStackTrace
(
new
PrintWriter
(
stringWriter
));
cause
.
printStackTrace
(
new
PrintWriter
(
stringWriter
));
log
.
error
(
cause
.
getMessage
(),
e
);
log
.
error
(
cause
.
getMessage
(),
e
);
HttpRequestUtil
.
httpGet
(
"http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content="
+
stringWriter
.
toString
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"toUser"
,
"jiaoruizhen@126.com"
);
map
.
put
(
"subject"
,
"服务器异常"
);
map
.
put
(
"content"
,
stringWriter
.
toString
());
try
{
HttpUtils
.
doPost
(
"http://10.5.52.3:8765"
,
"/api/universal/mail/app/unauth/send"
,
map
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
());
}
return
assembleResult
(
ObjectRestResponse
.
createFailedResult
(
5000
,
"服务器开小差了,请稍后重试!"
),
"Server exception: "
+
e
.
getMessage
());
return
assembleResult
(
ObjectRestResponse
.
createFailedResult
(
5000
,
"服务器开小差了,请稍后重试!"
),
"Server exception: "
+
e
.
getMessage
());
}
}
log
.
error
(
"Server exception: "
,
e
);
log
.
error
(
"Server exception: "
,
e
);
HttpRequestUtil
.
httpGet
(
"http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content="
+
e
.
getStackTrace
().
toString
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"toUser"
,
"jiaoruizhen@126.com"
);
map
.
put
(
"subject"
,
"服务器异常"
);
map
.
put
(
"content"
,
e
.
getMessage
());
try
{
HttpUtils
.
doPost
(
"http://10.5.52.3:8765"
,
"/api/universal/mail/app/unauth/send"
,
map
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
());
}
return
assembleResult
(
ObjectRestResponse
.
createFailedResult
(
5000
,
"服务器开小差了,请稍后重试!"
),
"Server exception: "
+
e
.
getMessage
());
return
assembleResult
(
ObjectRestResponse
.
createFailedResult
(
5000
,
"服务器开小差了,请稍后重试!"
),
"Server exception: "
+
e
.
getMessage
());
}
}
...
...
ace-common/src/main/java/com/github/wxiaoqi/security/common/util/HttpRequestUtil.java
deleted
100644 → 0
View file @
11da718f
package
com
.
github
.
wxiaoqi
.
security
.
common
.
util
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.impl.client.DefaultHttpClient
;
import
org.apache.http.util.EntityUtils
;
import
java.io.IOException
;
import
java.net.URLDecoder
;
@Slf4j
public
class
HttpRequestUtil
{
/**
* post请求
* @param url url地址
* @return
*/
public
static
String
httpPost
(
String
url
){
//post请求返回结果
DefaultHttpClient
httpClient
=
new
DefaultHttpClient
();
HttpPost
method
=
new
HttpPost
(
url
);
String
str
=
""
;
try
{
HttpResponse
result
=
httpClient
.
execute
(
method
);
url
=
URLDecoder
.
decode
(
url
,
"UTF-8"
);
/**请求发送成功,并得到响应**/
if
(
result
.
getStatusLine
().
getStatusCode
()
==
200
)
{
try
{
/**读取服务器返回过来的json字符串数据**/
str
=
EntityUtils
.
toString
(
result
.
getEntity
(),
"UTF-8"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"post请求提交失败:"
+
url
,
e
);
}
}
}
catch
(
IOException
e
)
{
log
.
error
(
"post请求提交失败:"
+
url
,
e
);
}
return
str
;
}
/**
* 发送get请求
* @param url 路径
* @return
*/
public
static
String
httpGet
(
String
url
){
//get请求返回结果
String
strResult
=
null
;
try
{
DefaultHttpClient
client
=
new
DefaultHttpClient
();
//发送get请求
HttpGet
request
=
new
HttpGet
(
url
);
HttpResponse
response
=
client
.
execute
(
request
);
/**请求发送成功,并得到响应**/
if
(
response
.
getStatusLine
().
getStatusCode
()
==
org
.
apache
.
http
.
HttpStatus
.
SC_OK
)
{
/**读取服务器返回过来的json字符串数据**/
strResult
=
EntityUtils
.
toString
(
response
.
getEntity
(),
"UTF-8"
);
}
else
{
log
.
error
(
"get请求提交失败:"
+
url
);
}
}
catch
(
IOException
e
)
{
log
.
error
(
"get请求提交失败:"
+
url
,
e
);
}
return
strResult
;
}
}
ace-common/src/main/java/com/github/wxiaoqi/security/common/util/HttpUtils.java
0 → 100644
View file @
08a4cb3b
This diff is collapsed.
Click to expand it.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderVehicleCrosstownBiz.java
View file @
08a4cb3b
...
@@ -251,7 +251,6 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
...
@@ -251,7 +251,6 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
}
}
Vehicle
vehicle
=
null
;
Vehicle
vehicle
=
null
;
RestResponse
<
Vehicle
>
vehicleRestResponse
=
vehicleFeign
.
findById
(
orderRentVehicleDetail
.
getVehicleId
());
RestResponse
<
Vehicle
>
vehicleRestResponse
=
vehicleFeign
.
findById
(
orderRentVehicleDetail
.
getVehicleId
());
log
.
info
(
"获取车辆信息返回消息:{}"
,
vehicleRestResponse
.
getMessage
());
if
(
vehicleRestResponse
.
getData
()
!=
null
)
{
if
(
vehicleRestResponse
.
getData
()
!=
null
)
{
vehicle
=
vehicleRestResponse
.
getData
();
vehicle
=
vehicleRestResponse
.
getData
();
}
else
{
}
else
{
...
@@ -289,13 +288,13 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
...
@@ -289,13 +288,13 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
vehicleDepartureVo
.
setCheckMan
(
checkUserInfoDto
.
getUsername
());
vehicleDepartureVo
.
setCheckMan
(
checkUserInfoDto
.
getUsername
());
vehicleDepartureVo
.
setCheckManTel
(
checkUserInfoDto
.
getTelephone
());
vehicleDepartureVo
.
setCheckManTel
(
checkUserInfoDto
.
getTelephone
());
}
}
log
.
info
(
"小程序订单出车: "
+
vehicleDepartureVo
.
toString
());
try
{
try
{
RestResponse
restResponse
=
vehicleFeign
.
departureBySmall
(
vehicleDepartureVo
);
RestResponse
restResponse
=
vehicleFeign
.
departureBySmall
(
vehicleDepartureVo
);
if
(
restResponse
.
getStatus
()
!=
200
)
{
if
(
restResponse
.
getStatus
()
!=
200
)
{
return
ObjectRestResponse
.
createFailedResult
(
1001
,
restResponse
.
getMessage
());
return
ObjectRestResponse
.
createFailedResult
(
1001
,
restResponse
.
getMessage
());
}
}
log
.
error
(
"返回信息: "
+
restResponse
.
toString
());
log
.
info
(
"小程序订单出车成功: "
+
restResponse
.
getCode
()
+
restResponse
.
getMessage
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
ObjectRestResponse
.
createFailedResult
(
1001
,
e
.
getMessage
());
return
ObjectRestResponse
.
createFailedResult
(
1001
,
e
.
getMessage
());
}
}
...
@@ -309,12 +308,13 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
...
@@ -309,12 +308,13 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
vehicleArrivalVo
.
setRecycleManTel
(
checkUserInfoDto
.
getTelephone
());
vehicleArrivalVo
.
setRecycleManTel
(
checkUserInfoDto
.
getTelephone
());
}
}
vehicleArrivalVo
.
setBookRecordId
(
orderRentVehicleDetail
.
getBookRecordId
());
vehicleArrivalVo
.
setBookRecordId
(
orderRentVehicleDetail
.
getBookRecordId
());
log
.
info
(
"小程序订单还车: "
+
vehicleArrivalVo
.
toString
());
try
{
try
{
RestResponse
restResponse
=
vehicleFeign
.
arrivalBySmall
(
vehicleArrivalVo
);
RestResponse
restResponse
=
vehicleFeign
.
arrivalBySmall
(
vehicleArrivalVo
);
if
(
restResponse
.
getStatus
()
!=
200
)
{
if
(
restResponse
.
getStatus
()
!=
200
)
{
return
ObjectRestResponse
.
createFailedResult
(
1001
,
restResponse
.
getMessage
());
return
ObjectRestResponse
.
createFailedResult
(
1001
,
restResponse
.
getMessage
());
}
}
log
.
error
(
"返回信息: "
+
restResponse
.
toString
());
log
.
info
(
"小程序订单还车成功: "
+
restResponse
.
getCode
()
+
restResponse
.
getMessage
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
ObjectRestResponse
.
createFailedResult
(
500
,
e
.
getMessage
());
return
ObjectRestResponse
.
createFailedResult
(
500
,
e
.
getMessage
());
}
}
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/EmailSendController.java
View file @
08a4cb3b
...
@@ -2,7 +2,7 @@ package com.xxfc.platform.universal.controller;
...
@@ -2,7 +2,7 @@ package com.xxfc.platform.universal.controller;
import
com.xxfc.platform.universal.biz.MailServiceBiz
;
import
com.xxfc.platform.universal.biz.MailServiceBiz
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.
Ge
tMapping
;
import
org.springframework.web.bind.annotation.
Pos
tMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -13,7 +13,7 @@ public class EmailSendController {
...
@@ -13,7 +13,7 @@ public class EmailSendController {
@Autowired
@Autowired
MailServiceBiz
mailServiceBiz
;
MailServiceBiz
mailServiceBiz
;
@
Ge
tMapping
(
value
=
"/app/unauth/send"
)
@
Pos
tMapping
(
value
=
"/app/unauth/send"
)
public
void
senEmail
(
String
toUser
,
String
subject
,
String
content
)
{
public
void
senEmail
(
String
toUser
,
String
subject
,
String
content
)
{
mailServiceBiz
.
run
(
toUser
,
subject
,
content
);
mailServiceBiz
.
run
(
toUser
,
subject
,
content
);
}
}
...
...
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