|
@@ -134,6 +134,11 @@ namespace wispro.sp.api.Controllers
|
|
|
{
|
|
|
_calItemJX(item,Context);
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var oldJxList = Context.StaffStatistics.Where(p => p.ItemId == item.Id);
|
|
|
+ Context.StaffStatistics.RemoveRange(oldJxList);
|
|
|
+ }
|
|
|
|
|
|
Context.SaveChanges();
|
|
|
}
|
|
@@ -313,6 +318,11 @@ namespace wispro.sp.api.Controllers
|
|
|
{
|
|
|
_calItemJX(item,Context);
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var oldJxList = Context.StaffStatistics.Where(p => p.ItemId == item.Id);
|
|
|
+ Context.StaffStatistics.RemoveRange(oldJxList);
|
|
|
+ }
|
|
|
|
|
|
Context.SaveChanges();
|
|
|
}
|
|
@@ -468,11 +478,11 @@ namespace wispro.sp.api.Controllers
|
|
|
|
|
|
string jxType = isReivewer ? "新申请审核" : "新申请处理";
|
|
|
|
|
|
- var results = spDb.StaffStatistics.Where(s => s.CalMonthId == calMonth.Id && s.jxType == jxType && s.StaffId == userId);
|
|
|
+ var results = spDb.StaffStatistics.Include(p => p.Item).Where(s => s.CalMonthId == calMonth.Id && s.jxType == jxType && s.StaffId == userId);
|
|
|
|
|
|
if (!isReivewer)
|
|
|
{
|
|
|
- results = spDb.StaffStatistics.Where(s => s.CalMonthId == calMonth.Id && (s.jxType == jxType || s.jxType == "专案处理") && s.StaffId == userId);
|
|
|
+ results = spDb.StaffStatistics.Include(p=>p.Item).Where(s => s.CalMonthId == calMonth.Id && (s.jxType == jxType || s.jxType == "专案处理") && s.StaffId == userId);
|
|
|
}
|
|
|
|
|
|
#region 循环计算
|
|
@@ -482,104 +492,107 @@ namespace wispro.sp.api.Controllers
|
|
|
|
|
|
foreach (var item in retList)
|
|
|
{
|
|
|
- string strCaseCeoffcient = item.Item.CaseCoefficient;
|
|
|
-
|
|
|
- if (string.IsNullOrEmpty(strCaseCeoffcient))
|
|
|
+ if (item.Item != null)
|
|
|
{
|
|
|
- strCaseCeoffcient = "B";
|
|
|
- }
|
|
|
+ string strCaseCeoffcient = item.Item.CaseCoefficient;
|
|
|
|
|
|
- #region 严重延期降系数
|
|
|
- if (item.Item.isDanger() && string.IsNullOrEmpty(item.Item.OverDueMemo))
|
|
|
- {
|
|
|
- switch (item.Item.CaseCoefficient)
|
|
|
+ if (string.IsNullOrEmpty(strCaseCeoffcient))
|
|
|
+ {
|
|
|
+ strCaseCeoffcient = "B";
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 严重延期降系数
|
|
|
+ if (item.Item.isDanger() && string.IsNullOrEmpty(item.Item.OverDueMemo))
|
|
|
+ {
|
|
|
+ switch (item.Item.CaseCoefficient)
|
|
|
+ {
|
|
|
+ case "S":
|
|
|
+ strCaseCeoffcient = "A";
|
|
|
+ break;
|
|
|
+ case "A":
|
|
|
+ strCaseCeoffcient = "B";
|
|
|
+ break;
|
|
|
+ case "B":
|
|
|
+ strCaseCeoffcient = "C";
|
|
|
+ break;
|
|
|
+ case "C":
|
|
|
+ strCaseCeoffcient = "D";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ switch (strCaseCeoffcient)
|
|
|
{
|
|
|
case "S":
|
|
|
- strCaseCeoffcient = "A";
|
|
|
+ if (item.Item.Type == "专案")
|
|
|
+ {
|
|
|
+ retObj.S += item.totalBasePoint.Value;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ retObj.S += 1;
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
case "A":
|
|
|
- strCaseCeoffcient = "B";
|
|
|
+ if (item.Item.Type == "专案")
|
|
|
+ {
|
|
|
+ retObj.A += item.totalBasePoint.Value;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ retObj.A += 1;
|
|
|
+ }
|
|
|
break;
|
|
|
case "B":
|
|
|
- strCaseCeoffcient = "C";
|
|
|
+ if (item.Item.Type == "专案")
|
|
|
+ {
|
|
|
+ retObj.B += item.totalBasePoint.Value;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ retObj.B += 1;
|
|
|
+ }
|
|
|
break;
|
|
|
case "C":
|
|
|
- strCaseCeoffcient = "D";
|
|
|
+ if (item.Item.Type == "专案")
|
|
|
+ {
|
|
|
+ retObj.C += item.totalBasePoint.Value;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ retObj.C += 1;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "D":
|
|
|
+ if (item.Item.Type == "专案")
|
|
|
+ {
|
|
|
+ retObj.D += item.totalBasePoint.Value;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ retObj.D += 1;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if (item.Item.Type == "专案")
|
|
|
+ {
|
|
|
+ retObj.B += item.totalBasePoint.Value;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ retObj.B += 1;
|
|
|
+ }
|
|
|
break;
|
|
|
- }
|
|
|
- }
|
|
|
- #endregion
|
|
|
-
|
|
|
- switch (strCaseCeoffcient)
|
|
|
- {
|
|
|
- case "S":
|
|
|
- if (item.Item.Type == "专案")
|
|
|
- {
|
|
|
- retObj.S += item.totalBasePoint.Value;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- retObj.S += 1;
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case "A":
|
|
|
- if (item.Item.Type == "专案")
|
|
|
- {
|
|
|
- retObj.A += item.totalBasePoint.Value;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- retObj.A += 1;
|
|
|
- }
|
|
|
- break;
|
|
|
- case "B":
|
|
|
- if (item.Item.Type == "专案")
|
|
|
- {
|
|
|
- retObj.B += item.totalBasePoint.Value;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- retObj.B += 1;
|
|
|
- }
|
|
|
- break;
|
|
|
- case "C":
|
|
|
- if (item.Item.Type == "专案")
|
|
|
- {
|
|
|
- retObj.C += item.totalBasePoint.Value;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- retObj.C += 1;
|
|
|
- }
|
|
|
- break;
|
|
|
- case "D":
|
|
|
- if (item.Item.Type == "专案")
|
|
|
- {
|
|
|
- retObj.D += item.totalBasePoint.Value;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- retObj.D += 1;
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- if (item.Item.Type == "专案")
|
|
|
- {
|
|
|
- retObj.B += item.totalBasePoint.Value;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- retObj.B += 1;
|
|
|
- }
|
|
|
- break;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- if (CaseXiShu.ContainsKey(strCaseCeoffcient))
|
|
|
- {
|
|
|
- d += CaseXiShu[strCaseCeoffcient];
|
|
|
- iCount += 1;
|
|
|
+ if (CaseXiShu.ContainsKey(strCaseCeoffcient))
|
|
|
+ {
|
|
|
+ d += CaseXiShu[strCaseCeoffcient];
|
|
|
+ iCount += 1;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -602,9 +615,9 @@ namespace wispro.sp.api.Controllers
|
|
|
NanduStatics retObj = new NanduStatics();
|
|
|
|
|
|
IDictionary<string, double> CaseXiShu = new Dictionary<string, double>();
|
|
|
- var list = Context.CaseCeoffcients;
|
|
|
+ var list = spDb.CaseCeoffcients.ToList();
|
|
|
|
|
|
- foreach (var cx in list.ToList<CaseCeoffcient>())
|
|
|
+ foreach (var cx in list)
|
|
|
{
|
|
|
CaseXiShu.Add(cx.Ceoffcient, cx.Value);
|
|
|
}
|
|
@@ -860,23 +873,53 @@ namespace wispro.sp.api.Controllers
|
|
|
private void _RefreshBasePoint()
|
|
|
{
|
|
|
spDbContext spDb = new spDbContext();
|
|
|
- var lstItem = spDb.PerformanceItems.Include(p => p.Customer).Where(p => p.CalMonth.Status != 4).ToList();
|
|
|
- var rules = spDb.BasePointRules.ToList();
|
|
|
- foreach (var item in lstItem)
|
|
|
+
|
|
|
+ var calMonth = spDb.CalMonths.FirstOrDefault(c => c.Status == 0);
|
|
|
+ _RefreshBasePoint(calMonth,spDb);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void _RefreshBasePoint(CalMonth calMonth,spDbContext spDb )
|
|
|
+ {
|
|
|
+ if (calMonth != null)
|
|
|
{
|
|
|
- if (item.AgentFeedbackMemo != "特殊点数申诉")
|
|
|
+ var lstItem = spDb.PerformanceItems
|
|
|
+ .Include(p => p.Customer)
|
|
|
+ .Include(p => p.ItemStaffs)
|
|
|
+ .Include(p => p.Reviewer)
|
|
|
+ .Include(p => p.CalMonth)
|
|
|
+ .Where(p => p.CalMonthId == calMonth.Id).ToList();
|
|
|
+
|
|
|
+ var rules = spDb.BasePointRules.ToList();
|
|
|
+
|
|
|
+ foreach (var item in lstItem)
|
|
|
{
|
|
|
- Utility.Utility.CalBasePoint(item, rules);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Utility.Utility.CalBasePoint(item, rules);
|
|
|
+
|
|
|
+ if (item.BasePoint > 0)
|
|
|
+ {
|
|
|
+ _calItemJX(item, spDb);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var oldJxList = spDb.StaffStatistics.Where(p => p.ItemId == item.Id);
|
|
|
+ spDb.StaffStatistics.RemoveRange(oldJxList);
|
|
|
+ }
|
|
|
|
|
|
- if(item.BasePoint > 0)
|
|
|
+ spDb.SaveChanges();
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
- _calItemJX(item,spDb);
|
|
|
+ System.Diagnostics.Debug.WriteLine(ex.Message);
|
|
|
}
|
|
|
-
|
|
|
- spDb.SaveChanges();
|
|
|
}
|
|
|
+
|
|
|
+ _CalJXPoint(calMonth, spDb);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public ApiSaveResponse RefreshBasePoint()
|
|
|
{
|
|
|
System.Threading.Thread t = new Thread(_RefreshBasePoint);
|
|
@@ -887,6 +930,31 @@ namespace wispro.sp.api.Controllers
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ public void RefreshPoint(PerformanceItem item)
|
|
|
+ {
|
|
|
+ spDbContext spDb = new spDbContext();
|
|
|
+
|
|
|
+ var rules = spDb.BasePointRules.ToList();
|
|
|
+
|
|
|
+ if (item.AgentFeedbackMemo != "特殊点数申诉")
|
|
|
+ {
|
|
|
+ Utility.Utility.CalBasePoint(item, rules);
|
|
|
+
|
|
|
+ if (item.BasePoint > 0)
|
|
|
+ {
|
|
|
+ _calItemJX(item, spDb);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var oldJxList = Context.StaffStatistics.Where(p => p.ItemId == item.Id);
|
|
|
+ Context.StaffStatistics.RemoveRange(oldJxList);
|
|
|
+ }
|
|
|
+
|
|
|
+ spDb.SaveChanges();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
public ApiSaveResponse RefreshFromIPEasyById(int itemId)
|
|
|
{
|
|
|
var Item = Context.PerformanceItems.Include(p=>p.Customer).Include(p=>p.ItemStaffs).ThenInclude(p=>p.DoPerson).FirstOrDefault(p => p.Id == itemId);
|
|
@@ -901,6 +969,11 @@ namespace wispro.sp.api.Controllers
|
|
|
{
|
|
|
_calItemJX(Item,Context);
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var oldJxList = Context.StaffStatistics.Where(p => p.ItemId == Item.Id);
|
|
|
+ Context.StaffStatistics.RemoveRange(oldJxList);
|
|
|
+ }
|
|
|
Context.SaveChanges();
|
|
|
|
|
|
return new ApiSaveResponse()
|
|
@@ -1075,10 +1148,10 @@ namespace wispro.sp.api.Controllers
|
|
|
row["申请类型"] = p.ApplicationType;
|
|
|
row["实际处理人"] = strHandler;
|
|
|
|
|
|
- if(p.ApplicationName != null && p.ApplicationName.Contains("OPPO") && p.ApplicationType == "实用新型")
|
|
|
+ if(p.ApplicationName != null && p.ApplicationName.Contains("OPPO") && p.ApplicationType == "实用新型" && p.Type =="新申请")
|
|
|
{
|
|
|
row["申请类型"] = "发明";
|
|
|
- row["案件备注"] = $"{row["案件备注"]}\r\nOPPO案件实用新型修改为发明】";
|
|
|
+ row["案件备注"] = $"{row["案件备注"]}\r\n【OPPO案件实用新型修改为发明】";
|
|
|
}
|
|
|
row["处理事项"] = p.DoItem;
|
|
|
row["业务类型"] = p.BusinessType;
|
|
@@ -1125,13 +1198,23 @@ namespace wispro.sp.api.Controllers
|
|
|
row["前一次OA处理人"] = p.PreOastaff?.Name;
|
|
|
row["处理人"] = iStaff.Staff.Name;
|
|
|
row["基本点数"] = iStaff.totalBasePoint;
|
|
|
- row["处理人绩效系数"] = iStaff.Staff.StaffGrade.Grade;
|
|
|
+ row["处理人等级"] = iStaff.Staff.StaffGrade.Grade;
|
|
|
+ row["处理人绩效系数"] = iStaff.Staff.StaffGrade.Coefficient;
|
|
|
|
|
|
- if(reviewStatic != null)
|
|
|
+ if (reviewStatic != null)
|
|
|
{
|
|
|
row["核稿人"] = reviewStatic.Staff.Name;
|
|
|
+
|
|
|
+ var v = verifyCeoffients.FirstOrDefault(p => p.CheckerId == reviewStatic.Staff.StaffGradeId && p.DoPersonId == iStaff.Staff.StaffGradeId);
|
|
|
+ if (v != null)
|
|
|
+ {
|
|
|
+ row["核稿绩效"] = ((decimal)iStaff.totalBasePoint * (decimal)v.Coefficient);
|
|
|
+ row["核稿系数"] = v.Coefficient;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
row["客户名称"] = p.Customer?.Name;
|
|
|
row["申请人"] = p.ApplicationName;
|
|
|
row["处理事项完成日"] = p.FinishedDate?.ToString("yyyy-MM-dd");
|
|
@@ -1646,7 +1729,11 @@ namespace wispro.sp.api.Controllers
|
|
|
|
|
|
public List<StaffStatistics> CalItemJX(int itemid)
|
|
|
{
|
|
|
- var Item = Context.PerformanceItems.Include(p=>p.CalMonth).FirstOrDefault(p=>p.Id == itemid);
|
|
|
+ var Item = Context.PerformanceItems.Include(p=>p.CalMonth)
|
|
|
+ .Include(p=>p.ItemStaffs).ThenInclude(p=>p.DoPerson).ThenInclude(s=>s.StaffGrade)
|
|
|
+ .Include(p=>p.Reviewer)
|
|
|
+ .Include(p=>p.Customer)
|
|
|
+ .FirstOrDefault(p=>p.Id == itemid);
|
|
|
List<VerifyCoefficient> verifyCoefficients = Context.VerifyCoefficients.ToList<VerifyCoefficient>();
|
|
|
|
|
|
return _calItemJX(verifyCoefficients,Item,Context);
|
|
@@ -1677,6 +1764,22 @@ namespace wispro.sp.api.Controllers
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 序号 情况 处理逻辑
|
|
|
+ /// 1 处理人试用期算绩效 一人处理 正常算绩效给处理人
|
|
|
+ /// 2 处理人试用期不算绩效 一人处理 算给核稿人,如果没有核稿人,这条数据忽略
|
|
|
+ /// 3 处理人试用期算绩效 与人合写 合写人算绩效、与合写人一人一半
|
|
|
+ /// 4 处理人试用期不算绩效 与人合写 合写人算绩效、全部绩效算给合写人
|
|
|
+ /// 5 处理人试用期不算绩效 与人合写 合写人不算算绩效、这条数据忽略
|
|
|
+ /// 6 处理人试用期算绩效 与人合写 合写人不算绩效、试用期人员拿一半
|
|
|
+ /// 7 处理人不算绩效 一人处理 这条数据忽略
|
|
|
+ /// 8 处理人不算绩效 与人合写 合写人算绩效、合写人拿一半
|
|
|
+ /// 9 处理人不算绩效 与人合写 合写人不算绩效、这条数据忽略
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="verifyCoefficients"></param>
|
|
|
+ /// <param name="item"></param>
|
|
|
+ /// <param name="spDb"></param>
|
|
|
+ /// <returns></returns>
|
|
|
private List<StaffStatistics> _calItemJX( List<VerifyCoefficient> verifyCoefficients, PerformanceItem item,spDbContext spDb)
|
|
|
{
|
|
|
|
|
@@ -1685,13 +1788,15 @@ namespace wispro.sp.api.Controllers
|
|
|
|
|
|
List<StaffStatistics> itemStatistics = new List<StaffStatistics>();
|
|
|
|
|
|
- if (item.ReviewerId != null)
|
|
|
+ if (item.ReviewerId != null && item.Reviewer == null)
|
|
|
{
|
|
|
item.Reviewer = spDb.Staffs.Include(s => s.StaffGrade).FirstOrDefault(p => p.Id == item.ReviewerId);
|
|
|
//spDb.Entry(item.Reviewer).Reference(b => b.StaffGrade).Load();
|
|
|
}
|
|
|
|
|
|
List<ItemStaff> temIStaffs = new List<ItemStaff>();
|
|
|
+
|
|
|
+ #region 将试用期且不算绩效的人员从处理人清单中剔除
|
|
|
int syqUsers = 0;
|
|
|
foreach(var itemStaff in item.ItemStaffs)
|
|
|
{
|
|
@@ -1700,7 +1805,7 @@ namespace wispro.sp.api.Controllers
|
|
|
itemStaff.DoPerson = spDb.Staffs.Include(s => s.StaffGrade).FirstOrDefault(p => p.Id == itemStaff.DoPersonId);
|
|
|
}
|
|
|
|
|
|
- if(itemStaff.DoPerson.Status == "试用期" || !itemStaff.DoPerson.IsCalPerformsnce )
|
|
|
+ if(itemStaff.DoPerson.Status == "试用期" && !itemStaff.DoPerson.IsCalPerformsnce )
|
|
|
{
|
|
|
syqUsers += 1;
|
|
|
}
|
|
@@ -1709,8 +1814,10 @@ namespace wispro.sp.api.Controllers
|
|
|
temIStaffs.Add(itemStaff);
|
|
|
}
|
|
|
}
|
|
|
+ #endregion
|
|
|
|
|
|
- if(syqUsers == item.ItemStaffs.Count)
|
|
|
+ #region 处理人全部是试用期人员,则将核稿人当成处理人(处理人为试用期人)
|
|
|
+ if (syqUsers == item.ItemStaffs.Count)
|
|
|
{
|
|
|
if(item.Reviewer != null)
|
|
|
{
|
|
@@ -1718,9 +1825,16 @@ namespace wispro.sp.api.Controllers
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ #endregion
|
|
|
|
|
|
bool isPJFP = true;
|
|
|
double total = temIStaffs.Count();
|
|
|
+
|
|
|
+ if (total > 1)
|
|
|
+ {
|
|
|
+ System.Diagnostics.Debug.WriteLine("");
|
|
|
+ }
|
|
|
+
|
|
|
if (temIStaffs.Where<ItemStaff>(p => p.PerformancePoint != null || p.PerformancePoint == 0).Count() > 0)
|
|
|
{
|
|
|
total = temIStaffs.Select(i => i.PerformancePoint.Value).Sum();
|
|
@@ -1733,164 +1847,160 @@ namespace wispro.sp.api.Controllers
|
|
|
{
|
|
|
itemStaff.DoPerson = spDb.Staffs.Include(s=>s.StaffGrade).FirstOrDefault(p=>p.Id==itemStaff.DoPersonId);
|
|
|
}
|
|
|
- //spDb.Entry(itemStaff).Reference(b => b.DoPerson).Load();
|
|
|
- //spDb.Entry(itemStaff.DoPerson).Reference(b => b.StaffGrade).Load();
|
|
|
|
|
|
- #region 计算审核人绩效点数,核稿人绩效点数按照核稿人与个处理人的核稿系数计算后加总,没有找到核稿系数(比如同级别),核稿系数为0
|
|
|
- if (item.ReviewerId != null && item.Type != "专案" &&
|
|
|
- temIStaffs.FirstOrDefault(s=>s.DoPersonId == item.ReviewerId) == null)
|
|
|
+ if (itemStaff.DoPerson.IsCalPerformsnce)
|
|
|
{
|
|
|
-
|
|
|
- #region 取审核人等级审核等级系数
|
|
|
- VerifyCoefficient vcoefficient
|
|
|
- = verifyCoefficients.Where<VerifyCoefficient>(v =>
|
|
|
- v.CheckerId == item.Reviewer.StaffGradeId
|
|
|
- && v.DoPersonId == itemStaff.DoPerson.StaffGradeId)
|
|
|
- .FirstOrDefault<VerifyCoefficient>();
|
|
|
- #endregion
|
|
|
-
|
|
|
- if (vcoefficient != null)
|
|
|
+ #region 计算各处理人的绩效点数
|
|
|
+ double handlerBasePoint;
|
|
|
+ if (item.Type != "专案")
|
|
|
{
|
|
|
- double reviewerBasePoint = item.BasePoint.Value * vcoefficient.Coefficient;
|
|
|
-
|
|
|
-
|
|
|
- string temJxType = $"{item.Type}审核";
|
|
|
-
|
|
|
- var temReviewerStatic = itemStatistics.Where<StaffStatistics>(s => s.StaffId == item.ReviewerId && s.jxType == temJxType && s.CalMonth.Id == item.CalMonthId).FirstOrDefault();
|
|
|
- if (temReviewerStatic != null)
|
|
|
+ if (isPJFP)
|
|
|
{
|
|
|
- temReviewerStatic.totalBasePoint += reviewerBasePoint;
|
|
|
- temReviewerStatic.totalActuallyPoint += reviewerBasePoint;
|
|
|
+ handlerBasePoint = item.BasePoint.Value * 1.0 / total;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (itemStaff.DoPerson.Status != "试用期" && item.Reviewer.IsCalPerformsnce ) //判断是否在职
|
|
|
- {
|
|
|
- temReviewerStatic = new StaffStatistics()
|
|
|
- {
|
|
|
-
|
|
|
- CalMonthId = item.CalMonthId,
|
|
|
- StaffId = item.ReviewerId.Value,
|
|
|
- totalBasePoint = reviewerBasePoint,
|
|
|
- totalActuallyPoint = reviewerBasePoint,
|
|
|
- jxType = temJxType
|
|
|
- };
|
|
|
-
|
|
|
- itemStatistics.Add(temReviewerStatic);
|
|
|
- }
|
|
|
+ handlerBasePoint = (double)((decimal)item.BasePoint.Value * (decimal)itemStaff.PerformancePoint.Value / (decimal)total);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 计算各处理人的绩效点数
|
|
|
- double handlerBasePoint;
|
|
|
- if (item.Type != "专案")
|
|
|
- {
|
|
|
- if (isPJFP)
|
|
|
- {
|
|
|
- handlerBasePoint = item.BasePoint.Value * 1.0 / total;
|
|
|
- }
|
|
|
else
|
|
|
{
|
|
|
- handlerBasePoint = item.BasePoint.Value * itemStaff.PerformancePoint.Value / total;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (itemStaff.PerformancePoint == null)
|
|
|
- {
|
|
|
- if (isPJFP)
|
|
|
+ if (itemStaff.PerformancePoint == null)
|
|
|
{
|
|
|
- handlerBasePoint = item.BasePoint.Value * 1.0 / total;
|
|
|
+ if (isPJFP)
|
|
|
+ {
|
|
|
+ handlerBasePoint = item.BasePoint.Value * 1.0 / total;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ handlerBasePoint = (double)((decimal)item.BasePoint.Value * (decimal)itemStaff.PerformancePoint.Value / (decimal)total);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- handlerBasePoint = item.BasePoint.Value * itemStaff.PerformancePoint.Value / total;
|
|
|
+ if (item.ItemStaffs.Count == 1 && itemStaff.PerformancePoint == 0)
|
|
|
+ {
|
|
|
+ handlerBasePoint = item.BasePoint.Value;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ handlerBasePoint = itemStaff.PerformancePoint.Value;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+
|
|
|
+ string handlerJxType = $"{item.Type}处理";
|
|
|
+ var temStatic = itemStatistics.Where<StaffStatistics>(s => s.StaffId == itemStaff.DoPersonId && s.jxType == handlerJxType && s.CalMonth.Id == item.CalMonthId).FirstOrDefault();
|
|
|
+ if (temStatic != null)
|
|
|
{
|
|
|
- if(item.ItemStaffs.Count ==1 && itemStaff .PerformancePoint == 0)
|
|
|
+ temStatic.totalBasePoint += handlerBasePoint;
|
|
|
+
|
|
|
+ if (item.Type == "OA" || item.Type == "新申请")
|
|
|
{
|
|
|
- handlerBasePoint = item.BasePoint.Value;
|
|
|
+ temStatic.totalActuallyPoint += (double)((decimal)handlerBasePoint * (decimal)itemStaff.DoPerson.StaffGrade.Coefficient);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- handlerBasePoint = itemStaff.PerformancePoint.Value;
|
|
|
+ temStatic.totalActuallyPoint += handlerBasePoint;
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- string handlerJxType = $"{item.Type}处理";
|
|
|
- var temStatic = itemStatistics.Where<StaffStatistics>(s => s.StaffId == itemStaff.DoPersonId && s.jxType == handlerJxType && s.CalMonth.Id == item.CalMonthId).FirstOrDefault();
|
|
|
- if (temStatic != null)
|
|
|
- {
|
|
|
- temStatic.totalBasePoint += handlerBasePoint;
|
|
|
-
|
|
|
- if (item.Type == "OA" || item.Type == "新申请")
|
|
|
- {
|
|
|
- temStatic.totalActuallyPoint += handlerBasePoint * itemStaff.DoPerson.StaffGrade.Coefficient;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- temStatic.totalActuallyPoint += handlerBasePoint;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (itemStaff.DoPerson.StaffGradeId != null && itemStaff.DoPerson.IsCalPerformsnce)
|
|
|
- {
|
|
|
- if (item.Type == "OA" || item.Type == "新申请")
|
|
|
+ if (itemStaff.DoPerson.StaffGradeId != null && itemStaff.DoPerson.IsCalPerformsnce)
|
|
|
{
|
|
|
- if (itemStaff.DoPerson.Status == "试用期" && item.Reviewer != null)
|
|
|
+ if (item.Type == "OA" || item.Type == "新申请")
|
|
|
{
|
|
|
+ if (itemStaff.DoPerson.StaffGrade == null)
|
|
|
+ {
|
|
|
+ itemStaff.DoPerson.StaffGrade = spDb.StaffGrades.FirstOrDefault(s => s.Id == itemStaff.DoPerson.StaffGradeId);
|
|
|
+ }
|
|
|
+
|
|
|
temStatic = new StaffStatistics()
|
|
|
{
|
|
|
+ //CalMonth = calMonth,
|
|
|
CalMonthId = item.CalMonthId,
|
|
|
- StaffId = item.Reviewer.Id,
|
|
|
- totalActuallyPoint= handlerBasePoint * item.Reviewer.StaffGrade.Coefficient,
|
|
|
+ StaffId = itemStaff.DoPersonId,
|
|
|
+ totalActuallyPoint = (double)((decimal)handlerBasePoint * (decimal)itemStaff.DoPerson.StaffGrade.Coefficient),
|
|
|
totalBasePoint = handlerBasePoint,
|
|
|
jxType = handlerJxType
|
|
|
};
|
|
|
|
|
|
-
|
|
|
itemStatistics.Add(temStatic);
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- itemStaff.DoPerson.StaffGrade = spDb.StaffGrades.FirstOrDefault(s=>s.Id == itemStaff.DoPerson.StaffGradeId);
|
|
|
temStatic = new StaffStatistics()
|
|
|
{
|
|
|
//CalMonth = calMonth,
|
|
|
CalMonthId = item.CalMonthId,
|
|
|
StaffId = itemStaff.DoPersonId,
|
|
|
- totalActuallyPoint = handlerBasePoint * itemStaff.DoPerson.StaffGrade.Coefficient,
|
|
|
totalBasePoint = handlerBasePoint,
|
|
|
+ totalActuallyPoint = handlerBasePoint,
|
|
|
jxType = handlerJxType
|
|
|
};
|
|
|
|
|
|
itemStatistics.Add(temStatic);
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 计算审核人绩效点数,核稿人绩效点数按照核稿人与个处理人的核稿系数计算后加总,没有找到核稿系数(比如同级别),核稿系数为0
|
|
|
+ if (item.ReviewerId != null && item.Type != "专案" &&
|
|
|
+ temIStaffs.FirstOrDefault(s => s.DoPersonId == item.ReviewerId) == null)
|
|
|
+ {
|
|
|
+ if(item.Reviewer == null)
|
|
|
+ {
|
|
|
+ item.Reviewer = spDb.Staffs.FirstOrDefault(s=>s.Id == item.ReviewerId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item.Reviewer.IsCalPerformsnce)
|
|
|
{
|
|
|
- temStatic = new StaffStatistics()
|
|
|
+ #region 取审核人等级审核等级系数
|
|
|
+ VerifyCoefficient vcoefficient
|
|
|
+ = verifyCoefficients.Where<VerifyCoefficient>(v =>
|
|
|
+ v.CheckerId == item.Reviewer.StaffGradeId
|
|
|
+ && v.DoPersonId == itemStaff.DoPerson.StaffGradeId)
|
|
|
+ .FirstOrDefault<VerifyCoefficient>();
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ if (vcoefficient != null)
|
|
|
{
|
|
|
- //CalMonth = calMonth,
|
|
|
- CalMonthId = item.CalMonthId,
|
|
|
- StaffId = itemStaff.DoPersonId,
|
|
|
- totalBasePoint = handlerBasePoint,
|
|
|
- totalActuallyPoint = handlerBasePoint,
|
|
|
- jxType = handlerJxType
|
|
|
- };
|
|
|
-
|
|
|
- itemStatistics.Add(temStatic);
|
|
|
+ double reviewerBasePoint = (double)((decimal)handlerBasePoint * (decimal)vcoefficient.Coefficient);
|
|
|
+
|
|
|
+
|
|
|
+ string temJxType = $"{item.Type}审核";
|
|
|
+
|
|
|
+ var temReviewerStatic = itemStatistics.Where<StaffStatistics>(s => s.StaffId == item.ReviewerId && s.jxType == temJxType && s.CalMonth.Id == item.CalMonthId).FirstOrDefault();
|
|
|
+ if (temReviewerStatic != null)
|
|
|
+ {
|
|
|
+ temReviewerStatic.totalBasePoint += reviewerBasePoint;
|
|
|
+ temReviewerStatic.totalActuallyPoint += reviewerBasePoint;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (itemStaff.DoPerson.Status != "试用期" && item.Reviewer.IsCalPerformsnce) //判断是否在职
|
|
|
+ {
|
|
|
+ temReviewerStatic = new StaffStatistics()
|
|
|
+ {
|
|
|
+
|
|
|
+ CalMonthId = item.CalMonthId,
|
|
|
+ StaffId = item.ReviewerId.Value,
|
|
|
+ totalBasePoint = reviewerBasePoint,
|
|
|
+ totalActuallyPoint = reviewerBasePoint,
|
|
|
+ jxType = temJxType
|
|
|
+ };
|
|
|
+
|
|
|
+ itemStatistics.Add(temReviewerStatic);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ #endregion
|
|
|
}
|
|
|
- #endregion
|
|
|
}
|
|
|
|
|
|
return itemStatistics;
|
|
@@ -1982,7 +2092,7 @@ namespace wispro.sp.api.Controllers
|
|
|
if (ss.jxType == "新申请处理" || ss.jxType == "专案处理")
|
|
|
{
|
|
|
ss.FinianlPoint = ss.FinianlPoint / totalFPBLPoint * (totalFPBLPoint + jlPoint);
|
|
|
- Context.SaveChanges();
|
|
|
+ spDb.SaveChanges();
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
@@ -2000,8 +2110,11 @@ namespace wispro.sp.api.Controllers
|
|
|
var result = Context.StaffStatistics.Where(s => s.CalMonthId == calMonth.Id);
|
|
|
Context.StaffStatistics.RemoveRange(result);
|
|
|
|
|
|
- var itemList = Context.PerformanceItems.Include(s => s.ItemStaffs).
|
|
|
- Where(s => s.CalMonthId == calMonth.Id).ToList();
|
|
|
+ var itemList = Context.PerformanceItems
|
|
|
+ .Include(s => s.ItemStaffs)
|
|
|
+ .Include(p=>p.Customer)
|
|
|
+ .Include(p=>p.Reviewer)
|
|
|
+ .Where(s => s.CalMonthId == calMonth.Id).ToList();
|
|
|
|
|
|
var rules = Context.BasePointRules.ToList();
|
|
|
|
|
@@ -2014,8 +2127,12 @@ namespace wispro.sp.api.Controllers
|
|
|
{
|
|
|
_calItemJX(item,Context);
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var oldJxList = Context.StaffStatistics.Where(p => p.ItemId == item.Id);
|
|
|
+ Context.StaffStatistics.RemoveRange(oldJxList);
|
|
|
+ }
|
|
|
|
|
|
- //_CalItemJX(item.Id);
|
|
|
}
|
|
|
|
|
|
_CalJXPoint(calMonth, Context);
|
|
@@ -2056,7 +2173,8 @@ namespace wispro.sp.api.Controllers
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- _CalJXPoint(calMonth, Context);
|
|
|
+ _RefreshBasePoint(calMonth,Context);
|
|
|
+ //_CalJXPoint(calMonth, Context);
|
|
|
|
|
|
calMonth.Status = 4;
|
|
|
Context.SaveChanges();
|