diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/JobPerformanceController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/JobPerformanceController.cs index 3f8fb357b..f385c48e9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/JobPerformanceController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/JobPerformanceController.cs @@ -70,34 +70,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers #endregion #region 获取数据 - /// - /// 人员类别 - /// - /// - public ActionResult PeopleType() - { - var data = jobPerformanceIBLL.GetPeopleType(); - return Success(data); - } - /// - /// 岗位类别 - /// - /// - public ActionResult PostType() - { - var data = jobPerformanceIBLL.GetPostType(); - return Success(data); - } - /// - /// 薪级 - /// - /// - public ActionResult PayGrade() - { - var data = jobPerformanceIBLL.GetPayGrade(); - return Success(data); - } - /// /// 获取列表数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/JobPerformance/ImportForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/JobPerformance/ImportForm.js index 19638a9c4..31a28a2d2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/JobPerformance/ImportForm.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/JobPerformance/ImportForm.js @@ -106,7 +106,7 @@ var bootstrap = function ($, learun) { param['chunks'] = fileInfo[file.id].chunks; param['ext'] = file.ext; param['templateId'] = id; - learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/ExcelImport/SalarySheetImport", param, function (res) { + learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/ExcelImport/JobPerformanceImport", param, function (res) { var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); $fileItem.find('.lr-uploader-progress').remove(); if (res.code == learun.httpCode.success) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs index a73267113..e2e11b411 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs @@ -23,6 +23,7 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); private WageScheduleIBLL wageScheduleIBLL = new WageScheduleBLL(); + private JobPerformanceIBLL jobPerformanceIBLL = new JobPerformanceBLL(); #region 视图功能 /// @@ -352,6 +353,38 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers return Fail("导入数据失败!"); } } + + /// + /// 工作绩效导入 + /// + /// 模板Id + /// 文件主键 + /// 分片数 + /// 文件扩展名 + /// + [HttpPost] + [ValidateAntiForgeryToken] + public ActionResult JobPerformanceImport(string fileId, int chunks, string ext) + { + UserInfo userInfo = LoginUserInfo.Get(); + string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo); + if (!string.IsNullOrEmpty(path)) + { + DataTable dt = ExcelHelper.ExcelImport(path); + string res = jobPerformanceIBLL.JobPerformanceImport(dt, fileId); + var data = new + { + Success = res.Split('|')[0], + Fail = res.Split('|')[1] + }; + return JsonResult(data); + } + else + { + return Fail("导入数据失败!"); + } + } + /// /// 下载文件(导入文件未被导入的数据) /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/JobPerformanceImport.xls b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/JobPerformanceImport.xls new file mode 100644 index 000000000..1df69c557 Binary files /dev/null and b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/JobPerformanceImport.xls differ diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 206807150..40f07577e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -8156,6 +8156,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceBLL.cs index fc5888cd6..f3a8477db 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceBLL.cs @@ -92,61 +92,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } - public List GetPeopleType() - { - try - { - return jobPerformanceService.GetPeopleType().Select(x => new JobPerformanceEntity { }).Distinct().ToList(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - public List GetPostType() - { - try - { - return jobPerformanceService.GetPostType().Select(x => new JobPerformanceEntity { }).Distinct().ToList(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - public List GetPayGrade() - { - try - { - return jobPerformanceService.GetPayGrade().Select(x => new JobPerformanceEntity { }).Distinct().ToList(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - #endregion #region 提交数据 @@ -223,11 +168,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// /// - public string SalarySheelImport(DataTable dt, string fileId) + public string JobPerformanceImport(DataTable dt, string fileId) { try { - return jobPerformanceService.SalarySheelImport(dt, fileId); + return jobPerformanceService.JobPerformanceImport(dt, fileId); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceIBLL.cs index fa959976f..15a17e34f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceIBLL.cs @@ -34,11 +34,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 主键 /// JobPerformanceEntity GetEntity(string keyValue); - - List GetPeopleType(); - List GetPostType(); - List GetPayGrade(); - + #endregion #region 提交数据 @@ -63,7 +59,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// /// - string SalarySheelImport(DataTable dt, string fileId); + string JobPerformanceImport(DataTable dt, string fileId); #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceService.cs index 8aab3aa51..9671c5f01 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/JobPerformance/JobPerformanceService.cs @@ -134,71 +134,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - - - public List GetPeopleType() - { - try - { - string sql = " select distinct PeopleType from JobPerformance where 1=1 and PeopleType is not null order by PeopleType asc "; - return this.BaseRepository("CollegeMIS").FindList(sql).ToList(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - - public List GetPostType() - { - try - { - string sql = " select distinct PostType from JobPerformance where 1=1 and PostType is not null order by PostType asc "; - return this.BaseRepository("CollegeMIS").FindList(sql).ToList(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - /// - /// 薪级 - /// - /// - /// - public List GetPayGrade() - { - try - { - string sql = " select distinct PayGrade from JobPerformance where 1=1 and PayGrade is not null order by PayGrade asc"; - return this.BaseRepository("CollegeMIS").FindList(sql).ToList(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } + #endregion #region 提交数据 @@ -316,14 +252,14 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration private ICache cache = CacheFactory.CaChe(); private string cacheKey = "Learun_adms_excelError_"; // +公司主键 #endregion - + /// /// 工作绩效导入 /// /// /// /// - public string SalarySheelImport(DataTable dt, string fileId) + public string JobPerformanceImport(DataTable dt, string fileId) { try { @@ -347,75 +283,106 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration try { //检测是否有空值 - if (dr[1].ToString() == "" || dr[3].ToString() == "" || dr[6].ToString() == "" || dr[26].ToString() == "" || dr[35].ToString() == "") + if (string.IsNullOrEmpty(dr["发放年份"].ToString())) + { + throw (new Exception("发放年份不能为空!")); + } + if (string.IsNullOrEmpty(dr["发放月份"].ToString())) + { + throw (new Exception("发放月份不能为空!")); + } + if (string.IsNullOrEmpty(dr["姓名"].ToString())) + { + throw (new Exception("姓名不能为空!")); + } + if (string.IsNullOrEmpty(dr["身份证号"].ToString())) + { + throw (new Exception("身份证号不能为空!")); + } + //检测发放年份 + decimal year = 0; + bool yearParseResult = decimal.TryParse(dr["发放年份"].ToString(), out year); + if (!yearParseResult || dr["发放年份"].ToString().Length != 4) { - throw (new Exception("行内必填项数据有空值,不能为空!")); + throw (new Exception("发放年份数据无效!")); } - if (EmpInfoEntities.Count(m => m.EmpName.ToUpper() == dr[1].ToString().ToUpper()) == 0) + //检测发放月份 + int month = 0; + bool monthParseResult = int.TryParse(dr["发放月份"].ToString(), out month); + if (!monthParseResult) { - throw (new Exception("【姓名】不存在,请核对!")); + throw (new Exception("发放月份必须为数字!")); } - if (dr[2].ToString() == "") + if (month <= 0 || month > 12) { - throw (new Exception("【工资卡号】不能为空")); + throw (new Exception("发放月份必须为1-12中间的数字!")); } - if (dr[36].ToString() == "" || dr[37].ToString() == "") + //检测姓名 + var empinfoEntity = EmpInfoEntities.FirstOrDefault(x => x.IdentityCardNo == dr["身份证号"].ToString()); + if (empinfoEntity == null) { - throw (new Exception("发放【年、月】不能为空")); + throw (new Exception("【身份证号】不存在,请核对!")); } - if (jobPerformanceEntityList.Count(x => x.IssueYear == dr[37].ToString() && x.IssueMonth == dr[36].ToInt() && x.EmpName == dr[1].ToString()) > 0) + //检测重复 + if (jobPerformanceEntityList.Count(x => x.IssueYear == dr["发放年份"].ToString() && x.IssueMonth == dr["发放月份"].ToInt() && x.EmpName == empinfoEntity.EmpName && x.EmpNo == empinfoEntity.EmpNo) > 0) { - throw (new Exception("导入信息已重复,信息已忽略")); + throw (new Exception("导入信息已重复,信息已忽略!")); } //写入要导入的数据 JobPerformanceEntity jobPerformanceEntity = new JobPerformanceEntity { Id = Guid.NewGuid().ToString(), - //No = dr[0].ToString(), - //EmpName = dr[1].ToString(), - //WageCardNo = dr[2].ToString(), - //PeopleType = dr[3].ToString(), - //PostType = dr[4].ToString(), - //PayGrade = dr[5].ToString(), - //TotalGrossPay = dr[6].ToDecimalOrNull(), - //PostWage = dr[7].ToDecimalOrNull(), - //PayGradeWage = dr[8].ToDecimalOrNull(), - //TenPercent = dr[9].ToDecimalOrNull(), - //BasicsPerformance = dr[10].ToDecimalOrNull(), - //AwardPerformance = dr[11].ToDecimalOrNull(), - //SeparateBasicsPerformance = dr[12].ToDecimalOrNull(), - //SeparateAwardPerformance = dr[13].ToDecimalOrNull(), - //RoughEdgeAllowance = dr[14].ToDecimalOrNull(), - //NationAllowance = dr[15].ToDecimalOrNull(), - //TeachAllowance = dr[16].ToDecimalOrNull(), - //SuperfineTeacherResearch = dr[17].ToDecimalOrNull(), - //Transportation = dr[18].ToDecimalOrNull(), - //RealeState = dr[19].ToDecimalOrNull(), - //WorkKeep = dr[20].ToDecimalOrNull(), - //GirlStaffSanitation = dr[21].ToDecimalOrNull(), - //TeacherAndTown = dr[22].ToDecimalOrNull(), - //HousingAllowance = dr[23].ToDecimalOrNull(), - //HousingFundAllowance = dr[24].ToDecimalOrNull(), - //OtherOne = dr[25].ToDecimalOrNull(), - //DeductionsSubtotal = dr[26].ToDecimalOrNull(), - //AccumulationFund = dr[27].ToDecimalOrNull(), - //EndowmentInsurance = dr[28].ToDecimalOrNull(), - //OccupationalAnnuities = dr[29].ToDecimalOrNull(), - //MedicalInsurance = dr[30].ToDecimalOrNull(), - //UnemploymentInsurance = dr[31].ToDecimalOrNull(), - //LaborUnionWage = dr[32].ToDecimalOrNull(), - //PersonalIncomeTax = dr[33].ToDecimalOrNull(), - //Other = dr[34].ToDecimalOrNull(), - //NetCombined = dr[35].ToDecimalOrNull(), - IssueMonth = dr[36].ToInt(), - IssueYear = dr[37].ToString(), + IssueYear = year.ToString(), + IssueMonth = month, + EmpNo = empinfoEntity.EmpNo, + EmpName = empinfoEntity.EmpName, + Department = dr[2].ToString(), + Post = dr[5].ToString(), + AdminPosition = dr[6].ToDecimalOrNull(), + LeagueSecretary = dr[7].ToDecimalOrNull(), + CenterPeople = dr[8].ToDecimalOrNull(), + TeachingPosition = dr[9].ToDecimalOrNull(), + Director = dr[10].ToDecimalOrNull(), + TeacherWorkRoom = dr[11].ToDecimalOrNull(), + MajorPeople = dr[12].ToDecimalOrNull(), + WorkLeader = dr[13].ToDecimalOrNull(), + TrainAdmin = dr[14].ToDecimalOrNull(), + CommitteeMember = dr[15].ToDecimalOrNull(), + LessonNum = dr[16].ToIntOrNull(), + LessonHour = dr[17].ToDecimalOrNull(), + MorningStudyNum = dr[18].ToIntOrNull(), + MorningStudyHour = dr[19].ToDecimalOrNull(), + NightStudyNum = dr[20].ToIntOrNull(), + NightStudyHour = dr[21].ToDecimalOrNull(), + TwoExerciseNum = dr[22].ToIntOrNull(), + TwoExerciseHour = dr[23].ToDecimalOrNull(), + TempWorkDay = dr[24].ToDecimalOrNull(), + TempWorkScore = dr[25].ToDecimalOrNull(), + OffWorkDay = dr[26].ToIntOrNull(), + OffWorkMinusScore = dr[27].ToDecimalOrNull(), + OnDutyDay = dr[28].ToDecimalOrNull(), + OnDutyScore = dr[29].ToDecimalOrNull(), + ShouldWorkDay = dr[30].ToDecimalOrNull(), + WorkBasicScore = dr[31].ToDecimalOrNull(), + WorkOffCount = dr[32].ToIntOrNull(), + WorkMinusScore = dr[33].ToDecimalOrNull(), + BigActivityMinusScore = dr[34].ToDecimalOrNull(), + AbsenteeismDay = dr[35].ToDecimalOrNull(), + AbsenteeismMinusScore = dr[36].ToDecimalOrNull(), + WorkRemark = dr[37].ToString(), + RoutineBasicScore = dr[38].ToDecimalOrNull(), + RoutineMinusScore = dr[39].ToDecimalOrNull(), + RoutineRemark = dr[40].ToString(), + PerformanceTotalScore = dr[41].ToDecimalOrNull(), + HolidayJobPerformance = dr[42].ToString(), + CreateUser = LoginUserInfo.Get().userId, + CreateTime = DateTime.Now, F_EnabledMark = "0" }; - jobPerformanceEntityList.Add(jobPerformanceEntity); //删除表中旧数据 及同年同月同名同姓之人 - db.Delete(x => x.EmpName == jobPerformanceEntity.EmpName && x.IssueMonth == jobPerformanceEntity.IssueMonth && x.IssueYear == jobPerformanceEntity.IssueYear); + db.Delete(x => x.EmpName == jobPerformanceEntity.EmpName && x.EmpNo == jobPerformanceEntity.EmpNo && x.IssueMonth == jobPerformanceEntity.IssueMonth && x.IssueYear == jobPerformanceEntity.IssueYear); snum++; } catch (Exception ex)