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
9429ec31
Commit
9429ec31
authored
Dec 02, 2020
by
ysongq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
dc4d230b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
83 additions
and
21 deletions
+83
-21
pom.xml
jz-dm-common/pom.xml
+12
-0
RedisMessageConstant.java
...ain/java/com/jz/common/constant/RedisMessageConstant.java
+3
-4
pom.xml
jz-dm-mall/pom.xml
+2
-2
pom.xml
jz-dm-manage/pom.xml
+11
-0
LoginController.java
.../com/jz/manage/moduls/controller/sys/LoginController.java
+39
-12
SysUserController.java
...om/jz/manage/moduls/controller/sys/SysUserController.java
+12
-1
ValidateCodeController.java
.../manage/moduls/controller/sys/ValidateCodeController.java
+1
-1
SysUserDao.java
...src/main/java/com/jz/manage/moduls/mapper/SysUserDao.java
+2
-0
SysUserService.java
...ain/java/com/jz/manage/moduls/service/SysUserService.java
+1
-1
No files found.
jz-dm-common/pom.xml
View file @
9429ec31
...
...
@@ -62,5 +62,17 @@
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
aliyun-java-sdk-core
</artifactId>
<version>
RELEASE
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
aliyun-java-sdk-dysmsapi
</artifactId>
<version>
RELEASE
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
jz-dm-common/src/main/java/com/jz/common/constant/RedisMessageConstant.java
View file @
9429ec31
package
com
.
itheima
.
health
.
constant
;
package
com
.
jz
.
common
.
constant
;
public
interface
RedisMessageConstant
{
static
final
String
SENDTYPE_ORDER
=
"001"
;
//用于缓存体检预约时发送的验证码
static
final
String
SENDTYPE_LOGIN
=
"002"
;
//用于缓存手机号快速登录时发送的验证码
static
final
String
SENDTYPE_GETPWD
=
"003"
;
//用于缓存找回密码时发送的验证码
static
final
String
SENDTYPE_GETPWD
=
"001"
;
//用于缓存找回密码时发送的验证码
static
final
String
SENDTYPE_LOGIN
=
"002"
;
// 用于缓存注册用户时发送的验证码
}
\ No newline at end of file
jz-dm-mall/pom.xml
View file @
9429ec31
...
...
@@ -125,6 +125,6 @@
<version>
1.0.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</dependencies>
</project>
\ No newline at end of file
jz-dm-manage/pom.xml
View file @
9429ec31
...
...
@@ -141,6 +141,17 @@
<version>
1.0.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<!--阿里云服务器短信平台-->
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
aliyun-java-sdk-core
</artifactId>
<version>
3.3.1
</version>
</dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
aliyun-java-sdk-dysmsapi
</artifactId>
<version>
1.0.0
</version>
</dependency>
</dependencies>
<build>
...
...
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/sys/LoginController.java
View file @
9429ec31
package
com
.
jz
.
manage
.
moduls
.
controller
.
sys
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.entity.SysUser
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.manage.moduls.controller.BaseController
;
import
com.jz.manage.moduls.service.SysUserService
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
javax.security.auth.Subject
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"/sys"
)
@Api
(
tags
=
"用户登录api"
)
public
class
LoginController
extends
BaseController
{
@Autowired
private
SysUserService
sysUserService
;
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 登录功能
* @param account 账号
...
...
@@ -34,18 +45,34 @@ public class LoginController extends BaseController {
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
}
// /**
// * 手机号码校验
// * @param paramMap
// * @param res
// * @return
// */
// @PostMapping(value = "/check")
// public Result loginCheck(@RequestBody Map<String, String> paramMap, HttpServletResponse res) {
// // 获取手机号码
// String telephone = paramMap.get("telephone");
//
// }
/**
* 手机号码校验
* @param paramMap
* @param res
* @return
*/
@PostMapping
(
value
=
"/check"
)
public
Result
loginCheck
(
@RequestBody
Map
<
String
,
String
>
paramMap
,
HttpServletResponse
res
)
{
// 获取手机号码
String
telephone
=
paramMap
.
get
(
"telephone"
);
String
key
=
RedisMessageConstant
.
SENDTYPE_LOGIN
+
"_"
+
telephone
;
// 获取redis中key对应的值
String
codeInRedis
=
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
if
(
StringUtils
.
isEmpty
(
codeInRedis
))
{
return
new
Result
(
false
,
"请重新获取验证码!"
,
StatusCode
.
ERROR
);
}
// 判断验证码是否一致
if
(!
codeInRedis
.
equals
(
paramMap
.
get
(
"validateCode"
)))
{
return
new
Result
(
false
,
"验证码不正确!"
,
StatusCode
.
ERROR
);
}
// 删除redis的验证码
redisTemplate
.
delete
(
key
);
return
new
Result
(
true
,
"验证码正确!"
,
StatusCode
.
OK
);
}
/*@ApiOperation("登录接口")
@RequestMapping(value = "/login", method = RequestMethod.POST)
public Result<JSONObject> login(@RequestBody SysUser sysUser, HttpServletRequest request) throws Exception {
...
...
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/sys/SysUserController.java
View file @
9429ec31
package
com
.
jz
.
manage
.
moduls
.
controller
.
sys
;
import
com.jz.common.utils.Result
;
import
com.jz.manage.moduls.controller.BaseController
;
import
com.jz.manage.moduls.entity.SysUser
;
import
com.jz.manage.moduls.service.SysUserService
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -14,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping
(
"sysUser"
)
@Api
(
tags
=
"用户功能api"
)
public
class
SysUserController
extends
BaseController
{
/**
* 服务对象
...
...
@@ -21,5 +27,10 @@ public class SysUserController extends BaseController {
@Autowired
private
SysUserService
sysUserService
;
// @PostMapping("/register")
// public Result saveSysUser(@RequestBody SysUser sysUser) throws Exception{
// if (sysUser == null) {
// return new Result(false, "注册信息失败!");
// }
// }
}
\ No newline at end of file
jz-dm-ma
ll/src/main/java/com/jz/dm/mall/moduls/controller/customer
/ValidateCodeController.java
→
jz-dm-ma
nage/src/main/java/com/jz/manage/moduls/controller/sys
/ValidateCodeController.java
View file @
9429ec31
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
customer
;
package
com
.
jz
.
manage
.
moduls
.
controller
.
sys
;
import
com.aliyuncs.exceptions.ClientException
;
import
com.jz.common.constant.RedisMessageConstant
;
...
...
jz-dm-manage/src/main/java/com/jz/manage/moduls/mapper/SysUserDao.java
View file @
9429ec31
...
...
@@ -17,4 +17,6 @@ public interface SysUserDao extends BaseMapper<SysUser> {
List
<
Map
>
getUserRoleByAccount
(
@Param
(
"account"
)
String
account
);
// void saveSysUser(SysUser)
}
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/service/SysUserService.java
View file @
9429ec31
...
...
@@ -14,7 +14,7 @@ import java.util.Map;
public
interface
SysUserService
{
/*
* 通过用户帐
好
进行查询
* 通过用户帐
号
进行查询
* */
SysUser
selectByUsername
(
String
account
);
...
...
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