/// <summary> /// 更新社保信息 /// </summary> /// <returns></returns> public async Task <HumanSocialSecurity> UpdateHumanSocialSecurityAsync(UserInfo user, HumanSocialSecurity humanSocialSecurity, CancellationToken cancellationToken = default(CancellationToken)) { if (humanSocialSecurity == null) { throw new ArgumentNullException(nameof(humanSocialSecurity)); } var old = Context.HumanSocialSecurities.Where(a => a.Id == humanSocialSecurity.Id).SingleOrDefault(); if (old == null) { throw new Exception("更新的对象不存在"); } old.EmploymentInjuryInsurance = humanSocialSecurity.EmploymentInjuryInsurance; old.EndowmentInsurance = humanSocialSecurity.EndowmentInsurance; old.HousingProvidentFund = humanSocialSecurity.HousingProvidentFund; old.HousingProvidentFundAccount = humanSocialSecurity.HousingProvidentFundAccount; old.InsuredTime = humanSocialSecurity.InsuredTime; old.InsuredAddress = humanSocialSecurity.InsuredAddress; old.IsGiveUp = humanSocialSecurity.IsGiveUp; old.IsHave = humanSocialSecurity.IsHave; old.IsSignCommitment = humanSocialSecurity.IsSignCommitment; old.MaternityInsurance = humanSocialSecurity.MaternityInsurance; old.MedicalInsurance = humanSocialSecurity.MedicalInsurance; old.MedicalInsuranceAccount = humanSocialSecurity.MedicalInsuranceAccount; old.SocialSecurityAccount = humanSocialSecurity.SocialSecurityAccount; old.UnemploymentInsurance = humanSocialSecurity.UnemploymentInsurance; Context.Update(old); try { await Context.SaveChangesAsync(cancellationToken); } catch (DbUpdateException) { throw; } return(humanSocialSecurity); }
/// <summary> /// 更新审核状态 /// </summary> /// <param name="id"></param> /// <param name="status"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task UpdateExamineStatus(string id, ExamineStatusEnum status, CancellationToken cancellationToken = default(CancellationToken)) { var model = await Store.GetAsync(a => a.Where(b => b.Id == id)); if (model == null) { throw new Exception("未找到更新对象"); } UserInfo userInfo = new UserInfo { Id = model.CreateUser }; var human = await _humanInfoStore.GetAsync(a => a.Where(b => b.Id == model.HumanId)); if (human == null) { throw new Exception("未找到操作的人事信息"); } human.Position = model.Position; human.DepartmentId = model.DepartmentId; human.UpdateTime = DateTime.Now; human.UpdateUser = model.CreateUser; HumanSocialSecurity humanSocialSecurity = new HumanSocialSecurity { EmploymentInjuryInsurance = model.EmploymentInjuryInsurance, HousingProvidentFundAccount = model.HousingProvidentFundAccount, InsuredAddress = model.InsuredAddress, MedicalInsuranceAccount = model.MedicalInsuranceAccount, SocialSecurityAccount = model.SocialSecurityAccount, EndowmentInsurance = model.EndowmentInsurance, HousingProvidentFund = model.HousingProvidentFund, Id = model.HumanId, InsuredTime = model.InsuredTime, IsGiveUp = model.IsGiveUp, IsHave = model.IsHave, IsSignCommitment = model.IsSignCommitment, MaternityInsurance = model.MaternityInsurance, MedicalInsurance = model.MedicalInsurance, UnemploymentInsurance = model.UnemploymentInsurance }; HumanSalaryStructure humanSalaryStructure = new HumanSalaryStructure { BaseWages = model.BaseWages, CommunicationAllowance = model.CommunicationAllowance, OtherAllowance = model.OtherAllowance, TrafficAllowance = model.TrafficAllowance, GrossPay = model.GrossPay, Id = model.HumanId, PostWages = model.PostWages, ProbationaryPay = model.ProbationaryPay }; HumanInfoChange humanInfoChange = new HumanInfoChange { ChangeContent = "", ChangeId = model.Id, ChangeReason = "", ChangeTime = DateTime.Now, ChangeType = HumanChangeType.Adjustment, CreateTime = DateTime.Now, CreateUser = model.CreateUser, Id = Guid.NewGuid().ToString(), IsDeleted = false, HumanId = model.HumanId, UserId = model.CreateUser }; await _humanInfoStore.UpdateAsync(userInfo, human); await _humanInfoStore.UpdateHumanSalaryStructureAsync(userInfo, humanSalaryStructure); await _humanInfoStore.UpdateHumanSocialSecurityAsync(userInfo, humanSocialSecurity); await _humanInfoChangeStore.CreateAsync(userInfo, humanInfoChange); await Store.UpdateExamineStatus(id, status, cancellationToken); }