init
parent
b905e695b7
commit
9068e9a278
@ -1,13 +1,42 @@
|
||||
package com.supervision.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.supervision.exception.BusinessException;
|
||||
import com.supervision.util.TokenUtil;
|
||||
import com.supervision.vo.LoginReqVO;
|
||||
import com.supervision.vo.LoginResVO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
@RequestMapping("user")
|
||||
public class UserController {
|
||||
|
||||
@GetMapping("login")
|
||||
public void login(){
|
||||
|
||||
@ApiOperation("登录")
|
||||
@PostMapping("login")
|
||||
public LoginResVO login(@RequestBody LoginReqVO reqVO) {
|
||||
// if (!StrUtil.isAllNotBlank(reqVO.getUserAccount(), reqVO.getPassword())) {
|
||||
// throw new BusinessException("用户名不能为空");
|
||||
// }
|
||||
// Optional<User> user = userService.lambdaQuery().eq(User::getAccount, reqVO.getUserAccount()).last("limit 1").oneOpt();
|
||||
// if (!user.isPresent() || !user.get().getPassword().equals(reqVO.getPassword())) {
|
||||
// throw new BusinessException("用户名或密码有误!");
|
||||
// }
|
||||
// // 更新用户最近的登录时间
|
||||
// String token = TokenUtil.creatToken(JSONUtil.toJsonStr(user.get()));
|
||||
//
|
||||
// LoginResVO loginResVO = BeanUtil.toBean(user.get(), LoginResVO.class);
|
||||
// loginResVO.setToken(token);
|
||||
// return loginResVO;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.supervision.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LoginReqVO {
|
||||
|
||||
private String userAccount;
|
||||
private String password;
|
||||
}
|
Loading…
Reference in New Issue