| | |
| | | import com.cl.common.exception.user.LoginErrorException; |
| | | import com.cl.common.exception.user.UserException; |
| | | import com.cl.common.result.Result; |
| | | import com.cl.pojo.dto.AddUserDTO; |
| | | import com.cl.pojo.dto.EditUserDTO; |
| | | import com.cl.pojo.dto.LoginDTO; |
| | | import com.cl.pojo.dto.PasswordDTO; |
| | | import com.cl.pojo.dto.*; |
| | | import com.cl.pojo.entity.User; |
| | | |
| | | import com.cl.pojo.vo.UserVO; |
| | |
| | | } |
| | | |
| | | if (!Objects.equals(user.getStatus(), StatusConstant.ENABLE)){ |
| | | throw new LoginErrorException("该账号已被冻结"); |
| | | throw new LoginErrorException("登录失败,当前账号已被冻结"); |
| | | } |
| | | //校验密码是否正确 |
| | | if (!BCryptPasswordEncoder.matches(dto.getPassword(), user.getPassword())) { |
| | |
| | | Map<String,String> map=new HashMap<>(); |
| | | map.put("token", token); |
| | | map.put("is_first",user.getIsFirst().toString()); |
| | | map.put("name",user.getName()); |
| | | map.put("phone",user.getPhone()); |
| | | map.put("id", String.valueOf(user.getId())); |
| | | if (1==user.getIsFirst()){ |
| | | User user1 = new User(); |
| | | user1.setId(user.getId()); |
| | |
| | | return Result.success("修改成功"); |
| | | } |
| | | /** |
| | | * 修改密码 |
| | | */ |
| | | @PutMapping("/passwordBeforeLogin") |
| | | @ApiOperation("修改密码(登录前)") |
| | | public Result<String> passwordBeforeLogin(@RequestBody @Valid PasswordBeforeLoginDTO passwordDTO) { |
| | | if (passwordDTO.getPhone().equals("admin")) { |
| | | return Result.error("管理员账号,不可操作"); |
| | | } |
| | | return userService.passwordBeforeLogin(passwordDTO); |
| | | } |
| | | /** |
| | | * 添加 |
| | | */ |
| | | @PostMapping("/addUser") |