|
@@ -398,13 +398,15 @@ namespace wispro.sp.api.Controllers
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
- public double DegreeOfDifficulty(int year,int month, int? userId = null)
|
|
|
|
|
|
+
|
|
|
|
+ public NanduStatics DegreeOfDifficulty(CalMonth calMonth,int? userId = null)
|
|
{
|
|
{
|
|
- string strKey = $"DegreeOfDifficulty:{year}-{month}-{userId}";
|
|
|
|
|
|
+ NanduStatics retObj = new NanduStatics();
|
|
|
|
+
|
|
|
|
+ string strKey = $"DegreeOfDifficulty:{calMonth.Year}-{calMonth.Month}-{userId}";
|
|
object cacheEntry;
|
|
object cacheEntry;
|
|
if (!MyMemoryCache.TryGetValue(strKey, out cacheEntry))
|
|
if (!MyMemoryCache.TryGetValue(strKey, out cacheEntry))
|
|
{
|
|
{
|
|
-
|
|
|
|
IDictionary<string, double> CaseXiShu = new Dictionary<string, double>();
|
|
IDictionary<string, double> CaseXiShu = new Dictionary<string, double>();
|
|
var list = Context.CaseCeoffcients;
|
|
var list = Context.CaseCeoffcients;
|
|
|
|
|
|
@@ -413,13 +415,13 @@ namespace wispro.sp.api.Controllers
|
|
CaseXiShu.Add(cx.Ceoffcient, cx.Value);
|
|
CaseXiShu.Add(cx.Ceoffcient, cx.Value);
|
|
}
|
|
}
|
|
|
|
|
|
- var results = Context.PerformanceItems.Where<PerformanceItem>(p => p.CalMonth.Year == year && p.CalMonth.Month == month && ((p.Type == "新申请" && p.BasePoint > 0) || p.Type == "专案") && p.BasePoint > 0.0);
|
|
|
|
|
|
+ var results = Context.PerformanceItems.Where<PerformanceItem>(p => p.CalMonthId == calMonth.Id && ((p.Type == "新申请" && p.BasePoint > 0) || p.Type == "专案") && p.BasePoint > 0.0);
|
|
|
|
|
|
if (userId != null)
|
|
if (userId != null)
|
|
{
|
|
{
|
|
results = Context.PerformanceItems.Where<PerformanceItem>(p =>
|
|
results = Context.PerformanceItems.Where<PerformanceItem>(p =>
|
|
- p.CalMonth.Year == year && p.CalMonth.Month == month && ((p.Type == "新申请" && p.BasePoint > 0) || p.Type == "专案") &&
|
|
|
|
- (p.ItemStaffs.Where<ItemStaff>(s => s.DoPerson.Id == userId).Count() > 0 || p.ReviewerId == userId ) && p.BasePoint > 0.0);
|
|
|
|
|
|
+ p.CalMonthId == calMonth.Id && ((p.Type == "新申请" && p.BasePoint > 0) || p.Type == "专案") &&
|
|
|
|
+ (p.ItemStaffs.Where<ItemStaff>(s => s.DoPerson.Id == userId).Count() > 0 || p.ReviewerId == userId) && p.BasePoint > 0.0);
|
|
}
|
|
}
|
|
|
|
|
|
#region 循环计算
|
|
#region 循环计算
|
|
@@ -452,6 +454,25 @@ namespace wispro.sp.api.Controllers
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
+ switch (strCaseCeoffcient)
|
|
|
|
+ {
|
|
|
|
+ case "S":
|
|
|
|
+ retObj.S += 1;
|
|
|
|
+ break;
|
|
|
|
+ case "A":
|
|
|
|
+ retObj.A += 1;
|
|
|
|
+ break;
|
|
|
|
+ case "B":
|
|
|
|
+ retObj.B += 1;
|
|
|
|
+ break;
|
|
|
|
+ case "C":
|
|
|
|
+ retObj.C += 1;
|
|
|
|
+ break;
|
|
|
|
+ case "D":
|
|
|
|
+ retObj.D += 1;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (CaseXiShu.ContainsKey(strCaseCeoffcient))
|
|
if (CaseXiShu.ContainsKey(strCaseCeoffcient))
|
|
{
|
|
{
|
|
d += CaseXiShu[strCaseCeoffcient];
|
|
d += CaseXiShu[strCaseCeoffcient];
|
|
@@ -461,42 +482,18 @@ namespace wispro.sp.api.Controllers
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
- #region 统计计算
|
|
|
|
- //var groupResult = results.GroupBy(x => x.CaseCoefficient).Select(g=> new {
|
|
|
|
- // CaseCeoffcient = g.Key,
|
|
|
|
- // count = g.Count()
|
|
|
|
- //});
|
|
|
|
-
|
|
|
|
- //int iCount = 0;
|
|
|
|
- //double d = 0.0;
|
|
|
|
- //foreach(var g in groupResult)
|
|
|
|
- //{
|
|
|
|
- // if (!string.IsNullOrEmpty(g.CaseCeoffcient))
|
|
|
|
- // {
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // if (CaseXiShu.ContainsKey(g.CaseCeoffcient))
|
|
|
|
- // {
|
|
|
|
- // d += g.count * CaseXiShu[g.CaseCeoffcient];
|
|
|
|
- // iCount += g.count;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
- #endregion
|
|
|
|
-
|
|
|
|
- cacheEntry = d / (double)iCount;
|
|
|
|
|
|
+
|
|
|
|
|
|
- // Set cache options.
|
|
|
|
|
|
+ retObj.NanduXS = d / (double)iCount;
|
|
|
|
|
|
// Save data in cache.
|
|
// Save data in cache.
|
|
- MyMemoryCache.SetValue(strKey, cacheEntry);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- return (double)cacheEntry;
|
|
|
|
|
|
+ MyMemoryCache.SetValue(strKey, retObj);
|
|
|
|
+
|
|
|
|
+ return retObj;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- return (double)cacheEntry;
|
|
|
|
|
|
+ return (NanduStatics)cacheEntry;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -511,11 +508,16 @@ namespace wispro.sp.api.Controllers
|
|
|
|
|
|
return new List<string>();
|
|
return new List<string>();
|
|
}
|
|
}
|
|
|
|
+
|
|
private List<StaffStatistics> _CalMyStatistics(CalMonth calMonth, int? userid = null)
|
|
private List<StaffStatistics> _CalMyStatistics(CalMonth calMonth, int? userid = null)
|
|
{
|
|
{
|
|
-
|
|
|
|
-
|
|
|
|
- double gspjXS = DegreeOfDifficulty(calMonth.Year, calMonth.Month);
|
|
|
|
|
|
+ NanduStatics gspjXS = DegreeOfDifficulty(calMonth);
|
|
|
|
+ calMonth.NanduXS = gspjXS.NanduXS;
|
|
|
|
+ calMonth.S = gspjXS.S;
|
|
|
|
+ calMonth.A = gspjXS.A;
|
|
|
|
+ calMonth.B = gspjXS.B;
|
|
|
|
+ calMonth.C = gspjXS.C;
|
|
|
|
+ calMonth.D = gspjXS.D;
|
|
|
|
|
|
//未归档,从绩效记录中统计数据
|
|
//未归档,从绩效记录中统计数据
|
|
var results = Context.PerformanceItems.Where<PerformanceItem>(s => s.CalMonth.Id == calMonth.Id);
|
|
var results = Context.PerformanceItems.Where<PerformanceItem>(s => s.CalMonth.Id == calMonth.Id);
|
|
@@ -542,16 +544,13 @@ namespace wispro.sp.api.Controllers
|
|
foreach (PerformanceItem item in ItemList)
|
|
foreach (PerformanceItem item in ItemList)
|
|
{
|
|
{
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
//if (item.BasePoint == null)
|
|
//if (item.BasePoint == null)
|
|
//{
|
|
//{
|
|
|
|
|
|
if (item.AgentFeedbackMemo != "特殊点数申诉")
|
|
if (item.AgentFeedbackMemo != "特殊点数申诉")
|
|
{
|
|
{
|
|
Utility.Utility.CalBasePoint(item, Rules);
|
|
Utility.Utility.CalBasePoint(item, Rules);
|
|
-
|
|
|
|
|
|
+
|
|
Context.SaveChanges();
|
|
Context.SaveChanges();
|
|
}
|
|
}
|
|
//}
|
|
//}
|
|
@@ -594,24 +593,31 @@ namespace wispro.sp.api.Controllers
|
|
retList = retList.Where<StaffStatistics>(s => s.StaffId == userid.Value).ToList();
|
|
retList = retList.Where<StaffStatistics>(s => s.StaffId == userid.Value).ToList();
|
|
}
|
|
}
|
|
|
|
|
|
- IDictionary<int, double> staffXiShu = new Dictionary<int, double>();
|
|
|
|
|
|
+ IDictionary<int, NanduStatics> staffXiShu = new Dictionary<int, NanduStatics>();
|
|
foreach (StaffStatistics ss in retList)
|
|
foreach (StaffStatistics ss in retList)
|
|
{
|
|
{
|
|
if (ss.jxType.Contains("新申请") || ss.jxType.Contains("专案"))
|
|
if (ss.jxType.Contains("新申请") || ss.jxType.Contains("专案"))
|
|
{
|
|
{
|
|
if (!staffXiShu.ContainsKey(ss.StaffId))
|
|
if (!staffXiShu.ContainsKey(ss.StaffId))
|
|
{
|
|
{
|
|
- staffXiShu.Add(ss.StaffId, DegreeOfDifficulty(calMonth.Year, calMonth.Month, ss.StaffId));
|
|
|
|
|
|
+ NanduStatics nandu = DegreeOfDifficulty(calMonth, ss.StaffId);
|
|
|
|
+ staffXiShu.Add(ss.StaffId, nandu);
|
|
}
|
|
}
|
|
|
|
|
|
- ss.totalActuallyPoint = ss.totalBasePoint * staffXiShu[ss.StaffId] / gspjXS;
|
|
|
|
|
|
+ ss.totalActuallyPoint = ss.totalBasePoint * staffXiShu[ss.StaffId].NanduXS / gspjXS.NanduXS;
|
|
|
|
+ ss.NanduXS = staffXiShu[ss.StaffId].NanduXS;
|
|
|
|
+ ss.S = staffXiShu[ss.StaffId].S;
|
|
|
|
+ ss.A = staffXiShu[ss.StaffId].A;
|
|
|
|
+ ss.B = staffXiShu[ss.StaffId].B;
|
|
|
|
+ ss.C = staffXiShu[ss.StaffId].C;
|
|
|
|
+ ss.D = staffXiShu[ss.StaffId].D;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
ss.totalActuallyPoint = ss.totalBasePoint;
|
|
ss.totalActuallyPoint = ss.totalBasePoint;
|
|
}
|
|
}
|
|
|
|
|
|
- ss.CalMonth.PerformanceItems = null;
|
|
|
|
|
|
+ //ss.CalMonth.PerformanceItems = null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -693,6 +699,191 @@ namespace wispro.sp.api.Controllers
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void Export2ExcelThread()
|
|
|
|
+ {
|
|
|
|
+ spDbContext spDb = new spDbContext();
|
|
|
|
+ List<PerformanceItem> items = spDb.PerformanceItems
|
|
|
|
+ .Include(p => p.Reviewer).ThenInclude(p => p.StaffGrade)
|
|
|
|
+ .Include(p=>p.PreOastaff)
|
|
|
|
+ .Include(p => p.Customer)
|
|
|
|
+ .Include(p => p.CalMonth)
|
|
|
|
+ .Include(p => p.ItemStaffs).ThenInclude(s => s.DoPerson).ThenInclude(s => s.StaffGrade)
|
|
|
|
+ .Where(p => p.CalMonth.Status == 0 && !p.CaseNo.StartsWith("J")).OrderBy(p => p.CaseNo).ThenBy(p => p.DoItem).ToList();
|
|
|
|
+
|
|
|
|
+ DataTable dt = new DataTable();
|
|
|
|
+ #region 栏位名称
|
|
|
|
+ dt.Columns.Add("我方文号",typeof(string));
|
|
|
|
+ dt.Columns.Add("申请类型", typeof(string));
|
|
|
|
+ dt.Columns.Add("业务类型", typeof(string));
|
|
|
|
+ dt.Columns.Add("备注(填表注意事项)", typeof(string));
|
|
|
|
+ dt.Columns.Add("处理事项", typeof(string));
|
|
|
|
+ dt.Columns.Add("案件阶段", typeof(string));
|
|
|
|
+ dt.Columns.Add("案件系数", typeof(string));
|
|
|
|
+ dt.Columns.Add("处理事项系数", typeof(string));
|
|
|
|
+ dt.Columns.Add("前一次OA处理事项系数", typeof(string));
|
|
|
|
+ dt.Columns.Add("前一次OA处理人", typeof(string));
|
|
|
|
+ dt.Columns.Add("处理人等级", typeof(string));
|
|
|
|
+ dt.Columns.Add("基本点数", typeof(string));
|
|
|
|
+ dt.Columns.Add("核稿系数", typeof(string));
|
|
|
|
+ dt.Columns.Add("核稿绩效", typeof(string));
|
|
|
|
+ dt.Columns.Add("处理人", typeof(string));
|
|
|
|
+ dt.Columns.Add("核稿人", typeof(string));
|
|
|
|
+ dt.Columns.Add("客户名称", typeof(string));
|
|
|
|
+ dt.Columns.Add("申请人", typeof(string));
|
|
|
|
+ dt.Columns.Add("处理事项完成日", typeof(string));
|
|
|
|
+ dt.Columns.Add("定稿日", typeof(string));
|
|
|
|
+ dt.Columns.Add("返稿日", typeof(string));
|
|
|
|
+ dt.Columns.Add("案件类型", typeof(string));
|
|
|
|
+ dt.Columns.Add("案件状态", typeof(string));
|
|
|
|
+ dt.Columns.Add("处理事项备注", typeof(string));
|
|
|
|
+ dt.Columns.Add("处理状态", typeof(string));
|
|
|
|
+ dt.Columns.Add("案件名称", typeof(string));
|
|
|
|
+ dt.Columns.Add("委案日期", typeof(string));
|
|
|
|
+ dt.Columns.Add("客户期限", typeof(string));
|
|
|
|
+ dt.Columns.Add("内部期限", typeof(string));
|
|
|
|
+ dt.Columns.Add("初稿日", typeof(string));
|
|
|
|
+ dt.Columns.Add("备注(发文严重超期是否属客观原因,若为否,请填写原因", typeof(string));
|
|
|
|
+ dt.Columns.Add("绩效类型", typeof(string));
|
|
|
|
+ dt.Columns.Add("案件备注", typeof(string));
|
|
|
|
+ dt.Columns.Add("处理人绩效系数", typeof(string));
|
|
|
|
+ dt.Columns.Add("系统核算绩效", typeof(string));
|
|
|
|
+ dt.Columns.Add("实际处理人", typeof(string));
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ var verifyCeoffients = spDb.VerifyCoefficients.ToList();
|
|
|
|
+ var Rules = spDb.BasePointRules.ToList();
|
|
|
|
+
|
|
|
|
+ foreach(var p in items)
|
|
|
|
+ {
|
|
|
|
+ Utility.Utility.CalBasePoint(p, Rules);
|
|
|
|
+ var jxList = _calItemJX(p.CalMonth, verifyCeoffients, p, spDb);
|
|
|
|
+
|
|
|
|
+ bool isPJFP = true;
|
|
|
|
+ bool isReviewerInDopersons = false;
|
|
|
|
+ if (p.ReviewerId.HasValue)
|
|
|
|
+ {
|
|
|
|
+ isReviewerInDopersons = (p.ItemStaffs.Where(i => i.DoPersonId == p.ReviewerId).Count() > 0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ double total = p.ItemStaffs.Count();
|
|
|
|
+ if (p.ItemStaffs.Where<ItemStaff>(p => p.PerformancePoint != null || p.PerformancePoint == 0).Count() > 0)
|
|
|
|
+ {
|
|
|
|
+ total = p.ItemStaffs.Select(i => i.PerformancePoint.Value).Sum();
|
|
|
|
+ isPJFP = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreach (var iStaff in p.ItemStaffs)
|
|
|
|
+ {
|
|
|
|
+ DataRow row = dt.NewRow();
|
|
|
|
+ row["我方文号"] = p.CaseNo;
|
|
|
|
+ row["申请类型"] = p.ApplicationType;
|
|
|
|
+
|
|
|
|
+ if(p.Customer.Name.Contains("OPPO") && p.ApplicationType == "实用新型")
|
|
|
|
+ {
|
|
|
|
+ row["申请类型"] = "发明";
|
|
|
|
+ row["案件备注"] = $"{row["案件备注"]}\r\nOPPO案件实用新型修改为发明】";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ row["业务类型"] = p.BusinessType;
|
|
|
|
+ row["备注(填表注意事项)"] = p.AgentFeedbackMemo;
|
|
|
|
+ row["处理事项"] = p.DoItem;
|
|
|
|
+ row["案件阶段"] = p.CaseStage;
|
|
|
|
+
|
|
|
|
+ row["案件系数"] = p.CaseCoefficient;
|
|
|
|
+ if(p.isDanger() && string.IsNullOrEmpty(p.OverDueMemo))
|
|
|
|
+ {
|
|
|
|
+ switch (p.CaseCoefficient)
|
|
|
|
+ {
|
|
|
|
+ case "S":
|
|
|
|
+ row["案件系数"] = "A";
|
|
|
|
+ break;
|
|
|
|
+ case "A":
|
|
|
|
+ row["案件系数"] = "B";
|
|
|
|
+ break;
|
|
|
|
+ case "B":
|
|
|
|
+ row["案件系数"] = "C";
|
|
|
|
+ break;
|
|
|
|
+ case "C":
|
|
|
|
+ row["案件系数"] = "D";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ row["案件备注"] = $"{row["案件备注"]}\r\n严重延期降系数【{p.CaseCoefficient}->{row["案件系数"]}】";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ row["处理事项系数"] = p.DoItemCoefficient;
|
|
|
|
+ row["前一次OA处理事项系数"] = "";
|
|
|
|
+ row["前一次OA处理人"] = p.PreOastaff.Name;
|
|
|
|
+
|
|
|
|
+ if(iStaff.DoPerson.Status == "试用期")
|
|
|
|
+ {
|
|
|
|
+ row["实际处理人"] = iStaff.DoPerson.Name;
|
|
|
|
+ row["案件备注"] = $"{row["案件备注"]}\r\n处理人{iStaff.DoPerson.Name}未转正";
|
|
|
|
+ row["处理人"] = p.Reviewer.Name;
|
|
|
|
+ row["处理人等级"] = p.Reviewer.StaffGrade.Grade;
|
|
|
|
+ row["基本点数"] = (p.BasePoint / total).ToString();
|
|
|
|
+
|
|
|
|
+ row["核稿人"] = "";
|
|
|
|
+ row["核稿系数"] = "";
|
|
|
|
+ row["核稿绩效"] = "";
|
|
|
|
+ row["处理人绩效系数"] = p.Reviewer.StaffGrade.Coefficient;
|
|
|
|
+ row["系统核算绩效"] = "";
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ row["处理人"] = iStaff.DoPerson.Name;
|
|
|
|
+ row["处理人等级"] = iStaff.DoPerson.StaffGrade.Grade;
|
|
|
|
+ row["基本点数"] = (p.BasePoint / total).ToString();
|
|
|
|
+ row["处理人绩效系数"] = iStaff.DoPerson.StaffGrade.Coefficient;
|
|
|
|
+ row["系统核算绩效"] = "";
|
|
|
|
+
|
|
|
|
+ if (isReviewerInDopersons)
|
|
|
|
+ {
|
|
|
|
+ row["核稿人"] = "";
|
|
|
|
+ row["核稿系数"] = "";
|
|
|
|
+ row["核稿绩效"] = "";
|
|
|
|
+ row["处理人绩效系数"] = "";
|
|
|
|
+ row["系统核算绩效"] = "";
|
|
|
|
+ row["案件备注"] = $"{row["案件备注"]}\r\n核稿人与处理人一致,置空核稿人栏位";
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ row["核稿人"] = p.Reviewer?.Name;
|
|
|
|
+ var vCoefficient = Context.VerifyCoefficients.FirstOrDefault(c => c.CheckerId == p.ReviewerId && c.DoPersonId == iStaff.DoPersonId);
|
|
|
|
+ if (vCoefficient != null)
|
|
|
|
+ {
|
|
|
|
+ row["核稿系数"] = vCoefficient.Coefficient;
|
|
|
|
+ row["核稿绩效"] = (p.BasePoint / total) * vCoefficient.Coefficient;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ row["客户名称"] = p.Customer.Name;
|
|
|
|
+ row["申请人"] = p.ApplicationName;
|
|
|
|
+ row["处理事项完成日"] = p.FinishedDate?.ToString("yyyy-MM-dd");
|
|
|
|
+ row["定稿日"] = p.FinalizationDate?.ToString("yyyy-MM-dd");
|
|
|
|
+ row["返稿日"] = p.ReturnDate?.ToString("yyyy-MM-dd");
|
|
|
|
+ row["案件类型"] = p.CaseType;
|
|
|
|
+ row["案件状态"] = p.CaseState;
|
|
|
|
+ row["处理事项备注"] = p.DoItemMemo;
|
|
|
|
+ row["处理状态"] = p.DoItemState;
|
|
|
|
+ row["案件名称"] = p.CaseName;
|
|
|
|
+ row["委案日期"] = p.EntrustingDate?.ToString("yyyy-MM-dd");
|
|
|
|
+ row["客户期限"] = p.CustomerLimitDate?.ToString("yyyy-MM-dd");
|
|
|
|
+ row["内部期限"] = p.InternalDate?.ToString("yyyy-MM-dd");
|
|
|
|
+ row["初稿日"] = p.FirstDraftDate?.ToString("yyyy-MM-dd");
|
|
|
|
+ row["备注(发文严重超期是否属客观原因,若为否,请填写原因"] = p.OverDueMemo;
|
|
|
|
+ row["绩效类型"] = p.Type;
|
|
|
|
+ row["案件备注"] = p.CaseMemo;
|
|
|
|
+
|
|
|
|
+ dt.Rows.Add(row);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ NPOIExcel.DataTableToExcel(dt,$"c:\\temp\\{DateTime.Now.ToString("yyyyMMddhhmmss")}-线下绩效核算数据.xlsx");
|
|
|
|
+ }
|
|
|
|
|
|
private void _CompareExcel2DB()
|
|
private void _CompareExcel2DB()
|
|
{
|
|
{
|
|
@@ -1170,12 +1361,18 @@ namespace wispro.sp.api.Controllers
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public List<StaffStatistics> CalItemJX(int itemid)
|
|
|
|
+ {
|
|
|
|
+ var Item = Context.PerformanceItems.Include(p=>p.CalMonth).FirstOrDefault(p=>p.Id == itemid);
|
|
|
|
+ List<VerifyCoefficient> verifyCoefficients = Context.VerifyCoefficients.ToList<VerifyCoefficient>();
|
|
|
|
+
|
|
|
|
+ return _calItemJX(Item.CalMonth,verifyCoefficients,Item,Context);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
private List<StaffStatistics> _calItemJX(CalMonth calMonth, List<VerifyCoefficient> verifyCoefficients, PerformanceItem item,spDbContext spDb)
|
|
private List<StaffStatistics> _calItemJX(CalMonth calMonth, List<VerifyCoefficient> verifyCoefficients, PerformanceItem item,spDbContext spDb)
|
|
{
|
|
{
|
|
- //if(item.CaseNo == "PACN2116373")
|
|
|
|
- //{
|
|
|
|
- // System.Diagnostics.Debug.WriteLine("");
|
|
|
|
- //}
|
|
|
|
|
|
+
|
|
System.Collections.Hashtable doPersonsBL = new System.Collections.Hashtable();
|
|
System.Collections.Hashtable doPersonsBL = new System.Collections.Hashtable();
|
|
|
|
|
|
bool isPJFP = true;
|
|
bool isPJFP = true;
|
|
@@ -1204,7 +1401,8 @@ namespace wispro.sp.api.Controllers
|
|
//spDb.Entry(itemStaff.DoPerson).Reference(b => b.StaffGrade).Load();
|
|
//spDb.Entry(itemStaff.DoPerson).Reference(b => b.StaffGrade).Load();
|
|
|
|
|
|
#region 计算审核人绩效点数,核稿人绩效点数按照核稿人与个处理人的核稿系数计算后加总,没有找到核稿系数(比如同级别),核稿系数为0
|
|
#region 计算审核人绩效点数,核稿人绩效点数按照核稿人与个处理人的核稿系数计算后加总,没有找到核稿系数(比如同级别),核稿系数为0
|
|
- if (item.ReviewerId != null && item.Type != "专案" && item.ItemStaffs.FirstOrDefault(s=>s.DoPersonId == item.ReviewerId) == null)
|
|
|
|
|
|
+ if (item.ReviewerId != null && item.Type != "专案" &&
|
|
|
|
+ item.ItemStaffs.FirstOrDefault(s=>s.DoPersonId == item.ReviewerId) == null)
|
|
{
|
|
{
|
|
|
|
|
|
#region 取审核人等级审核等级系数
|
|
#region 取审核人等级审核等级系数
|
|
@@ -1262,7 +1460,21 @@ namespace wispro.sp.api.Controllers
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- handlerBasePoint = itemStaff.PerformancePoint.Value;
|
|
|
|
|
|
+ if (itemStaff.PerformancePoint == null)
|
|
|
|
+ {
|
|
|
|
+ if (isPJFP)
|
|
|
|
+ {
|
|
|
|
+ handlerBasePoint = item.BasePoint.Value * 1.0 / total;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ handlerBasePoint = item.BasePoint.Value * itemStaff.PerformancePoint.Value / total;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ handlerBasePoint = itemStaff.PerformancePoint.Value;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
string handlerJxType = $"{item.Type}处理";
|
|
string handlerJxType = $"{item.Type}处理";
|
|
@@ -1342,12 +1554,13 @@ namespace wispro.sp.api.Controllers
|
|
|
|
|
|
if (calMonth != null || calMonth.Status !=4)
|
|
if (calMonth != null || calMonth.Status !=4)
|
|
{
|
|
{
|
|
- var retList = CalMyStatistics(year, month);
|
|
|
|
|
|
+ var retList = _CalMyStatistics(calMonth);
|
|
|
|
|
|
using (var t = Context.Database.BeginTransaction())
|
|
using (var t = Context.Database.BeginTransaction())
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
|
|
+ Context.SaveChanges();
|
|
foreach (var obj in retList)
|
|
foreach (var obj in retList)
|
|
{
|
|
{
|
|
obj.CalMonthId = calMonth.Id;
|
|
obj.CalMonthId = calMonth.Id;
|
|
@@ -1387,6 +1600,7 @@ namespace wispro.sp.api.Controllers
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 计算指定用户,指定年月的绩效统计信息
|
|
/// 计算指定用户,指定年月的绩效统计信息
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -1423,7 +1637,18 @@ namespace wispro.sp.api.Controllers
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- retList = _CalMyStatistics(calMonth, userid);
|
|
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ retList = _CalMyStatistics(calMonth, userid);
|
|
|
|
+ }
|
|
|
|
+ catch(Exception ex)
|
|
|
|
+ {
|
|
|
|
+ StreamWriter sw = System.IO.File.AppendText("c:\\temp\\log.txt");
|
|
|
|
+ sw.WriteLine($"{ex.Message}");
|
|
|
|
+ sw.Flush();
|
|
|
|
+ sw.Close();
|
|
|
|
+ sw.Dispose();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// Set cache options.
|
|
// Set cache options.
|
|
@@ -1431,15 +1656,28 @@ namespace wispro.sp.api.Controllers
|
|
// Keep in cache for this time, reset time if accessed.
|
|
// Keep in cache for this time, reset time if accessed.
|
|
.SetSlidingExpiration(TimeSpan.FromHours(1));
|
|
.SetSlidingExpiration(TimeSpan.FromHours(1));
|
|
|
|
|
|
|
|
+ foreach(var temObj in (List<StaffStatistics>)retList)
|
|
|
|
+ {
|
|
|
|
+ temObj.CalMonth.PerformanceItems = null;
|
|
|
|
+ }
|
|
|
|
+
|
|
// Save data in cache.
|
|
// Save data in cache.
|
|
MyMemoryCache.SetValue(strKey, retList);
|
|
MyMemoryCache.SetValue(strKey, retList);
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
return (List<StaffStatistics>)retList;
|
|
return (List<StaffStatistics>)retList;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- return (List<StaffStatistics>)retList;
|
|
|
|
|
|
+ var temList = (List<StaffStatistics>)retList;
|
|
|
|
+ foreach (var temObj in temList)
|
|
|
|
+ {
|
|
|
|
+ temObj.CalMonth.PerformanceItems = null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return temList;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|