Commit 60c1b9c3 authored by 黄奎's avatar 黄奎

新增客户日志修改

parent 147924e0
...@@ -33,5 +33,12 @@ namespace Edu.Common.Enum.Log ...@@ -33,5 +33,12 @@ namespace Edu.Common.Enum.Log
/// </summary> /// </summary>
[EnumField("试听")] [EnumField("试听")]
TrialLesson =4, TrialLesson =4,
/// <summary>
/// 试听
/// </summary>
[EnumField("基础资料")]
BasicInfo =5,
} }
} }
...@@ -28,6 +28,11 @@ namespace Edu.Model.Entity.Customer ...@@ -28,6 +28,11 @@ namespace Edu.Model.Entity.Customer
/// </summary> /// </summary>
public StudentLogTypeEnum LogType { get; set; } public StudentLogTypeEnum LogType { get; set; }
/// <summary>
/// 日志标题
/// </summary>
public string LogTitle { get; set; }
/// <summary> /// <summary>
/// 日志内容 /// 日志内容
/// </summary> /// </summary>
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.Customer; using Edu.Model.ViewModel.Customer;
using Edu.Repository.Customer; using Edu.Repository.Customer;
using Edu.Repository.User;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using VT.FW.DB; using VT.FW.DB;
using System.Linq;
namespace Edu.Module.Customer namespace Edu.Module.Customer
{ {
...@@ -33,6 +35,16 @@ namespace Edu.Module.Customer ...@@ -33,6 +35,16 @@ namespace Edu.Module.Customer
/// </summary> /// </summary>
private readonly RB_Student_LogRepository student_LogRepository = new RB_Student_LogRepository(); private readonly RB_Student_LogRepository student_LogRepository = new RB_Student_LogRepository();
/// <summary>
/// 校区仓储层对象
/// </summary>
private readonly RB_SchoolRepository schoolRepository = new RB_SchoolRepository();
/// <summary>
/// 员工对象仓储层对象
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
#region 学员约访 #region 学员约访
...@@ -58,8 +70,26 @@ namespace Edu.Module.Customer ...@@ -58,8 +70,26 @@ namespace Edu.Module.Customer
{ {
bool flag = false; bool flag = false;
string logContent = ""; string logContent = "";
string logTitle = "";
if (model.Id > 0) if (model.Id > 0)
{ {
var oldModel = GetStudentAppointmentModule(model.Id);
if (oldModel.AppointmentPoint != model.AppointmentPoint)
{
logContent += string.Format("约访地点:由【{0}】=>【{1}】,", oldModel.AppointmentPoint, model.AppointmentPoint);
}
if (oldModel.AppointmentTime != model.AppointmentTime)
{
logContent += string.Format("约访时间:由【{0}】=>【{1}】,", oldModel.AppointmentTime, model.AppointmentTime);
}
if (oldModel.Remark != model.Remark)
{
logContent += string.Format("备注:由【{0}】=>【{1}】,,", oldModel.Remark, model.Remark);
}
if (oldModel.Feedback != model.Feedback)
{
logContent += string.Format("反馈:由【{0}】=>【{1}】,", oldModel.Feedback, model.Feedback);
}
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Student_Appointment_Extend.AppointmentPoint),model.AppointmentPoint }, {nameof(RB_Student_Appointment_Extend.AppointmentPoint),model.AppointmentPoint },
...@@ -68,15 +98,18 @@ namespace Edu.Module.Customer ...@@ -68,15 +98,18 @@ namespace Edu.Module.Customer
{nameof(RB_Student_Appointment_Extend.Feedback),model.Feedback }, {nameof(RB_Student_Appointment_Extend.Feedback),model.Feedback },
}; };
flag = student_AppointmentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Appointment_Extend.Id), model.Id)); flag = student_AppointmentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Appointment_Extend.Id), model.Id));
logTitle = "修改学员约访";
} }
else else
{ {
var newId = student_AppointmentRepository.Insert(model); var newId = student_AppointmentRepository.Insert(model);
model.Id = newId; model.Id = newId;
flag = newId > 0; flag = newId > 0;
logTitle = "新增学员约访";
logContent = model.Remark;
} }
student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.Appointment, logContent, model.CreateBy); student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.Appointment, logTitle, logContent, model.CreateBy);
return flag; return flag;
} }
...@@ -96,14 +129,16 @@ namespace Edu.Module.Customer ...@@ -96,14 +129,16 @@ namespace Edu.Module.Customer
/// </summary> /// </summary>
/// <param name="Id"></param> /// <param name="Id"></param>
/// <returns></returns> /// <returns></returns>
public bool RemoveStudentAppointmentModule(object Id) public bool RemoveStudentAppointmentModule(object Id,int Uid)
{ {
bool flag = false; bool flag = false;
var model = GetStudentAppointmentModule(Id);
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{ nameof(RB_Student_Appointment_Extend.Status),(int)DateStateEnum.Delete} { nameof(RB_Student_Appointment_Extend.Status),(int)DateStateEnum.Delete}
}; };
flag = student_AppointmentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Appointment_Extend.Id), Id)); flag = student_AppointmentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Appointment_Extend.Id), Id));
student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.Appointment, "删除约访", "删除约访信息", Uid);
return flag; return flag;
} }
...@@ -133,21 +168,30 @@ namespace Edu.Module.Customer ...@@ -133,21 +168,30 @@ namespace Edu.Module.Customer
{ {
bool flag = false; bool flag = false;
string logContent = ""; string logContent = "";
string logTitle = "";
if (model.Id > 0) if (model.Id > 0)
{ {
var oldModel = GetStudentFollowModule(model.Id);
if (oldModel.Remark != model.Remark)
{
logContent += string.Format("跟进内容:由【{0}】=>【{1}】", oldModel.Remark, model.Remark);
}
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Student_Follow_Extend.Remark),model.Remark } {nameof(RB_Student_Follow_Extend.Remark),model.Remark }
}; };
flag = student_FollowRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Follow_Extend.Id), model.Id)); flag = student_FollowRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Follow_Extend.Id), model.Id));
logTitle = "修改跟进内容";
} }
else else
{ {
var newId = student_FollowRepository.Insert(model); var newId = student_FollowRepository.Insert(model);
model.Id = newId; model.Id = newId;
flag = newId > 0; flag = newId > 0;
logTitle = "新增跟进";
logContent = model.Remark;
} }
student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.Follow, logContent, model.CreateBy); student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.Follow, logTitle, logContent, model.CreateBy);
return flag; return flag;
} }
...@@ -167,12 +211,14 @@ namespace Edu.Module.Customer ...@@ -167,12 +211,14 @@ namespace Edu.Module.Customer
/// </summary> /// </summary>
/// <param name="Id"></param> /// <param name="Id"></param>
/// <returns></returns> /// <returns></returns>
public bool RemoveStudentFollowModule(object Id) public bool RemoveStudentFollowModule(object Id,int Uid)
{ {
var model = GetStudentFollowModule(Id);
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Student_Follow_Extend.Status), (int)DateStateEnum.Delete} {nameof(RB_Student_Follow_Extend.Status), (int)DateStateEnum.Delete}
}; };
student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.Follow, "删除跟进", "删除跟进信息", Uid);
return student_FollowRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Follow_Extend.Id), Id)); return student_FollowRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Follow_Extend.Id), Id));
} }
#endregion #endregion
...@@ -201,33 +247,43 @@ namespace Edu.Module.Customer ...@@ -201,33 +247,43 @@ namespace Edu.Module.Customer
{ {
bool flag = false; bool flag = false;
string logContent = ""; string logContent = "";
string logTitle = "";
if (model.Id > 0) if (model.Id > 0)
{ {
var oldModel = GetStudentVisitModule(model.Id); var oldModel = GetStudentVisitModule(model.Id);
logContent = "修改到访"; logTitle = "修改到访";
if (oldModel.School_Id != model.School_Id) if (oldModel.School_Id != model.School_Id)
{ {
logContent += string.Format("校区由{0}=>{1},", oldModel.School_Id, model.School_Id); var schoolList = schoolRepository.GetSchoolListRepository(new Model.ViewModel.User.RB_School_ViewModel() { QSIds = oldModel.School_Id + "," + model.School_Id });
logContent += string.Format("校区:由【{0}】=>【{1}】,",
schoolList.FirstOrDefault(qitem=>qitem.SId== oldModel.School_Id)?.SName,
schoolList.FirstOrDefault(qitem => qitem.SId == model.School_Id)?.SName);
} }
if (oldModel.Date != model.Date) if (oldModel.Date != model.Date)
{ {
logContent += string.Format("日期由{0}=>{1},", Common.ConvertHelper.FormatDate(oldModel.Date), Common.ConvertHelper.FormatDate(model.Date)); logContent += string.Format("日期:由【{0}】=>【{1}】,", Common.ConvertHelper.FormatDate(oldModel.Date), Common.ConvertHelper.FormatDate(model.Date));
} }
if (oldModel.VisitTime != model.VisitTime) if (oldModel.VisitTime != model.VisitTime)
{ {
logContent += string.Format("到访时间由{0}=>{1},", oldModel.VisitTime, model.VisitTime); logContent += string.Format("到访时间:由【{0}】=>【{1}】,", oldModel.VisitTime, model.VisitTime);
} }
if (oldModel.ReceptionPersion != model.ReceptionPersion) if (oldModel.ReceptionPersion != model.ReceptionPersion)
{ {
logContent += string.Format("接待人由{0}=>{1},", oldModel.ReceptionPersion, model.ReceptionPersion); var empList= accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel()
{
QIds = oldModel.ReceptionPersion + "," + model.ReceptionPersion
});
logContent += string.Format("接待人:由【{0}】=>【{1}】,",
empList?.FirstOrDefault(qitem => qitem.Id == oldModel.ReceptionPersion)?.EmployeeName,
empList?.FirstOrDefault(qitem => qitem.Id == model.ReceptionPersion)?.EmployeeName);
} }
if (oldModel.Remark != model.Remark) if (oldModel.Remark != model.Remark)
{ {
logContent += string.Format("备注由{0}=>{1},", oldModel.Remark, model.Remark); logContent += string.Format("备注:由【{0}】=>【{1}】,", oldModel.Remark, model.Remark);
} }
if (oldModel.Feedback != model.Feedback) if (oldModel.Feedback != model.Feedback)
{ {
logContent += string.Format("反馈信息由{0}=>{1},", oldModel.Feedback, model.Feedback); logContent += string.Format("反馈信息:由【{0}】=>【{1}】,", oldModel.Feedback, model.Feedback);
} }
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
...@@ -245,9 +301,10 @@ namespace Edu.Module.Customer ...@@ -245,9 +301,10 @@ namespace Edu.Module.Customer
var newId = student_VisitRepository.Insert(model); var newId = student_VisitRepository.Insert(model);
model.Id = newId; model.Id = newId;
flag = newId > 0; flag = newId > 0;
logContent = "新增到访"; logTitle = "新增到访";
logContent = model.Remark;
} }
student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.Visit, logContent, model.CreateBy); student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.Visit, logTitle, logContent, model.CreateBy);
return flag; return flag;
} }
...@@ -267,12 +324,14 @@ namespace Edu.Module.Customer ...@@ -267,12 +324,14 @@ namespace Edu.Module.Customer
/// </summary> /// </summary>
/// <param name="Id"></param> /// <param name="Id"></param>
/// <returns></returns> /// <returns></returns>
public bool RemoveStudentVisitModule(object Id) public bool RemoveStudentVisitModule(object Id,int Uid)
{ {
var model = GetStudentVisitModule(Id);
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Student_Visit_Extend.Status), (int)DateStateEnum.Delete} {nameof(RB_Student_Visit_Extend.Status), (int)DateStateEnum.Delete}
}; };
student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.Visit, "删除到访", "删除客户到访", Uid);
return student_VisitRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Visit_Extend.Id), Id)); return student_VisitRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Visit_Extend.Id), Id));
} }
#endregion #endregion
......
...@@ -46,20 +46,22 @@ WHERE 1=1 ...@@ -46,20 +46,22 @@ WHERE 1=1
/// </summary> /// </summary>
/// <param name="StuId">学员编号</param> /// <param name="StuId">学员编号</param>
/// <param name="LogType">日志类型</param> /// <param name="LogType">日志类型</param>
/// <param name="LogTitle">日志标题</param>
/// <param name="LogContent">日志内容</param> /// <param name="LogContent">日志内容</param>
/// <param name="CreateBy">创建人</param> /// <param name="CreateBy">创建人</param>
/// <param name="CreateType">创建人类型(1-系统用户,2-同行用户)</param> /// <param name="CreateType">创建人类型(1-系统用户,2-同行用户)</param>
/// <param name="Group_Id">集团编号</param> /// <param name="Group_Id">集团编号</param>
/// <returns></returns> /// <returns></returns>
public bool AddStuLogRepository(int StuId, StudentLogTypeEnum LogType, string LogContent, int CreateBy, int CreateType = 1, int Group_Id = 100000) public bool AddStuLogRepository(int StuId, StudentLogTypeEnum LogType,string LogTitle, string LogContent, int CreateBy, int CreateType = 1, int Group_Id = 100000)
{ {
var newModel = new RB_Student_Log_Extend() var newModel = new RB_Student_Log_Extend()
{ {
LogId = 0, LogId = 0,
StuId = StuId, StuId = StuId,
LogType = LogType, LogType = LogType,
CreateTime = DateTime.Now, LogTitle= LogTitle,
LogContent = LogContent, LogContent = LogContent,
CreateTime = DateTime.Now,
CreateType = CreateType, CreateType = CreateType,
CreateBy = CreateBy, CreateBy = CreateBy,
Group_Id = Group_Id Group_Id = Group_Id
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using Edu.Repository.Customer;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -19,6 +20,11 @@ namespace Edu.Repository.User ...@@ -19,6 +20,11 @@ namespace Edu.Repository.User
/// </summary> /// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository(); private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 学员日志仓储层对象
/// </summary>
private readonly RB_Student_LogRepository student_LogRepository = new RB_Student_LogRepository();
/// <summary> /// <summary>
/// 获取学生列表 /// 获取学生列表
/// </summary> /// </summary>
...@@ -194,8 +200,13 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an ...@@ -194,8 +200,13 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an
public bool SetStudentRepository(RB_Student_ViewModel model) public bool SetStudentRepository(RB_Student_ViewModel model)
{ {
bool flag; bool flag;
string logContent = "";
string logTitle = "";
int createBy = 0;
if (model.StuId > 0) if (model.StuId > 0)
{ {
logTitle = "修改客户";
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Student_ViewModel.StuName),model.StuName.Trim() }, {nameof(RB_Student_ViewModel.StuName),model.StuName.Trim() },
...@@ -222,6 +233,7 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an ...@@ -222,6 +233,7 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an
{nameof(RB_Student_ViewModel.StuStage),model.StuStage }, {nameof(RB_Student_ViewModel.StuStage),model.StuStage },
}; };
flag = base.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), model.StuId)); flag = base.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), model.StuId));
createBy = model.UpdateBy;
} }
else else
{ {
...@@ -246,7 +258,19 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an ...@@ -246,7 +258,19 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an
UpdateTime = DateTime.Now, UpdateTime = DateTime.Now,
Password = Common.DES.Encrypt(Common.Config.DefaultPwd) Password = Common.DES.Encrypt(Common.Config.DefaultPwd)
}); });
if (model.CreateType == 1)
{
createBy = model.CreateBy;
}
else
{
createBy = model.CustomerId;
}
logContent = "创建了该客户";
logTitle = "创建客户";
} }
student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.BasicInfo, logTitle, logContent, createBy, CreateType: model.CreateType);
return flag; return flag;
} }
} }
......
...@@ -95,7 +95,7 @@ namespace Edu.WebApi.Controllers.Customer ...@@ -95,7 +95,7 @@ namespace Edu.WebApi.Controllers.Customer
public ApiResult RemoveStudentAppointment() public ApiResult RemoveStudentAppointment()
{ {
var Id = base.ParmJObj.GetInt("Id"); var Id = base.ParmJObj.GetInt("Id");
var model = customerStudentModule.RemoveStudentAppointmentModule(Id); var model = customerStudentModule.RemoveStudentAppointmentModule(Id,base.UserInfo.Id);
return ApiResult.Success(data: model); return ApiResult.Success(data: model);
} }
...@@ -167,7 +167,7 @@ namespace Edu.WebApi.Controllers.Customer ...@@ -167,7 +167,7 @@ namespace Edu.WebApi.Controllers.Customer
public ApiResult RemoveStudentFollow() public ApiResult RemoveStudentFollow()
{ {
var Id = base.ParmJObj.GetInt("Id"); var Id = base.ParmJObj.GetInt("Id");
var model = customerStudentModule.RemoveStudentFollowModule(Id); var model = customerStudentModule.RemoveStudentFollowModule(Id,base.UserInfo.Id);
return ApiResult.Success(data: model); return ApiResult.Success(data: model);
} }
...@@ -245,7 +245,7 @@ namespace Edu.WebApi.Controllers.Customer ...@@ -245,7 +245,7 @@ namespace Edu.WebApi.Controllers.Customer
public ApiResult RemoveStudentVisit() public ApiResult RemoveStudentVisit()
{ {
var Id = base.ParmJObj.GetInt("Id"); var Id = base.ParmJObj.GetInt("Id");
var model = customerStudentModule.RemoveStudentVisitModule(Id); var model = customerStudentModule.RemoveStudentVisitModule(Id,base.UserInfo.Id);
return ApiResult.Success(data: model); return ApiResult.Success(data: model);
} }
......
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