mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-06 21:37:56 +08:00
[fix] 添加客户端令牌桶
This commit is contained in:
parent
6c7f6b807f
commit
dd6daa5421
@ -1,5 +1,6 @@
|
|||||||
package org.framework.lazy.cloud.network.heartbeat.client.config;
|
package org.framework.lazy.cloud.network.heartbeat.client.config;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@ -29,6 +30,19 @@ public class NettyClientProperties {
|
|||||||
*/
|
*/
|
||||||
private String clientId;
|
private String clientId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌key
|
||||||
|
*/
|
||||||
|
private String appKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌密钥
|
||||||
|
*/
|
||||||
|
private String appSecret;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否开启 默认是
|
* 是否开启 默认是
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,109 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.application;
|
||||||
|
|
||||||
|
import org.wu.framework.web.response.Result;
|
||||||
|
import org.wu.framework.web.response.ResultFactory;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.token.bucket.LazyNettyClientTokenBucket;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketRemoveCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketStoryCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketUpdateCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketQueryListCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketQueryOneCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyNettyClientTokenBucketDTO;
|
||||||
|
import java.util.List;
|
||||||
|
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplication
|
||||||
|
**/
|
||||||
|
|
||||||
|
public interface LazyNettyClientTokenBucketApplication {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 新增客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketStoryCommand 新增客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶新增后领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<LazyNettyClientTokenBucket> story(LazyNettyClientTokenBucketStoryCommand lazyNettyClientTokenBucketStoryCommand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 批量新增客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketStoryCommandList 批量新增客户端令牌桶
|
||||||
|
* @return {@link Result<List<LazyNettyClientTokenBucket>>} 客户端令牌桶新增后领域对象集合
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<List<LazyNettyClientTokenBucket>> batchStory(List<LazyNettyClientTokenBucketStoryCommand> lazyNettyClientTokenBucketStoryCommandList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 更新客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketUpdateCommand 更新客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<LazyNettyClientTokenBucket> updateOne(LazyNettyClientTokenBucketUpdateCommand lazyNettyClientTokenBucketUpdateCommand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 查询单个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketQueryOneCommand 查询单个客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucketDTO>} 客户端令牌桶DTO对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<LazyNettyClientTokenBucketDTO> findOne(LazyNettyClientTokenBucketQueryOneCommand lazyNettyClientTokenBucketQueryOneCommand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 查询多个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketQueryListCommand 查询多个客户端令牌桶
|
||||||
|
* @return {@link Result <List<LazyNettyClientTokenBucketDTO>>} 客户端令牌桶DTO对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result <List<LazyNettyClientTokenBucketDTO>> findList(LazyNettyClientTokenBucketQueryListCommand lazyNettyClientTokenBucketQueryListCommand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 分页查询多个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketQueryListCommand 分页查询多个客户端令牌桶
|
||||||
|
* @return {@link Result <LazyPage<LazyNettyClientTokenBucketDTO>>} 分页客户端令牌桶DTO对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result <LazyPage<LazyNettyClientTokenBucketDTO>> findPage(int size,int current,LazyNettyClientTokenBucketQueryListCommand lazyNettyClientTokenBucketQueryListCommand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 删除客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketRemoveCommand 删除客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<LazyNettyClientTokenBucket> remove(LazyNettyClientTokenBucketRemoveCommand lazyNettyClientTokenBucketRemoveCommand);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.application.assembler;
|
||||||
|
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.token.bucket.LazyNettyClientTokenBucket;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketRemoveCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketStoryCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketUpdateCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketQueryListCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketQueryOneCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyNettyClientTokenBucketDTO;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface LazyNettyClientTokenBucketDTOAssembler {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe MapStruct 创建的代理对象
|
||||||
|
*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
LazyNettyClientTokenBucketDTOAssembler INSTANCE = Mappers.getMapper(LazyNettyClientTokenBucketDTOAssembler.class);
|
||||||
|
/**
|
||||||
|
* describe 应用层存储入参转换成 领域对象
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketStoryCommand 保存客户端令牌桶对象
|
||||||
|
* @return {@link LazyNettyClientTokenBucket} 客户端令牌桶领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
LazyNettyClientTokenBucket toLazyNettyClientTokenBucket(LazyNettyClientTokenBucketStoryCommand lazyNettyClientTokenBucketStoryCommand);
|
||||||
|
/**
|
||||||
|
* describe 应用层更新入参转换成 领域对象
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketUpdateCommand 更新客户端令牌桶对象
|
||||||
|
* @return {@link LazyNettyClientTokenBucket} 客户端令牌桶领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
LazyNettyClientTokenBucket toLazyNettyClientTokenBucket(LazyNettyClientTokenBucketUpdateCommand lazyNettyClientTokenBucketUpdateCommand);
|
||||||
|
/**
|
||||||
|
* describe 应用层查询入参转换成 领域对象
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketQueryOneCommand 查询单个客户端令牌桶对象参数
|
||||||
|
* @return {@link LazyNettyClientTokenBucket} 客户端令牌桶领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
LazyNettyClientTokenBucket toLazyNettyClientTokenBucket(LazyNettyClientTokenBucketQueryOneCommand lazyNettyClientTokenBucketQueryOneCommand);
|
||||||
|
/**
|
||||||
|
* describe 应用层查询入参转换成 领域对象
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketQueryListCommand 查询集合客户端令牌桶对象参数
|
||||||
|
* @return {@link LazyNettyClientTokenBucket} 客户端令牌桶领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
LazyNettyClientTokenBucket toLazyNettyClientTokenBucket(LazyNettyClientTokenBucketQueryListCommand lazyNettyClientTokenBucketQueryListCommand);
|
||||||
|
/**
|
||||||
|
* describe 应用层删除入参转换成 领域对象
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketRemoveCommand 删除客户端令牌桶对象参数
|
||||||
|
* @return {@link LazyNettyClientTokenBucket} 客户端令牌桶领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
LazyNettyClientTokenBucket toLazyNettyClientTokenBucket(LazyNettyClientTokenBucketRemoveCommand lazyNettyClientTokenBucketRemoveCommand);
|
||||||
|
/**
|
||||||
|
* describe 持久层领域对象转换成DTO对象
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 客户端令牌桶领域对象
|
||||||
|
* @return {@link LazyNettyClientTokenBucketDTO} 客户端令牌桶DTO对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
LazyNettyClientTokenBucketDTO fromLazyNettyClientTokenBucket(LazyNettyClientTokenBucket lazyNettyClientTokenBucket);
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.lang.Long;
|
||||||
|
import java.lang.Boolean;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryListCommand
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(title = "lazy_netty_client_token_bucket_query_List_command",description = "客户端令牌桶")
|
||||||
|
public class LazyNettyClientTokenBucketQueryListCommand {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌key
|
||||||
|
*/
|
||||||
|
@Schema(description ="令牌key",name ="appKey",example = "")
|
||||||
|
private String appKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌密钥
|
||||||
|
*/
|
||||||
|
@Schema(description ="令牌密钥",name ="appSecret",example = "")
|
||||||
|
private String appSecret;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Schema(description ="描述",name ="describe",example = "")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="过期时间",name ="expireInTime",example = "")
|
||||||
|
private LocalDateTime expireInTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@Schema(description ="主键ID",name ="id",example = "")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||||
|
private Boolean isDeleted=false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="更新时间",name ="updateTime",example = "")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 被使用的客户端ID
|
||||||
|
*/
|
||||||
|
@Schema(description ="被使用的客户端ID",name ="usedByClientId",example = "")
|
||||||
|
private String usedByClientId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.lang.Long;
|
||||||
|
import java.lang.Boolean;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryOneCommand
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(title = "lazy_netty_client_token_bucket_query_one_command",description = "客户端令牌桶")
|
||||||
|
public class LazyNettyClientTokenBucketQueryOneCommand {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌key
|
||||||
|
*/
|
||||||
|
@Schema(description ="令牌key",name ="appKey",example = "")
|
||||||
|
private String appKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌密钥
|
||||||
|
*/
|
||||||
|
@Schema(description ="令牌密钥",name ="appSecret",example = "")
|
||||||
|
private String appSecret;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Schema(description ="描述",name ="describe",example = "")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="过期时间",name ="expireInTime",example = "")
|
||||||
|
private LocalDateTime expireInTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@Schema(description ="主键ID",name ="id",example = "")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||||
|
private Boolean isDeleted=false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="更新时间",name ="updateTime",example = "")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 被使用的客户端ID
|
||||||
|
*/
|
||||||
|
@Schema(description ="被使用的客户端ID",name ="usedByClientId",example = "")
|
||||||
|
private String usedByClientId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.lang.Long;
|
||||||
|
import java.lang.Boolean;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyRemoveCommand
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(title = "lazy_netty_client_token_bucket_remove_command",description = "客户端令牌桶")
|
||||||
|
public class LazyNettyClientTokenBucketRemoveCommand {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌key
|
||||||
|
*/
|
||||||
|
@Schema(description ="令牌key",name ="appKey",example = "")
|
||||||
|
private String appKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌密钥
|
||||||
|
*/
|
||||||
|
@Schema(description ="令牌密钥",name ="appSecret",example = "")
|
||||||
|
private String appSecret;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Schema(description ="描述",name ="describe",example = "")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="过期时间",name ="expireInTime",example = "")
|
||||||
|
private LocalDateTime expireInTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@Schema(description ="主键ID",name ="id",example = "")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||||
|
private Boolean isDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="更新时间",name ="updateTime",example = "")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 被使用的客户端ID
|
||||||
|
*/
|
||||||
|
@Schema(description ="被使用的客户端ID",name ="usedByClientId",example = "")
|
||||||
|
private String usedByClientId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.lang.Long;
|
||||||
|
import java.lang.Boolean;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyStoryCommand
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(title = "lazy_netty_client_token_bucket_story_command",description = "客户端令牌桶")
|
||||||
|
public class LazyNettyClientTokenBucketStoryCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Schema(description ="描述",name ="describe",example = "")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@Schema(description ="过期时间",name ="expireInTime",example = "")
|
||||||
|
private LocalDateTime expireInTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||||
|
private Boolean isDeleted=false;
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.lang.Long;
|
||||||
|
import java.lang.Boolean;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyUpdateCommand
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(title = "lazy_netty_client_token_bucket_update_command",description = "客户端令牌桶")
|
||||||
|
public class LazyNettyClientTokenBucketUpdateCommand {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌key
|
||||||
|
*/
|
||||||
|
@Schema(description ="令牌key",name ="appKey",example = "")
|
||||||
|
private String appKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌密钥
|
||||||
|
*/
|
||||||
|
@Schema(description ="令牌密钥",name ="appSecret",example = "")
|
||||||
|
private String appSecret;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 被使用的客户端ID
|
||||||
|
*/
|
||||||
|
@Schema(description ="被使用的客户端ID",name ="usedByClientId",example = "")
|
||||||
|
private String usedByClientId;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Schema(description ="描述",name ="describe",example = "")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="过期时间",name ="expireInTime",example = "")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private LocalDateTime expireInTime;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||||
|
private Boolean isDeleted=false;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDTO
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(title = "lazy_netty_client_token_bucket_command_dto", description = "客户端令牌桶")
|
||||||
|
public class LazyNettyClientTokenBucketDTO {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 令牌key
|
||||||
|
*/
|
||||||
|
@Schema(description = "令牌key", name = "appKey", example = "")
|
||||||
|
private String appKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 令牌密钥
|
||||||
|
*/
|
||||||
|
@Schema(description = "令牌密钥", name = "appSecret", example = "")
|
||||||
|
private String appSecret;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Schema(description = "描述", name = "describe", example = "")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@Schema(description = "过期时间", name = "expireInTime", example = "")
|
||||||
|
private LocalDateTime expireInTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "主键ID", name = "id", example = "")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||||
|
private Boolean isDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被使用的客户端ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "被使用的客户端ID", name = "usedByClientId", example = "")
|
||||||
|
private String usedByClientId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,146 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.application.impl;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.LazyNettyClientTokenBucketApplication;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.assembler.LazyNettyClientTokenBucketDTOAssembler;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.*;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyNettyClientTokenBucketDTO;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.token.bucket.LazyNettyClientTokenBucket;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketRepository;
|
||||||
|
import org.wu.framework.database.lazy.web.plus.stereotype.LazyApplication;
|
||||||
|
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||||
|
import org.wu.framework.web.response.Result;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplicationImpl
|
||||||
|
**/
|
||||||
|
@LazyApplication
|
||||||
|
public class LazyNettyClientTokenBucketApplicationImpl implements LazyNettyClientTokenBucketApplication {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
LazyNettyClientTokenBucketRepository lazyNettyClientTokenBucketRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 新增客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketStoryCommand 新增客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶新增后领域对象
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LazyNettyClientTokenBucket> story(LazyNettyClientTokenBucketStoryCommand lazyNettyClientTokenBucketStoryCommand) {
|
||||||
|
LazyNettyClientTokenBucket lazyNettyClientTokenBucket = LazyNettyClientTokenBucketDTOAssembler.INSTANCE.toLazyNettyClientTokenBucket(lazyNettyClientTokenBucketStoryCommand);
|
||||||
|
// 创建 appKey、appSecret
|
||||||
|
lazyNettyClientTokenBucket.setAppKey(UUID.randomUUID().toString());
|
||||||
|
lazyNettyClientTokenBucket.setAppSecret(UUID.randomUUID().toString());
|
||||||
|
return lazyNettyClientTokenBucketRepository.story(lazyNettyClientTokenBucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 批量新增客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketStoryCommandList 批量新增客户端令牌桶
|
||||||
|
* @return {@link Result<List<LazyNettyClientTokenBucket>>} 客户端令牌桶新增后领域对象集合
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<LazyNettyClientTokenBucket>> batchStory(List<LazyNettyClientTokenBucketStoryCommand> lazyNettyClientTokenBucketStoryCommandList) {
|
||||||
|
List<LazyNettyClientTokenBucket> lazyNettyClientTokenBucketList = lazyNettyClientTokenBucketStoryCommandList.stream().map(LazyNettyClientTokenBucketDTOAssembler.INSTANCE::toLazyNettyClientTokenBucket).collect(Collectors.toList());
|
||||||
|
for (LazyNettyClientTokenBucket lazyNettyClientTokenBucket : lazyNettyClientTokenBucketList) {
|
||||||
|
// 创建 appKey、appSecret
|
||||||
|
lazyNettyClientTokenBucket.setAppKey(UUID.randomUUID().toString());
|
||||||
|
lazyNettyClientTokenBucket.setAppSecret(UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
|
return lazyNettyClientTokenBucketRepository.batchStory(lazyNettyClientTokenBucketList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 更新客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketUpdateCommand 更新客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶领域对象
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LazyNettyClientTokenBucket> updateOne(LazyNettyClientTokenBucketUpdateCommand lazyNettyClientTokenBucketUpdateCommand) {
|
||||||
|
LazyNettyClientTokenBucket lazyNettyClientTokenBucket = LazyNettyClientTokenBucketDTOAssembler.INSTANCE.toLazyNettyClientTokenBucket(lazyNettyClientTokenBucketUpdateCommand);
|
||||||
|
return lazyNettyClientTokenBucketRepository.story(lazyNettyClientTokenBucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 查询单个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketQueryOneCommand 查询单个客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucketDTO>} 客户端令牌桶DTO对象
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LazyNettyClientTokenBucketDTO> findOne(LazyNettyClientTokenBucketQueryOneCommand lazyNettyClientTokenBucketQueryOneCommand) {
|
||||||
|
LazyNettyClientTokenBucket lazyNettyClientTokenBucket = LazyNettyClientTokenBucketDTOAssembler.INSTANCE.toLazyNettyClientTokenBucket(lazyNettyClientTokenBucketQueryOneCommand);
|
||||||
|
return lazyNettyClientTokenBucketRepository.findOne(lazyNettyClientTokenBucket).convert(LazyNettyClientTokenBucketDTOAssembler.INSTANCE::fromLazyNettyClientTokenBucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 查询多个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketQueryListCommand 查询多个客户端令牌桶
|
||||||
|
* @return {@link Result<List<LazyNettyClientTokenBucketDTO>>} 客户端令牌桶DTO对象
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<LazyNettyClientTokenBucketDTO>> findList(LazyNettyClientTokenBucketQueryListCommand lazyNettyClientTokenBucketQueryListCommand) {
|
||||||
|
LazyNettyClientTokenBucket lazyNettyClientTokenBucket = LazyNettyClientTokenBucketDTOAssembler.INSTANCE.toLazyNettyClientTokenBucket(lazyNettyClientTokenBucketQueryListCommand);
|
||||||
|
lazyNettyClientTokenBucket.setIsDeleted(false);
|
||||||
|
return lazyNettyClientTokenBucketRepository.findList(lazyNettyClientTokenBucket).convert(lazyNettyClientTokenBuckets -> lazyNettyClientTokenBuckets.stream().map(LazyNettyClientTokenBucketDTOAssembler.INSTANCE::fromLazyNettyClientTokenBucket).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 分页查询多个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketQueryListCommand 分页查询多个客户端令牌桶
|
||||||
|
* @return {@link Result<LazyPage<LazyNettyClientTokenBucketDTO>>} 分页客户端令牌桶DTO对象
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LazyPage<LazyNettyClientTokenBucketDTO>> findPage(int size, int current, LazyNettyClientTokenBucketQueryListCommand lazyNettyClientTokenBucketQueryListCommand) {
|
||||||
|
LazyNettyClientTokenBucket lazyNettyClientTokenBucket = LazyNettyClientTokenBucketDTOAssembler.INSTANCE.toLazyNettyClientTokenBucket(lazyNettyClientTokenBucketQueryListCommand);
|
||||||
|
lazyNettyClientTokenBucket.setIsDeleted(false);
|
||||||
|
return lazyNettyClientTokenBucketRepository.findPage(size, current, lazyNettyClientTokenBucket).convert(page -> page.convert(LazyNettyClientTokenBucketDTOAssembler.INSTANCE::fromLazyNettyClientTokenBucket));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 删除客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketRemoveCommand 删除客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LazyNettyClientTokenBucket> remove(LazyNettyClientTokenBucketRemoveCommand lazyNettyClientTokenBucketRemoveCommand) {
|
||||||
|
LazyNettyClientTokenBucket lazyNettyClientTokenBucket = LazyNettyClientTokenBucketDTOAssembler.INSTANCE.toLazyNettyClientTokenBucket(lazyNettyClientTokenBucketRemoveCommand);
|
||||||
|
return lazyNettyClientTokenBucketRepository.remove(lazyNettyClientTokenBucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,142 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.controller;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import org.wu.framework.web.spring.EasyController;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.wu.framework.web.response.Result;
|
||||||
|
import org.wu.framework.web.response.ResultFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.token.bucket.LazyNettyClientTokenBucket;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketRemoveCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketStoryCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketUpdateCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketQueryListCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketQueryOneCommand;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.LazyNettyClientTokenBucketApplication;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyNettyClientTokenBucketDTO;
|
||||||
|
import java.util.List;
|
||||||
|
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController
|
||||||
|
**/
|
||||||
|
@Tag(name = "客户端令牌桶提供者")
|
||||||
|
@EasyController("/lazy/netty/client/token/bucket")
|
||||||
|
public class LazyNettyClientTokenBucketProvider {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LazyNettyClientTokenBucketApplication lazyNettyClientTokenBucketApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 新增客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketStoryCommand 新增客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶新增后领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Operation(summary = "新增客户端令牌桶")
|
||||||
|
@PostMapping("/story")
|
||||||
|
public Result<LazyNettyClientTokenBucket> story(@RequestBody LazyNettyClientTokenBucketStoryCommand lazyNettyClientTokenBucketStoryCommand){
|
||||||
|
return lazyNettyClientTokenBucketApplication.story(lazyNettyClientTokenBucketStoryCommand);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* describe 批量新增客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketStoryCommandList 批量新增客户端令牌桶
|
||||||
|
* @return {@link Result<List<LazyNettyClientTokenBucket>>} 客户端令牌桶新增后领域对象集合
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Operation(summary = "批量新增客户端令牌桶")
|
||||||
|
@PostMapping("/batchStory")
|
||||||
|
public Result<List<LazyNettyClientTokenBucket>> batchStory(@RequestBody List<LazyNettyClientTokenBucketStoryCommand> lazyNettyClientTokenBucketStoryCommandList){
|
||||||
|
return lazyNettyClientTokenBucketApplication.batchStory(lazyNettyClientTokenBucketStoryCommandList);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* describe 更新客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketUpdateCommand 更新客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Operation(summary = "更新客户端令牌桶")
|
||||||
|
@PutMapping("/updateOne")
|
||||||
|
public Result<LazyNettyClientTokenBucket> updateOne(@RequestBody LazyNettyClientTokenBucketUpdateCommand lazyNettyClientTokenBucketUpdateCommand){
|
||||||
|
return lazyNettyClientTokenBucketApplication.updateOne(lazyNettyClientTokenBucketUpdateCommand);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* describe 查询单个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketQueryOneCommand 查询单个客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucketDTO>} 客户端令牌桶DTO对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Operation(summary = "查询单个客户端令牌桶")
|
||||||
|
@GetMapping("/findOne")
|
||||||
|
public Result<LazyNettyClientTokenBucketDTO> findOne(@ModelAttribute LazyNettyClientTokenBucketQueryOneCommand lazyNettyClientTokenBucketQueryOneCommand){
|
||||||
|
return lazyNettyClientTokenBucketApplication.findOne(lazyNettyClientTokenBucketQueryOneCommand);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* describe 查询多个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketQueryListCommand 查询多个客户端令牌桶
|
||||||
|
* @return {@link Result<List<LazyNettyClientTokenBucketDTO>>} 客户端令牌桶DTO对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Operation(summary = "查询多个客户端令牌桶")
|
||||||
|
@GetMapping("/findList")
|
||||||
|
public Result<List<LazyNettyClientTokenBucketDTO>> findList(@ModelAttribute LazyNettyClientTokenBucketQueryListCommand lazyNettyClientTokenBucketQueryListCommand){
|
||||||
|
return lazyNettyClientTokenBucketApplication.findList(lazyNettyClientTokenBucketQueryListCommand);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* describe 分页查询多个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketQueryListCommand 分页查询多个客户端令牌桶
|
||||||
|
* @return {@link Result<LazyPage<LazyNettyClientTokenBucketDTO>>} 分页客户端令牌桶DTO对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Operation(summary = "分页查询多个客户端令牌桶")
|
||||||
|
@GetMapping("/findPage")
|
||||||
|
public Result<LazyPage<LazyNettyClientTokenBucketDTO>> findPage(@Parameter(description ="分页大小") @RequestParam(defaultValue = "10", value = "size") int size,
|
||||||
|
@Parameter(description ="当前页数") @RequestParam(defaultValue = "1", value = "current") int current,@ModelAttribute LazyNettyClientTokenBucketQueryListCommand lazyNettyClientTokenBucketQueryListCommand){
|
||||||
|
return lazyNettyClientTokenBucketApplication.findPage(size,current,lazyNettyClientTokenBucketQueryListCommand);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* describe 删除客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketRemoveCommand 删除客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Operation(summary = "删除客户端令牌桶")
|
||||||
|
@DeleteMapping("/remove")
|
||||||
|
public Result<LazyNettyClientTokenBucket> remove(@ModelAttribute LazyNettyClientTokenBucketRemoveCommand lazyNettyClientTokenBucketRemoveCommand){
|
||||||
|
return lazyNettyClientTokenBucketApplication.remove(lazyNettyClientTokenBucketRemoveCommand);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.token.bucket;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.lang.Long;
|
||||||
|
import java.lang.Boolean;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDomain
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(title = "lazy_netty_client_token_bucket",description = "客户端令牌桶")
|
||||||
|
public class LazyNettyClientTokenBucket {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌key
|
||||||
|
*/
|
||||||
|
@Schema(description ="令牌key",name ="appKey",example = "")
|
||||||
|
private String appKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 令牌密钥
|
||||||
|
*/
|
||||||
|
@Schema(description ="令牌密钥",name ="appSecret",example = "")
|
||||||
|
private String appSecret;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Schema(description ="描述",name ="describe",example = "")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="过期时间",name ="expireInTime",example = "")
|
||||||
|
private LocalDateTime expireInTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@Schema(description ="主键ID",name ="id",example = "")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||||
|
private Boolean isDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Schema(description ="更新时间",name ="updateTime",example = "")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 被使用的客户端ID
|
||||||
|
*/
|
||||||
|
@Schema(description ="被使用的客户端ID",name ="usedByClientId",example = "")
|
||||||
|
private String usedByClientId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.token.bucket;
|
||||||
|
|
||||||
|
import org.wu.framework.web.response.Result;
|
||||||
|
import org.wu.framework.web.response.ResultFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.token.bucket.LazyNettyClientTokenBucket;
|
||||||
|
import java.util.List;
|
||||||
|
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDomainRepository
|
||||||
|
**/
|
||||||
|
|
||||||
|
public interface LazyNettyClientTokenBucketRepository {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 新增客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 新增客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶新增后领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<LazyNettyClientTokenBucket> story(LazyNettyClientTokenBucket lazyNettyClientTokenBucket);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 批量新增客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketList 批量新增客户端令牌桶
|
||||||
|
* @return {@link Result<List<LazyNettyClientTokenBucket>>} 客户端令牌桶新增后领域对象集合
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<List<LazyNettyClientTokenBucket>> batchStory(List<LazyNettyClientTokenBucket> lazyNettyClientTokenBucketList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 查询单个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 查询单个客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶DTO对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<LazyNettyClientTokenBucket> findOne(LazyNettyClientTokenBucket lazyNettyClientTokenBucket);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 查询多个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 查询多个客户端令牌桶
|
||||||
|
* @return {@link Result<List<LazyNettyClientTokenBucket>>} 客户端令牌桶DTO对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<List<LazyNettyClientTokenBucket>> findList(LazyNettyClientTokenBucket lazyNettyClientTokenBucket);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 分页查询多个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param size 当前页数
|
||||||
|
* @param current 当前页
|
||||||
|
* @param lazyNettyClientTokenBucket 分页查询多个客户端令牌桶
|
||||||
|
* @return {@link Result<LazyPage<LazyNettyClientTokenBucket>>} 分页客户端令牌桶领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<LazyPage<LazyNettyClientTokenBucket>> findPage(int size,int current,LazyNettyClientTokenBucket lazyNettyClientTokenBucket);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 删除客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 删除客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<LazyNettyClientTokenBucket> remove(LazyNettyClientTokenBucket lazyNettyClientTokenBucket);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 是否存在客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 是否存在客户端令牌桶
|
||||||
|
* @return {@link Result<Boolean>} 客户端令牌桶是否存在
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
Result<Boolean> exists(LazyNettyClientTokenBucket lazyNettyClientTokenBucket);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.converter;
|
||||||
|
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.token.bucket.LazyNettyClientTokenBucket;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.entity.LazyNettyClientTokenBucketDO;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureConverter
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface LazyNettyClientTokenBucketConverter {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe MapStruct 创建的代理对象
|
||||||
|
*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
LazyNettyClientTokenBucketConverter INSTANCE = Mappers.getMapper(LazyNettyClientTokenBucketConverter.class);
|
||||||
|
/**
|
||||||
|
* describe 实体对象 转换成领域对象
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketDO 客户端令牌桶实体对象
|
||||||
|
* @return {@link LazyNettyClientTokenBucket} 客户端令牌桶领域对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
LazyNettyClientTokenBucket toLazyNettyClientTokenBucket(LazyNettyClientTokenBucketDO lazyNettyClientTokenBucketDO);
|
||||||
|
/**
|
||||||
|
* describe 领域对象 转换成实体对象
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 客户端令牌桶领域对象
|
||||||
|
* @return {@link LazyNettyClientTokenBucketDO} 客户端令牌桶实体对象
|
||||||
|
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
LazyNettyClientTokenBucketDO fromLazyNettyClientTokenBucket(LazyNettyClientTokenBucket lazyNettyClientTokenBucket);
|
||||||
|
}
|
@ -31,7 +31,7 @@ public class LazyNettyClientTokenBucketDO {
|
|||||||
* 令牌key
|
* 令牌key
|
||||||
*/
|
*/
|
||||||
@Schema(description ="令牌key",name ="appKey",example = "")
|
@Schema(description ="令牌key",name ="appKey",example = "")
|
||||||
@LazyTableField(name="app_key",comment="令牌key",columnType="varchar(255)")
|
@LazyTableFieldUnique(name="app_key",comment="令牌key",columnType="varchar(255)")
|
||||||
private String appKey;
|
private String appKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.jpa.lazy;
|
||||||
|
|
||||||
|
import org.wu.framework.lazy.orm.database.jpa.repository.LazyJpaRepository;
|
||||||
|
import org.wu.framework.lazy.orm.database.jpa.repository.annotation.*;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.entity.LazyNettyClientTokenBucketDO;
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureLazyJpa
|
||||||
|
**/
|
||||||
|
@LazyRepository
|
||||||
|
public interface LazyNettyClientTokenBucketLazyJpaRepository extends LazyJpaRepository<LazyNettyClientTokenBucketDO,Long> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureMapper
|
||||||
|
**/
|
||||||
|
|
||||||
|
public interface LazyNettyClientTokenBucketMapper {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,147 @@
|
|||||||
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.persistence;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.token.bucket.LazyNettyClientTokenBucket;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.token.bucket.LazyNettyClientTokenBucketRepository;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.converter.LazyNettyClientTokenBucketConverter;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.entity.LazyNettyClientTokenBucketDO;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||||
|
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
|
||||||
|
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
||||||
|
import org.wu.framework.web.response.Result;
|
||||||
|
import org.wu.framework.web.response.ResultFactory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 客户端令牌桶
|
||||||
|
*
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructurePersistence
|
||||||
|
**/
|
||||||
|
@Repository
|
||||||
|
public class LazyNettyClientTokenBucketRepositoryImpl implements LazyNettyClientTokenBucketRepository {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
LazyLambdaStream lazyLambdaStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 新增客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 新增客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶新增后领域对象
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LazyNettyClientTokenBucket> story(LazyNettyClientTokenBucket lazyNettyClientTokenBucket) {
|
||||||
|
LazyNettyClientTokenBucketDO lazyNettyClientTokenBucketDO = LazyNettyClientTokenBucketConverter.INSTANCE.fromLazyNettyClientTokenBucket(lazyNettyClientTokenBucket);
|
||||||
|
lazyLambdaStream.upsert(lazyNettyClientTokenBucketDO);
|
||||||
|
return ResultFactory.successOf();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 批量新增客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucketList 批量新增客户端令牌桶
|
||||||
|
* @return {@link Result<List<LazyNettyClientTokenBucket>>} 客户端令牌桶新增后领域对象集合
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<LazyNettyClientTokenBucket>> batchStory(List<LazyNettyClientTokenBucket> lazyNettyClientTokenBucketList) {
|
||||||
|
List<LazyNettyClientTokenBucketDO> lazyNettyClientTokenBucketDOList = lazyNettyClientTokenBucketList.stream().map(LazyNettyClientTokenBucketConverter.INSTANCE::fromLazyNettyClientTokenBucket).collect(Collectors.toList());
|
||||||
|
lazyLambdaStream.upsert(lazyNettyClientTokenBucketDOList);
|
||||||
|
return ResultFactory.successOf();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 查询单个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 查询单个客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶领域对象
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LazyNettyClientTokenBucket> findOne(LazyNettyClientTokenBucket lazyNettyClientTokenBucket) {
|
||||||
|
LazyNettyClientTokenBucketDO lazyNettyClientTokenBucketDO = LazyNettyClientTokenBucketConverter.INSTANCE.fromLazyNettyClientTokenBucket(lazyNettyClientTokenBucket);
|
||||||
|
LazyNettyClientTokenBucket lazyNettyClientTokenBucketOne = lazyLambdaStream.selectOne(LazyWrappers.lambdaWrapperBean(lazyNettyClientTokenBucketDO), LazyNettyClientTokenBucket.class);
|
||||||
|
return ResultFactory.successOf(lazyNettyClientTokenBucketOne);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 查询多个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 查询多个客户端令牌桶
|
||||||
|
* @return {@link Result<List<LazyNettyClientTokenBucket>>} 客户端令牌桶领域对象
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<LazyNettyClientTokenBucket>> findList(LazyNettyClientTokenBucket lazyNettyClientTokenBucket) {
|
||||||
|
LazyNettyClientTokenBucketDO lazyNettyClientTokenBucketDO = LazyNettyClientTokenBucketConverter.INSTANCE.fromLazyNettyClientTokenBucket(lazyNettyClientTokenBucket);
|
||||||
|
List<LazyNettyClientTokenBucket> lazyNettyClientTokenBucketList = lazyLambdaStream.selectList(LazyWrappers.lambdaWrapperBean(lazyNettyClientTokenBucketDO), LazyNettyClientTokenBucket.class);
|
||||||
|
return ResultFactory.successOf(lazyNettyClientTokenBucketList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 分页查询多个客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param size 当前页数
|
||||||
|
* @param current 当前页
|
||||||
|
* @param lazyNettyClientTokenBucket 分页查询多个客户端令牌桶
|
||||||
|
* @return {@link Result<LazyPage<LazyNettyClientTokenBucket>>} 分页客户端令牌桶领域对象
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LazyPage<LazyNettyClientTokenBucket>> findPage(int size, int current, LazyNettyClientTokenBucket lazyNettyClientTokenBucket) {
|
||||||
|
LazyNettyClientTokenBucketDO lazyNettyClientTokenBucketDO = LazyNettyClientTokenBucketConverter.INSTANCE.fromLazyNettyClientTokenBucket(lazyNettyClientTokenBucket);
|
||||||
|
LazyPage<LazyNettyClientTokenBucket> lazyPage = new LazyPage<>(current, size);
|
||||||
|
LazyPage<LazyNettyClientTokenBucket> lazyNettyClientTokenBucketLazyPage = lazyLambdaStream.selectPage(LazyWrappers.lambdaWrapperBean(lazyNettyClientTokenBucketDO), lazyPage, LazyNettyClientTokenBucket.class);
|
||||||
|
return ResultFactory.successOf(lazyNettyClientTokenBucketLazyPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 删除客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 删除客户端令牌桶
|
||||||
|
* @return {@link Result<LazyNettyClientTokenBucket>} 客户端令牌桶
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LazyNettyClientTokenBucket> remove(LazyNettyClientTokenBucket lazyNettyClientTokenBucket) {
|
||||||
|
LazyNettyClientTokenBucketDO update = new LazyNettyClientTokenBucketDO();
|
||||||
|
update.setIsDeleted(true);
|
||||||
|
lazyLambdaStream.update(update,LazyWrappers.<LazyNettyClientTokenBucketDO>lambdaWrapper().eq(LazyNettyClientTokenBucketDO::getAppKey, lazyNettyClientTokenBucket.getAppKey()));
|
||||||
|
return ResultFactory.successOf();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe 是否存在客户端令牌桶
|
||||||
|
*
|
||||||
|
* @param lazyNettyClientTokenBucket 客户端令牌桶领域对象
|
||||||
|
* @return {@link Result<Boolean>} 是否存在 true 存在,false 不存在
|
||||||
|
* @author Jia wei Wu
|
||||||
|
* @date 2024/09/28 01:56 下午
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<Boolean> exists(LazyNettyClientTokenBucket lazyNettyClientTokenBucket) {
|
||||||
|
LazyNettyClientTokenBucketDO lazyNettyClientTokenBucketDO = LazyNettyClientTokenBucketConverter.INSTANCE.fromLazyNettyClientTokenBucket(lazyNettyClientTokenBucket);
|
||||||
|
Boolean exists = lazyLambdaStream.exists(LazyWrappers.lambdaWrapperBean(lazyNettyClientTokenBucketDO));
|
||||||
|
return ResultFactory.successOf(exists);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.mapper.LazyNettyClientTokenBucketMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.entity.LazyNettyClientTokenBucketDO">
|
||||||
|
<result column="app_key" property="appKey" />
|
||||||
|
<result column="app_secret" property="appSecret" />
|
||||||
|
<result column="create_time" property="createTime" />
|
||||||
|
<result column="`describe`" property="describe" />
|
||||||
|
<result column="expire_in_time" property="expireInTime" />
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="is_deleted" property="isDeleted" />
|
||||||
|
<result column="update_time" property="updateTime" />
|
||||||
|
<result column="used_by_client_id" property="usedByClientId" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user