Bläddra i källkod

Merge branch 'test' of http://110.188.24.182:10023/Fengwo/hotline into test

tangjiang 4 dagar sedan
förälder
incheckning
e7de08ac75
21 ändrade filer med 102 tillägg och 38 borttagningar
  1. 1 1
      src/Hotline.Api/Controllers/Bi/BiOrderController.cs
  2. 30 2
      src/Hotline.Api/Controllers/Snapshot/SnapshotUserController.cs
  3. 20 2
      src/Hotline.Api/Controllers/TestController.cs
  4. 12 6
      src/Hotline.Application/Handlers/FlowEngine/WorkflowEndHandler.cs
  5. 2 2
      src/Hotline.Application/OrderApp/OrderApplication.cs
  6. 11 3
      src/Hotline.Application/Snapshot/SnapshotUserApplication.cs
  7. 2 2
      src/Hotline.Repository.SqlSugar/Extensions/SqlSugarStartupExtensions.cs
  8. 11 1
      src/Hotline.Share/Dtos/Snapshot/SnapshotBulletinDto.cs
  9. 2 2
      src/Hotline/Snapshot/CitizenRelationSafetyType.cs
  10. 1 1
      src/Hotline/Validators/Exams/ExamManages/AddExtractRuleDtoValidator.cs
  11. 1 1
      src/Hotline/Validators/Exams/ExamManages/AddTagQuestionDtoValidator.cs
  12. 1 1
      src/Hotline/Validators/Exams/ExamManages/UpdateExtractRuleDtoValidator.cs
  13. 1 1
      src/Hotline/Validators/Exams/ExamManages/UpdateTagQuestionDtoValidator.cs
  14. 3 3
      src/Hotline/Validators/Exams/Questions/AddQuestionDtoValidator.cs
  15. 0 1
      src/Hotline/Validators/Exams/Questions/AddQuestionOptionsDtoValidator.cs
  16. 3 3
      src/Hotline/Validators/Exams/Questions/UpdateQuestionDtoValidator.cs
  17. 0 1
      src/Hotline/Validators/Exams/Questions/UpdateQuestionKnowladgeDtoValidator.cs
  18. 0 2
      src/Hotline/Validators/Exams/Questions/UpdateQuestionOptionsDtoValidator.cs
  19. 0 1
      src/Hotline/Validators/Exams/Questions/UpdateQuestionSourcewareDtoValidator.cs
  20. 0 1
      src/Hotline/Validators/Exams/Questions/UpdateQuestionTagDtoValidator.cs
  21. 1 1
      test/Hotline.Tests/Application/SnapshotUserApplicationTest.cs

+ 1 - 1
src/Hotline.Api/Controllers/Bi/BiOrderController.cs

@@ -2582,7 +2582,7 @@ namespace Hotline.Api.Controllers.Bi
                 Visitd = await _orderVisitRepository.Queryable()
               .Where(x => x.VisitTime >= StartTime && x.VisitTime <= EndTime && x.VisitState == EVisitState.Visited).CountAsync(),
                 WaitVisitd = await _orderVisitRepository.Queryable()
-             .Where(x => x.VisitTime >= StartTime && x.VisitTime <= EndTime && x.VisitState != EVisitState.None && x.VisitState != EVisitState.Visited).CountAsync()
+             .Where(x => x.CreationTime >= StartTime && x.CreationTime <= EndTime && x.VisitState != EVisitState.None && x.VisitState != EVisitState.Visited).CountAsync()
             };
             //
             var query = _orderVisitDetailRepository.Queryable()

+ 30 - 2
src/Hotline.Api/Controllers/Snapshot/SnapshotUserController.cs

@@ -3,6 +3,7 @@ using Hotline.Repository.SqlSugar.Extensions;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.Snapshot;
 using Hotline.Share.Tools;
+using Hotline.Snapshot.IRepository;
 using Microsoft.AspNetCore.Mvc;
 using System.ComponentModel;
 
