大量后端代码格式化

This commit is contained in:
SunCheng
2026-01-18 22:04:56 +08:00
parent 298ce03aa6
commit 4e2bf0da6c
36 changed files with 278 additions and 200 deletions

View File

@@ -1,8 +1,4 @@
namespace WebApi.Controllers;
using System.Text.Json;
using System.Text.Json.Nodes;
using Repository;
namespace WebApi.Controllers;
[ApiController]
[Route("api/[controller]/[action]")]
@@ -183,10 +179,8 @@ public class TransactionRecordController(
{
return BaseResponse.Done();
}
else
{
return "创建交易记录失败".Fail();
}
return "创建交易记录失败".Fail();
}
catch (Exception ex)
{
@@ -225,10 +219,8 @@ public class TransactionRecordController(
{
return BaseResponse.Done();
}
else
{
return "更新交易记录失败".Fail();
}
return "更新交易记录失败".Fail();
}
catch (Exception ex)
{
@@ -250,10 +242,8 @@ public class TransactionRecordController(
{
return BaseResponse.Done();
}
else
{
return "删除交易记录失败,记录不存在".Fail();
}
return "删除交易记录失败,记录不存在".Fail();
}
catch (Exception ex)
{
@@ -413,7 +403,7 @@ public class TransactionRecordController(
return;
}
await smartHandleService.AnalyzeBillAsync(request.UserInput, async (chunk) =>
await smartHandleService.AnalyzeBillAsync(request.UserInput, async chunk =>
{
await WriteEventAsync(chunk);
});
@@ -500,7 +490,7 @@ public class TransactionRecordController(
return;
}
await smartHandleService.SmartClassifyAsync(request.TransactionIds.ToArray(), async (chunk) =>
await smartHandleService.SmartClassifyAsync(request.TransactionIds.ToArray(), async chunk =>
{
var (eventType, content) = chunk;
await TrySetUnconfirmedAsync(eventType, content);
@@ -550,7 +540,6 @@ public class TransactionRecordController(
catch (Exception ex)
{
logger.LogError(ex, "解析智能分类结果失败,内容: {Content}", content);
return;
}
}
@@ -746,7 +735,18 @@ public record CreateTransactionDto(
decimal Amount,
TransactionType Type,
string? Classify
);
)
{
public string OccurredAt { get; init; } = OccurredAt;
public string? Reason { get; init; } = Reason;
public decimal Amount { get; init; } = Amount;
public TransactionType Type { get; init; } = Type;
public string? Classify { get; init; } = Classify;
}
/// <summary>
/// 更新交易记录DTO
@@ -758,7 +758,20 @@ public record UpdateTransactionDto(
decimal Balance,
TransactionType Type,
string? Classify
);
)
{
public long Id { get; init; } = Id;
public string? Reason { get; init; } = Reason;
public decimal Amount { get; init; } = Amount;
public decimal Balance { get; init; } = Balance;
public TransactionType Type { get; init; } = Type;
public string? Classify { get; init; } = Classify;
}
/// <summary>
/// 日历统计响应DTO
@@ -769,14 +782,28 @@ public record DailyStatisticsDto(
decimal Expense,
decimal Income,
decimal Balance
);
)
{
public string Date { get; init; } = Date;
public int Count { get; init; } = Count;
public decimal Expense { get; init; } = Expense;
public decimal Income { get; init; } = Income;
public decimal Balance { get; init; } = Balance;
}
/// <summary>
/// 智能分类请求DTO
/// </summary>
public record SmartClassifyRequest(
List<long>? TransactionIds = null
);
)
{
public List<long>? TransactionIds { get; init; } = TransactionIds;
}
/// <summary>
/// 批量更新分类项DTO
@@ -785,7 +812,14 @@ public record BatchUpdateClassifyItem(
long Id,
string? Classify,
TransactionType? Type = null
);
)
{
public long Id { get; init; } = Id;
public string? Classify { get; init; } = Classify;
public TransactionType? Type { get; init; } = Type;
}
/// <summary>
/// 按摘要批量更新DTO
@@ -794,14 +828,24 @@ public record BatchUpdateByReasonDto(
string Reason,
TransactionType Type,
string Classify
);
)
{
public string Reason { get; init; } = Reason;
public TransactionType Type { get; init; } = Type;
public string Classify { get; init; } = Classify;
}
/// <summary>
/// 账单分析请求DTO
/// </summary>
public record BillAnalysisRequest(
string UserInput
);
)
{
public string UserInput { get; init; } = UserInput;
}
/// <summary>
/// 抵账请求DTO
@@ -809,13 +853,23 @@ public record BillAnalysisRequest(
public record OffsetTransactionDto(
long Id1,
long Id2
);
)
{
public long Id1 { get; init; } = Id1;
public long Id2 { get; init; } = Id2;
}
public record ParseOneLineRequestDto(
string Text
);
)
{
public string Text { get; init; } = Text;
}
public record ConfirmAllUnconfirmedRequestDto(
long[] Ids
);
)
{
public long[] Ids { get; init; } = Ids;
}