|
|
@ -1,5 +1,7 @@ |
|
|
|
using NPOI.SS.UserModel; |
|
|
|
using NPOI.SS.Formula.Functions; |
|
|
|
|
|
|
|
using NPOI.SS.UserModel; |
|
|
|
using NPOI.SS.Util; |
|
|
|
using NPOI.SS.Util; |
|
|
|
|
|
|
|
using Tiobon.Core.Common; |
|
|
|
using static Tiobon.Core.Model.Consts; |
|
|
|
using static Tiobon.Core.Model.Consts; |
|
|
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
namespace Tiobon.Core.Services; |
|
|
@ -707,9 +709,138 @@ public class Ghre_PlanServices : BaseServices<Ghre_Plan, Ghre_PlanDto, InsertGhr |
|
|
|
#endregion |
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
#region 培训计划达成率 |
|
|
|
#region 培训计划达成率 |
|
|
|
//public async Task<ServicePageResult<UshioPlanReport>> QueryCompletionRateBLT(QueryBody filter) |
|
|
|
|
|
|
|
//{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//} |
|
|
|
public async Task<ServicePageResult<CompletionRateBLT>> QueryCompletionRateBLT(QueryBody filter) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var data = new List<CompletionRateBLT>(); |
|
|
|
|
|
|
|
int totalCount = 0; |
|
|
|
|
|
|
|
bool isFirst = true; |
|
|
|
|
|
|
|
DateTime? startTime = null, endTime = null; |
|
|
|
|
|
|
|
string seachType = string.Empty; |
|
|
|
|
|
|
|
int? deptId_40 = null, deptId_30 = null, deptId_20 = null; |
|
|
|
|
|
|
|
int? deptId = null; |
|
|
|
|
|
|
|
if (filter.jsonParam != null) |
|
|
|
|
|
|
|
foreach (JProperty jProperty in filter.jsonParam.Properties()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
isFirst = false; |
|
|
|
|
|
|
|
var name = jProperty.Name; |
|
|
|
|
|
|
|
var value = jProperty.Value.ToString(); |
|
|
|
|
|
|
|
if (name == "page" || name == "pageSize") |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (name == "Month") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var jsonParam = JsonConvert.DeserializeObject<JsonParam>(value); |
|
|
|
|
|
|
|
var ids1 = JsonHelper.JsonToObj<List<DateTime>>(jsonParam.columnValue.ToString()); |
|
|
|
|
|
|
|
startTime = ids1[0]; |
|
|
|
|
|
|
|
endTime = ids1[1]; |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (name == "SeachType") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var jsonParam = JsonConvert.DeserializeObject<JsonParam>(value); |
|
|
|
|
|
|
|
seachType = jsonParam.columnValue.ToString(); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (name == "DeptId_40") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var jsonParam = JsonConvert.DeserializeObject<JsonParam>(value); |
|
|
|
|
|
|
|
deptId_40 = jsonParam.columnValue.ObjToInt(); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (name == "DeptId_30") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var jsonParam = JsonConvert.DeserializeObject<JsonParam>(value); |
|
|
|
|
|
|
|
deptId_30 = jsonParam.columnValue.ObjToInt(); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (name == "DeptId_20") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var jsonParam = JsonConvert.DeserializeObject<JsonParam>(value); |
|
|
|
|
|
|
|
deptId_20 = jsonParam.columnValue.ObjToInt(); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isFirst) return new ServicePageResult<CompletionRateBLT>(filter.pageNum, totalCount, filter.pageSize, data); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filter.pageSize = 10000; |
|
|
|
|
|
|
|
if (startTime.IsNullOrEmpty()) |
|
|
|
|
|
|
|
throw new Exception("请先选择月份!"); |
|
|
|
|
|
|
|
if (seachType.IsNullOrEmpty()) |
|
|
|
|
|
|
|
throw new Exception("请先选择查询类别!"); |
|
|
|
|
|
|
|
if (!(deptId_40.IsNotEmptyOrNull() || deptId_30.IsNotEmptyOrNull() || deptId_20.IsNotEmptyOrNull())) |
|
|
|
|
|
|
|
throw new Exception("请先选择部门!"); |
|
|
|
|
|
|
|
var aaa = 0; |
|
|
|
|
|
|
|
if (deptId_40.IsNotEmptyOrNull()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
aaa++; |
|
|
|
|
|
|
|
deptId = deptId_40; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (deptId_30.IsNotEmptyOrNull()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
aaa++; |
|
|
|
|
|
|
|
deptId = deptId_30; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (deptId_20.IsNotEmptyOrNull()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
aaa++; |
|
|
|
|
|
|
|
deptId = deptId_20; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (aaa > 1) |
|
|
|
|
|
|
|
throw new Exception("部门层架筛选条件不可组合使用!"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var deptName = await Db.Queryable<Ghro_Dept>().Where(x => x.DeptID == deptId).Select(x => x.DeptName).FirstAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var deptName1 = await Db.Ado.GetStringAsync(@$"SELECT GHR30.dbo.[FO_DeptInfo] (
|
|
|
|
|
|
|
|
{deptId}, |
|
|
|
|
|
|
|
getdate (), |
|
|
|
|
|
|
|
1, |
|
|
|
|
|
|
|
'DeptFullPateName');");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (seachType == "Month") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
for (DateTime? dt = startTime; dt <= endTime; dt = dt.Value.AddMonths(1)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
string formatted = dt.Value.ToString("yyyy-MM"); |
|
|
|
|
|
|
|
data.Add(new CompletionRateBLT |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Month = formatted |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
data.Add(new CompletionRateBLT |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Month = $"{startTime.Value.ToString("yyyy-MM")}~{endTime.Value.ToString("yyyy-MM")}" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < data.Count; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data[i].Id = i + 1; |
|
|
|
|
|
|
|
data[i].Id = i + 1; |
|
|
|
|
|
|
|
data[i].RowNo = i + 1; |
|
|
|
|
|
|
|
data[i].DeptName = deptName; |
|
|
|
|
|
|
|
data[i].DeptFullName = deptName1; |
|
|
|
|
|
|
|
//var examCount = await Db.Queryable<Ghre_ExamRecord>() |
|
|
|
|
|
|
|
// .Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value)) |
|
|
|
|
|
|
|
// .CountAsync(); |
|
|
|
|
|
|
|
//var passCount = await Db.Queryable<Ghre_ExamRecord>() |
|
|
|
|
|
|
|
// .Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value) && x.IsPass == true) |
|
|
|
|
|
|
|
// .CountAsync(); |
|
|
|
|
|
|
|
//if (passCount > 0 && examCount > 0) |
|
|
|
|
|
|
|
// data[i].PassPercent = passCount / examCount; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ServicePageResult<CompletionRateBLT>(filter.pageNum, totalCount, filter.pageSize, data); |
|
|
|
|
|
|
|
} |
|
|
|
#endregion |
|
|
|
#endregion |
|
|
|
} |
|
|
|
} |