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
1b4f9887
Commit
1b4f9887
authored
Jun 21, 2020
by
lixian7
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
2b24a681
d3301e5a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
7 deletions
+40
-7
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+11
-7
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/BindCache.java
+1
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/DrivingLicenseCache.java
+28
-0
No files found.
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
1b4f9887
...
...
@@ -10,6 +10,7 @@ import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator;
import
com.hikcreate.common.sdk.response.statuscode.StatusCode
;
import
com.hikcreate.edl.pub.web.mobile.domain.IBindService
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.cache.BindCache
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.cache.DrivingLicenseCache
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.cache.VechicleCache
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.cache.ViolationCache
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.DrivingLicenseFeign
;
...
...
@@ -41,6 +42,7 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.UUID
;
...
...
@@ -72,6 +74,8 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
VechicleCache
vechicleCache
;
@Resource
ViolationCache
violationCache
;
@Resource
DrivingLicenseCache
drivingLicenseCache
;
@Override
...
...
@@ -90,7 +94,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
//规则2:客户手机号与车辆对应的车主手机号一致
PlateNumQueryReq
req
=
new
PlateNumQueryReq
();
req
.
setPlateNum
(
info
.
getPlateNum
());
List
<
VehicleRes
>
byPlateNum
=
vechicle
.
getByPlateNum
(
req
);
List
<
VehicleRes
>
byPlateNum
=
vechicle
Cache
.
getByPlateNum
(
req
);
for
(
VehicleRes
res
:
byPlateNum
)
{
if
(
info
.
getPhone
().
equals
(
res
.
getSjhm
()))
{
info
.
setPlateType
(
res
.
getHpzl
());
...
...
@@ -101,7 +105,6 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
}
QueryWrapper
<
BindInfo
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"user_id"
,
info
.
getUserId
());
queryWrapper
.
eq
(
"plate_num"
,
info
.
getPlateNum
());
queryWrapper
.
eq
(
"plate_type"
,
info
.
getPlateType
());
...
...
@@ -249,9 +252,9 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
/**
* 校验当前电话号码是否在10天内已通过验证
*/
VerifyInfo
verify
Info
=
this
.
verifyInfo
.
checkValidity
(
query
.
getPhone
(),
query
.
getUserId
(),
VerifyInfo
verify
=
verifyInfo
.
checkValidity
(
query
.
getPhone
(),
query
.
getUserId
(),
DateUtil
.
offsetDay
(
DateTime
.
now
(),
-
10
));
if
(
verify
Info
==
null
)
{
if
(
verify
==
null
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
PERMISSION_DENIED
);
}
...
...
@@ -261,7 +264,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
PlateNumAndTypeQueryReq
vechicleInfoReq
=
new
PlateNumAndTypeQueryReq
();
vechicleInfoReq
.
setPlateType
(
bindInfo
.
getPlateType
());
vechicleInfoReq
.
setPlateNum
(
bindInfo
.
getPlateNum
());
VehicleRes
byPlateNumAndType
=
vechicle
.
getByPlateNumAndType
(
vechicleInfoReq
);
VehicleRes
byPlateNumAndType
=
vechicle
Cache
.
getByPlateNumAndType
(
vechicleInfoReq
);
if
(
byPlateNumAndType
.
getSfzmhm
()
==
null
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
ALERT_ERROR
);
}
...
...
@@ -271,7 +274,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
*/
IdCardQueryReq
idCardQueryReq
=
new
IdCardQueryReq
();
idCardQueryReq
.
setIdCard
(
byPlateNumAndType
.
getSfzmhm
());
DrivingLicenseRes
drivingLicenseRes
=
drivingLicense
.
getByIdCard
(
idCardQueryReq
);
DrivingLicenseRes
drivingLicenseRes
=
drivingLicense
Cache
.
getByIdCard
(
idCardQueryReq
);
if
(
drivingLicenseRes
==
null
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
ALERT_ERROR
);
}
...
...
@@ -283,7 +286,8 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
result
.
setDriverName
(
drivingLicenseRes
.
getXm
());
result
.
setPlateNum
(
drivingLicenseRes
.
getSfzmhm
());
result
.
setValidityTime
(
drivingLicenseRes
.
getYxqz
());
result
.
setStatus
(
drivingLicenseRes
.
getZtValue
());
String
status
=
DateUtil
.
compare
(
DateUtil
.
parseDate
(
drivingLicenseRes
.
getYxqz
()),
new
Date
())
>=
0
?
"有效"
:
"已过期"
;
result
.
setStatus
(
status
);
result
.
setSurplusGrade
(
String
.
valueOf
(
12
-
Integer
.
parseInt
(
drivingLicenseRes
.
getLjjf
())));
return
ResponseGenerator
.
success
(
result
);
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/BindCache.java
View file @
1b4f9887
...
...
@@ -23,6 +23,7 @@ public class BindCache {
@Resource
private
BindInfoMapper
mapper
;
/**
* 获取绑定信息
* @param unqId
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/DrivingLicenseCache.java
0 → 100644
View file @
1b4f9887
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
cache
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.DrivingLicenseFeign
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.request.IdCardQueryReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.response.DrivingLicenseRes
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/**
* 驾照信息缓存
*
* @author: xieshixiang
* @time:2020/6/21 17:45
**/
@Component
public
class
DrivingLicenseCache
{
@Resource
DrivingLicenseFeign
feign
;
@Cacheable
(
value
=
"drivingLicense"
,
key
=
"'idCard:'+#req.idCard"
,
unless
=
"#result==null"
)
public
DrivingLicenseRes
getByIdCard
(
IdCardQueryReq
req
)
{
return
feign
.
getByIdCard
(
req
);
}
}
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