Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
ab0ec175
Commit
ab0ec175
authored
Nov 07, 2019
by
杨锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code review modify。
parent
7dc7cfff
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
45 deletions
+31
-45
ModifyPhoneNoController.java
...yqb/controller/modifyphoneno/ModifyPhoneNoController.java
+1
-4
AuditReq.java
...uantgroup/xyqb/controller/modifyphoneno/req/AuditReq.java
+1
-1
ModifyPhoneNoQueryReq.java
...b/controller/modifyphoneno/req/ModifyPhoneNoQueryReq.java
+2
-2
Step1Req.java
...uantgroup/xyqb/controller/modifyphoneno/req/Step1Req.java
+2
-0
Page.java
src/main/java/cn/quantgroup/xyqb/controller/req/Page.java
+0
-2
IUserRepository.java
...n/java/cn/quantgroup/xyqb/repository/IUserRepository.java
+0
-2
ModifyPhoneNoServiceImpl.java
...roup/xyqb/service/user/impl/ModifyPhoneNoServiceImpl.java
+20
-10
DateUtils.java
src/main/java/cn/quantgroup/xyqb/util/DateUtils.java
+5
-24
No files found.
src/main/java/cn/quantgroup/xyqb/controller/modifyphoneno/ModifyPhoneNoController.java
View file @
ab0ec175
...
@@ -57,10 +57,7 @@ public class ModifyPhoneNoController implements IBaseController {
...
@@ -57,10 +57,7 @@ public class ModifyPhoneNoController implements IBaseController {
*/
*/
@ApiOperation
(
"app - 申请修改手机号Step_1"
)
@ApiOperation
(
"app - 申请修改手机号Step_1"
)
@PostMapping
(
"/step_1"
)
@PostMapping
(
"/step_1"
)
public
JsonResult
step1
(
@Valid
@RequestBody
Step1Req
step1Req
)
throws
ParseException
{
public
JsonResult
step1
(
@Valid
@RequestBody
Step1Req
step1Req
)
{
if
(!
iIdCardService
.
isIdCardValid
(
step1Req
.
getIdCard
()))
{
throw
new
DataException
(
"身份证件号格式错误"
);
}
User
user
=
getCurrentUserFromRedis
();
User
user
=
getCurrentUserFromRedis
();
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"系统错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"系统错误"
,
null
);
...
...
src/main/java/cn/quantgroup/xyqb/controller/modifyphoneno/req/AuditReq.java
View file @
ab0ec175
...
@@ -19,7 +19,7 @@ public class AuditReq implements Serializable {
...
@@ -19,7 +19,7 @@ public class AuditReq implements Serializable {
private
static
final
long
serialVersionUID
=
9183603336718659105L
;
private
static
final
long
serialVersionUID
=
9183603336718659105L
;
@NotNull
(
message
=
"id不能为空"
)
@NotNull
(
message
=
"id不能为空"
)
private
Long
id
;
private
Long
id
;
@ApiModelProperty
(
"申请状态
DONE 通过; NO_ALLOW
不通过;"
)
@ApiModelProperty
(
"申请状态
1 通过; 2
不通过;"
)
@NotNull
(
message
=
"申请状态不能为空"
)
@NotNull
(
message
=
"申请状态不能为空"
)
private
ModifyPhoneNoApplyStatusEnum
applyStatus
;
private
ModifyPhoneNoApplyStatusEnum
applyStatus
;
@ApiModelProperty
(
"申请状态补充原因"
)
@ApiModelProperty
(
"申请状态补充原因"
)
...
...
src/main/java/cn/quantgroup/xyqb/controller/modifyphoneno/req/ModifyPhoneNoQueryReq.java
View file @
ab0ec175
...
@@ -39,12 +39,12 @@ public class ModifyPhoneNoQueryReq extends Page implements Serializable {
...
@@ -39,12 +39,12 @@ public class ModifyPhoneNoQueryReq extends Page implements Serializable {
/**
/**
* 申请状态 0处理中; 1修改完成; 2不允许修改;
* 申请状态 0处理中; 1修改完成; 2不允许修改;
*/
*/
@ApiModelProperty
(
"申请状态
INIT 处理中; DONE 修改完成; NO_ALLOW
不允许修改;"
)
@ApiModelProperty
(
"申请状态
0 处理中; 1 修改完成; 2
不允许修改;"
)
private
ModifyPhoneNoApplyStatusEnum
applyStatus
;
private
ModifyPhoneNoApplyStatusEnum
applyStatus
;
/**
/**
* 处理状态 0待人工处理 1待用户反馈结果 2已反馈
* 处理状态 0待人工处理 1待用户反馈结果 2已反馈
*/
*/
@ApiModelProperty
(
"处理状态
INIT 待人工处理; WAIT_4_USER_FEEDBACK 待用户反馈结果; DONE
已反馈;"
)
@ApiModelProperty
(
"处理状态
0 待人工处理; 1 待用户反馈结果; 2
已反馈;"
)
private
ModifyPhoneNoProcessingStatusEnum
processingStatus
;
private
ModifyPhoneNoProcessingStatusEnum
processingStatus
;
}
}
src/main/java/cn/quantgroup/xyqb/controller/modifyphoneno/req/Step1Req.java
View file @
ab0ec175
...
@@ -2,6 +2,7 @@ package cn.quantgroup.xyqb.controller.modifyphoneno.req;
...
@@ -2,6 +2,7 @@ package cn.quantgroup.xyqb.controller.modifyphoneno.req;
import
cn.quantgroup.xyqb.entity.ModifyPhoneNo
;
import
cn.quantgroup.xyqb.entity.ModifyPhoneNo
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.validator.IdCard
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.Length
;
...
@@ -35,6 +36,7 @@ public class Step1Req implements Serializable {
...
@@ -35,6 +36,7 @@ public class Step1Req implements Serializable {
*/
*/
@ApiModelProperty
(
"注册人身份证件号"
)
@ApiModelProperty
(
"注册人身份证件号"
)
@NotBlank
(
message
=
"注册人身份证件号不能为空"
)
@NotBlank
(
message
=
"注册人身份证件号不能为空"
)
@IdCard
private
String
idCard
;
private
String
idCard
;
/**
/**
...
...
src/main/java/cn/quantgroup/xyqb/controller/req/Page.java
View file @
ab0ec175
...
@@ -4,8 +4,6 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -4,8 +4,6 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Range
;
import
org.hibernate.validator.constraints.Range
;
import
javax.validation.constraints.NotNull
;
/**
/**
* common page
* common page
* <p>
* <p>
...
...
src/main/java/cn/quantgroup/xyqb/repository/IUserRepository.java
View file @
ab0ec175
...
@@ -17,8 +17,6 @@ public interface IUserRepository extends JpaRepository<User, Long>, JpaSpecifica
...
@@ -17,8 +17,6 @@ public interface IUserRepository extends JpaRepository<User, Long>, JpaSpecifica
User
findByPhoneNo
(
String
phoneNo
);
User
findByPhoneNo
(
String
phoneNo
);
User
findFirstByPhoneNo
(
String
phoneNo
);
User
findByUuid
(
String
uuid
);
User
findByUuid
(
String
uuid
);
/**
/**
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/ModifyPhoneNoServiceImpl.java
View file @
ab0ec175
...
@@ -76,7 +76,7 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
...
@@ -76,7 +76,7 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
@AccessLimit
(
redisKey
=
"saveStep1"
)
@AccessLimit
(
redisKey
=
"saveStep1"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Long
saveStep1
(
Long
userId
,
Step1Req
step1Req
)
{
public
Long
saveStep1
(
Long
userId
,
Step1Req
step1Req
)
{
allowModify
(
userId
,
step1Req
.
getName
(),
step1Req
.
getIdCard
(),
step1Req
.
getPrevPhoneNo
(),
step1Req
.
getCurPhoneNo
(),
allowModify
4Step1
(
userId
,
step1Req
.
getName
(),
step1Req
.
getIdCard
(),
step1Req
.
getPrevPhoneNo
(),
step1Req
.
getCurPhoneNo
(),
step1Req
.
getSmsCode
());
step1Req
.
getSmsCode
());
ModifyPhoneNo
modifyPhoneNo
=
Step1Req
.
adapt
(
step1Req
);
ModifyPhoneNo
modifyPhoneNo
=
Step1Req
.
adapt
(
step1Req
);
modifyPhoneNo
.
setUserId
(
userId
);
modifyPhoneNo
.
setUserId
(
userId
);
...
@@ -195,7 +195,7 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
...
@@ -195,7 +195,7 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
modifyPhoneNo
.
setApplyStatusReason
(
auditReq
.
getApplyStatusReason
());
modifyPhoneNo
.
setApplyStatusReason
(
auditReq
.
getApplyStatusReason
());
}
}
if
(
ModifyPhoneNoApplyStatusEnum
.
DONE
==
auditReq
.
getApplyStatus
())
{
if
(
ModifyPhoneNoApplyStatusEnum
.
DONE
==
auditReq
.
getApplyStatus
())
{
allowModify
Http
(
modifyPhoneNo
.
getUserId
(),
modifyPhoneNo
.
getName
(),
modifyPhoneNo
.
getIdCard
(),
allowModify
4Audit
(
modifyPhoneNo
.
getUserId
(),
modifyPhoneNo
.
getName
(),
modifyPhoneNo
.
getIdCard
(),
modifyPhoneNo
.
getPrevPhoneNo
(),
modifyPhoneNo
.
getCurPhoneNo
());
modifyPhoneNo
.
getPrevPhoneNo
(),
modifyPhoneNo
.
getCurPhoneNo
());
userService
.
modifyPhoneNo
(
modifyPhoneNo
.
getPrevPhoneNo
(),
modifyPhoneNo
.
getCurPhoneNo
());
userService
.
modifyPhoneNo
(
modifyPhoneNo
.
getPrevPhoneNo
(),
modifyPhoneNo
.
getCurPhoneNo
());
modifyPhoneNo
.
setApplyStatus
(
ModifyPhoneNoApplyStatusEnum
.
DONE
.
getType
());
modifyPhoneNo
.
setApplyStatus
(
ModifyPhoneNoApplyStatusEnum
.
DONE
.
getType
());
...
@@ -219,33 +219,43 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
...
@@ -219,33 +219,43 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
* @param smsCode 新手机号码短信验证码
* @param smsCode 新手机号码短信验证码
* @return
* @return
*/
*/
public
void
allowModify
(
Long
userId
,
String
name
,
String
idCard
,
String
prevPhoneNo
,
String
curPhoneNo
,
String
smsCode
)
{
public
void
allowModify
4Step1
(
Long
userId
,
String
name
,
String
idCard
,
String
prevPhoneNo
,
String
curPhoneNo
,
String
smsCode
)
{
if
(
modifyPhoneNoRepository
.
findFirstByUserIdAndApplyStatus
(
userId
,
ModifyPhoneNoProcessingStatusEnum
.
INIT
.
getType
())
!=
null
)
{
if
(
modifyPhoneNoRepository
.
findFirstByUserIdAndApplyStatus
(
userId
,
ModifyPhoneNoProcessingStatusEnum
.
INIT
.
getType
())
!=
null
)
{
throw
new
DataException
(
"已存在处理中的申请单,不支持再次更换。"
);
throw
new
DataException
(
"已存在处理中的申请单,不支持再次更换。"
);
}
}
if
(!
smsService
.
verifyPhoneAndCode
(
curPhoneNo
,
smsCode
))
{
if
(!
smsService
.
verifyPhoneAndCode
(
curPhoneNo
,
smsCode
))
{
throw
new
DataException
(
"验证码不正确。"
);
throw
new
DataException
(
"验证码不正确。"
);
}
}
allowModify
Http
(
userId
,
name
,
idCard
,
prevPhoneNo
,
curPhoneNo
);
allowModify
4Audit
(
userId
,
name
,
idCard
,
prevPhoneNo
,
curPhoneNo
);
}
}
/**
/**
* @param userId user.id
* @param userId user.id
*/
*/
public
void
allowModify
Http
(
Long
userId
,
String
name
,
String
idCard
,
String
prevPhoneNo
,
String
curPhoneNo
)
{
public
void
allowModify
4Audit
(
Long
userId
,
String
name
,
String
idCard
,
String
prevPhoneNo
,
String
curPhoneNo
)
{
if
(
userDetailRepository
.
findByUserIdAndPhoneNoAndNameAndIdNo
(
userId
,
prevPhoneNo
,
name
,
idCard
)
==
null
)
{
if
(
userDetailRepository
.
findByUserIdAndPhoneNoAndNameAndIdNo
(
userId
,
prevPhoneNo
,
name
,
idCard
)
==
null
)
{
throw
new
DataException
(
"信息填写有误,请重新填写。"
);
throw
new
DataException
(
"信息填写有误,请重新填写。"
);
}
}
if
(
userRepository
.
find
First
ByPhoneNo
(
curPhoneNo
)
!=
null
)
{
if
(
userRepository
.
findByPhoneNo
(
curPhoneNo
)
!=
null
)
{
throw
new
DataException
(
"信息填写有误,请重新填写。"
);
throw
new
DataException
(
"信息填写有误,请重新填写。"
);
}
}
log
.
info
(
"allowModify userId = 【{}】"
,
userId
);
log
.
info
(
"allowModify userId = 【{}】"
,
userId
);
String
res
=
httpService
.
get
(
apiHttps
+
"?userId="
+
userId
);
String
res
=
httpService
.
get
(
apiHttps
+
"?userId="
+
userId
);
log
.
info
(
"allowModify res = 【{}】"
,
res
);
log
.
info
(
"allowModify res = 【{}】"
,
res
);
if
(
StringUtils
.
isNotBlank
(
res
))
{
if
(
StringUtils
.
isBlank
(
res
))
{
UserLoanStatusResp
userLoanStatusResp
=
JSONObject
.
parseObject
(
res
,
UserLoanStatusResp
.
class
);
throw
new
DataException
(
"系统内部错误。"
);
if
(!
userLoanStatusResp
.
isSuccess
()
||
!
userLoanStatusResp
.
isData
())
{
}
else
{
throw
new
DataException
(
"用户存在订单,不支持修改。"
);
try
{
UserLoanStatusResp
userLoanStatusResp
=
JSONObject
.
parseObject
(
res
,
UserLoanStatusResp
.
class
);
if
(
userLoanStatusResp
==
null
)
{
throw
new
DataException
(
"系统内部错误。"
);
}
if
(!
userLoanStatusResp
.
isSuccess
()
||
!
userLoanStatusResp
.
isData
())
{
throw
new
DataException
(
"用户存在订单,不支持修改。"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"allowModify4Audit e = 【{}】"
,
e
);
throw
new
DataException
(
"系统内部错误。"
);
}
}
}
}
}
}
...
...
src/main/java/cn/quantgroup/xyqb/util/DateUtils.java
View file @
ab0ec175
...
@@ -19,32 +19,17 @@ import java.util.Date;
...
@@ -19,32 +19,17 @@ import java.util.Date;
*/
*/
public
class
DateUtils
{
public
class
DateUtils
{
public
static
final
String
STANDARD_FORMAT
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
final
String
YMD_FORMAT
=
"yyyy-MM-dd"
;
public
static
final
String
YMD_FORMAT
=
"yyyy-MM-dd"
;
public
static
Date
strToDate
(
String
dateTimeStr
,
String
formatStr
)
{
DateTimeFormatter
dateTimeFormatter
=
DateTimeFormat
.
forPattern
(
formatStr
);
DateTime
dateTime
=
dateTimeFormatter
.
parseDateTime
(
dateTimeStr
);
return
dateTime
.
toDate
();
}
/**
/**
* yyyy-MM-dd -> yyyy-MM-dd HH:mm:ss => yyyy-MM-dd 00:00:00
* @param dateTimeStr
*
* @param date
* @param formatStr
* @param formatStr
* @return
* @return
*/
*/
public
static
String
dateToStr
(
Date
date
,
String
formatStr
)
{
public
static
Date
strToDate
(
String
dateTimeStr
,
String
formatStr
)
{
if
(
date
==
null
)
{
DateTimeFormatter
dateTimeFormatter
=
DateTimeFormat
.
forPattern
(
formatStr
);
return
StringUtils
.
EMPTY
;
DateTime
dateTime
=
dateTimeFormatter
.
parseDateTime
(
dateTimeStr
);
}
return
dateTime
.
toDate
();
DateTime
dateTime
=
new
DateTime
(
date
);
return
dateTime
.
toString
(
formatStr
);
}
public
static
int
daysBetween
(
DateTime
fromDate
,
DateTime
toDate
)
{
return
Days
.
daysBetween
(
fromDate
,
toDate
).
getDays
();
}
}
/**
/**
...
@@ -63,8 +48,4 @@ public class DateUtils {
...
@@ -63,8 +48,4 @@ public class DateUtils {
long
now
=
System
.
currentTimeMillis
();
long
now
=
System
.
currentTimeMillis
();
return
(
timeStamp
-
now
)
/
1000
;
return
(
timeStamp
-
now
)
/
1000
;
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
dateToStr
(
strToDate
(
"2019-11-06"
,
DateUtils
.
YMD_FORMAT
),
"yyyy-MM-dd HH:mm:ss"
));
}
}
}
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