Merge branch 'master' of http://121.41.2.71:3000/wyw/mh_jy_safe
This commit is contained in:
commit
52c48630cf
@ -134,6 +134,7 @@ namespace APT.MS.Domain.Enums
|
||||
|
||||
public enum SETrainRecordStatus
|
||||
{
|
||||
已取消 = -1,
|
||||
草稿 = 0,
|
||||
签到中 = 1,
|
||||
审阅中 = 2,
|
||||
|
||||
@ -216,7 +216,7 @@ namespace APT.PF.WebApiControllers.Api.PF
|
||||
string userId = filter == null ? string.Empty : filter.Keyword;
|
||||
int platformType = filter == null ? (int)PFPlatTypeEnum.后台 : string.IsNullOrEmpty(filter.Parameter3)
|
||||
? (int)PFPlatTypeEnum.后台 : Convert.ToInt32(filter.Parameter3);
|
||||
Guid orgId = filter.OrgId??Guid.Empty;
|
||||
Guid orgId = filter.OrgId ?? Guid.Empty;
|
||||
|
||||
#region 登录优化 orgId
|
||||
|
||||
@ -580,7 +580,7 @@ namespace APT.PF.WebApiControllers.Api.PF
|
||||
// sysLogService.AddLoginLog(result.User.ID, platformType);
|
||||
//else
|
||||
// sysLogService.AddLoginLogByApp(result.User.ID, platformType, filter);
|
||||
if (result.User.NAME != "管理员")
|
||||
if (!result.User.NAME.Contains("管理员"))// if (result.User.NAME != "管理员")
|
||||
{
|
||||
T_BI_LOGIN_RECORD loginRecord = new T_BI_LOGIN_RECORD
|
||||
{
|
||||
|
||||
@ -2058,7 +2058,7 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
List<Guid> allSendUserIds = null;
|
||||
List<string> allSendUserNames = null;
|
||||
List<T_FM_NOTIFICATION_TASK> sendNotice = null;
|
||||
|
||||
List<T_SE_TRAIN_RECORD_USER> listUserDoAuto = null;
|
||||
foreach (var item in iListR)
|
||||
{
|
||||
try
|
||||
@ -2103,19 +2103,34 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
{
|
||||
if (listDon.Contains(e.USER_ID))
|
||||
{
|
||||
e.NOTICE_STATUS = 0;
|
||||
e.NOTICE_STATUS = 1;
|
||||
e.TASK_DT = DateTime.Now;
|
||||
}
|
||||
});
|
||||
listUserDoAuto = new List<T_SE_TRAIN_RECORD_USER>();
|
||||
listUserDoAuto = iListTemp.Where(e => listDon.Contains(e.USER_ID)).ToList();
|
||||
foreach (var itemAuto in listUserDoAuto)
|
||||
{
|
||||
itemAuto.OK = true;
|
||||
itemAuto.STATUS = SETrainRecordUserStatusEnum.参与;
|
||||
itemAuto.DT_SIGN = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
listUserDoAuto = null;
|
||||
}
|
||||
item.DT_SSEND_SIGN = DateTime.Now;
|
||||
item.STATUS = SETrainRecordStatus.签到中;
|
||||
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
UpdateEntityNoCommit(modelTr);
|
||||
UpdateEntityNoCommit(item);
|
||||
if (sendNotice != null && sendNotice.Any())
|
||||
BantchSaveEntityNoCommit(sendNotice);
|
||||
if (listUserDoAuto != null && listUserDoAuto.Any())
|
||||
BantchSaveEntityNoCommit(listUserDoAuto);
|
||||
});
|
||||
}
|
||||
catch { }
|
||||
|
||||
@ -801,7 +801,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
|
||||
#region 3
|
||||
var productionUnits = this.GetEntities<T_FM_USER_PRODUCTION_UNIT_SET>(t => t.IS_DELETED == false, new BaseFilter(filter.OrgId));
|
||||
var productIds = productionUnits.OrderBy(m=>m.ID).Select(t => t.ID).ToList();
|
||||
var productIds = productionUnits.OrderBy(m => m.ID).Select(t => t.ID).ToList();
|
||||
PerformanceModel modelMineType = new PerformanceModel();
|
||||
foreach (var id in productIds)
|
||||
{
|
||||
@ -842,13 +842,13 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
#region 5
|
||||
//抓管控层级子表
|
||||
riskFilter.SelectField = new string[] { "ENTERPRISE_LIBRARY_ID", "DEPARTMENT_TYPE", "DEPARTMENT_ID", "USER_ID", "APPROVE_ROLE_ID", "ID" };
|
||||
var libMeasures = GetEntities<T_SK_ENTERPRISE_LIBRARY_DEPART>(t => t.IS_DELETED ==false, riskFilter);
|
||||
var libMeasures = GetEntities<T_SK_ENTERPRISE_LIBRARY_DEPART>(t => t.IS_DELETED == false, riskFilter);
|
||||
var departIds = libMeasures.Select(t => t.DEPARTMENT_ID).Distinct().ToList();
|
||||
var distinctDepartment = departments.Where(t => departIds.Contains(t.ID)).ToList();
|
||||
PerformanceModel modelZRDY = new PerformanceModel();
|
||||
foreach (var department in distinctDepartment)
|
||||
{
|
||||
var libIds = libMeasures.Where(t => t.DEPARTMENT_ID == department.ID).Select(m=>m.ENTERPRISE_LIBRARY_ID).Distinct().ToList();
|
||||
var libIds = libMeasures.Where(t => t.DEPARTMENT_ID == department.ID).Select(m => m.ENTERPRISE_LIBRARY_ID).Distinct().ToList();
|
||||
var countLevel1 = allrisk.Count(t => libIds.Contains(t.ID) && t.EVALUATE_LEVEL == SKEvaluateLevelEnum.重大风险);
|
||||
var countLevel2 = allrisk.Count(t => libIds.Contains(t.ID) && t.EVALUATE_LEVEL == SKEvaluateLevelEnum.较大风险);
|
||||
var countLevel3 = allrisk.Count(t => libIds.Contains(t.ID) && t.EVALUATE_LEVEL == SKEvaluateLevelEnum.一般风险);
|
||||
@ -1125,7 +1125,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
/// <summary>
|
||||
/// 安全培训教育统计分析
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">返回系统用户数</param>
|
||||
/// <param name="filter">返回系统用户数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("getSafeTrainData")]
|
||||
public JsonActionResult<safeTrainData> getSafeTrainData([FromBody] KeywordFilter filter)
|
||||
@ -1135,13 +1135,11 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
var riskFilter = new BaseFilter(filter.GetOrgId());
|
||||
riskFilter.Include = new string[] { "Nav_Notify.Nav_TrainUserList", "Nav_Users", "Nav_Notify" };
|
||||
DateTime time = DateTime.Parse(filter.Parameter1);
|
||||
DateTime currYear = DateTime.Parse(time.Year + " 01-01");
|
||||
DateTime currYear = DateTime.Parse(time.Year + " 01-01 00:00:00");
|
||||
var startTime = time.AddDays(1 - time.Day);
|
||||
var endTime = time.AddDays(1 - time.Day).AddMonths(1);
|
||||
var records = GetEntities<T_SE_TRAIN_RECORD>(t => t.CREATE_TIME > currYear, riskFilter);
|
||||
var testCount = GetCount<T_SE_TEST>(t => t.IS_DELETED == false, new BaseFilter(filter.GetOrgId()));
|
||||
var threeLevelCount = GetCount<T_SE_THREE_LEVEL_SAFE_EDU_CARD>(t => t.IS_DELETED == false, new BaseFilter(filter.GetOrgId()));
|
||||
var currMonthrecords = records.Where(t => t.CREATE_TIME > startTime && t.CREATE_TIME < endTime).OrderBy(t => t.Nav_Notify.TRAIN_START_TIME);
|
||||
var records = GetEntities<T_SE_TRAIN_RECORD>(t => t.CREATE_TIME >= currYear && !t.IS_DELETED && t.STATUS != SETrainRecordStatus.已取消, riskFilter);
|
||||
var currMonthrecords = records.Where(t => t.CREATE_TIME > startTime && t.CREATE_TIME < endTime).OrderByDescending(t => t.Nav_Notify.TRAIN_START_TIME);//.OrderBy
|
||||
var recordids = currMonthrecords.Select(t => t.ID);
|
||||
var examFilter = new BaseFilter(filter.GetOrgId());
|
||||
examFilter.SelectField = new string[] { "USER_ID", "RECORD_ID", "SCORE" };
|
||||
@ -1152,38 +1150,67 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
var effects = GetEntities<T_SE_TRAINING_EFFECT_EVALUATION>(t => notifyIds.Contains((Guid)t.SURVEY_ID), effectFilter);
|
||||
|
||||
List<trainRecords> trainRecords = new List<trainRecords>();
|
||||
int countPer = 0;
|
||||
int countPass = 0;
|
||||
foreach (var item in currMonthrecords)
|
||||
{
|
||||
trainRecords trainRecord = new trainRecords();
|
||||
trainRecord.NAME = item.Nav_Notify.NAME;
|
||||
trainRecord.TIMERANGE = item.Nav_Notify.TRAIN_START_TIME + "-" + item.Nav_Notify.TRAIN_END_TIME;
|
||||
trainRecord.SHOULD_TRAINER = item.Nav_Notify.Nav_TrainUserList.Count();
|
||||
trainRecord.ACTUAL_TRAINER = item.Nav_Users.Count();
|
||||
if (item.Nav_Notify.TRAIN_START_TIME.HasValue && item.Nav_Notify.TRAIN_END_TIME.HasValue && item.Nav_Notify.TRAIN_START_TIME.Value.Date == item.Nav_Notify.TRAIN_END_TIME.Value.Date)
|
||||
{
|
||||
trainRecord.TIMERANGE = item.Nav_Notify.TRAIN_START_TIME + " - " + item.Nav_Notify.TRAIN_END_TIME.Value.ToString("HH:mm:ss");
|
||||
}
|
||||
else
|
||||
{
|
||||
trainRecord.TIMERANGE = item.Nav_Notify.TRAIN_START_TIME + "-" + item.Nav_Notify.TRAIN_END_TIME;
|
||||
}
|
||||
trainRecord.SHOULD_TRAINER = item.Nav_Notify.Nav_TrainUserList.Where(e => !e.IS_DELETED).Count();//
|
||||
trainRecord.ACTUAL_TRAINER = item.Nav_Users.Where(e => !e.IS_DELETED && e.OK).Count();//有签到
|
||||
|
||||
//trainRecord.METHOD = item.Nav_Notify.Nav_TrainCheckType.NAME;
|
||||
//if (item.Nav_Notify.Nav_TrainCheckType.NAME == "笔试")
|
||||
|
||||
trainRecord.METHOD = item.Nav_Notify.CHECKTYPE.GetDescription();
|
||||
if (item.Nav_Notify.CHECKTYPE == PlanCheckType.InOnLine)
|
||||
{
|
||||
var currExams = exams.Where(t => t.RECORD_ID == item.ID);
|
||||
var currCount = currExams.Count();
|
||||
if (currCount > 0)
|
||||
{
|
||||
var passExams = currExams.Where(t => t.SCORE >= 80);
|
||||
var passCount = passExams.Count();
|
||||
var rate = (passCount * 1.0 / currCount);
|
||||
trainRecord.PASS_RATE = rate.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
trainRecord.PASS_RATE = "0";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trainRecord.PASS_RATE = "1";
|
||||
}
|
||||
trainRecord.METHOD = item.Nav_Notify.CHECKTYPE.GetDescription();
|
||||
|
||||
|
||||
#region 考试通过率 //T_SE_TRAIN_RECORD_USER SEExaminationResultsEnum? EXAMINATION_RESULTS { get; set; }
|
||||
|
||||
countPer = item.Nav_Users.Where(e => !e.IS_DELETED).Count();
|
||||
countPass = item.Nav_Users.Where(e => !e.IS_DELETED && e.EXAMINATION_RESULTS.HasValue && e.EXAMINATION_RESULTS.Value == SEExaminationResultsEnum.合格).Count();
|
||||
if (countPer == 0)
|
||||
{
|
||||
trainRecord.PASS_RATE = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
trainRecord.PASS_RATE = (countPass * 1.00 / countPer).ToString();
|
||||
}
|
||||
|
||||
//if (item.Nav_Notify.CHECKTYPE == PlanCheckType.InOnLine)
|
||||
//{
|
||||
// var currExams = exams.Where(t => t.RECORD_ID == item.ID);
|
||||
// //var currCount = currExams.Count();
|
||||
// var currCount = trainRecord.ACTUAL_TRAINER;//分母应该是 有参加培训的人数
|
||||
// if (currCount > 0)
|
||||
// {
|
||||
// var passExams = currExams.Where(t => t.SCORE >= 80);
|
||||
// var passCount = passExams.Count();
|
||||
// var rate = (passCount * 1.0 / currCount);
|
||||
// trainRecord.PASS_RATE = rate.ToString();
|
||||
// var ccc = (3 * 1.00 / 10).ToString();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// trainRecord.PASS_RATE = "0";
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// trainRecord.PASS_RATE = "1";
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
if (item.Nav_Notify.NEED_EVALUATION == SETrainNeedSuvey.是)
|
||||
{
|
||||
var effect = effects.FirstOrDefault(t => t.SURVEY_ID == item.NOTIFY_ID);
|
||||
@ -1198,7 +1225,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
sumTotal += num1;
|
||||
sumTotal += num2;
|
||||
}
|
||||
trainRecord.EFFORT_RATE = (sumTotal / effectResult.Count()).ToString();
|
||||
trainRecord.EFFORT_RATE = (1.00 * sumTotal / effectResult.Count()).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1207,7 +1234,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
}
|
||||
else
|
||||
{
|
||||
trainRecord.EFFORT_RATE = "100";
|
||||
trainRecord.EFFORT_RATE = "-";
|
||||
|
||||
}
|
||||
trainRecords.Add(trainRecord);
|
||||
@ -1220,17 +1247,17 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
DateTime endTime1 = new DateTime(today.Year, i, 1).AddMonths(1).AddSeconds(-1);
|
||||
dateCountModel riskDate = new dateCountModel();
|
||||
riskDate.DATE = startTime1;
|
||||
riskDate.COUNT = records.Count(t => t.CREATE_TIME > startTime1 && t.CREATE_TIME < endTime1);
|
||||
riskDate.COUNT = records.Count(t => t.CREATE_TIME >= startTime1 && t.CREATE_TIME <= endTime1);
|
||||
item3s.Add(riskDate);
|
||||
}
|
||||
safeTrainData safeTrainData = new safeTrainData();
|
||||
safeTrainData.NUM1 = 1;
|
||||
safeTrainData.NUM2 = records.Count();
|
||||
safeTrainData.NUM3 = threeLevelCount;
|
||||
safeTrainData.NUM3 = GetCount<T_SE_THREE_LEVEL_SAFE_EDU_CARD>(t => t.IS_DELETED == false, new BaseFilter(filter.GetOrgId()));
|
||||
safeTrainData.NUM4 = 13;
|
||||
safeTrainData.NUM5 = 14;
|
||||
safeTrainData.NUM6 = 15;
|
||||
safeTrainData.NUM7 = testCount;
|
||||
safeTrainData.NUM7 = GetCount<T_SE_TEST>(t => t.IS_DELETED == false, new BaseFilter(filter.GetOrgId()));
|
||||
safeTrainData.trainRecords = trainRecords;
|
||||
safeTrainData.dateCountModel = item3s;
|
||||
return safeTrainData;
|
||||
|
||||
@ -58,9 +58,9 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
{
|
||||
throw new Exception("截止时间至少比发起时间要大于一天");
|
||||
}
|
||||
if (Demands == null || !Demands.Any() || Demands.Count() < 1)
|
||||
if (Demands == null || !Demands.Any() || Demands.Count() < 1 || Demands.Where(e => !e.IS_DELETED).Count() < 1)
|
||||
{
|
||||
throw new Exception("请添加培训人员信息!");
|
||||
throw new Exception("请添加调查人员信息!");
|
||||
}
|
||||
if (entity.LAUNCH_USER_ID == Guid.Empty)
|
||||
{
|
||||
|
||||
@ -242,6 +242,16 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
userFilter.Include = new string[] { "Nav_Person.Nav_Post", "Nav_Department" };
|
||||
IEnumerable<T_FM_USER> userNames = GetEntities<T_FM_USER>(t => sendUserAll.Contains(t.ID), userFilter);
|
||||
|
||||
//List<Guid> listAuto = new List<Guid>();
|
||||
//if (entity.RECORD_USER_ID.HasValue && sendUsers.Contains(entity.RECORD_USER_ID.Value))
|
||||
//{
|
||||
// listAuto.Add(entity.RECORD_USER_ID.Value);
|
||||
//}
|
||||
//if (entity.USER_ID_TEACHER.HasValue && !listAuto.Contains(entity.USER_ID_TEACHER.Value))
|
||||
//{
|
||||
// listAuto.Add(entity.USER_ID_TEACHER.Value);
|
||||
//}
|
||||
|
||||
T_FM_USER userCheck = null;
|
||||
foreach (var user in Nav_TrainUserList)
|
||||
{
|
||||
@ -275,6 +285,11 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
|
||||
user.DEPARTMENT_NAME = userCheck.Nav_Department?.NAME;
|
||||
user.POST_NAME = userCheck.Nav_Person?.Nav_Post?.NAME;
|
||||
|
||||
//if (listAuto != null && listAuto.Count > 0 && listAuto.Contains(user.USER_ID))
|
||||
//{
|
||||
// user.IS_LEAVE = SETrainYesNoEnum.参加;
|
||||
//}
|
||||
}
|
||||
foreach (var user in sendUsers)
|
||||
{
|
||||
@ -289,6 +304,19 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
}
|
||||
|
||||
sendNoticeTask = NotificationTaskService.InsertUserNoticeTaskModels("培训通知-" + entity.NAME + "-确认", entity.ID, entity.ORG_ID, sendUsers, allSendUserNames, DateTime.Now, DateTime.Now.AddDays(1), (int)FMNoticeTypeEnum.消息, "SE013_SHOWPRINT");
|
||||
|
||||
//if (listAuto != null && listAuto.Count > 0)
|
||||
//{
|
||||
// foreach (var item in sendNoticeTask)
|
||||
// {
|
||||
// if (listAuto.Contains(item.USER_ID))
|
||||
// {
|
||||
// item.NOTICE_STATUS = 1;
|
||||
// item.TASK_DT = DateTime.Now;
|
||||
// item.MODIFIER_ID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -169,6 +169,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
|
||||
entity.ISSTOPSIGN = true;//停止签到
|
||||
entity.MODIFY_TIME = DateTime.Now;
|
||||
entity.STATUS = SETrainRecordStatus.已取消;
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
UpdateEntityNoCommit(entity);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user