|
|
|
@ -1,14 +1,13 @@
|
|
|
|
|
package com.glxp.api.service.auth;
|
|
|
|
|
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.api.exception.JsonException;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.naming.Name;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@ -34,6 +33,17 @@ public class CustomerService {
|
|
|
|
|
return Integer.parseInt(userId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getUserIdStr() {
|
|
|
|
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
|
|
|
|
|
|
|
if (attributes == null) {
|
|
|
|
|
throw new JsonException(ResultEnum.NOT_NETWORK);
|
|
|
|
|
}
|
|
|
|
|
HttpServletRequest request = attributes.getRequest();
|
|
|
|
|
String userId = request.getHeader("ADMIN_ID");
|
|
|
|
|
return userId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getUserName() {
|
|
|
|
|
Integer userId = getUserId();
|
|
|
|
|
AuthAdmin authAdmin = authAdminService.findById(userId.longValue());
|
|
|
|
|