Commit f4579547 authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

# Conflicts:
#	Edu.Repository/System/RB_StageRepository.cs
parents 42755e70 6d4399ef
using System;
using Edu.Common.Enum;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.System
{
/// <summary>
/// 客户阶段实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Stage
......@@ -24,10 +28,34 @@ namespace Edu.Model.Entity.System
/// </summary>
public int No { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
public int CreateTime { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 更新人
/// </summary>
public int UpdateBy { get; set; }
public int UpdateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set;}
}
}
......@@ -9,6 +9,8 @@ using VT.FW.DB;
using System.Linq;
using Edu.Model.ViewModel.User;
using Edu.Common.Plugin;
using Edu.Repository.System;
using Edu.Model.Entity.System;
namespace Edu.Module.Customer
{
......@@ -62,6 +64,11 @@ namespace Edu.Module.Customer
/// </summary>
private readonly RB_Student_AssistRepository student_AssistRepository = new RB_Student_AssistRepository();
/// <summary>
/// 客户阶段仓储层对象
/// </summary>
private readonly RB_StageRepository stageRepository = new RB_StageRepository();
#region 学员约访
......@@ -230,7 +237,8 @@ namespace Edu.Module.Customer
flag = newId > 0;
logTitle = "新增跟进";
logContent = model.Remark;
if (flag) {
if (flag)
{
//获取学生信息
//var smodel = studentRepository.GetEntity(model.StuId);
//if (smodel != null && smodel.StuStage == Common.Enum.User.StuStageEnum.NewStu)
......@@ -422,7 +430,8 @@ namespace Edu.Module.Customer
flag = newId > 0;
logTitle = "新增到访";
logContent = model.Remark;
if (flag) {
if (flag)
{
//获取学生信息
//var smodel = studentRepository.GetEntity(model.StuId);
//if (smodel != null && smodel.StuStage == Common.Enum.User.StuStageEnum.NewStu)
......@@ -464,7 +473,7 @@ namespace Edu.Module.Customer
/// <param name="Id"></param>
/// <param name="OperateId"></param>
/// <returns></returns>
public bool SetStudentVisitFeedbackModule(string Feedback, int Id, int OperateId,int IsVisit)
public bool SetStudentVisitFeedbackModule(string Feedback, int Id, int OperateId, int IsVisit)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
......@@ -476,11 +485,11 @@ namespace Edu.Module.Customer
string logContent = "";
if (oldModel.Feedback != Feedback)
{
logContent += string.Format("反馈信息:由【{0}】=>【{1}】", oldModel.Feedback, Feedback);
logContent += string.Format("反馈信息:由【{0}】=>【{1}】", oldModel.Feedback, Feedback);
}
if (oldModel.IsVisit != IsVisit)
{
logContent += string.Format("到访状态:由【{0}】=>【{1}】", oldModel.IsVisitStr, (IsVisit==1?"已到访":"未到访"));
logContent += string.Format("到访状态:由【{0}】=>【{1}】", oldModel.IsVisitStr, (IsVisit == 1 ? "已到访" : "未到访"));
}
bool flag = student_VisitRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Visit_Extend.Id), Id));
student_LogRepository.AddStuLogRepository(oldModel.StuId, Common.Enum.Log.StudentLogTypeEnum.Visit, logTitle, logContent, OperateId);
......@@ -560,7 +569,7 @@ namespace Edu.Module.Customer
/// <param name="StuId"></param>
/// <param name="AssistList"></param>
/// <returns></returns>
public bool SetStudentAssistModule(int StuId, RB_Student_Assist_Extend model,int Uid)
public bool SetStudentAssistModule(int StuId, RB_Student_Assist_Extend model, int Uid)
{
bool flag = true;
string logTitle = "协助人员";
......@@ -589,9 +598,9 @@ namespace Edu.Module.Customer
}
if (oldModel.AssistType != model.AssistType)
{
logContent += string.Format("修改协同类型:【0】=>【{1}】", oldModel.AssistType.ToName(),model.AssistType.ToName());
logContent += string.Format("修改协同类型:【0】=>【{1}】", oldModel.AssistType.ToName(), model.AssistType.ToName());
}
flag= student_AssistRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Assist_Extend.Id), model.Id));
flag = student_AssistRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Assist_Extend.Id), model.Id));
}
else
{
......@@ -600,7 +609,7 @@ namespace Edu.Module.Customer
model.Id = newId;
flag = newId > 0;
}
student_LogRepository.AddStuLogRepository(StuId, Common.Enum.Log.StudentLogTypeEnum.BasicInfo, logTitle, logContent, Uid);
return flag;
}
......@@ -640,7 +649,7 @@ namespace Edu.Module.Customer
/// <returns></returns>
public List<RB_Student_Assist_Extend> GeStudentAssistListModule(int StuId)
{
var list= student_AssistRepository.GetStudentAssistListRepository(new RB_Student_Assist_Extend()
var list = student_AssistRepository.GetStudentAssistListRepository(new RB_Student_Assist_Extend()
{
StuId = StuId
});
......@@ -656,5 +665,60 @@ namespace Edu.Module.Customer
}
return list;
}
/// <summary>
/// 获取客户阶段列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stage> GetStageListModule(RB_Stage query)
{
var list = stageRepository.GetStageListRepostory(query);
return list;
}
/// <summary>
/// 新增修改客户阶段
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetStageModule(RB_Stage model)
{
bool flag = false;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Stage.No),model.No },
{nameof(RB_Stage.StageName),model.StageName },
{nameof(RB_Stage.UpdateBy),model.UpdateBy },
{nameof(RB_Stage.UpdateTime),model.UpdateTime },
};
flag = stageRepository.Update(fileds, new WhereHelper(nameof(RB_Stage.Id), model.Id));
}
else
{
var newId = stageRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 删除客户阶段
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool RemodeStageModule(int Id)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Stage.Status),(int)DateStateEnum.Delete },
};
bool flag = stageRepository.Update(fileds, new WhereHelper(nameof(RB_Stage.Id), Id));
return flag;
}
}
}
using Edu.Model.Entity.System;
using Edu.Model.ViewModel.System;
using Edu.Common.Enum;
using Edu.Model.Entity.System;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -8,6 +10,9 @@ using VT.FW.DB.Dapper;
namespace Edu.Repository.System
{
/// <summary>
/// 客户阶段仓储层
/// </summary>
public class RB_StageRepository:BaseRepository<RB_Stage>
{
/// <summary>
......@@ -16,7 +21,7 @@ namespace Edu.Repository.System
/// <param name="gid"></param>
/// <param name="id"></param>
/// <returns></returns>
public List<RB_Stage_ViewModel> GetPeersCustomerStageCount(int gid,int id)
public List<RB_Stage_ViewModel> GetPeersCustomerStageCount(int gid, int id)
{
string sql = "select Id,StageName,`No`,(select Count(0) from rb_Student where CustomerId=@id and StuStage=a.Id) as ChildCount from rb_stage a where Group_Id=@gid order by `No`";
......@@ -26,5 +31,30 @@ namespace Edu.Repository.System
return Get<RB_Stage_ViewModel>(sql, parameters).ToList();
}
/// <summary>
/// 获取客户阶段列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stage> GetStageListRepostory(RB_Stage query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Stage AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Stage.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Stage.Group_Id), query.Group_Id);
}
}
builder.AppendFormat(" ORDER BY A.{0} ASC ", nameof(RB_Stage.No));
return Get<RB_Stage>(builder.ToString()).ToList();
}
}
}
......@@ -310,6 +310,14 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an
{
logContent += string.Format("地三方平台名称:由【{0}】=>【{1}】,", oldModel.PlatformName, model.PlatformName);
}
if (oldModel.CreateType != model.CreateType)
{
logContent += string.Format("客人来源:由【{0}】=>【{1}】,", oldModel.CreateType.ToName(), model.CreateType.ToName());
}
if (oldModel.StuSourceId != model.StuSourceId)
{
logContent += string.Format("来源人:由【{0}】=>【{1}】,", oldModel.StuSourceId, model.StuSourceId);
}
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Student_ViewModel.StuName),model.StuName.Trim() },
......@@ -334,6 +342,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.StuChannel),model.StuChannel },
{nameof(RB_Student_ViewModel.PlatformName),model.PlatformName },
{nameof(RB_Student_ViewModel.CreateType),model.CreateType },
{nameof(RB_Student_ViewModel.StuSourceId),model.StuSourceId}
};
flag = base.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), model.StuId));
......
......@@ -2,6 +2,7 @@
using Edu.Common.API;
using Edu.Common.Enum.User;
using Edu.Common.Plugin;
using Edu.Model.Entity.System;
using Edu.Model.ViewModel.Customer;
using Edu.Model.ViewModel.User;
using Edu.Module.Customer;
......@@ -479,5 +480,63 @@ namespace Edu.WebApi.Controllers.Customer
}
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取客户阶段
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetStageList()
{
var query = new RB_Stage()
{
Group_Id = base.UserInfo.Group_Id
};
var list = customerStudentModule.GetStageListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 新增修改客户阶段
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetStage()
{
var model = new RB_Stage()
{
Id = base.ParmJObj.GetInt("Id"),
StageName=base.ParmJObj.GetStringValue("StageName"),
No=base.ParmJObj.GetInt("No"),
};
if (model.No <= 0)
{
return ApiResult.Failed(message: "请填写排序编号!");
}
if (string.IsNullOrEmpty(model.StageName))
{
return ApiResult.Failed(message: "请填写阶段名称!");
}
model.CreateBy = base.UserInfo.Id;
model.UpdateBy = base.UserInfo.Id;
model.CreateTime = DateTime.Now;
model.UpdateTime = DateTime.Now;
model.Group_Id = base.UserInfo.Group_Id;
model.Status = Common.Enum.DateStateEnum.Normal;
bool flag = customerStudentModule.SetStageModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 根据编号删除客户阶段
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult RemoveStage()
{
var Id = base.ParmJObj.GetInt("Id");
bool flag = customerStudentModule.RemodeStageModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
}
}
......@@ -787,12 +787,10 @@ namespace Edu.WebApi.Controllers.User
StuStage = (StuStageEnum)base.ParmJObj.GetInt("StuStage"),
StuChannel = (StuChannelEnum)base.ParmJObj.GetInt("StuChannel"),
PlatformName = base.ParmJObj.GetStringValue("PlatformName"),
CreateType=(StuCreateTypeEnum)base.ParmJObj.GetInt("CreateType"),
StuSourceId=base.ParmJObj.GetInt("StuSourceId"),
};
if (extModel.StuId == 0)
{
extModel.CreateType = StuCreateTypeEnum.EmployeeInput;
}
if (string.IsNullOrEmpty(extModel.StuTel))
{
return ApiResult.Failed("请填写手机号码!");
......
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