Commit fba2cdb8 authored by 吴春's avatar 吴春

批量转交协助人员

parent 7dc1909f
......@@ -1254,6 +1254,73 @@ namespace Edu.Module.User
return "";
}
/// <summary>
/// 协助老师转交
/// </summary>
/// <param name="userId"></param>
/// <param name="receiveId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public string SetUserLeaveTeacherCareOf(int userId, int receiveId, UserInfo userInfo)
{
var eModel = accountModule.GetEmployeeListRepository(new Employee_ViewModel() { Group_Id = userInfo.Group_Id, Id = userId }).FirstOrDefault();
var reModel = accountModule.GetEmployeeListRepository(new Employee_ViewModel() { Group_Id = userInfo.Group_Id, Id = receiveId }).FirstOrDefault();
if (eModel == null || reModel == null) { return "转交人不存在"; }
if (reModel.LeaveStatus == Common.Enum.User.LeaveStatusEnum.Departure) { return "转交人非在职状态,无法交接"; }
//查询所有的服务人员
var alist = student_AssistRepository.GetStudentAssistListRepository(new RB_Student_Assist_Extend { AssistId = userId });
if (alist.Any())
{
var trans = student_AssistRepository.DbTransaction;
try
{
foreach (var item in alist)
{
bool flag = true;
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Student_Assist_Extend.AssistId),receiveId},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName = nameof(RB_Student_Assist_Extend.Id),
FiledValue = item.Id,
OperatorEnum =OperatorEnum.Equal
}
};
flag = student_AssistRepository.Update(keyValues, wheres, trans);
if (flag)
{
//插入日志
student_LogRepository.Insert(new Model.Entity.Customer.RB_Student_Log()
{
CreateBy = userInfo.Id,
CreateTime = DateTime.Now,
CreateType = 1,
Group_Id = userInfo.Group_Id,
LogContent = "转交协助人员,由【" + eModel.EmployeeName + "(" + userId + ")" + "】转交给【" + reModel.EmployeeName + "(" + receiveId + ")" + "】",
LogId = 0,
LogTitle = "转交协助人员",
LogType = Common.Enum.Log.StudentLogTypeEnum.BasicInfo,
StuId = item.StuId
}, trans);
}
}
student_AssistRepository.DBSession.Commit();
}
catch (Exception ex)
{
LogHelper.Write(ex, "SetUserLeaveStudentCareOf");
student_AssistRepository.DBSession.Rollback();
return "转交协助老师出错了,请联系管理员";
}
}
return "";
}
#endregion
/// <summary>
......
......@@ -33,6 +33,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Assist_Extend.StuId), query.StuId);
}
if (query.AssistId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Assist_Extend.AssistId), query.AssistId);
}
if (!string.IsNullOrEmpty(query.QStuIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Student_Assist_Extend.StuId), query.QStuIds);
......@@ -67,6 +71,10 @@ WHERE a.`Status`=0 and s.Group_Id ={group_Id} and s.`Status`=0 and a.AssistId ={
return Get<RB_Student_Assist_Extend>(sql).ToList();
}
/// <summary>
/// 根据订单获取 转介绍学生的老师
/// </summary>
......
......@@ -1440,7 +1440,7 @@ namespace Edu.WebApi.Controllers.User
{
return ApiResult.ParamIsNull(message: "请传递学生编号");
}
classModule.GetStudentCurrentOrderModule(StuId, out int newClassStatus, out string classStatusName, out _, out _);
var extModel = studentModule.GetStudentModule(StuId);
var obj = new
......@@ -1643,7 +1643,7 @@ namespace Edu.WebApi.Controllers.User
StartEntryTime = base.ParmJObj.GetStringValue("StartEntryTime"),
StartLeaveTime = base.ParmJObj.GetStringValue("StartLeaveTime"),
IsLeave = base.ParmJObj.GetInt("IsLeave"),
AccountUserType=base.ParmJObj.GetInt("AccountUserType"),
AccountUserType = base.ParmJObj.GetInt("AccountUserType"),
};
query.Group_Id = base.UserInfo.Group_Id;
var list = employeeModule.GetEmployeePageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
......@@ -1724,7 +1724,7 @@ namespace Edu.WebApi.Controllers.User
Password = base.ParmJObj.GetStringValue("Password"),
UserRole = (UserRoleEnum)base.ParmJObj.GetInt("UserRole"),
IsTenCccUser = base.ParmJObj.GetInt("IsTenCccUser", 0),
AccountUserType=base.ParmJObj.GetInt("AccountUserType"),
AccountUserType = base.ParmJObj.GetInt("AccountUserType"),
};
if (!string.IsNullOrEmpty(extModel.Password.Trim()))
{
......@@ -1772,7 +1772,7 @@ namespace Edu.WebApi.Controllers.User
else
{
Common.Plugin.LogHelper.Write("SetEmployee_企业微信token请求失败");
// return ApiResult.Failed("企业微信token请求失败");
// return ApiResult.Failed("企业微信token请求失败");
}
}
//验证员工下是否有客户
......@@ -1817,7 +1817,7 @@ namespace Edu.WebApi.Controllers.User
//新增用户情况
var configmodel = departmentModule.GetWeChatConfigModel(base.UserInfo.Group_Id);
//HK 2023-06-14 新增甲鹤员工才同步到企业微信
if (configmodel != null && configmodel.Enable == 1 && configmodel.DeptEmpEnable == 1 && extModel.AccountUserType==1)
if (configmodel != null && configmodel.Enable == 1 && configmodel.DeptEmpEnable == 1 && extModel.AccountUserType == 1)
{
//获取通讯录token
TXLToken = GetEmployeeToken(base.UserInfo.Group_Id, configmodel);
......@@ -1838,7 +1838,7 @@ namespace Edu.WebApi.Controllers.User
var cccResult = await new TenCloudCCCHelper().SetUserToCCCUser(extModel);
if (!cccResult.result)
{
// return ApiResult.Failed($"同步电话坐席失败,{cccResult.message}");
// return ApiResult.Failed($"同步电话坐席失败,{cccResult.message}");
}
}
else if (oldModel.IsTenCccUser == 1 && extModel.IsTenCccUser == 0)
......@@ -2896,13 +2896,16 @@ namespace Edu.WebApi.Controllers.User
return ApiResult.ParamIsNull();
}
if (TypeIds.Contains("1")) {
if (TypeIds.Contains("1"))
{
string msg = classModule.SetUserLeaveOrderCareOf(UserId, ReceiveId, userInfo);
if (msg != "") {
if (msg != "")
{
return ApiResult.Failed("转交未完款订单失败:" + msg);
}
}
if (TypeIds.Contains("2")) {
if (TypeIds.Contains("2"))
{
string msg = studentModule.SetUserLeaveStudentCareOf(UserId, ReceiveId, userInfo);
if (msg != "")
{
......@@ -2912,6 +2915,31 @@ namespace Edu.WebApi.Controllers.User
return ApiResult.Success();
}
/// <summary>
/// 设置离职协助老师转交2024-02-04 add by:W
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetUserLeaveTearchCareOf()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int UserId = parms.GetInt("UserId", 0);//转交人
int ReceiveId = parms.GetInt("ReceiveId", 0);//接收人
if (UserId <= 0 || ReceiveId <= 0)
{
return ApiResult.ParamIsNull();
}
string msg = studentModule.SetUserLeaveTeacherCareOf(UserId, ReceiveId, userInfo);
if (msg != "")
{
return ApiResult.Failed("转交协助老师失败:" + msg);
}
return ApiResult.Success();
}
#endregion
}
}
\ No newline at end of file
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