|
@@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Mvc;
|
|
|
using MongoDB.Driver;
|
|
|
using SqlSugar;
|
|
|
using System.Reflection.Metadata;
|
|
|
+using Hotline.FlowEngine.Workflows;
|
|
|
using Hotline.Share.Enums.Order;
|
|
|
using XF.Domain.Authentications;
|
|
|
using XF.Domain.Exceptions;
|
|
@@ -28,6 +29,7 @@ namespace Hotline.Api.Controllers
|
|
|
private readonly ISessionContext _sessionContext;
|
|
|
private readonly IRepository<TrCallRecord> _trCallRecordRepository;
|
|
|
private readonly IOrderRepository _orderRepository;
|
|
|
+ private readonly IRepository<WorkflowCountersign> _workflowCountersignRepository;
|
|
|
|
|
|
public CommonPController(
|
|
|
ISystemCommonOpinionDomainService commonOpinionDomainService,
|
|
@@ -35,7 +37,8 @@ namespace Hotline.Api.Controllers
|
|
|
ISessionContext sessionContext,
|
|
|
IRepository<TrCallRecord> trCallRecordRepository,
|
|
|
IOrderRepository orderRepository,
|
|
|
- IMapper mapper)
|
|
|
+ IMapper mapper,
|
|
|
+ IRepository<WorkflowCountersign> workflowCountersignRepository)
|
|
|
{
|
|
|
_commonOpinionDomainService = commonOpinionDomainService;
|
|
|
_systemAreaDomainService= systemAreaDomainService;
|
|
@@ -43,6 +46,7 @@ namespace Hotline.Api.Controllers
|
|
|
_sessionContext = sessionContext;
|
|
|
_trCallRecordRepository = trCallRecordRepository;
|
|
|
_orderRepository = orderRepository;
|
|
|
+ _workflowCountersignRepository = workflowCountersignRepository;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -92,48 +96,23 @@ namespace Hotline.Api.Controllers
|
|
|
//部门
|
|
|
//今日待办 tasksOkNum
|
|
|
var time = DateTime.Parse(tadayTime);
|
|
|
- var order = await _orderRepository.Queryable(false, false, false)
|
|
|
- .Includes(o => o.Workflow, w => w.Steps)
|
|
|
- .Where(o=> o.Workflow.Steps.Any(s => s.Status == EWorkflowStepStatus.Handled) && o.ExpiredTime > time)
|
|
|
- .GroupBy(o=>o.Id)
|
|
|
- .Select(o => new {
|
|
|
- tasksOkNum= SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonListObjectAny(o.Workflow.HandlerUsers, "Key", _sessionContext.RequiredUserId) , 1, 0)),
|
|
|
- tasksOkOrgNum = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonListObjectAny(o.Workflow.HandlerOrgs, "Key", _sessionContext.RequiredOrgId) , 1, 0)),
|
|
|
- //handleNum = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonListObjectAny(o.Workflow.HandlerUsers, "Key", _sessionContext.RequiredUserId) && o.Workflow.Steps.Any(s => s.Status != EWorkflowStepStatus.Handled) && o.Workflow.ActualHandleTime.Value.ToString("yyyy-MM-dd") == tadayTime && o.Workflow.ActualHandleTime != null, 1, 0)),
|
|
|
- //handleOrgNum = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonListObjectAny(o.Workflow.HandlerOrgs, "Key", _sessionContext.RequiredOrgId) && o.Workflow.Steps.Any(s => s.Status != EWorkflowStepStatus.Handled) && o.Workflow.ActualHandleTime.Value.ToString("yyyy-MM-dd") == tadayTime && o.Workflow.ActualHandleTime != null, 1, 0)),
|
|
|
- //exceedTasksOkNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.Workflow.Steps.Any(s => s.Status == EWorkflowStepStatus.Handled) && SqlFunc.JsonListObjectAny(o.Workflow.HandlerOrgs, "Key", _sessionContext.RequiredOrgId) && o.ExpiredTime > DateTime.Now, 1, 0)),
|
|
|
- //exceedHandleNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.Workflow.Steps.Any(s => s.Status != EWorkflowStepStatus.Handled) && SqlFunc.JsonListObjectAny(o.Workflow.HandlerOrgs, "Key", _sessionContext.RequiredOrgId) && o.ExpiredTime > DateTime.Now, 1, 0)),
|
|
|
- }).FirstAsync();
|
|
|
- var tasksOkNum = order?.tasksOkNum ?? 0;
|
|
|
- var tasksOkOrgNum = order?.tasksOkOrgNum ?? 0;
|
|
|
- //今日已办
|
|
|
- var handleOrder = await _orderRepository.Queryable(false, false, false)
|
|
|
- .Includes(o => o.Workflow, w => w.Steps)
|
|
|
- .Where(o => o.Workflow.Steps.Any(s => s.Status != EWorkflowStepStatus.Handled) && o.Workflow.ActualHandleTime.Value.ToString("yyyy-MM-dd") == tadayTime && o.Workflow.ActualHandleTime != null)
|
|
|
- .GroupBy(o => o.Id)
|
|
|
- .Select(o => new
|
|
|
- {
|
|
|
- handleNum = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonListObjectAny(o.Workflow.HandlerUsers, "Key", _sessionContext.RequiredUserId), 1, 0)),
|
|
|
- handleOrgNum = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonListObjectAny(o.Workflow.HandlerOrgs, "Key", _sessionContext.RequiredOrgId), 1, 0)),
|
|
|
- }).FirstAsync();
|
|
|
- var handleNum = handleOrder?.handleNum ?? 0;
|
|
|
- var handleOrgNum = handleOrder?.handleOrgNum ?? 0;
|
|
|
- //部门超期
|
|
|
- var exceedOrder = await _orderRepository.Queryable(false, false, false)
|
|
|
- .Includes(o => o.Workflow, w => w.Steps)
|
|
|
- .Where(o => SqlFunc.JsonListObjectAny(o.Workflow.HandlerOrgs, "Key", _sessionContext.RequiredOrgId))
|
|
|
- .Where(o => o.ExpiredTime != null &&
|
|
|
- (((o.Status == EOrderStatus.Filed || o.Status == EOrderStatus.Published || o.Status == EOrderStatus.Visited) && o.FiledTime >= o.ExpiredTime) ||
|
|
|
- ((o.Status != EOrderStatus.Filed && o.Status != EOrderStatus.Published && o.Status != EOrderStatus.Visited) && DateTime.Now >= o.ExpiredTime.Value)))
|
|
|
- .GroupBy(o => o.Id)
|
|
|
- .Select(o => new
|
|
|
- {
|
|
|
- exceedTasksOkNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.Workflow.Steps.Any(s => s.Status == EWorkflowStepStatus.Handled && s.HandlerOrgId == _sessionContext.RequiredOrgId), 1, 0)),
|
|
|
- exceedHandleNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.Workflow.Steps.Any(s => s.Status != EWorkflowStepStatus.Handled && s.HandlerOrgId == _sessionContext.RequiredOrgId), 1, 0)),
|
|
|
- }).FirstAsync();
|
|
|
- var exceedTasksOkNum = exceedOrder?.exceedTasksOkNum ?? 0;
|
|
|
- var exceedHandleNum = exceedOrder?.exceedHandleNum ?? 0;
|
|
|
- return new { TasksOkNum = tasksOkNum, TasksOkOrgNum = tasksOkOrgNum, HandleNum = handleNum, HandleOrgNum = handleOrgNum, ExceedTasksOkNum = exceedTasksOkNum, ExceedHandleNum = exceedHandleNum };
|
|
|
+ var order = await _orderRepository.Queryable()
|
|
|
+ .Includes(o => o.Workflow, w => w.Steps)
|
|
|
+ .Where(o => SqlFunc.JsonListObjectAny(o.Workflow.HandlerUsers, "Key", _sessionContext.RequiredUserId) || SqlFunc.JsonListObjectAny(o.Workflow.HandlerOrgs, "Key", _sessionContext.RequiredOrgId))
|
|
|
+ .GroupBy(o => o.Id)
|
|
|
+ .Select(o => new
|
|
|
+ {
|
|
|
+ aboutExpire = SqlFunc.AggregateSum(SqlFunc.IIF(time > o.NearlyExpiredTime!.Value && time < o.ExpiredTime!.Value, 1, 0)),
|
|
|
+ havExpired = SqlFunc.AggregateSum(SqlFunc.IIF( time > o.ExpiredTime!.Value, 1, 0)),
|
|
|
+
|
|
|
+ }).FirstAsync();
|
|
|
+ var aboutExpire = order?.aboutExpire ?? 0;
|
|
|
+ var havExpired = order?.havExpired ?? 0;
|
|
|
+
|
|
|
+ //var Countersign = await _
|
|
|
+
|
|
|
+
|
|
|
+ return new { AboutExpire = aboutExpire, HavExpired = havExpired, CountersignHandle = "aa", ScreenAudit = "aa", Delay = "aa", ScreenHandle = "aa" };
|
|
|
}
|
|
|
}
|
|
|
}
|