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
2518a525
Commit
2518a525
authored
Jun 19, 2020
by
xieshixiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改result
parent
f460f7ff
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
54 deletions
+33
-54
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
+2
-2
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
+9
-9
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+7
-7
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/Result.java
+10
-31
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/enums/ResultCode.java
+5
-5
No files found.
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
View file @
2518a525
...
...
@@ -63,7 +63,7 @@ public class BindInfoControlller extends BaseController {
@PostMapping
(
"unbind"
)
public
Result
unbindInfo
(
@RequestBody
BindInfo
info
)
{
if
(
info
==
null
)
{
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
,
"参数不能为空"
);
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
);
}
info
.
setStatus
(
"0"
);
info
.
setEditorTime
(
DateTime
.
now
());
...
...
@@ -82,7 +82,7 @@ public class BindInfoControlller extends BaseController {
@ResponseEncryptAnnotation
public
Result
<
BindInfo
>
bindInfoQery
(
@RequestBody
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
,
"参数不能为空"
);
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
);
}
return
Result
.
successResult
();
}
...
...
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
View file @
2518a525
...
...
@@ -10,7 +10,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ViolationInfo
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.YearCheckInfoRes
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.
Pos
tMapping
;
import
org.springframework.web.bind.annotation.
Ge
tMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -38,10 +38,10 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/19 10:32
*/
@
Pos
tMapping
(
"yearCheckInfo"
)
@
Ge
tMapping
(
"yearCheckInfo"
)
public
Result
<
YearCheckInfoRes
>
yearCheckInfo
(
@RequestBody
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
,
"鉴权失败"
);
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
);
}
return
service
.
yearCheckInfo
(
query
);
}
...
...
@@ -54,10 +54,10 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/19 16:28
*/
@
Pos
tMapping
(
"violationInfo"
)
@
Ge
tMapping
(
"violationInfo"
)
public
Result
<
ViolationInfoRes
>
violationInfo
(
@RequestBody
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
,
"鉴权失败"
);
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
);
}
return
service
.
violationInfo
(
query
);
}
...
...
@@ -69,10 +69,10 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/19 16:28
*/
@
Pos
tMapping
(
"insuranceInfo"
)
@
Ge
tMapping
(
"insuranceInfo"
)
public
Result
<
InsuranceInfoRes
>
insuranceInfo
(
@RequestBody
BindInfoQuery
query
){
if
(
query
==
null
)
{
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
,
"鉴权失败"
);
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
);
}
return
service
.
insuranceInfo
(
query
);
}
...
...
@@ -85,10 +85,10 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/19 16:28
*/
@
Pos
tMapping
(
"drivingLicenseInfo"
)
@
Ge
tMapping
(
"drivingLicenseInfo"
)
public
Result
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
@RequestBody
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
,
"鉴权失败"
);
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
);
}
return
service
.
drivingLicenseInfo
(
query
);
}
...
...
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
2518a525
...
...
@@ -59,7 +59,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
boundQuery
.
eq
(
"user_id"
,
info
.
getUserId
());
Integer
bound
=
mapper
.
selectCount
(
boundQuery
);
if
(
bound
>=
3
)
{
return
Result
.
errorResult
(
ResultCode
.
SERVICE_ERROR
,
"您的绑定名额已用完!"
);
return
Result
.
errorResult
(
ResultCode
.
SERVICE_ERROR
);
}
//规则2:客户手机号与车辆对应的车主手机号一致
...
...
@@ -72,16 +72,16 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
}
}
if
(
info
.
getPlateType
()==
null
||
info
.
getPlateType
().
equals
(
""
)){
return
Result
.
errorResult
(
ResultCode
.
DATA_ERROR
,
"您提交的手机号与备案信息不符!"
);
return
Result
.
errorResult
(
ResultCode
.
DATA_ERROR
);
}
return
mapper
.
insert
(
info
)>
0
?
Result
.
successResult
(
info
.
getUnqId
()):
Result
.
errorResult
(
"绑定失败!"
);
return
mapper
.
insert
(
info
)>
0
?
Result
.
successResult
(
info
.
getUnqId
()):
Result
.
errorResult
();
}
@Override
public
Result
<
YearCheckInfoRes
>
yearCheckInfo
(
BindInfoQuery
query
)
{
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
())){
return
Result
.
errorResult
(
ResultCode
.
DATA_ERROR
,
"车辆绑定信息不存在,或已过期!"
);
return
Result
.
errorResult
(
ResultCode
.
DATA_ERROR
);
}
return
null
;
}
...
...
@@ -90,7 +90,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
public
Result
<
InsuranceInfoRes
>
insuranceInfo
(
BindInfoQuery
query
)
{
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
())){
return
Result
.
errorResult
(
ResultCode
.
DATA_ERROR
,
"车辆绑定信息不存在,或已过期!"
);
return
Result
.
errorResult
(
ResultCode
.
DATA_ERROR
);
}
return
null
;
}
...
...
@@ -100,7 +100,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
public
Result
<
ViolationInfoRes
>
violationInfo
(
BindInfoQuery
query
)
{
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
())){
return
Result
.
errorResult
(
ResultCode
.
DATA_ERROR
,
"车辆绑定信息不存在,或已过期!"
);
return
Result
.
errorResult
(
ResultCode
.
DATA_ERROR
);
}
ViolationPlateNumAndTypeQueryReq
req
=
new
ViolationPlateNumAndTypeQueryReq
();
...
...
@@ -114,7 +114,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
public
Result
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
BindInfoQuery
query
)
{
BindInfo
bindInfo
=
mapper
.
selectById
(
query
.
getUnqId
());
if
(
bindInfo
==
null
||
"0"
.
equals
(
bindInfo
.
getStatus
())){
return
Result
.
errorResult
(
ResultCode
.
DATA_ERROR
,
"车辆绑定信息不存在,或已过期!"
);
return
Result
.
errorResult
(
ResultCode
.
DATA_ERROR
);
}
return
null
;
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/Result.java
View file @
2518a525
...
...
@@ -17,7 +17,6 @@ public class Result<T> {
private
boolean
success
;
private
String
msg
;
private
String
code
;
private
String
codeMean
;
private
T
data
;
public
static
<
T
>
Result
<
T
>
createResult
(
boolean
isSuccess
,
String
mes
,
T
data
,
String
code
)
{
...
...
@@ -33,13 +32,10 @@ public class Result<T> {
return
result
;
}
public
static
<
T
>
Result
<
T
>
createResult
(
ResultCode
code
,
String
mes
,
T
data
)
{
public
static
<
T
>
Result
<
T
>
createResult
(
ResultCode
code
,
T
data
)
{
Result
<
T
>
result
=
new
Result
<
T
>();
if
(
code
.
getMean
()
!=
null
&&
!
code
.
getMean
().
isEmpty
())
{
result
.
setCodeMean
(
code
.
getMean
());
}
if
(
mes
!=
null
&&
!
mes
.
isEmpty
())
{
result
.
setMsg
(
mes
);
if
(
code
.
getMsg
()
!=
null
&&
!
code
.
getMsg
().
isEmpty
())
{
result
.
setMsg
(
code
.
getMsg
());
}
if
(
data
!=
null
)
{
...
...
@@ -52,37 +48,28 @@ public class Result<T> {
public
static
<
T
>
Result
<
T
>
successResult
()
{
return
createResult
(
ResultCode
.
SUCCESS
,
null
,
null
);
return
createResult
(
ResultCode
.
SUCCESS
,
null
);
}
public
static
<
T
>
Result
<
T
>
successResult
(
T
data
)
{
return
createResult
(
ResultCode
.
SUCCESS
,
null
,
data
);
}
public
static
<
T
>
Result
<
T
>
successResult
(
String
msg
,
T
data
)
{
return
createResult
(
ResultCode
.
SUCCESS
,
msg
,
data
);
return
createResult
(
ResultCode
.
SUCCESS
,
data
);
}
public
static
<
T
>
Result
<
T
>
errorResult
()
{
return
createResult
(
ResultCode
.
SYSTEM_UNKNOWN_ERROR
,
null
,
null
);
return
createResult
(
ResultCode
.
SYSTEM_UNKNOWN_ERROR
,
null
);
}
public
static
<
T
>
Result
<
T
>
errorResult
(
T
data
)
{
return
createResult
(
ResultCode
.
SYSTEM_UNKNOWN_ERROR
,
null
,
data
);
}
public
static
<
T
>
Result
<
T
>
errorResult
(
String
msg
)
{
return
createResult
(
ResultCode
.
SYSTEM_UNKNOWN_ERROR
,
msg
,
null
);
return
createResult
(
ResultCode
.
SYSTEM_UNKNOWN_ERROR
,
data
);
}
public
static
<
T
>
Result
<
T
>
errorResult
(
ResultCode
code
)
{
return
createResult
(
code
,
null
,
null
);
return
createResult
(
code
,
null
);
}
public
static
<
T
>
Result
<
T
>
errorResult
(
ResultCode
code
,
String
msg
)
{
return
createResult
(
code
,
msg
,
null
);
}
public
static
<
T
>
Result
<
T
>
errorResult
(
ResultCode
code
,
T
data
)
{
return
createResult
(
code
,
null
,
data
);
return
createResult
(
code
,
data
);
}
...
...
@@ -90,14 +77,6 @@ public class Result<T> {
return
this
.
failFast
(
this
.
code
,
this
.
msg
);
}
public
Result
<
T
>
failFastWithCode
(
String
msg
)
{
return
this
.
failFast
(
this
.
code
,
msg
);
}
public
Result
<
T
>
failFastWithMessage
(
String
code
)
{
return
this
.
failFast
(
code
,
this
.
msg
);
}
public
Result
<
T
>
failFast
(
String
code
,
String
msg
)
{
if
(!
this
.
success
)
{
RuntimeException
ex
=
new
RuntimeException
(
code
+
":"
+
msg
);
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/enums/ResultCode.java
View file @
2518a525
...
...
@@ -18,12 +18,12 @@ public enum ResultCode {
SERVICE_ERROR
(
"1006"
,
"业务错误"
,
false
);
private
String
code
;
private
String
m
ean
;
private
String
m
sg
;
private
boolean
success
;
ResultCode
(
String
code
,
String
m
ean
,
boolean
success
)
{
ResultCode
(
String
code
,
String
m
sg
,
boolean
success
)
{
this
.
code
=
code
;
this
.
m
ean
=
mean
;
this
.
m
sg
=
msg
;
this
.
success
=
success
;
}
...
...
@@ -31,8 +31,8 @@ public enum ResultCode {
return
this
.
code
;
}
public
String
getM
ean
()
{
return
m
ean
;
public
String
getM
sg
()
{
return
m
sg
;
}
public
boolean
isSuccess
()
{
...
...
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