wanghaomei 2 years ago
commit de54b12932

@ -115,5 +115,35 @@ namespace Myshipping.Application.Entity
/// 商品名称
/// </summary>
public string GoodsName { get; set; }
/// <summary>
/// Master Bol Indicator名称
/// </summary>
public string MasterBolIndicatorName { get; set; }
/// <summary>
/// 销售EDI名称
/// </summary>
public string SalerCodeName { get; set; }
/// <summary>
/// 欧盟港口、伊朗港口、KHI
/// </summary>
public string CKHI { get; set; }
/// <summary>
/// 南美东
/// </summary>
public string CNCM { get; set; }
/// <summary>
/// 巴西线的木质包装情况
/// </summary>
public string WNCM { get; set; }
/// <summary>
/// 订舱人说明
/// </summary>
public string OrderRemark { get; set; }
}
}

@ -0,0 +1,26 @@
using System;
using SqlSugar;
using System.ComponentModel;
using Myshipping.Core.Entity;
namespace Myshipping.Application.Entity
{
/// <summary>
/// EXCEl打印模板
/// </summary>
[SugarTable("booking_exceltemplate")]
[Description("EXCEl打印模板")]
public class BookingExcelTemplate : DBEntityTenant
{
/// <summary>
/// 模板名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 分类
/// </summary>
public string Type { get; set; }
}
}

@ -0,0 +1,36 @@
using System;
using SqlSugar;
using System.ComponentModel;
using Myshipping.Core.Entity;
namespace Myshipping.Application.Entity
{
/// <summary>
/// 订舱状态
/// </summary>
[SugarTable("booking_exceltemplate_sub")]
[Description("EXCEL模板明细")]
public class BookingExcelTemplateSub : PrimaryKeyEntity
{
/// <summary>
/// 父键
/// </summary>
public long? Pid { get; set; }
/// <summary>
/// 字段名称
/// </summary>
public string Field { get; set; }
/// <summary>
/// 行
/// </summary>
public int Row { get; set; }
/// <summary>
/// 列
/// </summary>
public int Column { get; set; }
/// <summary>
/// 默认内容
/// </summary>
public string Describe { get; set; }
}
}

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 任务统计分类枚举
/// </summary>
public enum TaskStatLevelEnum
{
/// <summary>
/// 异常
/// </summary>
[Description("异常")]
EXCPTION,
/// <summary>
/// 个人
/// </summary>
[Description("个人")]
PERSON,
/// <summary>
/// 公共
/// </summary>
[Description("公共")]
PUBLIC
}
}

@ -30,6 +30,11 @@
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NPOI" Version="2.6.0" />
<PackageReference Include="Npoi.Mapper" Version="4.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Myshipping.Core\Myshipping.Core.csproj" />
</ItemGroup>

