From b091feba29feb6d57935fc748a9cb9e56233460c Mon Sep 17 00:00:00 2001
From: shijie <648688341@qq.com>
Date: Mon, 28 Sep 2020 16:52:55 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=99=BB=E5=BD=95=E6=A8=A1?=
=?UTF-8?q?=E5=9D=97swagger?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../hrauth/UserLoginControllerApi.java | 30 +++++++++++++++++++
dq-financial-hrms-auth/pom.xml | 5 ++++
.../controller/UserLoginController.java | 3 +-
.../service/impl/UserLoginServiceImpl.java | 5 ++++
.../domain/hrms/response/HrmsCode.java | 1 +
5 files changed, 43 insertions(+), 1 deletion(-)
create mode 100644 dq-financial-api/src/main/java/com/daqing/financial/hrauth/UserLoginControllerApi.java
diff --git a/dq-financial-api/src/main/java/com/daqing/financial/hrauth/UserLoginControllerApi.java b/dq-financial-api/src/main/java/com/daqing/financial/hrauth/UserLoginControllerApi.java
new file mode 100644
index 00000000..5a32c03c
--- /dev/null
+++ b/dq-financial-api/src/main/java/com/daqing/financial/hrauth/UserLoginControllerApi.java
@@ -0,0 +1,30 @@
+package com.daqing.financial.hrauth;
+
+import com.daqing.framework.domain.hrms.request.LoginRequest;
+import com.daqing.framework.domain.hrms.request.UserLoginRequest;
+import com.daqing.framework.model.response.ResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * @Author: gongsj.
+ * @Description: 登录controllerApi定义
+ * @Date:Created in 2020/09/07 11:33.
+ * @Modified By:
+ */
+@Api(value = "登录相关操作", tags = "提供登录相关操作")
+public interface UserLoginControllerApi {
+
+ /**
+ * 验证手机号及验证码
+ */
+ @ApiOperation(value = "验证手机号及验证码", notes = "验证手机号及验证码")
+ ResponseResult verifyMobile(UserLoginRequest user);
+
+ @ApiOperation(value = "重置密码")
+ ResponseResult getBackPwd(UserLoginRequest user);
+
+ @ApiOperation(value = "登录")
+ ResponseResult login(LoginRequest loginRequest);
+
+}
diff --git a/dq-financial-hrms-auth/pom.xml b/dq-financial-hrms-auth/pom.xml
index e9b706df..51f3e298 100644
--- a/dq-financial-hrms-auth/pom.xml
+++ b/dq-financial-hrms-auth/pom.xml
@@ -89,6 +89,11 @@
mybatis-plus-boot-starter
3.0.5
-->
+
+ com.daqing.financial
+ dq-financial-api
+ 0.0.1-SNAPSHOT
+
diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java
index 41e4403f..195035db 100644
--- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java
+++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java
@@ -1,5 +1,6 @@
package com.daqing.financial.hrauth.controller;
+import com.daqing.financial.hrauth.UserLoginControllerApi;
import com.daqing.financial.hrauth.service.UserLoginService;
import com.daqing.framework.domain.hrms.request.LoginRequest;
import com.daqing.framework.domain.hrms.request.UserLoginRequest;
@@ -19,7 +20,7 @@ import javax.validation.Valid;
@RestController
@RequestMapping("/hrms/auth/userlogin")
@Api(tags = {"登录"})
-public class UserLoginController {
+public class UserLoginController implements UserLoginControllerApi {
@Autowired
private UserLoginService userLoginService;
diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java
index c08cac85..1d3c0fac 100644
--- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java
+++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java
@@ -91,6 +91,11 @@ public class UserLoginServiceImpl extends ServiceImpl
//根据手机号查询相关信息
UserEntity userEntity = baseMapper.selectByPhoneAccount(user.getPhoneAccount());
+ //新密码不能与账号相同
+ if(user.getNewPwd().equals(userEntity.getAccount())){
+ ExceptionCast.cast(HrmsCode.NEW_PASSWORD_DIFFERENT);
+ }
+
String newMD5 = Md5Util.md5(user.getNewPwd()+userEntity.getId());
//根据手机号码修改密码
int i = userLoginDao.updatePasswordByPhoneAccount(user.getPhoneAccount(),newMD5);
diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java
index 528a08de..cbfea710 100644
--- a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java
+++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java
@@ -29,6 +29,7 @@ public enum HrmsCode implements ResultCode {
PHNOE_ACCOUNT_NOT_EXIST(false,33006,"手机号码不存在!"),
CONFIRM_PWD_NOT_EMPTY(false,33007,"确认密码不能为空!"),
TWICE_PWD_DIFFERENT(false,33008,"两次输入密码不一致!"),
+ NEW_PASSWORD_DIFFERENT(false,33008,"输入的新密码不能与账号相同!"),
EMP_POSITION_EXSIT(false, 22006, "该职位下已关联员工!");