记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
deba8015
Commit
deba8015
authored
Mar 23, 2022
by
zhengfuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改验证。
parent
f95fa375
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
3 deletions
+52
-3
SmileUserVO.java
...java/com/liquidnet/service/goblin/dto/vo/SmileUserVO.java
+24
-0
SmileUserController.java
...com/liquidnet/service/controller/SmileUserController.java
+28
-3
No files found.
liquidnet-bus-api/liquidnet-service-smile-api/src/main/java/com/liquidnet/service/goblin/dto/vo/SmileUserVO.java
View file @
deba8015
...
@@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModel;
...
@@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.Past
;
import
javax.validation.constraints.Positive
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
@@ -21,6 +24,9 @@ import java.time.LocalDateTime;
...
@@ -21,6 +24,9 @@ import java.time.LocalDateTime;
@ApiModel
(
value
=
"smileUser"
,
description
=
"smile的user"
)
@ApiModel
(
value
=
"smileUser"
,
description
=
"smile的user"
)
@Data
@Data
public
class
SmileUserVO
implements
Serializable
{
public
class
SmileUserVO
implements
Serializable
{
public
interface
saveOne
{}
public
interface
saveTwo
{}
public
interface
saveThree
{}
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -32,12 +38,14 @@ public class SmileUserVO implements Serializable {
...
@@ -32,12 +38,14 @@ public class SmileUserVO implements Serializable {
* 照片
* 照片
*/
*/
@ApiModelProperty
(
value
=
"照片"
)
@ApiModelProperty
(
value
=
"照片"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"照片必传"
)
private
String
img
;
private
String
img
;
/**
/**
* 真实姓名
* 真实姓名
*/
*/
@ApiModelProperty
(
value
=
"真实姓名"
)
@ApiModelProperty
(
value
=
"真实姓名"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"真实姓名必传"
)
private
String
name
;
private
String
name
;
/**
/**
...
@@ -45,66 +53,77 @@ public class SmileUserVO implements Serializable {
...
@@ -45,66 +53,77 @@ public class SmileUserVO implements Serializable {
*/
*/
@ApiModelProperty
(
value
=
"生日(yyyy-MM-dd)"
)
@ApiModelProperty
(
value
=
"生日(yyyy-MM-dd)"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
DateUtil
.
DATE_SMALL_STR
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
DateUtil
.
DATE_SMALL_STR
)
@Past
(
groups
=
{
saveOne
.
class
},
message
=
"生日必传"
)
private
LocalDate
birthday
;
private
LocalDate
birthday
;
/**
/**
* 性别(1:男(默认),2:女)
* 性别(1:男(默认),2:女)
*/
*/
@ApiModelProperty
(
value
=
"性别(1:男(默认),2:女)"
)
@ApiModelProperty
(
value
=
"性别(1:男(默认),2:女)"
)
@Positive
(
groups
=
{
saveOne
.
class
},
message
=
"性别必传"
)
private
Integer
sex
;
private
Integer
sex
;
/**
/**
* 手机号
* 手机号
*/
*/
@ApiModelProperty
(
value
=
"手机号"
)
@ApiModelProperty
(
value
=
"手机号"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"手机必传"
)
private
String
phone
;
private
String
phone
;
/**
/**
* 省key
* 省key
*/
*/
@ApiModelProperty
(
value
=
"省key"
)
@ApiModelProperty
(
value
=
"省key"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"省必传"
)
private
String
provinceId
;
private
String
provinceId
;
/**
/**
* 省
* 省
*/
*/
@ApiModelProperty
(
value
=
"省"
)
@ApiModelProperty
(
value
=
"省"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"省必传"
)
private
String
province
;
private
String
province
;
/**
/**
* 市key
* 市key
*/
*/
@ApiModelProperty
(
value
=
"市key"
)
@ApiModelProperty
(
value
=
"市key"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"市必传"
)
private
String
cityId
;
private
String
cityId
;
/**
/**
* 市
* 市
*/
*/
@ApiModelProperty
(
value
=
"市"
)
@ApiModelProperty
(
value
=
"市"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"市必传"
)
private
String
city
;
private
String
city
;
/**
/**
* 区key
* 区key
*/
*/
@ApiModelProperty
(
value
=
"区key"
)
@ApiModelProperty
(
value
=
"区key"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"区必传"
)
private
String
areaId
;
private
String
areaId
;
/**
/**
* 区
* 区
*/
*/
@ApiModelProperty
(
value
=
"区"
)
@ApiModelProperty
(
value
=
"区"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"区必传"
)
private
String
area
;
private
String
area
;
/**
/**
* 详细地址
* 详细地址
*/
*/
@ApiModelProperty
(
value
=
"详细地址"
)
@ApiModelProperty
(
value
=
"详细地址"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"详细地址必传"
)
private
String
address
;
private
String
address
;
/**
/**
* 微信号
* 微信号
*/
*/
@ApiModelProperty
(
value
=
"微信号"
)
@ApiModelProperty
(
value
=
"微信号"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"微信号必传"
)
private
String
wechat
;
private
String
wechat
;
/**
/**
...
@@ -123,24 +142,28 @@ public class SmileUserVO implements Serializable {
...
@@ -123,24 +142,28 @@ public class SmileUserVO implements Serializable {
* 身份证号
* 身份证号
*/
*/
@ApiModelProperty
(
value
=
"身份证号"
)
@ApiModelProperty
(
value
=
"身份证号"
)
@NotBlank
(
groups
=
{
saveTwo
.
class
},
message
=
"身份证号必传"
)
private
String
idCard
;
private
String
idCard
;
/**
/**
* 学校名称
* 学校名称
*/
*/
@ApiModelProperty
(
value
=
"学校名称"
)
@ApiModelProperty
(
value
=
"学校名称"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"学校名称必传"
)
private
String
schoolName
;
private
String
schoolName
;
/**
/**
* 专业
* 专业
*/
*/
@ApiModelProperty
(
value
=
"专业"
)
@ApiModelProperty
(
value
=
"专业"
)
@NotBlank
(
groups
=
{
saveOne
.
class
},
message
=
"专业必传"
)
private
String
schoolMajor
;
private
String
schoolMajor
;
/**
/**
* 身份(1:在校学生(默认),2已毕业)
* 身份(1:在校学生(默认),2已毕业)
*/
*/
@ApiModelProperty
(
value
=
"身份(1:在校学生(默认),2已毕业)"
)
@ApiModelProperty
(
value
=
"身份(1:在校学生(默认),2已毕业)"
)
@Positive
(
groups
=
{
saveOne
.
class
},
message
=
"身份必传"
)
private
Integer
identity
;
private
Integer
identity
;
/**
/**
...
@@ -159,6 +182,7 @@ public class SmileUserVO implements Serializable {
...
@@ -159,6 +182,7 @@ public class SmileUserVO implements Serializable {
* 自我介绍
* 自我介绍
*/
*/
@ApiModelProperty
(
value
=
"自我介绍"
)
@ApiModelProperty
(
value
=
"自我介绍"
)
@NotBlank
(
groups
=
{
saveThree
.
class
},
message
=
"自我介绍必传"
)
private
String
introduce
;
private
String
introduce
;
/**
/**
...
...
liquidnet-bus-service/liquidnet-service-smile/liquidnet-service-smile-impl/src/main/java/com/liquidnet/service/controller/SmileUserController.java
View file @
deba8015
...
@@ -17,6 +17,10 @@ import io.swagger.annotations.ApiOperation;
...
@@ -17,6 +17,10 @@ import io.swagger.annotations.ApiOperation;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.ObjectError
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
...
@@ -94,7 +98,14 @@ public class SmileUserController {
...
@@ -94,7 +98,14 @@ public class SmileUserController {
//
//
@PostMapping
(
"saveOrUpdateUserOneStep"
)
@PostMapping
(
"saveOrUpdateUserOneStep"
)
@ApiOperation
(
"增加或者删除第一步"
)
@ApiOperation
(
"增加或者删除第一步"
)
public
ResponseDto
saveOrUpdateUserOneStep
(
@RequestBody
SmileUserVO
smileUserVO
)
{
public
ResponseDto
saveOrUpdateUserOneStep
(
@Validated
(
SmileUserVO
.
saveOne
.
class
)
@RequestBody
SmileUserVO
smileUserVO
,
MethodArgumentNotValidException
exception
)
{
BindingResult
result
=
exception
.
getBindingResult
();
if
(
result
.
hasErrors
())
{
List
<
ObjectError
>
errors
=
result
.
getAllErrors
();
if
(
errors
!=
null
)
{
return
ResponseDto
.
failure
(
errors
.
get
(
0
).
getDefaultMessage
());
}
}
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
SmileUserVO
smileUserVORedis
=
(
SmileUserVO
)
redisUtil
.
get
(
SmileRedisConst
.
SMILE_USER
.
concat
(
userId
));
SmileUserVO
smileUserVORedis
=
(
SmileUserVO
)
redisUtil
.
get
(
SmileRedisConst
.
SMILE_USER
.
concat
(
userId
));
smileUserVO
.
setUid
(
userId
);
smileUserVO
.
setUid
(
userId
);
...
@@ -109,7 +120,14 @@ public class SmileUserController {
...
@@ -109,7 +120,14 @@ public class SmileUserController {
@PostMapping
(
"saveOrUpdateUserTwoStep"
)
@PostMapping
(
"saveOrUpdateUserTwoStep"
)
@ApiOperation
(
"增加或者删除第二步"
)
@ApiOperation
(
"增加或者删除第二步"
)
public
ResponseDto
saveOrUpdateUserTwoStep
(
@RequestBody
SmileUserVO
smileUserVO
)
{
public
ResponseDto
saveOrUpdateUserTwoStep
(
@Validated
(
SmileUserVO
.
saveTwo
.
class
)
@RequestBody
SmileUserVO
smileUserVO
,
MethodArgumentNotValidException
exception
)
{
BindingResult
result
=
exception
.
getBindingResult
();
if
(
result
.
hasErrors
())
{
List
<
ObjectError
>
errors
=
result
.
getAllErrors
();
if
(
errors
!=
null
)
{
return
ResponseDto
.
failure
(
errors
.
get
(
0
).
getDefaultMessage
());
}
}
if
(
StringUtil
.
isNotBlank
(
smileUserVO
.
getIdCard
())&&
StringUtil
.
isNotBlank
(
smileUserVO
.
getName
())){
if
(
StringUtil
.
isNotBlank
(
smileUserVO
.
getIdCard
())&&
StringUtil
.
isNotBlank
(
smileUserVO
.
getName
())){
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
if
(
validate
(
smileUserVO
.
getName
(),
smileUserVO
.
getIdCard
(),
userId
)){
if
(
validate
(
smileUserVO
.
getName
(),
smileUserVO
.
getIdCard
(),
userId
)){
...
@@ -152,7 +170,14 @@ public class SmileUserController {
...
@@ -152,7 +170,14 @@ public class SmileUserController {
}
}
@PostMapping
(
"saveOrUpdateUserThreeStep"
)
@PostMapping
(
"saveOrUpdateUserThreeStep"
)
@ApiOperation
(
"增加或者删除第三步"
)
@ApiOperation
(
"增加或者删除第三步"
)
public
ResponseDto
saveOrUpdateUserThreeStep
(
@RequestBody
SmileUserVO
smileUserVO
)
{
public
ResponseDto
saveOrUpdateUserThreeStep
(
@Validated
(
SmileUserVO
.
saveThree
.
class
)
@RequestBody
SmileUserVO
smileUserVO
,
MethodArgumentNotValidException
exception
)
{
BindingResult
result
=
exception
.
getBindingResult
();
if
(
result
.
hasErrors
())
{
List
<
ObjectError
>
errors
=
result
.
getAllErrors
();
if
(
errors
!=
null
)
{
return
ResponseDto
.
failure
(
errors
.
get
(
0
).
getDefaultMessage
());
}
}
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
smileUserVO
.
setUid
(
userId
);
smileUserVO
.
setUid
(
userId
);
SmileUserVO
smileUserVORedis
=
(
SmileUserVO
)
redisUtil
.
get
(
SmileRedisConst
.
SMILE_USER
.
concat
(
userId
));
SmileUserVO
smileUserVORedis
=
(
SmileUserVO
)
redisUtil
.
get
(
SmileRedisConst
.
SMILE_USER
.
concat
(
userId
));
...
...
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