|
@@ -5,6 +5,8 @@ import com.diagbot.dto.UserAuthenticationRespDTO;
|
|
import com.diagbot.entity.Organization;
|
|
import com.diagbot.entity.Organization;
|
|
import com.diagbot.entity.User;
|
|
import com.diagbot.entity.User;
|
|
import com.diagbot.entity.UserAuthentication;
|
|
import com.diagbot.entity.UserAuthentication;
|
|
|
|
+import com.diagbot.enums.AuthStatusEnum;
|
|
|
|
+import com.diagbot.enums.OrganizationTypeEnum;
|
|
import com.diagbot.service.impl.UserAuthenticationServiceImpl;
|
|
import com.diagbot.service.impl.UserAuthenticationServiceImpl;
|
|
import com.diagbot.util.UserUtils;
|
|
import com.diagbot.util.UserUtils;
|
|
import com.diagbot.vo.UserAuthenticationVO;
|
|
import com.diagbot.vo.UserAuthenticationVO;
|
|
@@ -12,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description:用户认证业务层
|
|
* @Description:用户认证业务层
|
|
@@ -105,12 +109,38 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
|
|
userAuthenticationDTO.setUser(user);
|
|
userAuthenticationDTO.setUser(user);
|
|
userAuthenticationDTO.setOrganization(organization);
|
|
userAuthenticationDTO.setOrganization(organization);
|
|
userAuthenticationDTO.setUserAuthentication(userAuthentication);
|
|
userAuthenticationDTO.setUserAuthentication(userAuthentication);
|
|
|
|
+ Map<Integer, Object> organizationType = new HashMap<>();
|
|
|
|
+ for (OrganizationTypeEnum item : OrganizationTypeEnum.values()) {
|
|
|
|
+ organizationType.put(item.getKey(), item.getName());
|
|
|
|
+ }
|
|
|
|
+ userAuthenticationDTO.setOrganizationType(organizationType);
|
|
return userAuthenticationDTO;
|
|
return userAuthenticationDTO;
|
|
}
|
|
}
|
|
|
|
|
|
- public UserAuthentication getUserAuthentication() {
|
|
|
|
|
|
+ public Map<String, Object> getUserAuthenticationStatus() {
|
|
Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
UserAuthentication userAuthentication = this.getByUserId(userId);
|
|
UserAuthentication userAuthentication = this.getByUserId(userId);
|
|
- return userAuthentication;
|
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ if (userAuthentication == null) {
|
|
|
|
+ map.put("msg", "当前用户没有认证信息");
|
|
|
|
+ } else {
|
|
|
|
+ String status = userAuthentication.getStatus();
|
|
|
|
+ String statusName = "";
|
|
|
|
+ switch (status) {
|
|
|
|
+ case "0":
|
|
|
|
+ statusName = AuthStatusEnum.Unauthorized.getName();
|
|
|
|
+ break;
|
|
|
|
+ case "1":
|
|
|
|
+ statusName = AuthStatusEnum.Authorized.getName();
|
|
|
|
+ break;
|
|
|
|
+ case "2":
|
|
|
|
+ statusName = AuthStatusEnum.Authorizing.getName();
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ map.put(status, statusName);
|
|
|
|
+ }
|
|
|
|
+ return map;
|
|
}
|
|
}
|
|
}
|
|
}
|