Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
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
姚本章
dm_project
Commits
f4b145f8
Commit
f4b145f8
authored
Dec 16, 2020
by
ysongq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
8633e41d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
10 deletions
+19
-10
LoginController.java
...z/dm/mall/moduls/controller/customer/LoginController.java
+7
-4
MallCustomerController.java
...ll/moduls/controller/customer/MallCustomerController.java
+10
-6
MallCustomerServiceImpl.java
.../dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
+2
-0
No files found.
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/LoginController.java
View file @
f4b145f8
...
...
@@ -4,6 +4,7 @@ package com.jz.dm.mall.moduls.controller.customer;
import
com.jz.common.bean.MallCustomerApiDto
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
...
...
@@ -47,7 +48,8 @@ public class LoginController {
*/
@PostMapping
(
value
=
"/login"
)
@ApiOperation
(
value
=
"登录功能"
,
notes
=
"登录功能"
)
public
Result
<
CustomerDto
>
login
(
String
username
,
String
password
,
HttpServletRequest
request
)
throws
Exception
{
public
Result
<
CustomerDto
>
login
(
@RequestParam
(
value
=
"username"
)
String
username
,
@RequestParam
(
value
=
"password"
)
String
password
,
HttpServletRequest
request
)
throws
Exception
{
// 手机
String
ph
=
"^[1][34578]\\d{9}$"
;
// 如果是手机验证
...
...
@@ -78,7 +80,7 @@ public class LoginController {
* @return
*/
@PostMapping
(
value
=
"/getCode"
)
public
Result
loginCheck
(
@RequestParam
(
required
=
fals
e
)
Map
<
String
,
String
>
paramMap
)
{
public
Result
loginCheck
(
@RequestParam
(
required
=
tru
e
)
Map
<
String
,
String
>
paramMap
)
{
// 获取手机号码
String
telephone
=
paramMap
.
get
(
"telephone"
);
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
...
...
@@ -105,7 +107,7 @@ public class LoginController {
*/
@GetMapping
(
value
=
"/phoneCheck"
)
@ApiOperation
(
value
=
"手机号码校验接口"
,
notes
=
"手机号码是否已注册"
)
public
Result
phoneCheck
(
String
telephone
)
{
public
Result
phoneCheck
(
@RequestParam
(
"telephone"
)
String
telephone
)
{
if
(
telephone
==
null
)
{
return
new
Result
(
false
,
"请重新输入手机号!"
);
}
...
...
@@ -127,7 +129,8 @@ public class LoginController {
*/
@GetMapping
(
value
=
"/phoneUserCheck"
)
@ApiOperation
(
value
=
"手机号用户名重复校验接口"
,
notes
=
"手机号用户名是否重复"
)
public
Result
phoneCheck
(
String
username
,
String
telephone
,
HttpServletRequest
request
)
{
public
Result
phoneCheck
(
@RequestParam
(
value
=
"username"
)
String
username
,
@RequestParam
(
value
=
"password"
)
String
telephone
,
HttpServletRequest
request
)
{
String
ph
=
"^[1][34578]\\d{9}$"
;
if
(
telephone
.
matches
(
ph
))
{
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
telephone
);
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/MallCustomerController.java
View file @
f4b145f8
...
...
@@ -3,6 +3,7 @@ package com.jz.dm.mall.moduls.controller.customer;
import
com.baomidou.mybatisplus.extension.api.R
;
import
com.jz.common.base.BaseController
;
import
com.jz.common.base.CurrentUser
;
import
com.jz.common.bean.MallCustomerApiDto
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultMsg
;
...
...
@@ -13,6 +14,7 @@ import com.jz.common.utils.Result;
import
com.jz.common.utils.StatusCode
;
import
com.jz.dm.mall.moduls.service.MallCustomerService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
...
@@ -50,7 +52,7 @@ public class MallCustomerController extends BaseController {
*/
@PostMapping
(
"/saveCustomer"
)
@ApiOperation
(
value
=
"注册用户"
,
notes
=
"添加用户"
)
public
Result
saveCustomer
(
@RequestParam
(
required
=
fals
e
)
Map
<
String
,
String
>
paramMap
,
HttpServletRequest
request
)
{
public
Result
saveCustomer
(
@RequestParam
(
required
=
tru
e
)
Map
<
String
,
String
>
paramMap
,
HttpServletRequest
request
)
{
if
(
paramMap
!=
null
)
{
String
username
=
paramMap
.
get
(
"username"
);
String
telephone
=
paramMap
.
get
(
"telephone"
);
...
...
@@ -82,13 +84,13 @@ public class MallCustomerController extends BaseController {
* @return
*/
@GetMapping
(
"/getLoginUserName"
)
@ApiOperation
(
value
=
"
注册用户"
,
notes
=
"添加用户
"
)
@ApiOperation
(
value
=
"
获取用户信息
"
)
public
Result
getLoginUserName
(
HttpServletRequest
request
)
{
// 从session中获取id
try
{
MallCustomer
mallCustomer
=
(
MallCustomer
)
SessionUtils
.
getUserCurrent
(
request
,
"mallCustomer"
);
Long
customerId
=
1L
;
//
Long customerId = mallCustomer.getCustomerId();
MallCustomer
ApiDto
mallCustomer
=
(
MallCustomerApiDto
)
SessionUtils
.
getUserCurrent
(
request
,
"mallCustomer"
);
//
Long customerId = 1L;
Long
customerId
=
mallCustomer
.
getCustomerId
();
MallCustomer
user
=
mallCustomerService
.
selectByUser
(
customerId
);
return
new
Result
(
true
,
"获取用户信息成功!"
,
StatusCode
.
OK
,
user
);
}
catch
(
Exception
e
)
{
...
...
@@ -98,7 +100,9 @@ public class MallCustomerController extends BaseController {
}
@PostMapping
(
value
=
"/updatePassword"
)
public
Result
updatePassword
(
String
oldPassword
,
String
newPassword
,
HttpServletRequest
request
)
throws
Exception
{
@ApiModelProperty
(
value
=
"密码修改"
)
public
Result
updatePassword
(
@RequestParam
(
value
=
"oldPassWard"
)
String
oldPassword
,
@RequestParam
(
value
=
"newPassword"
)
String
newPassword
,
HttpServletRequest
request
)
throws
Exception
{
// 获取用户信息
MallCustomer
mallCustomer
=
(
MallCustomer
)
getLoginUserName
(
request
).
getData
();
// 如果密码一致
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
View file @
f4b145f8
...
...
@@ -5,6 +5,7 @@ import com.jz.common.bean.MallCustomerApiDto;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.enums.UserTypeEnum
;
import
com.jz.common.utils.DateUtils
;
import
com.jz.common.utils.SessionUtils
;
import
com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.mapper.MallCustomerDao
;
...
...
@@ -52,6 +53,7 @@ public class MallCustomerServiceImpl implements MallCustomerService {
mallCustomerApiDto
.
setUserTypeEnum
(
UserTypeEnum
.
COMPANY_ROLE
);
mallCustomerApiDto
.
setCustomerAccount
(
mallCustomer
.
getCustomerAccount
());
mallCustomerApiDto
.
setCustomerName
(
mallCustomer
.
getCustomerName
());
mallCustomerApiDto
.
setAssetsId
(
mallCustomer
.
getAssetsId
());
// 存入到session
request
.
getSession
().
setAttribute
(
"mallCustomer"
,
mallCustomerApiDto
);
// 存入到redis
...
...
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