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
3b53e691
Commit
3b53e691
authored
Jun 21, 2020
by
lixian7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整接口返回体
parent
41e07450
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
145 additions
and
33 deletions
+145
-33
api/pom.xml
+6
-0
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/ApiApplication.java
+2
-0
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
+33
-26
infra/pom.xml
+6
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/SmsFeign.java
+5
-4
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/param/request/CheckVerifyCodeMicReq.java
+0
-1
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/param/request/SendVerifyCodeMicReq.java
+0
-1
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/BindInfoQuery.java
+0
-1
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/request/CheckVerifyCodeReq.java
+35
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/request/SendVerifyCodeReq.java
+29
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/response/CheckValidityRes.java
+29
-0
No files found.
api/pom.xml
View file @
3b53e691
...
...
@@ -44,6 +44,12 @@
<artifactId>
sdk
</artifactId>
<version>
${parent.version}
</version>
</dependency>
<dependency>
<groupId>
com.hikcreate.common
</groupId>
<artifactId>
orika
</artifactId>
<version>
${parent.version}
</version>
</dependency>
</dependencies>
<profiles>
...
...
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/ApiApplication.java
View file @
3b53e691
...
...
@@ -9,6 +9,7 @@ import org.springframework.cache.annotation.EnableCaching;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.ComponentScan
;
@SpringBootApplication
(
scanBasePackages
=
"com.hikcreate.edl.pub.web.mobile"
,
exclude
=
DruidDataSourceAutoConfigure
.
class
)
...
...
@@ -18,6 +19,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableEurekaClient
@EnableApolloConfig
@EnableCaching
@ComponentScan
(
"com.hikcreate"
)
public
class
ApiApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/H5Controller.java
View file @
3b53e691
...
...
@@ -2,6 +2,7 @@ package com.hikcreate.edl.pub.web.mobile.api.controller;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
com.hikcreate.common.orika.DefaultConverter
;
import
com.hikcreate.common.sdk.response.apiparam.Response
;
import
com.hikcreate.common.sdk.response.apiparam.ResponseGenerator
;
import
com.hikcreate.common.sdk.response.statuscode.StatusCode
;
...
...
@@ -15,15 +16,12 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.par
import
com.hikcreate.edl.pub.web.mobile.infra.data.mapper.VerifyInfoMapper
;
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.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.ViolationInfoRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.YearCheckInfoRes
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.CheckVerifyCodeReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.request.SendVerifyCodeReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.*
;
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
;
...
...
@@ -50,6 +48,8 @@ public class H5Controller {
VerifyInfoMapper
verifyInfoMapper
;
@Resource
SmsFeign
smsFeign
;
@Autowired
DefaultConverter
defaultConverter
;
/**
* 年检信息查询接口
...
...
@@ -59,7 +59,7 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/19 10:32
*/
@
Ge
tMapping
(
"yearCheckInfo"
)
@
Pos
tMapping
(
"yearCheckInfo"
)
public
Response
<
YearCheckInfoRes
>
yearCheckInfo
(
@RequestBody
@Validated
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
);
...
...
@@ -75,7 +75,7 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/19 16:28
*/
@
Ge
tMapping
(
"violationInfo"
)
@
Pos
tMapping
(
"violationInfo"
)
public
Response
<
ResultList
<
ViolationInfoRes
>>
violationInfo
(
@RequestBody
@Validated
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
);
...
...
@@ -91,7 +91,7 @@ public class H5Controller {
* @author: xsx
* @date: 2020/6/19 16:28
*/
@
Ge
tMapping
(
"insuranceInfo"
)
@
Pos
tMapping
(
"insuranceInfo"
)
public
Response
<
InsuranceInfoRes
>
insuranceInfo
(
@RequestBody
@Validated
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
);
...
...
@@ -101,14 +101,15 @@ public class H5Controller {
/**
* 驾照信息查询接口
* header或body传值
*
* @param query
* @return Result
* @author: xsx
* @date: 2020/6/19 16:28
*/
@
Ge
tMapping
(
"drivingLicenseInfo"
)
public
Response
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
@RequestBody
BindInfoQuery
query
)
{
@
Pos
tMapping
(
"drivingLicenseInfo"
)
public
Response
<
DrivingLicenseInfoRes
>
drivingLicenseInfo
(
@RequestBody
@Validated
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
);
}
...
...
@@ -120,24 +121,22 @@ public class H5Controller {
* @param query
* @return
*/
@
Ge
tMapping
(
"checkValidity"
)
public
Response
checkValidity
(
@RequestBody
BindInfoQuery
query
)
{
@
Pos
tMapping
(
"checkValidity"
)
public
Response
<
CheckValidityRes
>
checkValidity
(
@RequestBody
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
);
}
VerifyInfo
verifyInfo
=
verifyInfoMapper
.
checkValidity
(
query
.
getPhone
(),
query
.
getUserId
(),
DateUtil
.
offsetDay
(
DateTime
.
now
(),
-
10
));
CheckValidityRes
checkValidityRes
=
new
CheckValidityRes
();
defaultConverter
.
getMapperFacade
().
map
(
query
,
checkValidityRes
);
if
(
verifyInfo
!=
null
)
{
return
ResponseGenerator
.
success
(
);
checkValidityRes
.
setIsChecked
(
1
);
}
else
{
SendVerifyCodeMicReq
sendVerifyCodeMicReq
=
new
SendVerifyCodeMicReq
();
sendVerifyCodeMicReq
.
setUserId
(
query
.
getUserId
());
sendVerifyCodeMicReq
.
setPhone
(
query
.
getPhone
());
sendVerifyCodeMicReq
.
setVerifyCode
(
VerifyCodeUtil
.
getCode
());
return
ResponseGenerator
.
fail
(
StatusCode
.
PERMISSION_DENIED
.
getCode
(),
null
,
sendVerifyCodeMicReq
);
checkValidityRes
.
setIsChecked
(
0
);
}
return
ResponseGenerator
.
success
(
checkValidityRes
);
}
/***
...
...
@@ -149,11 +148,15 @@ public class H5Controller {
* @date: 2020/6/21 13:57
*/
@PostMapping
(
"sendVerifyCode"
)
public
Response
sendVerifyCode
(
@RequestBody
SendVerifyCodeMic
Req
req
)
{
public
Response
<
Void
>
sendVerifyCode
(
@RequestBody
@Validated
SendVerifyCode
Req
req
)
{
if
(
req
==
null
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
);
}
return
ResponseGenerator
.
success
(
smsFeign
.
sendVerifyCode
(
req
));
SendVerifyCodeMicReq
micReq
=
new
SendVerifyCodeMicReq
();
micReq
.
setPhone
(
req
.
getPhone
());
micReq
.
setVerifyCode
(
VerifyCodeUtil
.
getCode
());
micReq
.
setTemplateCode
(
"PARK_LOOK_DRIVER_LICENSE"
);
return
smsFeign
.
sendVerifyCode
(
micReq
);
}
/**
...
...
@@ -165,13 +168,17 @@ public class H5Controller {
* @date: 2020/6/21 13:58
*/
@PostMapping
(
"checkVerifyCode"
)
public
Response
sendVerifyCode
(
@RequestBody
CheckVerifyCodeMic
Req
req
)
{
public
Response
<
Void
>
sendVerifyCode
(
@RequestBody
@Validated
CheckVerifyCode
Req
req
)
{
if
(
req
==
null
)
{
return
ResponseGenerator
.
fail
(
StatusCode
.
PARAM_ERROR
);
}
CheckVerifyCodeMicReq
micReq
=
new
CheckVerifyCodeMicReq
();
micReq
.
setPhone
(
req
.
getPhone
());
micReq
.
setVerifyCode
(
req
.
getVerifyCode
());
micReq
.
setTemplateCode
(
"PARK_LOOK_DRIVER_LICENSE"
);
Res
ult
<
Void
>
checkResult
=
smsFeign
.
checkVerifyCode
(
r
eq
);
if
(
ResultCode
.
SUCCESS
.
getCode
().
equals
(
checkResult
.
getCode
()))
{
Res
ponse
<
Void
>
checkResult
=
smsFeign
.
checkVerifyCode
(
micR
eq
);
if
(
StatusCode
.
SUCCESS
.
getCode
()
==
(
checkResult
.
getCode
()))
{
VerifyInfo
verifyInfo
=
new
VerifyInfo
();
verifyInfo
.
setUserId
(
req
.
getUserId
());
verifyInfo
.
setVerifyCode
(
req
.
getVerifyCode
());
...
...
@@ -179,7 +186,7 @@ public class H5Controller {
verifyInfo
.
setPassTime
(
DateTime
.
now
().
toString
());
verifyInfoMapper
.
insert
(
verifyInfo
);
}
return
ResponseGenerator
.
success
(
checkResult
)
;
return
checkResult
;
}
...
...
infra/pom.xml
View file @
3b53e691
...
...
@@ -74,6 +74,12 @@
<groupId>
javax.validation
</groupId>
<artifactId>
validation-api
</artifactId>
</dependency>
<dependency>
<groupId>
com.hikcreate.edl.common
</groupId>
<artifactId>
sdk
</artifactId>
<version>
${parent.version}
</version>
</dependency>
</dependencies>
</project>
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/SmsFeign.java
View file @
3b53e691
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
feign
.
edl_pub_service_sms
;
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.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.SendMicReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.SendVerifyCodeMicReq
;
...
...
@@ -15,11 +15,11 @@ import org.springframework.web.bind.annotation.RequestBody;
public
interface
SmsFeign
{
@PostMapping
(
{
"send"
}
)
Res
ult
<
Void
>
send
(
@RequestBody
SendMicReq
req
);
Res
ponse
<
Void
>
send
(
@RequestBody
SendMicReq
req
);
@PostMapping
(
{
"verifyCode/send"
}
)
Res
ult
<
Void
>
sendVerifyCode
(
@RequestBody
SendVerifyCodeMicReq
req
);
Res
ponse
<
Void
>
sendVerifyCode
(
@RequestBody
SendVerifyCodeMicReq
req
);
@PostMapping
(
{
"verifyCode/check"
}
)
Res
ult
<
Void
>
checkVerifyCode
(
@RequestBody
CheckVerifyCodeMicReq
req
);
Res
ponse
<
Void
>
checkVerifyCode
(
@RequestBody
CheckVerifyCodeMicReq
req
);
}
\ No newline at end of file
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/param/request/CheckVerifyCodeMicReq.java
View file @
3b53e691
...
...
@@ -6,7 +6,6 @@ import lombok.experimental.Accessors;
@Data
@Accessors
(
chain
=
true
)
public
class
CheckVerifyCodeMicReq
{
private
String
userId
;
//用户ID
private
String
phone
;
// 手机号码
private
String
templateCode
;
// 短信模板编码
private
String
extraKey
;
// 附加的键,主要用于一辆机动车被多个人绑定的场景。
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/param/request/SendVerifyCodeMicReq.java
View file @
3b53e691
...
...
@@ -5,7 +5,6 @@ import lombok.Data;
@Data
public
class
SendVerifyCodeMicReq
{
private
String
userId
;
//用户ID
private
String
phone
;
// 手机号码
private
String
templateCode
;
// 短信模板编码
private
String
extraKey
;
// 附加的键,主要用于一辆机动车被多个人绑定的场景。
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/BindInfoQuery.java
View file @
3b53e691
...
...
@@ -3,7 +3,6 @@ package com.hikcreate.edl.pub.web.mobile.infra.model;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/request/CheckVerifyCodeReq.java
0 → 100644
View file @
3b53e691
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
model
.
param
.
request
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
/**
* @author lixian
* @description
* @date 2020/6/21 14:53
**/
@Data
public
class
CheckVerifyCodeReq
{
/**
* 绑定信息的唯一标识.
*/
@NotBlank
(
message
=
"绑定信息的唯一标识不能为空"
)
private
String
unqId
;
/**
* 查询客户的id
*/
@NotBlank
(
message
=
"客户唯一编码不能为空"
)
private
String
userId
;
/**
* 查询客户的电话号码
*/
@NotBlank
(
message
=
"客户手机号不能为空"
)
private
String
phone
;
/**
* 短信验证码
*/
@NotBlank
(
message
=
"短信验证码不能为空"
)
private
String
verifyCode
;
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/request/SendVerifyCodeReq.java
0 → 100644
View file @
3b53e691
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
model
.
param
.
request
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
/**
* @author lixian
* @description
* @date 2020/6/21 14:46
**/
@Data
public
class
SendVerifyCodeReq
{
/**
* 绑定信息的唯一标识.
*/
@NotBlank
(
message
=
"绑定信息的唯一标识不能为空"
)
private
String
unqId
;
/**
* 查询客户的id
*/
@NotBlank
(
message
=
"客户唯一编码不能为空"
)
private
String
userId
;
/**
* 查询客户的电话号码
*/
@NotBlank
(
message
=
"客户手机号不能为空"
)
private
String
phone
;
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/param/response/CheckValidityRes.java
0 → 100644
View file @
3b53e691
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
model
.
param
.
response
;
import
lombok.Data
;
/**
* 校验返回体
* @author lixian
* @description
* @date 2020/6/21 14:16
**/
@Data
public
class
CheckValidityRes
{
/**
* 是否已校验,0:否,1:是
*/
private
Integer
isChecked
;
/**
* 绑定信息的唯一标识
*/
private
String
unqId
;
/**
* 第三方的客户id
*/
private
String
userId
;
/**
* 查询客户的电话号码
*/
private
String
phone
;
}
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