Commit 0f9c4dc8 authored by 黄奎's avatar 黄奎

页面修改

parent 760e4efa
...@@ -5,7 +5,19 @@ using System.Text; ...@@ -5,7 +5,19 @@ using System.Text;
namespace Edu.Model.ViewModel.Customer namespace Edu.Model.ViewModel.Customer
{ {
/// <summary>
/// 学员协助人员扩展实体类
/// </summary>
public class RB_Student_Assist_Extend : RB_Student_Assist public class RB_Student_Assist_Extend : RB_Student_Assist
{ {
/// <summary>
/// 学员编号【查询使用】
/// </summary>
public string QStuIds { get; set; }
/// <summary>
/// 协助人员名称
/// </summary>
public string AssistName { get; set; }
} }
} }
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Common.Enum.User; using Edu.Common.Enum.User;
using Edu.Model.CacheModel; using Edu.Model.CacheModel;
using Edu.Model.ViewModel.Customer;
using Edu.Model.ViewModel.Mall; using Edu.Model.ViewModel.Mall;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using Edu.Repository.Customer; using Edu.Repository.Customer;
...@@ -99,6 +100,17 @@ namespace Edu.Module.User ...@@ -99,6 +100,17 @@ namespace Edu.Module.User
{ {
CustomerId = query.CustomerId CustomerId = query.CustomerId
}); });
//协助人员列表
var assistList = student_AssistRepository.GetStudentAssistListRepository(new RB_Student_Assist_Extend()
{
QStuIds = stuIds
});
string aIds = string.Join(",", assistList.Select(qitem => qitem.AssistId));
List<RB_Account_ViewModel> accountList = new List<RB_Account_ViewModel>();
if (!string.IsNullOrEmpty(aIds))
{
accountList= accountModule.GetAccountListExtModule(new RB_Account_ViewModel() { QIds = aIds });
}
var provideList = list.Where(qitem => qitem.ProviceId > 0).Select(qitem => qitem.ProviceId).ToList(); var provideList = list.Where(qitem => qitem.ProviceId > 0).Select(qitem => qitem.ProviceId).ToList();
var cityList = list.Where(qitem => qitem.CityId > 0).Select(qitem => qitem.CityId).ToList(); var cityList = list.Where(qitem => qitem.CityId > 0).Select(qitem => qitem.CityId).ToList();
var areaList = list.Where(qitem => qitem.AreaId > 0).Select(qitem => qitem.AreaId).ToList(); var areaList = list.Where(qitem => qitem.AreaId > 0).Select(qitem => qitem.AreaId).ToList();
...@@ -139,6 +151,12 @@ namespace Edu.Module.User ...@@ -139,6 +151,12 @@ namespace Edu.Module.User
+ "/" + (destinationList?.FirstOrDefault(qitem => qitem.ID == item.CityId)?.Name ?? "") + "/" + (destinationList?.FirstOrDefault(qitem => qitem.ID == item.CityId)?.Name ?? "")
+ "/" + (destinationList?.FirstOrDefault(qitem => qitem.ID == item.AreaId)?.Name ?? ""); + "/" + (destinationList?.FirstOrDefault(qitem => qitem.ID == item.AreaId)?.Name ?? "");
var tempAssistList = assistList?.Where(qitem => qitem.StuId == item.StuId)?.ToList();
foreach (var sItem in tempAssistList)
{
sItem.AssistName = accountList?.FirstOrDefault(qitem => qitem.Id == sItem.AssistId)?.AccountName ?? "";
}
item.AssistList = tempAssistList;
} }
} }
return list; return list;
......
...@@ -31,8 +31,24 @@ WHERE 1=1 ...@@ -31,8 +31,24 @@ WHERE 1=1
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Assist_Extend.StuId), query.StuId); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Assist_Extend.StuId), query.StuId);
} }
if (!string.IsNullOrEmpty(query.QStuIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Student_Assist_Extend.StuId), query.QStuIds);
}
} }
return Get<RB_Student_Assist_Extend>(builder.ToString()).ToList(); return Get<RB_Student_Assist_Extend>(builder.ToString()).ToList();
} }
/// <summary>
/// 删除学员协同人员
/// </summary>
/// <param name="StuId"></param>
/// <returns></returns>
public bool DeleteStudentAssistRepository(int StuId)
{
string delSql = string.Format(" DELETE FROM RB_Student_Assist WHERE StuId={0} ", StuId);
return base.Execute(delSql)>0;
}
} }
} }
...@@ -173,7 +173,7 @@ WHERE 1=1 ...@@ -173,7 +173,7 @@ WHERE 1=1
} }
if (!string.IsNullOrEmpty(query.StartTime)) if (!string.IsNullOrEmpty(query.StartTime))
{ {
builder.AppendFormat(" AND t.{0}>='{1}' ", nameof(RB_Student_ViewModel.CreateTime),query.StartTime); builder.AppendFormat(" AND t.{0}>='{1}' ", nameof(RB_Student_ViewModel.CreateTime), query.StartTime);
} }
if (!string.IsNullOrEmpty(query.EndTime)) if (!string.IsNullOrEmpty(query.EndTime))
{ {
...@@ -260,7 +260,7 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an ...@@ -260,7 +260,7 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an
} }
if (oldModel.StuSex != model.StuSex) if (oldModel.StuSex != model.StuSex)
{ {
logContent += string.Format("性别:由【{0}】=>【{1}】,", oldModel.StuSex==0?"男":"女", model.StuSex == 0 ? "男" : "女"); logContent += string.Format("性别:由【{0}】=>【{1}】,", oldModel.StuSex == 0 ? "男" : "女", model.StuSex == 0 ? "男" : "女");
} }
if (oldModel.StuBirth != model.StuBirth) if (oldModel.StuBirth != model.StuBirth)
{ {
...@@ -361,13 +361,91 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an ...@@ -361,13 +361,91 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an
logTitle = "创建客户"; logTitle = "创建客户";
} }
if (model.AssistList != null && model.AssistList.Count > 0)
var oldAssistList = student_AssistRepository.GetStudentAssistListRepository(new Model.ViewModel.Customer.RB_Student_Assist_Extend()
{
StuId = model.StuId
});
List<int> ids1 = new List<int>();
if (model.AssistList != null)
{ {
var oldAssistList = student_AssistRepository.GetStudentAssistListRepository(new Model.ViewModel.Customer.RB_Student_Assist_Extend() ids1 = Common.Plugin.StringHelper.StringToListInt(string.Join(",", model.AssistList.Select(qitem => qitem.AssistId)));
}
if (oldAssistList != null)
{
List<int> ids2 = Common.Plugin.StringHelper.StringToListInt(string.Join(",", oldAssistList.Select(qitem => qitem.AssistId)));
if (ids2 != null && ids2.Count > 0)
{ {
ids1.AddRange(ids2);
}
}
string aids = string.Join(",", ids1);
List<Employee_ViewModel> empList = new List<Employee_ViewModel>();
if (!string.IsNullOrEmpty(aids))
{
empList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel()
{
QIds = aids
}); });
} }
//以前没有协同人员【直接新增】
if (oldAssistList == null || (oldAssistList != null && oldAssistList.Count == 0))
{
foreach (var item in oldAssistList)
{
student_AssistRepository.Insert(new Model.Entity.Customer.RB_Student_Assist()
{
AssistId = item.AssistId,
AssistType = item.AssistType,
StuId = model.StuId
});
logContent+=string.Format("新增协同人员:"+ empList?.FirstOrDefault(qitem=>qitem.Id==item.AssistId)?.EmployeeName);
}
}
else
{
//现在没有协同人员了【直接删除以前的协同人员】
if (model.AssistList == null || (model.AssistList != null && model.AssistList.Count == 0))
{
student_AssistRepository.DeleteStudentAssistRepository(model.StuId);
foreach (var item in oldAssistList)
{
logContent += string.Format("删除协同人员:" + empList?.FirstOrDefault(qitem => qitem.Id == item.AssistId)?.EmployeeName);
}
}
//找出差异的数据
var deleteList = oldAssistList.Where(qitem => !model.AssistList.Any(oldItem => qitem.Id == oldItem.Id)).ToList();
foreach (var dItem in deleteList)
{
if (dItem.Id > 0)
{
logContent += string.Format("删除协同人员:" + empList?.FirstOrDefault(qitem => qitem.Id == dItem.AssistId)?.EmployeeName);
student_AssistRepository.Delete(dItem.Id);
}
}
foreach (var item in model.AssistList)
{
item.StuId = model.StuId;
if (item.Id == 0)
{
logContent += string.Format("新增协同人员:" + empList?.FirstOrDefault(qitem => qitem.Id == item.AssistId)?.EmployeeName);
student_AssistRepository.Insert(item);
}
else
{
var oldModel = oldAssistList?.FirstOrDefault(qitem => qitem.Id == item.Id);
if ((oldModel?.AssistId ?? 0) != item.AssistId)
{
logContent += string.Format("修改协同人员:【0】=>【{1}】",
empList?.FirstOrDefault(qitem => qitem.Id == (oldModel?.AssistId ?? 0))?.EmployeeName,
empList?.FirstOrDefault(qitem => qitem.Id == item.AssistId)?.EmployeeName
);
}
student_AssistRepository.Update(item);
}
}
}
student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.BasicInfo, logTitle, logContent, createBy, CreateType: model.CreateType); student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.BasicInfo, logTitle, logContent, createBy, CreateType: model.CreateType);
return flag; return flag;
} }
......
...@@ -693,6 +693,10 @@ namespace Edu.WebApi.Controllers.User ...@@ -693,6 +693,10 @@ namespace Edu.WebApi.Controllers.User
item.CreateByName, item.CreateByName,
item.CreateType, item.CreateType,
CreateTypeStr = item.CreateType == 1 ? "员工录入" : "同业录入", CreateTypeStr = item.CreateType == 1 ? "员工录入" : "同业录入",
item.StuChannel,
StuChannelName= item.StuChannel.ToName(),
item.PlatformName,
item.AssistList,
}); });
} }
pageModel.Count = rowsCount; pageModel.Count = rowsCount;
......
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