Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
communication
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
耿迪迪
communication
Commits
9bf32317
Commit
9bf32317
authored
Sep 09, 2026
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创蓝接口错误日志添加
parent
044a81df
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
VoiceNotifyController.java
...ehong/communication/controller/VoiceNotifyController.java
+8
-3
HttpUtil.java
src/main/java/com/zehong/communication/util/HttpUtil.java
+6
-0
No files found.
src/main/java/com/zehong/communication/controller/VoiceNotifyController.java
View file @
9bf32317
...
@@ -9,7 +9,10 @@ import org.slf4j.Logger;
...
@@ -9,7 +9,10 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -36,11 +39,12 @@ public class VoiceNotifyController {
...
@@ -36,11 +39,12 @@ public class VoiceNotifyController {
public
Result
sendVoiceNotify
(
@Valid
@RequestBody
SendVoiceNotify
sendVoiceNotify
,
BindingResult
result
){
public
Result
sendVoiceNotify
(
@Valid
@RequestBody
SendVoiceNotify
sendVoiceNotify
,
BindingResult
result
){
try
{
try
{
if
(
result
.
hasErrors
()){
if
(
result
.
hasErrors
()){
logger
.
error
(
"语音发送失败,params:{},message:{}"
,
sendVoiceNotify
.
toString
(),
result
.
getFieldError
().
getDefaultMessage
());
return
new
Result
(
ResultEnum
.
VALIDATA_ERROR
.
getCode
(),
result
.
getFieldError
().
getDefaultMessage
());
return
new
Result
(
ResultEnum
.
VALIDATA_ERROR
.
getCode
(),
result
.
getFieldError
().
getDefaultMessage
());
}
}
return
voiceNotifyService
.
sendVoiceNotify
(
sendVoiceNotify
);
return
voiceNotifyService
.
sendVoiceNotify
(
sendVoiceNotify
);
}
catch
(
IOException
|
URISyntaxException
e
)
{
}
catch
(
IOException
|
URISyntaxException
e
)
{
logger
.
info
(
"语音发送失败!phoneNumber:%
"
,
sendVoiceNotify
.
getPhoneNumber
(),
e
);
logger
.
error
(
"语音发送失败,phoneNumbers:{},message:{}
"
,
sendVoiceNotify
.
getPhoneNumber
(),
e
);
return
new
Result
(
ResultEnum
.
SYSTEM_EXCEPTION
);
return
new
Result
(
ResultEnum
.
SYSTEM_EXCEPTION
);
}
}
}
}
...
@@ -54,11 +58,12 @@ public class VoiceNotifyController {
...
@@ -54,11 +58,12 @@ public class VoiceNotifyController {
public
Result
sendBatchVoiceNotify
(
@Valid
@RequestBody
SendBatchVoiceNotify
sendBatchVoiceNotify
,
BindingResult
result
){
public
Result
sendBatchVoiceNotify
(
@Valid
@RequestBody
SendBatchVoiceNotify
sendBatchVoiceNotify
,
BindingResult
result
){
try
{
try
{
if
(
result
.
hasErrors
()){
if
(
result
.
hasErrors
()){
logger
.
error
(
"群发语音失败,params:{},message:{}"
,
sendBatchVoiceNotify
.
toString
(),
result
.
getFieldError
().
getDefaultMessage
());
return
new
Result
(
ResultEnum
.
VALIDATA_ERROR
.
getCode
(),
result
.
getFieldError
().
getDefaultMessage
());
return
new
Result
(
ResultEnum
.
VALIDATA_ERROR
.
getCode
(),
result
.
getFieldError
().
getDefaultMessage
());
}
}
return
voiceNotifyService
.
sendBatchVoiceNotify
(
sendBatchVoiceNotify
);
return
voiceNotifyService
.
sendBatchVoiceNotify
(
sendBatchVoiceNotify
);
}
catch
(
IOException
|
URISyntaxException
e
)
{
}
catch
(
IOException
|
URISyntaxException
e
)
{
logger
.
info
(
"群发语音失败!phoneNumbers:%
"
,
sendBatchVoiceNotify
.
getPhoneNumberJson
(),
e
);
logger
.
error
(
"群发语音失败,params:{},message:{}
"
,
sendBatchVoiceNotify
.
getPhoneNumberJson
(),
e
);
return
new
Result
(
ResultEnum
.
SYSTEM_EXCEPTION
);
return
new
Result
(
ResultEnum
.
SYSTEM_EXCEPTION
);
}
}
}
}
...
...
src/main/java/com/zehong/communication/util/HttpUtil.java
View file @
9bf32317
...
@@ -2,6 +2,7 @@ package com.zehong.communication.util;
...
@@ -2,6 +2,7 @@ package com.zehong.communication.util;
import
com.zehong.communication.common.result.Result
;
import
com.zehong.communication.common.result.Result
;
import
com.zehong.communication.common.result.ResultEnum
;
import
com.zehong.communication.common.result.ResultEnum
;
import
com.zehong.communication.service.impl.AliVoiceNotifyServiceImpl
;
import
org.apache.http.*
;
import
org.apache.http.*
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.entity.UrlEncodedFormEntity
;
import
org.apache.http.client.entity.UrlEncodedFormEntity
;
...
@@ -15,6 +16,8 @@ import org.apache.http.impl.client.HttpClients;
...
@@ -15,6 +16,8 @@ import org.apache.http.impl.client.HttpClients;
import
org.apache.http.message.BasicNameValuePair
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.apache.http.protocol.HTTP
;
import
org.apache.http.protocol.HTTP
;
import
org.apache.http.util.EntityUtils
;
import
org.apache.http.util.EntityUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -28,6 +31,8 @@ import java.util.Map;
...
@@ -28,6 +31,8 @@ import java.util.Map;
public
class
HttpUtil
{
public
class
HttpUtil
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
HttpUtil
.
class
);
/**
/**
* get请求
* get请求
* @return
* @return
...
@@ -85,6 +90,7 @@ public class HttpUtil {
...
@@ -85,6 +90,7 @@ public class HttpUtil {
if
(
code
==
200
){
if
(
code
==
200
){
return
new
Result
(
ResultEnum
.
SUCCESS
.
getCode
(),
sb
.
toString
());
return
new
Result
(
ResultEnum
.
SUCCESS
.
getCode
(),
sb
.
toString
());
}
}
logger
.
error
(
"请求失败,params:{},message:{}"
,
params
.
toString
(),
sb
.
toString
());
return
new
Result
(
ResultEnum
.
FAIL
.
getCode
(),
sb
.
toString
());
return
new
Result
(
ResultEnum
.
FAIL
.
getCode
(),
sb
.
toString
());
}
}
...
...
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