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
044a81df
Commit
044a81df
authored
Sep 04, 2026
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
错误日志添加
parent
3de16226
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
3 deletions
+17
-3
AliVoiceNotifyController.java
...ng/communication/controller/AliVoiceNotifyController.java
+2
-1
SmsController.java
...va/com/zehong/communication/controller/SmsController.java
+4
-2
AliVoiceNotifyServiceImpl.java
...communication/service/impl/AliVoiceNotifyServiceImpl.java
+5
-0
SmsServiceImpl.java
...com/zehong/communication/service/impl/SmsServiceImpl.java
+6
-0
No files found.
src/main/java/com/zehong/communication/controller/AliVoiceNotifyController.java
View file @
044a81df
...
...
@@ -38,11 +38,12 @@ public class AliVoiceNotifyController {
public
Result
sendAliVoiceNotify
(
@Valid
@RequestBody
SendAliVoiceNotify
sendAliVoiceNotify
,
BindingResult
result
){
try
{
if
(
result
.
hasErrors
()){
logger
.
error
(
"阿里语音发送失败,params:{},message:{}"
,
sendAliVoiceNotify
.
toString
(),
result
.
getFieldError
().
getDefaultMessage
());
return
new
Result
(
ResultEnum
.
VALIDATA_ERROR
.
getCode
(),
result
.
getFieldError
().
getDefaultMessage
());
}
return
aliVoiceNotifyService
.
sendAliVoiceNotify
(
sendAliVoiceNotify
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"阿里语音发送失败,phoneNumbers:
%
"
,
sendAliVoiceNotify
.
getCalledNumber
(),
e
);
logger
.
error
(
"阿里语音发送失败,phoneNumbers:
{},message:{}
"
,
sendAliVoiceNotify
.
getCalledNumber
(),
e
);
return
new
Result
(
ResultEnum
.
SYSTEM_EXCEPTION
);
}
}
...
...
src/main/java/com/zehong/communication/controller/SmsController.java
View file @
044a81df
...
...
@@ -39,11 +39,12 @@ public class SmsController {
public
Result
sendSms
(
@Valid
@RequestBody
SendSms
sendSms
,
BindingResult
result
){
try
{
if
(
result
.
hasErrors
()){
logger
.
info
(
"短信发送失败,params:{},message:{}"
,
sendSms
.
toString
(),
result
.
getFieldError
().
getDefaultMessage
());
return
new
Result
(
ResultEnum
.
VALIDATA_ERROR
.
getCode
(),
result
.
getFieldError
().
getDefaultMessage
());
}
return
smsService
.
sendSms
(
sendSms
);
}
catch
(
ClientException
e
)
{
logger
.
info
(
"短信发送失败,phoneNumber:
%
"
,
sendSms
.
getPhoneNumber
(),
e
);
logger
.
info
(
"短信发送失败,phoneNumber:
{},message:{}
"
,
sendSms
.
getPhoneNumber
(),
e
);
return
new
Result
(
ResultEnum
.
SYSTEM_EXCEPTION
);
}
}
...
...
@@ -57,11 +58,12 @@ public class SmsController {
public
Result
sendBatchSms
(
@Valid
@RequestBody
SendBatchSms
sendBatchSms
,
BindingResult
result
){
try
{
if
(
result
.
hasErrors
()){
logger
.
info
(
"批量发送短信失败,params:{},message:{}"
,
sendBatchSms
.
getPhoneNumberJson
(),
result
.
getFieldError
().
getDefaultMessage
());
return
new
Result
(
ResultEnum
.
VALIDATA_ERROR
.
getCode
(),
result
.
getFieldError
().
getDefaultMessage
());
}
return
smsService
.
sendBatchSms
(
sendBatchSms
);
}
catch
(
ClientException
e
)
{
logger
.
info
(
"批量发送短信失败,phoneNumbers:
%
"
,
sendBatchSms
.
getPhoneNumberJson
(),
e
);
logger
.
info
(
"批量发送短信失败,phoneNumbers:
{},message:{}
"
,
sendBatchSms
.
getPhoneNumberJson
(),
e
);
return
new
Result
(
ResultEnum
.
SYSTEM_EXCEPTION
);
}
}
...
...
src/main/java/com/zehong/communication/service/impl/AliVoiceNotifyServiceImpl.java
View file @
044a81df
...
...
@@ -9,12 +9,16 @@ import com.zehong.communication.common.result.ResultEnum;
import
com.zehong.communication.model.SendAliVoiceNotify
;
import
com.zehong.communication.service.AliVoiceNotifyService
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
@Service
public
class
AliVoiceNotifyServiceImpl
implements
AliVoiceNotifyService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AliVoiceNotifyServiceImpl
.
class
);
@Value
(
"${accessKeyId}"
)
private
String
accessKeyId
;
...
...
@@ -59,6 +63,7 @@ public class AliVoiceNotifyServiceImpl implements AliVoiceNotifyService{
return
new
Result
(
ResultEnum
.
SUCCESS
.
getCode
(),
response
.
getBody
().
getMessage
());
}
logger
.
error
(
"阿里语音发送失败,params:{},message:{}"
,
sendAliVoiceNotify
.
toString
(),
response
.
getBody
().
getMessage
());
return
new
Result
(
ResultEnum
.
FAIL
.
getCode
(),
response
.
getBody
().
getMessage
());
}
...
...
src/main/java/com/zehong/communication/service/impl/SmsServiceImpl.java
View file @
044a81df
...
...
@@ -16,12 +16,16 @@ import com.zehong.communication.model.SendBatchSms;
import
com.zehong.communication.model.SendSms
;
import
com.zehong.communication.service.SmsService
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
@Service
public
class
SmsServiceImpl
implements
SmsService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SmsServiceImpl
.
class
);
@Value
(
"${accessKeyId}"
)
private
String
accessKeyId
;
...
...
@@ -73,6 +77,7 @@ public class SmsServiceImpl implements SmsService {
//请求成功
return
new
Result
(
ResultEnum
.
SUCCESS
.
getCode
(),
sendSmsResponse
.
getMessage
());
}
logger
.
info
(
"短信发送失败,params:{},message:{}"
,
sendSms
.
toString
(),
sendSmsResponse
.
getMessage
());
return
new
Result
(
ResultEnum
.
FAIL
.
getCode
(),
sendSmsResponse
.
getMessage
());
}
...
...
@@ -111,6 +116,7 @@ public class SmsServiceImpl implements SmsService {
//请求成功
return
new
Result
(
ResultEnum
.
SUCCESS
.
getCode
(),
sendSmsResponse
.
getMessage
());
}
logger
.
info
(
"批量发送短信失败,params:{},message:{}"
,
sendBatchSms
.
toString
(),
sendSmsResponse
.
getMessage
());
return
new
Result
(
ResultEnum
.
FAIL
.
getCode
(),
sendSmsResponse
.
getMessage
());
}
...
...
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