Commit ce2a169e by lcx

Merge branch 'develop' of http://192.168.18.110:8880/zry/performance into develop

parents a3499331 633de37d
......@@ -59,9 +59,7 @@ public ApiResponse GetPersons([FromRoute] int allotId, [FromBody] PersonParamsRe
public ApiResponse CreatePerson([FromBody] PerEmployeeResponse request)
{
request.CreateUser = claimService.GetUserId();
var employeee = personService.CreatePerson(request);
return employeee.Id > 0 ? new ApiResponse(ResponseType.OK, "添加成功!", employeee)
: new ApiResponse(ResponseType.Fail, "添加失败!");
return personService.CreatePerson(request);
}
/// <summary>
......@@ -73,9 +71,7 @@ public ApiResponse CreatePerson([FromBody] PerEmployeeResponse request)
[HttpPost]
public ApiResponse UpdatePerson([FromBody] PerEmployeeResponse request)
{
var result = personService.UpdatePerson(request);
return result ? new ApiResponse(ResponseType.OK, "修改成功!")
: new ApiResponse(ResponseType.OK, "修改失败!");
return personService.UpdatePerson(request);
}
/// <summary>
......
......@@ -4,25 +4,26 @@ public class view_allot_sign_dept
{
public int HospitalId { get; set; }
public int AllotID { get; set; }
public int Year { get; set; }
public int Month { get; set; }
public int UnitType { get; set; }
public int AccountingUnit { get; set; }
public int PerforFee { get; set; }
public int WorkloadFee { get; set; }
public int AssessBeforeOtherFee { get; set; }
public int PerforTotal { get; set; }
public int ScoringAverage { get; set; }
public int Extra { get; set; }
public int MedicineExtra { get; set; }
public int MaterialsExtra { get; set; }
public int AssessLaterOtherFee { get; set; }
public int AssessLaterPerforTotal { get; set; }
public int AdjustFactor { get; set; }
public int AdjustLaterOtherFee { get; set; }
public int AprPerforAmount { get; set; }
public int HideAprOtherPerforAmount { get; set; }
public int AssessLaterManagementFee { get; set; }
public int RealGiveFee { get; set; }
public string Year { get; set; }
public string Month { get; set; }
public string Code { get; set; }
public string UnitType { get; set; }
public string AccountingUnit { get; set; }
public decimal PerforFee { get; set; }
public decimal WorkloadFee { get; set; }
public decimal AssessBeforeOtherFee { get; set; }
public decimal PerforTotal { get; set; }
public decimal ScoringAverage { get; set; }
public decimal Extra { get; set; }
public decimal MedicineExtra { get; set; }
public decimal MaterialsExtra { get; set; }
public decimal AssessLaterOtherFee { get; set; }
public decimal AssessLaterPerforTotal { get; set; }
public decimal AdjustFactor { get; set; }
public decimal AdjustLaterOtherFee { get; set; }
public decimal AprPerforAmount { get; set; }
public decimal HideAprOtherPerforAmount { get; set; }
public decimal AssessLaterManagementFee { get; set; }
public decimal RealGiveFee { get; set; }
}
}
namespace Performance.DtoModels
{
public class view_allot_sign_emp
public class view_allot_sign_emp_finance
{
public int HospitalID { get; set; }
public int Year { get; set; }
public int Month { get; set; }
public int Source { get; set; }
public int AllotId { get; set; }
public int SecondId { get; set; }
public int States { get; set; }
public string UnitType { get; set; }
public string Code { get; set; }
public string AccountingUnit { get; set; }
public string IsShowManage { get; set; }
public string EmployeeName { get; set; }
public string HospitalID { get; set; }
public string Year { get; set; }
public string Month { get; set; }
public string AllotId { get; set; }
public string JobNumber { get; set; }
public string EmployeeName { get; set; }
public string JobTitle { get; set; }
public string Emp_UnitType { get; set; }
public string Emp_AccountingUnit { get; set; }
public string Code { get; set; }
public string UnitType { get; set; }
public string AccountingUnit { get; set; }
public string BankCard { get; set; }
public string Batch { get; set; }
public string JobCategory { get; set; }
public string Duty { get; set; }
public string TitlePosition { get; set; }
public string PerforSumFee { get; set; }
public decimal PerforSumFee { get; set; }
public decimal PerforManagementFee { get; set; }
public decimal NightWorkPerfor { get; set; }
public decimal AdjustLaterOtherFee { get; set; }
......@@ -33,4 +26,15 @@ public class view_allot_sign_emp
public decimal ReservedRatioFee { get; set; }
public decimal RealGiveFee { get; set; }
}
public class view_allot_sign_emp : view_allot_sign_emp_finance
{
public int Source { get; set; }
public int SecondId { get; set; }
public int States { get; set; }
public string IsShowManage { get; set; }
public string Emp_UnitType { get; set; }
public string Emp_AccountingUnit { get; set; }
public string Batch { get; set; }
}
}
......@@ -418,7 +418,8 @@ public List<dynamic> QueryComputeByDate(string viewName, BeginEndTime request)
if (!string.IsNullOrEmpty(request.SortBy))
sql += $" order by {request.SortBy} ";
else
sql += $" order by hospitalid,code,unittype,accountingunit";
return DapperQuery<dynamic>(sql, new { beginTime = request.BeginTime, endTime = request.EndTime }).ToList();
}
......@@ -432,16 +433,16 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu
Dictionary<string, List<string>> dict = new Dictionary<string, List<string>>
{
{ "view_allot_sign_emp_group", new List<string>{ /* "year", "month", "allotid", "secondid",*/ "hospitalid", "source", "states", "unittype", "code", "accountingunit", "isshowmanage", "employeename", "jobnumber", "jobtitle", "emp_unittype", "emp_accountingunit", "bankcard", "batch", "jobcategory", "duty", "titleposition" } },
{ "view_allot_sign_emp_group", new List<string>{ "hospitalid", "code", "unittype", "accountingunit", "source", "jobnumber", "employeename", "jobtitle", "bankcard", "batch", "jobcategory", "duty", "titleposition" } },
{ "view_allot_sign_emp_sum", new List<string>{ "perforsumfee", "performanagementfee", "nightworkperfor", "adjustlaterotherfee", "otherperfor", "hideotherperfor", "shouldgivefee", "reservedratiofee", "realgivefee" } },
{ "view_allot_sign_dept_group", new List<string>{ "hospitalid",/* "allotid", "year", "month", */"unittype", "code", "accountingunit" } },
{ "view_allot_sign_dept_group", new List<string>{ "hospitalid", "code", "unittype", "accountingunit" } },
{ "view_allot_sign_dept_sum", new List<string>{ "perforfee", "workloadfee", "assessbeforeotherfee", "perfortotal", "scoringaverage", "extra", "medicineextra", "materialsextra", "assesslaterotherfee", "assesslaterperfortotal", "adjustfactor", "adjustlaterotherfee", "aprperforamount", "hideaprotherperforamount", "assesslatermanagementfee", "realgivefee" } },
{ "view_allot_sign_emp_finance_group", new List<string>{ "hospitalid",/* "year", "month", "allotid",*/ "jobnumber", "employeename", "jobtitle", "unittype", "code", "accountingunit", "bankcard", "jobcategory", "duty", "titleposition" } },
{ "view_allot_sign_emp_finance_group", new List<string>{ "hospitalid", "code", "unittype", "accountingunit","jobnumber", "employeename", } },
{ "view_allot_sign_emp_finance_sum", new List<string>{ "perforsumfee", "performanagementfee", "nightworkperfor", "adjustlaterotherfee", "otherperfor", "hideotherperfor", "shouldgivefee", "reservedratiofee", "realgivefee" } },
};
request.GroupBy.Remove("");
if (request.SumBy == null || !request.SumBy.Any(t => !string.IsNullOrEmpty(t))) request.SumBy = dict[viewName + "_sum"];
......@@ -453,22 +454,11 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu
if (!string.IsNullOrEmpty(request.SortBy))
sql += $" order by {request.SortBy} ";
else
sql += $" order by hospitalid,code,unittype,accountingunit";
if (request.GroupBy == null || !request.GroupBy.Any(t => !string.IsNullOrEmpty(t))) /*request.GroupBy = dict[viewName + "_group"];*/
{
switch (viewName)
{
case "view_allot_sign_emp":
request.GroupBy.AddRange(new[] { "Source", "UnitType", "AccountingUnit", "JobNumber", "EmployeeName", "JobCategory" });
break;
case "view_allot_sign_dept":
request.GroupBy.AddRange(new[] { "UnitType", "AccountingUnit" });
break;
case "view_allot_sign_emp_finance":
request.GroupBy.AddRange(new[] { "UnitType", "AccountingUnit", "JobNumber", "EmployeeName" });
break;
}
sql = $"select {string.Join(",", dict[viewName + "_group"])}, {string.Join(",", request.SumBy.Select(t => $"sum({t}) {t}"))} from ({sql}) tab group by {string.Join(",", request.GroupBy)}";
sql = $"select {string.Join(",", dict[viewName + "_group"])}, {string.Join(",", request.SumBy.Select(t => $"sum({t}) {t}"))} from ({sql}) tab group by {string.Join(",", dict[viewName + "_group"])}";
}
else
{
......
......@@ -799,6 +799,7 @@ public cof_accounting AccountingInsert(cof_accounting request)
var entity = new cof_accounting
{
AllotId = request.AllotId,
Code = request.Code,
UnitType = request.UnitType,
AccountingUnit = request.AccountingUnit
};
......@@ -819,6 +820,7 @@ public cof_accounting AccountingUpdate(cof_accounting request)
throw new PerformanceException($"ID不存在 :{request.Id}");
entity.AllotId = request.AllotId;
entity.Code = request.Code;
entity.UnitType = request.UnitType;
entity.AccountingUnit = request.AccountingUnit;
......
......@@ -231,10 +231,38 @@ public PageList<per_employee> GetPersons(int allotId, int userId, PersonParamsRe
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public per_employee CreatePerson(PerEmployeeResponse request)
public ApiResponse CreatePerson(PerEmployeeResponse request)
{
var employee = peremployeeRepository.GetEntity(t => t.AllotId == request.AllotId && t.PersonnelNumber == request.PersonnelNumber
&& t.DoctorName == request.DoctorName && t.Department == request.Department);
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
var oldEmployees = peremployeeRepository.GetEntities(t => t.AllotId == request.AllotId);
for (int i = 0; i < oldEmployees.Count; i++)
{
if (oldEmployees.Count(w => w.PersonnelNumber == oldEmployees[i].PersonnelNumber) > 1)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", oldEmployees[i].PersonnelNumber??"" },
{ "姓名", oldEmployees[i].DoctorName??"" },
{ "错误原因", "“人员工号”重复" },
});
}
}
if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
if (string.IsNullOrEmpty(request.UnitType?.Trim())
|| string.IsNullOrEmpty(request.Department?.Trim())
|| string.IsNullOrEmpty(request.AccountingUnit?.Trim())
|| string.IsNullOrEmpty(request.DoctorName?.Trim())
|| string.IsNullOrEmpty(request.PersonnelNumber?.Trim()))
{
throw new PerformanceException($"“关键信息缺失”请补全!");
}
var employee = peremployeeRepository.GetEntity(t => t.AllotId == request.AllotId && t.PersonnelNumber == request.PersonnelNumber);
if (employee != null)
throw new PerformanceException($"员工工号为{request.PersonnelNumber}的数据已存在!");
......@@ -253,7 +281,8 @@ public per_employee CreatePerson(PerEmployeeResponse request)
//CheckAccountingDept(request.HospitalId.Value, request.AccountingUnit, request.Department);
peremployeeRepository.Add(entity);
return entity;
return new ApiResponse(ResponseType.OK, "添加成功", entity);
}
/// <summary>
......@@ -261,12 +290,44 @@ public per_employee CreatePerson(PerEmployeeResponse request)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool UpdatePerson(PerEmployeeResponse request)
public ApiResponse UpdatePerson(PerEmployeeResponse request)
{
var employee = peremployeeRepository.GetEntity(t => t.AllotId == request.AllotId && t.PersonnelNumber == request.PersonnelNumber
&& t.DoctorName == request.DoctorName && t.Department == request.Department);
if (employee != null && employee.Id != request.Id)
throw new PerformanceException($"员工工号为{request.PersonnelNumber}的数据已存在!");
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
var oldEmployees = peremployeeRepository.GetEntities(t => t.AllotId == request.AllotId);
for (int i = 0; i < oldEmployees.Count; i++)
{
if (oldEmployees.Count(w => w.PersonnelNumber == oldEmployees[i].PersonnelNumber) > 1)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", oldEmployees[i].PersonnelNumber??"" },
{ "姓名", oldEmployees[i].DoctorName??"" },
{ "错误原因", "“人员工号”重复" },
});
}
}
if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
if (string.IsNullOrEmpty(request.UnitType?.Trim())
|| string.IsNullOrEmpty(request.Department?.Trim())
|| string.IsNullOrEmpty(request.AccountingUnit?.Trim())
|| string.IsNullOrEmpty(request.DoctorName?.Trim())
|| string.IsNullOrEmpty(request.PersonnelNumber?.Trim()))
{
throw new PerformanceException($"“关键信息缺失”请补全!");
}
var employees = peremployeeRepository.GetEntities(t => t.AllotId == request.AllotId && t.PersonnelNumber == request.PersonnelNumber);
if (employees == null)
throw new PerformanceException($"员工工号为“{request.PersonnelNumber}”不存在,请重新添加!");
if (employees.Count() > 1)
throw new PerformanceException($"工号为“{request.PersonnelNumber}”存在多条数据,请删除多余数据!");
var unittype = EnumHelper.GetItems<UnitType>().Select(t => t.Description).ToList();
unittype.AddRange(EnumHelper.GetItems<AccountUnitType>().Select(t => t.Description));
......@@ -274,9 +335,7 @@ public bool UpdatePerson(PerEmployeeResponse request)
if (!unittype.Contains(request.UnitType))
throw new PerformanceException($"人员类别不符合规范!");
if (employee == null)
employee = peremployeeRepository.GetEntity(t => t.Id == request.Id) ?? throw new PerformanceException("人员信息无效!");
var employee = employees.First();
//_mapper.Map(request, employee, typeof(per_employee), typeof(per_employee));
employee.AccountingUnit = request.AccountingUnit;
......@@ -304,7 +363,9 @@ public bool UpdatePerson(PerEmployeeResponse request)
employee.Attendance = Math.Round((request.AttendanceDay ?? 0) / day, 4);
//CheckAccountingDept(request.HospitalId.Value, request.AccountingUnit, request.Department);
return peremployeeRepository.Update(employee);
var res = peremployeeRepository.Update(employee);
return new ApiResponse(ResponseType.OK, "修改成功");
}
/// <summary>
......
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