|
|
@@ -1,6 +1,5 @@
|
|
|
package com.usoftchina.saas.account.controller;
|
|
|
|
|
|
-import com.usoftchina.saas.account.cache.AccountCache;
|
|
|
import com.usoftchina.saas.account.dto.AccountDTO;
|
|
|
import com.usoftchina.saas.account.dto.AccountRegDTO;
|
|
|
import com.usoftchina.saas.account.dto.CompanyBaseDTO;
|
|
|
@@ -11,6 +10,7 @@ import com.usoftchina.saas.account.service.AccountService;
|
|
|
import com.usoftchina.saas.account.service.CompanyService;
|
|
|
import com.usoftchina.saas.account.service.RoleService;
|
|
|
import com.usoftchina.saas.account.vo.CompanyBaseVO;
|
|
|
+import com.usoftchina.saas.auth.client.annotation.IgnoreAuth;
|
|
|
import com.usoftchina.saas.base.Result;
|
|
|
import com.usoftchina.saas.context.BaseContextHolder;
|
|
|
import com.usoftchina.saas.exception.ExceptionCode;
|
|
|
@@ -48,6 +48,7 @@ public class AccountController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/register")
|
|
|
+ @IgnoreAuth
|
|
|
public Result register(@RequestBody AccountRegDTO accountRegDTO) {
|
|
|
// 判断是否已注册
|
|
|
Account account = accountService.findByUsername(accountRegDTO.getUsername());
|
|
|
@@ -80,6 +81,7 @@ public class AccountController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping(value = "/pwd/check")
|
|
|
+ @IgnoreAuth
|
|
|
public Result<AccountDTO> validByUsernameAndPwd(@RequestParam(value = "username") String username, @RequestParam(value = "password") String password) {
|
|
|
Account account = getAccountByUsername(username);
|
|
|
if (null == account) {
|
|
|
@@ -158,6 +160,21 @@ public class AccountController {
|
|
|
return Result.success(getAccountDTO(account));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 按当前登录用户查找账户
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping
|
|
|
+ public Result<AccountDTO> getAccountByAuthorization() {
|
|
|
+ Account account = accountService.findByPrimaryKey(BaseContextHolder.getUserId());
|
|
|
+ if (null == account) {
|
|
|
+ return Result.error(ExceptionCode.USER_NOT_EXIST);
|
|
|
+ }
|
|
|
+
|
|
|
+ return Result.success(getAccountDTO(account));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 按ID查找账户
|
|
|
*
|