Commit 93691577 by 李承祥

Merge branch 'feature/second' into xindu2

保底绩效修改
parents c9cd04b3 b7bcc7c8
......@@ -1514,6 +1514,9 @@
用户科室
</summary>
</member>
<member name="P:Performance.DtoModels.UseTempRequest.IsArchive">
<summary> 是否归档 </summary>
</member>
<member name="P:Performance.DtoModels.WorkItemRequest.Item">
<summary>
工作量绩效项
......@@ -2100,6 +2103,9 @@
菜单状态 1 启用 2禁用
</summary>
</member>
<member name="P:Performance.DtoModels.SecondListResponse.IsArchive">
<summary> 是否归档 </summary>
</member>
<member name="P:Performance.DtoModels.SecondTempResponse.TempName">
<summary>
模板名称
......
......@@ -191,6 +191,8 @@ public AutoMapperConfigs()
.ForMember(dest => dest.FiledName, opt => opt.MapFrom(src => src.ItemName))
.ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.ItemValue));
CreateMap<ag_temp, SecondTempResponse>();
CreateMap<ag_secondallot, SecondListResponse>().ReverseMap();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
public static partial class UtilExtensions
{
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
{
return first.AndAlso<T>(second, Expression.AndAlso);
}
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
{
return first.AndAlso<T>(second, Expression.OrElse);
}
private static Expression<Func<T, bool>> AndAlso<T>(this Expression<Func<T, bool>> expr1, Expression<Func<T, bool>> expr2, Func<Expression, Expression, BinaryExpression> func)
{
var parameter = Expression.Parameter(typeof(T));
var leftVisitor = new ReplaceExpressionVisitor(expr1.Parameters[0], parameter);
var left = leftVisitor.Visit(expr1.Body);
var rightVisitor = new ReplaceExpressionVisitor(expr2.Parameters[0], parameter);
var right = rightVisitor.Visit(expr2.Body);
return Expression.Lambda<Func<T, bool>>(
func(left, right), parameter);
}
private class ReplaceExpressionVisitor : ExpressionVisitor
{
private readonly Expression _oldValue;
private readonly Expression _newValue;
public ReplaceExpressionVisitor(Expression oldValue, Expression newValue)
{
_oldValue = oldValue;
_newValue = newValue;
}
public override Expression Visit(Expression node)
{
if (node == _oldValue)
return _newValue;
return base.Visit(node);
}
}
}
\ No newline at end of file
......@@ -284,7 +284,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, List<res_
{
string minimumReference = dept.MinimumReference;
if (dept.MinimumReference == EnumHelper.GetDescription(MinimumType.自定义保底))
minimumReference = GetCustomMinimumName(dept.Department);
minimumReference = GetCustomMinimumName(dept.Department, unitType.ToString());
var minimum = baiscnormList.FirstOrDefault(t => t.PositionName == minimumReference);
if (minimum != null)
......@@ -450,7 +450,10 @@ public void ComputeCustomMinimum(PerExcel excel, List<PerSheet> perSheet, List<r
var workload = workdata == null ? null : workdata.FirstOrDefault(t => t.UnitType == unitType.ToString() && t.AccountingUnit == dept.Department);
//保底绩效
var minimum = baiscnormList.FirstOrDefault(t => t.PositionName == dept.MinimumReference);
var minimumReference = dept.MinimumReference;
if (dept.MinimumReference == EnumHelper.GetDescription(MinimumType.自定义保底))
minimumReference = GetCustomMinimumName(dept.Department, unitType.ToString());
var minimum = baiscnormList.FirstOrDefault(t => t.PositionName == minimumReference);
if (!string.IsNullOrEmpty(dept.MinimumReference) && minimum != null)
dept.MinimumFee = minimum.AvgValue * (dept.MinimumFactor ?? 0) * (dept.ManagerNumber + dept.Number);
......@@ -468,7 +471,7 @@ public void ComputeCustomMinimum(PerExcel excel, List<PerSheet> perSheet, List<r
var baiscnorm = new res_baiscnorm
{
AllotID = allotId,
PositionName = GetCustomMinimumName(guaranteeGroup.Target),
PositionName = GetCustomMinimumName(guaranteeGroup.Target, unitType.ToString()),
TotelNumber = count,
TotelValue = totalValue,
AvgValue = count == 0 ? 0 : totalValue / count
......@@ -482,9 +485,9 @@ public void ComputeCustomMinimum(PerExcel excel, List<PerSheet> perSheet, List<r
/// </summary>
/// <param name="department"></param>
/// <returns></returns>
private string GetCustomMinimumName(string department)
private string GetCustomMinimumName(string department, string unitType)
{
return $"{EnumHelper.GetDescription(MinimumType.自定义保底)}({department})";
return $"{EnumHelper.GetDescription(MinimumType.自定义保底)}({unitType}-{department})";
}
/// <summary>
......
......@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace Performance.Services
......@@ -120,8 +121,8 @@ public List<SecondListResponse> GetSecondList(int userId)
else
secondList.AddRange(newSecond);
}
var list = Mapper.Map<List<SecondListResponse>>(secondList);
var list = Mapper.Map<List<SecondListResponse>>(secondList);
list?.ForEach(t => t.IsArchive = allotList.FirstOrDefault(a => a.ID == t.AllotId).States == 8 ? 1 : 0);
return list;
}
......@@ -166,6 +167,37 @@ public bool UseTemp(UseTempRequest request)
{
entity.UseTempId = request.TempId;
result = perforAgusetempRepository.Update(entity);
//删除多余的数据
if (result)
{
//获取固定模板列头
var tempItem = perforAgtempitemRepository.GetEntities(t => t.TempId == request.TempId);
var headItems = Mapper.Map<List<HeadItem>>(tempItem) ?? new List<HeadItem>();
//获取工作量列头
var workItem = perforAgworkloadRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.Department == request.Department && t.UnitType == request.UnitType);
if (workItem != null && workItem.Count > 0)
{
var workDtos = Mapper.Map<List<HeadItem>>(workItem);
workDtos.ForEach(t => { t.Type = 3; });
headItems.AddRange(workDtos);
}
List<ag_fixatitem> list = new List<ag_fixatitem>();
//获取数据
var fixatList = perforAgfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId);
foreach (var item in headItems)
{
list.AddRange(fixatList.Where(t => t.ItemName == item.FiledName && t.Type == item.Type));
}
if (list != null && list.Count > 0)
{
var delList = fixatList.Except(list);
perforAgfixatitemRepository.RemoveRange(delList.ToArray());
}
}
}
return result;
}
......@@ -399,7 +431,7 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
SourceType = t.SourceType,
Type = t.Type,
FactorValue = t.FactorValue
}).ToList();
}).Where(t => t.FiledId != "无FiledId").ToList();
}
}
......
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