Commit 9ededce9 authored by 黄奎's avatar 黄奎

页面修改

parent 0dcb48d2
......@@ -10,5 +10,19 @@ namespace Edu.Model.ViewModel.DataStatistics
/// </summary>
public class RB_Consultant_Goal_Extend : RB_Consultant_Goal
{
/// <summary>
/// 部门名称
/// </summary>
public string DeptName { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 创建时间字符串
/// </summary>
public string CreateTimeStr { get { return Common.ConvertHelper.FormatTime(this.CreateTime); } }
}
}
......@@ -66,6 +66,11 @@ namespace Edu.Module.Customer
/// </summary>
private readonly RB_Consultant_GoalRepository consultant_GoalRepository = new RB_Consultant_GoalRepository();
/// <summary>
/// 部门仓储层对象
/// </summary>
private readonly RB_DepartmentRepository departmentRepository = new RB_DepartmentRepository();
/// <summary>
/// 清除数据
/// </summary>
......@@ -732,6 +737,22 @@ namespace Edu.Module.Customer
public List<RB_Consultant_Goal_Extend> GetConsultantGoalPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Consultant_Goal_Extend query)
{
var list = consultant_GoalRepository.GetConsultantGoalPageRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count > 0)
{
var deptList = new List<RB_Department_ViewModel>();
string deptIds = string.Join(",", list.Select(qitem => qitem.Dept_Id));
if (!string.IsNullOrEmpty(deptIds))
{
deptList= departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel()
{
QDeptIds = deptIds
});
}
foreach (var item in list)
{
item.DeptName = deptList?.FirstOrDefault(qitem => qitem.DeptId == item.Dept_Id)?.DeptName ?? "";
}
}
return list;
}
......@@ -761,6 +782,7 @@ namespace Edu.Module.Customer
{ nameof(RB_Consultant_Goal_Extend.YearStr),model.YearStr},
{ nameof(RB_Consultant_Goal_Extend.MonthStr),model.MonthStr},
{ nameof(RB_Consultant_Goal_Extend.GoalMoney),model.GoalMoney},
{ nameof(RB_Consultant_Goal_Extend.Dept_Id),model.Dept_Id},
};
flag = consultant_GoalRepository.Update(fileds, new WhereHelper(nameof(RB_Consultant_Goal_Extend.Id), model.Id));
}
......@@ -775,16 +797,37 @@ namespace Edu.Module.Customer
/// <returns></returns>
public bool AddConsultantGoalModule(List<RB_Consultant_Goal_Extend> list)
{
bool flag = false;
bool flag = true;
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
if (!flag)
var oldModel = consultant_GoalRepository.GetConsultantGoalListRepository(new RB_Consultant_Goal_Extend()
{
YearStr = item.YearStr,
MonthStr = item.MonthStr,
Dept_Id = item.Dept_Id
})?.FirstOrDefault();
item.Id = oldModel?.Id ?? 0;
if (flag)
{
var newId = consultant_GoalRepository.Insert(item);
item.Id = newId;
flag = newId > 0;
if (item.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Consultant_Goal_Extend.YearStr),item.YearStr},
{ nameof(RB_Consultant_Goal_Extend.MonthStr),item.MonthStr},
{ nameof(RB_Consultant_Goal_Extend.GoalMoney),item.GoalMoney},
{ nameof(RB_Consultant_Goal_Extend.Dept_Id),item.Dept_Id},
};
flag = consultant_GoalRepository.Update(fileds, new WhereHelper(nameof(RB_Consultant_Goal_Extend.Id), item.Id));
}
else
{
var newId = consultant_GoalRepository.Insert(item);
item.Id = newId;
flag = newId > 0;
}
}
}
}
......
......@@ -2631,9 +2631,28 @@ namespace Edu.WebApi.Controllers.User
MonthStr=base.ParmJObj.GetInt("MonthStr"),
};
query.Group_Id = base.UserInfo.Group_Id;
List<object> list = new List<object>();
var data= marketConsultantModule.GetConsultantGoalPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
if (data != null && data.Count > 0)
{
foreach (var item in data)
{
string CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
list.Add(new
{
item.Id,
item.YearStr,
item.MonthStr,
item.GoalMoney,
CreateByName,
item.CreateTimeStr,
item.Dept_Id,
item.DeptName,
});
}
}
pageModel.Count = rowsCount;
pageModel.PageData = data;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
......
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