Commit 5d9eb044 authored by liudong1993's avatar liudong1993

okrbug调整

parent f37ed9f5
...@@ -167,61 +167,91 @@ namespace Edu.Module.OKR ...@@ -167,61 +167,91 @@ namespace Edu.Module.OKR
//更新所有历史周期 //更新所有历史周期
oKR_PeriodRepository.SetPeriodHistory(userInfo.Group_Id); oKR_PeriodRepository.SetPeriodHistory(userInfo.Group_Id);
//生成对应期数 var nlist = oKR_PeriodRepository.GetList(new RB_OKR_Period_ViewModel() { Group_Id = dmodel.Group_Id, Name = dmodel.StartDate.Value.ToString("yyyy年MM月") + "-" + dmodel.EndDate.Value.ToString("yyyy年MM月") });
oKR_PeriodRepository.Insert(new Model.Entity.OKR.RB_OKR_Period() if (nlist.Any())
{ {
Id = 0, var nmodel = nlist.FirstOrDefault();
IsYear = 2, Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
Status = 0, { nameof(RB_OKR_Period_ViewModel.IsNormal),1}
Name = dmodel.StartDate.Value.ToString("yyyy年MM月") + "-" + dmodel.EndDate.Value.ToString("yyyy年MM月"), };
StartDate = dmodel.StartDate.Value, List<WhereHelper> wheres1 = new List<WhereHelper>() {
EndDate = dmodel.EndDate.Value, new WhereHelper(){
Group_Id = dmodel.Group_Id, FiledName=nameof(RB_OKR_Period_ViewModel.Id),
School_Id = dmodel.School_Id, FiledValue=nmodel.Id,
CreateBy = dmodel.CreateBy, OperatorEnum=OperatorEnum.Equal
CreateTime = DateTime.Now, }
UpdateBy = dmodel.UpdateBy, };
UpdateTime = DateTime.Now oKR_PeriodRepository.Update(keyValues1, wheres1);
}); }
else
{
//生成对应期数
oKR_PeriodRepository.Insert(new Model.Entity.OKR.RB_OKR_Period()
{
Id = 0,
IsYear = 2,
Status = 0,
Name = dmodel.StartDate.Value.ToString("yyyy年MM月") + "-" + dmodel.EndDate.Value.ToString("yyyy年MM月"),
StartDate = dmodel.StartDate.Value,
EndDate = dmodel.EndDate.Value,
Group_Id = dmodel.Group_Id,
School_Id = dmodel.School_Id,
CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now,
UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now,
IsNormal = 1
});
}
} }
if (dmodel.YearOKR == 1) if (dmodel.YearOKR == 1)
{ {
//今年 //今年
oKR_PeriodRepository.Insert(new Model.Entity.OKR.RB_OKR_Period() var nlist = oKR_PeriodRepository.GetList(new RB_OKR_Period_ViewModel() { Group_Id = dmodel.Group_Id, Name = dmodel.StartDate.Value.Year + "年度OKR" });
{ if (!nlist.Any())
Id = 0,
IsYear = 1,
Status = 0,
Name = dmodel.StartDate.Value.Year + "年度OKR",
StartDate = Convert.ToDateTime(dmodel.StartDate.Value.Year + "-01-01"),
EndDate = Convert.ToDateTime(dmodel.StartDate.Value.Year + "-01-01 23:59:59").AddYears(1).AddDays(-1),
Group_Id = dmodel.Group_Id,
School_Id = dmodel.School_Id,
CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now,
UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now
});
if (dmodel.StartDate.Value.Year != dmodel.EndDate.Value.Year)
{ {
//明年
oKR_PeriodRepository.Insert(new Model.Entity.OKR.RB_OKR_Period() oKR_PeriodRepository.Insert(new Model.Entity.OKR.RB_OKR_Period()
{ {
Id = 0, Id = 0,
IsYear = 1, IsYear = 1,
Status = 0, Status = 0,
Name = dmodel.EndDate.Value.Year + "年度OKR", Name = dmodel.StartDate.Value.Year + "年度OKR",
StartDate = Convert.ToDateTime(dmodel.EndDate.Value.Year + "-01-01"), StartDate = Convert.ToDateTime(dmodel.StartDate.Value.Year + "-01-01"),
EndDate = Convert.ToDateTime(dmodel.EndDate.Value.Year + "-01-01 23:59:59").AddYears(1).AddDays(-1), EndDate = Convert.ToDateTime(dmodel.StartDate.Value.Year + "-01-01 23:59:59").AddYears(1).AddDays(-1),
Group_Id = dmodel.Group_Id, Group_Id = dmodel.Group_Id,
School_Id = dmodel.School_Id, School_Id = dmodel.School_Id,
CreateBy = dmodel.CreateBy, CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
UpdateBy = dmodel.UpdateBy, UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now UpdateTime = DateTime.Now,
IsNormal = 1
}); });
} }
if (dmodel.StartDate.Value.Year != dmodel.EndDate.Value.Year)
{
//明年
var nextlist = oKR_PeriodRepository.GetList(new RB_OKR_Period_ViewModel() { Group_Id = dmodel.Group_Id, Name = dmodel.StartDate.Value.Year + "年度OKR" });
if (!nextlist.Any())
{
oKR_PeriodRepository.Insert(new Model.Entity.OKR.RB_OKR_Period()
{
Id = 0,
IsYear = 1,
Status = 0,
Name = dmodel.EndDate.Value.Year + "年度OKR",
StartDate = Convert.ToDateTime(dmodel.EndDate.Value.Year + "-01-01"),
EndDate = Convert.ToDateTime(dmodel.EndDate.Value.Year + "-01-01 23:59:59").AddYears(1).AddDays(-1),
Group_Id = dmodel.Group_Id,
School_Id = dmodel.School_Id,
CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now,
UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now,
IsNormal = 1
});
}
}
} }
//看最新的天数 是否满足生成下一周期 //看最新的天数 是否满足生成下一周期
if (dmodel.BeforeType == 1) if (dmodel.BeforeType == 1)
...@@ -285,7 +315,8 @@ namespace Edu.Module.OKR ...@@ -285,7 +315,8 @@ namespace Edu.Module.OKR
CreateBy = dmodel.CreateBy, CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
UpdateBy = dmodel.UpdateBy, UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now UpdateTime = DateTime.Now,
IsNormal = 1
}); });
if (dmodel.YearOKR == 1) if (dmodel.YearOKR == 1)
{ {
...@@ -306,7 +337,8 @@ namespace Edu.Module.OKR ...@@ -306,7 +337,8 @@ namespace Edu.Module.OKR
CreateBy = dmodel.CreateBy, CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
UpdateBy = dmodel.UpdateBy, UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now UpdateTime = DateTime.Now,
IsNormal = 1
}); });
} }
if (dmodel.StartDate.Value.Year != dmodel.EndDate.Value.Year) if (dmodel.StartDate.Value.Year != dmodel.EndDate.Value.Year)
...@@ -328,7 +360,8 @@ namespace Edu.Module.OKR ...@@ -328,7 +360,8 @@ namespace Edu.Module.OKR
CreateBy = dmodel.CreateBy, CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
UpdateBy = dmodel.UpdateBy, UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now UpdateTime = DateTime.Now,
IsNormal = 1
}); });
} }
} }
...@@ -1838,7 +1871,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1838,7 +1871,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = x.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
...@@ -1860,7 +1893,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1860,7 +1893,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = x.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
...@@ -2117,7 +2150,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2117,7 +2150,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = x.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
...@@ -2139,7 +2172,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2139,7 +2172,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = x.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
......
...@@ -1337,6 +1337,7 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -1337,6 +1337,7 @@ namespace Edu.WebApi.Controllers.OKR
x.Table, x.Table,
x.Field, x.Field,
x.Way, x.Way,
WayName = x.Way.ToName(),
x.State, x.State,
x.Identity, x.Identity,
x.Time, x.Time,
......
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