|
@@ -6,6 +6,7 @@ import com.ym.mec.auth.service.SysUserRoleService;
|
|
|
import com.ym.mec.auth.service.SysUserService;
|
|
|
import com.ym.mec.auth.web.controller.queryInfo.SysUserQueryInfo;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.security.AuthUser;
|
|
|
import com.ym.mec.common.security.SecurityConstants;
|
|
|
import com.ym.mec.common.security.SecurityUtils;
|
|
@@ -171,6 +172,27 @@ public class UserController extends BaseController {
|
|
|
return failed();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "校验用户手机号和密码")
|
|
|
+ @GetMapping(value = "/checkUser")
|
|
|
+ public Object checkUser(String phone,String password) {
|
|
|
+ if(StringUtils.isEmpty(phone) || StringUtils.isEmpty(password)){
|
|
|
+ throw new BizException("请录入用户名和密码");
|
|
|
+ }
|
|
|
+ AuthUser user = SecurityUtils.getUser();
|
|
|
+ if (user != null) {
|
|
|
+ SysUser sysUser = sysUserService.get(user.getUserId());
|
|
|
+ if(!sysUser.getPhone().equals(phone)){
|
|
|
+ return failed("手机号校验失败");
|
|
|
+ }
|
|
|
+ if(new BCryptPasswordEncoder().matches(password,user.getPassword())){
|
|
|
+ return succeed();
|
|
|
+ }else {
|
|
|
+ return failed("密码校验失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return failed();
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "获取用户角色列表")
|
|
|
@GetMapping("/getRole")
|
|
|
@PreAuthorize("@pcs.hasPermissions('user/getRole')")
|