浏览代码

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

xf 8 月之前
父节点
当前提交
92273058ae

+ 69 - 25
src/Hotline.Api/Controllers/Bi/BiOrderController.cs

@@ -1347,20 +1347,44 @@ namespace Hotline.Api.Controllers.Bi
 
             #region 信件分布情况
             //市直部门
+
             var listOrgStatisticsCityAll = await _orderRepository.Queryable()
-              .LeftJoin<SystemOrganize>((it, o) => it.OrgLevelOneCode == o.Id)
-              .Where((it, o) => (o.OrgType == EOrgType.City || o.OrgType == EOrgType.Province) && it.CreationTime >= StartTime && it.CreationTime <= EndTime)
-             .GroupBy((it, o) => new
-             {
-                 it.OrgLevelOneCode,
-                 o.Name
-             })
-              .Select((it, o) => new OrgStatistics
-              {
-                  CountNum = SqlFunc.AggregateCount(it.OrgLevelOneCode),
-
-                  OrgName = it.OrgLevelOneCode == "001" ? "市民热线服务中心" : o.Name
-              }).ToListAsync();
+                .Where(o => o.CreationTime >= StartTime && o.CreationTime <= EndTime)
+                .Select(o => new
+                {
+                    OrgCode = o.ActualHandleOrgCode == null || o.ActualHandleOrgCode == "" ? "001" : o.ActualHandleOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
+                })
+                .MergeTable()
+                .LeftJoin<SystemOrganize>((o, s) => o.OrgCode == s.Id)
+                 .Where((o, s) => s.OrgType == EOrgType.City || s.OrgType == EOrgType.Province)
+                .GroupBy((o, s) => new
+                {
+                    o.OrgCode,
+                    s.Name
+                })
+                .Select((o, s) => new OrgStatistics
+                {
+                    CountNum = SqlFunc.AggregateCount(o.OrgCode),
+
+                    OrgName = s.Name
+                }).ToListAsync();
+
+
+
+            //var listOrgStatisticsCityAll = await _orderRepository.Queryable()
+            //  .LeftJoin<SystemOrganize>((it, o) => it.OrgLevelOneCode == o.Id)
+            //  .Where((it, o) => (o.OrgType == EOrgType.City || o.OrgType == EOrgType.Province) && it.CreationTime >= StartTime && it.CreationTime <= EndTime)
+            // .GroupBy((it, o) => new
+            // {
+            //     it.OrgLevelOneCode,
+            //     o.Name
+            // })
+            //  .Select((it, o) => new OrgStatistics
+            //  {
+            //      CountNum = SqlFunc.AggregateCount(it.OrgLevelOneCode),
+
+            //      OrgName = it.OrgLevelOneCode == "001" ? "市民热线服务中心" : o.Name
+            //  }).ToListAsync();
 
             centerReportStatisticsDto.OrgStatisticsCityAll = new OrgStatisticsAll
             {
@@ -1369,18 +1393,38 @@ namespace Hotline.Api.Controllers.Bi
 
             //区县部门
             var listOrgStatisticsAreaAll = await _orderRepository.Queryable()
-             .LeftJoin<SystemOrganize>((it, o) => it.OrgLevelOneCode == o.Id)
-             .Where((it, o) => o.OrgType == EOrgType.County && it.CreationTime >= StartTime && it.CreationTime <= EndTime)
-            .GroupBy((it, o) => new
-            {
-                it.OrgLevelOneCode,
-                o.Name
-            })
-             .Select((it, o) => new OrgStatistics
-             {
-                 CountNum = SqlFunc.AggregateCount(it.OrgLevelOneCode),
-                 OrgName = it.OrgLevelOneCode == "001" ? "市民热线服务中心" : o.Name
-             }).ToListAsync();
+                .Where(o => o.CreationTime >= StartTime && o.CreationTime <= EndTime)
+                .Select(o => new
+                {
+                    OrgCode = o.ActualHandleOrgCode == null || o.ActualHandleOrgCode == "" ? "001" : o.ActualHandleOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
+                })
+                .MergeTable()
+                .LeftJoin<SystemOrganize>((o, s) => o.OrgCode == s.Id)
+                 .Where((o, s) => s.OrgType == EOrgType.County)
+                .GroupBy((o, s) => new
+                {
+                    o.OrgCode,
+                    s.Name
+                })
+                .Select((o, s) => new OrgStatistics
+                {
+                    CountNum = SqlFunc.AggregateCount(o.OrgCode),
+
+                    OrgName = s.Name
+                }).ToListAsync();
+            //var listOrgStatisticsAreaAll = await _orderRepository.Queryable()
+            // .LeftJoin<SystemOrganize>((it, o) => it.OrgLevelOneCode == o.Id)
+            // .Where((it, o) => o.OrgType == EOrgType.County && it.CreationTime >= StartTime && it.CreationTime <= EndTime)
+            //.GroupBy((it, o) => new
+            //{
+            //    it.OrgLevelOneCode,
+            //    o.Name
+            //})
+            // .Select((it, o) => new OrgStatistics
+            // {
+            //     CountNum = SqlFunc.AggregateCount(it.OrgLevelOneCode),
+            //     OrgName = it.OrgLevelOneCode == "001" ? "市民热线服务中心" : o.Name
+            // }).ToListAsync();
 
             centerReportStatisticsDto.OrgStatisticsAreaAll = new OrgStatisticsAll
             {

+ 1 - 1
src/Hotline.Api/Controllers/OrderController.cs

@@ -329,7 +329,7 @@ public class OrderController : BaseController
                     orderVisit.VisitState = EVisitState.WaitForVisit;
                     orderVisit.PublishTime = DateTime.Now;
                     orderVisit.IsCanHandle = true;
-
+                    orderVisit.EmployeeId = _sessionContext.RequiredUserId;
                     if (order is { ProcessType: EProcessType.Zhiban, CounterSignType: null })
                     {
                         orderVisit.VisitState = EVisitState.Visited;

+ 1 - 1
src/Hotline.Application/Orders/OrderSecondaryHandlingApplication.cs

@@ -237,7 +237,7 @@ namespace Hotline.Application.Orders
                 .WhereIF(!string.IsNullOrEmpty(dto.OrgHandledAttitude), x => SqlFunc.JsonListObjectAny(x.OrgHandledAttitude, "Key", dto.OrgHandledAttitude))
                 .WhereIF(!string.IsNullOrEmpty(dto.OrgNoSatisfiedReason), x => SqlFunc.JsonField(x.OrgNoSatisfiedReason, "Key") == dto.OrgNoSatisfiedReason)
                 .Where((x, s) => x.OrderVisit.VisitState == EVisitState.Visited && x.OrderVisit.IsCanHandle)
-                .WhereIF(!isAdmin, (x, s) => x.OrderVisit.Order.CounterSignType == null && x.OrderVisit.Order.ActualHandleOrgCode == _sessionContext.OrgId)
+                .WhereIF(!isAdmin, (x, s) => x.OrderVisit.Order.CounterSignType !=  ECounterSignType.Center && x.OrderVisit.Order.ActualHandleOrgCode == _sessionContext.OrgId)
                 ;
             if (_sessionContext.OrgId != null && !_sessionContext.OrgIsCenter)
             {