|
|
|
@ -7,7 +7,6 @@ using DS.WMS.Core.TaskPlat.Dtos;
|
|
|
|
|
using DS.WMS.Core.TaskPlat.Entity;
|
|
|
|
|
using DS.WMS.Core.TaskPlat.Interface;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Masuit.Tools.Systems;
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
@ -160,7 +159,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
CUSTOMER_ID = info.Main.CustomerId,
|
|
|
|
|
CUSTOMER_NAME = info.Main.CustomerName,
|
|
|
|
|
BATCH_STATIC = info.Main.BatchStatic,
|
|
|
|
|
DJYUserId = info.Head.DJYUserId,
|
|
|
|
|
//DJYUserId = info.Head.DJYUserId,
|
|
|
|
|
OUT_BS_NO = info.Head.BSNO,
|
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
};
|
|
|
|
@ -469,12 +468,12 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE)
|
|
|
|
|
{
|
|
|
|
|
fileInfo.FILE_CATEGORY = TaskFileCategoryEnum.BC.ToString();
|
|
|
|
|
fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.GetDescription();
|
|
|
|
|
fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.EnumDescription();
|
|
|
|
|
}
|
|
|
|
|
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE)
|
|
|
|
|
{
|
|
|
|
|
fileInfo.FILE_CATEGORY = TaskFileCategoryEnum.BC_MODIFY.ToString();
|
|
|
|
|
fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC_MODIFY.GetDescription();
|
|
|
|
|
fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC_MODIFY.EnumDescription();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -484,7 +483,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
System.Enum.TryParse(file.FileCategory, out fileCategoryEnum);
|
|
|
|
|
|
|
|
|
|
fileInfo.FILE_CATEGORY = fileCategoryEnum.ToString();
|
|
|
|
|
fileInfo.FILE_CATEGORY_NAME = fileCategoryEnum.GetDescription();
|
|
|
|
|
fileInfo.FILE_CATEGORY_NAME = fileCategoryEnum.EnumDescription();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(fileInfo.FILE_NAME))
|
|
|
|
@ -686,14 +685,18 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
|
taskType = (TaskBaseTypeEnum)temp;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
|
DataResult<List<dynamic>> result;
|
|
|
|
|
switch (taskType)
|
|
|
|
|
{
|
|
|
|
|
case TaskBaseTypeEnum.BC:
|
|
|
|
|
{
|
|
|
|
|
var result = await tenantDb.Queryable<TaskBaseInfo>()
|
|
|
|
|
.LeftJoin<TaskBCInfo>((t, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
result = await tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskBCInfo>((t, a, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Select<dynamic>((t, bc) => new
|
|
|
|
|
.Where((t, a) => a.UserId == userId || t.CreateBy == userId)
|
|
|
|
|
.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
|
Id = t.Id.SelectAll(),
|
|
|
|
|
bc.BUSI_TYPE,
|
|
|
|
@ -774,19 +777,546 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
case TaskBaseTypeEnum.SI_FEEDBACK:
|
|
|
|
|
{
|
|
|
|
|
result = await tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskSiSubmitted>((t, a, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => a.UserId == userId || t.CreateBy == userId)
|
|
|
|
|
.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
bc.CARRIER,
|
|
|
|
|
//bc.MBL_NO,
|
|
|
|
|
bc.TAKE_ISSUETYPE_NAME,
|
|
|
|
|
bc.ISSUETYPE,
|
|
|
|
|
bc.NOTICE_DATE,
|
|
|
|
|
bc.BOOKING_ID,
|
|
|
|
|
bc.SUBMITTED_DATE,
|
|
|
|
|
bc.BILLOF_NUM,
|
|
|
|
|
bc.RELEASE_INSTRUCTION,
|
|
|
|
|
bc.SI_SUBTYPE,
|
|
|
|
|
bc.SHIPPER,
|
|
|
|
|
bc.CONSIGNEE,
|
|
|
|
|
bc.NOTIFYPARTY,
|
|
|
|
|
bc.NOTIFYPARTY2,
|
|
|
|
|
bc.TRANSPORT_RECEIVER,
|
|
|
|
|
bc.MARKS,
|
|
|
|
|
bc.HSCODE,
|
|
|
|
|
bc.DESCRIPTION,
|
|
|
|
|
bc.PKGS,
|
|
|
|
|
bc.KINDPKGS,
|
|
|
|
|
bc.KGS,
|
|
|
|
|
bc.CBM,
|
|
|
|
|
bc.VESSEL,
|
|
|
|
|
bc.VOYNO,
|
|
|
|
|
bc.COMMODITY,
|
|
|
|
|
bc.PLACERECEIPTID,
|
|
|
|
|
bc.PLACERECEIPT,
|
|
|
|
|
bc.PORTLOADID,
|
|
|
|
|
bc.PORTLOAD,
|
|
|
|
|
bc.PORTDISCHARGEID,
|
|
|
|
|
bc.PORTDISCHARGE,
|
|
|
|
|
bc.PLACEDELIVERYID,
|
|
|
|
|
bc.PLACEDELIVERY,
|
|
|
|
|
bc.PROCESS_STATUS,
|
|
|
|
|
bc.IS_SET_AUTO_UPD_BOOKING,
|
|
|
|
|
bc.PROCESS_RESULT,
|
|
|
|
|
bc.PROCESS_DATE,
|
|
|
|
|
bc.DIFF_NUM,
|
|
|
|
|
bc.IS_UPDATE_BOOKING,
|
|
|
|
|
bc.UPDATE_BOOKING_DATE
|
|
|
|
|
})
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.INVOICE_BILL_MAIL:
|
|
|
|
|
{
|
|
|
|
|
var result = await tenantDb.Queryable<TaskBaseInfo>()
|
|
|
|
|
result = await tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskPerBillBase>((t, a, bc) => t.Id == bc.TASK_PKID)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Select<dynamic>(t => new
|
|
|
|
|
.Where((t, a) => a.UserId == userId || t.CreateBy == userId)
|
|
|
|
|
.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
|
Id = t.Id.SelectAll()
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
bc.TASK_PKID,
|
|
|
|
|
//bc.MBL_NO,
|
|
|
|
|
bc.INVOICE_NO,
|
|
|
|
|
bc.CANCEL_NO,
|
|
|
|
|
bc.TOTAL_AMOUNT,
|
|
|
|
|
bc.IS_DONGSH_RECV,
|
|
|
|
|
bc.IS_DONGSH_RESULT,
|
|
|
|
|
bc.DONGSH_RECV_TIME,
|
|
|
|
|
bc.DONGSH_RESULT_TIME,
|
|
|
|
|
bc.DONGSH_RECV_REASON
|
|
|
|
|
})
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.TRUCK_DISPATCH:
|
|
|
|
|
{
|
|
|
|
|
result = await tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskTruck>((t, a, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => a.UserId == userId || t.CreateBy == userId)
|
|
|
|
|
.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.BookingTruckId,
|
|
|
|
|
bc.BookingId,
|
|
|
|
|
bc.TruckId,
|
|
|
|
|
bc.TruckCode,
|
|
|
|
|
bc.TruckName,
|
|
|
|
|
bc.ToName,
|
|
|
|
|
bc.Attn,
|
|
|
|
|
bc.AttnTel,
|
|
|
|
|
bc.AttnMail,
|
|
|
|
|
bc.AttnFax,
|
|
|
|
|
bc.FromName,
|
|
|
|
|
bc.FromTel,
|
|
|
|
|
bc.FromMail,
|
|
|
|
|
bc.FromMobile,
|
|
|
|
|
bc.FromFax,
|
|
|
|
|
bc.KGS,
|
|
|
|
|
bc.Fee,
|
|
|
|
|
bc.PayMethod,
|
|
|
|
|
bc.PayMethodName,
|
|
|
|
|
bc.TruckTime,
|
|
|
|
|
bc.YARDID,
|
|
|
|
|
bc.YARD,
|
|
|
|
|
bc.YARDCONTRACT,
|
|
|
|
|
bc.YARDCONTRACTTEL,
|
|
|
|
|
bc.FactoryId,
|
|
|
|
|
bc.FactoryCode,
|
|
|
|
|
bc.FactoryName,
|
|
|
|
|
bc.FactoryContact,
|
|
|
|
|
bc.FactoryTel,
|
|
|
|
|
bc.ReturnTime,
|
|
|
|
|
bc.InYardID,
|
|
|
|
|
bc.InYard,
|
|
|
|
|
bc.InYardContact,
|
|
|
|
|
bc.InYardContractTel,
|
|
|
|
|
//bc.NeedArriveTime,
|
|
|
|
|
bc.ClosingTime,
|
|
|
|
|
bc.PickUpTime,
|
|
|
|
|
bc.IsGuaJi,
|
|
|
|
|
//bc.Status,
|
|
|
|
|
bc.Attention,
|
|
|
|
|
bc.Remark,
|
|
|
|
|
bc.DispatcherId,
|
|
|
|
|
bc.DispatcherName,
|
|
|
|
|
bc.TruckFlowNo,
|
|
|
|
|
bc.TaskNo,
|
|
|
|
|
bc.Vessel,
|
|
|
|
|
bc.VoyNo,
|
|
|
|
|
bc.MBLNo,
|
|
|
|
|
bc.CntrTotal,
|
|
|
|
|
bc.FactoryAddr
|
|
|
|
|
})
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.CUT_MODIFY:
|
|
|
|
|
{
|
|
|
|
|
result = await tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskCutDateChangeInfo>((t, a, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => a.UserId == userId || t.CreateBy == userId)
|
|
|
|
|
.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.CARRIER,
|
|
|
|
|
bc.VESSEL,
|
|
|
|
|
bc.VOYNO,
|
|
|
|
|
bc.NOTICE_DATE
|
|
|
|
|
})
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.ROLLING_NOMINATION:
|
|
|
|
|
case TaskBaseTypeEnum.TRANSFER_NOMINATION:
|
|
|
|
|
{
|
|
|
|
|
result = await tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskRollingNomination>((t, a, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => a.UserId == userId || t.CreateBy == userId)
|
|
|
|
|
.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.PLAN_TYPE,
|
|
|
|
|
bc.BATCH_NO,
|
|
|
|
|
bc.CARRIERID,
|
|
|
|
|
bc.CARRIER,
|
|
|
|
|
bc.CONFIRM_DEAD_LINE,
|
|
|
|
|
bc.READ_CREATE_TIME,
|
|
|
|
|
bc.ROLL_DOUBLE_REMARK,
|
|
|
|
|
bc.PLAN_TXT,
|
|
|
|
|
//bc.REMARK,
|
|
|
|
|
bc.TASK_BATCH_TOTAL,
|
|
|
|
|
bc.TASK_BATCH_PER_TOTAL
|
|
|
|
|
})
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.DRAFT:
|
|
|
|
|
{
|
|
|
|
|
result = await tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskDraftInfo>((t, a, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => a.UserId == userId || t.CreateBy == userId)
|
|
|
|
|
.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.CARRIER,
|
|
|
|
|
//bc.MBL_NO,
|
|
|
|
|
bc.BOOKING_ID,
|
|
|
|
|
bc.IS_CHANGE,
|
|
|
|
|
bc.IS_EMAIL_SEND,
|
|
|
|
|
bc.SEND_EMAIL_DATE,
|
|
|
|
|
bc.NOTICE_DATE,
|
|
|
|
|
})
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.POD_DISCHARGE_FULL:
|
|
|
|
|
case TaskBaseTypeEnum.POD_GATEOUT_FULL:
|
|
|
|
|
{
|
|
|
|
|
result = await tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskPodDischargeGateoutFull>((t, a, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => a.UserId == userId || t.CreateBy == userId)
|
|
|
|
|
.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.CARRIER,
|
|
|
|
|
bc.NOTICE_TYPE,
|
|
|
|
|
bc.NOTICE_TYPE_NAME,
|
|
|
|
|
//bc.MBL_NO,
|
|
|
|
|
bc.NOTICE_DATE
|
|
|
|
|
}).ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.CAUTION_NOTICE:
|
|
|
|
|
{
|
|
|
|
|
result = await tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskCautionNotice>((t, a, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => a.UserId == userId || t.CreateBy == userId)
|
|
|
|
|
.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.SOURCE_SYSTEM,
|
|
|
|
|
bc.SOURCE_BUSI_TYPE,
|
|
|
|
|
bc.SOURCE_BUSI_TYPENAME,
|
|
|
|
|
bc.NOTIFY_CONTENT,
|
|
|
|
|
//bc.MBL_NO,
|
|
|
|
|
bc.CARRIER,
|
|
|
|
|
bc.CAUTION_NOTICE_TYPE,
|
|
|
|
|
bc.IS_WEEK_DIFF,
|
|
|
|
|
bc.IS_PRICE_DATE_DIFF,
|
|
|
|
|
bc.IS_TRANSFER,
|
|
|
|
|
bc.IS_VESSEL_CHANGE,
|
|
|
|
|
bc.IS_CUT_DATE_ADVANCED,
|
|
|
|
|
bc.BOOKING_ID,
|
|
|
|
|
bc.BOOKING_SLOT_ID,
|
|
|
|
|
bc.SOURCE_TASK_ID,
|
|
|
|
|
bc.OLD_VAL,
|
|
|
|
|
bc.NEW_VAL,
|
|
|
|
|
}).ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.ROUTE_CUT_CHANGE:
|
|
|
|
|
{
|
|
|
|
|
result = await tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskRouteChangeAdvisory>((t, a, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => a.UserId == userId || t.CreateBy == userId)
|
|
|
|
|
.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.VESSEL,
|
|
|
|
|
bc.VOYNO,
|
|
|
|
|
bc.CARRIER,
|
|
|
|
|
bc.READ_PORTLOAD,
|
|
|
|
|
bc.ORIG_ETD,
|
|
|
|
|
bc.MDGF_CUT_DATE,
|
|
|
|
|
bc.ETA,
|
|
|
|
|
//bc.ETD,
|
|
|
|
|
bc.SI_CUT_DATE,
|
|
|
|
|
bc.TM_SHIFT_CUT_DATE,
|
|
|
|
|
bc.VGM_CUTOFF_TIME,
|
|
|
|
|
bc.CY_CUT_DATE,
|
|
|
|
|
bc.ROUTE_CODE,
|
|
|
|
|
bc.EMAIL_SUBJECT,
|
|
|
|
|
bc.WEEK,
|
|
|
|
|
bc.PORTLOADID,
|
|
|
|
|
bc.PORTLOAD
|
|
|
|
|
|
|
|
|
|
}).ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
result = await tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => a.UserId == userId || t.CreateBy == userId)
|
|
|
|
|
.Select<dynamic>(t => t)
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取登陆人相关的任务统计信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="isReCalc">是否强制计算</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(bool isReCalc)
|
|
|
|
|
{
|
|
|
|
|
TaskUserStatResultInfo resultInfo = new TaskUserStatResultInfo
|
|
|
|
|
{
|
|
|
|
|
LevelTop = new List<TaskUserStatItem>(),
|
|
|
|
|
LevelNext = new List<TaskUserStatItemNext>(),
|
|
|
|
|
LevelTree = new List<TaskUserStatItemTree>()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1、首先判断当前登陆人是否有统计记录,如果没有触发统计生成统计记录。
|
|
|
|
|
2、如果isReCalc=true,表示强制重新统计数据,并重新更新统计数据。
|
|
|
|
|
3、按照统计类型(个人/公共)、任务状态、是否异常分组汇总,并写入统计表。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//var userTendInfo = await _sysUserRepository.AsQueryable()
|
|
|
|
|
// .LeftJoin<SysTenant>((usr, ten) => usr.TenantId == ten.Id)
|
|
|
|
|
// .Where(usr => usr.Id == UserManager.UserId)
|
|
|
|
|
// .Select((usr, ten) => new { User = usr, Tend = ten }).FirstAsync();
|
|
|
|
|
|
|
|
|
|
//if (userTendInfo == null)
|
|
|
|
|
// throw Oops.Oh($"当前用户关联租户信息获取失败");
|
|
|
|
|
|
|
|
|
|
////var statList = _taskStatManageInfoRepository.AsQueryable().Where(t => (t.USER_ID == userTendInfo.User.Id
|
|
|
|
|
////&& t.STAT_TYPE == TaskStatLevelEnum.PERSON.ToString()) || (t.COMP_ID == userTendInfo.Tend.Id && t.STAT_TYPE == TaskStatLevelEnum.PUBLIC.ToString())).ToList();
|
|
|
|
|
|
|
|
|
|
////菜单375504048771141=我的任务台账
|
|
|
|
|
//List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuTaskManage);
|
|
|
|
|
|
|
|
|
|
//bool isAdmin = userlist == null;
|
|
|
|
|
|
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
|
//任务列表分组统计
|
|
|
|
|
var groupList = await tenantDb.Queryable<TaskBaseInfo>()
|
|
|
|
|
.LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.Where((t, a) => t.IS_PUBLIC == 1
|
|
|
|
|
|| t.CreateBy == userId
|
|
|
|
|
|| (t.IS_PUBLIC == 0 && a.UserId == userId))
|
|
|
|
|
.GroupBy(t => new { t.TASK_TYPE, t.STATUS, t.IS_EXCEPT, t.IS_PUBLIC })
|
|
|
|
|
.Select(t => new
|
|
|
|
|
{
|
|
|
|
|
Total = SqlFunc.AggregateCount(t.Id),
|
|
|
|
|
TaskType = t.TASK_TYPE,
|
|
|
|
|
Status = t.STATUS,
|
|
|
|
|
IsExcept = t.IS_EXCEPT,
|
|
|
|
|
IsPublic = t.IS_PUBLIC
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var exceptList = groupList
|
|
|
|
|
.Where(t => t.IsExcept == 1).ToList();
|
|
|
|
|
|
|
|
|
|
var personList = groupList
|
|
|
|
|
.Where(t => t.IsExcept == 0 && t.IsPublic == 0).ToList();
|
|
|
|
|
|
|
|
|
|
var publicList = groupList
|
|
|
|
|
.Where(t => t.IsExcept == 0 && t.IsPublic == 1).ToList();
|
|
|
|
|
|
|
|
|
|
#region 异常
|
|
|
|
|
if (exceptList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
resultInfo.LevelTop.Add(new TaskUserStatItem
|
|
|
|
|
{
|
|
|
|
|
Key = TaskStatLevelEnum.EXCPTION.ToString(),
|
|
|
|
|
Name = TaskStatLevelEnum.EXCPTION.EnumDescription(),
|
|
|
|
|
Total = exceptList.Sum(t => t.Total),
|
|
|
|
|
SortNo = (int)TaskStatLevelEnum.EXCPTION,
|
|
|
|
|
ActionKey = TaskStatLevelEnum.EXCPTION.ToString()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var nextList = new List<TaskUserStatItemNext>();
|
|
|
|
|
|
|
|
|
|
exceptList.GroupBy(t => t.Status)
|
|
|
|
|
.Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
|
|
|
|
|
.ToList().ForEach(t =>
|
|
|
|
|
{
|
|
|
|
|
TaskStatusEnum currEnum = (TaskStatusEnum)System.Enum.Parse(typeof(TaskStatusEnum), t.Key);
|
|
|
|
|
|
|
|
|
|
nextList.Add(new TaskUserStatItemNext
|
|
|
|
|
{
|
|
|
|
|
TopKey = TaskStatLevelEnum.EXCPTION.ToString(),
|
|
|
|
|
Key = currEnum.ToString(),
|
|
|
|
|
Name = currEnum.EnumDescription(),
|
|
|
|
|
Total = t.Total,
|
|
|
|
|
SortNo = (int)currEnum,
|
|
|
|
|
ActionKey = $"{TaskStatLevelEnum.EXCPTION.ToString()}#{currEnum.ToString()}"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (nextList.Count > 0)
|
|
|
|
|
resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList());
|
|
|
|
|
|
|
|
|
|
exceptList.GroupBy(t => new { t.Status, t.TaskType })
|
|
|
|
|
.Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
|
|
|
|
|
.ToList().ForEach(t =>
|
|
|
|
|
{
|
|
|
|
|
//TaskBusiTypeEnum currEnum = (TaskBusiTypeEnum)System.Enum.Parse(typeof(TaskBusiTypeEnum), t.Key.TaskType);
|
|
|
|
|
TaskBaseTypeEnum currEnum = (TaskBaseTypeEnum)System.Enum.Parse(typeof(TaskBaseTypeEnum), t.Key.TaskType);
|
|
|
|
|
|
|
|
|
|
resultInfo.LevelTree.Add(new TaskUserStatItemTree
|
|
|
|
|
{
|
|
|
|
|
TopKey = TaskStatLevelEnum.EXCPTION.ToString(),
|
|
|
|
|
NextKey = t.Key.Status,
|
|
|
|
|
Key = currEnum.ToString(),
|
|
|
|
|
Name = currEnum.EnumDescription(),
|
|
|
|
|
Total = t.Total,
|
|
|
|
|
SortNo = (int)currEnum,
|
|
|
|
|
ActionKey = $"{TaskStatLevelEnum.EXCPTION.ToString()}#{t.Key.Status}#{currEnum.ToString()}"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 个人
|
|
|
|
|
if (personList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
resultInfo.LevelTop.Add(new TaskUserStatItem
|
|
|
|
|
{
|
|
|
|
|
Key = TaskStatLevelEnum.PERSON.ToString(),
|
|
|
|
|
Name = TaskStatLevelEnum.PERSON.EnumDescription(),
|
|
|
|
|
Total = personList.Sum(t => t.Total),
|
|
|
|
|
SortNo = (int)TaskStatLevelEnum.PERSON,
|
|
|
|
|
ActionKey = TaskStatLevelEnum.PERSON.ToString()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var nextList = new List<TaskUserStatItemNext>();
|
|
|
|
|
personList.GroupBy(t => t.Status)
|
|
|
|
|
.Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
|
|
|
|
|
.ToList().ForEach(t =>
|
|
|
|
|
{
|
|
|
|
|
TaskStatusEnum currEnum = (TaskStatusEnum)System.Enum.Parse(typeof(TaskStatusEnum), t.Key);
|
|
|
|
|
|
|
|
|
|
nextList.Add(new TaskUserStatItemNext
|
|
|
|
|
{
|
|
|
|
|
TopKey = TaskStatLevelEnum.PERSON.ToString(),
|
|
|
|
|
Key = currEnum.ToString(),
|
|
|
|
|
Name = currEnum.EnumDescription(),
|
|
|
|
|
Total = t.Total,
|
|
|
|
|
SortNo = (int)currEnum,
|
|
|
|
|
ActionKey = $"{TaskStatLevelEnum.PERSON.ToString()}#{currEnum.ToString()}"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (nextList.Count > 0)
|
|
|
|
|
resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList());
|
|
|
|
|
|
|
|
|
|
personList.GroupBy(t => new { t.Status, t.TaskType })
|
|
|
|
|
.Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
|
|
|
|
|
.ToList().ForEach(t =>
|
|
|
|
|
{
|
|
|
|
|
//TaskBusiTypeEnum currEnum = (TaskBusiTypeEnum)System.Enum.Parse(typeof(TaskBusiTypeEnum), t.Key.TaskType);
|
|
|
|
|
TaskBaseTypeEnum currEnum = (TaskBaseTypeEnum)System.Enum.Parse(typeof(TaskBaseTypeEnum), t.Key.TaskType);
|
|
|
|
|
|
|
|
|
|
resultInfo.LevelTree.Add(new TaskUserStatItemTree
|
|
|
|
|
{
|
|
|
|
|
TopKey = TaskStatLevelEnum.PERSON.ToString(),
|
|
|
|
|
NextKey = t.Key.Status,
|
|
|
|
|
Key = currEnum.ToString(),
|
|
|
|
|
Name = currEnum.EnumDescription(),
|
|
|
|
|
Total = t.Total,
|
|
|
|
|
SortNo = (int)currEnum,
|
|
|
|
|
ActionKey = $"{TaskStatLevelEnum.PERSON.ToString()}#{t.Key.Status}#{currEnum.ToString()}"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 公共
|
|
|
|
|
if (publicList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
resultInfo.LevelTop.Add(new TaskUserStatItem
|
|
|
|
|
{
|
|
|
|
|
Key = TaskStatLevelEnum.PUBLIC.ToString(),
|
|
|
|
|
Name = TaskStatLevelEnum.PUBLIC.EnumDescription(),
|
|
|
|
|
Total = publicList.Sum(t => t.Total),
|
|
|
|
|
SortNo = (int)TaskStatLevelEnum.PUBLIC,
|
|
|
|
|
ActionKey = TaskStatLevelEnum.PUBLIC.ToString()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var nextList = new List<TaskUserStatItemNext>();
|
|
|
|
|
|
|
|
|
|
publicList.GroupBy(t => t.Status)
|
|
|
|
|
.Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
|
|
|
|
|
.ToList().ForEach(t =>
|
|
|
|
|
{
|
|
|
|
|
TaskStatusEnum currEnum = (TaskStatusEnum)System.Enum.Parse(typeof(TaskStatusEnum), t.Key);
|
|
|
|
|
|
|
|
|
|
nextList.Add(new TaskUserStatItemNext
|
|
|
|
|
{
|
|
|
|
|
TopKey = TaskStatLevelEnum.PUBLIC.ToString(),
|
|
|
|
|
Key = currEnum.ToString(),
|
|
|
|
|
Name = currEnum.EnumDescription(),
|
|
|
|
|
Total = t.Total,
|
|
|
|
|
SortNo = (int)currEnum,
|
|
|
|
|
ActionKey = $"{TaskStatLevelEnum.PUBLIC.ToString()}#{currEnum.ToString()}"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (nextList.Count > 0)
|
|
|
|
|
resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList());
|
|
|
|
|
|
|
|
|
|
publicList.GroupBy(t => new { t.Status, t.TaskType })
|
|
|
|
|
.Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
|
|
|
|
|
.ToList().ForEach(t =>
|
|
|
|
|
{
|
|
|
|
|
//TaskBusiTypeEnum currEnum = (TaskBusiTypeEnum)System.Enum.Parse(typeof(TaskBusiTypeEnum), t.Key.TaskType);
|
|
|
|
|
TaskBaseTypeEnum currEnum = (TaskBaseTypeEnum)System.Enum.Parse(typeof(TaskBaseTypeEnum), t.Key.TaskType);
|
|
|
|
|
|
|
|
|
|
resultInfo.LevelTree.Add(new TaskUserStatItemTree
|
|
|
|
|
{
|
|
|
|
|
TopKey = TaskStatLevelEnum.PUBLIC.ToString(),
|
|
|
|
|
NextKey = t.Key.Status,
|
|
|
|
|
Key = currEnum.ToString(),
|
|
|
|
|
Name = currEnum.EnumDescription(),
|
|
|
|
|
Total = t.Total,
|
|
|
|
|
SortNo = (int)currEnum,
|
|
|
|
|
ActionKey = $"{TaskStatLevelEnum.PUBLIC.ToString()}#{t.Key.Status}#{currEnum.ToString()}"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
if (resultInfo.LevelTree != null && resultInfo.LevelTree.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
resultInfo.LevelTree = resultInfo.LevelTree.OrderBy(x => x.SortNo).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<TaskUserStatResultInfo>.Success(resultInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 私有方法
|
|
|
|
|
|
|
|
|
|