@@ -12,10 +13,28 @@ namespace Hotline.Api.Controllers.Snapshot;
 public class SnapshotUserController : BaseController
 {
     private readonly ISnapshotUserApplication _snapshotUserApplication;
+    private readonly ISafetyTypeRepository _safetyTypeRepository;
 
-    public SnapshotUserController(ISnapshotUserApplication snapshotUserApplication)
+    public SnapshotUserController(ISnapshotUserApplication snapshotUserApplication, ISafetyTypeRepository safetyTypeRepository)
     {
         _snapshotUserApplication = snapshotUserApplication;
+        _safetyTypeRepository = safetyTypeRepository;
+    }
+
+    /// <summary>
+    /// 获取添加安全志愿者和安全员分类关系的基础数据
+    /// </summary>
+    /// <returns></returns>
+    [HttpGet("citizen_relation/basedata")]
+    public async Task<Dictionary<string, object>> GetCitizenRelationSafetyTypeBase()
+    {
+        var safetyTypes = await _safetyTypeRepository.Queryable()
+            .Select(m => new { m.Id, m.Name})
+            .ToListAsync(HttpContext.RequestAborted);
+        return new Dictionary<string, object>
+        {
+            { "safetyTypes", safetyTypes }
+        };
     }
 
     /// <summary>
@@ -27,11 +46,20 @@ public class SnapshotUserController : BaseController
         => (await _snapshotUserApplication.GetCitizenRelationSafetyType(dto).ToPagedListAsync(dto)).ToPaged();
 
     /// <summary>
-    /// 添加安全志愿者
+    /// 添加安全志愿者和安全员分类关系
     /// </summary>
     /// <param name="dto"></param>
     /// <returns></returns>
     [HttpPost("citizen_relation")]
     public async Task AddCitizenRelationSafetyTypeInDto([FromBody]AddCitizenRelationSafetyTypeInDto dto)
         => await _snapshotUserApplication.AddCitizenRelationSafetyType(dto, HttpContext.RequestAborted);
+
+    /// <summary>
+    /// 批量删除安全志愿者分类关系
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    [HttpDelete("citizen_relation")]
+    public async Task DeleteCitizenRelationSafetyType([FromBody] DeleteCitizenRelationSafetyTypeInDto dto)
+        => await _snapshotUserApplication.DeleteCitizenRelationSafetyAsync(dto);
 }

+ 20 - 2
src/Hotline.Api/Controllers/TestController.cs

@@ -74,6 +74,7 @@ using XF.Domain.Queues;
 using XF.Domain.Repository;
 using Order = Hotline.Orders.Order;
 using OrderDto = Hotline.Share.Dtos.Order.OrderDto;
+using Hotline.Schedulings;
 
 namespace Hotline.Api.Controllers;
 
@@ -135,7 +136,8 @@ public class TestController : BaseController
     private readonly IServiceProvider _serviceProvider;
     private readonly IRepository<OrderDelay> _orderDelayRepository;
     private readonly IRepository<OrderSecondaryHandling> _orderSecondaryHandlingRepository;
-    private readonly IRepository<Message> _messageRepository;
+    private readonly IRepository<Message> _messageRepository; 
+    private readonly IRepository<Scheduling> _schedulingRepository;
 
 
     public TestController(
@@ -195,7 +197,8 @@ public class TestController : BaseController
         IServiceProvider serviceProvider,
         IRepository<OrderSecondaryHandling> orderSecondaryHandlingRepository,
         IRepository<Message> messageRepository
-        )
+,
+        IRepository<Scheduling> schedulingRepository)
     {
         _logger = logger;
         _options = options;
@@ -249,7 +252,22 @@ public class TestController : BaseController
         _orderDelayRepository = orderDelayRepository;
         _orderSecondaryHandlingRepository = orderSecondaryHandlingRepository;
         _messageRepository = messageRepository;
+        _schedulingRepository = schedulingRepository;
     }
+    /// <summary>
+    /// 测试
+    /// </summary>
+    /// <returns></returns>
+    [AllowAnonymous]
+    [HttpGet("test")]
+    public async Task Test()
+    {
+        var schedulingList = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser).Where(x => x.SchedulingTime!.Value.Date == DateTime.Now.Date).ToListAsync();
+        Random random = new Random();
+        int randomNum = random.Next(schedulingList.Count);
+        var userId = schedulingList[randomNum].SchedulingUser.UserId;
+    }
+
 
     /// <summary>
     /// 测试获取电话号码