@ -2355,6 +2355,81 @@
商品名称
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingEDIExt.MasterBolIndicatorName">
<summary>
Master Bol Indicator名称
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingEDIExt.SalerCodeName">
<summary>
销售EDI名称
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingEDIExt.CKHI">
<summary>
欧盟港口、伊朗港口、KHI
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingEDIExt.CNCM">
<summary>
南美东
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingEDIExt.WNCM">
<summary>
巴西线的木质包装情况
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingEDIExt.OrderRemark">
<summary>
订舱人说明
</summary>
</member>
<member name="T:Myshipping.Application.Entity.BookingExcelTemplate">
<summary>
EXCEl打印模板
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingExcelTemplate.Name">
<summary>
模板名称
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingExcelTemplate.Type">
<summary>
分类
</summary>
</member>
<member name="T:Myshipping.Application.Entity.BookingExcelTemplateSub">
<summary>
订舱状态
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingExcelTemplateSub.Pid">
<summary>
父键
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingExcelTemplateSub.Field">
<summary>
字段名称
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingExcelTemplateSub.Row">
<summary>
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingExcelTemplateSub.Column">
<summary>
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingExcelTemplateSub.Describe">
<summary>
默认内容
</summary>
</member>
<member name="T:Myshipping.Application.Entity.BookingFile">
<summary>
订舱附件表
@ -4651,6 +4726,26 @@
系统
</summary>
</member>
<member name="T:Myshipping.Application.TaskStatLevelEnum">
<summary>
任务统计分类枚举
</summary>
</member>
<member name="F:Myshipping.Application.TaskStatLevelEnum.EXCPTION">
<summary>
异常
</summary>
</member>
<member name="F:Myshipping.Application.TaskStatLevelEnum.PERSON">
<summary>
个人
</summary>
</member>
<member name="F:Myshipping.Application.TaskStatLevelEnum.PUBLIC">
<summary>
公共
</summary>
</member>
<member name="T:Myshipping.Application.TaskStatusEnum">
<summary>
任务状态枚举
@ -6993,6 +7088,21 @@
人员id
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingTemplate.Dto.BookingExcelTemplateDto.Id">
<summary>
业务id
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingTemplate.Dto.BookingExcelTemplateDto.Name">
<summary>
模板名称
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingTemplate.Dto.BookingExcelTemplateDto.Type">
<summary>
分类
</summary>
</member>
<member name="T:Myshipping.Application.BookingEDIExtDto">
<summary>
EDI扩展
@ -9117,6 +9227,13 @@
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingPrintTemplateService.GetPrintTemplateList(Myshipping.Application.QueryBookingPrintTemplateInput)">
<summary>
赋权列表
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingPrintTemplateService.Add(Microsoft.AspNetCore.Http.IFormFile,Myshipping.Application.AddBookingPrintTemplateInput)">
<summary>
增加订舱打印模板
@ -9330,6 +9447,19 @@
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingTemplateService.GetFieldName">
<summary>
下拉获取字段名称
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingTemplateService.AddOrUpdateExcelTemplate(Myshipping.Application.Service.BookingTemplate.Dto.BookingExcelTemplateDto)">
<summary>
新增编辑excel模板
</summary>
<param name="dto"></param>
<returns></returns>
</member>
<member name="T:Myshipping.Application.BookingTemplateInput">
<summary>
订舱模板输入参数
@ -11243,14 +11373,24 @@
称重方式
</summary>
</member>
<member name="T:Myshipping.Application.TaskUserStatItem">
<member name="P:Myshipping.Application.TaskUserStatResultInfo.LevelTop">
<summary>
用户任务统计展示
第一层(异常/个人/公共)
</summary>
</member>
<member name="P:Myshipping.Application.TaskUserStatResultInfo.LevelNext">
<summary>
第二层(待处理/已完成/已取消/已挂起)
</summary>
</member>
<member name="P:Myshipping.Application.TaskUserStatItem.Level">
<member name="P:Myshipping.Application.TaskUserStatResultInfo.LevelTree">
<summary>
级别分层1-异常/个人/公共 2-待处理/已完成/已取消/已挂起 3-按照任务类型展示)
任务类型树(按照任务类型展示)
</summary>
</member>
<member name="T:Myshipping.Application.TaskUserStatItem">
<summary>
用户任务统计展示
</summary>
</member>
<member name="P:Myshipping.Application.TaskUserStatItem.SortNo">

