249 lines
13 KiB
C#
249 lines
13 KiB
C#
|
|
using APT.BaseData.Domain.Entities;
|
|||
|
|
using APT.BaseData.Domain.Entities.FM;
|
|||
|
|
using APT.BaseData.Domain.Enums;
|
|||
|
|
using APT.BaseData.Services.Services.FM;
|
|||
|
|
using APT.Infrastructure.Core;
|
|||
|
|
using APT.MS.Domain.Entities.FO;
|
|||
|
|
using APT.MS.Domain.Enums;
|
|||
|
|
using APT.Utility;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using NPOI.SS.Formula.Functions;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
|
|||
|
|
namespace APT.FO.WebApi.Controllers
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 专业人员履历表
|
|||
|
|
/// </summary>
|
|||
|
|
[Route("api/FO/FOProfessionalResume")]
|
|||
|
|
public partial class ProfessionalResumeController : AuthorizeApiController<T_FO_PROFESSIONAL_RESUME>
|
|||
|
|
{
|
|||
|
|
[HttpPost, Route("GetEdit")]
|
|||
|
|
public JsonActionResult<T_FO_PROFESSIONAL_RESUME> GetEdit([FromBody] KeywordFilter filter)
|
|||
|
|
{
|
|||
|
|
return SafeExecute(() =>
|
|||
|
|
{
|
|||
|
|
var id = filter.FilterGroup.Rules.FirstOrDefault(t => t.Field == "ID").Value.ToString();
|
|||
|
|
if (string.IsNullOrEmpty(id))
|
|||
|
|
this.ThrowError("060010");
|
|||
|
|
var entity = this.GetEntity<T_FO_PROFESSIONAL_RESUME>(id, "Nav_ApplyUser", "Nav_Company", "Nav_ApplyDepartment", "Nav_User", "Nav_Educational", "Nav_Category", "Nav_TechPost",
|
|||
|
|
"Nav_EducationalFiles.Nav_ImgFile.Nav_File", "Nav_PostFiles.Nav_ImgFile.Nav_File", "Nav_CertificateFiles.Nav_ImgFile.Nav_File", "Nav_MedicalFiles.Nav_ImgFile.Nav_File",
|
|||
|
|
"Nav_TrainFiles.Nav_ImgFile.Nav_File", "Nav_OtherFiles.Nav_ImgFile.Nav_File");
|
|||
|
|
if (entity != null)
|
|||
|
|
{
|
|||
|
|
var details = this.GetEntities<T_FO_PROFESSIONAL_RESUME_DETAIL>(t => t.PROFESSIONAL_RESUME_ID == entity.ID, new BaseFilter(entity.ORG_ID), "Nav_DetailFiles.Nav_ImgFile.Nav_File").ToList();
|
|||
|
|
entity.Nav_Details = details.OrderByDescending(t => t.START_DATE).ToList();
|
|||
|
|
}
|
|||
|
|
return entity;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 新增修改
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="entity"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost, Route("FullUpdate")]
|
|||
|
|
public JsonActionResult<bool> FullUpdate([FromBody] T_FO_PROFESSIONAL_RESUME entity)
|
|||
|
|
{
|
|||
|
|
return SafeExecute<bool>(() =>
|
|||
|
|
{
|
|||
|
|
if (entity.AGE > 60)
|
|||
|
|
{
|
|||
|
|
throw new Exception("年龄不得大于60周岁");
|
|||
|
|
}
|
|||
|
|
var type = this.GetEntity<T_FO_PROFESSIONAL_CATEGORY>(entity.PROFESSIONAL_CATEGORY_ID.ToString());
|
|||
|
|
if (entity.YEAR <= 10 && type!=null && type.NAME =="五职")
|
|||
|
|
{
|
|||
|
|
throw new Exception("五职人员,从业经历年限要大于10年");
|
|||
|
|
}
|
|||
|
|
if (entity.YEAR <= 5 && type != null && type.NAME == "五科")
|
|||
|
|
{
|
|||
|
|
throw new Exception("五职人员,从业经历年限要大于5年");
|
|||
|
|
}
|
|||
|
|
var loginUserId = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
|
|||
|
|
var departmentId = APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID;
|
|||
|
|
entity.APPLY_USER_ID = loginUserId;
|
|||
|
|
entity.APPLY_DEPARTMENT_ID = departmentId;
|
|||
|
|
var details = entity.Nav_Details;
|
|||
|
|
if (details != null && details.Any())
|
|||
|
|
{
|
|||
|
|
details = details.Where(t => !t.IS_DELETED).ToList();
|
|||
|
|
}
|
|||
|
|
entity.Nav_Details = null;
|
|||
|
|
var detailIds = this.GetEntities<T_FO_PROFESSIONAL_RESUME_DETAIL>(t => t.PROFESSIONAL_RESUME_ID == entity.ID, new BaseFilter(entity.ORG_ID)).Select(m => m.ID).ToList();
|
|||
|
|
var detailFileIds = this.GetEntities<T_FO_PROFESSIONAL_RESUME_DETAIL_FILE>(t => detailIds.Contains(t.PROFESSIONAL_RESUME_DETAIL_ID), new BaseFilter(entity.ORG_ID)).Select(m => m.ID).ToList();
|
|||
|
|
var detailList = new List<T_FO_PROFESSIONAL_RESUME_DETAIL>();
|
|||
|
|
var detailFileList = new List<T_FO_PROFESSIONAL_RESUME_DETAIL_FILE>();
|
|||
|
|
if (details != null && details.Any())
|
|||
|
|
{
|
|||
|
|
foreach (var item in details)
|
|||
|
|
{
|
|||
|
|
if (item.Nav_DetailFiles != null && item.Nav_DetailFiles.Any())
|
|||
|
|
{
|
|||
|
|
foreach (var item2 in item.Nav_DetailFiles)
|
|||
|
|
{
|
|||
|
|
item2.ORG_ID = entity.ORG_ID;
|
|||
|
|
item2.PROFESSIONAL_RESUME_DETAIL_ID = item.ID;
|
|||
|
|
item2.Nav_ImgFile = null;
|
|||
|
|
detailFileList.Add(item2);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
item.ORG_ID = entity.ORG_ID;
|
|||
|
|
item.PROFESSIONAL_RESUME_ID = entity.ID;
|
|||
|
|
item.Nav_DetailFiles = null;
|
|||
|
|
detailList.Add(item);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var educationals = entity.Nav_EducationalFiles;
|
|||
|
|
if (educationals != null && educationals.Any())
|
|||
|
|
{
|
|||
|
|
educationals = educationals.Where(t => !t.IS_DELETED).ToList();
|
|||
|
|
}
|
|||
|
|
entity.Nav_EducationalFiles = null;
|
|||
|
|
var educationalIds = this.GetEntities<T_FO_PROFESSIONAL_RESUME_EDUCATIONAL_FILE>(t => t.PROFESSIONAL_RESUME_ID == entity.ID, new BaseFilter(entity.ORG_ID)).Select(m => m.ID).ToList();
|
|||
|
|
var educationalList = new List<T_FO_PROFESSIONAL_RESUME_EDUCATIONAL_FILE>();
|
|||
|
|
if (educationals != null && educationals.Any())
|
|||
|
|
{
|
|||
|
|
foreach (var item in educationals)
|
|||
|
|
{
|
|||
|
|
item.ORG_ID = entity.ORG_ID;
|
|||
|
|
item.PROFESSIONAL_RESUME_ID = entity.ID;
|
|||
|
|
item.Nav_ImgFile = null;
|
|||
|
|
educationalList.Add(item);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var posts = entity.Nav_PostFiles;
|
|||
|
|
if (posts != null && posts.Any())
|
|||
|
|
{
|
|||
|
|
posts = posts.Where(t => !t.IS_DELETED).ToList();
|
|||
|
|
}
|
|||
|
|
entity.Nav_PostFiles = null;
|
|||
|
|
var postIds = this.GetEntities<T_FO_PROFESSIONAL_RESUME_POST_FILE>(t => t.PROFESSIONAL_RESUME_ID == entity.ID, new BaseFilter(entity.ORG_ID)).Select(m => m.ID).ToList();
|
|||
|
|
var postList = new List<T_FO_PROFESSIONAL_RESUME_POST_FILE>();
|
|||
|
|
if (posts != null && posts.Any())
|
|||
|
|
{
|
|||
|
|
foreach (var item in posts)
|
|||
|
|
{
|
|||
|
|
item.ORG_ID = entity.ORG_ID;
|
|||
|
|
item.PROFESSIONAL_RESUME_ID = entity.ID;
|
|||
|
|
item.Nav_ImgFile = null;
|
|||
|
|
postList.Add(item);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var certificates = entity.Nav_CertificateFiles;
|
|||
|
|
if (certificates != null && certificates.Any())
|
|||
|
|
{
|
|||
|
|
certificates = certificates.Where(t => !t.IS_DELETED).ToList();
|
|||
|
|
}
|
|||
|
|
entity.Nav_CertificateFiles = null;
|
|||
|
|
var certificateIds = this.GetEntities<T_FO_PROFESSIONAL_RESUME_CERTIFICATE_FILE>(t => t.PROFESSIONAL_RESUME_ID == entity.ID, new BaseFilter(entity.ORG_ID)).Select(m => m.ID).ToList();
|
|||
|
|
var certificateList = new List<T_FO_PROFESSIONAL_RESUME_CERTIFICATE_FILE>();
|
|||
|
|
if (certificates != null && certificates.Any())
|
|||
|
|
{
|
|||
|
|
foreach (var item in certificates)
|
|||
|
|
{
|
|||
|
|
item.ORG_ID = entity.ORG_ID;
|
|||
|
|
item.PROFESSIONAL_RESUME_ID = entity.ID;
|
|||
|
|
item.Nav_ImgFile = null;
|
|||
|
|
certificateList.Add(item);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var medicals = entity.Nav_MedicalFiles;
|
|||
|
|
if (medicals != null && medicals.Any())
|
|||
|
|
{
|
|||
|
|
medicals = medicals.Where(t => !t.IS_DELETED).ToList();
|
|||
|
|
}
|
|||
|
|
entity.Nav_MedicalFiles = null;
|
|||
|
|
var medicalIds = this.GetEntities<T_FO_PROFESSIONAL_RESUME_MEDICAL_FILE>(t => t.PROFESSIONAL_RESUME_ID == entity.ID, new BaseFilter(entity.ORG_ID)).Select(m => m.ID).ToList();
|
|||
|
|
var medicalList = new List<T_FO_PROFESSIONAL_RESUME_MEDICAL_FILE>();
|
|||
|
|
if (medicals != null && medicals.Any())
|
|||
|
|
{
|
|||
|
|
foreach (var item in medicals)
|
|||
|
|
{
|
|||
|
|
item.ORG_ID = entity.ORG_ID;
|
|||
|
|
item.PROFESSIONAL_RESUME_ID = entity.ID;
|
|||
|
|
item.Nav_ImgFile = null;
|
|||
|
|
medicalList.Add(item);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var trains = entity.Nav_TrainFiles;
|
|||
|
|
if (trains != null && trains.Any())
|
|||
|
|
{
|
|||
|
|
trains = trains.Where(t => !t.IS_DELETED).ToList();
|
|||
|
|
}
|
|||
|
|
entity.Nav_TrainFiles = null;
|
|||
|
|
var trainIds = this.GetEntities<T_FO_PROFESSIONAL_RESUME_TRAIN_FILE>(t => t.PROFESSIONAL_RESUME_ID == entity.ID, new BaseFilter(entity.ORG_ID)).Select(m => m.ID).ToList();
|
|||
|
|
var trainList = new List<T_FO_PROFESSIONAL_RESUME_TRAIN_FILE>();
|
|||
|
|
if (trains != null && trains.Any())
|
|||
|
|
{
|
|||
|
|
foreach (var item in trains)
|
|||
|
|
{
|
|||
|
|
item.ORG_ID = entity.ORG_ID;
|
|||
|
|
item.PROFESSIONAL_RESUME_ID = entity.ID;
|
|||
|
|
item.Nav_ImgFile = null;
|
|||
|
|
trainList.Add(item);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var others = entity.Nav_OtherFiles;
|
|||
|
|
if (others != null && others.Any())
|
|||
|
|
{
|
|||
|
|
others = others.Where(t => !t.IS_DELETED).ToList();
|
|||
|
|
}
|
|||
|
|
entity.Nav_OtherFiles = null;
|
|||
|
|
var otherIds = this.GetEntities<T_FO_PROFESSIONAL_RESUME_OTHER_FILE>(t => t.PROFESSIONAL_RESUME_ID == entity.ID, new BaseFilter(entity.ORG_ID)).Select(m => m.ID).ToList();
|
|||
|
|
var otherList = new List<T_FO_PROFESSIONAL_RESUME_OTHER_FILE>();
|
|||
|
|
if (others != null && others.Any())
|
|||
|
|
{
|
|||
|
|
foreach (var item in others)
|
|||
|
|
{
|
|||
|
|
item.ORG_ID = entity.ORG_ID;
|
|||
|
|
item.PROFESSIONAL_RESUME_ID = entity.ID;
|
|||
|
|
item.Nav_ImgFile = null;
|
|||
|
|
otherList.Add(item);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
this.UnifiedCommit(() =>
|
|||
|
|
{
|
|||
|
|
if (detailFileIds != null && detailFileIds.Any())
|
|||
|
|
this.BantchDeleteEntityNoCommit<T_FO_PROFESSIONAL_RESUME_DETAIL_FILE>(detailFileIds);
|
|||
|
|
if (detailIds != null && detailIds.Any())
|
|||
|
|
this.BantchDeleteEntityNoCommit<T_FO_PROFESSIONAL_RESUME_DETAIL>(detailIds);
|
|||
|
|
if (educationalIds != null && educationalIds.Any())
|
|||
|
|
this.BantchDeleteEntityNoCommit<T_FO_PROFESSIONAL_RESUME_EDUCATIONAL_FILE>(educationalIds);
|
|||
|
|
if (postIds != null && postIds.Any())
|
|||
|
|
this.BantchDeleteEntityNoCommit<T_FO_PROFESSIONAL_RESUME_POST_FILE>(postIds);
|
|||
|
|
if (certificateIds != null && certificateIds.Any())
|
|||
|
|
this.BantchDeleteEntityNoCommit<T_FO_PROFESSIONAL_RESUME_CERTIFICATE_FILE>(certificateIds);
|
|||
|
|
if (medicalIds != null && medicalIds.Any())
|
|||
|
|
this.BantchDeleteEntityNoCommit<T_FO_PROFESSIONAL_RESUME_MEDICAL_FILE>(medicalIds);
|
|||
|
|
if (trainIds != null && trainIds.Any())
|
|||
|
|
this.BantchDeleteEntityNoCommit<T_FO_PROFESSIONAL_RESUME_TRAIN_FILE>(trainIds);
|
|||
|
|
if (otherIds != null && otherIds.Any())
|
|||
|
|
this.BantchDeleteEntityNoCommit<T_FO_PROFESSIONAL_RESUME_OTHER_FILE>(otherIds);
|
|||
|
|
if (entity != null)
|
|||
|
|
UpdateEntityNoCommit(entity);
|
|||
|
|
if (detailList != null && detailList.Any())
|
|||
|
|
this.BantchSaveEntityNoCommit(detailList);
|
|||
|
|
if (detailFileList != null && detailFileList.Any())
|
|||
|
|
this.BantchSaveEntityNoCommit(detailFileList);
|
|||
|
|
if (educationalList != null && educationalList.Any())
|
|||
|
|
this.BantchSaveEntityNoCommit(educationalList);
|
|||
|
|
if (postList != null && postList.Any())
|
|||
|
|
this.BantchSaveEntityNoCommit(postList);
|
|||
|
|
if (certificateList != null && certificateList.Any())
|
|||
|
|
this.BantchSaveEntityNoCommit(certificateList);
|
|||
|
|
if (medicalList != null && medicalList.Any())
|
|||
|
|
this.BantchSaveEntityNoCommit(medicalList);
|
|||
|
|
if (trainList != null && trainList.Any())
|
|||
|
|
this.BantchSaveEntityNoCommit(trainList);
|
|||
|
|
if (otherList != null && otherList.Any())
|
|||
|
|
this.BantchSaveEntityNoCommit(otherList);
|
|||
|
|
});
|
|||
|
|
return true;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|