1584 lines
79 KiB
C#
1584 lines
79 KiB
C#
using APT.BaseData.Domain.Entities;
|
||
using APT.BaseData.Domain.Entities.FM;
|
||
using APT.BaseData.Domain.Enums;
|
||
using APT.BaseData.Domain.Enums.PF;
|
||
using APT.BaseData.Domain.IServices;
|
||
using APT.BaseData.Domain.IServices.FM;
|
||
using APT.Infrastructure.Core;
|
||
using APT.MS.Domain.Entities.FO;
|
||
using APT.MS.Domain.Entities.SC;
|
||
using APT.MS.Domain.Enums;
|
||
using APT.Utility;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
|
||
namespace APT.SC.WebApi.Controllers.Api.SC
|
||
{
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
[Route("api/SC/SCMtMeetingMinutes")]
|
||
public class SCMtMeetingMinutesController : AuthorizeApiController<T_SC_MT_MEETING_MINUTES>
|
||
{
|
||
IFMFlowPermitService MFlowPermitService { get; set; }
|
||
IFMUserService FMUserService { get; set; }
|
||
IPFApproveCallBackService ApproveCallBackService { get; set; }
|
||
IFMNotificationTaskService FMNotificActionTaskService { get; set; }
|
||
IFMNotificationTaskService NotificationTaskService { get; set; }
|
||
IPFCodeRuleService CodeRuleService { get; set; }
|
||
public SCMtMeetingMinutesController(IFMUserService fMUserService, IFMFlowPermitService mFlowPermitService, IPFApproveCallBackService approveCallBackService, IPFCodeRuleService codeRuleService, IFMNotificationTaskService fMNotificActionTaskService, IFMNotificationTaskService notificationTaskService)
|
||
{
|
||
FMUserService = fMUserService;
|
||
MFlowPermitService = mFlowPermitService;
|
||
ApproveCallBackService = approveCallBackService;
|
||
FMNotificActionTaskService = fMNotificActionTaskService;
|
||
NotificationTaskService = notificationTaskService;
|
||
CodeRuleService = codeRuleService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 编辑页面过滤 评审人
|
||
/// </summary>
|
||
/// <param name="filter"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("Get")]
|
||
public JsonActionResult<T_SC_MT_MEETING_MINUTES> Get([FromBody] KeywordFilter filter)
|
||
{
|
||
return SafeExecute<T_SC_MT_MEETING_MINUTES>(() =>
|
||
{
|
||
Guid ID = Guid.Empty;
|
||
if (filter.FilterGroup.Rules != null && filter.FilterGroup.Rules.Any())
|
||
{
|
||
foreach (var item in filter.FilterGroup.Rules)
|
||
{
|
||
if (item.Field == "ID")
|
||
{
|
||
ID = new Guid(item.Value.ToString());
|
||
filter.FilterGroup.Rules.Remove(item);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
T_SC_MT_MEETING_MINUTES result = null;
|
||
if (ID == Guid.Empty)
|
||
{
|
||
result = GetEntity<T_SC_MT_MEETING_MINUTES>(null, filter);
|
||
}
|
||
else
|
||
{
|
||
ICollection<string> IncludeMinutes = new List<string>();
|
||
//ICollection<string> IncludeMinutesUserExt = new List<string>();
|
||
bool isUserExt = false;
|
||
List<string> IncludeMinutesContent = new List<string>();
|
||
ICollection<string> IncludeMeeting = new List<string>();
|
||
ICollection<string> IncludeMinutesUserSign = new List<string>();//需要签名的
|
||
foreach (var item in filter.Include)
|
||
{
|
||
//if (item == "Nav_ListContent.Nav_ListContentDeal" || item == "Nav_ListContent.Nav_Content.Nav_ListContentDeal" || item == "Nav_ListMeetingContent.Nav_ContentName" || item == "Nav_ListMeetingContent")
|
||
//{
|
||
// //会议纪要 拉出了 会议的会议内容
|
||
// IncludeMeeting.Add(item);
|
||
//}
|
||
//else
|
||
|
||
if (item.Contains("Nav_Meeting"))
|
||
{
|
||
if (item != "Nav_Meeting" && item != "Nav_Meeting.Nav_UserHost" && item != "Nav_Meeting.Nav_UserRecorder")
|
||
{
|
||
IncludeMeeting.Add(item.Substring(12));
|
||
}
|
||
}
|
||
else if (item.Contains("Nav_ListContent"))
|
||
{
|
||
if (item != "Nav_ListContent")
|
||
IncludeMinutesContent.Add(item.Substring(16));
|
||
}
|
||
else if (item.Contains("Nav_User") && item.StartsWith("Nav_ListP"))
|
||
{
|
||
if (item.Contains("Nav_UserSignFiles"))
|
||
{
|
||
IncludeMinutesUserSign.Add(item);
|
||
}
|
||
|
||
|
||
IncludeMinutes.Add(item.Split(".Nav_User")[0]);//人员拆分搜索
|
||
if (!isUserExt && item.Contains(".Nav_User."))
|
||
{
|
||
isUserExt = true;
|
||
}
|
||
//if (item.Contains(".Nav_User."))
|
||
//{
|
||
// IncludeMinutesUserExt.Add(item.Split(".Nav_User.")[1]);
|
||
//}
|
||
}
|
||
else
|
||
{
|
||
IncludeMinutes.Add(item);
|
||
}
|
||
}
|
||
//if (IncludeMinutesUserExt.Count > 0)
|
||
//{
|
||
// IncludeMinutesUserExt = IncludeMinutesUserExt.Distinct().ToList();
|
||
//}
|
||
|
||
filter.Include = IncludeMinutes;
|
||
|
||
result = GetEntity<T_SC_MT_MEETING_MINUTES>(e => e.ID == ID, IncludeMinutes.ToArray());
|
||
var meeting = GetEntity<T_SC_MT_MEETING>(e => e.ID == result.MEETING_ID, IncludeMeeting.ToArray());
|
||
|
||
if (IncludeMinutesContent != null && IncludeMinutesContent.Count > 0)
|
||
{
|
||
if (IncludeMinutesContent.Contains("Nav_ListContentDeal") && !IncludeMinutesContent.Contains("Nav_ListContentDeal.Nav_ContentDeal"))
|
||
{
|
||
IncludeMinutesContent.Add("Nav_ListContentDeal.Nav_ContentDeal");
|
||
}
|
||
var contents = GetEntities<T_SC_MT_MEETING_MINUTES_CONTENT>(e => e.MEETING_MINUTES_ID == ID, null, IncludeMinutesContent.ToArray());
|
||
if (contents != null && contents.Any())
|
||
{
|
||
result.Nav_ListContent = contents.ToList();
|
||
}
|
||
else
|
||
{
|
||
result.Nav_ListContent = new List<T_SC_MT_MEETING_MINUTES_CONTENT>();
|
||
}
|
||
}
|
||
//1 "Nav_ListPReview.Nav_User"
|
||
//10 "Nav_ListPAskForLeave.Nav_User"
|
||
//11 "Nav_ListPAbsence.Nav_User"
|
||
//13 "Nav_ListPJoin.Nav_User"
|
||
|
||
List<Guid> listUserID = new List<Guid>();
|
||
//List<Guid> listUserIDSign = new List<Guid>();
|
||
if (meeting.USER_ID_HOST.HasValue)
|
||
{
|
||
listUserID.Add(meeting.USER_ID_HOST.Value);//主持人
|
||
}
|
||
if (meeting.USER_ID_RECORDER.HasValue)
|
||
{
|
||
listUserID.Add(meeting.USER_ID_RECORDER.Value);//记录人
|
||
}
|
||
|
||
if (result.Nav_ListPReview != null && result.Nav_ListPReview.Any())
|
||
{
|
||
listUserID.AddRange(result.Nav_ListPReview.Select(e => e.USER_ID));
|
||
}
|
||
if (result.Nav_ListPAskForLeave != null && result.Nav_ListPAskForLeave.Any())
|
||
{
|
||
listUserID.AddRange(result.Nav_ListPAskForLeave.Select(e => e.USER_ID));
|
||
}
|
||
if (result.Nav_ListPAbsence != null && result.Nav_ListPAbsence.Any())
|
||
{
|
||
listUserID.AddRange(result.Nav_ListPAbsence.Select(e => e.USER_ID));
|
||
}
|
||
if (result.Nav_ListPJoin != null && result.Nav_ListPJoin.Any())
|
||
{
|
||
listUserID.AddRange(result.Nav_ListPJoin.Select(e => e.USER_ID));
|
||
//listUserIDSign.AddRange(result.Nav_ListPJoin.Select(e => e.USER_ID));
|
||
}
|
||
|
||
if (listUserID.Count > 0)
|
||
{
|
||
listUserID = listUserID.Distinct().ToList();
|
||
var listUserAll = GetEntities<T_FM_USER>(e => listUserID.Contains(e.ID), null, null);
|
||
//if (listUserAll != null && listUserAll.Any() && listUserIDSign.Count > 0)
|
||
//{
|
||
// var listUserSign = GetEntities<T_FM_USER_SIGN_FILE>(e => listUserIDSign.Contains(e.USER_ID), null, "Nav_ImgFile");
|
||
// foreach (var item in listUserAll)
|
||
// {
|
||
// if (listUserIDSign.Contains(item.ID))
|
||
// {
|
||
// item.Nav_UserSignFiles = listUserSign.Where(e => e.USER_ID == item.ID).ToList();
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
if (result.Nav_ListPReview != null && result.Nav_ListPReview.Any())
|
||
{
|
||
foreach (var item in result.Nav_ListPReview)
|
||
{
|
||
item.Nav_User = listUserAll.FirstOrDefault(e => e.ID == item.USER_ID);
|
||
}
|
||
}
|
||
if (result.Nav_ListPAskForLeave != null && result.Nav_ListPAskForLeave.Any())
|
||
{
|
||
foreach (var item in result.Nav_ListPAskForLeave)
|
||
{
|
||
item.Nav_User = listUserAll.FirstOrDefault(e => e.ID == item.USER_ID);
|
||
}
|
||
}
|
||
if (result.Nav_ListPAbsence != null && result.Nav_ListPAbsence.Any())
|
||
{
|
||
foreach (var item in result.Nav_ListPAbsence)
|
||
{
|
||
item.Nav_User = listUserAll.FirstOrDefault(e => e.ID == item.USER_ID);
|
||
}
|
||
}
|
||
if (result.Nav_ListPJoin != null && result.Nav_ListPJoin.Any())
|
||
{
|
||
foreach (var item in result.Nav_ListPJoin)
|
||
{
|
||
item.Nav_User = listUserAll.FirstOrDefault(e => e.ID == item.USER_ID);
|
||
}
|
||
}
|
||
|
||
|
||
if (meeting.USER_ID_HOST.HasValue)
|
||
{
|
||
meeting.Nav_UserHost = listUserAll.FirstOrDefault(e => e.ID == meeting.USER_ID_HOST.Value);//主持人
|
||
}
|
||
if (meeting.USER_ID_RECORDER.HasValue)
|
||
{
|
||
meeting.Nav_UserRecorder = listUserAll.FirstOrDefault(e => e.ID == meeting.USER_ID_RECORDER.Value);//记录人
|
||
}
|
||
|
||
if (isUserExt)
|
||
{
|
||
//评审人员 和 参加人 额外显示部门职位信息
|
||
List<Guid> listDepID = new List<Guid>();
|
||
List<Guid> listPersonID = new List<Guid>();
|
||
listDepID.AddRange(result.Nav_ListPJoin.Where(e => e.Nav_User.DEPARTMENT_ID.HasValue).Select(e => e.Nav_User.DEPARTMENT_ID.Value).ToList());
|
||
listDepID.AddRange(result.Nav_ListPReview.Where(e => e.Nav_User.DEPARTMENT_ID.HasValue).Select(e => e.Nav_User.DEPARTMENT_ID.Value).ToList());
|
||
|
||
listPersonID.AddRange(result.Nav_ListPJoin.Where(e => e.Nav_User.PERSON_ID.HasValue).Select(e => e.Nav_User.PERSON_ID.Value).ToList());
|
||
listPersonID.AddRange(result.Nav_ListPReview.Where(e => e.Nav_User.PERSON_ID.HasValue).Select(e => e.Nav_User.PERSON_ID.Value).ToList());
|
||
|
||
listDepID = listDepID.Distinct().ToList();
|
||
listPersonID = listPersonID.Distinct().ToList();
|
||
if (listDepID != null)
|
||
{
|
||
var listDep = GetEntities<T_FM_DEPARTMENT>(e => listDepID.Contains(e.ID), null, null);
|
||
foreach (var item in result.Nav_ListPJoin)
|
||
{
|
||
if (item.Nav_User.DEPARTMENT_ID.HasValue)
|
||
item.Nav_User.Nav_Department = listDep.FirstOrDefault(e => item.Nav_User.DEPARTMENT_ID == e.ID);
|
||
}
|
||
foreach (var item in result.Nav_ListPReview)
|
||
{
|
||
if (item.Nav_User.DEPARTMENT_ID.HasValue)
|
||
item.Nav_User.Nav_Department = listDep.FirstOrDefault(e => item.Nav_User.DEPARTMENT_ID == e.ID);
|
||
}
|
||
}
|
||
if (listPersonID != null && listPersonID.Any())
|
||
{
|
||
var listPersons = GetEntities<T_FM_PERSON>(e => listPersonID.Contains(e.ID), null, "Nav_Post");
|
||
foreach (var item in result.Nav_ListPJoin)
|
||
{
|
||
if (item.Nav_User.PERSON_ID.HasValue)
|
||
item.Nav_User.Nav_Person = listPersons.FirstOrDefault(e => item.Nav_User.PERSON_ID == e.ID);
|
||
}
|
||
foreach (var item in result.Nav_ListPReview)
|
||
{
|
||
if (item.Nav_User.PERSON_ID.HasValue)
|
||
item.Nav_User.Nav_Person = listPersons.FirstOrDefault(e => item.Nav_User.PERSON_ID == e.ID);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
result.Nav_Meeting = meeting;
|
||
}
|
||
|
||
|
||
if (result.Nav_ListPJoin != null && result.Nav_ListPJoin.Any())
|
||
{
|
||
result.Nav_ListPJoin = result.Nav_ListPJoin.Where(e => e.PERSONTYPE == SCMEETINGPERSONTYPE.JOIN).OrderBy(e => e.ISRECORDRED).ThenBy(e => e.MODIFY_TIME).ToList();
|
||
}
|
||
|
||
//检查内容排序
|
||
if (result.Nav_ListContent != null && result.Nav_ListContent.Any())
|
||
{
|
||
var ListContent = result.Nav_ListContent.OrderBy(e => e.Nav_Content.CONTENT_NO).ThenBy(e => e.Nav_Content.CONTENTNAME_ID).ToList();
|
||
|
||
foreach (var item in ListContent)
|
||
{
|
||
if (item.Nav_ListContentDeal != null && item.Nav_ListContentDeal.Any())
|
||
item.Nav_ListContentDeal = item.Nav_ListContentDeal.OrderBy(e => e.Nav_ContentDeal.CONTENT_DEAL_NO).ToList();
|
||
|
||
if (item.Nav_Content.Nav_ListContentDeal != null && item.Nav_Content.Nav_ListContentDeal.Any())
|
||
item.Nav_Content.Nav_ListContentDeal = item.Nav_Content.Nav_ListContentDeal.OrderBy(e => e.CONTENT_DEAL_NO).ToList();
|
||
}
|
||
result.Nav_ListContent = ListContent;
|
||
}
|
||
|
||
if (DataHelper.GetRequestType(Request.Headers) == 2 && result.Nav_ListMinutesDetail != null && result.Nav_ListMinutesDetail.Any())
|
||
{
|
||
foreach (var item in result.Nav_ListMinutesDetail)
|
||
{
|
||
if (item.DEALEFFECT.HasValue)
|
||
{
|
||
item.DEALEFFECTSHOW = item.DEALEFFECT.Value.GetDescription();
|
||
}
|
||
}
|
||
}
|
||
|
||
return result;
|
||
});
|
||
}
|
||
|
||
/// <summary>
|
||
/// 编辑页面过滤 评审人 Get的改进版(移动端)
|
||
/// </summary>
|
||
/// <param name="filter"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("GetDevelop")]
|
||
public JsonActionResult<T_SC_MT_MEETING_MINUTES> GetDevelop([FromBody] KeywordFilter filter)
|
||
{
|
||
return SafeExecute<T_SC_MT_MEETING_MINUTES>(() =>
|
||
{
|
||
Guid ID = Guid.Empty;
|
||
if (filter.FilterGroup.Rules != null && filter.FilterGroup.Rules.Any())
|
||
{
|
||
foreach (var item in filter.FilterGroup.Rules)
|
||
{
|
||
if (item.Field == "ID")
|
||
{
|
||
ID = new Guid(item.Value.ToString());
|
||
filter.FilterGroup.Rules.Remove(item);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
T_SC_MT_MEETING_MINUTES result = null;
|
||
if (ID == Guid.Empty)
|
||
{
|
||
result = GetEntity<T_SC_MT_MEETING_MINUTES>(null, filter);
|
||
}
|
||
else
|
||
{
|
||
ICollection<string> IncludeMinutes = new List<string>();
|
||
ICollection<string> IncludeMeeting = new List<string>();
|
||
ICollection<string> IncludeMinutesContent = new List<string>();
|
||
foreach (var item in filter.Include)
|
||
{
|
||
//if (item == "Nav_ListContent.Nav_ListContentDeal" || item == "Nav_ListContent.Nav_Content.Nav_ListContentDeal" || item == "Nav_ListMeetingContent.Nav_ContentName" || item == "Nav_ListMeetingContent")
|
||
//{
|
||
// //会议纪要 拉出了 会议的会议内容
|
||
// IncludeMeeting.Add(item);
|
||
//}
|
||
//else
|
||
if (item.Contains("Nav_Meeting"))
|
||
{
|
||
if (item != "Nav_Meeting" && item != "Nav_Meeting.Nav_UserHost" && item != "Nav_Meeting.Nav_UserRecorder")
|
||
IncludeMeeting.Add(item.Substring(12));
|
||
}
|
||
else if (item.Contains("Nav_ListContent"))
|
||
{
|
||
if (item != "Nav_ListContent")
|
||
IncludeMinutesContent.Add(item.Substring(16));
|
||
}
|
||
else
|
||
{
|
||
IncludeMinutes.Add(item);
|
||
}
|
||
}
|
||
filter.Include = IncludeMinutes;
|
||
result = GetEntity<T_SC_MT_MEETING_MINUTES>(e => e.ID == ID, IncludeMinutes.ToArray());
|
||
|
||
var meeting = GetEntity<T_SC_MT_MEETING>(e => e.ID == result.MEETING_ID, IncludeMeeting.ToArray());
|
||
|
||
#region 人员加载
|
||
|
||
result.Nav_ListPReview = GetEntities<T_SC_MT_MINUTES_PREVIEW>(e => e.MEETING_MINUTES_ID == result.ID, null, null).ToList();
|
||
result.Nav_ListPAskForLeave = GetEntities<T_SC_MT_MEETING_PASKFORLEAVE>(e => e.MEETING_MINUTES_ID == result.ID, null, null).ToList();
|
||
result.Nav_ListPAbsence = GetEntities<T_SC_MT_MEETING_PABSENCE>(e => e.MEETING_MINUTES_ID == result.ID, null, null).ToList();
|
||
result.Nav_ListPJoin = GetEntities<T_SC_MT_MEETING_PJOIN>(e => e.MEETING_MINUTES_ID == result.ID, null, null).ToList();
|
||
|
||
List<Guid> listUserID = new List<Guid>();
|
||
if (meeting.USER_ID_HOST.HasValue)
|
||
{
|
||
listUserID.Add(meeting.USER_ID_HOST.Value);
|
||
}
|
||
if (meeting.USER_ID_RECORDER.HasValue)
|
||
{
|
||
listUserID.Add(meeting.USER_ID_RECORDER.Value);
|
||
}
|
||
|
||
if (result.Nav_ListPReview != null && result.Nav_ListPReview.Any())
|
||
{
|
||
var listUserIDPR = result.Nav_ListPReview.Select(e => e.USER_ID);
|
||
if (listUserIDPR.Any())
|
||
{
|
||
listUserID.AddRange(listUserIDPR);
|
||
}
|
||
}
|
||
|
||
if (result.Nav_ListPAskForLeave != null && result.Nav_ListPAskForLeave.Any())
|
||
{
|
||
var listUserIDPR = result.Nav_ListPAskForLeave.Select(e => e.USER_ID);
|
||
if (listUserIDPR.Any())
|
||
{
|
||
listUserID.AddRange(listUserIDPR);
|
||
}
|
||
}
|
||
if (result.Nav_ListPAbsence != null && result.Nav_ListPAbsence.Any())
|
||
{
|
||
var listUserIDPR = result.Nav_ListPAbsence.Select(e => e.USER_ID);
|
||
if (listUserIDPR.Any())
|
||
{
|
||
listUserID.AddRange(listUserIDPR);
|
||
}
|
||
}
|
||
if (result.Nav_ListPJoin != null && result.Nav_ListPJoin.Any())
|
||
{
|
||
var listUserIDPR = result.Nav_ListPJoin.Select(e => e.USER_ID);
|
||
if (listUserIDPR.Any())
|
||
{
|
||
listUserID.AddRange(listUserIDPR);
|
||
}
|
||
}
|
||
if (listUserID != null && listUserID.Any())
|
||
{
|
||
listUserID = listUserID.Distinct().ToList();
|
||
var listUserS = GetEntities<T_FM_USER>(e => listUserID.Contains(e.ID), null, null);
|
||
|
||
if (result.Nav_ListPReview != null && result.Nav_ListPReview.Any())
|
||
{
|
||
result.Nav_ListPReview.ForEach(e =>
|
||
{
|
||
e.Nav_User = listUserS.FirstOrDefault(eu => eu.ID == e.USER_ID);
|
||
});
|
||
}
|
||
|
||
if (result.Nav_ListPAskForLeave != null && result.Nav_ListPAskForLeave.Any())
|
||
{
|
||
result.Nav_ListPAskForLeave.ForEach(e =>
|
||
{
|
||
e.Nav_User = listUserS.FirstOrDefault(eu => eu.ID == e.USER_ID);
|
||
});
|
||
}
|
||
if (result.Nav_ListPAbsence != null && result.Nav_ListPAbsence.Any())
|
||
{
|
||
result.Nav_ListPAbsence.ForEach(e =>
|
||
{
|
||
e.Nav_User = listUserS.FirstOrDefault(eu => eu.ID == e.USER_ID);
|
||
});
|
||
}
|
||
if (result.Nav_ListPJoin != null && result.Nav_ListPJoin.Any())
|
||
{
|
||
result.Nav_ListPJoin.ForEach(e =>
|
||
{
|
||
e.Nav_User = listUserS.FirstOrDefault(eu => eu.ID == e.USER_ID);
|
||
});
|
||
}
|
||
|
||
if (meeting.USER_ID_HOST.HasValue)
|
||
{
|
||
meeting.Nav_UserHost = listUserS.FirstOrDefault(e => e.ID == meeting.USER_ID_HOST.Value);
|
||
}
|
||
if (meeting.USER_ID_RECORDER.HasValue)
|
||
{
|
||
meeting.Nav_UserRecorder = listUserS.FirstOrDefault(e => e.ID == meeting.USER_ID_RECORDER.Value);
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
//#region Nav_ListContent
|
||
//var Nav_ListContent = GetEntities<T_SC_MT_MEETING_MINUTES_CONTENT>(e => e.MEETING_MINUTES_ID == result.ID, null, IncludeMinutesNav_ListContent.ToArray());
|
||
//result.Nav_ListContent = Nav_ListContent.ToList();
|
||
//#endregion
|
||
|
||
result.Nav_Meeting = meeting;
|
||
|
||
if (IncludeMinutesContent != null && IncludeMinutesContent.Count > 0)
|
||
{
|
||
if (IncludeMinutesContent.Contains("Nav_ListContentDeal") && !IncludeMinutesContent.Contains("Nav_ListContentDeal.Nav_ContentDeal"))
|
||
{
|
||
IncludeMinutesContent.Add("Nav_ListContentDeal.Nav_ContentDeal");
|
||
}
|
||
var contents = GetEntities<T_SC_MT_MEETING_MINUTES_CONTENT>(e => e.MEETING_MINUTES_ID == ID, null, IncludeMinutesContent.ToArray());
|
||
if (contents != null && contents.Any())
|
||
{
|
||
result.Nav_ListContent = contents.ToList();
|
||
}
|
||
else
|
||
{
|
||
result.Nav_ListContent = new List<T_SC_MT_MEETING_MINUTES_CONTENT>();
|
||
}
|
||
}
|
||
}
|
||
|
||
if (result.Nav_ListPJoin != null && result.Nav_ListPJoin.Any())
|
||
{
|
||
result.Nav_ListPJoin = result.Nav_ListPJoin.Where(e => e.PERSONTYPE == SCMEETINGPERSONTYPE.JOIN).OrderBy(e => e.ISRECORDRED).ThenBy(e => e.MODIFY_TIME).ToList();
|
||
}
|
||
|
||
//检查内容排序
|
||
if (result.Nav_ListContent != null && result.Nav_ListContent.Any())
|
||
{
|
||
var ListContent = result.Nav_ListContent.OrderBy(e => e.Nav_Content.CONTENT_NO).ThenBy(e => e.Nav_Content.CONTENTNAME_ID).ToList();
|
||
|
||
foreach (var item in ListContent)
|
||
{
|
||
if (item.Nav_ListContentDeal != null && item.Nav_ListContentDeal.Any())
|
||
item.Nav_ListContentDeal = item.Nav_ListContentDeal.OrderBy(e => e.Nav_ContentDeal.CONTENT_DEAL_NO).ToList();
|
||
|
||
if (item.Nav_Content.Nav_ListContentDeal != null && item.Nav_Content.Nav_ListContentDeal.Any())
|
||
item.Nav_Content.Nav_ListContentDeal = item.Nav_Content.Nav_ListContentDeal.OrderBy(e => e.CONTENT_DEAL_NO).ToList();
|
||
}
|
||
result.Nav_ListContent = ListContent;
|
||
}
|
||
|
||
if (DataHelper.GetRequestType(Request.Headers) == 2 && result.Nav_ListMinutesDetail != null && result.Nav_ListMinutesDetail.Any())
|
||
{
|
||
foreach (var item in result.Nav_ListMinutesDetail)
|
||
{
|
||
if (item.DEALEFFECT.HasValue)
|
||
{
|
||
item.DEALEFFECTSHOW = item.DEALEFFECT.Value.GetDescription();
|
||
}
|
||
}
|
||
}
|
||
|
||
return result;
|
||
});
|
||
}
|
||
|
||
///// <summary>
|
||
///// 编辑页面过滤 评审人
|
||
///// </summary>
|
||
///// <param name="filter"></param>
|
||
///// <returns></returns>
|
||
//[HttpPost, Route("Get")]
|
||
//public JsonActionResult<T_SC_MT_MEETING_MINUTES> GetPAll([FromBody] KeywordFilter filter)
|
||
//{
|
||
// return SafeExecute<T_SC_MT_MEETING_MINUTES>(() =>
|
||
// {
|
||
// T_SC_MT_MEETING_MINUTES result = GetEntity<T_SC_MT_MEETING_MINUTES>(null, filter);
|
||
// if (result.Nav_ListPJoin != null && result.Nav_ListPJoin.Any())
|
||
// {
|
||
// result.Nav_ListPJoin = result.Nav_ListPJoin.Where(e => e.PERSONTYPE == SCMEETINGPERSONTYPE.JOIN).OrderBy(e => e.ISRECORDRED).ThenBy(e => e.MODIFY_TIME).ToList();
|
||
// //var listPJoin = result.Nav_ListPJoin.Where(e => e.PERSONTYPE == SCMEETINGPERSONTYPE.REVIEW);
|
||
// //if (listPJoin != null && listPJoin.Any())
|
||
// //{
|
||
// // //result.Nav_ListPReView = listPJoin.ToList();
|
||
// //}
|
||
// }
|
||
|
||
// //检查内容排序
|
||
// if (result.Nav_ListContent != null && result.Nav_ListContent.Any())
|
||
// {
|
||
// var ListContent = result.Nav_ListContent.OrderBy(e => e.CONTENT_ID).ToList();
|
||
|
||
// foreach (var item in ListContent)
|
||
// {
|
||
// if (item.Nav_ListContentDeal != null && item.Nav_ListContentDeal.Any())
|
||
// {
|
||
// item.Nav_ListContentDeal = item.Nav_ListContentDeal.OrderBy(e => e.Nav_ContentDeal.CONTENT_DEAL_NO).ToList();
|
||
// }
|
||
// }
|
||
// result.Nav_ListContent = ListContent;
|
||
// //foreach (var item in ListContent)
|
||
// //{
|
||
// // if (item.Nav_ListContentDeal!=null&& item.Nav_ListContentDeal.Count>0)
|
||
// // {
|
||
// // foreach (var itemD in item.Nav_ListContentDeal)
|
||
// // {
|
||
// // itemD.Nav_ContentDeal = itemD.Nav_ContentDeal.Nav_Content.Nav_ListContentDeal.OrderBy(e=>e.CONTENT_DEAL_NO).ToList();
|
||
// // }
|
||
// // }
|
||
// //}
|
||
// }
|
||
|
||
// return result;
|
||
// });
|
||
//}
|
||
|
||
|
||
/// <summary>
|
||
/// 纪要
|
||
/// </summary>
|
||
/// <param name="entity"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("FullUpdate")]
|
||
public JsonActionResult<bool> FullUpdate([FromBody] T_SC_MT_MEETING_MINUTES entity)
|
||
{
|
||
return SafeExecute<bool>(() =>
|
||
{
|
||
Guid LoginID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value;
|
||
var meeting = GetEntity<T_SC_MT_MEETING>(entity.MEETING_ID, new string[] { "Nav_UserRecorder", "Nav_ListPAll.Nav_User", "Nav_ListPReView" });
|
||
if (meeting.USER_ID_RECORDER != LoginID)
|
||
{
|
||
if (entity.TaskID == Guid.Empty)//转办 也让处理
|
||
{
|
||
throw new Exception("您不是" + meeting.Nav_UserRecorder.NAME + "不能操作此会议纪要!");
|
||
}
|
||
}
|
||
if (entity.STATUS != PFStandardStatus.Draft && entity.STATUS != PFStandardStatus.Sign)
|
||
{
|
||
//会议纪要不是草稿或者 保存并发送
|
||
throw new Exception("纪要状态【" + entity.STATUS.GetDescription() + "】,操作失败!");
|
||
}
|
||
|
||
//如果有会议意见
|
||
//如果是单选 同一组 取最后为true的 别的false
|
||
var listContent = entity.Nav_ListContent;
|
||
entity.Nav_ListContent = null;
|
||
List<T_SC_MT_MEETING_MINUTES_CONTENT_DEAL> listContentDetail = new List<T_SC_MT_MEETING_MINUTES_CONTENT_DEAL>();
|
||
if (listContent != null && listContent.Any())
|
||
{
|
||
int index = 0;
|
||
string Msg = string.Empty;
|
||
foreach (var item in listContent)
|
||
{
|
||
index++;
|
||
if (item.CONTENT_ID == Guid.Empty)
|
||
continue;
|
||
if (item.Nav_ListContentDeal == null || !item.Nav_ListContentDeal.Any())
|
||
continue;
|
||
|
||
|
||
T_SC_MT_CONTENT content = GetEntity<T_SC_MT_CONTENT>(item.CONTENT_ID);
|
||
if (content.CHECKTYPE != CHECKTYPE.TheRadio)
|
||
{
|
||
//多选 都不选 暂时也OK
|
||
listContentDetail.AddRange(item.Nav_ListContentDeal); //不需要数据处理
|
||
continue;
|
||
}
|
||
|
||
var listRadioCheck = item.Nav_ListContentDeal.Where(e => e.ISCHECK);
|
||
if (listRadioCheck == null || listRadioCheck.Count() < 1)
|
||
{
|
||
Msg += ((string.IsNullOrEmpty(Msg) ? "" : ",") + index.ToString());
|
||
continue;
|
||
}
|
||
if (string.IsNullOrEmpty(Msg))
|
||
{
|
||
listContentDetail.AddRange(item.Nav_ListContentDeal);
|
||
var listRadioCheckOrder = listRadioCheck.OrderByDescending(e => e.MODIFY_TIME).ToList();//时间倒序 第二个之后的都是false
|
||
for (int i = 1; i < listRadioCheckOrder.Count; i++)
|
||
{
|
||
listRadioCheckOrder[i].ISCHECK = false;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(Msg))
|
||
{
|
||
throw new Exception("请选择【" + Msg + "】项会议意见的结果!");
|
||
}
|
||
}
|
||
|
||
//所有的人员信息 必须有在 参加 缺勤 请假 中
|
||
var Join = entity.Nav_ListPJoin;
|
||
if (Join == null || !Join.Any())
|
||
{
|
||
throw new Exception("参会人不能为空!");
|
||
}
|
||
var listJoins = Join.ToList();
|
||
foreach (var item in listJoins)
|
||
{
|
||
item.Nav_User.ID = item.USER_ID;
|
||
}
|
||
|
||
var AskForLeave = entity.Nav_ListPAskForLeave;
|
||
var Absence = entity.Nav_ListPAbsence;
|
||
var Review = entity.Nav_ListPReview;
|
||
|
||
//entity.Nav_ListPJoin = null;
|
||
//entity.Nav_ListPAskForLeave = null;
|
||
//entity.Nav_ListPAbsence = null;
|
||
//bool isThisInt = false;
|
||
//bool isThisRepeat = false;
|
||
List<T_FM_USER> listUserJoin = listJoins.Where(e => !e.IS_DELETED).Select(e => e.Nav_User).ToList();
|
||
|
||
|
||
List<T_FM_USER> listUserLevel = null;
|
||
List<T_FM_USER> listUserAbsence = null;
|
||
List<T_FM_USER> listUserReview = null;
|
||
|
||
List<T_FM_USER> listUserLack = new List<T_FM_USER>();//少选人员
|
||
List<T_FM_USER> listUserRepeat = new List<T_FM_USER>();//重复人员
|
||
|
||
if (AskForLeave != null && AskForLeave.Any())
|
||
{
|
||
foreach (var item in AskForLeave)
|
||
item.Nav_User.ID = item.USER_ID;//前端配置有问题
|
||
|
||
listUserLevel = AskForLeave.Where(e => !e.IS_DELETED).Select(e => e.Nav_User).ToList();
|
||
}
|
||
if (Absence != null && Absence.Any())
|
||
{
|
||
foreach (var item in Absence)
|
||
item.Nav_User.ID = item.USER_ID;//前端配置有问题
|
||
|
||
listUserAbsence = Absence.Where(e => !e.IS_DELETED).Select(e => e.Nav_User).ToList();
|
||
}
|
||
if (Review != null && Review.Any())
|
||
{
|
||
listUserReview = Review.Where(e => !e.IS_DELETED).Select(e => e.Nav_User).ToList();
|
||
}
|
||
var ListMinutesDetail = entity.Nav_ListMinutesDetail;
|
||
//entity.Nav_ListMinutesDetail = null;
|
||
var files = entity.Nav_Files;
|
||
//entity.Nav_Files = null;
|
||
if (entity.STATUS == PFStandardStatus.Sign)
|
||
{
|
||
if (string.IsNullOrEmpty(entity.MEETINGRECORD))
|
||
{
|
||
throw new Exception("会议记录不能为空!");
|
||
}
|
||
|
||
if ((entity.MEETINGTYPE == SCMEETINGTYPE.BasicSecurity || entity.MEETINGTYPE == SCMEETINGTYPE.SafetyBoard) && (entity.Nav_ListMinutesDetail == null || !entity.Nav_ListMinutesDetail.Any()))
|
||
{
|
||
throw new Exception("请填写" + entity.MEETINGTYPE.GetDescription() + "的会议决议!");
|
||
}
|
||
|
||
//保存并发送
|
||
var PAllUser = meeting.Nav_ListPAll.Where(e => !e.IS_DELETED && e.PERSONTYPE != SCMEETINGPERSONTYPE.REVIEW && e.PERSONNATURE == PersonNature.JOIN).Select(e => e.Nav_User).ToList();//所有人员
|
||
|
||
List<T_FM_USER> listJoin = null;
|
||
List<T_FM_USER> listLevel = null;
|
||
List<T_FM_USER> listRepeat = null;
|
||
|
||
List<T_FM_USER> listReview = null;
|
||
|
||
int thisCount = 0;
|
||
foreach (var item in PAllUser)
|
||
{
|
||
listJoin = listUserJoin.FindAll(e => e.ID == item.ID);
|
||
if (listJoin.Count > 1)
|
||
{
|
||
throw new Exception("参会人员重复:" + item.NAME + "!");
|
||
}
|
||
|
||
if (listUserLevel != null)
|
||
{
|
||
listLevel = listUserLevel.FindAll(e => e.ID == item.ID);
|
||
if (listLevel.Count > 1)
|
||
{
|
||
throw new Exception("请假人员重复:" + item.NAME + "!");
|
||
}
|
||
}
|
||
if (listUserAbsence != null)
|
||
{
|
||
listRepeat = listUserAbsence.FindAll(e => e.ID == item.ID);
|
||
if (listRepeat.Count > 1)
|
||
{
|
||
throw new Exception("缺勤人员重复:" + item.NAME + "!");
|
||
}
|
||
}
|
||
|
||
if (listUserReview != null)
|
||
{
|
||
listReview = listUserReview.FindAll(e => e.ID == item.ID);
|
||
if (listReview.Count > 1)
|
||
{
|
||
throw new Exception("评审人员重复:" + item.NAME + "!");
|
||
}
|
||
}
|
||
|
||
thisCount = (listJoin == null ? 0 : listJoin.Count) + (listLevel == null ? 0 : listLevel.Count) + (listRepeat == null ? 0 : listRepeat.Count) + (listReview == null ? 0 : listReview.Count);
|
||
|
||
if (thisCount == 0)
|
||
{
|
||
//没找到对应人员
|
||
listUserLack.Add(item);
|
||
}
|
||
else if (thisCount > 1)
|
||
{
|
||
//重复
|
||
listUserRepeat.Add(item);
|
||
}
|
||
}
|
||
string Msg = string.Empty;
|
||
if (listUserLack != null && listUserLack.Count > 0)
|
||
{
|
||
Msg = "以下人员参会情况丢失:" + String.Join(",", listUserLack.Select(e => e.NAME).ToList());
|
||
}
|
||
if (listUserRepeat != null && listUserRepeat.Count > 0)
|
||
{
|
||
Msg += (string.IsNullOrEmpty(Msg) ? "" : ";") + "以下人员重复:" + String.Join(",", listUserRepeat.Select(e => e.NAME).ToList()) + "!";
|
||
}
|
||
if (!string.IsNullOrEmpty(Msg))
|
||
{
|
||
throw new Exception(Msg);
|
||
}
|
||
|
||
if (ListMinutesDetail != null && ListMinutesDetail.Count > 0)
|
||
{
|
||
int i = 0;
|
||
foreach (var item in ListMinutesDetail)
|
||
{
|
||
i++;
|
||
if (string.IsNullOrEmpty(item.RESOLUTION))
|
||
{
|
||
throw new Exception("第【" + i + "】行,会议决议不能为空!");
|
||
}
|
||
if (item.ISNEEDDEAL)
|
||
{
|
||
if (item.DEAL_DEPARTMENT_ID == null)
|
||
{
|
||
throw new Exception("第【" + i + "】行,落实部门不能为空!");
|
||
}
|
||
if (item.DEAL_USER_ID == null)
|
||
{
|
||
throw new Exception("第【" + i + "】行,落实责任不能为空!");
|
||
}
|
||
if (item.LIMITDATETIME == null)
|
||
{
|
||
throw new Exception("第【" + i + "】行,落实期限不能为空!");
|
||
}
|
||
else if (item.LIMITDATETIME.Value.Date <= DateTime.Now.Date)
|
||
{
|
||
throw new Exception("第【" + i + "】行,落实期限不能小于当前时间!");
|
||
}
|
||
else
|
||
{
|
||
item.LIMITDATETIME = item.LIMITDATETIME.Value.Date.AddDays(1).AddSeconds(-1);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (item.DEAL_DEPARTMENT_ID != null && item.DEAL_DEPARTMENT_ID != Guid.Empty)
|
||
{
|
||
throw new Exception("第【" + i + "】行,无需填写落实部门!");
|
||
}
|
||
if (item.DEAL_USER_ID != null && item.DEAL_USER_ID != Guid.Empty)
|
||
{
|
||
throw new Exception("第【" + i + "】行,无需填写落实责任人!");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (Join != null && Join.Any())
|
||
{
|
||
foreach (var item in Join)
|
||
{
|
||
item.Nav_User = null;
|
||
}
|
||
}
|
||
if (AskForLeave != null && AskForLeave.Any())
|
||
{
|
||
foreach (var item in AskForLeave)
|
||
{
|
||
item.Nav_User = null;
|
||
}
|
||
}
|
||
if (Absence != null && Absence.Any())
|
||
{
|
||
foreach (var item in Absence)
|
||
{
|
||
item.Nav_User = null;
|
||
}
|
||
}
|
||
if (Review != null && Review.Any())
|
||
{
|
||
foreach (var item in Review)
|
||
{
|
||
item.Nav_User = null;
|
||
}
|
||
}
|
||
|
||
#region 参加人 删除 到缺席人 请假人、缺席人 删除 到参加人 没有传入的参加人、请假人、缺席人 删除
|
||
|
||
List<Guid> listIDs = new List<Guid>();
|
||
if (Join != null && Join.Count > 0)
|
||
{
|
||
listIDs = Join.Select(e => e.ID).ToList();
|
||
}
|
||
var listPJDel = GetEntities<T_SC_MT_MEETING_PJOIN>(e => e.PERSONTYPE == SCMEETINGPERSONTYPE.JOIN && e.MEETING_MINUTES_ID == entity.ID && !listIDs.Contains(e.ID), null, null);
|
||
|
||
////评审人
|
||
//listIDs = new List<Guid>();
|
||
//var listPVDel = GetEntities<T_SC_MT_MINUTES_PREVIEW>(e => e.MEETING_MINUTES_ID == entity.ID, null, null);
|
||
|
||
//请假人
|
||
listIDs = new List<Guid>();
|
||
if (AskForLeave != null && AskForLeave.Any())
|
||
{
|
||
listIDs = AskForLeave.Select(e => e.ID).ToList();
|
||
}
|
||
var listPAskLDel = GetEntities<T_SC_MT_MEETING_PASKFORLEAVE>(e => e.MEETING_MINUTES_ID == entity.ID && !listIDs.Contains(e.ID), null, null);
|
||
|
||
//缺席人
|
||
listIDs = new List<Guid>();
|
||
if (Absence != null && Absence.Any())
|
||
{
|
||
listIDs = Absence.Select(e => e.ID).ToList();
|
||
}
|
||
var listPAbsDel = GetEntities<T_SC_MT_MEETING_PABSENCE>(e => e.MEETING_MINUTES_ID == entity.ID && !listIDs.Contains(e.ID), null, null);
|
||
|
||
|
||
#endregion
|
||
|
||
if (entity.STATUS == PFStandardStatus.Draft)
|
||
{
|
||
this.UnifiedCommit(() =>
|
||
{
|
||
if (entity != null)
|
||
UpdateEntityNoCommit(entity); //保存主表 NoCommit
|
||
if (listContentDetail != null && listContentDetail.Any())//纪要意见
|
||
BantchUpdateEntityNoCommit(listContentDetail);
|
||
if (Join != null && Join.Any())//参会人员
|
||
BantchSaveEntityNoCommit(Join);
|
||
if (AskForLeave != null && AskForLeave.Any())//请假人员
|
||
BantchSaveEntityNoCommit(AskForLeave);
|
||
if (Absence != null && Absence.Any())//缺席人员
|
||
BantchSaveEntityNoCommit(Absence);
|
||
if (ListMinutesDetail != null && ListMinutesDetail.Any())//纪要评估 反馈
|
||
BantchSaveEntityNoCommit(ListMinutesDetail);
|
||
if (files != null && files.Any())//附件
|
||
BantchSaveEntityNoCommit(files);
|
||
if (listPJDel != null && listPJDel.Count() > 0) //参加人
|
||
BantchDeleteEntityNoCommit<T_SC_MT_MEETING_PJOIN>(listPJDel.Select(e => e.ID).ToList());
|
||
if (listPAskLDel != null && listPAskLDel.Count() > 0) //请假人
|
||
BantchDeleteEntityNoCommit<T_SC_MT_MEETING_PASKFORLEAVE>(listPAskLDel.Select(e => e.ID).ToList());
|
||
if (listPAbsDel != null && listPAbsDel.Count() > 0) //缺席人
|
||
BantchDeleteEntityNoCommit<T_SC_MT_MEETING_PABSENCE>(listPAbsDel.Select(e => e.ID).ToList());
|
||
});
|
||
}
|
||
else if (entity.STATUS == PFStandardStatus.Sign)
|
||
{
|
||
//获取待办信息
|
||
var task = FMNotificActionTaskService.GetEntityTask(entity.TaskID, "SC030_SHOWPRINT");
|
||
|
||
//保存并发送
|
||
//没有需要落实整改的信息
|
||
List<Guid> ListNoticeAll = new List<Guid>();
|
||
List<string> ListNoticeAllNAME = new List<string>();
|
||
foreach (var item in listUserJoin)
|
||
{
|
||
ListNoticeAll.Add(item.ID);
|
||
ListNoticeAllNAME.Add(item.NAME);
|
||
}
|
||
if (listUserReview != null && listUserReview.Count > 0)
|
||
{
|
||
foreach (var item in listUserReview)
|
||
{
|
||
ListNoticeAll.Add(item.ID);
|
||
ListNoticeAllNAME.Add(item.NAME);
|
||
}
|
||
}
|
||
List<T_FM_NOTIFICATION_TASK> listTaskRread = NotificationTaskService.InsertUserNoticeTaskModels("会议纪要签到", entity.ID, entity.ORG_ID, ListNoticeAll, ListNoticeAllNAME, DateTime.Now, (int)FMNoticeTypeEnum.消息, "SC030_SHOWPRINT", FMTASKTYPE.MT_MINUTES_Sign);
|
||
|
||
var listModelJoin = Join.Where(e => e.USER_ID == LoginID);
|
||
foreach (var item in Join)
|
||
{
|
||
if (item.USER_ID == LoginID)
|
||
{
|
||
item.ISRECORDRED = true;
|
||
}
|
||
}
|
||
List<T_SC_MT_MINUTES_PREVIEW> listPReview = null;
|
||
if (Review != null && Review.Any())
|
||
{
|
||
foreach (var item in Review)
|
||
{
|
||
if (item.USER_ID == LoginID)
|
||
{
|
||
if (listPReview == null)
|
||
{
|
||
listPReview = new List<T_SC_MT_MINUTES_PREVIEW>();
|
||
}
|
||
item.ISRECORDRED = true;
|
||
listPReview.Add(item);
|
||
}
|
||
}
|
||
}
|
||
|
||
//当前人 默认 知晓
|
||
foreach (var item in listTaskRread)
|
||
{
|
||
if (item.USER_ID == LoginID)
|
||
{
|
||
item.TASK_DT = DateTime.Now;
|
||
item.NOTICE_STATUS = 1;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (listContentDetail != null && listContentDetail.Any() && DataHelper.GetRequestType(Request.Headers) == 2)
|
||
{
|
||
foreach (var item in listContentDetail)
|
||
{
|
||
item.Nav_ContentDeal = null;
|
||
}
|
||
}
|
||
|
||
this.UnifiedCommit(() =>
|
||
{
|
||
if (entity != null)
|
||
UpdateEntityNoCommit(entity); //保存主表 NoCommit
|
||
if (listContentDetail != null && listContentDetail.Any())//纪要意见
|
||
BantchUpdateEntityNoCommit(listContentDetail);
|
||
if (Join != null && Join.Any())//参会人员
|
||
BantchSaveEntityNoCommit(Join);
|
||
if (listPReview != null && listPReview.Any())//登陆者如果是评审人 默认阅读
|
||
BantchSaveEntityNoCommit(listPReview);
|
||
if (AskForLeave != null && AskForLeave.Any())//请假人员
|
||
BantchSaveEntityNoCommit(AskForLeave);
|
||
if (Absence != null && Absence.Any())//缺席人员
|
||
BantchSaveEntityNoCommit(Absence);
|
||
if (ListMinutesDetail != null && ListMinutesDetail.Any())//纪要评估 反馈
|
||
BantchSaveEntityNoCommit(ListMinutesDetail);
|
||
if (files != null && files.Any())//附件
|
||
BantchSaveEntityNoCommit(files);
|
||
if (listTaskRread != null && listTaskRread.Any())//参与人 阅
|
||
BantchSaveEntityNoCommit(listTaskRread);
|
||
if (task != null)//待办
|
||
UpdateEntity(task);
|
||
if (listPJDel != null && listPJDel.Count() > 0) //参加人
|
||
BantchDeleteEntityNoCommit<T_SC_MT_MEETING_PJOIN>(listPJDel.Select(e => e.ID).ToList());
|
||
if (listPAskLDel != null && listPAskLDel.Count() > 0) //请假人
|
||
BantchDeleteEntityNoCommit<T_SC_MT_MEETING_PASKFORLEAVE>(listPAskLDel.Select(e => e.ID).ToList());
|
||
if (listPAbsDel != null && listPAbsDel.Count() > 0) //缺席人
|
||
BantchDeleteEntityNoCommit<T_SC_MT_MEETING_PABSENCE>(listPAbsDel.Select(e => e.ID).ToList());
|
||
});
|
||
|
||
////如果通知人 包含 登陆者
|
||
//if (ListNoticeAll.Contains(LoginID))
|
||
//{
|
||
// KeywordFilter filterSign = new KeywordFilter();
|
||
// filterSign.Parameter1 = listTaskRread.Find(e => e.USER_ID == LoginID).ID.ToString();
|
||
// filterSign.Keyword = entity.ID.ToString();
|
||
// MeetingMinutesSign(filterSign);
|
||
//}
|
||
}
|
||
return true;
|
||
});
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 整改责任人 纪要落实
|
||
/// </summary>
|
||
/// <param name="entity"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("UpdateDeal")]
|
||
public JsonActionResult<bool> UpdateDeal([FromBody] T_SC_MT_MEETING_MINUTES entity)
|
||
{
|
||
return SafeExecute<bool>(() =>
|
||
{
|
||
Guid LoginID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value;
|
||
//责任人意见 落实情况反馈
|
||
if (entity.Nav_ListMinutesDetail == null || !entity.Nav_ListMinutesDetail.Any())
|
||
throw new Exception("未获取到纪要落实信息,操作失败!");
|
||
|
||
var ListMinutesDetail = entity.Nav_ListMinutesDetail.ToList();
|
||
MINUTES_DETAIL_STATUS dealType = ListMinutesDetail[0].STATUS;
|
||
foreach (var item in ListMinutesDetail)
|
||
{
|
||
item.STATUS = dealType;
|
||
}
|
||
int i = 1;
|
||
foreach (var item in ListMinutesDetail)
|
||
{
|
||
if (string.IsNullOrEmpty(item.OPINION))
|
||
throw new Exception("第【" + i + "】行责任人意见不能未空!");
|
||
else if (item.OPINION.Length > 500)
|
||
throw new Exception("第【" + i + "】行责任人意见不能超过500个字符!");
|
||
if (string.IsNullOrEmpty(item.DEALBACK))
|
||
throw new Exception("第【" + i + "】行落实情况反馈不能未空!");
|
||
else if (item.DEALBACK.Length > 500)
|
||
throw new Exception("第【" + i + "】行落实情况反馈不能超过500个字符!");
|
||
i++;
|
||
}
|
||
|
||
//如果 所有人都 填写了 发给 主持人
|
||
List<T_SC_MT_MEETING_MINUTES_DETAIL_FILE> files = null;
|
||
foreach (var item in ListMinutesDetail)
|
||
{
|
||
if (item.Nav_Files != null)
|
||
{
|
||
if (files == null)
|
||
{
|
||
files = new List<T_SC_MT_MEETING_MINUTES_DETAIL_FILE>();
|
||
}
|
||
files.AddRange(item.Nav_Files.ToList());
|
||
item.Nav_Files = null;
|
||
}
|
||
}
|
||
|
||
if (dealType == MINUTES_DETAIL_STATUS.Deal)//责任人 保存
|
||
{
|
||
this.UnifiedCommit(() =>
|
||
{
|
||
if (ListMinutesDetail != null && ListMinutesDetail.Any())//纪要落实
|
||
BantchSaveEntityNoCommit(ListMinutesDetail);
|
||
if (files != null && files.Any())
|
||
BantchSaveEntityNoCommit(files);
|
||
});
|
||
}
|
||
else if (dealType == MINUTES_DETAIL_STATUS.Host)//责任人 保存并发送
|
||
{
|
||
//获取待办信息
|
||
var task = FMNotificActionTaskService.GetEntityTask(entity.TaskID, "SC030_SHOWPRINTPER");
|
||
List<Guid> listDetailID = ListMinutesDetail.Select(e => e.ID).ToList();
|
||
|
||
var listDetail = GetEntity<T_SC_MT_MEETING_MINUTES>(e => e.ID == entity.ID, new string[] { "Nav_ListMinutesDetail" }).Nav_ListMinutesDetail.Where(e => e.ISNEEDDEAL && !listDetailID.Contains(e.ID) && (e.STATUS == MINUTES_DETAIL_STATUS.Temp_Record || e.STATUS == MINUTES_DETAIL_STATUS.Deal)).Select(e => e.Nav_MeetingMinutes.Nav_ListMinutesDetail);
|
||
|
||
if (listDetail == null || !listDetail.Any())
|
||
{
|
||
var meeting = GetEntity<T_SC_MT_MEETING>(entity.MEETING_ID, new string[] { "Nav_UserHost" });
|
||
//落实整改人 都填写了整改情况
|
||
//给主持人 发送待办填写 落实效果
|
||
T_FM_NOTIFICATION_TASK taskHost = NotificationTaskService.InsertUserNoticeTaskModel("会议决议落实效果", entity.ID, entity.ORG_ID, meeting.USER_ID_HOST.Value, meeting.Nav_UserHost.NAME, DateTime.Now, (int)FMNoticeTypeEnum.消息, "SC030_2", FMTASKTYPE.MT_MINUTES_DETAIL_CHECK);
|
||
|
||
this.UnifiedCommit(() =>
|
||
{
|
||
if (task != null)//待办
|
||
UpdateEntityNoCommit(task);
|
||
if (ListMinutesDetail != null && ListMinutesDetail.Any())//纪要评估 反馈
|
||
BantchSaveEntityNoCommit(ListMinutesDetail);
|
||
AddEntityNoCommit(taskHost);//给主持人发送待办
|
||
if (files != null && files.Any())
|
||
BantchSaveEntityNoCommit(files);
|
||
});
|
||
}
|
||
else
|
||
{
|
||
//还有 未落实的会议决议 保存信息
|
||
this.UnifiedCommit(() =>
|
||
{
|
||
if (task != null)//待办
|
||
UpdateEntityNoCommit(task);
|
||
if (ListMinutesDetail != null && ListMinutesDetail.Any())//纪要评估 反馈
|
||
BantchSaveEntityNoCommit(ListMinutesDetail);
|
||
if (files != null && files.Any())
|
||
BantchSaveEntityNoCommit(files);
|
||
});
|
||
}
|
||
}
|
||
return true;
|
||
});
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 主持人 填写落实效果 走审批流
|
||
/// </summary>
|
||
/// <param name="entity"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("UpdateDealEffect")]
|
||
public JsonActionResult<bool> UpdateDealEffect([FromBody] T_SC_MT_MEETING_MINUTES entity)
|
||
{
|
||
//var sysFilter = new SystemCodeFilter();
|
||
//sysFilter.CodeType = (int)PFCodeRuleType.会议通知;
|
||
//sysFilter.Count = 2;
|
||
//sysFilter.OrgId = entity.ORG_ID;
|
||
//var serialCode = CodeRuleService.NewGenSerial(sysFilter);
|
||
//List<string> listCode = serialCode.Split(",").ToList();
|
||
|
||
return SafeExecute<bool>(() =>
|
||
{
|
||
//责任人意见 落实情况反馈
|
||
if (entity.Nav_ListMinutesDetail == null || !entity.Nav_ListMinutesDetail.Any())
|
||
throw new Exception("未获取到纪要落实信息,操作失败!");
|
||
var ListMinutesDetail = entity.Nav_ListMinutesDetail;
|
||
if (entity.STATUS == PFStandardStatus.Sign)
|
||
{
|
||
foreach (var item in ListMinutesDetail)
|
||
{
|
||
item.STATUS = MINUTES_DETAIL_STATUS.Host;
|
||
}
|
||
//保存
|
||
this.UnifiedCommit(() =>
|
||
{
|
||
UpdateEntityNoCommit(entity);
|
||
if (ListMinutesDetail != null && ListMinutesDetail.Any())//落实效果
|
||
BantchSaveEntityNoCommit(ListMinutesDetail);
|
||
});
|
||
}
|
||
else if (entity.STATUS == PFStandardStatus.Approving)
|
||
{
|
||
//保存并发送
|
||
int i = 0;
|
||
foreach (var item in ListMinutesDetail)
|
||
{
|
||
i++;
|
||
item.STATUS = MINUTES_DETAIL_STATUS.End;
|
||
if (item.DEALEFFECT == 0)
|
||
throw new Exception("请选择第【" + i + "】行的落实效果!");
|
||
}
|
||
|
||
entity.APPROVE_ID = Guid.NewGuid();
|
||
var meeting = GetEntity<T_SC_MT_MEETING>(entity.MEETING_ID);
|
||
|
||
////公司级 3 部门级 0 车间级 1 班组级 2
|
||
////只有明确是车间 走车间级 否则走部门级
|
||
string param = meeting.LEVELVALUE.Value.ToString();
|
||
//安全生产委员会 审批到总经理 基层安全会 到对应车间/ 部门 其他到部门级
|
||
//会议通知就处理了 下句代码应该可以不用
|
||
if (meeting.MEETINGTYPE == SCMEETINGTYPE.SafetyBoard)
|
||
param = "3";
|
||
List<string> listCode = new List<string>();
|
||
listCode.Add(meeting.CODE + "1");
|
||
listCode.Add(meeting.CODE + "2");
|
||
|
||
MFlowPermitService.InsertApprove(listCode[0], "SC030", param, entity.ID, "SC030_SHOWPRINT", entity.TaskID, true, () =>
|
||
{
|
||
if (entity != null) //保存会议纪要主表 进入审批流
|
||
UpdateEntityNoCommit(entity);
|
||
if (ListMinutesDetail != null && ListMinutesDetail.Any())//落实效果
|
||
BantchSaveEntityNoCommit(ListMinutesDetail);
|
||
}, entity.APPROVE_ID, meeting.USER_ID_ORIGINATOR, null, null, listCode[1], "SC030_SHOWPRINT", null, null, FMTASKTYPE.MT_MINUTES_DEAL_Audit);
|
||
}
|
||
return true;
|
||
});
|
||
}
|
||
|
||
/// <summary>
|
||
/// 会议纪要 参会人员 签到
|
||
/// 最后一个人审批 添加审批流
|
||
/// </summary>
|
||
/// <param name="filter"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("MeetingMinutesSign")]
|
||
public JsonActionResult<bool> MeetingMinutesSign([FromBody] KeywordFilter filter)
|
||
{
|
||
//var sysFilter = new SystemCodeFilter();
|
||
//sysFilter.CodeType = (int)PFCodeRuleType.会议通知;
|
||
//sysFilter.Count = 2;
|
||
//sysFilter.OrgId = filter.OrgId;
|
||
//var serialCode = CodeRuleService.NewGenSerial(sysFilter);
|
||
return SafeExecute<bool>(() =>
|
||
{
|
||
var TaskID = new Guid(filter.Parameter1);
|
||
if (TaskID == Guid.Empty)
|
||
{
|
||
throw new Exception("获取数据【待办ID】传参失败!");
|
||
}
|
||
var task = FMNotificActionTaskService.GetEntityTask(TaskID);
|
||
|
||
if (task.SOURCE_DATA_ID != new Guid(filter.Keyword))
|
||
{
|
||
throw new Exception("传参有误!");
|
||
}
|
||
|
||
var entity = GetEntity<T_SC_MT_MEETING_MINUTES>(task.SOURCE_DATA_ID.Value);//, "Nav_ListPJoin", "Nav_ListPReview"
|
||
int NOTICE_STATUS = (int)FMNoticeStatusEnum.未处理;
|
||
var listNotDeal = GetEntities<T_FM_NOTIFICATION_TASK>(e => e.SOURCE_DATA_ID == task.SOURCE_DATA_ID && e.NOTICE_STATUS == NOTICE_STATUS && e.ID != TaskID && e.SOURCE_FORMCODE == task.SOURCE_FORMCODE, null, null).Count();
|
||
var LoginID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
|
||
|
||
var listModelJoin = GetEntities<T_SC_MT_MEETING_PJOIN>(e => e.MEETING_MINUTES_ID == entity.ID && e.USER_ID == LoginID, null, null);
|
||
|
||
//var listModelJoin = entity.Nav_ListPJoin.Where(e => e.USER_ID == LoginID);
|
||
|
||
T_SC_MT_MINUTES_PREVIEW modelReview = null;
|
||
if (listModelJoin == null || listModelJoin.Count() < 1)
|
||
{
|
||
throw new Exception("您未参加该会议,操作失败!");
|
||
}
|
||
foreach (var item in listModelJoin)
|
||
{
|
||
item.ISRECORDRED = true;
|
||
}
|
||
|
||
modelReview = GetEntity<T_SC_MT_MINUTES_PREVIEW>(e => e.MEETING_MINUTES_ID == entity.ID && e.USER_ID == LoginID && !e.IS_DELETED);
|
||
if (modelReview != null && modelReview.ID != Guid.Empty)
|
||
{
|
||
modelReview.ISRECORDRED = true;
|
||
}
|
||
//if (entity.Nav_ListPReview != null && entity.Nav_ListPReview.Any())
|
||
//{
|
||
// modelReview = entity.Nav_ListPReview.FirstOrDefault(e => e.USER_ID == LoginID && !e.IS_DELETED);
|
||
// if (modelReview != null)
|
||
// {
|
||
// modelReview.ISRECORDRED = true;
|
||
// }
|
||
//}
|
||
|
||
//if (listNotDeal == null || !listNotDeal.Any())
|
||
if (listNotDeal < 1)
|
||
{
|
||
|
||
entity.Nav_Meeting = GetEntity<T_SC_MT_MEETING>(entity.MEETING_ID);
|
||
entity.Nav_ListMinutesDetail = GetEntities<T_SC_MT_MEETING_MINUTES_DETAIL>(e => e.MEETING_MINUTES_ID == entity.ID, null, "Nav_UserDeal").ToList();
|
||
|
||
bool isApprove = true;//是否直接审批
|
||
if (entity.Nav_ListMinutesDetail != null && entity.Nav_ListMinutesDetail.Any())
|
||
{
|
||
var listDeal = entity.Nav_ListMinutesDetail.Where(e => e.ISNEEDDEAL);
|
||
if (listDeal != null && listDeal.Any())
|
||
{
|
||
isApprove = false;
|
||
}
|
||
}
|
||
if (isApprove)
|
||
{
|
||
List<string> listCode = new List<string>() { "HY" + DateTime.Now.ToString("yyyyMMddHHmmss") + "1", "HY" + DateTime.Now.ToString("yyyyMMddHHmmss") + "2" };
|
||
|
||
//最后一个阅读
|
||
entity.STATUS = PFStandardStatus.Approving;
|
||
entity.APPROVE_ID = Guid.NewGuid();
|
||
|
||
////公司级 3 部门级 0 车间级 1 班组级 2
|
||
////只有明确是车间 走车间级 否则走部门级
|
||
string param = entity.Nav_Meeting.LEVELVALUE.Value.ToString();
|
||
//安全生产委员会 审批到总经理 基层安全会 到对应车间/ 部门 其他到部门级
|
||
//会议通知就处理了 下句代码应该可以不用
|
||
if (entity.Nav_Meeting.MEETINGTYPE == SCMEETINGTYPE.SafetyBoard)
|
||
param = "3";
|
||
|
||
MFlowPermitService.InsertApprove(listCode[0], "SC030", param, entity.ID, "SC030_SHOWPRINT", entity.TaskID, true, () =>
|
||
{
|
||
if (entity != null) //保存会议纪要主表 进入审批流
|
||
UpdateEntityNoCommit(entity);
|
||
if (task != null)//待办
|
||
UpdateEntityNoCommit(task);
|
||
if (listModelJoin != null && listModelJoin.Count() > 0)//参会人 是否阅读会议纪要
|
||
BantchUpdateEntityNoCommit(listModelJoin);
|
||
//UpdateEntityNoCommit(modelJoin);
|
||
}, entity.APPROVE_ID, entity.Nav_Meeting.USER_ID_ORIGINATOR, null, null, listCode[1], null, null, null, FMTASKTYPE.MT_MINUTES_Audit);
|
||
}
|
||
else
|
||
{
|
||
List<T_FM_NOTIFICATION_TASK> listTaskRread = new List<T_FM_NOTIFICATION_TASK>();//每条有时间期限
|
||
// 给落实责任人 发送落实待办
|
||
List<Guid> ListNoticeAll = new List<Guid>();
|
||
//List<string> ListNoticeAllNAME = new List<string>();
|
||
foreach (var item in entity.Nav_ListMinutesDetail)
|
||
{
|
||
if (!item.ISNEEDDEAL)
|
||
continue;
|
||
if (ListNoticeAll.Contains(item.Nav_UserDeal.ID))
|
||
continue;
|
||
|
||
ListNoticeAll.Add(item.Nav_UserDeal.ID);
|
||
//ListNoticeAllNAME.Add(item.Nav_UserDeal.NAME);
|
||
listTaskRread.Add(NotificationTaskService.InsertUserNoticeTaskModel("会议纪要落实", entity.ID, entity.ORG_ID, item.Nav_UserDeal.ID, item.Nav_UserDeal.NAME, DateTime.Now, item.LIMITDATETIME.Value, (int)FMNoticeTypeEnum.消息, "SC030_1"));
|
||
}
|
||
|
||
//List<T_FM_NOTIFICATION_TASK> listTaskRread = NotificationTaskService.InsertUserNoticeTaskModels("会议纪要落实", entity.ID, entity.ORG_ID, ListNoticeAll, ListNoticeAllNAME, DateTime.Now, DateTime.Now.AddHours(24), (int)FMNoticeTypeEnum.消息, "SC030_1");
|
||
if (listModelJoin != null && listModelJoin.Any())
|
||
{
|
||
foreach (var item in listModelJoin)
|
||
{
|
||
item.Nav_MeetingMinutes = null;
|
||
}
|
||
}
|
||
if (entity.Nav_ListMinutesDetail != null)
|
||
{
|
||
foreach (var item in entity.Nav_ListMinutesDetail)
|
||
{
|
||
item.Nav_UserDeal = null;
|
||
}
|
||
}
|
||
this.UnifiedCommit(() =>
|
||
{
|
||
if (task != null)//待办
|
||
UpdateEntityNoCommit(task);
|
||
if (listModelJoin != null && listModelJoin.Count() > 0)//参会人 是否阅读会议纪要
|
||
BantchUpdateEntityNoCommit(listModelJoin);
|
||
//UpdateEntityNoCommit(modelJoin);
|
||
if (listTaskRread != null && listTaskRread.Any())//落实责任人 填写信息
|
||
BantchSaveEntityNoCommit(listTaskRread);
|
||
});
|
||
}
|
||
}
|
||
else
|
||
{
|
||
this.UnifiedCommit(() =>
|
||
{
|
||
if (task != null)//待办
|
||
UpdateEntityNoCommit(task);
|
||
//if (modelJoin != null)//参会人 是否阅读会议纪要
|
||
// UpdateEntityNoCommit(modelJoin);
|
||
if (listModelJoin != null && listModelJoin.Count() > 0)//参会人 是否阅读会议纪要
|
||
BantchUpdateEntityNoCommit(listModelJoin);
|
||
//UpdateEntityNoCommit(modelJoin);
|
||
if (modelReview != null)//参会人 是否阅读会议纪要
|
||
UpdateEntityNoCommit(modelReview);
|
||
});
|
||
}
|
||
|
||
return true;
|
||
});
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 获取 纪要中只包含登陆者的明细信息
|
||
/// </summary>
|
||
/// <param name="filter">过滤实体</param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("GetByDetailDeal")]
|
||
public JsonActionResult<T_SC_MT_MEETING_MINUTES> GetByDetailDeal([FromBody] KeywordFilter filter)
|
||
{
|
||
return SafeExecute<T_SC_MT_MEETING_MINUTES>(() =>
|
||
{
|
||
Guid LoginId = APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value;
|
||
var result = GetEntity<T_SC_MT_MEETING_MINUTES>(null, filter);
|
||
if (result.Nav_ListPJoin != null && result.Nav_ListPJoin.Any())
|
||
{
|
||
result.Nav_ListPJoin = result.Nav_ListPJoin.Where(e => e.PERSONTYPE == SCMEETINGPERSONTYPE.JOIN).ToList();
|
||
}
|
||
if (result.Nav_ListMinutesDetail != null && result.Nav_ListMinutesDetail.Any())
|
||
{
|
||
var detail = result.Nav_ListMinutesDetail.Where(e => e.ISNEEDDEAL && e.DEAL_USER_ID.HasValue && e.DEAL_USER_ID == LoginId);
|
||
if (detail != null && detail.Any())
|
||
result.Nav_ListMinutesDetail = detail.ToList();
|
||
else
|
||
result.Nav_ListMinutesDetail = null;
|
||
}
|
||
return result;
|
||
});
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 获取纪要 主持人 落实效果 填写
|
||
/// </summary>
|
||
/// <param name="filter">过滤实体</param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("GetDetailEffect")]
|
||
public JsonActionResult<T_SC_MT_MEETING_MINUTES> GetDetailEffect([FromBody] KeywordFilter filter)
|
||
{
|
||
return SafeExecute<T_SC_MT_MEETING_MINUTES>(() =>
|
||
{
|
||
Guid LoginId = APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value;
|
||
var result = GetEntity<T_SC_MT_MEETING_MINUTES>(null, filter);
|
||
if (result.Nav_ListPJoin != null && result.Nav_ListPJoin.Any())
|
||
{
|
||
result.Nav_ListPJoin = result.Nav_ListPJoin.Where(e => e.PERSONTYPE == SCMEETINGPERSONTYPE.JOIN).ToList();
|
||
}
|
||
if (result.Nav_ListMinutesDetail != null && result.Nav_ListMinutesDetail.Any())
|
||
{
|
||
var check = result.Nav_ListMinutesDetail.Where(e => e.ISNEEDDEAL && e.STATUS < MINUTES_DETAIL_STATUS.Host);
|
||
if (check != null && check.Count() > 0)
|
||
{
|
||
throw new Exception("会议决议中所有整改责任人都提交了整改信息后,才能填写落实结果!");
|
||
}
|
||
else
|
||
{
|
||
result.Nav_ListMinutesDetail = result.Nav_ListMinutesDetail.Where(e => e.ISNEEDDEAL).ToList();
|
||
}
|
||
}
|
||
return result;
|
||
});
|
||
}
|
||
|
||
/// <summary>
|
||
/// 会议纪要审批回调
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet, Route("MeetingMinutesBack")]
|
||
public JsonActionResult<bool> MeetingMinutesBack(string id)
|
||
{
|
||
return SafeExecute<bool>(() =>
|
||
{
|
||
return ApproveCallBackService.CallBack("SC/SCMtMeetingMinutes/MeetingMinutesBack", id);
|
||
});
|
||
}
|
||
|
||
/// <summary>
|
||
/// 会议纪要审批驳回
|
||
/// </summary>
|
||
/// <param name="entity"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("MeetingMinutesReject")]
|
||
public JsonActionResult<bool> MeetingMinutesReject([FromBody] T_PF_APPROVE entity)
|
||
{
|
||
return SafeExecute<bool>(() =>
|
||
{
|
||
// //公共 获取审批流信息
|
||
T_PF_APPROVE modelApp = null;
|
||
List<T_PF_APPROVE_DETAIL> listAppDetail = null;
|
||
T_FM_NOTIFICATION_TASK taskFinish = null;
|
||
string Msg = string.Empty;
|
||
bool ResultGetInfo = ApproveCallBackService.GetApproject(entity, ref modelApp, ref listAppDetail, ref taskFinish, ref Msg);
|
||
if (!ResultGetInfo)
|
||
throw new Exception("驳回失败!");
|
||
|
||
if (modelApp == null || listAppDetail == null)
|
||
throw new Exception("获取驳回信息失败!");
|
||
|
||
#region 驳回主体
|
||
|
||
var meetingMinus = GetEntity<T_SC_MT_MEETING_MINUTES>(entity.DATA_ID);
|
||
meetingMinus.STATUS = PFStandardStatus.Rejected;
|
||
|
||
|
||
var taskOld = GetEntity<T_FM_NOTIFICATION_TASK>(e => e.SOURCE_DATA_ID == meetingMinus.ID && e.SOURCE_FORMCODE == "SC030_SHOWPRINT" && e.NOTICE_STATUS != 0 && e.USER_ID == meetingMinus.CREATER_ID && !e.NOTICE_TITLE.EndsWith("签到"));//没有 SC034_SHOWPRINT
|
||
//安委会会议纪要 SC034 //安委会会议纪要 BS030
|
||
string SOURCE_FORMCODE = "SC034";
|
||
if (meetingMinus.MEETINGTYPE == SCMEETINGTYPE.SafetyBoard || meetingMinus.MEETINGTYPE == SCMEETINGTYPE.BasicSecurity)
|
||
{
|
||
SOURCE_FORMCODE = "SC030";
|
||
}
|
||
//发给制表人
|
||
T_FM_NOTIFICATION_TASK taskBack = null;
|
||
if (taskOld == null)
|
||
{
|
||
string userName = string.Empty;
|
||
Guid userID = meetingMinus.CREATER_ID.HasValue ? meetingMinus.CREATER_ID.Value : Guid.Empty;
|
||
if (userID == Guid.Empty)
|
||
{
|
||
//会议中查找
|
||
var meet = GetEntity<T_SC_MT_MEETING>(meetingMinus.MEETING_ID);
|
||
userID = meet.USER_ID_RECORDER.HasValue ? meet.USER_ID_RECORDER.Value : meet.CREATER_ID.Value;
|
||
}
|
||
var user = GetEntity<T_FM_USER>(userID);
|
||
userName = user.NAME;
|
||
taskBack = NotificationTaskService.InsertUserNoticeTaskModel(("(驳回)" + meetingMinus.MEETINGTYPE.GetDescription() + "会议纪要"), meetingMinus.ID, entity.ORG_ID, userID, userName, DateTime.Now, DateTime.Now.AddDays(1), 0, SOURCE_FORMCODE);
|
||
}
|
||
else
|
||
{
|
||
taskBack = NotificationTaskService.InsertUserNoticeTaskModel("(驳回)" + taskOld.NOTICE_TITLE, meetingMinus.ID, entity.ORG_ID, taskOld.USER_ID, taskOld.USER_NAME, DateTime.Now, taskOld.TASK_ENDDT, 0, SOURCE_FORMCODE);
|
||
}
|
||
|
||
#endregion
|
||
|
||
meetingMinus.Nav_Approve = null;
|
||
UnifiedCommit(() =>
|
||
{
|
||
if (meetingMinus != null)
|
||
UpdateEntityNoCommit(meetingMinus);
|
||
if (modelApp != null)
|
||
UpdateEntityNoCommit(modelApp);
|
||
if (listAppDetail != null && listAppDetail.Count > 0)
|
||
BantchUpdateEntityNoCommit(listAppDetail);
|
||
if (taskFinish != null)
|
||
UpdateEntityNoCommit(taskFinish);
|
||
if (taskBack != null)
|
||
UpdateEntityNoCommit(taskBack);
|
||
});
|
||
return true;
|
||
});
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 排序分页查询数据
|
||
/// </summary>
|
||
/// <param name="pageFilter">分页过滤实体</param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("OrderPaged")]
|
||
public PagedActionResult<T_SC_MT_MEETING_MINUTES> OrderPaged([FromBody] KeywordPageFilter pageFilter)
|
||
{
|
||
PagedActionResult<T_SC_MT_MEETING_MINUTES> result = null;
|
||
if (!string.IsNullOrEmpty(pageFilter.MenuParameter))
|
||
{
|
||
if (pageFilter.MenuParameter == "40")
|
||
{
|
||
result = WitOrderPaged(e => e.MEETINGTYPE == SCMEETINGTYPE.SafetyBoard || e.MEETINGTYPE == SCMEETINGTYPE.BasicSecurity, pageFilter);
|
||
}
|
||
else
|
||
{
|
||
result = WitOrderPaged(e => e.MEETINGTYPE == SCMEETINGTYPE.Ordinary || e.MEETINGTYPE == SCMEETINGTYPE.FileAudit || e.MEETINGTYPE == SCMEETINGTYPE.FileReView, pageFilter);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
result = WitOrderPaged(null, pageFilter);
|
||
}
|
||
if (result.Data != null && result.Data.Any() && DataHelper.GetRequestType(Request.Headers) == 2)
|
||
{
|
||
foreach (var item in result.Data)
|
||
{
|
||
item.STATUSSHOW = item.STATUS.GetDescription();
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
}
|
||
} |