@ -932,6 +932,9 @@ namespace Myshipping.Application
}
_logger.LogInformation("调用运踪接口提单号:" + item.MBLNO + " 调用运踪接口");
if (item.isBook&&(string.IsNullOrWhiteSpace(item.CARRIERID)|| string.IsNullOrWhiteSpace(item.CARRIER) || string.IsNullOrWhiteSpace(item.MBLNO))) {
throw Oops.Bah("订阅目的港船公司或提单号不能为空!");
}
billTraceList.Add(new BillTraceList
{
BusinessId = item.BusinessId,
@ -2449,19 +2452,23 @@ namespace Myshipping.Application
var primaryModel = order.Adapt<MsOpSeaeEDIBaseModel>();
//场站
var ediYardList = _cache.GetAllMappingYard().GetAwaiter().GetResult()
//起运港是CNTAO并且船公司是太平需要判断场站EDI
if (order.PORTLOADID == "CNTAO" && ediRouteEnum == EDIRouteEnum.PIL)
{
//场站
var ediYardList = _cache.GetAllMappingYard().GetAwaiter().GetResult()
.Where(t => t.Module.Equals(CONST_MAPPING_MODULE, StringComparison.OrdinalIgnoreCase)).ToList();
if (!string.IsNullOrWhiteSpace(order.YARDID))
{
var currYardInfo = ediYardList.FirstOrDefault(t => t.Code.Equals(order.YARDID, StringComparison.OrdinalIgnoreCase));
if (!string.IsNullOrWhiteSpace(order.YARDID))
{
var currYardInfo = ediYardList.FirstOrDefault(t => t.Code.Equals(order.YARDID, StringComparison.OrdinalIgnoreCase));
if (currYardInfo == null)
throw Oops.Bah($"场站{order.YARDID}的EDI代码未找到");
if (currYardInfo == null)
throw Oops.Bah($"场站{order.YARDID}的EDI代码未找到");
primaryModel.YARDEDICODE = currYardInfo.MapCode?.Trim();
primaryModel.YARD = currYardInfo.MapName?.Trim();
primaryModel.YARDEDICODE = currYardInfo.MapCode?.Trim();
primaryModel.YARD = currYardInfo.MapName?.Trim();
}
}
primaryModel.CARRIEREDICODE = ediSOSICfg.MapCode;

@ -60,6 +60,24 @@ namespace Myshipping.Application
.ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult();
}
/// <summary>
/// 赋权列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/BookingPrintTemplate/GetPrintTemplateList")]
public async Task<dynamic> GetPrintTemplateList([FromQuery] QueryBookingPrintTemplateInput input)
{
var entities = await _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.TypeName), u => u.TypeName.Contains(input.TypeName.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.FileName), u => u.FileName.Contains(input.FileName.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.TenantName), u => u.TenantName.Contains(input.TenantName.Trim()))
.WhereIF(input.IsMain.HasValue, u => u.IsMain == input.IsMain)
.WhereIF(input.IsSub.HasValue, u => u.IsSub == input.IsSub)
.ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult();
}
/// <summary>
/// 增加订舱打印模板(准备作废)
@ -347,13 +365,17 @@ namespace Myshipping.Application
throw Oops.Bah("未上传正确数据");
}
await _repRight.DeleteAsync(x => x.SysUserId == input.SysUserId);
// await _repRight.DeleteAsync(x => x.SysUserId == input.SysUserId);
foreach (var item in input.PrintTemplateId)
{
BookingPrinttemplateRight right = new BookingPrinttemplateRight();
right.SysUserId = input.SysUserId;
right.PrintTemplateId = item;
await _repRight.InsertAsync(right);
var ent = _repRight.FirstOrDefault(x => x.SysUserId == input.SysUserId && x.PrintTemplateId == item);
if (ent==null) {
BookingPrinttemplateRight right = new BookingPrinttemplateRight();
right.SysUserId = input.SysUserId;
right.PrintTemplateId = item;
await _repRight.InsertAsync(right);
}
}
}
/// <summary>
@ -363,18 +385,38 @@ namespace Myshipping.Application
[HttpGet("/BookingPrintTemplate/GetPrinttemplateRightList")]
public async Task<dynamic> GetPrinttemplateRightList(long userId)
{
var userlist = await _repUser.AsQueryable().Filter(null, true).ToListAsync();
var list = await _repRight.AsQueryable().InnerJoin<BookingPrintTemplate>((d, t) => d.PrintTemplateId == t.Id && t.TenantId == UserManager.TENANT_ID).
WhereIF(userId != 0, x => x.SysUserId == userId).
Select((d, t) => new
WhereIF(userId != 0, d => d.SysUserId == userId).
Select((d, t) => new BookingPrinttemplateDto
{
Id=d.Id,
PrintTemplateId=t.Id,
SysUserId=d.SysUserId,
TypeCode = t.TypeCode,
TypeName = t.TypeName,
FilePath = t.FilePath,
FileName = t.FileName,
TenantName = t.TenantName,
UserName = _repUser.Where(x => x.Id == d.SysUserId).Select(x => x.Name).FirstAsync().Result
UserName ="",
}).ToListAsync();
foreach (var item in list)
{
var username= userlist.Where(x => x.Id == item.SysUserId).Select(x => x.Name).FirstOrDefault();
item.UserName = username;
}
return list;
}
/// <summary>
/// 删除打印模板权限
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
[HttpGet("/BookingPrintTemplate/DeletePrinttemplateRight")]
public async Task DeletePrinttemplateRight(List<long> Ids) {
await _repRight.DeleteAsync(x => Ids.Contains(x.Id));
}
}
}

@ -127,5 +127,8 @@ namespace Myshipping.Application
/// </summary>
public bool? IsSub { get; set; }
}
}

