refactor: 批量新增枚举类型并完成实体、DTO、服务层枚举替换
- 新增30+业务枚举类型覆盖用户、宠物、商城、社区、积分等模块 - 完成实体类、DTO、服务层的字符串枚举替换为强类型枚举 - 修复用户状态枚举名称变更,将Frozen改为Disabled - 新增批量发布社区消息接口与控制器实现 - 新增操作日志、积分管理、补偿任务相关服务与DTO
This commit is contained in:
@ -3,6 +3,7 @@ using QYZH.InteractiveMagazine.IService;
|
||||
using QYZH.InteractiveMagazine.Models.Common;
|
||||
using QYZH.InteractiveMagazine.Models.Dto;
|
||||
using QYZH.InteractiveMagazine.Models.Entity;
|
||||
using QYZH.InteractiveMagazine.Models.Enum;
|
||||
using QYZH.InteractiveMagazine.Repository;
|
||||
using SqlSugar;
|
||||
|
||||
@ -49,7 +50,7 @@ public class UserJournalService(
|
||||
}
|
||||
|
||||
// 校验期刊状态
|
||||
if (journal.Status != "Published")
|
||||
if (journal.Status != JournalStatusEnum.Published)
|
||||
{
|
||||
logger.LogWarning("绑定期刊失败,期刊未发布,JournalId: {JournalId}, Status: {Status}", input.JournalId, journal.Status);
|
||||
throw new BusinessException("该期刊暂未发布,无法绑定", 400);
|
||||
@ -75,8 +76,8 @@ public class UserJournalService(
|
||||
UserId = userId,
|
||||
JournalId = input.JournalId,
|
||||
Id = input.Id,
|
||||
Type = input.Type,
|
||||
Status = "Active",
|
||||
Type = Enum.Parse<UserJournalTypeEnum>(input.Type, true),
|
||||
Status = UserJournalStatusEnum.Active,
|
||||
IsDeleted = false,
|
||||
CreatedBy = userId.ToString(),
|
||||
CreatedAt = DateTime.Now,
|
||||
@ -112,8 +113,8 @@ public class UserJournalService(
|
||||
Id = userJournal.Id,
|
||||
UserId = userJournal.UserId,
|
||||
JournalId = userJournal.JournalId,
|
||||
Type = userJournal.Type,
|
||||
Status = userJournal.Status,
|
||||
Type = userJournal.Type.ToString(),
|
||||
Status = userJournal.Status.ToString(),
|
||||
CreatedAt = userJournal.CreatedAt
|
||||
};
|
||||
}
|
||||
@ -139,15 +140,15 @@ public class UserJournalService(
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var pageResult = await userJournalRepository.Queryable()
|
||||
.Where(uj => uj.UserId == userId)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Type), uj => uj.Type == input.Type)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Type), uj => uj.Type.ToString() == input.Type)
|
||||
.OrderByDescending(uj => uj.CreatedAt)
|
||||
.Select(uj => new BindJournalOutput
|
||||
{
|
||||
Id = uj.Id,
|
||||
UserId = uj.UserId,
|
||||
JournalId = uj.JournalId,
|
||||
Type = uj.Type,
|
||||
Status = uj.Status,
|
||||
Type = uj.Type.ToString(),
|
||||
Status = uj.Status.ToString(),
|
||||
CreatedAt = uj.CreatedAt
|
||||
}, true)
|
||||
.ToPageListAsync(input.PageIndex, input.PageSize, totalNumber);
|
||||
|
||||
Reference in New Issue
Block a user