+ 12 - 6
src/Hotline.Application/Handlers/FlowEngine/WorkflowEndHandler.cs

@@ -26,6 +26,7 @@ using MediatR;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Options;
 using SqlSugar.Extensions;
+using XF.Domain.Exceptions;
 using XF.Domain.Repository;
 
 namespace Hotline.Application.Handlers.FlowEngine;
@@ -69,7 +70,8 @@ public class WorkflowEndHandler : INotificationHandler<EndWorkflowNotify>
         ILogger<WorkflowEndHandler> logger,
         ICalcExpireTime expireTime,
         IRepository<OrderTerminate> orderTerminateRepository,
-        IRepository<OrderSecondaryHandling> orderSecondaryHandlingRepository)
+        IRepository<OrderSecondaryHandling> orderSecondaryHandlingRepository,
+        IRepository<Scheduling> schedulingRepository)
     {
         _mapper = mapper;
         _knowledgeDomainService = knowledgeDomainService;
@@ -88,6 +90,7 @@ public class WorkflowEndHandler : INotificationHandler<EndWorkflowNotify>
         _expireTime = expireTime;
         _orderTerminateRepository = orderTerminateRepository;
         _orderSecondaryHandlingRepository = orderSecondaryHandlingRepository;
+        _schedulingRepository = schedulingRepository;
     }
 
     /// <summary>Handles a notification</summary>
@@ -226,13 +229,16 @@ public class WorkflowEndHandler : INotificationHandler<EndWorkflowNotify>
                             try
                             {
                                 var schedulingList = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser).Where(x => x.SchedulingTime!.Value.Date == DateTime.Now.Date).ToListAsync();
-                                Random random = new Random();
-                                int randomNum = random.Next(schedulingList.Count);
-                                var userId = schedulingList[randomNum].SchedulingUser.UserId;
-                                order.WaitForPublisherId = userId;
+                                if (schedulingList != null && schedulingList.Count > 0)
+                                {
+                                    int randomNum = Random.Shared.Next(schedulingList.Count);
+                                    var userId = schedulingList[randomNum].SchedulingUser.UserId;
+                                    order.WaitForPublisherId = userId;
+                                }
                             }
                             catch
-                            {}
+                            {
+                            }
                         }
                     }
 

+ 2 - 2
src/Hotline.Application/OrderApp/OrderApplication.cs

@@ -5726,7 +5726,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                 .Where((x, su) => x.ModuleCode == WorkflowModuleConsts.OrderHandle && x.BusinessType == EBusinessType.Send)
                 .Where((x, su) => x.CreationTime >= dto.StartTime.Value && x.CreationTime <= dto.EndTime.Value && su.UserId == dto.UserId)
                 .WhereIF(dto.TitleCode.ToUpper() == "NOSENDORDERNUM", (x, su) => x.Status != EWorkflowStepStatus.Handled)
-                .WhereIF(dto.TitleCode.ToUpper() == "SENDORDERNUM", (x, su) => x.Status == EWorkflowStepStatus.Handled && !SqlFunc.JsonListObjectAny(x.NextHandlers, "OrgId", OrgSeedData.CenterId))
+                .WhereIF(dto.TitleCode.ToUpper() == "SENDORDERNUM", (x, su) => x.Status == EWorkflowStepStatus.Handled )
                 .GroupBy((x, su) => x.ExternalId)
                 .Select((x, su) => new { Id = x.ExternalId })
                 .MergeTable()
@@ -5765,7 +5765,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                 .Where(x => x.ModuleCode == WorkflowModuleConsts.OrderHandle && (x.Name == "派单组" || x.Name == "班长审批"))
                 .Where(x => x.CreationTime >= dto.StartTime.Value && x.CreationTime <= dto.EndTime.Value && x.HandlerId == dto.UserId)
                 .WhereIF(dto.TitleCode.ToUpper() == "NOSENDORDERNUM", x => x.Status != EWorkflowStepStatus.Handled)
