chore: initialize qiming workspace repository
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.xspaceagi</groupId>
|
||||
<artifactId>app-platform-pricing</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>app-platform-pricing-sdk</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xspaceagi</groupId>
|
||||
<artifactId>app-platform-pricing-spec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.xspaceagi.pricing.sdk.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(description = "模型阶梯价格配置")
|
||||
public class ModelPriceTierDTO implements Serializable {
|
||||
|
||||
@Schema(description = "档位ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模型ID")
|
||||
private Long modelId;
|
||||
|
||||
@Schema(description = "空间ID", hidden = true)
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "上下文长度(如32代表32k)")
|
||||
private Integer contextLength;
|
||||
|
||||
@Schema(description = "输入价格")
|
||||
private BigDecimal inputPrice;
|
||||
|
||||
@Schema(description = "输出价格")
|
||||
private BigDecimal outputPrice;
|
||||
|
||||
@Schema(description = "缓存价格")
|
||||
private BigDecimal cachePrice;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date created;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date modified;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.xspaceagi.pricing.sdk.dto;
|
||||
|
||||
import com.xspaceagi.pricing.spec.enums.TargetTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class PriceEstimate {
|
||||
private boolean pass;
|
||||
private String message;
|
||||
private TargetTypeEnum targetType;
|
||||
private String targetId;
|
||||
private Object subscription;
|
||||
private Long resourceBillUserId;//临时传递数据
|
||||
private List<PricingConfigDTO> pricingConfigs;
|
||||
private boolean trial;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public static class EstimateTarget {
|
||||
|
||||
private TargetTypeEnum targetType;
|
||||
private String targetId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.xspaceagi.pricing.sdk.dto;
|
||||
|
||||
import com.xspaceagi.pricing.spec.enums.PricingTypeEnum;
|
||||
import com.xspaceagi.pricing.spec.enums.TargetTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "定价配置")
|
||||
public class PricingConfigDTO implements Serializable {
|
||||
|
||||
@Schema(description = "配置ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "定价对象类型")
|
||||
private TargetTypeEnum targetType;
|
||||
|
||||
@Schema(description = "定价对象ID")
|
||||
private String targetId;
|
||||
|
||||
@Schema(description = "定价类型:ONE_TIME-单次,BUYOUT-买断,MONTHLY-包月,SUBSCRIPTION_PLAN-订阅计划,TIERED-阶梯计费")
|
||||
private PricingTypeEnum pricingType;
|
||||
|
||||
@Schema(description = "价格(单次、买断、包月时有效)")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "可试用次数,0=不支持试用")
|
||||
private Integer trialCount;
|
||||
|
||||
@Schema(description = "状态:0-禁用(关闭付费),1-启用(开启收费)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "工作空间ID,默认-1")
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date created;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date modified;
|
||||
|
||||
@Schema(description = "定价对象信息")
|
||||
private TargetObjectInfo targetObjectInfo;
|
||||
|
||||
@Schema(description = "模型阶梯价格配置")
|
||||
private List<ModelPriceTierDTO> modelPriceTiers;
|
||||
|
||||
@Schema(description = "订阅计划")
|
||||
private List<Object> plans;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.xspaceagi.pricing.sdk.dto;
|
||||
|
||||
import com.xspaceagi.pricing.spec.enums.PricingTypeEnum;
|
||||
import com.xspaceagi.pricing.spec.enums.TargetTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "定价配置查询请求")
|
||||
public class PricingConfigQueryRequest implements Serializable {
|
||||
|
||||
@Schema(description = "租户ID", requiredMode = Schema.RequiredMode.REQUIRED, hidden = true)
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "定价对象类型")
|
||||
private TargetTypeEnum targetType;
|
||||
|
||||
@Schema(description = "定价对象类型列表,比如查询工具列表下面包含了 MCP、PLUGIN、WORKFLOW")
|
||||
private List<TargetTypeEnum> targetTypes;
|
||||
|
||||
@Schema(description = "定价对象ID")
|
||||
private String targetId;
|
||||
|
||||
@Schema(description = "定价类型")
|
||||
private PricingTypeEnum pricingType;
|
||||
|
||||
@Schema(description = "状态:0-禁用,1-启用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "工作空间ID,系统管理端传-1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long spaceId;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.xspaceagi.pricing.sdk.dto;
|
||||
|
||||
import com.xspaceagi.pricing.spec.enums.TargetTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Schema(description = "查询定价信息请求")
|
||||
public class QueryPricingInfoRequest implements Serializable {
|
||||
|
||||
@Schema(description = "租户ID", requiredMode = Schema.RequiredMode.REQUIRED, hidden = true)
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private TargetTypeEnum targetType;
|
||||
|
||||
@Schema(description = "业务对象ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String targetId;
|
||||
|
||||
@Schema(description = "是否返回业务对象信息")
|
||||
private Boolean showTargetObjectInfo;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.xspaceagi.pricing.sdk.dto;
|
||||
|
||||
import com.xspaceagi.pricing.spec.enums.PricingTypeEnum;
|
||||
import com.xspaceagi.pricing.spec.enums.TargetTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Schema(description = "保存定价配置请求")
|
||||
public class SavePricingConfigRequest implements Serializable {
|
||||
|
||||
@Schema(description = "租户ID", requiredMode = Schema.RequiredMode.REQUIRED, hidden = true)
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "配置ID,传值则为更新", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "定价对象类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private TargetTypeEnum targetType;
|
||||
|
||||
@Schema(description = "定价对象ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String targetId;
|
||||
|
||||
@Schema(description = "定价类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private PricingTypeEnum pricingType;
|
||||
|
||||
@Schema(description = "价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "可试用次数")
|
||||
private Integer trialCount;
|
||||
|
||||
@Schema(description = "状态:0-禁用,1-启用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "工作空间ID,默认-1,工作空间下的定价管理时,该字段为必须")
|
||||
private Long spaceId;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xspaceagi.pricing.sdk.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TargetObjectInfo {
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private String icon;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.xspaceagi.pricing.sdk.dto;
|
||||
|
||||
import com.xspaceagi.pricing.spec.enums.TargetTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(description = "试用次数记录")
|
||||
public class TrialRecordDTO implements Serializable {
|
||||
|
||||
@Schema(description = "记录ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "业务类型")
|
||||
private TargetTypeEnum targetType;
|
||||
|
||||
@Schema(description = "业务对象ID")
|
||||
private String targetId;
|
||||
|
||||
@Schema(description = "已使用次数")
|
||||
private Integer usedCount;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date created;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date modified;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.xspaceagi.pricing.sdk.dto;
|
||||
|
||||
import com.xspaceagi.pricing.spec.enums.TargetTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Schema(description = "更新试用次数请求")
|
||||
public class UpdateTrialCountRequest implements Serializable {
|
||||
|
||||
@Schema(description = "租户ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private TargetTypeEnum targetType;
|
||||
|
||||
@Schema(description = "业务对象ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String targetId;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.xspaceagi.pricing.sdk.rpc;
|
||||
|
||||
import com.xspaceagi.pricing.sdk.dto.*;
|
||||
import com.xspaceagi.pricing.spec.enums.TargetTypeEnum;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IPricingRpcService {
|
||||
|
||||
/**
|
||||
* 创建或更新定价配置(按 targetType + targetId 唯一)
|
||||
*/
|
||||
Long savePricingConfig(SavePricingConfigRequest request);
|
||||
|
||||
/**
|
||||
* 查询定价配置列表(可根据类型筛选)
|
||||
*/
|
||||
List<PricingConfigDTO> listPricingConfigs(PricingConfigQueryRequest request);
|
||||
|
||||
/**
|
||||
* 查询定价配置列表(按 targetType + targetId 唯一)
|
||||
*/
|
||||
List<PricingConfigDTO> listPricingConfigs(TargetTypeEnum targetType, List<String> targetIds);
|
||||
|
||||
|
||||
PriceEstimate estimatePrice(Long tenantId, Long userId, List<PriceEstimate.EstimateTarget> estimateTargets);
|
||||
|
||||
/**
|
||||
* 新增模型价格档位
|
||||
*/
|
||||
Long addModelPriceTier(ModelPriceTierDTO dto);
|
||||
|
||||
/**
|
||||
* 修改模型价格档位
|
||||
*/
|
||||
boolean updateModelPriceTier(ModelPriceTierDTO dto);
|
||||
|
||||
/**
|
||||
* 删除模型价格档位
|
||||
*/
|
||||
boolean deleteModelPriceTier(Long tenantId, Long id);
|
||||
|
||||
/**
|
||||
* 查询模型价格档位列表
|
||||
*/
|
||||
List<ModelPriceTierDTO> listModelPriceTiers(Long tenantId, Long modelId);
|
||||
|
||||
/**
|
||||
* 更新试用次数(试用+1),返回更新后的试用记录
|
||||
*/
|
||||
TrialRecordDTO updateTrialCount(UpdateTrialCountRequest request);
|
||||
|
||||
/**
|
||||
* 查询试用次数
|
||||
*/
|
||||
TrialRecordDTO getTrialCount(UpdateTrialCountRequest request);
|
||||
|
||||
/**
|
||||
* 查询指定对象的定价信息(含关联对象详情和模型档位)
|
||||
*/
|
||||
PricingConfigDTO queryPricingInfo(QueryPricingInfoRequest request);
|
||||
}
|
||||
Reference in New Issue
Block a user