2024-03-06 20:56:22 +08:00
|
|
|
package com.ai.da.service;
|
|
|
|
|
|
2024-03-15 15:38:56 +08:00
|
|
|
|
2024-03-26 14:58:43 +08:00
|
|
|
import com.ai.da.common.enums.CreditsEventsEnum;
|
2024-03-15 15:38:56 +08:00
|
|
|
import com.ai.da.common.response.PageBaseResponse;
|
|
|
|
|
import com.ai.da.mapper.primary.entity.CreditsDetail;
|
|
|
|
|
import com.ai.da.model.dto.QueryIncomeOrExpenditureDTO;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
|
|
|
2025-06-30 12:03:23 +08:00
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
2024-03-15 15:38:56 +08:00
|
|
|
public interface CreditsService extends IService<CreditsDetail> {
|
2024-03-06 20:56:22 +08:00
|
|
|
|
2024-05-31 16:28:23 +08:00
|
|
|
Boolean buyCredits(Long accountId, Float quantity);
|
2024-03-06 20:56:22 +08:00
|
|
|
|
|
|
|
|
void creditsIncrease(Long accountId, String event);
|
|
|
|
|
|
|
|
|
|
void creditsDecrease(Long accountId, String event);
|
|
|
|
|
|
2024-03-26 14:58:43 +08:00
|
|
|
String getCredits(Long accountId);
|
2024-03-06 20:56:22 +08:00
|
|
|
|
2024-11-19 16:00:30 +08:00
|
|
|
void creditsRefund(Long accountId, Integer quantity, String orderNo);
|
2024-03-15 15:38:56 +08:00
|
|
|
|
2024-11-19 16:00:30 +08:00
|
|
|
void insertToCreditsDetail(Long accountId, String changeEvent, String credits, String changeType, String orderNo);
|
2024-03-15 15:38:56 +08:00
|
|
|
|
|
|
|
|
PageBaseResponse<CreditsDetail> queryCreditsDetailsPage(QueryIncomeOrExpenditureDTO queryPageByTimeDTO);
|
2024-03-26 14:58:43 +08:00
|
|
|
|
|
|
|
|
Boolean checkCredits(Long accountId, CreditsEventsEnum event, Integer num);
|
2024-03-28 14:43:36 +08:00
|
|
|
|
|
|
|
|
Boolean creditsPreDeduction(CreditsEventsEnum event, Integer num);
|
|
|
|
|
|
2025-04-23 10:14:15 +08:00
|
|
|
Boolean creditsPreDeduction(Integer credits);
|
|
|
|
|
|
2024-06-20 15:26:22 +08:00
|
|
|
void addRecordToCreditsDeduction(Long accountId, String taskId, CreditsEventsEnum creditsEventsEnum);
|
|
|
|
|
|
2025-07-07 18:32:14 +08:00
|
|
|
void addRecordToCreditsDeduction(Long accountId, String taskId, CreditsEventsEnum creditsEventsEnum, Integer num);
|
|
|
|
|
|
2024-06-25 12:18:18 +08:00
|
|
|
Boolean taskCreditsDeduction(Long accountId, String taskId);
|
2024-06-20 10:27:04 +08:00
|
|
|
|
|
|
|
|
CreditsDetail getByAccountIdAndChangeEvent(Long accountId, String changeEvent, String changedCredits);
|
2024-06-25 12:18:18 +08:00
|
|
|
|
2024-09-27 15:40:30 +08:00
|
|
|
void preInsert(Long accountId, String changeEventName, String taskId, Boolean isPreInsert, String changedCredits);
|
2024-06-25 12:18:18 +08:00
|
|
|
|
|
|
|
|
void updateChangedCredits(String accountId, String taskId);
|
2025-02-06 14:09:15 +08:00
|
|
|
|
|
|
|
|
CreditsDetail queryDetailByTaskId(String taskId);
|
2025-06-30 12:03:23 +08:00
|
|
|
|
|
|
|
|
void tokenUsage(Long accountId, BigDecimal totalTokenUsage);
|
2024-03-06 20:56:22 +08:00
|
|
|
}
|