-                .WhereIF(dto.TitleCode.ToUpper() == "SENDORDERNUM", x => x.Status == EWorkflowStepStatus.Handled)
+                .WhereIF(dto.TitleCode.ToUpper() == "SENDORDERNUM", x => x.Status == EWorkflowStepStatus.Handled && !SqlFunc.JsonListObjectAny(x.NextHandlers, "OrgId", OrgSeedData.CenterId))
                 .WhereIF(dto.RoleName is "派单员", x => x.Name == "派单组")
                 .WhereIF(dto.RoleName is "中心班长", x => x.Name == "班长审批")
                 .GroupBy(x => x.ExternalId)

+ 11 - 3
src/Hotline.Application/Snapshot/SnapshotUserApplication.cs

@@ -75,9 +75,17 @@ public class SnapshotUserApplication : ISnapshotUserApplication, IScopeDependenc
     {
         foreach (var item in dto.Items)
         {
-            await _citizenRepository.RemoveNav(m => m.Id == item.CitizenId)
-                .Include(m => m.SafetyTypes.Where(s => s.Id == item.SafetyTypeId).First())
-                .ExecuteCommandAsync();
+            var citizen = await _citizenRepository.Queryable()
+                .Includes(m => m.SafetyTypes)
+                .Where(m => m.Id == item.CitizenId)
+                .FirstAsync();
+            var deleteSafetyType = citizen.SafetyTypes.FirstOrDefault(m => m.Id == item.SafetyTypeId);
+            if (deleteSafetyType == null) continue;
+
+            citizen.SafetyTypes.Remove(deleteSafetyType);
+            _citizenRepository.UpdateNav(citizen)
+                .Include(m => m.SafetyTypes)
+                .ExecuteCommand();
         }
     }
 }

+ 2 - 2
src/Hotline.Repository.SqlSugar/Extensions/SqlSugarStartupExtensions.cs

@@ -226,8 +226,8 @@ namespace Hotline.Repository.SqlSugar.Extensions
                 //Log.Warning($"sql参数:{JsonSerializer.Serialize(db.Ado.SqlStackTrace, new JsonSerializerOptions { Encoder = JavaScriptEncoder.Create(UnicodeRanges.BasicLatin, UnicodeRanges.CjkUnifiedIdeographs) })}");
 
 
-                //获取原生SQL推荐 5.1.4.63  性能OK
-                Log.Information(UtilMethods.GetNativeSql(sql, pars));
+                ////获取原生SQL推荐 5.1.4.63  性能OK
+                //Log.Information(UtilMethods.GetNativeSql(sql, pars));
 
                 //Log.Information("Sql: {0}", sql);
                 //Log.Information("SqlParameters: {0}", string.Join(',', pars.Select(d => d.Value)));

+ 11 - 1
src/Hotline.Share/Dtos/Snapshot/SnapshotBulletinDto.cs

@@ -255,6 +255,16 @@ public class AddSnapshotBulletinInDto
     /// </summary>
     public bool IsPopup { get; set; }
 
+    /// <summary>
+    /// 是否随手拍
+    /// </summary>
+    public bool? IsSnapshot { get; set; }
+
+    /// <summary>
+    /// 志愿者类型Id
+    /// </summary>
+    public string? SafetyTypeId { get; set; }
+
     /// <summary>
     /// 时间
     /// </summary>
@@ -268,5 +278,5 @@ public class AddSnapshotBulletinInDto
     /// <summary>
     /// 视频地址
     /// </summary>
-    public string VideoPath { get; set; }
+    public string? VideoPath { get; set; }
 }

+ 2 - 2
src/Hotline/Snapshot/CitizenRelationSafetyType.cs

@@ -14,13 +14,13 @@ public class CitizenRelationSafetyType : ITable, IEntity
     /// 市民Id
     /// <inheritdoc cref="Hotline.Orders.Citizen"/>
     /// </summary>
-    [SugarColumn(ColumnDescription = "市民Id", IsPrimaryKey = true)]
+    [SugarColumn(ColumnDescription = "市民Id")]
     public string CitizenId { get; set; }
 
     /// <summary>
     /// 安全员类型Id
     /// <inheritdoc cref="SafetyType"/>
     /// </summary>
-    [SugarColumn(ColumnDescription = "安全员类型Id", IsPrimaryKey = true)]
+    [SugarColumn(ColumnDescription = "安全员类型Id")]
     public string SafetyTypeId { get; set; }
 }

