添加登录模块swagger

master
shijie 4 years ago
parent 49cce00232
commit b091feba29
  1. 30
      dq-financial-api/src/main/java/com/daqing/financial/hrauth/UserLoginControllerApi.java
  2. 5
      dq-financial-hrms-auth/pom.xml
  3. 3
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java
  4. 5
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java
  5. 1
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.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);
}

@ -89,6 +89,11 @@
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0.5</version>
</dependency>-->
<dependency>
<groupId>com.daqing.financial</groupId>
<artifactId>dq-financial-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<dependencyManagement>

@ -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;

@ -91,6 +91,11 @@ public class UserLoginServiceImpl extends ServiceImpl<UserLoginDao, UserEntity>
//根据手机号查询相关信息
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);

@ -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, "该职位下已关联员工!");

Loading…
Cancel
Save