...
|
...
|
@@ -3,6 +3,7 @@ package com.xkl.authorization.resolvers; |
|
|
import com.xkl.authorization.annotation.CurrentAdmin;
|
|
|
import com.xkl.config.Constants;
|
|
|
import com.xkl.controller.uploadsoft.UpSoftAccountController;
|
|
|
import com.xkl.controller.uspih.AdminAccountController;
|
|
|
import com.xkl.domain.XklAdminEntity;
|
|
|
import com.xkl.repository.AdminRepository;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
...
|
...
|
@@ -39,7 +40,8 @@ public class CurrentAdminMethodArgumentResolver implements HandlerMethodArgument |
|
|
@Override
|
|
|
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
|
|
|
//取出鉴权时存入的登录用户Id
|
|
|
String currentAdminId = ((String) webRequest.getAttribute(Constants.CURRENT_USER_ID, RequestAttributes.SCOPE_REQUEST)).replace(UpSoftAccountController.UPSOFT_TOKEN_PREFIX, "");
|
|
|
String currentAdminId = ((String) webRequest.getAttribute(Constants.CURRENT_USER_ID, RequestAttributes.SCOPE_REQUEST)).
|
|
|
replace(UpSoftAccountController.UPSOFT_TOKEN_PREFIX, "").replace(AdminAccountController.USPIH_TOKEN_PREFIX, "");
|
|
|
if (currentAdminId != null) {
|
|
|
//从数据库中查询并返回
|
|
|
XklAdminEntity admin = adminRepository.findByIdAndStatus(Long.parseLong(currentAdminId), Constants.STATUS_OK);
|
...
|
...
|
|