+ 1 - 1
src/Hotline/Validators/Exams/ExamManages/AddExtractRuleDtoValidator.cs

@@ -15,7 +15,7 @@ namespace Hotline.Validators.Exams.ExamManages
         public AddExtractRuleDtoValidator()
         {
             RuleFor(m => m.Name).NotEmpty().WithMessage(x=>string.Format(ExamErrorMessage.IsRequired,x.GetType().GetDescription(nameof(ExtractRuleDto.Name))));
-            RuleFor(m => m.RuleType).NotEmpty().WithMessage(x=>string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExtractRuleDto.RuleType))));
+            RuleFor(m => m.RuleType).NotNull().WithMessage(x=>string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExtractRuleDto.RuleType))));
 
             RuleForEach(m => m.TagQuestionDtos).SetValidator(new AddTagQuestionDtoValidator());
 

+ 1 - 1
src/Hotline/Validators/Exams/ExamManages/AddTagQuestionDtoValidator.cs

@@ -10,7 +10,7 @@ namespace Hotline.Validators.Exams.ExamManages
     {
         public AddTagQuestionDtoValidator()
         {
-            RuleFor(m => m.QuestionType).NotEmpty().WithMessage(x=>string.Format(ExamErrorMessage.IsRequired,x.GetType().GetDescription(nameof(ExamTagQuestion.QuestionType))));
+            RuleFor(m => m.QuestionType).NotNull().WithMessage(x=>string.Format(ExamErrorMessage.IsRequired,x.GetType().GetDescription(nameof(ExamTagQuestion.QuestionType))));
             RuleFor(m=>m.Count).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamTagQuestion.Count))));
             RuleFor(m => m.TagId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, typeof(ExamTag).GetDescription()));
         }

+ 1 - 1
src/Hotline/Validators/Exams/ExamManages/UpdateExtractRuleDtoValidator.cs

@@ -13,7 +13,7 @@ namespace Hotline.Validators.Exams.ExamManages
             RuleFor(m => m.Id).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExtractRuleDto.Id))));
 
             RuleFor(m => m.Name).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExtractRuleDto.Name))));
-            RuleFor(m => m.RuleType).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExtractRuleDto.RuleType))));
+            RuleFor(m => m.RuleType).NotNull().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExtractRuleDto.RuleType))));
 
             RuleForEach(m => m.TagQuestionDtos).SetValidator(new UpdateTagQuestionDtoValidator());
 

+ 1 - 1
src/Hotline/Validators/Exams/ExamManages/UpdateTagQuestionDtoValidator.cs

@@ -12,7 +12,7 @@ namespace Hotline.Validators.Exams.ExamManages
         public UpdateTagQuestionDtoValidator()
         {
             RuleFor(m => m.Id).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamTagQuestion.Id))));
-            RuleFor(m => m.QuestionType).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamTagQuestion.QuestionType))));
+            RuleFor(m => m.QuestionType).NotNull().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamTagQuestion.QuestionType))));
             RuleFor(m => m.Count).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamTagQuestion.Count))));
             RuleFor(m => m.TagId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, typeof(ExamTag).GetDescription()));
         }

+ 3 - 3
src/Hotline/Validators/Exams/Questions/AddQuestionDtoValidator.cs

@@ -11,9 +11,9 @@ namespace Hotline.Validators.Exams
         public AddQuestionDtoValidator()
         {
             RuleFor(m => m.Title).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.Title))));
-            RuleFor(m => m.DifficultyLevel).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.DifficultyLevel))));
-            RuleFor(m => m.FormalEnable).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.FormalEnable))));
-            RuleFor(m => m.SimulateEnable).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.SimulateEnable))));
+            RuleFor(m => m.DifficultyLevel).NotNull().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.DifficultyLevel))));
+            RuleFor(m => m.FormalEnable).NotNull().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.FormalEnable))));
+            RuleFor(m => m.SimulateEnable).NotNull().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.SimulateEnable))));
 
             RuleForEach(m => m.QuestionSourcewareDtos).SetValidator(new AddQuestionSourcewareDtoValidator());
 

