Commit 6faf3538 authored by 黄奎's avatar 黄奎

页面修改

parent 33be192d
......@@ -9,6 +9,9 @@ namespace Edu.Model.ViewModel.User
[Serializable]
public class RB_Dictvalue_Extend : RB_Dictvalue
{
/// <summary>
/// ֵKey
/// </summary>
public string QDictKeys { get; set; }
}
}
\ No newline at end of file
......@@ -799,82 +799,80 @@ namespace Edu.Module.Customer
return student_AssistRepository.Exists(list);
}
/// <summary>
/// 推送课程顾问
/// </summary>
/// <param name="studIds"></param>
/// <param name="uid"></param>
/// <returns></returns>
public (bool result, string msg) SetStudentAssistBatchModule(string studIds,int uid)
{
var tempList = studIds.Split(',', StringSplitOptions.RemoveEmptyEntries);
//语培推送配置
var pushKey = "PUSH_STU_UNION_EMP";
var pushRule = "PUSH_STU_RULETYPE";
if (tempList.Length > 0)
//留学就业类推送配置
string studyabroad = "PUSH_STU_STUDYABROAD";
//配置列表
var dicList = dictvalueRepository.GetList(new RB_Dictvalue_Extend()
{
QDictKeys = string.Format("'{0}','{1}','{2}'", pushKey, pushRule, studyabroad)
});
var stuList = studentRepository.GetStudentListRepository(new RB_Student_ViewModel() { StuIds = studIds });
var push = dicList.Where(qitem => qitem.DictKey == pushKey).FirstOrDefault();
var rule = dicList.Where(qitem => qitem.DictKey == pushRule).FirstOrDefault();
var study= dicList.Where(qitem => qitem.DictKey == studyabroad).FirstOrDefault();
var mask = string.Empty;
if (stuList != null && stuList.Count > 0)
{
var push = dictvalueRepository.GetList(new RB_Dictvalue_Extend() { DictKey = pushKey }).FirstOrDefault();
var rule = dictvalueRepository.GetList(new RB_Dictvalue_Extend() { DictKey = pushRule }).FirstOrDefault();
var guwen = push.Content.Split(',', StringSplitOptions.RemoveEmptyEntries);
var guwenName = push.Mask.Split(',', StringSplitOptions.RemoveEmptyEntries);
if (guwen.Length > 1)
foreach (var item in stuList)
{
if (rule.Content.Equals("1"))
var model = new RB_Student_Assist_Extend()
{
var mask = string.Empty;
tempList.ToList().ForEach(x =>
{
Random ran = new Random();
var cur = ran.Next(0, guwen.Length - 1);
var model = new RB_Student_Assist_Extend()
{
Id = 0,
AssistId = int.Parse(guwen[cur]),
AssistType = Common.Enum.User.AssistTypeEnum.CourseAdviser,
StuId = int.Parse(x),
Status = Common.Enum.DateStateEnum.Normal
};
SetStudentAssistModule(int.Parse(x), model, uid);
mask += mask.Contains("," + guwenName[cur]) ? "" : "," + guwenName[cur];
});
return (true, "学员批量转课程顾问成功,已分别转给顾问:" + mask);
Id = 0,
AssistType = Common.Enum.User.AssistTypeEnum.CourseAdviser,
StuId = item.StuId,
Status = Common.Enum.DateStateEnum.Normal
};
//留学就业分配
if (study.Code.Contains(item.StuNeeds.ToString()))
{
model.AssistId = int.Parse(study.Content);
SetStudentAssistModule(item.StuId, model, uid);
mask += mask.Contains("," + study.Mask) ? "" : "," + study.Mask;
}
//语培客户分配规则
else
{
var mask = string.Empty;
tempList.ToList().ForEach(x =>
var guwen = push.Content.Split(',', StringSplitOptions.RemoveEmptyEntries);
var guwenName = push.Mask.Split(',', StringSplitOptions.RemoveEmptyEntries);
if (guwen.Length > 1)
{
var cache = CustomerRedisCache.Get();
if (cache >= guwen.Length)
if (rule.Content.Equals("1"))
{
CustomerRedisCache.Set(1);
cache = 0;
Random ran = new Random();
var cur = ran.Next(0, guwen.Length - 1);
model.AssistId = int.Parse(guwen[cur]);
SetStudentAssistModule(item.StuId, model, uid);
mask += mask.Contains("," + guwenName[cur]) ? "" : "," + guwenName[cur];
}
var model = new RB_Student_Assist_Extend()
else
{
Id = 0,
AssistId = int.Parse(guwen[cache]),
AssistType = Common.Enum.User.AssistTypeEnum.CourseAdviser,
StuId = int.Parse(x),
Status = Common.Enum.DateStateEnum.Normal
};
SetStudentAssistModule(int.Parse(x), model, uid);
mask += mask.Contains("," + guwenName[cache]) ? "" : "," + guwenName[cache];
});
return (true, "学员批量转课程顾问成功,已分别转给顾问:" + mask);
var cache = CustomerRedisCache.Get();
if (cache >= guwen.Length)
{
CustomerRedisCache.Set(1);
cache = 0;
}
model.AssistId = int.Parse(guwen[cache]);
SetStudentAssistModule(item.StuId, model, uid);
mask += mask.Contains("," + guwenName[cache]) ? "" : "," + guwenName[cache];
}
}
}
}
else
{
tempList.ToList().ForEach(x =>
{
var model = new RB_Student_Assist_Extend()
{
Id = 0,
AssistId = int.Parse(guwen[0]),
AssistType = Common.Enum.User.AssistTypeEnum.CourseAdviser,
StuId = int.Parse(x),
Status = Common.Enum.DateStateEnum.Normal
};
SetStudentAssistModule(int.Parse(x), model, uid);
});
return (true, "学员批量转课程顾问成功,已全部转给顾问:" + push.Mask);
}
return (true, "学员批量转课程顾问成功,已分别转给顾问:" + mask);
}
else
else
{
return (false, "未获取到学员信息");
}
......
......@@ -66,6 +66,11 @@ namespace Edu.Module.User
return dictvalueRepository.Update(fileds, new WhereHelper(nameof(RB_Dictvalue_Extend.DictKey), Edu.Common.Config.Notice_BaseKey));
}
/// <summary>
/// 新增修改客户分配规则
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public (int saveType,bool result,int id) SaveDictModule(RB_Dictvalue model)
{
if (model.ID > 0)
......@@ -73,7 +78,8 @@ namespace Edu.Module.User
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Dictvalue_Extend.Content),model.Content },
{nameof(RB_Dictvalue_Extend.Mask),model.Mask }
{nameof(RB_Dictvalue_Extend.Mask),model.Mask },
{nameof(RB_Dictvalue_Extend.Code),model.Code },
};
var result = dictvalueRepository.Update(fileds, new WhereHelper(nameof(RB_Dictvalue_Extend.DictKey), model.DictKey));
return (1, result, model.ID);
......
......@@ -78,6 +78,10 @@ namespace Edu.Repository.User
{
sb.AppendFormat(" AND {0}='{1}' ", nameof(RB_Dictvalue_Extend.DictKey), where.DictKey.Trim());
}
if (!string.IsNullOrEmpty(where.QDictKeys))
{
sb.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Dictvalue_Extend.DictKey), where.QDictKeys.Trim());
}
}
return Get<RB_Dictvalue_Extend>(sb.ToString()).ToList();
}
......
......@@ -934,13 +934,10 @@ namespace Edu.WebApi.Controllers.Customer
List<object> list = new List<object>();
foreach (var item in data)
{
string CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
list.Add(new
{
item.Id,
item.Name,
CreateByName,
CreateTime = Common.ConvertHelper.FormatTime(item.CreateTime),
});
}
return ApiResult.Success(data: list);
......
......@@ -143,7 +143,15 @@ namespace Edu.WebApi.Controllers.User
public ApiResult SaveDict()
{
UserInfo userInfo = base.UserInfo;
var model = JsonConvert.DeserializeObject<RB_Dictvalue_Extend>(RequestParm.Msg.ToString());
var model = new RB_Dictvalue_Extend()
{
ID = base.ParmJObj.GetInt("ID"),
Code = base.ParmJObj.GetStringValue("Code"),
Content = base.ParmJObj.GetStringValue("Content"),
DictKey = base.ParmJObj.GetStringValue("DictKey"),
Mask = base.ParmJObj.GetStringValue("Mask"),
Name = base.ParmJObj.GetStringValue("Name"),
};
model.RB_Group_id = userInfo.Group_Id;
model.RB_Branch_id = userInfo.School_Id;
model.UpdateBy = userInfo.Id;
......@@ -155,6 +163,18 @@ namespace Edu.WebApi.Controllers.User
return saveInfo.result ? ApiResult.Success("请求成功!", saveInfo.id) : ApiResult.Failed("请求失败!");
}
/// <summary>
/// 获取实体类
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetDictvalue()
{
string Key = base.ParmJObj.GetStringValue("Key");
var model= attendancemodule.GetDictValueList(base.UserInfo.Group_Id, Key)?.FirstOrDefault();
return ApiResult.Success(data: model);
}
/// <summary>
/// 获取公告设置字典实体
/// </summary>
......
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