소스 검색

Merge branch 'test' into lib/test

libin 4 주 전
부모
커밋
1904a36fec

+ 24 - 12
src/Hotline.Share/Dtos/Snapshot/IndustryDto.cs

@@ -78,6 +78,11 @@ public class IndustryDetailOutDto : IndustryItemsOutDto
     /// App是否启用
     /// </summary>
     public bool IsAppEnable { get; set; }
+
+    /// <summary>
+    /// 是否开启积分
+    /// </summary>
+    public bool? IsPoints { get; set; }
 }
 
 public class IndustryItemsOutDto : IndustryOutDto
@@ -173,22 +178,27 @@ public class IndustryOutDto
     /// <summary>
     /// 上报积分
     /// </summary>
-    public int ReportPoints { get; set; }
+    public int? ReportPoints { get; set; }
 
     /// <summary>
     /// 审核同意积分
     /// </summary>
-    public int ArgeePoints { get; set; }
+    public int? ArgeePoints { get; set; }
 
     /// <summary>
     /// 审核不同意扣除积分
     /// </summary>
-    public int RefusePoints { get; set; }
+    public int? RefusePoints { get; set; }
 
     /// <summary>
     /// 额外扣除积分
     /// </summary>
-    public int ExtraDeductedPoints { get; set; }
+    public int? ExtraDeductedPoints { get; set; }
+
+    /// <summary>
+    /// 是否开启积分
+    /// </summary>
+    public bool? IsPoints { get; set; }
 
 }
 
@@ -417,26 +427,28 @@ public class AddIndustryDto
     /// <summary>
     /// 上报积分
     /// </summary>
-    [Required]
-    public int ReportPoints { get; set; }
+    public int? ReportPoints { get; set; }
 
     /// <summary>
     /// 审核同意积分
     /// </summary>
-    [Required]
-    public int ArgeePoints { get; set; }
+    public int? ArgeePoints { get; set; }
 
     /// <summary>
     /// 审核不同意扣除积分
     /// </summary>
-    [Required]
-    public int RefusePoints { get; set; }
+    public int? RefusePoints { get; set; }
 
     /// <summary>
     /// 额外扣除积分
     /// </summary>
-    [Required]
-    public int ExtraDeductedPoints { get; set; }
+    public int? ExtraDeductedPoints { get; set; }
+
+    /// <summary>
+    /// 是否开启积分
+    /// </summary>
+    public bool? IsPoints { get; set; }
+
 }
 
 public class IndustryCaseItemOutDto : AddIndustryCaseDto

+ 5 - 0
src/Hotline.Share/Dtos/Snapshot/OrderDto.cs

@@ -802,6 +802,11 @@ public class SnapshotOrderAuditDetailOutDto
     /// </summary>
     public IEnumerable<KeyValuePair<int, string>> AuditComBox { get; set; }
 
+    /// <summary>
+    /// 是否开启积分
+    /// </summary>
+    public bool? IsPoints { get; set; }
+
     /// <summary>
     /// 额外扣除积分类型
     /// </summary>

+ 6 - 0
src/Hotline/Snapshot/Industry.cs

@@ -173,6 +173,12 @@ public class Industry : CreationSoftDeleteEntity
     [SugarColumn(ColumnDescription = "行业类型")]
     public EIndustryType IndustryType { get; set; }
 
+    /// <summary>
+    /// 是否开启积分
+    /// </summary>
+    [SugarColumn(ColumnDescription = "是否开启积分")]
+    public bool? IsPoints { get; set; }
+
     /// <summary>
     /// 上报积分
     /// </summary>

+ 2 - 0
test/Hotline.Tests/Application/IndustryApplicationTest.cs

@@ -58,6 +58,7 @@ public class IndustryApplicationTest : TestBase
         var orgs = await _systemOrganizeRepository.GetOrgEnabled();
         industry.ApproveOrgId = orgs.First().Key;
         industry.ApproveOrgName = null;
+        industry.IsPoints = false;
         await _industryApplication.UpdateIndustryAsync(industry, CancellationToken.None);
         var updateIndustry = await _industryApplication.GetIndustryDetailAsync(item.Id, CancellationToken.None);
         updateIndustry.ForeachClassProperties(async (industry, property, name, value) =>
@@ -65,6 +66,7 @@ public class IndustryApplicationTest : TestBase
             industry.GetType().GetProperty(name).GetValue(industry).ShouldBe(value);
             return true;
         });
+        updateIndustry.IsPoints.ShouldBe(false);
         await _industryApplication.UpdateIndustryAsync(item.Adapt<UpdateIndustryInDto>(), CancellationToken.None);
     }
 

+ 7 - 5
test/Hotline.Tests/Application/SnapshotApplicationTest.cs

@@ -471,17 +471,19 @@ public class SnapshotApplicationTest : TestBase
             ArgeePoints = 3,
             ExtraDeductedPoints = 2,
             RefusePoints = 1,
-            ReportPoints = 4
+            ReportPoints = 4,
+            IsPoints = false
         };
         var industryId = await _industryApplication.AddIndustryAsync(industry, CancellationToken.None);
         var pageDto = await _snapshotApplication.GetIndustryBaseAsync(industryId, CancellationToken.None);
         var industryOut = await _industryApplication.GetIndustryDetailAsync(industryId, CancellationToken.None);
         try
         {
-            industryOut.ArgeePoints.ShouldBe(industry.ArgeePoints);
-            industryOut.ExtraDeductedPoints.ShouldBe(industry.ExtraDeductedPoints);
-            industryOut.RefusePoints.ShouldBe(industry.RefusePoints);
-            industryOut.ReportPoints.ShouldBe(industry.ReportPoints);
+            industryOut.ArgeePoints.Value.ShouldBe(industry.ArgeePoints.Value);
+            industryOut.ExtraDeductedPoints.Value.ShouldBe(industry.ExtraDeductedPoints.Value);
+            industryOut.RefusePoints.Value.ShouldBe(industry.RefusePoints.Value);
+            industryOut.ReportPoints.Value.ShouldBe(industry.ReportPoints.Value);
+            industryOut.IsPoints.ShouldBe(industry.IsPoints);
             pageDto.ShouldNotBeNull();
             pageDto.Files.ShouldNotBeNull();
             foreach (var file in pageDto.Files)