Commit 5b726456 authored by 吴春's avatar 吴春

提交okr评论

parent 9c6f6bc2
...@@ -50,6 +50,62 @@ namespace Edu.Common.Plugin ...@@ -50,6 +50,62 @@ namespace Edu.Common.Plugin
#endregion #endregion
#region "日期相关" #region "日期相关"
public static string DateFormatToString(DateTime dt)
{
//TimeSpan表示时间间隔
TimeSpan span = (DateTime.Now - dt).Duration();//表示取timespan绝对值
//if (span.TotalDays > 60)
//{
// return dt.ToString("yyyy-MM-dd");
//}
//else if (span.TotalDays > 30)
//{
// return "1个月前";
//}
//else if (span.TotalDays > 14)
//{
// return "2周前";
//}
if (dt.Year == DateTime.Now.Year)
{
if (span.TotalDays > 7)
{
return dt.ToString("yyyy-MM-dd");
}
else if (span.TotalDays > 1)
{
return string.Format("{0}天前", (int)Math.Floor(span.TotalDays));
}
else if (span.TotalHours > 1)
{
return string.Format("{0}小时前", (int)Math.Floor(span.TotalHours));
}
else if (span.TotalMinutes > 1)
{
return string.Format("{0}分钟前", (int)Math.Floor(span.TotalMinutes));
}
else if (span.TotalSeconds >= 1)
{
return string.Format("{0}秒前", (int)Math.Floor(span.TotalSeconds));
}
else
{
return "1秒前";
}
}
else
{
return dt.ToString("yyyy-MM-dd");
}
}
/// <summary> /// <summary>
/// 获取星期的字符串 /// 获取星期的字符串
/// </summary> /// </summary>
...@@ -472,7 +528,8 @@ namespace Edu.Common.Plugin ...@@ -472,7 +528,8 @@ namespace Edu.Common.Plugin
{ {
TotalDay = Saturday + Sunday + 2; TotalDay = Saturday + Sunday + 2;
} }
else { else
{
TotalDay = Saturday + Sunday + 1; TotalDay = Saturday + Sunday + 1;
} }
} }
......
...@@ -9,6 +9,24 @@ namespace Edu.Model.ViewModel.OKR ...@@ -9,6 +9,24 @@ namespace Edu.Model.ViewModel.OKR
[Serializable] [Serializable]
public class RB_OKR_Comment_ViewModel : Model.Entity.OKR.RB_OKR_Comment public class RB_OKR_Comment_ViewModel : Model.Entity.OKR.RB_OKR_Comment
{ {
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 创建人头像
/// </summary>
public string CreateByIco { get; set; }
/// <summary>
/// 操作人
/// </summary>
public string UpdateByName { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public string CreateTimeStr { get; set; }
} }
} }
\ No newline at end of file
...@@ -104,7 +104,8 @@ namespace Edu.Module.OKR ...@@ -104,7 +104,8 @@ namespace Edu.Module.OKR
} }
}; };
bool flag = oKR_PeriodConfigRepository.Update(keyValues, wheres); bool flag = oKR_PeriodConfigRepository.Update(keyValues, wheres);
if (flag) { if (flag)
{
//记录日志 //记录日志
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog() changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{ {
...@@ -120,14 +121,17 @@ namespace Edu.Module.OKR ...@@ -120,14 +121,17 @@ namespace Edu.Module.OKR
} }
return flag ? "" : "失败了,请联系管理"; return flag ? "" : "失败了,请联系管理";
} }
else { else
{
//验证是否存在 //验证是否存在
var model = oKR_PeriodConfigRepository.GetList(new RB_OKR_PeriodConfig_ViewModel() { Group_Id = userInfo.Group_Id }).FirstOrDefault(); var model = oKR_PeriodConfigRepository.GetList(new RB_OKR_PeriodConfig_ViewModel() { Group_Id = userInfo.Group_Id }).FirstOrDefault();
if (model != null) { if (model != null)
{
return "已存在配置"; return "已存在配置";
} }
bool flag = oKR_PeriodConfigRepository.Insert(dmodel) > 0; bool flag = oKR_PeriodConfigRepository.Insert(dmodel) > 0;
if (flag) { if (flag)
{
//生成对应期数 //生成对应期数
oKR_PeriodRepository.Insert(new Model.Entity.OKR.RB_OKR_Period() oKR_PeriodRepository.Insert(new Model.Entity.OKR.RB_OKR_Period()
{ {
...@@ -144,7 +148,8 @@ namespace Edu.Module.OKR ...@@ -144,7 +148,8 @@ namespace Edu.Module.OKR
UpdateBy = dmodel.UpdateBy, UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now UpdateTime = DateTime.Now
}); });
if (dmodel.YearOKR == 1) { if (dmodel.YearOKR == 1)
{
//今年 //今年
oKR_PeriodRepository.Insert(new Model.Entity.OKR.RB_OKR_Period() oKR_PeriodRepository.Insert(new Model.Entity.OKR.RB_OKR_Period()
{ {
...@@ -203,9 +208,11 @@ namespace Edu.Module.OKR ...@@ -203,9 +208,11 @@ namespace Edu.Module.OKR
public List<RB_OKR_Remind_ViewModel> GetOKRRemindList(int group_Id) public List<RB_OKR_Remind_ViewModel> GetOKRRemindList(int group_Id)
{ {
var list = oKR_RemindRepository.GetList(new RB_OKR_Remind_ViewModel() { Group_Id = group_Id }); var list = oKR_RemindRepository.GetList(new RB_OKR_Remind_ViewModel() { Group_Id = group_Id });
for (var i = 1; i <= 4; i++) { for (var i = 1; i <= 4; i++)
{
var model = list.Where(x => x.Type == i).FirstOrDefault(); var model = list.Where(x => x.Type == i).FirstOrDefault();
if (model == null) { if (model == null)
{
list.Add(new RB_OKR_Remind_ViewModel() list.Add(new RB_OKR_Remind_ViewModel()
{ {
Days = "", Days = "",
...@@ -246,7 +253,8 @@ namespace Edu.Module.OKR ...@@ -246,7 +253,8 @@ namespace Edu.Module.OKR
} }
return flag ? "" : "出错啦,请联系管理员"; return flag ? "" : "出错啦,请联系管理员";
} }
else { else
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_OKR_Remind_ViewModel.Days),dmodel.Days}, { nameof(RB_OKR_Remind_ViewModel.Days),dmodel.Days},
{ nameof(RB_OKR_Remind_ViewModel.Time),dmodel.Time}, { nameof(RB_OKR_Remind_ViewModel.Time),dmodel.Time},
...@@ -261,7 +269,8 @@ namespace Edu.Module.OKR ...@@ -261,7 +269,8 @@ namespace Edu.Module.OKR
} }
}; };
bool flag = oKR_RemindRepository.Update(keyValues, wheres); bool flag = oKR_RemindRepository.Update(keyValues, wheres);
if (flag) { if (flag)
{
//记录日志 //记录日志
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog() changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{ {
...@@ -292,7 +301,8 @@ namespace Edu.Module.OKR ...@@ -292,7 +301,8 @@ namespace Edu.Module.OKR
{ {
return false; return false;
} }
else { else
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_OKR_Remind_ViewModel.Enable),model.Enable == 1 ? 2 : 1} { nameof(RB_OKR_Remind_ViewModel.Enable),model.Enable == 1 ? 2 : 1}
}; };
...@@ -334,10 +344,12 @@ namespace Edu.Module.OKR ...@@ -334,10 +344,12 @@ namespace Edu.Module.OKR
public List<RB_OKR_Score_ViewModel> GetOKRScoreConfigPageList(int pageIndex, int pageSize, out long count, RB_OKR_Score_ViewModel dmodel) public List<RB_OKR_Score_ViewModel> GetOKRScoreConfigPageList(int pageIndex, int pageSize, out long count, RB_OKR_Score_ViewModel dmodel)
{ {
var list = oKR_ScoreRepository.GetPageList(pageIndex, pageSize, out count, dmodel); var list = oKR_ScoreRepository.GetPageList(pageIndex, pageSize, out count, dmodel);
if (list.Any()) { if (list.Any())
{
string ids = string.Join(",", list.Select(x => x.Id)); string ids = string.Join(",", list.Select(x => x.Id));
var dlist = oKR_ScoreDetailRepository.GetList(new RB_OKR_ScoreDetail_ViewModel() { ScoreIds = ids }); var dlist = oKR_ScoreDetailRepository.GetList(new RB_OKR_ScoreDetail_ViewModel() { ScoreIds = ids });
foreach (var item in list) { foreach (var item in list)
{
item.DetailList = dlist.Where(x => x.ScoreId == item.Id).ToList(); item.DetailList = dlist.Where(x => x.ScoreId == item.Id).ToList();
} }
} }
...@@ -365,7 +377,8 @@ namespace Edu.Module.OKR ...@@ -365,7 +377,8 @@ namespace Edu.Module.OKR
} }
}; };
bool flag = oKR_ScoreRepository.Update(keyValues, wheres); bool flag = oKR_ScoreRepository.Update(keyValues, wheres);
if (flag) { if (flag)
{
var list = oKR_ScoreDetailRepository.GetList(new RB_OKR_ScoreDetail_ViewModel() { ScoreId = dmodel.Id }); var list = oKR_ScoreDetailRepository.GetList(new RB_OKR_ScoreDetail_ViewModel() { ScoreId = dmodel.Id });
//删除后 再新增 //删除后 再新增
oKR_ScoreDetailRepository.DeleteBatch(list); oKR_ScoreDetailRepository.DeleteBatch(list);
...@@ -389,16 +402,18 @@ namespace Edu.Module.OKR ...@@ -389,16 +402,18 @@ namespace Edu.Module.OKR
CreateBy = userInfo.Id, CreateBy = userInfo.Id,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
Group_Id = userInfo.Group_Id, Group_Id = userInfo.Group_Id,
LogContent = "修改OKR分数配置【"+dmodel.Id+"】", LogContent = "修改OKR分数配置【" + dmodel.Id + "】",
School_Id = userInfo.School_Id, School_Id = userInfo.School_Id,
SourceId = 0 SourceId = 0
}); });
} }
return flag ? "" : "出错了,请联系管理员"; return flag ? "" : "出错了,请联系管理员";
} }
else { else
{
int Id = oKR_ScoreRepository.Insert(dmodel); int Id = oKR_ScoreRepository.Insert(dmodel);
if (Id > 0) { if (Id > 0)
{
//增加明细 //增加明细
foreach (var item in dmodel.DetailList) foreach (var item in dmodel.DetailList)
{ {
...@@ -420,7 +435,7 @@ namespace Edu.Module.OKR ...@@ -420,7 +435,7 @@ namespace Edu.Module.OKR
CreateBy = userInfo.Id, CreateBy = userInfo.Id,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
Group_Id = userInfo.Group_Id, Group_Id = userInfo.Group_Id,
LogContent = "新增OKR分数配置【"+Id+"】", LogContent = "新增OKR分数配置【" + Id + "】",
School_Id = userInfo.School_Id, School_Id = userInfo.School_Id,
SourceId = 0 SourceId = 0
}); });
...@@ -498,7 +513,8 @@ namespace Edu.Module.OKR ...@@ -498,7 +513,8 @@ namespace Edu.Module.OKR
} }
return flag ? "" : "出错了,请联系管理员"; return flag ? "" : "出错了,请联系管理员";
} }
else { else
{
return "类型不正确"; return "类型不正确";
} }
} }
...@@ -517,7 +533,8 @@ namespace Edu.Module.OKR ...@@ -517,7 +533,8 @@ namespace Edu.Module.OKR
foreach (var item in list) foreach (var item in list)
{ {
item.IsCurrent = 2; item.IsCurrent = 2;
if (item.StartDate <= DateTime.Now && item.EndDate >= DateTime.Now) { if (item.StartDate <= DateTime.Now && item.EndDate >= DateTime.Now)
{
item.IsCurrent = 1; item.IsCurrent = 1;
} }
} }
...@@ -533,7 +550,8 @@ namespace Edu.Module.OKR ...@@ -533,7 +550,8 @@ namespace Edu.Module.OKR
public object GetOKRMyObjectiveList(int PeriodId, UserInfo userInfo) public object GetOKRMyObjectiveList(int PeriodId, UserInfo userInfo)
{ {
var list = oKR_ObjectiveRepository.GetList(new RB_OKR_Objective_ViewModel() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId, CreateBy = userInfo.Id }); var list = oKR_ObjectiveRepository.GetList(new RB_OKR_Objective_ViewModel() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId, CreateBy = userInfo.Id });
if (list.Any()) { if (list.Any())
{
string objectiveIds = string.Join(",", list.Select(x => x.Id)); string objectiveIds = string.Join(",", list.Select(x => x.Id));
//查询向上对齐 //查询向上对齐
var sdqlist = oKR_ObjectiveRepository.GetParentList(new RB_OKR_Objective_ViewModel() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId, ObjectiveIds = objectiveIds }); var sdqlist = oKR_ObjectiveRepository.GetParentList(new RB_OKR_Objective_ViewModel() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId, ObjectiveIds = objectiveIds });
...@@ -592,7 +610,8 @@ namespace Edu.Module.OKR ...@@ -592,7 +610,8 @@ namespace Edu.Module.OKR
item.IsLock = 1; item.IsLock = 1;
} }
} }
foreach (var item in list) { foreach (var item in list)
{
item.IsLock = 2; item.IsLock = 2;
if (pList.Where(x => x.ObjectiveId == item.Id).Any()) if (pList.Where(x => x.ObjectiveId == item.Id).Any())
{ {
...@@ -600,7 +619,8 @@ namespace Edu.Module.OKR ...@@ -600,7 +619,8 @@ namespace Edu.Module.OKR
} }
//结果列表 //结果列表
item.KeyResultList = krList.Where(x => x.ObjectiveId == item.Id).ToList(); item.KeyResultList = krList.Where(x => x.ObjectiveId == item.Id).ToList();
if (item.IsDefaultState == 1) { if (item.IsDefaultState == 1)
{
item.ProgressState = item.KeyResultList.Max(x => x.ProgressState); item.ProgressState = item.KeyResultList.Max(x => x.ProgressState);
} }
...@@ -608,7 +628,8 @@ namespace Edu.Module.OKR ...@@ -608,7 +628,8 @@ namespace Edu.Module.OKR
var sdqclist = sdqlist.Where(x => x.ObjectiveId == item.Id).ToList(); var sdqclist = sdqlist.Where(x => x.ObjectiveId == item.Id).ToList();
List<int> EmIdList = sdqclist.Select(x => x.CreateBy).Distinct().ToList(); List<int> EmIdList = sdqclist.Select(x => x.CreateBy).Distinct().ToList();
item.ParentList = new List<ObjectiveEmployeeModel>(); item.ParentList = new List<ObjectiveEmployeeModel>();
foreach (var qitem in EmIdList) { foreach (var qitem in EmIdList)
{
item.ParentList.Add(new ObjectiveEmployeeModel() item.ParentList.Add(new ObjectiveEmployeeModel()
{ {
AccountId = qitem, AccountId = qitem,
...@@ -748,7 +769,8 @@ namespace Edu.Module.OKR ...@@ -748,7 +769,8 @@ namespace Edu.Module.OKR
} }
}; };
bool flag = oKR_ObjectiveRepository.Update(keyValues, wheres); bool flag = oKR_ObjectiveRepository.Update(keyValues, wheres);
if (flag) { if (flag)
{
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog() changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{ {
Id = 0, Id = 0,
...@@ -763,7 +785,8 @@ namespace Edu.Module.OKR ...@@ -763,7 +785,8 @@ namespace Edu.Module.OKR
} }
return flag ? "" : "出错了,请联系管理员"; return flag ? "" : "出错了,请联系管理员";
} }
else { else
{
dmodel.Status = 4; dmodel.Status = 4;
dmodel.Sort = oKR_ObjectiveRepository.GetObjectiveMaxSort(userInfo.Group_Id, dmodel.PeriodId, userInfo.Id) + 1;//获取 当前最大的 dmodel.Sort = oKR_ObjectiveRepository.GetObjectiveMaxSort(userInfo.Group_Id, dmodel.PeriodId, userInfo.Id) + 1;//获取 当前最大的
dmodel.ScoreRuleId = 0;//获取 是否有默认 dmodel.ScoreRuleId = 0;//获取 是否有默认
...@@ -786,7 +809,8 @@ namespace Edu.Module.OKR ...@@ -786,7 +809,8 @@ namespace Edu.Module.OKR
dmodel.UpdateTime = DateTime.Now; dmodel.UpdateTime = DateTime.Now;
int Id = oKR_ObjectiveRepository.Insert(dmodel); int Id = oKR_ObjectiveRepository.Insert(dmodel);
if (Id > 0) { if (Id > 0)
{
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog() changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{ {
Id = 0, Id = 0,
...@@ -828,7 +852,8 @@ namespace Edu.Module.OKR ...@@ -828,7 +852,8 @@ namespace Edu.Module.OKR
} }
}; };
bool flag = oKR_KeyResultRepository.Update(keyValues, wheres); bool flag = oKR_KeyResultRepository.Update(keyValues, wheres);
if (flag) { if (flag)
{
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog() changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{ {
Id = 0, Id = 0,
...@@ -843,19 +868,22 @@ namespace Edu.Module.OKR ...@@ -843,19 +868,22 @@ namespace Edu.Module.OKR
} }
return flag ? "" : "出错了,请联系管理员"; return flag ? "" : "出错了,请联系管理员";
} }
else { else
{
int Sort = oKR_KeyResultRepository.GetKeyResultMaxSort(objectiveId); int Sort = oKR_KeyResultRepository.GetKeyResultMaxSort(objectiveId);
int Weight = 100; int Weight = 100;
bool IsUpdate = false; bool IsUpdate = false;
var list = oKR_KeyResultRepository.GetList(new RB_OKR_KeyResult_ViewModel() { Group_Id = userInfo.Group_Id, ObjectiveId = objectiveId }); var list = oKR_KeyResultRepository.GetList(new RB_OKR_KeyResult_ViewModel() { Group_Id = userInfo.Group_Id, ObjectiveId = objectiveId });
if (list.Any()) { if (list.Any())
{
if (list.Select(x => x.Weight).Distinct().Count() == 1) if (list.Select(x => x.Weight).Distinct().Count() == 1)
{ {
//说明权重一致 平摊到每个结果里 //说明权重一致 平摊到每个结果里
Weight = 100 / (list.Count() + 1); Weight = 100 / (list.Count() + 1);
IsUpdate = true; IsUpdate = true;
} }
else { else
{
Weight = 0; Weight = 0;
} }
} }
...@@ -881,9 +909,12 @@ namespace Edu.Module.OKR ...@@ -881,9 +909,12 @@ namespace Edu.Module.OKR
UpdateTime = DateTime.Now, UpdateTime = DateTime.Now,
Weight = Weight Weight = Weight
}); });
if (Id > 0) { if (Id > 0)
if (IsUpdate) { {
foreach (var item in list) { if (IsUpdate)
{
foreach (var item in list)
{
//修改每个结果的权重 //修改每个结果的权重
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_OKR_KeyResult_ViewModel.Weight),Weight} { nameof(RB_OKR_KeyResult_ViewModel.Weight),Weight}
...@@ -982,7 +1013,8 @@ namespace Edu.Module.OKR ...@@ -982,7 +1013,8 @@ namespace Edu.Module.OKR
} }
}; };
bool flag = oKR_ObjectiveRepository.Update(keyValues, wheres); bool flag = oKR_ObjectiveRepository.Update(keyValues, wheres);
if (flag) { if (flag)
{
//在这个范围里面的 Sort+1 //在这个范围里面的 Sort+1
oKR_ObjectiveRepository.UpdateOtherSort(objectModel1.PeriodId, objectModel1.CreateBy, objectModel1.Id, objectModel2.Sort, objectModel1.Sort); oKR_ObjectiveRepository.UpdateOtherSort(objectModel1.PeriodId, objectModel1.CreateBy, objectModel1.Id, objectModel2.Sort, objectModel1.Sort);
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog() changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
...@@ -1185,7 +1217,8 @@ namespace Edu.Module.OKR ...@@ -1185,7 +1217,8 @@ namespace Edu.Module.OKR
keyValues.Add(nameof(RB_OKR_Objective_ViewModel.UpdateTime), DateTime.Now); keyValues.Add(nameof(RB_OKR_Objective_ViewModel.UpdateTime), DateTime.Now);
LogContent = "删除OKR目标【" + objectiveId + "】"; LogContent = "删除OKR目标【" + objectiveId + "】";
} }
else { else
{
return "类型不正确"; return "类型不正确";
} }
List<WhereHelper> wheres = new List<WhereHelper>() { List<WhereHelper> wheres = new List<WhereHelper>() {
...@@ -1196,7 +1229,8 @@ namespace Edu.Module.OKR ...@@ -1196,7 +1229,8 @@ namespace Edu.Module.OKR
} }
}; };
bool flag = oKR_ObjectiveRepository.Update(keyValues, wheres); bool flag = oKR_ObjectiveRepository.Update(keyValues, wheres);
if (flag) { if (flag)
{
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog() changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{ {
Id = 0, Id = 0,
...@@ -1252,7 +1286,8 @@ namespace Edu.Module.OKR ...@@ -1252,7 +1286,8 @@ namespace Edu.Module.OKR
keyValues.Add(nameof(RB_OKR_KeyResult_ViewModel.UpdateTime), DateTime.Now); keyValues.Add(nameof(RB_OKR_KeyResult_ViewModel.UpdateTime), DateTime.Now);
LogContent = "修改OKR目标关键结果进度为高级模式【" + keyResultId + "】"; LogContent = "修改OKR目标关键结果进度为高级模式【" + keyResultId + "】";
} }
else { else
{
return "类型不正确"; return "类型不正确";
} }
List<WhereHelper> wheres = new List<WhereHelper>() { List<WhereHelper> wheres = new List<WhereHelper>() {
...@@ -1293,7 +1328,8 @@ namespace Edu.Module.OKR ...@@ -1293,7 +1328,8 @@ namespace Edu.Module.OKR
/// <returns></returns> /// <returns></returns>
public ApiResult SgetOKRMyKeyResultProgress(int keyResultId, int type, int progress, decimal startValue, decimal endValue, decimal currentValue, UserInfo userInfo) public ApiResult SgetOKRMyKeyResultProgress(int keyResultId, int type, int progress, decimal startValue, decimal endValue, decimal currentValue, UserInfo userInfo)
{ {
if (type == 1) { if (type == 1)
{
} }
...@@ -1302,5 +1338,61 @@ namespace Edu.Module.OKR ...@@ -1302,5 +1338,61 @@ namespace Edu.Module.OKR
#endregion #endregion
#region okr 任务评论
/// <summary>
/// 获取评论分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_OKR_Comment_ViewModel> GetCommentPageList(int pageIndex, int pageSize, out long rowsCount, RB_OKR_Comment_ViewModel demodel)
{
return oKR_CommentRepository.GetPageList(pageIndex, pageSize, out rowsCount, demodel);
}
/// <summary>
/// 获取评论列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_OKR_Comment_ViewModel> GetCommentList(RB_OKR_Comment_ViewModel demodel)
{
return oKR_CommentRepository.GetList(demodel);
}
/// <summary>
/// 新增/修改ork评论
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetOKRComment(RB_OKR_Comment_ViewModel model)
{
if (model.Id == 0)
{
return oKR_CommentRepository.Insert(model) > 0;
}
else
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_OKR_Comment_ViewModel.State),model.State},
{ nameof(RB_OKR_Comment_ViewModel.UpdateBy),model.UpdateBy},
{ nameof(RB_OKR_Comment_ViewModel.UpdateTime),DateTime.Now},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_OKR_Comment_ViewModel.Id),
FiledValue=model.Id,
OperatorEnum=OperatorEnum.Equal
}
};
return oKR_CommentRepository.Update(keyValues, wheres);
}
}
#endregion
} }
} }
...@@ -37,7 +37,10 @@ namespace Edu.Repository.OKR ...@@ -37,7 +37,10 @@ namespace Edu.Repository.OKR
{ {
where += $@" and {nameof(RB_OKR_Comment_ViewModel.State)} ={demodel.State}"; where += $@" and {nameof(RB_OKR_Comment_ViewModel.State)} ={demodel.State}";
} }
if (demodel.CreateBy > 0)
{
where += $@" and {nameof(RB_OKR_Comment_ViewModel.CreateBy)} ={demodel.CreateBy}";
}
string sql = $@" select * from RB_OKR_Comment where {where} order by Id desc"; string sql = $@" select * from RB_OKR_Comment where {where} order by Id desc";
return GetPage<RB_OKR_Comment_ViewModel>(pageIndex, pageSize, out rowsCount, sql).ToList(); return GetPage<RB_OKR_Comment_ViewModel>(pageIndex, pageSize, out rowsCount, sql).ToList();
} }
...@@ -62,7 +65,10 @@ namespace Edu.Repository.OKR ...@@ -62,7 +65,10 @@ namespace Edu.Repository.OKR
{ {
where += $@" and {nameof(RB_OKR_Comment_ViewModel.State)} ={demodel.State}"; where += $@" and {nameof(RB_OKR_Comment_ViewModel.State)} ={demodel.State}";
} }
if (demodel.CreateBy > 0)
{
where += $@" and {nameof(RB_OKR_Comment_ViewModel.CreateBy)} ={demodel.CreateBy}";
}
string sql = $@" select * from RB_OKR_Comment where {where} order by Id desc"; string sql = $@" select * from RB_OKR_Comment where {where} order by Id desc";
return Get<RB_OKR_Comment_ViewModel>(sql).ToList(); return Get<RB_OKR_Comment_ViewModel>(sql).ToList();
} }
......
...@@ -33,7 +33,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -33,7 +33,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetOKRPeriodConfigInfo() { public ApiResult GetOKRPeriodConfigInfo()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
var model = okrPeriodModule.GetOKRPeriodConfigInfo(userInfo.Group_Id); var model = okrPeriodModule.GetOKRPeriodConfigInfo(userInfo.Group_Id);
return ApiResult.Success("", new return ApiResult.Success("", new
...@@ -54,28 +55,36 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -54,28 +55,36 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetOKRPeriodConfigInfo() { public ApiResult SetOKRPeriodConfigInfo()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
RB_OKR_PeriodConfig_ViewModel dmodel = JsonHelper.DeserializeObject<RB_OKR_PeriodConfig_ViewModel>(RequestParm.Msg.ToString()); RB_OKR_PeriodConfig_ViewModel dmodel = JsonHelper.DeserializeObject<RB_OKR_PeriodConfig_ViewModel>(RequestParm.Msg.ToString());
if (dmodel.PeriodMonth <= 0) { if (dmodel.PeriodMonth <= 0)
{
return ApiResult.ParamIsNull("请选择周期长度"); return ApiResult.ParamIsNull("请选择周期长度");
} }
if (!dmodel.StartDate.HasValue) { if (!dmodel.StartDate.HasValue)
{
return ApiResult.ParamIsNull("请选择新周期生效时间"); return ApiResult.ParamIsNull("请选择新周期生效时间");
} }
if (!dmodel.EndDate.HasValue){ if (!dmodel.EndDate.HasValue)
{
return ApiResult.ParamIsNull("请选择新周期生效时间"); return ApiResult.ParamIsNull("请选择新周期生效时间");
} }
if (dmodel.BeforeNum <= 0) { if (dmodel.BeforeNum <= 0)
{
return ApiResult.ParamIsNull("请选择新周期出现时间"); return ApiResult.ParamIsNull("请选择新周期出现时间");
} }
if (dmodel.BeforeType <= 0) { if (dmodel.BeforeType <= 0)
{
return ApiResult.ParamIsNull("请选择类型"); return ApiResult.ParamIsNull("请选择类型");
} }
if (dmodel.YearOKR <= 0) { if (dmodel.YearOKR <= 0)
{
return ApiResult.ParamIsNull("请选择年度是否开启"); return ApiResult.ParamIsNull("请选择年度是否开启");
} }
if (dmodel.DirectorAudit <= 0) { if (dmodel.DirectorAudit <= 0)
{
return ApiResult.ParamIsNull("请选择主管审核是否开启"); return ApiResult.ParamIsNull("请选择主管审核是否开启");
} }
if (dmodel.StartDate.Value.AddMonths((int)dmodel.PeriodMonth - 1).ToString("yyyy-MM") != dmodel.EndDate.Value.ToString("yyyy-MM")) if (dmodel.StartDate.Value.AddMonths((int)dmodel.PeriodMonth - 1).ToString("yyyy-MM") != dmodel.EndDate.Value.ToString("yyyy-MM"))
...@@ -96,7 +105,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -96,7 +105,8 @@ namespace Edu.WebApi.Controllers.OKR
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(msg); return ApiResult.Failed(msg);
} }
} }
...@@ -106,7 +116,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -106,7 +116,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetOKRRemindList() { public ApiResult GetOKRRemindList()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
var list = okrPeriodModule.GetOKRRemindList(userInfo.Group_Id); var list = okrPeriodModule.GetOKRRemindList(userInfo.Group_Id);
return ApiResult.Success("", list.Select(x => new return ApiResult.Success("", list.Select(x => new
...@@ -124,16 +135,20 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -124,16 +135,20 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetOKRRemindInfo() { public ApiResult SetOKRRemindInfo()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
RB_OKR_Remind_ViewModel dmodel = JsonHelper.DeserializeObject<RB_OKR_Remind_ViewModel>(RequestParm.Msg.ToString()); RB_OKR_Remind_ViewModel dmodel = JsonHelper.DeserializeObject<RB_OKR_Remind_ViewModel>(RequestParm.Msg.ToString());
if (string.IsNullOrEmpty(dmodel.Days)) { if (string.IsNullOrEmpty(dmodel.Days))
{
return ApiResult.ParamIsNull("请选择工作日"); return ApiResult.ParamIsNull("请选择工作日");
} }
if (string.IsNullOrEmpty(dmodel.Time)) { if (string.IsNullOrEmpty(dmodel.Time))
{
return ApiResult.ParamIsNull("请选择时间"); return ApiResult.ParamIsNull("请选择时间");
} }
if (dmodel.Type <= 0) { if (dmodel.Type <= 0)
{
return ApiResult.ParamIsNull("请传递类型"); return ApiResult.ParamIsNull("请传递类型");
} }
...@@ -149,7 +164,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -149,7 +164,8 @@ namespace Edu.WebApi.Controllers.OKR
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(msg); return ApiResult.Failed(msg);
} }
} }
...@@ -159,11 +175,13 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -159,11 +175,13 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetOKRRemindEnable() { public ApiResult SetOKRRemindEnable()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
JObject prams = JObject.Parse(RequestParm.Msg.ToString()); JObject prams = JObject.Parse(RequestParm.Msg.ToString());
int Type = prams.GetInt("Type", 0); int Type = prams.GetInt("Type", 0);
if (Type <= 0) { if (Type <= 0)
{
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
...@@ -172,7 +190,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -172,7 +190,8 @@ namespace Edu.WebApi.Controllers.OKR
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -182,7 +201,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -182,7 +201,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetOKRScoreConfigPageList() { public ApiResult GetOKRScoreConfigPageList()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString()); var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var dmodel = JsonHelper.DeserializeObject<RB_OKR_Score_ViewModel>(RequestParm.Msg.ToString()); var dmodel = JsonHelper.DeserializeObject<RB_OKR_Score_ViewModel>(RequestParm.Msg.ToString());
...@@ -211,27 +231,35 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -211,27 +231,35 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetOKRScoreConfigInfo() { public ApiResult SetOKRScoreConfigInfo()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
RB_OKR_Score_ViewModel dmodel = JsonHelper.DeserializeObject<RB_OKR_Score_ViewModel>(RequestParm.Msg.ToString()); RB_OKR_Score_ViewModel dmodel = JsonHelper.DeserializeObject<RB_OKR_Score_ViewModel>(RequestParm.Msg.ToString());
if (string.IsNullOrEmpty(dmodel.Name)) { if (string.IsNullOrEmpty(dmodel.Name))
{
return ApiResult.ParamIsNull("请传递规则名称"); return ApiResult.ParamIsNull("请传递规则名称");
} }
if (dmodel.DetailList == null || !dmodel.DetailList.Any()) { if (dmodel.DetailList == null || !dmodel.DetailList.Any())
{
return ApiResult.ParamIsNull("请传递分数明细"); return ApiResult.ParamIsNull("请传递分数明细");
} }
decimal min = 0; decimal min = 0;
foreach (var item in dmodel.DetailList) { foreach (var item in dmodel.DetailList)
if (string.IsNullOrEmpty(item.Name)) { {
if (string.IsNullOrEmpty(item.Name))
{
return ApiResult.ParamIsNull("请传递颜色名称"); return ApiResult.ParamIsNull("请传递颜色名称");
} }
if (item.ScoreMin < 0 || item.ScoreMin >= 1) { if (item.ScoreMin < 0 || item.ScoreMin >= 1)
{
return ApiResult.ParamIsNull("分数有误"); return ApiResult.ParamIsNull("分数有误");
} }
if (item.ScoreMax <= 0 || item.ScoreMax > 1) { if (item.ScoreMax <= 0 || item.ScoreMax > 1)
{
return ApiResult.ParamIsNull("分数有误"); return ApiResult.ParamIsNull("分数有误");
} }
if (item.ScoreMax < item.ScoreMin) { if (item.ScoreMax < item.ScoreMin)
{
return ApiResult.ParamIsNull("分数有误"); return ApiResult.ParamIsNull("分数有误");
} }
if (min == 0) if (min == 0)
...@@ -241,7 +269,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -241,7 +269,8 @@ namespace Edu.WebApi.Controllers.OKR
return ApiResult.ParamIsNull("分数有交集"); return ApiResult.ParamIsNull("分数有交集");
} }
} }
else { else
{
if (item.ScoreMin <= min) if (item.ScoreMin <= min)
{ {
return ApiResult.ParamIsNull("分数有交集"); return ApiResult.ParamIsNull("分数有交集");
...@@ -264,7 +293,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -264,7 +293,8 @@ namespace Edu.WebApi.Controllers.OKR
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -274,12 +304,14 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -274,12 +304,14 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetOKRScoreConfigState() { public ApiResult SetOKRScoreConfigState()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString()); JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int ScoreId = parms.GetInt("ScoreId", 0); int ScoreId = parms.GetInt("ScoreId", 0);
int Type = parms.GetInt("Type", 1);// 类型 1设置默认 2删除 int Type = parms.GetInt("Type", 1);// 类型 1设置默认 2删除
if (ScoreId <= 0) { if (ScoreId <= 0)
{
return ApiResult.ParamIsNull("请传递id"); return ApiResult.ParamIsNull("请传递id");
} }
...@@ -288,7 +320,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -288,7 +320,8 @@ namespace Edu.WebApi.Controllers.OKR
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -342,7 +375,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -342,7 +375,8 @@ namespace Edu.WebApi.Controllers.OKR
/// 获取周期列表 /// 获取周期列表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public ApiResult GetOKRPeriodList() { public ApiResult GetOKRPeriodList()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
var list = okrPeriodModule.GetOKRPeriodList(userInfo.Group_Id); var list = okrPeriodModule.GetOKRPeriodList(userInfo.Group_Id);
return ApiResult.Success("", list.Select(x => new return ApiResult.Success("", list.Select(x => new
...@@ -361,11 +395,13 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -361,11 +395,13 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetOKRMyObjectiveList() { public ApiResult GetOKRMyObjectiveList()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString()); JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0); int PeriodId = parms.GetInt("PeriodId", 0);
if (PeriodId <= 0) { if (PeriodId <= 0)
{
return ApiResult.ParamIsNull("请传递周期id"); return ApiResult.ParamIsNull("请传递周期id");
} }
var list = okrPeriodModule.GetOKRMyObjectiveList(PeriodId, userInfo); var list = okrPeriodModule.GetOKRMyObjectiveList(PeriodId, userInfo);
...@@ -377,13 +413,16 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -377,13 +413,16 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SgetOKRMyObjectiveInfo() { public ApiResult SgetOKRMyObjectiveInfo()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
RB_OKR_Objective_ViewModel dmodel = JsonHelper.DeserializeObject<RB_OKR_Objective_ViewModel>(RequestParm.Msg.ToString()); RB_OKR_Objective_ViewModel dmodel = JsonHelper.DeserializeObject<RB_OKR_Objective_ViewModel>(RequestParm.Msg.ToString());
if (string.IsNullOrEmpty(dmodel.Title)) { if (string.IsNullOrEmpty(dmodel.Title))
{
return ApiResult.ParamIsNull("请输入Objective"); return ApiResult.ParamIsNull("请输入Objective");
} }
if (dmodel.PeriodId <= 0) { if (dmodel.PeriodId <= 0)
{
return ApiResult.ParamIsNull("请传递周期id"); return ApiResult.ParamIsNull("请传递周期id");
} }
...@@ -392,7 +431,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -392,7 +431,8 @@ namespace Edu.WebApi.Controllers.OKR
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(msg); return ApiResult.Failed(msg);
} }
} }
...@@ -402,16 +442,19 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -402,16 +442,19 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SgetOKRMyKeyResultInfo() { public ApiResult SgetOKRMyKeyResultInfo()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString()); JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int KeyResultId = parms.GetInt("KeyResultId", 0); int KeyResultId = parms.GetInt("KeyResultId", 0);
int ObjectiveId = parms.GetInt("ObjectiveId", 0); int ObjectiveId = parms.GetInt("ObjectiveId", 0);
string Name = parms.GetStringValue("Name"); string Name = parms.GetStringValue("Name");
if (string.IsNullOrEmpty(Name)) { if (string.IsNullOrEmpty(Name))
{
return ApiResult.ParamIsNull("请传递结果值"); return ApiResult.ParamIsNull("请传递结果值");
} }
if (KeyResultId <= 0 && ObjectiveId <= 0) { if (KeyResultId <= 0 && ObjectiveId <= 0)
{
return ApiResult.ParamIsNull("结果id不正确"); return ApiResult.ParamIsNull("结果id不正确");
} }
...@@ -420,7 +463,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -420,7 +463,8 @@ namespace Edu.WebApi.Controllers.OKR
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(msg); return ApiResult.Failed(msg);
} }
} }
...@@ -430,18 +474,22 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -430,18 +474,22 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SgetOKRMyObjectiveSort() { public ApiResult SgetOKRMyObjectiveSort()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString()); JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int ObjectiveId1 = parms.GetInt("ObjectiveId1", 0); int ObjectiveId1 = parms.GetInt("ObjectiveId1", 0);
int ObjectiveId2 = parms.GetInt("ObjectiveId2", 0);//目标的后面 int ObjectiveId2 = parms.GetInt("ObjectiveId2", 0);//目标的后面
if (ObjectiveId1 <= 0) { if (ObjectiveId1 <= 0)
{
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
if (ObjectiveId2 < 0) { if (ObjectiveId2 < 0)
{
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
if (ObjectiveId1 == ObjectiveId2) { if (ObjectiveId1 == ObjectiveId2)
{
return ApiResult.Success(); return ApiResult.Success();
} }
...@@ -496,13 +544,15 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -496,13 +544,15 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SgetOKRMyObjectiveState() { public ApiResult SgetOKRMyObjectiveState()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString()); JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int ObjectiveId = parms.GetInt("ObjectiveId", 0); int ObjectiveId = parms.GetInt("ObjectiveId", 0);
int Type = parms.GetInt("Type", 1);// 类型 1设置默认状态 2设置自定义状态 3删除 int Type = parms.GetInt("Type", 1);// 类型 1设置默认状态 2设置自定义状态 3删除
int ProgressState = parms.GetInt("ProgressState", 0); int ProgressState = parms.GetInt("ProgressState", 0);
if (ObjectiveId <= 0) { if (ObjectiveId <= 0)
{
return ApiResult.ParamIsNull("请传递目标id"); return ApiResult.ParamIsNull("请传递目标id");
} }
if (Type == 2 && ProgressState <= 0) if (Type == 2 && ProgressState <= 0)
...@@ -515,7 +565,8 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -515,7 +565,8 @@ namespace Edu.WebApi.Controllers.OKR
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(msg); return ApiResult.Failed(msg);
} }
} }
...@@ -570,6 +621,93 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -570,6 +621,93 @@ namespace Edu.WebApi.Controllers.OKR
return okrPeriodModule.SgetOKRMyKeyResultProgress(KeyResultId, Type, Progress, StartValue, EndValue, CurrentValue, userInfo); return okrPeriodModule.SgetOKRMyKeyResultProgress(KeyResultId, Type, Progress, StartValue, EndValue, CurrentValue, userInfo);
} }
#endregion
#region okr评论管理
/// <summary>
/// 获取评论分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCommentPageList()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_OKR_Comment_ViewModel()
{
School_Id = base.ParmJObj.GetInt("School_Id"),
State = base.ParmJObj.GetInt("State", 0),
PeriodId = base.ParmJObj.GetInt("PeriodId", 0)
};
query.Group_Id = base.UserInfo.Group_Id;
var list = okrPeriodModule.GetCommentPageList(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
item.CreateByIco = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.UserIcon ?? "";
}
if (item.UpdateBy > 0)
{
item.UpdateByName = UserReidsCache.GetUserLoginInfo(item.UpdateBy)?.AccountName ?? "";
}
item.CreateTimeStr = StringHelper.DateFormatToString(item.CreateTime);
}
pageModel.Count = rowsCount;
pageModel.PageData = list.Select(x => new { x.CreateByName, x.CreateByIco, x.UpdateByName, x.Content, x.CreateTimeStr });
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 新增评论状态
/// </summary>
/// <returns></returns>
public ApiResult SetComment()
{
var extModel = new RB_OKR_Comment_ViewModel()
{
School_Id = base.ParmJObj.GetInt("School_Id"),
PeriodId = base.ParmJObj.GetInt("PeriodId"),
Content = base.ParmJObj.GetStringValue("Content"),
};
extModel.CreateBy = base.UserInfo.Id;
extModel.State = 1;
extModel.CreateTime = System.DateTime.Now;
extModel.UpdateTime = System.DateTime.Now;
extModel.UpdateBy = base.UserInfo.Id;
extModel.Group_Id = base.UserInfo.Group_Id;
bool flag = okrPeriodModule.SetOKRComment(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 修改评论状态
/// </summary>
/// <returns></returns>
public ApiResult SetCommentStatus()
{
var extModel = new RB_OKR_Comment_ViewModel()
{
Id = base.ParmJObj.GetInt("Id"),
State = base.ParmJObj.GetInt("State"),
};
if (extModel.Id <= 0)
{
return ApiResult.ParamIsNull(message: "未获取到评论编号,请刷新页面重试!");
}
if (extModel.State <= 0)
{
return ApiResult.ParamIsNull(message: "请传递评论状态!");
}
extModel.UpdateBy = base.UserInfo.Id;
bool flag = okrPeriodModule.SetOKRComment(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion #endregion
} }
} }
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