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
af5cd4be
Commit
af5cd4be
authored
Jun 24, 2020
by
lixian7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
返回体调整
parent
5554c9b6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
54 deletions
+49
-54
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
+14
-14
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
+22
-28
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/exception/GlobalExceptionHandler.java
+4
-4
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+3
-3
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/SmsFeign.java
+6
-5
No files found.
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
View file @
af5cd4be
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
.
controller
;
import
com.hikcreate.common.orika.DefaultConverter
;
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.common.distributed.lock.exception.DistributedLockException
;
import
com.hikcreate.edl.pub.web.mobile.domain.IBindService
;
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
com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.BodyDecryptAnnotation
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkBindInfo
;
...
...
@@ -31,7 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
* @time:2020/6/18 15:59
**/
@RestController
@RequestMapping
(
"/vehicle"
)
@RequestMapping
(
"/vehicle"
)
@Slf4j
public
class
BindInfoControlller
extends
BaseController
{
...
...
@@ -49,18 +49,18 @@ public class BindInfoControlller extends BaseController {
* @author: xsx
* @date: 2020/6/19 10:27
*/
@PostMapping
(
"bind"
)
@PostMapping
(
"bind"
)
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public
Res
ponse
<
BindInfoRes
>
bindInfo
(
@RequestBody
@Validated
BindInfoReq
req
)
{
public
Res
ult
<
BindInfoRes
>
bindInfo
(
@RequestBody
@Validated
BindInfoReq
req
)
{
ParkBindInfo
bindInfo
=
new
ParkBindInfo
();
defaultConverter
.
getMapperFacade
().
map
(
req
,
bindInfo
);
Res
ponse
response
=
null
;
Res
ult
response
=
null
;
try
{
response
=
service
.
bind
(
bindInfo
);
}
catch
(
DistributedLockException
e
)
{
log
.
error
(
"分布式锁超时"
);
return
Res
ponseGenerator
.
fail
(
Status
Code
.
REPEAT_SUBMIT
);
return
Res
ultGenerator
.
fail
(
Result
Code
.
REPEAT_SUBMIT
);
}
return
response
;
}
...
...
@@ -74,10 +74,10 @@ public class BindInfoControlller extends BaseController {
* @author: xsx
* @date: 2020/6/19 10:27
*/
@PostMapping
(
"unbind"
)
@PostMapping
(
"unbind"
)
@BodyDecryptAnnotation
public
Res
ponse
unbindInfo
(
@RequestBody
@Validated
UnBindReq
req
)
{
return
service
.
unbindInfo
(
req
)
;
public
Res
ult
unbindInfo
(
@RequestBody
@Validated
UnBindReq
req
)
{
return
service
.
unbindInfo
(
req
);
}
/**
...
...
@@ -88,11 +88,11 @@ public class BindInfoControlller extends BaseController {
* @author: xsx
* @date: 2020/6/19 10:31
*/
@PostMapping
(
"query"
)
@PostMapping
(
"query"
)
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public
Res
ponse
<
ResultList
<
BindInfoQueryRes
>>
bindInfoQery
(
@RequestBody
@Validated
BindInfoQueryReq
query
)
{
return
Res
ponse
Generator
.
success
(
new
ResultList
<
BindInfoQueryRes
>(
service
.
selectByQuery
(
query
)));
public
Res
ult
<
ResultList
<
BindInfoQueryRes
>>
bindInfoQery
(
@RequestBody
@Validated
BindInfoQueryReq
query
)
{
return
Res
ult
Generator
.
success
(
new
ResultList
<
BindInfoQueryRes
>(
service
.
selectByQuery
(
query
)));
}
}
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
View file @
af5cd4be
...
...
@@ -3,12 +3,11 @@ package com.hikcreate.edl.pub.web.mobile.api.controller;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
com.hikcreate.common.orika.DefaultConverter
;
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.common.sdk.util.VerifyCodeUtil
;
import
com.hikcreate.edl.pub.web.mobile.domain.IBindService
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result.ResultGenerator
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.HeaderDecryptAnnotation
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.SmsFeign
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.CheckVerifyCodeMicReq
;
...
...
@@ -18,12 +17,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.entity.ParkVerifyInfo;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.CheckVerifyCodeReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.H5BindInfoQuery
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.SendVerifyCodeReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.CheckValidityRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.InsuranceInfoRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ResultList
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ViolationInfoRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.YearCheckInfoRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -44,7 +38,7 @@ import javax.annotation.Resource;
* @time:2020/6/19 16:37
**/
@RestController
@RequestMapping
(
"/vehicle"
)
@RequestMapping
(
"/vehicle"
)
@Slf4j
public
class
H5Controller
{
...
...
@@ -61,7 +55,7 @@ public class H5Controller {
* 验证有效性限制时间
* 单位:小时
*/
@Value
(
"${biz.check.validity.limit.time:24}"
)
@Value
(
"${biz.check.validity.limit.time:24}"
)
Integer
checkValidityLimitTime
;
/**
...
...
@@ -72,9 +66,9 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/19 10:32
*/
@PostMapping
(
"yearCheckInfo"
)
@PostMapping
(
"yearCheckInfo"
)
@HeaderDecryptAnnotation
public
Res
ponse
<
YearCheckInfoRes
>
yearCheckInfo
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
public
Res
ult
<
YearCheckInfoRes
>
yearCheckInfo
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
return
service
.
yearCheckInfo
(
query
);
}
...
...
@@ -87,9 +81,9 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/19 16:28
*/
@PostMapping
(
"violationInfo"
)
@PostMapping
(
"violationInfo"
)
@HeaderDecryptAnnotation
public
Res
ponse
<
ResultList
<
ViolationInfoRes
>>
violationInfo
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
public
Res
ult
<
ResultList
<
ViolationInfoRes
>>
violationInfo
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
return
service
.
violationInfo
(
query
);
}
...
...
@@ -102,9 +96,9 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/19 16:28
*/
@PostMapping
(
"insuranceInfo"
)
@PostMapping
(
"insuranceInfo"
)
@HeaderDecryptAnnotation
public
Result
<
InsuranceInfoRes
>
insuranceInfo
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
public
Result
<
InsuranceInfoRes
>
insuranceInfo
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
return
service
.
insuranceInfo
(
query
);
}
...
...
@@ -118,9 +112,9 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/19 16:28
*/
@PostMapping
(
"drivingLicenseInfo"
)
@PostMapping
(
"drivingLicenseInfo"
)
@HeaderDecryptAnnotation
public
Res
ponse
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
public
Res
ult
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
return
service
.
drivingLicenseInfo
(
query
);
}
...
...
@@ -131,21 +125,21 @@ public class H5Controller {
* @param query
* @return
*/
@PostMapping
(
"checkValidity"
)
@PostMapping
(
"checkValidity"
)
@HeaderDecryptAnnotation
public
Res
ponse
<
CheckValidityRes
>
checkValidity
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
public
Res
ult
<
CheckValidityRes
>
checkValidity
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
ParkVerifyInfo
verifyInfo
=
verifyInfoMapper
.
checkValidity
(
query
.
getPhone
(),
query
.
getUserId
(),
DateUtil
.
offsetHour
(
DateTime
.
now
(),
-
checkValidityLimitTime
));
CheckValidityRes
checkValidityRes
=
new
CheckValidityRes
();
defaultConverter
.
getMapperFacade
().
map
(
query
,
checkValidityRes
);
if
(
verifyInfo
!=
null
)
{
if
(
verifyInfo
!=
null
)
{
checkValidityRes
.
setIsChecked
(
1
);
}
else
{
checkValidityRes
.
setIsChecked
(
0
);
}
return
Res
ponse
Generator
.
success
(
checkValidityRes
);
return
Res
ult
Generator
.
success
(
checkValidityRes
);
}
/***
...
...
@@ -156,8 +150,8 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/21 13:57
*/
@PostMapping
(
"sendVerifyCode"
)
public
Res
ponse
<
Void
>
sendVerifyCode
(
@RequestBody
@Validated
SendVerifyCodeReq
req
)
{
@PostMapping
(
"sendVerifyCode"
)
public
Res
ult
<
Void
>
sendVerifyCode
(
@RequestBody
@Validated
SendVerifyCodeReq
req
)
{
SendVerifyCodeMicReq
micReq
=
new
SendVerifyCodeMicReq
();
micReq
.
setPhone
(
req
.
getPhone
());
...
...
@@ -174,16 +168,16 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/21 13:58
*/
@PostMapping
(
"checkVerifyCode"
)
public
Res
ponse
<
Void
>
checkVerifyCode
(
@RequestBody
@Validated
CheckVerifyCodeReq
req
)
{
@PostMapping
(
"checkVerifyCode"
)
public
Res
ult
<
Void
>
checkVerifyCode
(
@RequestBody
@Validated
CheckVerifyCodeReq
req
)
{
CheckVerifyCodeMicReq
micReq
=
new
CheckVerifyCodeMicReq
();
micReq
.
setPhone
(
req
.
getPhone
());
micReq
.
setVerifyCode
(
req
.
getVerifyCode
());
micReq
.
setTemplateCode
(
"PARK_LOOK_DRIVER_LICENSE"
);
Res
ponse
<
Void
>
checkResult
=
smsFeign
.
checkVerifyCode
(
micReq
);
if
(
StatusCode
.
SUCCESS
.
getCode
()
==
(
checkResult
.
getCode
())
)
{
Res
ult
<
Void
>
checkResult
=
smsFeign
.
checkVerifyCode
(
micReq
);
if
(
StatusCode
.
SUCCESS
.
getCode
()
==
(
checkResult
.
getCode
())
)
{
ParkVerifyInfo
verifyInfo
=
new
ParkVerifyInfo
();
verifyInfo
.
setUserId
(
req
.
getUserId
());
verifyInfo
.
setVerifyCode
(
req
.
getVerifyCode
());
...
...
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/exception/GlobalExceptionHandler.java
View file @
af5cd4be
...
...
@@ -34,9 +34,9 @@ public class GlobalExceptionHandler {
@ExceptionHandler
(
value
=
ServletRequestBindingException
.
class
)
@ResponseBody
@ResponseStatus
(
HttpStatus
.
OK
)
public
Res
ponse
handleServletRequestBindingException
(
ServletRequestBindingException
e
)
{
public
Res
ult
handleServletRequestBindingException
(
ServletRequestBindingException
e
)
{
log
.
error
(
"param bind failure"
,
e
);
return
Res
ponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
.
getCode
(),
e
.
getMessage
()
);
return
Res
ultGenerator
.
fail
(
ResultCode
.
PARAM_ERROR
);
}
/**
...
...
@@ -83,9 +83,9 @@ public class GlobalExceptionHandler {
@ExceptionHandler
(
value
=
RetryableException
.
class
)
@ResponseBody
public
Res
ponse
retryableExceptionHandler
(
HttpServletRequest
req
,
RetryableException
e
)
throws
Exception
{
public
Res
ult
retryableExceptionHandler
(
HttpServletRequest
req
,
RetryableException
e
)
throws
Exception
{
log
.
error
(
" connect timed out"
,
e
);
return
Res
ponseGenerator
.
fail
(
StatusCode
.
SYSTEM_ERROR
.
getCode
(),
"服务请求超时或不可用"
,
e
.
getMessage
()
);
return
Res
ultGenerator
.
fail
(
ResultCode
.
SYSTEM_ERROR
.
getCode
(),
"服务请求超时或不可用"
);
}
/**
...
...
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
af5cd4be
...
...
@@ -109,14 +109,14 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
unbindQuery
.
eq
(
"status"
,
"0"
);
Integer
integer
=
mapper
.
selectCount
(
unbindQuery
);
if
(
integer
>=
unBindCount
)
{
return
ResultGenerator
.
fail
(
StrUtil
.
format
(
"{}天内,同一用户解绑超过{}次不能再进行绑定"
,
unBindTime
/
24
,
unBindCount
)
);
return
ResultGenerator
.
fail
(
ResultCode
.
UNBIND_TOTAL_ERROR
);
}
//规则:一个客户只能绑定一个电话号码
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
boolean
equals
=
list
.
get
(
0
).
getPhone
().
equals
(
info
.
getPhone
());
if
(!
equals
)
{
return
ResultGenerator
.
fail
(
"当前客户手机号与历史绑定手机号不一致"
);
return
ResultGenerator
.
fail
(
ResultCode
.
USERID_PHONE_ERROR
);
}
}
...
...
@@ -128,7 +128,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
if
(
phones
!=
null
&&
!
phones
.
isEmpty
())
{
boolean
phoneExist
=
phones
.
get
(
0
).
getUserId
().
equals
(
info
.
getUserId
());
if
(!
phoneExist
)
{
return
ResultGenerator
.
fail
(
"当前手机号已被其他客户绑定"
);
return
ResultGenerator
.
fail
(
ResultCode
.
DATA_ERROR
.
getCode
(),
"当前手机号已被其他客户绑定"
);
}
}
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/SmsFeign.java
View file @
af5cd4be
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
feign
.
edl_pub_service_sms
;
import
com.hikcreate.
common.sdk.response.apiparam.Response
;
import
com.hikcreate.
edl.pub.web.mobile.infra.core.Result.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.CheckVerifyCodeMicReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.SendMicReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.SendVerifyCodeMicReq
;
...
...
@@ -11,15 +11,15 @@ import org.springframework.web.bind.annotation.RequestBody;
/**
* 短信feign
*/
@FeignClient
(
name
=
"edl-pvt-service-common"
,
path
=
"sms"
)
@FeignClient
(
name
=
"edl-pvt-service-common"
,
path
=
"sms"
)
public
interface
SmsFeign
{
@PostMapping
(
{
"send"
}
)
Res
ponse
<
Void
>
send
(
@RequestBody
SendMicReq
req
);
Res
ult
<
Void
>
send
(
@RequestBody
SendMicReq
req
);
@PostMapping
(
{
"verifyCode/send"
}
)
Res
ponse
<
Void
>
sendVerifyCode
(
@RequestBody
SendVerifyCodeMicReq
req
);
Res
ult
<
Void
>
sendVerifyCode
(
@RequestBody
SendVerifyCodeMicReq
req
);
@PostMapping
(
{
"verifyCode/check"
}
)
Res
ponse
<
Void
>
checkVerifyCode
(
@RequestBody
CheckVerifyCodeMicReq
req
);
Res
ult
<
Void
>
checkVerifyCode
(
@RequestBody
CheckVerifyCodeMicReq
req
);
}
\ No newline at end of file
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