Commit bc5dbf09 authored by liudong1993's avatar liudong1993

目标、结果更新历史

parent 45036650
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.OKR
{
/// <summary>
/// okr更新历史实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_OKR_UpdateHistory
{
/// <summary>
/// id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 类型 1目标 2结果 3进度
/// </summary>
public int Type { get; set; }
/// <summary>
/// 来源id
/// </summary>
public int SourceId { get; set; }
/// <summary>
/// 内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 集团id
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.OKR
{
/// <summary>
/// OKR更新历史扩展类
/// </summary>
[Serializable]
public class RB_OKR_UpdateHistory_ViewModel : Model.Entity.OKR.RB_OKR_UpdateHistory
{
}
}
\ No newline at end of file
......@@ -93,6 +93,10 @@ namespace Edu.Module.OKR
/// 规则关联
/// </summary>
private readonly RB_OKR_RuleRelationRepository oKR_RuleRelationRepository = new RB_OKR_RuleRelationRepository();
/// <summary>
/// 修改历史
/// </summary>
private readonly RB_OKR_UpdateHistoryRepository oKR_UpdateHistoryRepository = new RB_OKR_UpdateHistoryRepository();
#region 基础配置
......@@ -555,7 +559,7 @@ namespace Edu.Module.OKR
}
return flag;
}
}
}
/// <summary>
/// 获取分数配置
......@@ -742,6 +746,19 @@ namespace Edu.Module.OKR
return "类型不正确";
}
}
/// <summary>
/// 获取更新历史分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_OKR_UpdateHistory_ViewModel> GetOKRObjectiveUpdateHistoryList(int pageIndex, int pageSize, out long count, RB_OKR_UpdateHistory_ViewModel dmodel)
{
return oKR_UpdateHistoryRepository.GetPageList(pageIndex, pageSize, out count, dmodel);
}
#endregion
#region 规则管理
......@@ -1138,6 +1155,19 @@ namespace Edu.Module.OKR
}
};
bool flag = oKR_KeyResultRepository.Update(keyValues, wheres);
if (flag) {
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
Type = 1,
CreateBy = userInfo.Id,
CreateTime = DateTime.Now,
Group_Id = userInfo.Group_Id,
LogContent = "取消OKR结果使用规则【" + keyResultId + "】",
School_Id = userInfo.School_Id,
SourceId = 0
});
}
return flag ? "" : "出错了,请联系管理员";
}
......@@ -3536,6 +3566,10 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
if (dmodel.Id > 0)
{
var hmodel = oKR_ObjectiveRepository.GetEntity(dmodel.Id);
if (hmodel.ProgressRemark == dmodel.ProgressRemark && hmodel.Title == dmodel.Title) {
return "";
}
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_OKR_Objective_ViewModel.Title),dmodel.Title},
{ nameof(RB_OKR_Objective_ViewModel.ProgressRemark),dmodel.ProgressRemark},
......@@ -3563,6 +3597,31 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
School_Id = userInfo.School_Id,
SourceId = 0
});
if (hmodel.ProgressRemark != dmodel.ProgressRemark)
{
oKR_UpdateHistoryRepository.Insert(new Model.Entity.OKR.RB_OKR_UpdateHistory()
{
Id = 0,
Type = 3,
SourceId = dmodel.Id,
Content = dmodel.ProgressRemark,
CreateBy = userInfo.Id,
CreateTime = DateTime.Now,
Group_Id = userInfo.Group_Id
});
}
if (hmodel.Title == dmodel.Title) {
oKR_UpdateHistoryRepository.Insert(new Model.Entity.OKR.RB_OKR_UpdateHistory()
{
Id = 0,
Type = 1,
SourceId = dmodel.Id,
Content = dmodel.Title,
CreateBy = userInfo.Id,
CreateTime = DateTime.Now,
Group_Id = userInfo.Group_Id
});
}
//更新提示
Task.Run(() => AddMyEmployeeUpdateNotification(dmodel.PeriodId, userInfo));
}
......@@ -3651,6 +3710,16 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
School_Id = userInfo.School_Id,
SourceId = 0
});
oKR_UpdateHistoryRepository.Insert(new Model.Entity.OKR.RB_OKR_UpdateHistory()
{
Id = 0,
Type = 1,
SourceId = Id,
Content = dmodel.Title,
CreateBy = userInfo.Id,
CreateTime = DateTime.Now,
Group_Id = userInfo.Group_Id
});
//更新提示
Task.Run(() => AddMyEmployeeUpdateNotification(dmodel.PeriodId, userInfo));
}
......@@ -3670,6 +3739,10 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
if (keyResultId > 0)
{
var hmodel = oKR_KeyResultRepository.GetEntity(keyResultId);
if (hmodel.Name == name) {
return "";
}
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_OKR_KeyResult_ViewModel.Name),name},
{ nameof(RB_OKR_KeyResult_ViewModel.UpdateBy),userInfo.Id},
......@@ -3696,6 +3769,16 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
School_Id = userInfo.School_Id,
SourceId = 0
});
oKR_UpdateHistoryRepository.Insert(new Model.Entity.OKR.RB_OKR_UpdateHistory()
{
Id = 0,
Type = 2,
SourceId = keyResultId,
Content = name,
CreateBy = userInfo.Id,
CreateTime = DateTime.Now,
Group_Id = userInfo.Group_Id
});
//更新提示
Task.Run(() => AddMyEmployeeUpdateNotification_V2(objectiveId, userInfo));
}
......@@ -3793,6 +3876,16 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
School_Id = userInfo.School_Id,
SourceId = 0
});
oKR_UpdateHistoryRepository.Insert(new Model.Entity.OKR.RB_OKR_UpdateHistory()
{
Id = 0,
Type = 2,
SourceId = keyResultId,
Content = name,
CreateBy = userInfo.Id,
CreateTime = DateTime.Now,
Group_Id = userInfo.Group_Id
});
//更新提示
Task.Run(() => AddMyEmployeeUpdateNotification_V2(objectiveId, userInfo));
}
......
using Edu.Common.Enum;
using Edu.Model.Entity.OKR;
using Edu.Model.ViewModel.OKR;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.OKR
{
/// <summary>
/// OKR更新历史仓储层
/// </summary>
public class RB_OKR_UpdateHistoryRepository : BaseRepository<RB_OKR_UpdateHistory>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_OKR_UpdateHistory_ViewModel> GetList(RB_OKR_UpdateHistory_ViewModel demodel)
{
string where = $@" 1=1 and Status =0";
if (demodel.Group_Id > 0)
{
where += $@" and {nameof(RB_OKR_UpdateHistory.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.Type > 0)
{
where += $@" and {nameof(RB_OKR_UpdateHistory.Type)} ={demodel.Type}";
}
if (demodel.SourceId > 0)
{
where += $@" and {nameof(RB_OKR_UpdateHistory.SourceId)} ={demodel.SourceId}";
}
string sql = $@" select * from RB_OKR_UpdateHistory where {where} order by Id desc";
return Get<RB_OKR_UpdateHistory_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_OKR_UpdateHistory_ViewModel> GetPageList(int pageIndex,int pageSize,out long count,RB_OKR_UpdateHistory_ViewModel demodel)
{
string where = $@" 1=1 and Status =0";
if (demodel.Group_Id > 0)
{
where += $@" and {nameof(RB_OKR_UpdateHistory.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.Type > 0)
{
where += $@" and {nameof(RB_OKR_UpdateHistory.Type)} ={demodel.Type}";
}
if (demodel.SourceId > 0)
{
where += $@" and {nameof(RB_OKR_UpdateHistory.SourceId)} ={demodel.SourceId}";
}
string sql = $@" select * from RB_OKR_UpdateHistory where {where} order by Id desc";
return GetPage<RB_OKR_UpdateHistory_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
}
}
......@@ -709,6 +709,28 @@ namespace Edu.WebApi.Controllers.OKR
return okrPeriodModule.SgetOKRMyKeyResultDel(KeyResultId, userInfo);
}
/// <summary>
/// 获取目标/关键结果 更新历史
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRObjectiveUpdateHistoryList() {
var userInfo = base.UserInfo;
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var dmodel = JsonHelper.DeserializeObject<RB_OKR_UpdateHistory_ViewModel>(RequestParm.Msg.ToString());
dmodel.Group_Id = userInfo.Group_Id;
var list = okrPeriodModule.GetOKRObjectiveUpdateHistoryList(pageModel.PageIndex, pageModel.PageSize, out long count, dmodel);
pageModel.Count = Convert.ToInt32(count);
pageModel.PageData = list.Select(x => new
{
x.Id,
x.Content,
CreateTime = x.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")
});
return ApiResult.Success("", pageModel);
}
#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