Commit b875151f by 李承祥

增加获取人员列表,修改人员信息调整,表cog_again相关修改对应allotid,

parent 70967a56
...@@ -107,8 +107,8 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -107,8 +107,8 @@ public ApiResponse Import([FromForm] IFormCollection form)
if (!againAllotService.Update(allot, againid)) if (!againAllotService.Update(allot, againid))
return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传成功,修改状态失败"); return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传成功,修改状态失败");
configService.ClearAgain(againid); configService.ClearAgain(allot.ID);
configService.CopyAgain(againid); configService.CopyAgain(allot.ID);
} }
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
......
...@@ -255,7 +255,7 @@ public ApiResponse WorkyearDelete([CustomizeValidator(RuleSet = "Delete"), FromB ...@@ -255,7 +255,7 @@ public ApiResponse WorkyearDelete([CustomizeValidator(RuleSet = "Delete"), FromB
[HttpPost] [HttpPost]
public ApiResponse GetAgainList([CustomizeValidator(RuleSet = "Select"), FromBody]CofAgainRequest request) public ApiResponse GetAgainList([CustomizeValidator(RuleSet = "Select"), FromBody]CofAgainRequest request)
{ {
var list = _configService.GetAgainList(request.AgainAllotID); var list = _configService.GetAgainList(request.AllotID);
return new ApiResponse(ResponseType.OK, "ok", list); return new ApiResponse(ResponseType.OK, "ok", list);
} }
......
...@@ -21,6 +21,19 @@ public EmployeeController(EmployeeService employeeService) ...@@ -21,6 +21,19 @@ public EmployeeController(EmployeeService employeeService)
} }
/// <summary> /// <summary>
/// 获取人员列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("getlist")]
[HttpPost]
public ApiResponse GetEmployeeList([CustomizeValidator(RuleSet = "Select"), FromBody]EmployeeRequest request)
{
var employee = employeeService.GetEmployeeList(request.AllotID.Value);
return new ApiResponse(ResponseType.OK, "ok", employee);
}
/// <summary>
/// 新增人员 /// 新增人员
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
......
...@@ -13,11 +13,6 @@ public class CofAgainRequest: ApiRequest ...@@ -13,11 +13,6 @@ public class CofAgainRequest: ApiRequest
public int AllotID { get; set; } public int AllotID { get; set; }
/// <summary> /// <summary>
///
/// </summary>
public int AgainAllotID { get; set; }
/// <summary>
/// 1 职称绩效 2 工作量绩效 3 满勤天数 /// 1 职称绩效 2 工作量绩效 3 满勤天数
/// </summary> /// </summary>
public int Type { get; set; } public int Type { get; set; }
...@@ -38,7 +33,7 @@ public CofAgainRequestValidator() ...@@ -38,7 +33,7 @@ public CofAgainRequestValidator()
{ {
RuleSet("Select", () => RuleSet("Select", () =>
{ {
RuleFor(x => x.AgainAllotID).NotNull().NotEmpty().GreaterThan(0); RuleFor(x => x.AllotID).NotNull().NotEmpty().GreaterThan(0);
}); });
RuleSet("Update", () => RuleSet("Update", () =>
......
...@@ -113,6 +113,10 @@ public EmployeeRequestValidator() ...@@ -113,6 +113,10 @@ public EmployeeRequestValidator()
RuleFor(x => x.AccountingUnit).NotNull().NotEmpty(); RuleFor(x => x.AccountingUnit).NotNull().NotEmpty();
RuleFor(x => x.DoctorName).NotNull().NotEmpty(); RuleFor(x => x.DoctorName).NotNull().NotEmpty();
}; };
RuleSet("Select", () =>
{
RuleFor(x => x.AllotID).NotNull().GreaterThan(0);
});
RuleSet("Insert", () => RuleSet("Insert", () =>
{ {
......
...@@ -27,11 +27,6 @@ public class cof_again ...@@ -27,11 +27,6 @@ public class cof_again
public Nullable<int> AllotID { get; set; } public Nullable<int> AllotID { get; set; }
/// <summary> /// <summary>
///
/// </summary>
public Nullable<int> AgainAllotID { get; set; }
/// <summary>
/// 1 职称绩效 2 工作量绩效 3 满勤天数 /// 1 职称绩效 2 工作量绩效 3 满勤天数
/// </summary> /// </summary>
public Nullable<int> Type { get; set; } public Nullable<int> Type { get; set; }
......
...@@ -74,12 +74,12 @@ public bool Generate(AgainAllotRequest request, UserIdentity user) ...@@ -74,12 +74,12 @@ public bool Generate(AgainAllotRequest request, UserIdentity user)
perforPeragainallotRepository.Update(againAllot, p => { p.States = 2; }); perforPeragainallotRepository.Update(againAllot, p => { p.States = 2; });
//清理二次绩效无用数据 //清理二次绩效无用数据
configService.ClearAgain(againAllot.ID); configService.ClearAgain(againAllot.AllotID.Value);
try try
{ {
#region 基础信息 #region 基础信息
//获取基础配置信息 //获取基础配置信息
var config = perforCofagainRepository.GetEntities(t => t.AgainAllotID == againAllot.ID); var config = perforCofagainRepository.GetEntities(t => t.AllotID == againAllot.AllotID);
var jobfactor = config.FirstOrDefault(t => t.Type == 1)?.Value; var jobfactor = config.FirstOrDefault(t => t.Type == 1)?.Value;
var workfactor = config.FirstOrDefault(t => t.Type == 2)?.Value; var workfactor = config.FirstOrDefault(t => t.Type == 2)?.Value;
var days = config.FirstOrDefault(t => t.Type == 3)?.Value; var days = config.FirstOrDefault(t => t.Type == 3)?.Value;
......
...@@ -345,9 +345,9 @@ public void Copy(per_allot allot) ...@@ -345,9 +345,9 @@ public void Copy(per_allot allot)
/// 获取cof_drugprop列表 /// 获取cof_drugprop列表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<cof_again> GetAgainList(int againId) public List<cof_again> GetAgainList(int allotId)
{ {
var list = _againRepository.GetEntities(t => t.AgainAllotID == againId); var list = _againRepository.GetEntities(t => t.AllotID == allotId);
return list; return list;
} }
...@@ -358,10 +358,10 @@ public List<cof_again> GetAgainList(int againId) ...@@ -358,10 +358,10 @@ public List<cof_again> GetAgainList(int againId)
/// <returns></returns> /// <returns></returns>
public cof_again AgainInsert(CofAgainRequest request) public cof_again AgainInsert(CofAgainRequest request)
{ {
var workyear = Mapper.Map<cof_again>(request); var again = Mapper.Map<cof_again>(request);
if (!_againRepository.Add(workyear)) if (!_againRepository.Add(again))
throw new PerformanceException("保存失败"); throw new PerformanceException("保存失败");
return workyear; return again;
} }
/// <summary> /// <summary>
...@@ -414,12 +414,9 @@ public void ClearAgain(int againId) ...@@ -414,12 +414,9 @@ public void ClearAgain(int againId)
/// 复制报表基础配置 /// 复制报表基础配置
/// </summary> /// </summary>
/// <param name="iD"></param> /// <param name="iD"></param>
public void CopyAgain(int againid) public void CopyAgain(int allotId)
{ {
var again = perforPeragainallotRepository.GetEntity(t => t.ID == againid); var allot = perforPerAllotRepository.GetEntity(t => t.ID == allotId);
if (again == null)
throw new PerformanceException("二次绩效不存在");
var allot = perforPerAllotRepository.GetEntity(t => t.ID == again.AllotID);
if (allot == null) if (allot == null)
throw new PerformanceException("绩效不存在"); throw new PerformanceException("绩效不存在");
...@@ -432,22 +429,13 @@ public void CopyAgain(int againid) ...@@ -432,22 +429,13 @@ public void CopyAgain(int againid)
} }
List<cof_again> record = new List<cof_again>(); List<cof_again> record = new List<cof_again>();
//根据上月绩效获取二次绩效信息 //根据上月绩效获取二次绩效信息
var beforeAgain = perforPeragainallotRepository.GetEntity(t => t.AllotID == allot.ID); var data = _againRepository.GetEntities(t => t.AllotID == allotId);
if (again.AllotID != allot.ID && beforeAgain != null) if (data == null || data.Count == 0)
record = _againRepository.GetEntities(t => t.AgainAllotID == beforeAgain.ID);
if (record == null || record.Count == 0)
record = _againRepository.GetEntities(t => t.AgainAllotID == -1);
var againList = record.Select(t => new cof_again
{ {
AllotID = allot.ID, var again = _againRepository.GetEntities(t => t.AllotID == allot.ID) ?? _againRepository.GetEntities(t => t.AllotID == -1);
AgainAllotID = againid, var newAgains = again.Select(t => new cof_again { AllotID = allot.ID, Type = t.Type, TypeName = t.TypeName, Value = t.Value });
Type = t.Type, _againRepository.AddRange(newAgains.ToArray());
TypeName = t.TypeName, }
Value = t.Value
});
_againRepository.AddRange(againList.ToArray());
} }
#endregion #endregion
} }
......
...@@ -22,6 +22,30 @@ public EmployeeService(PerforImemployeeRepository perforImemployeeRepository) ...@@ -22,6 +22,30 @@ public EmployeeService(PerforImemployeeRepository perforImemployeeRepository)
} }
/// <summary> /// <summary>
///获取人员信息
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public im_employee GetEmployee(EmployeeRequest request)
{
var employee = perforImemployeeRepository.GetEntity(t => t.ID == request.ID);
if (employee == null)
throw new PerformanceException("该人员不存在");
return employee;
}
/// <summary>
///获取人员列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public List<im_employee> GetEmployeeList(int allotId)
{
var employee = perforImemployeeRepository.GetEntities(t => t.AllotID == allotId);
return employee;
}
/// <summary>
/// 新增人员 /// 新增人员
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
...@@ -34,7 +58,7 @@ public im_employee Insert(EmployeeRequest request) ...@@ -34,7 +58,7 @@ public im_employee Insert(EmployeeRequest request)
} }
/// <summary> /// <summary>
/// 修改人员 /// 修改人员信息
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
...@@ -44,10 +68,23 @@ public im_employee Update(EmployeeRequest request) ...@@ -44,10 +68,23 @@ public im_employee Update(EmployeeRequest request)
if (employee == null) if (employee == null)
throw new PerformanceException("该人员不存在"); throw new PerformanceException("该人员不存在");
employee.AccountingUnit = request.AccountingUnit; employee.AccountingUnit = request.AccountingUnit;
employee.Department = request.Department ?? employee.Department;
employee.FitPeople = request.FitPeople ?? employee.FitPeople;
employee.DoctorName = request.DoctorName; employee.DoctorName = request.DoctorName;
employee.JobTitle = request.JobTitle ?? employee.JobTitle;
employee.AccountType = request.AccountType;
employee.Department = request.Department;
employee.FitPeople = request.FitPeople;
employee.JobTitle = request.JobTitle;
employee.PostCoefficient = request.PostCoefficient;
employee.WorkTime = request.WorkTime;
employee.ScoreAverageRate = request.ScoreAverageRate;
employee.Attendance = request.Attendance;
employee.PeopleNumber = request.PeopleNumber;
employee.Workload = request.Workload;
employee.OtherPerfor = request.OtherPerfor;
employee.Punishment = request.Punishment;
employee.Adjust = request.Adjust;
employee.Grant = request.Grant;
//修改人员信息
perforImemployeeRepository.Update(employee); perforImemployeeRepository.Update(employee);
return employee; return employee;
} }
...@@ -59,7 +96,10 @@ public im_employee Update(EmployeeRequest request) ...@@ -59,7 +96,10 @@ public im_employee Update(EmployeeRequest request)
/// <returns></returns> /// <returns></returns>
public bool Delete(EmployeeRequest request) public bool Delete(EmployeeRequest request)
{ {
var employee = Mapper.Map<im_employee>(request); var employee = perforImemployeeRepository.GetEntity(t => t.ID == request.ID);
if (null == employee)
throw new PerformanceException($"ID不存在 :{request.ID}");
return perforImemployeeRepository.Remove(employee); return perforImemployeeRepository.Remove(employee);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment