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
d5bc2c35
Commit
d5bc2c35
authored
Jun 21, 2020
by
lixian7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整接口返回体
parent
1135a081
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
136 additions
and
54 deletions
+136
-54
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
+11
-9
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
+11
-8
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/exception/GlobalExceptionHandler.java
+62
-0
domain/pom.xml
+5
-0
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/IBindService.java
+7
-6
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+39
-30
infra/pom.xml
+1
-1
No files found.
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
View file @
d5bc2c35
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
.
controller
;
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
.
controller
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateTime
;
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.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.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation
;
...
@@ -45,9 +48,9 @@ public class BindInfoControlller extends BaseController {
...
@@ -45,9 +48,9 @@ public class BindInfoControlller extends BaseController {
*/
*/
@PostMapping
(
"bind"
)
@PostMapping
(
"bind"
)
@ResponseEncryptAnnotation
@ResponseEncryptAnnotation
public
Res
ult
<
String
>
bindInfo
(
@RequestBody
BindInfo
info
)
{
public
Res
ponse
<
String
>
bindInfo
(
@RequestBody
BindInfo
info
)
{
if
(
info
==
null
)
{
if
(
info
==
null
)
{
return
Res
ult
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
,
"参数不能为空"
);
return
Res
ponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
);
}
}
return
service
.
bind
(
info
);
return
service
.
bind
(
info
);
}
}
...
@@ -62,13 +65,13 @@ public class BindInfoControlller extends BaseController {
...
@@ -62,13 +65,13 @@ public class BindInfoControlller extends BaseController {
* @date: 2020/6/19 10:27
* @date: 2020/6/19 10:27
*/
*/
@PostMapping
(
"unbind"
)
@PostMapping
(
"unbind"
)
public
Res
ult
unbindInfo
(
@RequestBody
BindInfo
info
)
{
public
Res
ponse
unbindInfo
(
@RequestBody
BindInfo
info
)
{
if
(
info
==
null
)
{
if
(
info
==
null
)
{
return
Res
ult
.
errorResult
(
ResultCode
.
PARAMETER
_ERROR
);
return
Res
ponseGenerator
.
fail
(
StatusCode
.
PARAM
_ERROR
);
}
}
info
.
setStatus
(
"0"
);
info
.
setStatus
(
"0"
);
info
.
setUnbindTime
(
DateTime
.
now
());
info
.
setUnbindTime
(
DateTime
.
now
());
return
mapper
.
updateById
(
info
)
>
0
?
Res
ult
.
successResult
()
:
Result
.
errorResult
(
);
return
mapper
.
updateById
(
info
)
>
0
?
Res
ponseGenerator
.
success
()
:
ResponseGenerator
.
fail
(
""
);
}
}
/**
/**
...
@@ -81,12 +84,11 @@ public class BindInfoControlller extends BaseController {
...
@@ -81,12 +84,11 @@ public class BindInfoControlller extends BaseController {
*/
*/
@PostMapping
(
"query"
)
@PostMapping
(
"query"
)
@ResponseEncryptAnnotation
@ResponseEncryptAnnotation
public
Res
ult
<
ResultList
<
BindInfo
>>
bindInfoQery
(
@RequestBody
BindInfoQuery
query
)
{
public
Res
ponse
<
ResultList
<
BindInfo
>>
bindInfoQery
(
@RequestBody
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
if
(
query
==
null
)
{
return
Res
ult
.
errorResult
(
ResultCode
.
PARAMETER
_ERROR
);
return
Res
ponseGenerator
.
fail
(
StatusCode
.
PARAM
_ERROR
);
}
}
return
Result
.
successResult
(
new
ResultList
<
BindInfo
>(
mapper
.
selectByQuery
(
query
).
getDataItems
()));
return
ResponseGenerator
.
success
(
new
ResultList
<
BindInfo
>(
mapper
.
selectByQuery
(
query
).
getDataItems
()));
}
}
...
...
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
View file @
d5bc2c35
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
.
controller
;
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
.
controller
;
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.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.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.enums.ResultCode
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.enums.ResultCode
;
...
@@ -40,9 +43,9 @@ public class H5Controller {
...
@@ -40,9 +43,9 @@ public class H5Controller {
* @date: 2020/6/19 10:32
* @date: 2020/6/19 10:32
*/
*/
@GetMapping
(
"yearCheckInfo"
)
@GetMapping
(
"yearCheckInfo"
)
public
Res
ult
<
YearCheckInfoRes
>
yearCheckInfo
(
@RequestBody
@Validated
BindInfoQuery
query
)
{
public
Res
ponse
<
YearCheckInfoRes
>
yearCheckInfo
(
@RequestBody
@Validated
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
if
(
query
==
null
)
{
return
Res
ult
.
errorResult
(
ResultCode
.
PARAMETER
_ERROR
);
return
Res
ponseGenerator
.
fail
(
StatusCode
.
PARAM
_ERROR
);
}
}
return
service
.
yearCheckInfo
(
query
);
return
service
.
yearCheckInfo
(
query
);
}
}
...
@@ -56,9 +59,9 @@ public class H5Controller {
...
@@ -56,9 +59,9 @@ public class H5Controller {
* @date: 2020/6/19 16:28
* @date: 2020/6/19 16:28
*/
*/
@GetMapping
(
"violationInfo"
)
@GetMapping
(
"violationInfo"
)
public
Res
ult
<
ResultList
<
ViolationInfoRes
>>
violationInfo
(
@RequestBody
@Validated
BindInfoQuery
query
)
{
public
Res
ponse
<
ResultList
<
ViolationInfoRes
>>
violationInfo
(
@RequestBody
@Validated
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
if
(
query
==
null
)
{
return
Res
ult
.
errorResult
(
ResultCode
.
PARAMETER
_ERROR
);
return
Res
ponseGenerator
.
fail
(
StatusCode
.
PARAM
_ERROR
);
}
}
return
service
.
violationInfo
(
query
);
return
service
.
violationInfo
(
query
);
}
}
...
@@ -72,9 +75,9 @@ public class H5Controller {
...
@@ -72,9 +75,9 @@ public class H5Controller {
* @date: 2020/6/19 16:28
* @date: 2020/6/19 16:28
*/
*/
@GetMapping
(
"insuranceInfo"
)
@GetMapping
(
"insuranceInfo"
)
public
Res
ult
<
InsuranceInfoRes
>
insuranceInfo
(
@RequestBody
@Validated
BindInfoQuery
query
)
{
public
Res
ponse
<
InsuranceInfoRes
>
insuranceInfo
(
@RequestBody
@Validated
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
if
(
query
==
null
)
{
return
Res
ult
.
errorResult
(
ResultCode
.
PARAMETER
_ERROR
);
return
Res
ponseGenerator
.
fail
(
StatusCode
.
PARAM
_ERROR
);
}
}
return
service
.
insuranceInfo
(
query
);
return
service
.
insuranceInfo
(
query
);
}
}
...
@@ -88,9 +91,9 @@ public class H5Controller {
...
@@ -88,9 +91,9 @@ public class H5Controller {
* @date: 2020/6/19 16:28
* @date: 2020/6/19 16:28
*/
*/
@GetMapping
(
"drivingLicenseInfo"
)
@GetMapping
(
"drivingLicenseInfo"
)
public
Res
ult
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
@RequestBody
BindInfoQuery
query
)
{
public
Res
ponse
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
@RequestBody
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
if
(
query
==
null
)
{
return
Res
ult
.
errorResult
(
ResultCode
.
PARAMETER
_ERROR
);
return
Res
ponseGenerator
.
fail
(
StatusCode
.
PARAM
_ERROR
);
}
}
return
service
.
drivingLicenseInfo
(
query
);
return
service
.
drivingLicenseInfo
(
query
);
}
}
...
...
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/exception/GlobalExceptionHandler.java
0 → 100644
View file @
d5bc2c35
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
.
exception
;
import
com.hikcreate.common.sdk.exception.DefaultExceptionHandler
;
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
feign.RetryableException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.ServletRequestBindingException
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.ConstraintViolation
;
import
javax.validation.ConstraintViolationException
;
/**
* 全局异常处理类 FOR controller层以下的异常,Filter的异常不能捕获
*/
@Slf4j
@ControllerAdvice
public
class
GlobalExceptionHandler
extends
DefaultExceptionHandler
{
@Override
@ExceptionHandler
(
value
=
ServletRequestBindingException
.
class
)
@ResponseBody
@ResponseStatus
(
HttpStatus
.
OK
)
public
Response
handleServletRequestBindingException
(
ServletRequestBindingException
e
)
{
log
.
error
(
"param bind failure"
,
e
);
return
ResponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
.
getCode
(),
e
.
getMessage
());
}
/**
* 参数验证失败
* <p>
* GET 方法入口
*
* @param e
* @return
*/
@ExceptionHandler
(
ConstraintViolationException
.
class
)
@ResponseBody
@ResponseStatus
(
HttpStatus
.
OK
)
public
Response
handleValidationException
(
ConstraintViolationException
e
)
{
for
(
ConstraintViolation
<?>
s
:
e
.
getConstraintViolations
())
{
log
.
error
(
"Request parameter is invalid {}"
,
s
.
getMessage
());
return
ResponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
.
getCode
(),
s
.
getMessage
());
}
return
ResponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
);
}
@ExceptionHandler
(
value
=
RetryableException
.
class
)
@ResponseBody
public
Response
retryableExceptionHandler
(
HttpServletRequest
req
,
RetryableException
e
)
throws
Exception
{
log
.
error
(
" connect timed out"
,
e
);
return
ResponseGenerator
.
fail
(
StatusCode
.
SYSTEM_ERROR
.
getCode
(),
"服务请求超时或不可用"
,
e
.
getMessage
());
}
}
\ No newline at end of file
domain/pom.xml
View file @
d5bc2c35
...
@@ -21,6 +21,11 @@
...
@@ -21,6 +21,11 @@
<artifactId>
infra
</artifactId>
<artifactId>
infra
</artifactId>
<version>
${parent.version}
</version>
<version>
${parent.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.hikcreate.edl.common
</groupId>
<artifactId>
sdk
</artifactId>
<version>
${parent.version}
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/IBindService.java
View file @
d5bc2c35
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
;
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.hikcreate.
edl.pub.web.mobile.infra.core.Result
;
import
com.hikcreate.
common.sdk.response.apiparam.Response
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes
;
/**
/**
* 客户绑定服务接口
* 客户绑定服务接口
*
*
...
@@ -22,7 +23,7 @@ public interface IBindService extends IService<BindInfo> {
...
@@ -22,7 +23,7 @@ public interface IBindService extends IService<BindInfo> {
* @author: xsx
* @author: xsx
* @date: 2020/6/19 10:32
* @date: 2020/6/19 10:32
*/
*/
Res
ult
bind
(
BindInfo
info
);
Res
ponse
bind
(
BindInfo
info
);
/**
/**
* 年检信息查询接口
* 年检信息查询接口
...
@@ -30,14 +31,14 @@ public interface IBindService extends IService<BindInfo> {
...
@@ -30,14 +31,14 @@ public interface IBindService extends IService<BindInfo> {
* @param query
* @param query
* @return
* @return
*/
*/
Res
ult
yearCheckInfo
(
BindInfoQuery
query
);
Res
ponse
yearCheckInfo
(
BindInfoQuery
query
);
/**
/**
* 保险信息查询接口
* 保险信息查询接口
* @param query
* @param query
* @return
* @return
*/
*/
Res
ult
insuranceInfo
(
BindInfoQuery
query
);
Res
ponse
insuranceInfo
(
BindInfoQuery
query
);
/**
/**
* 违法信息查询接口
* 违法信息查询接口
...
@@ -47,7 +48,7 @@ public interface IBindService extends IService<BindInfo> {
...
@@ -47,7 +48,7 @@ public interface IBindService extends IService<BindInfo> {
* @author: xsx
* @author: xsx
* @date: 2020/6/19 16:06
* @date: 2020/6/19 16:06
*/
*/
Res
ult
violationInfo
(
BindInfoQuery
query
);
Res
ponse
violationInfo
(
BindInfoQuery
query
);
/**
/**
* 驾照信息查询接口
* 驾照信息查询接口
...
@@ -57,6 +58,6 @@ public interface IBindService extends IService<BindInfo> {
...
@@ -57,6 +58,6 @@ public interface IBindService extends IService<BindInfo> {
* @author: xsx
* @author: xsx
* @date: 2020/6/19 16:29
* @date: 2020/6/19 16:29
*/
*/
Res
ult
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
BindInfoQuery
query
);
Res
ponse
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
BindInfoQuery
query
);
}
}
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
d5bc2c35
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
.
impl
;
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
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.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.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.enums.ResultCode
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.enums.ResultCode
;
...
@@ -21,12 +23,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.VerifyInfoMapper;
...
@@ -21,12 +23,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.VerifyInfoMapper;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.VerifyInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.VerifyInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.*
;
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
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
...
@@ -60,7 +57,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
...
@@ -60,7 +57,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
@Override
@Override
public
Res
ult
bind
(
BindInfo
info
)
{
public
Res
ponse
bind
(
BindInfo
info
)
{
info
.
setUnqId
(
UUID
.
randomUUID
().
toString
());
info
.
setUnqId
(
UUID
.
randomUUID
().
toString
());
info
.
setGmtBindTime
(
DateTime
.
now
());
info
.
setGmtBindTime
(
DateTime
.
now
());
...
@@ -69,7 +66,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
...
@@ -69,7 +66,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
boundQuery
.
eq
(
"user_id"
,
info
.
getUserId
());
boundQuery
.
eq
(
"user_id"
,
info
.
getUserId
());
Integer
bound
=
mapper
.
selectCount
(
boundQuery
);
Integer
bound
=
mapper
.
selectCount
(
boundQuery
);
if
(
bound
>=
3
)
{
if
(
bound
>=
3
)
{
return
Res
ult
.
errorResult
(
ResultCode
.
SERVICE
_ERROR
);
return
Res
ponseGenerator
.
fail
(
StatusCode
.
BUSINESS
_ERROR
);
}
}
//规则2:客户手机号与车辆对应的车主手机号一致
//规则2:客户手机号与车辆对应的车主手机号一致
...
@@ -82,64 +79,76 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
...
@@ -82,64 +79,76 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
}
}
}
}
if
(
info
.
getPlateType
()
==
null
||
info
.
getPlateType
().
equals
(
""
))
{
if
(
info
.
getPlateType
()
==
null
||
info
.
getPlateType
().
equals
(
""
))
{
return
Res
ult
.
errorResult
(
Result
Code
.
DATA_ERROR
);
return
Res
ponseGenerator
.
fail
(
Status
Code
.
DATA_ERROR
);
}
}
return
mapper
.
insert
(
info
)
>
0
?
Res
ult
.
successResult
(
info
.
getUnqId
())
:
return
mapper
.
insert
(
info
)
>
0
?
Res
ponseGenerator
.
success
(
info
.
getUnqId
())
:
Res
ult
.
errorResult
(
ResultCode
.
SERVICE
_ERROR
);
Res
ponseGenerator
.
fail
(
StatusCode
.
BUSINESS
_ERROR
);
}
}
@Override
@Override
public
Res
ult
<
YearCheckInfoRes
>
yearCheckInfo
(
BindInfoQuery
query
)
{
public
Res
ponse
<
YearCheckInfoRes
>
yearCheckInfo
(
BindInfoQuery
query
)
{
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
return
Res
ult
.
errorResult
(
Result
Code
.
DATA_ERROR
);
return
Res
ponseGenerator
.
fail
(
Status
Code
.
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
.
getByPlateNumAndType
(
req
);
if
(
Objects
.
isNull
(
vehicleRes
)
)
{
if
(
Objects
.
isNull
(
vehicleRes
)
)
{
return
Res
ult
.
successResult
();
return
Res
ponseGenerator
.
success
();
}
}
YearCheckInfoRes
yearCheckInfoRes
=
new
YearCheckInfoRes
();
YearCheckInfoRes
yearCheckInfoRes
=
new
YearCheckInfoRes
();
yearCheckInfoRes
.
setYxqz
(
vehicleRes
.
getYxqz
());
yearCheckInfoRes
.
setPlateNum
(
bindInfo
.
getPlateNum
());
yearCheckInfoRes
.
setValidityTime
(
vehicleRes
.
getYxqz
());
Long
checkTime
=
DateUtil
.
parse
(
vehicleRes
.
getYxqz
(),
"yyyy-MM-dd HH:mm:ss"
).
getTime
();
Long
checkTime
=
DateUtil
.
parse
(
vehicleRes
.
getYxqz
(),
"yyyy-MM-dd HH:mm:ss"
).
getTime
();
if
(
checkTime
>=
System
.
currentTimeMillis
()
)
{
if
(
checkTime
>=
System
.
currentTimeMillis
()
)
{
yearCheckInfoRes
.
set
Zt
(
"未到期"
);
yearCheckInfoRes
.
set
Status
(
"未到期"
);
}
else
{
}
else
{
yearCheckInfoRes
.
set
Zt
(
"已到期"
);
yearCheckInfoRes
.
set
Status
(
"已到期"
);
}
}
return
Res
ult
.
successResult
(
yearCheckInfoRes
);
return
Res
ponseGenerator
.
success
(
yearCheckInfoRes
);
}
}
@Override
@Override
public
Res
ult
<
InsuranceInfoRes
>
insuranceInfo
(
BindInfoQuery
query
)
{
public
Res
ponse
<
InsuranceInfoRes
>
insuranceInfo
(
BindInfoQuery
query
)
{
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
return
Res
ult
.
errorResult
(
Result
Code
.
DATA_ERROR
);
return
Res
ponseGenerator
.
fail
(
Status
Code
.
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
.
getByPlateNumAndType
(
req
);
if
(
Objects
.
isNull
(
vehicleRes
)
)
{
if
(
Objects
.
isNull
(
vehicleRes
)
)
{
return
Res
ult
.
successResult
();
return
Res
ponseGenerator
.
success
();
}
}
InsuranceInfoRes
insuranceInfoRes
=
new
InsuranceInfoRes
();
InsuranceInfoRes
insuranceInfoRes
=
new
InsuranceInfoRes
();
insuranceInfoRes
.
setPlateNum
(
bindInfo
.
getPlateNum
());
if
(
StrUtil
.
isNotBlank
(
vehicleRes
.
getBxzzrq
())
)
{
if
(
StrUtil
.
isNotBlank
(
vehicleRes
.
getBxzzrq
())
)
{
Long
time
=
DateUtil
.
parse
(
vehicleRes
.
getBxzzrq
(),
"yyyy-MM-dd HH:mm:ss"
).
getTime
();
if
(
time
>=
System
.
currentTimeMillis
())
{
insuranceInfoRes
.
setStatus
(
"有效"
);
}
else
{
}
else
{
insuranceInfoRes
.
setStatus
(
"已到期"
);
}
insuranceInfoRes
.
setValidityTimeEnd
(
vehicleRes
.
getBxzzrq
().
substring
(
0
,
10
));
String
endTime
=
DateUtil
.
format
(
DateUtil
.
offsetMonth
(
DateUtil
.
parse
(
vehicleRes
.
getBxzzrq
(),
"yyyy-MM-dd HH:mm:ss"
),
-
12
),
"yyyy-MM-dd"
);
insuranceInfoRes
.
setValidityTimeStart
(
endTime
);
}
else
{
insuranceInfoRes
.
setStatus
(
"未知"
);
}
}
return
null
;
return
ResponseGenerator
.
success
(
insuranceInfoRes
)
;
}
}
@Override
@Override
public
Res
ult
<
ResultList
<
ViolationInfoRes
>>
violationInfo
(
BindInfoQuery
query
)
{
public
Res
ponse
<
ResultList
<
ViolationInfoRes
>>
violationInfo
(
BindInfoQuery
query
)
{
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
return
Res
ult
.
errorResult
(
Result
Code
.
DATA_ERROR
);
return
Res
ponseGenerator
.
fail
(
Status
Code
.
DATA_ERROR
);
}
}
ViolationPlateNumAndTypeQueryReq
req
=
new
ViolationPlateNumAndTypeQueryReq
();
ViolationPlateNumAndTypeQueryReq
req
=
new
ViolationPlateNumAndTypeQueryReq
();
...
@@ -156,14 +165,14 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
...
@@ -156,14 +165,14 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
info
.
setMoney
(
res
.
getfk
);
info
.
setMoney
(
res
.
getfk
);
violationInfoResList
.
add
(
info
);
violationInfoResList
.
add
(
info
);
}
}
return
Res
ult
.
successResult
(
new
ResultList
<>(
violationInfoResList
));
return
Res
ponseGenerator
.
success
(
new
ResultList
<>(
violationInfoResList
));
}
}
@Override
@Override
public
Res
ult
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
BindInfoQuery
query
)
{
public
Res
ponse
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
BindInfoQuery
query
)
{
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
()))
{
return
Res
ult
.
errorResult
(
Result
Code
.
DATA_ERROR
);
return
Res
ponseGenerator
.
fail
(
Status
Code
.
DATA_ERROR
);
}
}
...
...
infra/pom.xml
View file @
d5bc2c35
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
<dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
<version>
2.5.4
</version>
<version>
${dynamic-datasource.version}
</version>
</dependency>
</dependency>
<!--多数据源支持 End-->
<!--多数据源支持 End-->
...
...
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