@ -16,4 +16,20 @@ namespace Myshipping.Application.Service.BookingPrintTemplate.Dto
public List<long> PrintTemplateId { get; set; }
}
public class BookingPrinttemplateDto
{
public long Id { get; set; }
public long PrintTemplateId { get; set; }
public long SysUserId { get; set; }
public string TypeCode { get; set; }
public string TypeName { get; set; }
public string FilePath { get; set; }
public string FileName { get; set; }
public string TenantName { get; set; }
public string UserName { get; set; }
}
}

@ -10,6 +10,9 @@ using Myshipping.Application.Entity;
using Microsoft.Extensions.Logging;
using Furion.FriendlyException;
using Myshipping.Application.Enum;
using System.ComponentModel;
using System.Collections.Generic;
using Myshipping.Application.Service.BookingTemplate.Dto;
namespace Myshipping.Application
{
@ -20,10 +23,16 @@ namespace Myshipping.Application
public class BookingTemplateService : IBookingTemplateService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<BookingTemplate> _rep;
private readonly SqlSugarRepository<BookingOrder> _repOrder;
private readonly SqlSugarRepository<BookingExcelTemplate> _excelrep;
private readonly SqlSugarRepository<BookingExcelTemplateSub> _excelsubrep;
private readonly ILogger<BookingTemplate> _logger;
public BookingTemplateService(SqlSugarRepository<BookingTemplate> rep, ILogger<BookingTemplate> logger)
public BookingTemplateService(SqlSugarRepository<BookingTemplate> rep, SqlSugarRepository<BookingOrder> repOrder, SqlSugarRepository<BookingExcelTemplate> excelrep, SqlSugarRepository<BookingExcelTemplateSub> excelsubrep, ILogger<BookingTemplate> logger)
{
_excelrep = excelrep;
_excelsubrep = excelsubrep;
_repOrder = repOrder;
_rep = rep;
_logger = logger;
}
@ -36,11 +45,11 @@ namespace Myshipping.Application
[HttpGet("/BookingTemplate/page")]
public async Task<dynamic> Page([FromQuery] QueryBookingTemplateInput input)
{
var entities = await _rep.AsQueryable()
.Where(m => m.CreatedUserId == UserManager.UserId)
.WhereIF(!string.IsNullOrEmpty(input.Title), u => u.Title.Contains(input.Title))
.WhereIF(!string.IsNullOrEmpty(input.Type), u =>u.Type.Contains(input.Type))
.ToPagedListAsync(input.PageNo, input.PageSize);
var entities = await _rep.AsQueryable()
.Where(m => m.CreatedUserId == UserManager.UserId)
.WhereIF(!string.IsNullOrEmpty(input.Title), u => u.Title.Contains(input.Title))
.WhereIF(!string.IsNullOrEmpty(input.Type), u => u.Type.Contains(input.Type))
.ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult();
}
@ -103,16 +112,91 @@ namespace Myshipping.Application
{
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
}
/// <summary>
/// 下拉获取字段名称
/// </summary>
/// <returns></returns>
[HttpGet("/BookingTemplate/GetFieldName")]
public async Task<dynamic> GetFieldName()
{
BookingOrder order = new BookingOrder();
Dictionary<string, string> dic = new Dictionary<string, string>();
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order))
{
string name = descriptor.Name;
if (name == "TenantId" || name == "CreatedTime" || name == "UpdatedTime" || name == "CreatedUserId" || name == "CreatedUserName")
{
continue;
}
if (!string.IsNullOrWhiteSpace(descriptor.Description))
{
dic.Add(descriptor.Name, descriptor.Description);
}
}
return dic;
}
/// <summary>
/// 新增编辑excel模板
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/BookingTemplate/AddOrUpdateExcelTemplate")]
public async Task<dynamic> AddOrUpdateExcelTemplate(BookingExcelTemplateDto dto) {
if (dto.Id == 0)
{
BookingExcelTemplate bookingExcel = new BookingExcelTemplate();
bookingExcel.Name = dto.Name;
bookingExcel.Type = dto.Type;
await _excelrep.InsertAsync(bookingExcel);
foreach (var item in dto.children)
{
var entity = item.Adapt<BookingExcelTemplateSub>();
entity.Pid = bookingExcel.Id;
await _excelsubrep.InsertAsync(entity);
}
}
else {
var entity = dto.Adapt<BookingExcelTemplate>();
await _excelrep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
await _excelsubrep.DeleteAsync(x => x.Pid == dto.Id);
foreach (var item in dto.children)
{
var ent = item.Adapt<BookingExcelTemplateSub>();
ent.Pid = dto.Id;
await _excelsubrep.InsertAsync(ent);
}
}
return null;
}
/// <summary>
/// 获取excel模板
/// </summary>
/// <param name="Name">模板名称</param>
/// <returns></returns>
[HttpGet("/BookingTemplate/BookingExcelTemplateList")]
public async Task<dynamic> BookingExcelTemplateList(string Name) {
return await _excelrep.AsQueryable().WhereIF(!string.IsNullOrWhiteSpace(Name), x => x.Name.Contains(Name)).ToListAsync();
}
/// <summary>
/// 获取excel模板详情
/// </summary>
/// <param name="Id">模板名称</param>
/// <returns></returns>
[HttpGet("/BookingTemplate/BookingExcelTemplateDetailList")]
public async Task<dynamic> BookingExcelTemplateDetailList(long Id)
{
return await _excelsubrep.AsQueryable().Where( x => x.Pid==Id).ToListAsync();
}
///// <summary>
///// 获取订舱模板列表
///// </summary>
///// <param name="input"></param>
///// <returns></returns>
//[HttpGet("/BookingTemplate/list")]
//public async Task<dynamic> List([FromQuery] QueryBookingTemplateInput input)
//{
// return await _rep.ToListAsync();
//}
}
}