+ 0 - 1
src/Hotline/Validators/Exams/Questions/AddQuestionOptionsDtoValidator.cs

@@ -11,7 +11,6 @@ namespace Hotline.Validators.Exams
         public AddQuestionOptionsDtoValidator()
         {
             RuleFor(m => m.Content).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestionOptions))));
-            RuleFor(m => m.QuestionId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, typeof(ExamQuestion).GetDescription()));
         }
     }
 }

+ 3 - 3
src/Hotline/Validators/Exams/Questions/UpdateQuestionDtoValidator.cs

@@ -13,9 +13,9 @@ namespace Hotline.Validators.Exams
         {
             RuleFor(m => m.Id).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.Id))));
             RuleFor(m => m.Title).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.Title))));
-            RuleFor(m => m.DifficultyLevel).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.DifficultyLevel))));
-            RuleFor(m => m.FormalEnable).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.FormalEnable))));
-            RuleFor(m => m.SimulateEnable).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.SimulateEnable))));
+            RuleFor(m => m.DifficultyLevel).NotNull().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.DifficultyLevel))));
+            RuleFor(m => m.FormalEnable).NotNull().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.FormalEnable))));
+            RuleFor(m => m.SimulateEnable).NotNull().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.SimulateEnable))));
 
             RuleForEach(m => m.QuestionSourcewareDtos).SetValidator(new UpdateQuestionSourcewareDtoValidator());
 

+ 0 - 1
src/Hotline/Validators/Exams/Questions/UpdateQuestionKnowladgeDtoValidator.cs

@@ -11,7 +11,6 @@ namespace Hotline.Validators.Exams
         public UpdateQuestionKnowladgeDtoValidator()
         {
             RuleFor(m => m.KnowladgeId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, typeof(Hotline.KnowledgeBase.Knowledge).GetDescription()));
-            RuleFor(m => m.QuestionId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, typeof(ExamQuestion).GetDescription()));
             RuleFor(m => m.Id).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestion.Id))));
         }
     }

+ 0 - 2
src/Hotline/Validators/Exams/Questions/UpdateQuestionOptionsDtoValidator.cs

@@ -11,8 +11,6 @@ namespace Hotline.Validators.Exams
         public UpdateQuestionOptionsDtoValidator()
         {
             RuleFor(m => m.Content).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestionOptions.Content))));
-            RuleFor(m => m.QuestionId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, typeof(ExamQuestion).GetDescription()));
-
             RuleFor(m => m.Id).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestionOptions.Id))));
         }
     }

+ 0 - 1
src/Hotline/Validators/Exams/Questions/UpdateQuestionSourcewareDtoValidator.cs

@@ -13,7 +13,6 @@ namespace Hotline.Validators.Exams.Questions
         public UpdateQuestionSourcewareDtoValidator()
         {
             RuleFor(m => m.SourcewareId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, typeof(ExamSourceware).GetDescription()));
-            RuleFor(m => m.QuestionId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, typeof(ExamQuestion).GetDescription()));
             RuleFor(m => m.Id).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamPracticeQuestionSourceware.Id))));
         }
     }

+ 0 - 1
src/Hotline/Validators/Exams/Questions/UpdateQuestionTagDtoValidator.cs

@@ -13,7 +13,6 @@ namespace Hotline.Validators.Exams.Questions
         public UpdateQuestionTagDtoValidator()
         {
             RuleFor(m => m.TagId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, typeof(ExamTag).GetDescription()));
-            RuleFor(m => m.QuestionId).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, typeof(ExamQuestion).GetDescription()));
             RuleFor(m=>m.Id).NotEmpty().WithMessage(x => string.Format(ExamErrorMessage.IsRequired, x.GetType().GetDescription(nameof(ExamQuestionTag.Id))));
         }
     }

+ 1 - 1
test/Hotline.Tests/Application/SnapshotUserApplicationTest.cs

@@ -87,7 +87,7 @@ public class SnapshotUserApplicationTest : TestBase
             [
                 new() {
                     CitizenId = citizen.Id,
-                    SafetyTypeId = safetyTypeXuanChuan.Id
+                    SafetyTypeId = safetyType.Id
                 }
             ]
         };