Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
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
8timerv2
8timerapiv200
Commits
cfcb69a0
Commit
cfcb69a0
authored
Apr 07, 2020
by
东州 翁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企业中心在修改密码接口添加了修改原密码的方法,更正验证码code的类型
parent
cfa774c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
83 deletions
+112
-83
src/main/java/cn/timer/api/controller/LoginController.java
+107
-81
src/main/java/cn/timer/api/dto/qyzx/EntRegisterDto.java
+5
-2
No files found.
src/main/java/cn/timer/api/controller/LoginController.java
View file @
cfcb69a0
...
...
@@ -61,8 +61,6 @@ public class LoginController {
@Autowired
private
QyzxEmpEntAssoMapper
qyzxEmpEntAssoMapper
;
// @Autowired
// private DataSourceTransactionManager transactionManager;
...
...
@@ -126,7 +124,7 @@ public class LoginController {
@ApiOperationSupport
(
order
=
2
)
public
Result
<
String
>
authentication
(
@RequestBody
EntRegisterDto
entRegisterDto
)
{
String
phone
=
entRegisterDto
.
getPhone
();
Integer
code
=
entRegisterDto
.
getCode
();
String
code
=
entRegisterDto
.
getCode
();
// String codeRedis = (String) redisTemplate.get(phone);
String
codeRedis
=
(
String
)
session
.
getAttribute
(
phone
);
...
...
@@ -142,33 +140,32 @@ public class LoginController {
* @param qyzxEmpLogin
* @return
* @throws IOException
*/
@PostMapping
(
value
=
"/test"
)
@ApiOperation
(
value
=
"3.测试"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
3
)
public
void
test
(
HttpServletRequest
request
,
HttpServletResponse
res
)
throws
IOException
{
res
.
setHeader
(
"content-type"
,
"text/html;charset=UTF-8"
);
res
.
setHeader
(
"selfHeader"
,
"selfHeaderValue"
);
// res.addHeader("response_code", "123");
// res.setContentType("application/octet-stream");
// res.addHeader("Content-Length", "0");
res
.
addHeader
(
"response_code"
,
"100"
);
res
.
addHeader
(
"trans_id"
,
""
);
res
.
addHeader
(
"cmd_code"
,
"NO com"
);
res
.
setContentType
(
"application/octet-stream"
);
res
.
addHeader
(
"Content-Length"
,
"0"
);
res
.
flushBuffer
();
// response.addHeader("response_code", "ERROR_INVALID_LIB_NAME");
// response.setContentType("application/octet-stream");
// response.addHeader("Content-Length", "0");
// response.flushBuffer();
System
.
out
.
println
(
111
);
}
*//*
* @PostMapping(value = "/test")
*
* @ApiOperation(value = "3.测试", httpMethod = "POST", notes = "接口发布说明")
*
* @ApiOperationSupport(order = 3) public void test(HttpServletRequest request,
* HttpServletResponse res) throws IOException {
*
* res.setHeader("content-type","text/html;charset=UTF-8");
* res.setHeader("selfHeader","selfHeaderValue"); //
* res.addHeader("response_code", "123"); //
* res.setContentType("application/octet-stream"); //
* res.addHeader("Content-Length", "0");
*
* res.addHeader("response_code", "100"); res.addHeader("trans_id", "");
* res.addHeader("cmd_code", "NO com");
*
* res.setContentType("application/octet-stream");
* res.addHeader("Content-Length", "0");
*
* res.flushBuffer(); // response.addHeader("response_code",
* "ERROR_INVALID_LIB_NAME"); //
* response.setContentType("application/octet-stream"); //
* response.addHeader("Content-Length", "0"); // response.flushBuffer();
* System.out.println(111); }
*/
/**
* 修改密码
...
...
@@ -179,28 +176,55 @@ public class LoginController {
@PostMapping
(
value
=
"/updatepassword"
)
@ApiOperation
(
value
=
"4.修改密码"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
4
)
public
Result
<
String
>
updatepassword
(
@RequestBody
EntRegisterDto
entRegisterDto
){
public
Result
<
String
>
updatepassword
(
@RequestBody
EntRegisterDto
entRegisterDto
)
{
String
phone
=
entRegisterDto
.
getPhone
();
String
pw
=
entRegisterDto
.
getPw
();
Integer
code
=
entRegisterDto
.
getCode
();
//String codeRedis =redisTemplate.get(phone).toString();
String
codeRedis
=
(
String
)
session
.
getAttribute
(
phone
);
if
(
code
==
null
||
!
code
.
toString
().
equals
(
codeRedis
))
{
return
ResultUtil
.
error
(
"验证码不符"
);
}
QyzxEmpLogin
qyzxEmpLogin1
=
new
LambdaQueryChainWrapper
<
QyzxEmpLogin
>(
qyzxEmpLoginMapper
)
.
eq
(!
StrUtil
.
hasBlank
(
phone
),
QyzxEmpLogin:
:
getPhone
,
phone
).
one
();
if
(
qyzxEmpLogin1
!=
null
)
{
String
code
=
entRegisterDto
.
getCode
();
if
(
entRegisterDto
.
getPwUpdateType
()
!=
2
)
{
// String codeRedis =redisTemplate.get(phone).toString();
String
codeRedis
=
(
String
)
session
.
getAttribute
(
phone
);
if
(
code
==
null
)
{
return
ResultUtil
.
error
(
"请填写验证码"
);
}
if
(
!
code
.
toString
().
equals
(
codeRedis
))
{
return
ResultUtil
.
error
(
"验证码不符"
);
}
QyzxEmpLogin
qyzxEmpLogin
=
new
LambdaQueryChainWrapper
<
QyzxEmpLogin
>(
qyzxEmpLoginMapper
)
.
eq
(!
StrUtil
.
hasBlank
(
phone
),
QyzxEmpLogin:
:
getPhone
,
phone
).
one
();
if
(
qyzxEmpLogin
!=
null
)
{
qyzxEmpLogin1
.
setPhone
(
phone
);
qyzxEmpLogin1
.
setPw
(
Md5
.
md5
(
pw
));
qyzxEmpLogin
.
setPhone
(
phone
);
qyzxEmpLogin
.
setPw
(
Md5
.
md5
(
pw
));
qyzxEmpLogin1
.
updateById
();
return
ResultUtil
.
success
(
"修改密码成功"
);
qyzxEmpLogin
.
updateById
();
return
ResultUtil
.
success
(
"修改密码成功"
);
}
else
{
return
ResultUtil
.
error
(
"修改密码失败,查找不到该人员!"
);
}
}
else
{
if
(
code
==
null
)
{
return
ResultUtil
.
error
(
"请填写原密码"
);
}
if
(
pw
.
trim
()
==
code
.
trim
())
{
return
ResultUtil
.
error
(
"新密码与原密码相同!请更改重试"
);
}
QyzxEmpLogin
qyzxEmpLogin
=
new
LambdaQueryChainWrapper
<
QyzxEmpLogin
>(
qyzxEmpLoginMapper
)
.
eq
(!
StrUtil
.
hasBlank
(
phone
),
QyzxEmpLogin:
:
getPhone
,
phone
).
one
();
if
(
qyzxEmpLogin
!=
null
)
{
if
(
qyzxEmpLogin
.
getPw
()
==
Md5
.
md5
(
pw
))
{
qyzxEmpLogin
.
setPhone
(
phone
);
qyzxEmpLogin
.
setPw
(
Md5
.
md5
(
pw
));
qyzxEmpLogin
.
updateById
();
return
ResultUtil
.
success
(
"修改密码成功"
);
}
else
{
return
ResultUtil
.
error
(
"原密码有误!请核对重试"
);
}
}
return
ResultUtil
.
error
(
"修改密码失败,查找不到该人员!"
);
}
return
ResultUtil
.
error
(
"修改密码失败"
);
//
return ResultUtil.error("修改密码失败");
}
/**
...
...
@@ -218,9 +242,9 @@ public class LoginController {
*/
Integer
empNum
=
userBean
.
getEmpNum
();
String
phone
=
entRegisterDto
.
getPhone
();
Integer
code
=
entRegisterDto
.
getCode
();
//String codeRedis = redisTemplate.get(phone).toString();
String
codeRedis
=
(
String
)
session
.
getAttribute
(
phone
);
String
code
=
entRegisterDto
.
getCode
();
//
String codeRedis = redisTemplate.get(phone).toString();
String
codeRedis
=
(
String
)
session
.
getAttribute
(
phone
);
if
(
code
==
null
||
!
code
.
toString
().
equals
(
codeRedis
))
{
return
ResultUtil
.
error
(
"验证码不符/失效"
);
...
...
@@ -229,7 +253,7 @@ public class LoginController {
if
(
qyzxEmpLogin1
!=
null
)
{
qyzxEmpLogin1
.
setPhone
(
phone
);
qyzxEmpLogin1
.
setPw
(
Md5
.
md5
(
"123456"
));
// 密码初始化
qyzxEmpLogin1
.
setPw
(
Md5
.
md5
(
"123456"
));
// 密码初始化
qyzxEmpLogin1
.
updateById
();
return
ResultUtil
.
success
(
"修改手机号/用户名成功"
);
...
...
@@ -245,7 +269,7 @@ public class LoginController {
*/
@PostMapping
(
value
=
"/register"
)
@ApiOperation
(
value
=
"注册企业"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
String
>
register
(
@RequestBody
EntRegisterDto
entRegisterDto
){
public
Result
<
String
>
register
(
@RequestBody
EntRegisterDto
entRegisterDto
)
{
// 事务回滚
/*
* DefaultTransactionDefinition def = new DefaultTransactionDefinition();
...
...
@@ -287,10 +311,9 @@ public class LoginController {
if
(
login
==
null
)
{
// 员工信息
QyzxEmpLogin
qyzxEmpLogin
=
QyzxEmpLogin
.
builder
().
phone
(
phone
).
pw
(
Md5
.
md5
(
pw
))
.
sts
(
CommonEnum
.
U_STS_ON
.
getType
())
.
orgId
(
qyzxEntInfoM
.
getId
()).
regTime
(
DateUtil
.
date
()).
endTime
(
DateUtil
.
nextMonth
())
.
build
();
QyzxEmpLogin
qyzxEmpLogin
=
QyzxEmpLogin
.
builder
().
phone
(
phone
).
pw
(
Md5
.
md5
(
pw
))
.
sts
(
CommonEnum
.
U_STS_ON
.
getType
()).
orgId
(
qyzxEntInfoM
.
getId
()).
regTime
(
DateUtil
.
date
())
.
endTime
(
DateUtil
.
nextMonth
()).
build
();
boolean
b2
=
qyzxEmpLogin
.
insert
();
if
(!
b2
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
...
...
@@ -331,28 +354,29 @@ public class LoginController {
*/
@PostMapping
(
value
=
"/code"
)
@ApiOperation
(
value
=
"验证码登录"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
QyzxEmpLogin
>
codelogin
(
@RequestBody
EntRegisterDto
entRegisterDto
,
HttpServletRequest
request
)
{
public
Result
<
QyzxEmpLogin
>
codelogin
(
@RequestBody
EntRegisterDto
entRegisterDto
,
HttpServletRequest
request
)
{
Integer
code
=
entRegisterDto
.
getCode
();
String
code
=
entRegisterDto
.
getCode
();
String
phone
=
entRegisterDto
.
getPhone
();
//Object codeRedis = redisTemplate.get(phone);
String
codeRedis
=
(
String
)
session
.
getAttribute
(
phone
);
//
Object codeRedis = redisTemplate.get(phone);
String
codeRedis
=
(
String
)
session
.
getAttribute
(
phone
);
if
(
codeRedis
==
null
||
!
code
.
toString
().
equals
(
codeRedis
.
toString
()))
return
ResultUtil
.
error
(
"验证码不符"
);
QyzxEmpLogin
qyzxEmpLogin1
=
new
LambdaQueryChainWrapper
<
QyzxEmpLogin
>(
qyzxEmpLoginMapper
)
.
eq
(!
StrUtil
.
hasBlank
(
phone
),
QyzxEmpLogin:
:
getPhone
,
phone
).
one
();
return
loginhan
(
qyzxEmpLogin1
,
request
);
return
loginhan
(
qyzxEmpLogin1
,
request
);
}
@Autowired
ZzglBmgwMMapper
zzglBmgwMMapper
;
private
Result
<
QyzxEmpLogin
>
loginhan
(
QyzxEmpLogin
qyzxEmpLogin1
,
HttpServletRequest
request
)
{
if
(
qyzxEmpLogin1
==
null
)
return
ResultUtil
.
error
(
"帐号不存在!"
);
private
Result
<
QyzxEmpLogin
>
loginhan
(
QyzxEmpLogin
qyzxEmpLogin1
,
HttpServletRequest
request
)
{
if
(
qyzxEmpLogin1
==
null
)
return
ResultUtil
.
error
(
"帐号不存在!"
);
String
ip
;
try
{
ip
=
UserIp
.
getIpAddr
(
request
);
...
...
@@ -361,23 +385,25 @@ public class LoginController {
e
.
printStackTrace
();
}
List
<
QysDto
>
qys
=
qyzxEmpLoginMapper
.
getQys
(
qyzxEmpLogin1
.
getId
());
if
(
qys
.
size
()==
0
)
return
ResultUtil
.
error
(
"没有任何公司可以查看!"
);
if
(
qys
.
size
()
==
0
)
return
ResultUtil
.
error
(
"没有任何公司可以查看!"
);
qyzxEmpLogin1
.
setQys
(
qys
);
QysDto
ctrl
=
qys
.
get
(
0
);
if
(
qyzxEmpLogin1
.
getOrgId
()!=
null
){
Stream
<
QysDto
>
s
=
qys
.
stream
().
filter
(
item
->
item
.
getStatus
()==
1
&&
qyzxEmpLogin1
.
getOrgId
().
equals
(
item
.
getId
()));
if
(
s
!=
null
){
ctrl
=
s
.
findFirst
().
get
();
QysDto
ctrl
=
qys
.
get
(
0
);
if
(
qyzxEmpLogin1
.
getOrgId
()
!=
null
)
{
Stream
<
QysDto
>
s
=
qys
.
stream
()
.
filter
(
item
->
item
.
getStatus
()
==
1
&&
qyzxEmpLogin1
.
getOrgId
().
equals
(
item
.
getId
()));
if
(
s
!=
null
)
{
ctrl
=
s
.
findFirst
().
get
();
}
}
if
(
ctrl
.
getStatus
()
==
null
||
ctrl
.
getStatus
().
equals
(
0
))
{
}
if
(
ctrl
.
getStatus
()
==
null
||
ctrl
.
getStatus
().
equals
(
0
))
{
return
ResultUtil
.
error
(
"帐号被禁用"
);
}
qyzxEmpLogin1
.
setOrgId
(
ctrl
.
getId
());
@SuppressWarnings
(
"unused"
)
String
phone
=
qyzxEmpLogin1
.
getPhone
();
if
(
CommonEnum
.
U_TYPE_ADMIN
.
getType
().
equals
(
ctrl
.
getUserType
())
||
CommonEnum
.
U_TYPE_C_ADMIN
.
getType
().
equals
(
ctrl
.
getUserType
()))
{
if
(
CommonEnum
.
U_TYPE_ADMIN
.
getType
().
equals
(
ctrl
.
getUserType
())
||
CommonEnum
.
U_TYPE_C_ADMIN
.
getType
().
equals
(
ctrl
.
getUserType
()))
{
}
else
{
// 获取权限
ArrayList
<
Integer
>
list
=
new
ArrayList
<
Integer
>();
...
...
@@ -389,7 +415,7 @@ public class LoginController {
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
LambdaQueryWrapper
<
ZzglAuth
>
wp
=
new
LambdaQueryWrapper
<>();
wp
.
select
(
ZzglAuth:
:
getMenuId
).
eq
(
ZzglAuth:
:
getOrgCode
,
qyzxEmpLogin1
.
getOrgId
())
.
and
(
i
->
i
.
in
(
ZzglAuth:
:
getBmgwId
,
list
.
toArray
()));
.
and
(
i
->
i
.
in
(
ZzglAuth:
:
getBmgwId
,
list
.
toArray
()));
List
<
ZzglAuth
>
zas
=
ZzglAuth
.
builder
().
build
().
selectList
(
wp
);
List
<
String
>
menus
=
new
ArrayList
<>();
zas
.
stream
().
forEach
(
o
->
menus
.
add
(
o
.
getMenuId
()));
...
...
@@ -398,7 +424,7 @@ public class LoginController {
}
// 可操作企业
//需要更新最后一次登陆信息
//
需要更新最后一次登陆信息
// 用户信息缓存
session
.
setAttribute
(
"ui"
,
qyzxEmpLogin1
);
// redisTemplate.set("loginUser:" + phone, session.getId());
...
...
@@ -415,7 +441,7 @@ public class LoginController {
*/
@PostMapping
(
value
=
"/password"
)
@ApiOperation
(
value
=
"密码登录"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
QyzxEmpLogin
>
passwordlogin
(
@RequestBody
EntRegisterDto
entRegisterDto
,
HttpServletRequest
request
)
{
public
Result
<
QyzxEmpLogin
>
passwordlogin
(
@RequestBody
EntRegisterDto
entRegisterDto
,
HttpServletRequest
request
)
{
String
phone
=
entRegisterDto
.
getPhone
();
String
pw
=
entRegisterDto
.
getPw
();
...
...
@@ -423,10 +449,10 @@ public class LoginController {
QyzxEmpLogin
qyzxEmpLogin1
=
new
LambdaQueryChainWrapper
<
QyzxEmpLogin
>(
qyzxEmpLoginMapper
)
.
eq
(!
StrUtil
.
hasBlank
(
phone
),
QyzxEmpLogin:
:
getPhone
,
phone
).
one
();
if
(
qyzxEmpLogin1
!=
null
)
{
if
(
StrUtil
.
hasBlank
(
pw
)
||
!
qyzxEmpLogin1
.
getPw
().
equals
(
Md5
.
md5
(
pw
)))
if
(
StrUtil
.
hasBlank
(
pw
)
||
!
qyzxEmpLogin1
.
getPw
().
equals
(
Md5
.
md5
(
pw
)))
return
ResultUtil
.
error
(
"帐号密码错误"
);
return
loginhan
(
qyzxEmpLogin1
,
request
);
return
loginhan
(
qyzxEmpLogin1
,
request
);
}
else
{
return
ResultUtil
.
error
(
"帐号不存在-错误"
);
}
...
...
src/main/java/cn/timer/api/dto/qyzx/EntRegisterDto.java
View file @
cfcb69a0
...
...
@@ -32,12 +32,15 @@ public class EntRegisterDto implements Serializable {
private
String
sendDate
;
@ApiModelProperty
(
value
=
"验证码 "
,
example
=
"666666"
)
private
Integer
code
;
private
String
code
;
@ApiModelProperty
(
value
=
"1.验证码 2.消息推送 3通知提醒 "
,
example
=
"1"
)
private
Integer
messageType
;
@ApiModelProperty
(
value
=
"短信模板:1.身份验证验证码 2.登录确认验证码 3.登录异常验证码 4.用户注册验证码 5.修改密码验证码 6.信息变更验证码 "
,
example
=
"1"
)
private
Integer
tc
;
@ApiModelProperty
(
value
=
"1.验证码修改密码 2.原密码修改密码 "
,
example
=
"1"
)
private
Integer
pwUpdateType
;
}
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