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

页面修改

parent 0dcb48d2
...@@ -10,5 +10,19 @@ namespace Edu.Model.ViewModel.DataStatistics ...@@ -10,5 +10,19 @@ namespace Edu.Model.ViewModel.DataStatistics
/// </summary> /// </summary>
public class RB_Consultant_Goal_Extend : RB_Consultant_Goal 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 ...@@ -66,6 +66,11 @@ namespace Edu.Module.Customer
/// </summary> /// </summary>
private readonly RB_Consultant_GoalRepository consultant_GoalRepository = new RB_Consultant_GoalRepository(); private readonly RB_Consultant_GoalRepository consultant_GoalRepository = new RB_Consultant_GoalRepository();
/// <summary>
/// 部门仓储层对象
/// </summary>
private readonly RB_DepartmentRepository departmentRepository = new RB_DepartmentRepository();
/// <summary> /// <summary>
/// 清除数据 /// 清除数据
/// </summary> /// </summary>
...@@ -732,6 +737,22 @@ namespace Edu.Module.Customer ...@@ -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) 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); 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; return list;
} }
...@@ -761,6 +782,7 @@ namespace Edu.Module.Customer ...@@ -761,6 +782,7 @@ namespace Edu.Module.Customer
{ nameof(RB_Consultant_Goal_Extend.YearStr),model.YearStr}, { nameof(RB_Consultant_Goal_Extend.YearStr),model.YearStr},
{ nameof(RB_Consultant_Goal_Extend.MonthStr),model.MonthStr}, { nameof(RB_Consultant_Goal_Extend.MonthStr),model.MonthStr},
{ nameof(RB_Consultant_Goal_Extend.GoalMoney),model.GoalMoney}, { 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)); flag = consultant_GoalRepository.Update(fileds, new WhereHelper(nameof(RB_Consultant_Goal_Extend.Id), model.Id));
} }
...@@ -775,16 +797,37 @@ namespace Edu.Module.Customer ...@@ -775,16 +797,37 @@ namespace Edu.Module.Customer
/// <returns></returns> /// <returns></returns>
public bool AddConsultantGoalModule(List<RB_Consultant_Goal_Extend> list) public bool AddConsultantGoalModule(List<RB_Consultant_Goal_Extend> list)
{ {
bool flag = false; bool flag = true;
if (list != null && list.Count > 0) if (list != null && list.Count > 0)
{ {
foreach (var item in list) 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); if (item.Id > 0)
item.Id = newId; {
flag = newId > 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 ...@@ -2631,9 +2631,28 @@ namespace Edu.WebApi.Controllers.User
MonthStr=base.ParmJObj.GetInt("MonthStr"), MonthStr=base.ParmJObj.GetInt("MonthStr"),
}; };
query.Group_Id = base.UserInfo.Group_Id; 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); 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.Count = rowsCount;
pageModel.PageData = data; pageModel.PageData = list;
return ApiResult.Success(data: pageModel); 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