Package com.bytedesk.core.ip_access
Class IpAccessRestService
java.lang.Object
com.bytedesk.core.base.BaseRestService<IpAccessEntity,IpAccessRequest,IpAccessResponse>
com.bytedesk.core.ip_access.IpAccessRestService
@Service
@Transactional
public class IpAccessRestService
extends BaseRestService<IpAccessEntity,IpAccessRequest,IpAccessResponse>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final IpAccessRepositoryprivate final IpBlackRestServiceprivate final IpServiceprivate static final intprivate static final intprivate final org.modelmapper.ModelMapperprivate final UidUtilsFields inherited from class com.bytedesk.core.base.BaseRestService
authService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertToResponse(IpAccessEntity entity) create(IpAccessRequest request) 记录IP访问(原 recordAccess 功能迁移至此)private IpAccessEntitycreateIpAccessEntity(String ip, String endpoint, String httpMethod, String params, ZonedDateTime now) 创建IP访问实体createIpAccessRequest(String ip, String endpoint, String httpMethod, String params) 创建IP访问请求对象protected org.springframework.data.jpa.domain.Specification<IpAccessEntity>createSpecification(IpAccessRequest request) 创建Specification对象,子类必须实现 用于queryByOrg的通用实现voiddelete(IpAccessRequest request) voiddeleteByUid(String uid) protected IpAccessEntitydoSave(IpAccessEntity entity) 子类实现具体的保存逻辑protected org.springframework.data.domain.Page<IpAccessEntity>executePageQuery(org.springframework.data.jpa.domain.Specification<IpAccessEntity> spec, org.springframework.data.domain.Pageable pageable) 执行分页查询,子类必须实现 用于queryByOrg的通用实现existsByUid(String uid) handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, IpAccessEntity entity) update(IpAccessRequest request) Methods inherited from class com.bytedesk.core.base.BaseRestService
deleteByOrgUid, findByOrgUid, getUidFromRequest, queryByOrg, queryByUid, queryByUser, recover, save, setUserUidToRequest
-
Field Details
-
MAX_REQUESTS_PER_MINUTE
private static final int MAX_REQUESTS_PER_MINUTE- See Also:
-
MAX_RETRY_COUNT
private static final int MAX_RETRY_COUNT- See Also:
-
BLACKLIST_THRESHOLD
private static final int BLACKLIST_THRESHOLD- See Also:
-
ipAccessRepository
-
ipBlackRestService
-
ipService
-
uidUtils
-
modelMapper
private final org.modelmapper.ModelMapper modelMapper
-
-
Constructor Details
-
IpAccessRestService
public IpAccessRestService()
-
-
Method Details
-
createSpecification
protected org.springframework.data.jpa.domain.Specification<IpAccessEntity> createSpecification(IpAccessRequest request) Description copied from class:BaseRestService创建Specification对象,子类必须实现 用于queryByOrg的通用实现- Specified by:
createSpecificationin classBaseRestService<IpAccessEntity,IpAccessRequest, IpAccessResponse>
-
executePageQuery
protected org.springframework.data.domain.Page<IpAccessEntity> executePageQuery(org.springframework.data.jpa.domain.Specification<IpAccessEntity> spec, org.springframework.data.domain.Pageable pageable) Description copied from class:BaseRestService执行分页查询,子类必须实现 用于queryByOrg的通用实现- Specified by:
executePageQueryin classBaseRestService<IpAccessEntity,IpAccessRequest, IpAccessResponse>
-
findByUid
- Specified by:
findByUidin classBaseRestService<IpAccessEntity,IpAccessRequest, IpAccessResponse>
-
existsByUid
-
create
记录IP访问(原 recordAccess 功能迁移至此)- Specified by:
createin classBaseRestService<IpAccessEntity,IpAccessRequest, IpAccessResponse> - Parameters:
request- IpAccessRequest,需包含 ip, endpoint, httpMethod, params- Returns:
- IpAccessResponse
-
update
- Specified by:
updatein classBaseRestService<IpAccessEntity,IpAccessRequest, IpAccessResponse>
-
doSave
Description copied from class:BaseRestService子类实现具体的保存逻辑- Specified by:
doSavein classBaseRestService<IpAccessEntity,IpAccessRequest, IpAccessResponse>
-
handleOptimisticLockingFailureException
public IpAccessEntity handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, IpAccessEntity entity) - Specified by:
handleOptimisticLockingFailureExceptionin classBaseRestService<IpAccessEntity,IpAccessRequest, IpAccessResponse>
-
deleteByUid
- Specified by:
deleteByUidin classBaseRestService<IpAccessEntity,IpAccessRequest, IpAccessResponse>
-
delete
- Specified by:
deletein classBaseRestService<IpAccessEntity,IpAccessRequest, IpAccessResponse>
-
convertToResponse
- Specified by:
convertToResponsein classBaseRestService<IpAccessEntity,IpAccessRequest, IpAccessResponse>
-
createIpAccessRequest
public IpAccessRequest createIpAccessRequest(String ip, String endpoint, String httpMethod, String params) 创建IP访问请求对象- Parameters:
ip- IP地址endpoint- 访问端点httpMethod- HTTP方法params- 请求参数- Returns:
- IpAccessRequest
-
createIpAccessEntity
private IpAccessEntity createIpAccessEntity(String ip, String endpoint, String httpMethod, String params, ZonedDateTime now) 创建IP访问实体- Parameters:
ip- IP地址endpoint- 访问端点httpMethod- HTTP方法params- 请求参数now- 当前时间- Returns:
- IpAccessEntity
-