|
@@ -867,6 +867,37 @@ namespace wispro.sp.api.Controllers
|
|
|
result.fileTask.Finished = true;
|
|
|
}
|
|
|
|
|
|
+ private List<StaffStatistics> _calMyOtherStatstics(CalMonth calMonth,int? userid)
|
|
|
+ {
|
|
|
+ var retList = Context.AllocationRatios.Where(s=>s.Item.CalMonth.Id == calMonth.Id);
|
|
|
+
|
|
|
+ if(userid != null)
|
|
|
+ {
|
|
|
+ retList = retList.Where(s=>s.PersonId == userid);
|
|
|
+ }
|
|
|
+
|
|
|
+ var retData = retList.GroupBy(s => new { s.PersonId })
|
|
|
+ .Select(g => new
|
|
|
+ {
|
|
|
+ StaffId = g.Key.PersonId,
|
|
|
+ FinianlPoint = g.Sum(s => s.ActualAmount),
|
|
|
+ });
|
|
|
+
|
|
|
+ List<StaffStatistics> temList = new List<StaffStatistics>();
|
|
|
+ foreach (var key in retData)
|
|
|
+ {
|
|
|
+ temList.Add(new StaffStatistics()
|
|
|
+ {
|
|
|
+ StaffId = key.StaffId,
|
|
|
+ CalMonthId = calMonth.Id,
|
|
|
+ jxType = "其他新申请",
|
|
|
+ FinianlPoint = key.FinianlPoint
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return temList;
|
|
|
+ }
|
|
|
+
|
|
|
private List<StaffStatistics> _CalMyStatistics(CalMonth calMonth, int? userid = null)
|
|
|
{
|
|
|
var retList = Context.StaffStatistics.Where(s => s.CalMonthId == calMonth.Id);
|
|
@@ -2008,13 +2039,15 @@ namespace wispro.sp.api.Controllers
|
|
|
|
|
|
Context.SaveChanges();
|
|
|
|
|
|
- _calNDItemJx(new PerformanceItem() { Id = allocationRatios[0].ItemId }, Context);
|
|
|
+ var item = Context.PerformanceItems.Where(i => i.Id == allocationRatios[0].ItemId).FirstOrDefault<PerformanceItem>();
|
|
|
+ _calItemJX(item, Context);
|
|
|
|
|
|
t.Commit();
|
|
|
}
|
|
|
- catch
|
|
|
+ catch(Exception ex)
|
|
|
{
|
|
|
t.Rollback();
|
|
|
+ throw new ApplicationException(ex.Message);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2096,7 +2129,11 @@ namespace wispro.sp.api.Controllers
|
|
|
}
|
|
|
private void _calItemJX(PerformanceItem Item, spDbContext spDb)
|
|
|
{
|
|
|
- if(Item.Type == "其他新申请")
|
|
|
+ var oldJxList = spDb.StaffStatistics.Where(p => p.ItemId == Item.Id);
|
|
|
+ spDb.StaffStatistics.RemoveRange(oldJxList);
|
|
|
+ spDb.SaveChanges();
|
|
|
+
|
|
|
+ if (Item.Type == "其他新申请")
|
|
|
{
|
|
|
_calNDItemJx(Item, spDb);
|
|
|
return;
|
|
@@ -2107,9 +2144,7 @@ namespace wispro.sp.api.Controllers
|
|
|
|
|
|
var jxList = _calItemJX(verifyCoefficients, Item, spDb);
|
|
|
|
|
|
- var oldJxList = spDb.StaffStatistics.Where(p => p.ItemId == Item.Id);
|
|
|
- spDb.StaffStatistics.RemoveRange(oldJxList);
|
|
|
- spDb.SaveChanges();
|
|
|
+
|
|
|
foreach (var jx in jxList)
|
|
|
{
|
|
|
if (jx.totalBasePoint == 0)
|
|
@@ -2677,7 +2712,13 @@ namespace wispro.sp.api.Controllers
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return _CalMyStatistics(calMonth, userid);
|
|
|
+ List<StaffStatistics> retList = _CalMyStatistics(calMonth, userid);
|
|
|
+ List<StaffStatistics> otherList = _calMyOtherStatstics(calMonth, userid);
|
|
|
+ if (otherList != null)
|
|
|
+ {
|
|
|
+ retList.AddRange(otherList);
|
|
|
+ }
|
|
|
+ return retList;
|
|
|
|
|
|
#region old code
|
|
|
//if (calMonth.Status == 4)
|
|
@@ -3127,7 +3168,7 @@ namespace wispro.sp.api.Controllers
|
|
|
{
|
|
|
if (queryFilter.DoingOrReview == 0)
|
|
|
{
|
|
|
- response = new spDbContext().PerformanceItems.Where<PerformanceItem>(dynamicWhere).Where(s => (s.ItemStaffs.Where<ItemStaff>(iStaff => iStaff.DoPerson.Id == queryFilter.userId).Count() > 0));
|
|
|
+ response = new spDbContext().PerformanceItems.Where<PerformanceItem>(dynamicWhere).Where(s => (s.ItemStaffs.Where<ItemStaff>(iStaff => iStaff.DoPerson.Id == queryFilter.userId).Count() > 0) || (s.ExternalHandlerId == queryFilter.userId && s.Type=="其他新申请"));
|
|
|
}
|
|
|
else
|
|
|
{
|