瀏覽代碼

Merge branch 'dev' of http://110.188.24.182:10023/Fengwo/hotline into dev
合并冲突

guqiang 3 天之前
父節點
當前提交
de665825ee

+ 5 - 2
src/Hotline.Application/Identity/IdentityAppService.cs

@@ -367,8 +367,11 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
 
     public async Task<Dictionary<string, object>> RefreshTokenAsync(string openId, CancellationToken token)
     {
-        var thirdAccount = await _thirdAccountRepository.GetByOpenIdAsync(openId, token)
-            ?? throw UserFriendlyException.SameMessage("未找到用户信息");
+        var thirdAccount = await _thirdAccountRepository.GetByOpenIdAsync(openId, token);
+        if (thirdAccount is null)
+        {
+            throw new UserFriendlyException(403, "用户不存在");
+        }
 
         return await GetJwtToken(thirdAccount, token);
     }

+ 2 - 3
src/Hotline.Application/Snapshot/BiSnapshotApplication.cs

@@ -568,7 +568,7 @@ public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
             CommunityCode = it.Id,
             CommunityName = it.Name,
             CommunityFullName = it.FullName,
-            SumCount = SqlFunc.Subqueryable<OrderSnapshot>().Where(snapshot => snapshot.CommunityFullName!.Contains(it.FullName)).Count(),
+            SumCount = SqlFunc.Subqueryable<OrderSnapshot>().Where(s => s.CommunityFullName!.Contains(it.FullName) && s.CreationTime >= dto.StartTime && s.CreationTime <= dto.EndTime).Count(),
             HasChild = SqlFunc.Subqueryable<CommunityInfo>().Where(c => c.ParentCode == it.Id).Any()
         });
 #if DEBUG
@@ -579,10 +579,9 @@ public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
 
     public ISugarQueryable<CommunityStatisticsDetailsOutDto> GetCommunityStatisticsDetails(CommunityStatisticsDetailsInDto dto)
     {
-        var communityFullName = _communityInfoRepository.Queryable().Where(c => c.Id == dto.CommunityCode).Select(c => c.FullName).First();
         var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
             .LeftJoin<Order>((snapshot, order) => snapshot.Id == order.Id)
-            .Where((snapshot, order) => snapshot.CreationTime >= dto.StartTime && snapshot.CreationTime <= dto.EndTime && snapshot.CommunityFullName!.Contains(communityFullName))
+            .Where((snapshot, order) => snapshot.CreationTime >= dto.StartTime && snapshot.CreationTime <= dto.EndTime && snapshot.CommunityFullName!.Contains(dto.CommunityFullName))
             .WhereIF(dto.IndustryId.NotNullOrEmpty(), (snapshot, order) => snapshot.IndustryId == dto.IndustryId)
             .Select((snapshot, order) => new CommunityStatisticsDetailsOutDto(), true);
 #if DEBUG

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

@@ -88,7 +88,6 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
             status = ERedPackAuditStatus.Agree;
         var redPackAudit = await _redPackAuditRepository.GetAsync(dto.RedPackAuditId, token) ?? throw UserFriendlyException.SameMessage("审核记录不存在");
         if (redPackAudit.Status != ERedPackAuditStatus.Pending) throw UserFriendlyException.SameMessage("已审核, 不可重复审核");
-
         var industry = await _industryRepository.Queryable(includeDeleted: true)
           .LeftJoin<OrderSnapshot>((i, o) => i.Id == o.IndustryId)
           .Where((i, o) => o.Id == redPackAudit.OrderId)
@@ -108,6 +107,7 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
         {
             redPackAudit.ApprovedAmount = 20;
         }
+
         redPackAudit.SMSTemplateId = dto.SMSTemplateId;
         redPackAudit.Status = status;
         redPackAudit.AuditRemark = dto.Opinion;
@@ -267,8 +267,16 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
         var industry = await _industryRepository.Queryable(includeDeleted: true)
             .LeftJoin<OrderSnapshot>((i, o) => i.Id == o.IndustryId)
             .Where((i, o) => o.Id == id)
-            .Select((i, o) => new { i.Id, i.CitizenReadPackAmount, i.ArgeePoints, i.ExtraDeductedPoints, i.RefusePoints, i.IsPoints,
-            o.IsSafetyDepartment, i.Name})
+            .Select((i, o) => new {
+                i.Id,
+                i.CitizenReadPackAmount,
+                i.ArgeePoints,
+                i.ExtraDeductedPoints,
+                i.RefusePoints,
+                i.IsPoints,
+                o.IsSafetyDepartment,
+                i.Name
+            })
             .FirstAsync();
         outDto.Amount = industry.CitizenReadPackAmount;
         if (industry.Name == "安全隐患" && industry.IsSafetyDepartment.HasValue && industry.IsSafetyDepartment == true)

+ 1 - 1
src/Hotline.Share/Dtos/Snapshot/StatisticsDto.cs

@@ -2092,7 +2092,7 @@ public record CommunityStatisticsDetailsInDto : PagedRequest
     /// 社区全称
     /// </summary>
     [Required]
-    public string CommunityCode { get; set; }
+    public string CommunityFullName { get; set; }
 
     /// <summary>
     /// 行业Id

+ 12 - 12
src/Hotline/Orders/OrderDomainService.cs

@@ -569,20 +569,20 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
 
     #region 平均派单
 
-    public async Task<bool> SchedulingAtWork(string UserId) 
+    public async Task<bool> SchedulingAtWork(string UserId)
     {
-		var time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
-		var atWork =  await _schedulingRepository.Queryable()
-			.Includes(x => x.SchedulingUser)
-			.Where(x => x.SchedulingUser.UserId == UserId && x.SchedulingTime == time && x.WorkingTime <= DateTime.Now.TimeOfDay && x.OffDutyTime >= DateTime.Now.TimeOfDay && x.AtWork == true)
-			.AnyAsync();
+        var time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
+        var atWork = await _schedulingRepository.Queryable()
+            .Includes(x => x.SchedulingUser)
+            .Where(x => x.SchedulingUser.UserId == UserId && x.SchedulingTime == time && x.WorkingTime <= DateTime.Now.TimeOfDay && x.OffDutyTime >= DateTime.Now.TimeOfDay && x.AtWork == true)
+            .AnyAsync();
         return atWork;
-	}
-	/// <summary>
-	/// 平均派单
-	/// </summary>
-	/// <returns></returns>
-	public async Task<StepAssignInfo> AverageOrder(CancellationToken cancellationToken)
+    }
+    /// <summary>
+    /// 平均派单
+    /// </summary>
+    /// <returns></returns>
+    public async Task<StepAssignInfo> AverageOrder(CancellationToken cancellationToken)
     {
         var time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
         var scheduling = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)

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

@@ -60,7 +60,7 @@ public class BiSnapshotApplicationTest : TestBase
             if (hasChild.SumCount != 0)
             {
                 var inDto2 = inDto.Adapt<CommunityStatisticsDetailsInDto>();
-                inDto2.CommunityCode = hasChild.CommunityCode;
+                inDto2.CommunityFullName = hasChild.CommunityFullName;
                 var details = await _biSnapshotApplication.GetCommunityStatisticsDetails(inDto2).ToListAsync();
                 details.Count.ShouldBe(hasChild.SumCount);
             }