@ -0,0 +1,29 @@
using Myshipping.Application.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.BookingTemplate.Dto
{
public class BookingExcelTemplateDto
{
/// <summary>
/// 业务id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 分类
/// </summary>
public string Type { get; set; }
public List<BookingExcelTemplateSub> children { get; set; }
}
}

@ -6,16 +6,28 @@ using System.Threading.Tasks;
namespace Myshipping.Application
{
public class TaskUserStatResultInfo
{
/// <summary>
/// 第一层(异常/个人/公共)
/// </summary>
public List<TaskUserStatItem> LevelTop { get; set; }
/// <summary>
/// 第二层(待处理/已完成/已取消/已挂起)
/// </summary>
public List<TaskUserStatItemNext> LevelNext { get; set; }
/// <summary>
/// 任务类型树(按照任务类型展示)
/// </summary>
public List<TaskUserStatItemTree> LevelTree { get; set; }
}
/// <summary>
/// 用户任务统计展示
/// </summary>
public class TaskUserStatItem
{
/// <summary>
/// 级别分层1-异常/个人/公共 2-待处理/已完成/已取消/已挂起 3-按照任务类型展示)
/// </summary>
public int Level { get; set; }
/// <summary>
/// 排序值
/// </summary>
@ -42,4 +54,15 @@ namespace Myshipping.Application
public string ActionKey { get; set; }
}
public class TaskUserStatItemNext: TaskUserStatItem
{
public string TopKey { get; set; }
}
public class TaskUserStatItemTree : TaskUserStatItemNext
{
public string NextKey { get; set; }
}
}

@ -30,6 +30,6 @@ namespace Myshipping.Application
/// </summary>
/// <param name="isReCalc">是否强制计算</param>
/// <returns>返回回执</returns>
Task<List<TaskUserStatItem>> GetCurrentTotalStat(bool isReCalc = false);
Task<TaskUserStatResultInfo> GetCurrentTotalStat(bool isReCalc = false);
}
}

