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
2919089c
Commit
2919089c
authored
Jun 21, 2020
by
lixian7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整接口
parent
cd0bb81d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
211 deletions
+102
-211
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
+0
-2
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/intercept/EncryptResponseBodyAdvice.java
+10
-8
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+14
-8
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/Result.java
+0
-152
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/enums/ResultCode.java
+0
-41
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/BindCache.java
+28
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/VechicleCache.java
+50
-0
No files found.
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
View file @
2919089c
...
@@ -8,8 +8,6 @@ import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator;
...
@@ -8,8 +8,6 @@ import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator;
import
com.hikcreate.common.sdk.response.statuscode.StatusCode
;
import
com.hikcreate.common.sdk.response.statuscode.StatusCode
;
import
com.hikcreate.edl.common.sdk.util.VerifyCodeUtil
;
import
com.hikcreate.edl.common.sdk.util.VerifyCodeUtil
;
import
com.hikcreate.edl.pub.web.mobile.domain.IBindService
;
import
com.hikcreate.edl.pub.web.mobile.domain.IBindService
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.enums.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.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.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_pub_service_sms.param.request.SendVerifyCodeMicReq
;
...
...
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/intercept/EncryptResponseBodyAdvice.java
View file @
2919089c
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
.
intercept
;
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
.
intercept
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.hikcreate.common.sdk.response.apiparam.Response
;
import
com.hikcreate.common.sdk.response.statuscode.StatusCode
;
import
com.hikcreate.edl.common.sdk.util.EncryptStringAes
;
import
com.hikcreate.edl.common.sdk.util.EncryptStringAes
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.enums.ResultCode
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BaseEncryptRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BaseEncryptRes
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.MethodParameter
;
...
@@ -18,6 +18,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
...
@@ -18,6 +18,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
* 返回加密拦截器
* 返回加密拦截器
* 返回对象必须为com.hikcreate.edl.pub.web.mobile.infra.core.Result类型
* 返回对象必须为com.hikcreate.edl.pub.web.mobile.infra.core.Result类型
* 加密后信息保存于Result.data
* 加密后信息保存于Result.data
*
* @author lixian
* @author lixian
* @description
* @description
* @date 2020/6/19 10:39
* @date 2020/6/19 10:39
...
@@ -26,6 +27,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
...
@@ -26,6 +27,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
@ControllerAdvice
@ControllerAdvice
public
class
EncryptResponseBodyAdvice
implements
ResponseBodyAdvice
{
public
class
EncryptResponseBodyAdvice
implements
ResponseBodyAdvice
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
ObjectMapper
objectMapper
=
new
ObjectMapper
();
@Override
@Override
public
boolean
supports
(
MethodParameter
methodParameter
,
Class
aClass
)
{
public
boolean
supports
(
MethodParameter
methodParameter
,
Class
aClass
)
{
return
true
;
return
true
;
...
@@ -34,20 +36,20 @@ public class EncryptResponseBodyAdvice implements ResponseBodyAdvice {
...
@@ -34,20 +36,20 @@ public class EncryptResponseBodyAdvice implements ResponseBodyAdvice {
@Override
@Override
public
Object
beforeBodyWrite
(
Object
o
,
MethodParameter
methodParameter
,
MediaType
mediaType
,
Class
aClass
,
ServerHttpRequest
serverHttpRequest
,
ServerHttpResponse
serverHttpResponse
)
{
public
Object
beforeBodyWrite
(
Object
o
,
MethodParameter
methodParameter
,
MediaType
mediaType
,
Class
aClass
,
ServerHttpRequest
serverHttpRequest
,
ServerHttpResponse
serverHttpResponse
)
{
try
{
try
{
log
.
info
(
"Response body 明文: {}"
,
objectMapper
.
writeValueAsString
(
o
));
log
.
info
(
"Response body 明文: {}"
,
objectMapper
.
writeValueAsString
(
o
));
if
(
methodParameter
.
getMethod
().
isAnnotationPresent
(
ResponseEncryptAnnotation
.
class
)
&&
o
instanceof
Result
)
{
if
(
methodParameter
.
getMethod
().
isAnnotationPresent
(
ResponseEncryptAnnotation
.
class
)
&&
o
instanceof
Response
)
{
Res
ult
<
Object
>
result
=
(
Result
<
Object
>)
o
;
Res
ponse
<
Object
>
result
=
(
Response
<
Object
>)
o
;
if
(
ResultCode
.
SUCCESS
.
getCode
().
equals
(
result
.
getCode
())
)
{
if
(
StatusCode
.
SUCCESS
.
getCode
()
==
(
result
.
getCode
())
)
{
//进行加密
//进行加密
Object
data
=
result
.
getData
();
Object
data
=
result
.
getData
();
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
String
dataStr
=
objectMapper
.
writeValueAsString
(
data
);
String
dataStr
=
objectMapper
.
writeValueAsString
(
data
);
String
encryptStr
=
EncryptStringAes
.
encryptAes
(
dataStr
,
"AES/ECB/PKCS5Padding"
);
String
encryptStr
=
EncryptStringAes
.
encryptAes
(
dataStr
,
"AES/ECB/PKCS5Padding"
);
BaseEncryptRes
baseEncryptRes
=
new
BaseEncryptRes
();
BaseEncryptRes
baseEncryptRes
=
new
BaseEncryptRes
();
baseEncryptRes
.
setEncData
(
encryptStr
);
baseEncryptRes
.
setEncData
(
encryptStr
);
result
.
setData
(
baseEncryptRes
);
result
.
setData
(
baseEncryptRes
);
o
=
result
;
o
=
result
;
log
.
info
(
"Response body 密文: {}"
,
objectMapper
.
writeValueAsString
(
o
));
log
.
info
(
"Response body 密文: {}"
,
objectMapper
.
writeValueAsString
(
o
));
}
}
}
}
}
}
...
...
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
2919089c
...
@@ -9,6 +9,8 @@ import com.hikcreate.common.sdk.response.apiparam.Response;
...
@@ -9,6 +9,8 @@ import com.hikcreate.common.sdk.response.apiparam.Response;
import
com.hikcreate.common.sdk.response.apiparam.ResponseGenerator
;
import
com.hikcreate.common.sdk.response.apiparam.ResponseGenerator
;
import
com.hikcreate.common.sdk.response.statuscode.StatusCode
;
import
com.hikcreate.common.sdk.response.statuscode.StatusCode
;
import
com.hikcreate.edl.pub.web.mobile.domain.IBindService
;
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.VechicleCache
;
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.DrivingLicenseFeign
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.VechicleFeign
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.VechicleFeign
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.ViolationFeign
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.ViolationFeign
;
...
@@ -57,6 +59,10 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
...
@@ -57,6 +59,10 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
VerifyInfoMapper
verifyInfo
;
VerifyInfoMapper
verifyInfo
;
@Resource
@Resource
DrivingLicenseFeign
drivingLicense
;
DrivingLicenseFeign
drivingLicense
;
@Resource
BindCache
bindCache
;
@Resource
VechicleCache
vechicleCache
;
@Override
@Override
...
@@ -90,14 +96,14 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
...
@@ -90,14 +96,14 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
@Override
@Override
public
Response
<
YearCheckInfoRes
>
yearCheckInfo
(
BindInfoQuery
query
)
{
public
Response
<
YearCheckInfoRes
>
yearCheckInfo
(
BindInfoQuery
query
)
{
BindInfo
bindInfo
=
mapper
.
selec
tById
(
query
.
getUnqId
());
BindInfo
bindInfo
=
bindCache
.
ge
tById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
return
ResponseGenerator
.
fail
(
StatusCode
.
DATA_ERROR
);
return
ResponseGenerator
.
fail
(
StatusCode
.
DATA_ERROR
);
}
}
PlateNumAndTypeQueryReq
req
=
new
PlateNumAndTypeQueryReq
();
PlateNumAndTypeQueryReq
req
=
new
PlateNumAndTypeQueryReq
();
req
.
setPlateNum
(
bindInfo
.
getPlateNum
());
req
.
setPlateNum
(
bindInfo
.
getPlateNum
());
req
.
setPlateType
(
bindInfo
.
getPlateType
());
req
.
setPlateType
(
bindInfo
.
getPlateType
());
VehicleRes
vehicleRes
=
vechicle
.
getByPlateNumAndType
(
req
);
VehicleRes
vehicleRes
=
vechicle
Cache
.
getByPlateNumAndType
(
req
);
if
(
Objects
.
isNull
(
vehicleRes
))
{
if
(
Objects
.
isNull
(
vehicleRes
))
{
return
ResponseGenerator
.
success
();
return
ResponseGenerator
.
success
();
}
}
...
@@ -117,14 +123,14 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
...
@@ -117,14 +123,14 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
@Override
@Override
public
Response
<
InsuranceInfoRes
>
insuranceInfo
(
BindInfoQuery
query
)
{
public
Response
<
InsuranceInfoRes
>
insuranceInfo
(
BindInfoQuery
query
)
{
BindInfo
bindInfo
=
mapper
.
selec
tById
(
query
.
getUnqId
());
BindInfo
bindInfo
=
bindCache
.
ge
tById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
return
ResponseGenerator
.
fail
(
StatusCode
.
DATA_ERROR
);
return
ResponseGenerator
.
fail
(
StatusCode
.
DATA_ERROR
);
}
}
PlateNumAndTypeQueryReq
req
=
new
PlateNumAndTypeQueryReq
();
PlateNumAndTypeQueryReq
req
=
new
PlateNumAndTypeQueryReq
();
req
.
setPlateNum
(
bindInfo
.
getPlateNum
());
req
.
setPlateNum
(
bindInfo
.
getPlateNum
());
req
.
setPlateType
(
bindInfo
.
getPlateType
());
req
.
setPlateType
(
bindInfo
.
getPlateType
());
VehicleRes
vehicleRes
=
vechicle
.
getByPlateNumAndType
(
req
);
VehicleRes
vehicleRes
=
vechicle
Cache
.
getByPlateNumAndType
(
req
);
if
(
Objects
.
isNull
(
vehicleRes
))
{
if
(
Objects
.
isNull
(
vehicleRes
))
{
return
ResponseGenerator
.
success
();
return
ResponseGenerator
.
success
();
}
}
...
@@ -143,9 +149,9 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
...
@@ -143,9 +149,9 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
"yyyy-MM-dd"
);
"yyyy-MM-dd"
);
insuranceInfoRes
.
setValidityTimeStart
(
endTime
);
insuranceInfoRes
.
setValidityTimeStart
(
endTime
);
}
else
{
}
else
{
insuranceInfoRes
.
setStatus
(
"未知"
);
}
}
return
null
;
return
ResponseGenerator
.
success
(
insuranceInfoRes
)
;
}
}
...
@@ -154,7 +160,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
...
@@ -154,7 +160,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
/**
/**
* 校验当前的绑定信息是否存在
* 校验当前的绑定信息是否存在
*/
*/
BindInfo
bindInfo
=
mapper
.
selec
tById
(
query
.
getUnqId
());
BindInfo
bindInfo
=
bindCache
.
ge
tById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
return
ResponseGenerator
.
fail
(
StatusCode
.
DATA_ERROR
);
return
ResponseGenerator
.
fail
(
StatusCode
.
DATA_ERROR
);
}
}
...
@@ -188,7 +194,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
...
@@ -188,7 +194,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
/**
/**
* 校验当前的绑定信息是否存在
* 校验当前的绑定信息是否存在
*/
*/
BindInfo
bindInfo
=
mapper
.
selec
tById
(
query
.
getUnqId
());
BindInfo
bindInfo
=
bindCache
.
ge
tById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
return
ResponseGenerator
.
fail
(
StatusCode
.
DATA_ERROR
);
return
ResponseGenerator
.
fail
(
StatusCode
.
DATA_ERROR
);
}
}
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/Result.java
deleted
100644 → 0
View file @
cd0bb81d
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
core
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.enums.ResultCode
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* description: 返回结果封装
*
* @author: xieshixiang
* @time:2020/6/18 12:51
**/
@Data
@NoArgsConstructor
public
class
Result
<
T
>
{
private
boolean
success
;
private
String
msg
;
private
String
code
;
private
T
data
;
public
static
<
T
>
Result
<
T
>
createResult
(
boolean
isSuccess
,
String
mes
,
T
data
,
String
code
)
{
Result
<
T
>
result
=
new
Result
<
T
>();
if
(
mes
!=
null
&&
!
mes
.
isEmpty
())
{
result
.
setMsg
(
mes
);
}
if
(
data
!=
null
)
{
result
.
setData
(
data
);
}
result
.
setSuccess
(
isSuccess
);
result
.
setCode
(
code
);
return
result
;
}
public
static
<
T
>
Result
<
T
>
createResult
(
ResultCode
code
,
T
data
)
{
Result
<
T
>
result
=
new
Result
<
T
>();
if
(
code
.
getMsg
()
!=
null
&&
!
code
.
getMsg
().
isEmpty
())
{
result
.
setMsg
(
code
.
getMsg
());
}
if
(
data
!=
null
)
{
result
.
setData
(
data
);
}
result
.
setSuccess
(
code
.
isSuccess
());
result
.
setCode
(
code
.
getCode
());
return
result
;
}
public
static
<
T
>
Result
<
T
>
successResult
()
{
return
createResult
(
ResultCode
.
SUCCESS
,
null
);
}
public
static
<
T
>
Result
<
T
>
successResult
(
T
data
)
{
return
createResult
(
ResultCode
.
SUCCESS
,
data
);
}
public
static
<
T
>
Result
<
T
>
errorResult
()
{
return
createResult
(
ResultCode
.
SYSTEM_UNKNOWN_ERROR
,
null
);
}
public
static
<
T
>
Result
<
T
>
errorResult
(
T
data
)
{
return
createResult
(
ResultCode
.
SYSTEM_UNKNOWN_ERROR
,
data
);
}
public
static
<
T
>
Result
<
T
>
errorResult
(
ResultCode
code
)
{
return
createResult
(
code
,
null
);
}
public
static
<
T
>
Result
<
T
>
errorResult
(
ResultCode
code
,
T
data
)
{
return
createResult
(
code
,
data
);
}
public
Result
<
T
>
failFast
()
{
return
this
.
failFast
(
this
.
code
,
this
.
msg
);
}
public
Result
<
T
>
failFast
(
String
code
,
String
msg
)
{
if
(!
this
.
success
)
{
RuntimeException
ex
=
new
RuntimeException
(
code
+
":"
+
msg
);
throw
ex
;
}
else
{
return
this
;
}
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
o
==
this
)
{
return
true
;
}
else
if
(!(
o
instanceof
Result
))
{
return
false
;
}
else
{
Result
<?>
other
=
(
Result
)
o
;
if
(!
other
.
canEqual
(
this
))
{
return
false
;
}
else
if
(
this
.
isSuccess
()
!=
other
.
isSuccess
())
{
return
false
;
}
else
{
label49:
{
Object
this
$message
=
this
.
getMsg
();
Object
other$message
=
other
.
getMsg
();
if
(
this
$message
==
null
)
{
if
(
other$message
==
null
)
{
break
label49
;
}
}
else
if
(
this
$message
.
equals
(
other$message
))
{
break
label49
;
}
return
false
;
}
Object
this
$code
=
this
.
getCode
();
Object
other$code
=
other
.
getCode
();
if
(
this
$code
==
null
)
{
if
(
other$code
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$code
.
equals
(
other$code
))
{
return
false
;
}
Object
this
$data
=
this
.
getData
();
Object
other$data
=
other
.
getData
();
if
(
this
$data
==
null
)
{
if
(
other$data
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$data
.
equals
(
other$data
))
{
return
false
;
}
return
true
;
}
}
}
protected
boolean
canEqual
(
Object
other
)
{
return
other
instanceof
Result
;
}
@Override
public
String
toString
()
{
return
"Result(success="
+
this
.
isSuccess
()
+
", message="
+
this
.
getMsg
()
+
", code="
+
this
.
getCode
()
+
", "
+
"data="
+
this
.
getData
()
+
")"
;
}
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/enums/ResultCode.java
deleted
100644 → 0
View file @
cd0bb81d
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
core
.
enums
;
/**
* description: 请求返回的结果的code码
*
* @author: xieshixiang
* @time:2020/6/18 12:38
**/
public
enum
ResultCode
{
SUCCESS
(
"1000"
,
"操作成功"
,
true
),
SYSTEM_UNKNOWN_ERROR
(
"1001"
,
"系统未知错误"
,
false
),
HASH_NO_PRIVILEGE
(
"1002"
,
"没有权限访问该服务"
,
false
),
DATA_ERROR
(
"1003"
,
"数据错误"
,
false
),
RESUBMIT
(
"1004"
,
"重复提交"
,
false
),
PARAMETER_ERROR
(
"1005"
,
"参数错误"
,
false
),
SERVICE_ERROR
(
"1006"
,
"业务错误"
,
false
);
private
String
code
;
private
String
msg
;
private
boolean
success
;
ResultCode
(
String
code
,
String
msg
,
boolean
success
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
this
.
success
=
success
;
}
public
String
getCode
()
{
return
this
.
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
boolean
isSuccess
()
{
return
success
;
}
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/BindCache.java
0 → 100644
View file @
2919089c
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
cache
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/**
* @author lixian
* @description
* @date 2020/6/21 15:49
**/
@Component
public
class
BindCache
{
@Resource
private
BindInfoMapper
mapper
;
@Cacheable
(
value
=
"bindinfo"
,
key
=
"'id:'+#unqId"
,
unless
=
"#result==null"
)
public
BindInfo
getById
(
String
unqId
)
{
LambdaQueryWrapper
<
BindInfo
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
BindInfo:
:
getUnqId
,
unqId
);
queryWrapper
.
eq
(
BindInfo:
:
getStatus
,
1
);
return
mapper
.
selectOne
(
queryWrapper
);
}
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/cache/VechicleCache.java
0 → 100644
View file @
2919089c
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
cache
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.VechicleFeign
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.request.PlateNumAndTypeQueryReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.request.PlateNumQueryReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.response.VehicleRes
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @author lixian
* @description
* @date 2020/6/21 15:53
**/
@Component
public
class
VechicleCache
{
@Resource
private
VechicleFeign
vechicle
;
/**
* -----获取车辆信息列表------
*
* @param req
* @return
* @param号牌号码
*/
@Cacheable
(
value
=
"vehicles"
,
key
=
"'platenum:'+#req.plateNum"
,
unless
=
"#result==null or #result.size()==0"
)
public
List
<
VehicleRes
>
getByPlateNum
(
@RequestBody
PlateNumQueryReq
req
){
return
vechicle
.
getByPlateNum
(
req
);
}
/**
* -----获取车辆信息------
* 查询车辆信息-号牌号码和号牌类型
*
* @param req
* @return
* @param号牌号码
* @param号牌类型
*/
@Cacheable
(
value
=
"vehicle"
,
key
=
"'plateNum:'+#req.plateNum+':plateType:'+#req.plateType"
,
unless
=
"#result==null"
)
public
VehicleRes
getByPlateNumAndType
(
@RequestBody
PlateNumAndTypeQueryReq
req
)
{
return
vechicle
.
getByPlateNumAndType
(
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