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
4c19a6e9
Commit
4c19a6e9
authored
Jul 21, 2020
by
牟邦恺
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
调整驾驶证信息
parent
d9ed238c
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
260 additions
and
12 deletions
+260
-12
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/DrivingLicenseController.java
+35
-1
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
+1
-1
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/DrivingLicenseService.java
+16
-0
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/IBindService.java
+2
-3
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+3
-3
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/DrivingLicenseServiceImpl.java
+116
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/request/DrivingLicenseSendSmsCodeReq.java
+16
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/request/DrivingLicenseValidReq.java
+18
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/request/DrivingLicenseValidSmsCodeReq.java
+18
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/response/DrivingLicenseInfoRes.java
+1
-4
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/response/DrivingLicenseValidRes.java
+17
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/response/VehicleDrivingLicenseInfoRes.java
+17
-0
No files found.
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/DrivingLicenseController.java
View file @
4c19a6e9
...
...
@@ -6,14 +6,24 @@ import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator;
import
com.hikcreate.common.sdk.response.statuscode.StatusCode
;
import
com.hikcreate.edl.common.image.builder.domain.DlImageDO
;
import
com.hikcreate.edl.pub.web.mobile.domain.CredentialsImageService
;
import
com.hikcreate.edl.pub.web.mobile.domain.DrivingLicenseService
;
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.core.configbean.FastDfsConfigBean
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pvt_service_drivinglicense.DrivingLicenseFeign
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pvt_service_drivinglicense.request.CreditIdCardMicReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pvt_service_drivinglicense.response.DrivingLicenseMicRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.DrivingLicenseSendSmsCodeReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.DrivingLicenseValidReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.DrivingLicenseValidSmsCodeReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseValidRes
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -33,15 +43,38 @@ import java.io.IOException;
@RequestMapping
(
"/drivingLicense"
)
@Slf4j
public
class
DrivingLicenseController
{
@Autowired
private
CredentialsImageService
credentialsImageService
;
@Autowired
private
DrivingLicenseFeign
drivingLicenseFeign
;
@Autowired
private
FastDfsConfigBean
fastDfsConfigBean
;
@Autowired
private
DrivingLicenseService
drivingLicenseService
;
@
GetMapping
(
"/image
"
)
@
PostMapping
(
"/valid
"
)
@HeaderDecryptAnnotation
public
Result
<
DrivingLicenseValidRes
>
valid
(
@RequestBody
@Validated
DrivingLicenseValidReq
req
)
{
DrivingLicenseValidRes
drivingLicenseValidRes
=
drivingLicenseService
.
checkIdCard
(
req
.
getIdCard
(),
req
.
getUserId
());
return
ResultGenerator
.
success
(
drivingLicenseValidRes
);
}
@PostMapping
(
"/sendSmsCode"
)
@HeaderDecryptAnnotation
public
Result
<
Void
>
sendSmsCode
(
@RequestBody
@Validated
DrivingLicenseSendSmsCodeReq
req
)
{
drivingLicenseService
.
sendSmsCode
(
req
.
getUserId
());
return
ResultGenerator
.
success
();
}
@PostMapping
(
"/validSmsCode"
)
@HeaderDecryptAnnotation
public
Result
<
Void
>
validSmsCode
(
@RequestBody
@Validated
DrivingLicenseValidSmsCodeReq
req
)
{
drivingLicenseService
.
validSmsCode
(
req
.
getUserId
(),
req
.
getSmsCode
());
return
ResultGenerator
.
success
();
}
@GetMapping
(
"/image"
)
public
void
image
(
@RequestParam
(
"idCard"
)
String
idCard
,
HttpServletResponse
response
)
{
DrivingLicenseMicRes
drivingLicenseMicRes
=
drivingLicenseFeign
.
getByIdCard
(
new
CreditIdCardMicReq
().
setIdCard
(
idCard
)).
fallback
().
getData
();
DlImageDO
dlImageDO
=
new
DlImageDO
();
...
...
@@ -78,6 +111,7 @@ public class DrivingLicenseController {
}
}
private
void
getResException
(
HttpServletResponse
response
,
String
msg
)
{
try
{
Response
<
Void
>
res
=
ResponseGenerator
.
fail
(
StatusCode
.
SYSTEM_ERROR
,
msg
);
...
...
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
View file @
4c19a6e9
...
...
@@ -114,7 +114,7 @@ public class H5Controller {
*/
@PostMapping
(
"drivingLicenseInfo"
)
@HeaderDecryptAnnotation
public
Result
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
public
Result
<
Vehicle
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
@RequestBody
@Validated
H5BindInfoQuery
query
)
{
return
service
.
drivingLicenseInfo
(
query
);
}
...
...
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/DrivingLicenseService.java
0 → 100644
View file @
4c19a6e9
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseValidRes
;
/**
* @author MOUBK
* @create 2020/7/21 14:02
*/
public
interface
DrivingLicenseService
{
DrivingLicenseValidRes
checkIdCard
(
String
idCard
,
String
userId
);
void
sendSmsCode
(
String
userId
);
void
validSmsCode
(
String
userId
,
String
smsCode
);
}
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/IBindService.java
View file @
4c19a6e9
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
;
import
com.baomidou.mybatisplus.extension.service.IService
;
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.model.entity.ParkBindInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.BindInfoQueryReq
;
...
...
@@ -9,7 +8,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.BindSmsValidRe
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.H5BindInfoQuery
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.UnBindReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoQueryRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.
Vehicle
DrivingLicenseInfoRes
;
import
java.util.List
;
...
...
@@ -86,6 +85,6 @@ public interface IBindService extends IService<ParkBindInfo> {
* @author: xsx
* @date: 2020/6/19 16:29
*/
Result
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
H5BindInfoQuery
query
);
Result
<
VehicleDrivingLicenseInfoRes
>
drivingLicenseInfo
(
H5BindInfoQuery
query
);
}
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
4c19a6e9
...
...
@@ -43,9 +43,9 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.H5BindInfoQuer
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.UnBindReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoQueryRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BindInfoRes
;
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.VehicleDrivingLicenseInfoRes
;
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
lombok.extern.slf4j.Slf4j
;
...
...
@@ -418,7 +418,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
}
@Override
public
Result
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
H5BindInfoQuery
query
)
{
public
Result
<
Vehicle
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
H5BindInfoQuery
query
)
{
/**
* 校验当前的绑定信息是否存在
*/
...
...
@@ -470,7 +470,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, ParkBindInfo> i
/**
* 构建驾照信息查询结果
*/
DrivingLicenseInfoRes
result
=
new
DrivingLicenseInfoRes
();
VehicleDrivingLicenseInfoRes
result
=
new
Vehicle
DrivingLicenseInfoRes
();
result
.
setDriverName
(
drivingLicenseRes
.
getXm
());
result
.
setPlateNum
(
byPlateNumAndType
.
getHphm
());
result
.
setDlQr
(
qrInfo
.
getData
().
getQr
());
...
...
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/DrivingLicenseServiceImpl.java
0 → 100644
View file @
4c19a6e9
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.hikcreate.common.sdk.exception.BusinessException
;
import
com.hikcreate.edl.common.sdk.util.VerifyCodeUtil
;
import
com.hikcreate.edl.pub.web.mobile.domain.DrivingLicenseService
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result.ResultCode
;
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
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.SendVerifyCodeMicReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pvt_service_drivinglicense.DrivingLicenseFeign
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pvt_service_drivinglicense.request.CreditIdCardMicReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pvt_service_drivinglicense.response.DrivingLicenseMicRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseValidRes
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
/**
* @author MOUBK
* @create 2020/7/21 14:03
*/
@Slf4j
@Service
public
class
DrivingLicenseServiceImpl
implements
DrivingLicenseService
{
@Autowired
private
DrivingLicenseFeign
drivingLicenseFeign
;
@Autowired
private
SmsFeign
smsFeign
;
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
private
static
final
String
REDIS_KEY
=
"drv:idcard"
;
private
static
final
String
REDIS_SMS_KEY
=
"drv:idcard:sms"
;
@Override
public
DrivingLicenseValidRes
checkIdCard
(
String
idCard
,
String
userId
)
{
DrivingLicenseMicRes
drivingLicenseMicRes
=
drivingLicenseFeign
.
getByIdCard
(
new
CreditIdCardMicReq
().
setIdCard
(
idCard
)).
fallback
().
getData
();
if
(
drivingLicenseMicRes
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
DRIVING_LICENSE_UNKNOWN
);
}
// 保存在缓存
saveToRedis
(
userId
,
drivingLicenseMicRes
);
DrivingLicenseValidRes
drivingLicenseValidRes
=
new
DrivingLicenseValidRes
();
drivingLicenseValidRes
.
setUserId
(
userId
);
drivingLicenseValidRes
.
setPhone
(
drivingLicenseMicRes
.
getPhone
());
// 检查短信发送
if
(
checkSmsValid
(
userId
,
idCard
,
drivingLicenseMicRes
.
getPhone
()))
{
drivingLicenseValidRes
.
setSendSmsFlag
(
true
);
}
else
{
drivingLicenseValidRes
.
setSendSmsFlag
(
false
);
}
return
drivingLicenseValidRes
;
}
@Override
public
void
sendSmsCode
(
String
userId
)
{
DrivingLicenseMicRes
drivingLicenseMicRes
=
getFromRedis
(
userId
);
SendVerifyCodeMicReq
micReq
=
new
SendVerifyCodeMicReq
();
micReq
.
setPhone
(
drivingLicenseMicRes
.
getPhone
());
micReq
.
setVerifyCode
(
VerifyCodeUtil
.
getCode
());
micReq
.
setTemplateCode
(
"PARK_DRIVING_LICENSE_IDCARD"
);
smsFeign
.
sendVerifyCode
(
micReq
).
fallback
();
}
@Override
public
void
validSmsCode
(
String
userId
,
String
smsCode
)
{
DrivingLicenseMicRes
drivingLicenseMicRes
=
getFromRedis
(
userId
);
CheckVerifyCodeMicReq
req
=
new
CheckVerifyCodeMicReq
();
req
.
setPhone
(
drivingLicenseMicRes
.
getPhone
());
req
.
setVerifyCode
(
smsCode
);
req
.
setTemplateCode
(
"PARK_DRIVING_LICENSE_IDCARD"
);
smsFeign
.
checkVerifyCode
(
req
).
fallback
();
// 保存验证redis
saveSmsValid
(
userId
,
drivingLicenseMicRes
.
getIdCard
(),
drivingLicenseMicRes
.
getPhone
());
}
private
void
saveSmsValid
(
String
userId
,
String
idCard
,
String
phone
)
{
redisTemplate
.
opsForValue
().
set
(
getSmsKey
(
userId
,
idCard
),
phone
,
300
,
TimeUnit
.
SECONDS
);
}
private
boolean
checkSmsValid
(
String
userId
,
String
idCard
,
String
phone
)
{
String
value
=
redisTemplate
.
opsForValue
().
get
(
getSmsKey
(
userId
,
idCard
));
if
(
Objects
.
equals
(
phone
,
value
))
{
return
true
;
}
return
false
;
}
private
String
getSmsKey
(
String
userId
,
String
idCard
)
{
return
REDIS_SMS_KEY
+
userId
+
":"
+
idCard
;
}
private
void
saveToRedis
(
String
userId
,
DrivingLicenseMicRes
drivingLicenseMicRes
)
{
redisTemplate
.
opsForValue
().
set
(
getKey
(
userId
),
JSONObject
.
toJSONString
(
drivingLicenseMicRes
),
24
*
3600
,
TimeUnit
.
SECONDS
);
}
private
DrivingLicenseMicRes
getFromRedis
(
String
userId
)
{
String
value
=
redisTemplate
.
opsForValue
().
get
(
getKey
(
userId
));
if
(!
StringUtils
.
isEmpty
(
value
))
{
return
JSONObject
.
parseObject
(
value
,
DrivingLicenseMicRes
.
class
);
}
return
null
;
}
private
String
getKey
(
String
userId
)
{
return
REDIS_KEY
+
userId
;
}
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/request/DrivingLicenseSendSmsCodeReq.java
0 → 100644
View file @
4c19a6e9
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
model
.
param
.
request
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
/**
* @author MOUBK
* @create 2020/7/21 15:17
*/
@Data
public
class
DrivingLicenseSendSmsCodeReq
{
@NotBlank
(
message
=
"手机号不能为空"
)
private
String
userId
;
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/request/DrivingLicenseValidReq.java
0 → 100644
View file @
4c19a6e9
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
model
.
param
.
request
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
/**
* @author MOUBK
* @create 2020/7/21 11:24
*/
@Data
public
class
DrivingLicenseValidReq
{
@NotBlank
(
message
=
"驾驶证号不能为空"
)
private
String
idCard
;
@NotBlank
(
message
=
"用户Id不能为空"
)
private
String
userId
;
private
Long
timestamp
;
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/request/DrivingLicenseValidSmsCodeReq.java
0 → 100644
View file @
4c19a6e9
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
model
.
param
.
request
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
/**
* @author MOUBK
* @create 2020/7/21 15:17
*/
@Data
public
class
DrivingLicenseValidSmsCodeReq
{
@NotBlank
(
message
=
"手机号不能为空"
)
private
String
userId
;
@NotBlank
(
message
=
"手机验证码不能为空"
)
private
String
smsCode
;
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/response/DrivingLicenseInfoRes.java
View file @
4c19a6e9
...
...
@@ -9,10 +9,7 @@ import lombok.Data;
@Data
public
class
DrivingLicenseInfoRes
{
/**
* 车牌号
*/
private
String
plateNum
;
/**
*有效期止
*/
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/response/DrivingLicenseValidRes.java
0 → 100644
View file @
4c19a6e9
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
model
.
param
.
response
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* @author MOUBK
* @create 2020/7/21 11:26
*/
@Data
@Accessors
(
chain
=
true
)
public
class
DrivingLicenseValidRes
{
private
String
phone
;
private
String
userId
;
private
Boolean
sendSmsFlag
;
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/response/VehicleDrivingLicenseInfoRes.java
0 → 100644
View file @
4c19a6e9
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
model
.
param
.
response
;
import
lombok.Data
;
/**
* @author MOUBK
* @create 2019/7/5 15:31
*/
@Data
public
class
VehicleDrivingLicenseInfoRes
extends
DrivingLicenseInfoRes
{
/**
* 车牌号
*/
private
String
plateNum
;
}
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