Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
extend
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
park
extend
Commits
13dbd551
Commit
13dbd551
authored
Jul 22, 2020
by
lixian7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
绑定接口调整
parent
8ed80a65
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/exception/GlobalExceptionHandler.java
+8
-2
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+9
-6
No files found.
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/exception/GlobalExceptionHandler.java
View file @
13dbd551
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
.
exception
;
import
com.hikcreate.common.sdk.exception.
DefaultExceptionHandler
;
import
com.hikcreate.common.sdk.exception.
BusinessException
;
import
com.hikcreate.common.sdk.response.apiparam.Response
;
import
com.hikcreate.common.sdk.response.apiparam.ResponseGenerator
;
import
com.hikcreate.common.sdk.response.statuscode.StatusCode
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result.ResultCode
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result.ResultGenerator
;
import
feign.RetryableException
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -88,6 +87,13 @@ public class GlobalExceptionHandler {
return
ResultGenerator
.
fail
(
StatusCode
.
SYSTEM_ERROR
.
getCode
(),
"服务请求超时或不可用"
);
}
@ExceptionHandler
({
BusinessException
.
class
})
@ResponseBody
public
Response
<
Object
>
handle
(
BusinessException
e
)
{
log
.
warn
(
e
.
toString
(),
e
);
return
ResponseGenerator
.
fail
(
e
.
getCode
(),
e
.
getMsg
(),
e
.
getErrorMsg
(),
e
.
getParam
());
}
/**
* 从{@code @BindingResult}中构建异常信息
* on field 'verifyCode': null];
...
...
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
13dbd551
...
...
@@ -202,6 +202,13 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
return
ResultGenerator
.
fail
(
ResultCode
.
CAR_HAVE_BIND
);
}
//发送验证码
SendVerifyCodeMicReq
sendMicReq
=
new
SendVerifyCodeMicReq
();
sendMicReq
.
setPhone
(
info
.
getOwnerPhone
());
sendMicReq
.
setVerifyCode
(
VerifyCodeUtil
.
getCode
());
sendMicReq
.
setTemplateCode
(
"PARK_BIND_VEHICLE"
);
smsFeign
.
sendVerifyCode
(
sendMicReq
).
fallback
();
//保存至redis
try
{
String
key
=
bindKeyPrefix
.
concat
(
info
.
getPhone
()).
concat
(
"-"
).
concat
(
info
.
getOwnerPhone
());
...
...
@@ -210,12 +217,6 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
log
.
error
(
"绑定异常:{}"
,
e
.
getMessage
());
return
ResultGenerator
.
fail
(
StatusCode
.
SYSTEM_ERROR
);
}
//发送验证码
SendVerifyCodeMicReq
sendMicReq
=
new
SendVerifyCodeMicReq
();
sendMicReq
.
setPhone
(
info
.
getOwnerPhone
());
sendMicReq
.
setVerifyCode
(
VerifyCodeUtil
.
getCode
());
sendMicReq
.
setTemplateCode
(
"PARK_BIND_VEHICLE"
);
smsFeign
.
sendVerifyCode
(
sendMicReq
).
fallback
();
return
ResultGenerator
.
success
();
}
...
...
@@ -253,6 +254,8 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
log
.
error
(
"车辆绑定短信验证失败:绑定信息入库失败"
);
return
ResultGenerator
.
fail
(
StatusCode
.
SYSTEM_ERROR
);
}
//清除redis
redisTemplate
.
delete
(
key
);
return
ResultGenerator
.
success
(
new
BindInfoRes
(
bindInfo
.
getUnqId
()));
}
catch
(
JsonProcessingException
e
)
{
log
.
error
(
"车辆绑定短信验证异常:{}"
,
e
.
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