@ -316,16 +316,20 @@ namespace Myshipping.Application
/// </summary>
/// <param name="isReCalc">是否强制计算</param>
/// <returns>返回回执</returns>
public async Task<List<TaskUserStatItem>> GetCurrentTotalStat(bool isReCalc = false)
[HttpGet("/TaskManage/GetCurrentTotalStat")]
public async Task<TaskUserStatResultInfo> GetCurrentTotalStat([FromQuery]bool isReCalc = false)
{
List<TaskUserStatItem> resultList = new List<TaskUserStatItem>();
TaskUserStatResultInfo resultInfo = new TaskUserStatResultInfo {
LevelTop = new List<TaskUserStatItem>(),
LevelNext = new List<TaskUserStatItemNext>(),
LevelTree = new List<TaskUserStatItemTree>()
};
/*
1
2isReCalc=true
3/
*/
try
{
var userTendInfo = await _sysUserRepository.AsQueryable()
@ -337,9 +341,9 @@ namespace Myshipping.Application
throw Oops.Oh($"当前用户关联租户信息获取失败");
var statList = _taskStatManageInfoRepository.AsQueryable().Where(t => (t.USER_ID == userTendInfo.User.Id
&& t.STAT_TYPE == "PERSONAL") || (t.COMP_ID == userTendInfo.Tend.Id && t.STAT_TYPE == "PUBLIC")).ToList();
&& t.STAT_TYPE == TaskStatLevelEnum.PERSON.ToString()) || (t.COMP_ID == userTendInfo.Tend.Id && t.STAT_TYPE == TaskStatLevelEnum.PUBLIC.ToString())).ToList();
if (!isReCalc)
if (isReCalc)
{
//任务列表分组统计
var groupList = _taskBaseInfoRepository.AsQueryable()
@ -348,10 +352,167 @@ namespace Myshipping.Application
.Select(p => new
{
Total = SqlFunc.AggregateCount(p.PK_ID),
TaskType = p
TaskType = p.TASK_TYPE,
Status = p.STATUS,
IsExcept = p.IS_EXCEPT,
IsPublic = p.IS_PUBLIC
}).ToList();
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 == 1 && t.IsPublic == 1).ToList();
#region 异常
if (exceptList.Count > 0)
{
resultInfo.LevelTop.Add(new TaskUserStatItem
{
Key = TaskStatLevelEnum.EXCPTION.ToString(),
Name = TaskStatLevelEnum.EXCPTION.GetDescription(),
Total = exceptList.Sum(t=>t.Total),
SortNo = (int)TaskStatLevelEnum.EXCPTION,
ActionKey = TaskStatLevelEnum.EXCPTION.ToString()
});
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);
resultInfo.LevelNext.Add(new TaskUserStatItemNext
{
TopKey = TaskStatLevelEnum.EXCPTION.ToString(),
Key = currEnum.ToString(),
Name = currEnum.GetDescription(),
Total = t.Total,
SortNo = (int)currEnum,
ActionKey = $"{TaskStatLevelEnum.EXCPTION.ToString()}#{currEnum.ToString()}"
});
});
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);
resultInfo.LevelTree.Add(new TaskUserStatItemTree
{
TopKey = TaskStatLevelEnum.EXCPTION.ToString(),
NextKey = t.Key.Status,
Key = currEnum.ToString(),
Name = currEnum.GetDescription(),
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.GetDescription(),
Total = personList.Sum(t => t.Total),
SortNo = (int)TaskStatLevelEnum.PERSON,
ActionKey = TaskStatLevelEnum.PERSON.ToString()
});
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);
resultInfo.LevelNext.Add(new TaskUserStatItemNext
{
TopKey = TaskStatLevelEnum.PERSON.ToString(),
Key = currEnum.ToString(),
Name = currEnum.GetDescription(),
Total = t.Total,
SortNo = (int)currEnum,
ActionKey = $"{TaskStatLevelEnum.PERSON.ToString()}#{currEnum.ToString()}"
});
});
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);
resultInfo.LevelTree.Add(new TaskUserStatItemTree
{
TopKey = TaskStatLevelEnum.PERSON.ToString(),
NextKey = t.Key.Status,
Key = currEnum.ToString(),
Name = currEnum.GetDescription(),
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.GetDescription(),
Total = publicList.Sum(t => t.Total),
SortNo = (int)TaskStatLevelEnum.PUBLIC,
ActionKey = TaskStatLevelEnum.PUBLIC.ToString()
});
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);
resultInfo.LevelNext.Add(new TaskUserStatItemNext
{
TopKey = TaskStatLevelEnum.PUBLIC.ToString(),
Key = currEnum.ToString(),
Name = currEnum.GetDescription(),
Total = t.Total,
SortNo = (int)currEnum,
ActionKey = $"{TaskStatLevelEnum.PUBLIC.ToString()}#{currEnum.ToString()}"
});
});
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);
resultInfo.LevelTree.Add(new TaskUserStatItemTree
{
TopKey = TaskStatLevelEnum.PUBLIC.ToString(),
NextKey = t.Key.Status,
Key = currEnum.ToString(),
Name = currEnum.GetDescription(),
Total = t.Total,
SortNo = (int)currEnum,
ActionKey = $"{TaskStatLevelEnum.PUBLIC.ToString()}#{t.Key.Status}#{currEnum.ToString()}"
});
});
}
#endregion
}
}
catch (Exception ex)
@ -359,7 +520,7 @@ namespace Myshipping.Application
throw Oops.Bah($"获取登陆人相关的任务统计信息异常,{0}", ex.Message);
}
return resultList;
return resultInfo;
}
}
}

Loading…
Cancel
Save