Commit 9502602c authored by 黄奎's avatar 黄奎

1111

parent 30c19983
......@@ -2,38 +2,23 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Edu.Common.Message
{
/// <summary>
/// 消息发送
/// 消息队列帮助类
/// </summary>
public class MessageHelper
public class MessageHelper : IDisposable
{
/// <summary>
/// 获取连接
/// </summary>
/// <param name="rabbitConfig">连接配置实体</param>
/// <returns></returns>
private static ConnectionFactory GetConnectionFactory(RabbitConfig rabbitConfig)
{
ConnectionFactory factory = new ConnectionFactory
{
HostName = rabbitConfig.HostName,
//默认端口
Port = rabbitConfig.Port,
UserName = rabbitConfig.UserName,
Password = rabbitConfig.Password,
};
return factory;
}
private readonly ConnectionFactory _factory;
private IConnection _connection;
private IModel _channel;
/// <summary>
/// 发送信息
/// 构造函数
/// </summary>
/// <param name="message"></param>
public static void SendMessage(PushMessageModel message)
public MessageHelper()
{
Int32.TryParse(Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "Port"), out int Port);
RabbitConfig rabbitConfig = new RabbitConfig()
......@@ -44,62 +29,118 @@ namespace Edu.Common.Message
UserName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "UserName"),
QueenName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "QueenName"),
};
var obj = new
// 设置连接参数
_factory = new ConnectionFactory()
{
Id = 0,// 主键
message.Title,
message.Content,
message.CoverImg,
message.CategoryId,
message.Platform,
message.SendType,
message.SendTime,
message.ReceiveId,
message.JumpUrl,
message.CreateByName,
message.MsgSign,
message.MsgTemplateCode,
message.WorkMsgType,
Status = 0,
CreateTime = DateTime.Now,
AppId = Common.Config.PushAppId,
IsRead=0,
HostName = rabbitConfig.HostName,
//默认端口
Port = Port,
UserName = rabbitConfig.UserName,
Password = rabbitConfig.Password,
};
Task.Run(() =>
}
/// <summary>
/// 发送消息
/// </summary>
/// <param name="message"></param>
/// <param name="PushAppId"></param>
private void SendMessage(PushMessageModel message)
{
try
{
try
InitConnection();
Int32.TryParse(Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "Port"), out int Port);
RabbitConfig rabbitConfig = new RabbitConfig()
{
using (IConnection conn = GetConnectionFactory(rabbitConfig).CreateConnection())
{
using (IModel channel = conn.CreateModel())
{
//在MQ上定义一个持久化队列,如果名称相同不会重复创建
channel.QueueDeclare(rabbitConfig.QueenName, true, false, false, null);
byte[] buffer = Encoding.UTF8.GetBytes(Common.Plugin.JsonHelper.Serialize(obj));
IBasicProperties properties = channel.CreateBasicProperties();
properties.DeliveryMode = 2;
channel.BasicPublish("", rabbitConfig.QueenName, properties, buffer);
}
}
}
catch (Exception ex)
HostName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "HostName"),
Password = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "Password"),
Port = Port,
UserName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "UserName"),
QueenName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "QueenName"),
};
string queenName = rabbitConfig.QueenName;
var obj = new
{
Common.Plugin.LogHelper.Write(ex, "RabbitMq_SendMessage");
}
});
Id = 0,// 主键
message.Title,
message.Content,
message.CoverImg,
message.CategoryId,
message.Platform,
message.SendType,
message.SendTime,
message.ReceiveId,
message.JumpUrl,
message.CreateByName,
message.MsgSign,
message.MsgTemplateCode,
message.WorkMsgType,
Status = 0,
CreateTime = DateTime.Now,
AppId = Common.Config.PushAppId,
IsRead = 0,
};
var body = Encoding.UTF8.GetBytes(Common.Plugin.JsonHelper.Serialize(obj));
// 声明队列
_channel.QueueDeclare(queue: queenName,
durable: true,// 设置为true表示队列是持久化的
exclusive: false,
autoDelete: false,
arguments: null);
IBasicProperties properties = _channel.CreateBasicProperties();
properties.DeliveryMode = 2;
_channel.BasicPublish(exchange: "", routingKey: queenName, basicProperties: properties, body: body);
Common.Plugin.LogHelper.WriteInfo("发送企微消息:" + Common.Plugin.JsonHelper.Serialize(obj));
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "SendMessage");
}
}
/// <summary>
/// 批量推送
/// 发送消息
/// </summary>
/// <param name="msgList"></param>
public static void SendMessage(List<PushMessageModel> msgList)
/// <param name="list"></param>
/// <param name="PushAppId"></param>
public void SendMessage(List<PushMessageModel> list)
{
foreach (var item in msgList)
foreach (var item in list)
{
SendMessage(item);
}
}
/// <summary>
/// 初始化链接
/// </summary>
private void InitConnection()
{
try
{
if (_connection == null || !_connection.IsOpen)
{
_connection = _factory.CreateConnection();
_channel = _connection.CreateModel();
}
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "InitConnection");
}
}
/// <summary>
/// 释放资源
/// </summary>
public void Dispose()
{
_channel?.Close();
_channel?.Dispose();
_connection?.Close();
_connection?.Dispose();
}
}
}
......@@ -36,7 +36,8 @@ namespace Edu.Common.Plugin
Platform = 5,
ReceiveId = receiveid
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> list = new List<Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(list);
}
}
}
......@@ -2184,8 +2184,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
#endregion
......@@ -2213,7 +2213,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
#endregion
......@@ -2246,8 +2247,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
#endregion
#region 即将欠费提醒(管理者)
......@@ -2274,7 +2275,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
#endregion
......@@ -2307,8 +2309,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
#endregion
......@@ -2337,7 +2339,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
#endregion
......@@ -2370,8 +2373,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
#endregion
......@@ -2400,7 +2403,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
#endregion
......@@ -2438,7 +2442,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
......@@ -2663,8 +2668,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
#endregion
......@@ -2692,7 +2697,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
#endregion
......
......@@ -1728,7 +1728,8 @@ namespace Edu.Module.Course
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
......
......@@ -324,7 +324,8 @@ namespace Edu.Module.Customer
if (!string.IsNullOrEmpty(queryTargetWorkId))
{
modelWork.ReceiveId = queryTargetWorkId;
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
}
if (assistList != null && assistList.Count > 0)
......@@ -335,7 +336,8 @@ namespace Edu.Module.Customer
if (!string.IsNullOrEmpty(queryTargetWorkId))
{
modelWork.ReceiveId = queryTargetWorkId;
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
}
}
......@@ -767,7 +769,8 @@ namespace Edu.Module.Customer
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
}
}
......
......@@ -118,7 +118,7 @@ namespace Edu.Module.Duty
List<RB_Duty_Content_ViewModel> dutyContentList = new List<RB_Duty_Content_ViewModel>();
if (!string.IsNullOrEmpty(ids))
{
planDetails = GetDutyPlanDetailsListModule(new RB_Duty_PlanDetails_ViewModel() { QPlanIds = ids, QDutyStatus=-1 }, IsQueryDutyMan: true);
planDetails = GetDutyPlanDetailsListModule(new RB_Duty_PlanDetails_ViewModel() { QPlanIds = ids, QDutyStatus = -1 }, IsQueryDutyMan: true);
dutyContentList = duty_ContentRepository.GetDutyContentListRepository(new RB_Duty_Content_ViewModel() { QPlanIds = ids });
}
if (planDetails != null && planDetails.Count > 0)
......@@ -150,11 +150,11 @@ namespace Edu.Module.Duty
{
var dutyItem = dutyItemList?.Where(qitem => qitem.Shifts.Contains(subItem.Shift.ToString()) && qitem.Id == dItem.ItemId && qitem.ItemSchools.Contains(item.School_Id.ToString()))?.FirstOrDefault();
int isFinish = 0;
if (dutyItem!=null&&dutyItem.ItemType == ItemTypeEnum.Choice)
if (dutyItem != null && dutyItem.ItemType == ItemTypeEnum.Choice)
{
isFinish = dItem.WorkIsFinish;
}
else if (dutyItem!=null&&dutyItem.ItemType == ItemTypeEnum.FillIn)
else if (dutyItem != null && dutyItem.ItemType == ItemTypeEnum.FillIn)
{
if (!string.IsNullOrEmpty(dItem.WorkContent))
{
......@@ -419,7 +419,7 @@ namespace Edu.Module.Duty
}
if (messageList != null && messageList.Count > 0)
{
Common.Message.MessageHelper.SendMessage(messageList);
new Common.Message.MessageHelper().SendMessage(messageList);
}
return flag;
}
......@@ -434,7 +434,7 @@ namespace Edu.Module.Duty
RB_Duty_Plan_ViewModel model = duty_PlanRepository.GetEntity<RB_Duty_Plan_ViewModel>(Id);
if (model != null && model.Id > 0)
{
model.PlanDetails = GetDutyPlanDetailsListModule(new RB_Duty_PlanDetails_ViewModel() { PlanId = model.Id ,QDutyStatus=-1});
model.PlanDetails = GetDutyPlanDetailsListModule(new RB_Duty_PlanDetails_ViewModel() { PlanId = model.Id, QDutyStatus = -1 });
}
return model;
}
......@@ -476,7 +476,7 @@ namespace Edu.Module.Duty
}
if (messageList != null && messageList.Count > 0)
{
Common.Message.MessageHelper.SendMessage(messageList);
new Common.Message.MessageHelper().SendMessage(messageList);
}
}
}
......@@ -501,12 +501,12 @@ namespace Edu.Module.Duty
}
//当前班次
var currentModel = new RB_Duty_PlanDetails_ViewModel();
if (model.PlanDetails != null && model.PlanDetails.Count > 0)
{
//查找当前人员索引
int currentIndex = CalcCurrentDutyManIndexModule_V2(model);
//当前班次
currentModel = model.PlanDetails[currentIndex];
}
......@@ -527,7 +527,7 @@ namespace Edu.Module.Duty
{
result.Add("CheckLateTimeStr", "");
}
result.Add("FinishTime", currentModel?.FinishTimeStr);
result.Add("FinishLateTime", currentModel?.FinishLateTime);
if (currentModel?.FinishTimeStr != "未打卡")
......@@ -538,7 +538,7 @@ namespace Edu.Module.Duty
{
result.Add("FinishLateTimeStr", "");
}
result.Add("SchoolName", model?.SchoolName);
result.Add("ShiftName", currentModel?.ShiftName);
result.Add("StartTime", currentModel?.StartTime);
......@@ -583,7 +583,7 @@ namespace Edu.Module.Duty
}
}
List<object> pList = new List<object>();
var currentPlanContetList = contentList.Where(qitem => qitem.PlanShift == Shift && qitem.PlanType == 1 && qitem.CreateBy==userId)?.ToList();
var currentPlanContetList = contentList.Where(qitem => qitem.PlanShift == Shift && qitem.PlanType == 1 && qitem.CreateBy == userId)?.ToList();
if (currentPlanContetList == null || (currentPlanContetList != null && currentPlanContetList.Count == 0))
{
foreach (var dayItem in dutyItemList)
......@@ -615,7 +615,7 @@ namespace Edu.Module.Duty
if (currentModel.Status == DutyStatusEnum.DutyFinished)
{
foreach (var item in currentPlanContetList.Where(qitem=>qitem.CreateBy==userId))
foreach (var item in currentPlanContetList.Where(qitem => qitem.CreateBy == userId))
{
var c_itemModel = dutyItemList?.Where(qitem => qitem.Id == item.ItemId)?.FirstOrDefault();
if (c_itemModel != null)
......@@ -657,7 +657,7 @@ namespace Edu.Module.Duty
{
foreach (var item in PlanList)
{
var c_workModel = currentPlanContetList?.Where(qitem => qitem.ItemId == item.Id&&qitem.CreateBy==userId)?.FirstOrDefault();
var c_workModel = currentPlanContetList?.Where(qitem => qitem.ItemId == item.Id && qitem.CreateBy == userId)?.FirstOrDefault();
var itemType = item.ItemType;
int workIsFinish = 0;
if (itemType == ItemTypeEnum.FillIn)
......@@ -787,7 +787,7 @@ namespace Edu.Module.Duty
otherContentList = duty_ContentRepository.GetDutyContentListRepository(new RB_Duty_Content_ViewModel()
{
HandoverDlandetails=model.DetailId.ToString()
HandoverDlandetails = model.DetailId.ToString()
});
if (model.PlanDetails != null && model.PlanDetails.Count > 0)
{
......@@ -873,7 +873,7 @@ namespace Edu.Module.Duty
if (!string.IsNullOrEmpty(tempStr))
{
empList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = tempStr.TrimStart(',').TrimEnd(',') });
}
}
}
foreach (var item in contentList)
{
......@@ -893,7 +893,7 @@ namespace Edu.Module.Duty
var currentPlanContetList = contentList.Where(qitem => qitem.PlanShift == Shift && qitem.PlanType == 1 && qitem.CreateBy == userId)?.ToList();
if (currentPlanContetList == null || (currentPlanContetList != null && currentPlanContetList.Count == 0))
{
foreach (var dayItem in dutyItemList.Where(qitem=>qitem.DutyCategory==1&& qitem.DutyType==2))
foreach (var dayItem in dutyItemList.Where(qitem => qitem.DutyCategory == 1 && qitem.DutyType == 2))
{
duty_ContentRepository.Insert(new Model.Entity.Duty.RB_Duty_Content()
{
......@@ -962,7 +962,7 @@ namespace Edu.Module.Duty
}
else
{
foreach (var item in PlanList.Where(qitem=>qitem.DutyCategory==1&&qitem.DutyType==2))
foreach (var item in PlanList.Where(qitem => qitem.DutyCategory == 1 && qitem.DutyType == 2))
{
var c_workModel = currentPlanContetList?.Where(qitem => qitem.ItemId == item.Id && qitem.CreateBy == userId)?.FirstOrDefault();
var itemType = item.ItemType;
......@@ -1102,7 +1102,7 @@ namespace Edu.Module.Duty
hItem.IsOperate = 2;
hItem.CreateByName = empList?.Where(qitem => qitem.Id == hItem.CreateBy)?.FirstOrDefault()?.EmployeeName ?? "";
hItem.CreateTimeStr2 = Common.ConvertHelper.FormatDate(hItem.CreateTime) + " " + hItem.CreateTimeStr;
HandoverList.Insert(0,hItem);
HandoverList.Insert(0, hItem);
}
}
result.Add("HandoverList", HandoverList);
......@@ -1153,7 +1153,7 @@ namespace Edu.Module.Duty
{"current",new List<RB_Duty_PlanDetails_ViewModel>() },
{"next",new List<RB_Duty_PlanDetails_ViewModel>() },
};
var shiftList= model.PlanDetails.GroupBy(qitem => new { qitem.Shift }).Select(qitem => new { qitem.Key.Shift }).ToList();
var shiftList = model.PlanDetails.GroupBy(qitem => new { qitem.Shift }).Select(qitem => new { qitem.Key.Shift }).ToList();
for (var i = 0; i < shiftList.Count(); i++)
{
var subList = model.PlanDetails.Where(qitem => qitem.Shift == shiftList[i].Shift)?.ToList();
......@@ -1243,14 +1243,14 @@ namespace Edu.Module.Duty
/// <returns></returns>
public object GetHandoverShiftListModule()
{
List<object> result = new List<object>();
List<object> result = new List<object>();
var list = GetDutyPlanDetailsListModule(new RB_Duty_PlanDetails_ViewModel() { QStartDate = Common.ConvertHelper.FormatDate(DateTime.Now) }, IsQueryDutyMan: true);
foreach (var item in list)
{
result.Add(new
{
item.Id,
Name= Common.ConvertHelper.FormatDate(item.DutyDate)+" "+ item.ConfigStartTime+" " + item.ShiftName + " "+ item.DutyManName,
Name = Common.ConvertHelper.FormatDate(item.DutyDate) + " " + item.ConfigStartTime + " " + item.ShiftName + " " + item.DutyManName,
item.PlanId,
item.Shift,
item.DutyMan,
......@@ -1258,7 +1258,7 @@ namespace Edu.Module.Duty
item.ConfigStartTime,
item.ConfigEndTime,
item.ShiftName,
DutyDate=Common.ConvertHelper.FormatDate(item.DutyDate),
DutyDate = Common.ConvertHelper.FormatDate(item.DutyDate),
});
}
return result;
......@@ -1276,7 +1276,7 @@ namespace Edu.Module.Duty
/// <param name="message"></param>
/// <returns></returns>
[TransactionCallHandler]
public virtual bool DutyCheckModule(int Id, int Shift, int DutyMan, int Status, List<RB_Duty_Content_ViewModel> worklist,string HandoverDlandetails, out string message)
public virtual bool DutyCheckModule(int Id, int Shift, int DutyMan, int Status, List<RB_Duty_Content_ViewModel> worklist, string HandoverDlandetails, out string message)
{
message = "";
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -1284,7 +1284,7 @@ namespace Edu.Module.Duty
{ nameof(RB_Duty_PlanDetails_ViewModel.Status),Status},
};
DateTime dt = DateTime.Now;
var DutyFrequency=duty_FrequencyRepository.GetDutyFrequencyListRepository(new RB_Duty_Frequency_ViewModel() { Id = Shift }).FirstOrDefault();
var DutyFrequency = duty_FrequencyRepository.GetDutyFrequencyListRepository(new RB_Duty_Frequency_ViewModel() { Id = Shift }).FirstOrDefault();
var startTime = Convert.ToDateTime(Common.ConvertHelper.FormatDate(dt) + " " + DutyFrequency?.StartTime);
var endTime = Convert.ToDateTime(Common.ConvertHelper.FormatDate(dt) + " " + DutyFrequency?.EndTime);
if (Status == 1)
......@@ -1501,10 +1501,12 @@ namespace Edu.Module.Duty
public List<RB_Visitor_ViewModel> GetVisitorAllPageList(int pageIndex, int pageSize, out long rowsCount, RB_Visitor_ViewModel query)
{
var list = visitorRepository.GetVisitorPageRepository(pageIndex, pageSize, out rowsCount, query);
if (list.Any()) {
if (list.Any())
{
string userIds = string.Join(",", list.Select(x => x.CreateBy).Distinct());
var ulist = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { Group_Id = query.Group_Id, QIds = userIds });
foreach (var item in list) {
foreach (var item in list)
{
item.CreateByName = ulist.Where(x => x.Id == item.CreateBy).FirstOrDefault()?.EmployeeName ?? "";
}
}
......@@ -1665,7 +1667,7 @@ namespace Edu.Module.Duty
{
var list = visitorRepository.GetVisitorPageRepository(1, 1000, out _, new RB_Visitor_ViewModel()
{
Group_Id= 100000
Group_Id = 100000
});
var classList = visitor_ReserveRepository.GetVisitorReserveListRepository(new Model.ViewModel.Reserve.RB_Visitor_Reserve_Extend()
{
......@@ -1679,13 +1681,13 @@ namespace Edu.Module.Duty
StuId = 0,
StuName = item.Name,
StuTel = item.Tel,
StuIcon ="",
StuIcon = "",
StuSex = 0,
StuChannel = 0
};
if (extModel.StuId == 0)
{
extModel.CreateType = StuCreateTypeEnum.EmployeeInput;
extModel.CreateType = StuCreateTypeEnum.EmployeeInput;
}
extModel.Status = DateStateEnum.Normal;
extModel.StuStatus = 1;
......@@ -1693,12 +1695,12 @@ namespace Edu.Module.Duty
extModel.UpdateTime = DateTime.Now;
extModel.CreateBy = item.CreateBy;
extModel.CreateTime = DateTime.Now;
extModel.UpdateBy = item.CreateBy;
extModel.UpdateBy = item.CreateBy;
extModel.UpdateTime = DateTime.Now;
extModel.Group_Id = item.Group_Id;
extModel.CustomerId = 0;
extModel.IsDisable = 1;
bool flag = studentRepository.SetStudentRepository(extModel);
//更新试听班级学员关联
......
......@@ -48,7 +48,7 @@ namespace Edu.Module.Duty
/// 账号管理仓储层对象
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 学员仓储层对象
/// </summary>
......@@ -104,7 +104,7 @@ namespace Edu.Module.Duty
/// <param name="model"></param>
/// <returns></returns>
[TransactionCallHandler]
public virtual bool SetVisitorReserveModule(RB_Visitor_Reserve_Extend model,out string message)
public virtual bool SetVisitorReserveModule(RB_Visitor_Reserve_Extend model, out string message)
{
message = "";
bool flag;
......@@ -138,7 +138,8 @@ namespace Edu.Module.Duty
{
model.ReserveClassId = remodel.ReserveClassId;
}
else {
else
{
var newFlag = SetReserveClassModule(reserveClass, out string newMsg);
if (!newFlag)
{
......@@ -157,7 +158,7 @@ namespace Edu.Module.Duty
return false;
}
model.ReserveClassId = reserveClass.ReserveClassId;
}
}
}
if (visitor_ReserveRepository.ExistsVisitorReserveRepository(model))
{
......@@ -215,7 +216,7 @@ namespace Edu.Module.Duty
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool UpdateVisitorReserveStatusModule(int Id,int ReserveStatus,string Remark)
public bool UpdateVisitorReserveStatusModule(int Id, int ReserveStatus, string Remark)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
......@@ -254,17 +255,17 @@ namespace Edu.Module.Duty
string visitorIds = string.Join(",", visitorList.Select(qitem => qitem.Visitor_Id));
if (!string.IsNullOrEmpty(visitorIds))
{
stuOrderList= student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel()
stuOrderList = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel()
{
QStudentIds = visitorIds
});
}
}
foreach (var item in list)
{
var tempList = visitorList?.Where(qitem => qitem.ReserveClassId == item.ReserveClassId);
item.JoinNum = tempList?.Count()??0;
item.JoinNum = tempList?.Count() ?? 0;
item.VisitorList = tempList?.ToList() ?? new List<RB_Visitor_Reserve_Extend>();
int OrderCount = 0;
int failCount = 0;
......@@ -279,7 +280,7 @@ namespace Edu.Module.Duty
OrderCount++;
}
}
item.FailCount = failCount;
item.OrderCount = OrderCount;
if (item.OrderCount > 0)
......@@ -310,7 +311,7 @@ namespace Edu.Module.Duty
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetReserveClassModule(RB_Reserve_Class_Extend model,out string message)
public bool SetReserveClassModule(RB_Reserve_Class_Extend model, out string message)
{
bool flag;
message = "";
......@@ -368,8 +369,8 @@ namespace Edu.Module.Duty
var teacherList = accountRepository.GetAccountListRepository(new Model.ViewModel.User.RB_Account_ViewModel()
{
Group_Id = model.Group_Id,
QAccountIds = (model?.TeacherId??0) +","+(oldModel?.TeacherId??0),
AccountType= Common.Enum.User.AccountTypeEnum.Teacher
QAccountIds = (model?.TeacherId ?? 0) + "," + (oldModel?.TeacherId ?? 0),
AccountType = Common.Enum.User.AccountTypeEnum.Teacher
});
Common.Message.PushMessageModel pushModel = new Common.Message.PushMessageModel()
{
......@@ -382,7 +383,7 @@ namespace Edu.Module.Duty
SendType = 0,
Title = "试听课",
Platform = 2,
ReceiveId = (teacherList.Where(qitem=>qitem.AccountId==model.TeacherId)?.FirstOrDefault()?.Id??0).ToString(),
ReceiveId = (teacherList.Where(qitem => qitem.AccountId == model.TeacherId)?.FirstOrDefault()?.Id ?? 0).ToString(),
};
Common.Message.PushMessageModel pushModel2 = new Common.Message.PushMessageModel()
{
......@@ -402,7 +403,7 @@ namespace Edu.Module.Duty
pushModel,
pushModel2
};
Common.Message.MessageHelper.SendMessage(messageList);
new Common.Message.MessageHelper().SendMessage(messageList);
}
}
else
......@@ -431,7 +432,8 @@ namespace Edu.Module.Duty
};
if (flag)
{
Common.Message.MessageHelper.SendMessage(pushModel);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { pushModel };
new Common.Message.MessageHelper().SendMessage(pushList);
}
}
return flag;
......@@ -492,12 +494,12 @@ namespace Edu.Module.Duty
/// <param name="model"></param>
/// <param name="RoomMessage"></param>
/// <returns></returns>
public bool CheckClassRoomModule(DateTime chooseDateTime, DateTime chooseEndTime, RB_Reserve_Class_Extend model,out string RoomMessage)
public bool CheckClassRoomModule(DateTime chooseDateTime, DateTime chooseEndTime, RB_Reserve_Class_Extend model, out string RoomMessage)
{
RoomMessage = "";
var planList = class_PlanRepository.GetClassPlanListExtRepository(new RB_Class_Plan_ViewModel()
{
ClassRoomId=model.ClassRoomId,
ClassRoomId = model.ClassRoomId,
QClassDateStr = Common.ConvertHelper.FormatDate(model.ClassDate),
Group_Id = model.Group_Id
});
......@@ -574,7 +576,7 @@ namespace Edu.Module.Duty
return reserve_ClassRepository.ExistsReserveClassRepository(model);
}
/// <summary>
/// 根据编号获取约课班级
/// </summary>
......@@ -633,7 +635,8 @@ namespace Edu.Module.Duty
};
if (flag)
{
Common.Message.MessageHelper.SendMessage(pushModel);
List<Common.Message.PushMessageModel> pushList = new List<PushMessageModel>() { pushModel };
new Common.Message.MessageHelper().SendMessage(pushList);
}
}
return flag;
......
......@@ -455,7 +455,8 @@ namespace Edu.Module.User
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
}
......@@ -767,7 +768,8 @@ namespace Edu.Module.User
{
var queryTargetWorkId = accountModule.GetWorkUserIdModule(customerModel.CreateBy);
modelWork.ReceiveId = queryTargetWorkId;
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
//if (assistList != null && assistList.Count > 0)
//{
......
......@@ -143,7 +143,10 @@ namespace Edu.Repository.Course
});
builder = builder.Remove(builder.Length - 1, 1);
builder.Append("ON DUPLICATE KEY UPDATE CurrentHours=VALUES(CurrentHours);");
flag= Execute(builder.ToString()) > 0;
flag = Execute(builder.ToString()) > 0;
//builder.Append(@" REPLACE INTO rb_course_chapter (ChapterId, CurrentHours) VALUES(@ChapterId,@CurrentHours)");
//param
}
catch (Exception ex)
{
......
......@@ -304,8 +304,8 @@ namespace Edu.Repository.EduTask
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
#endregion
......@@ -333,7 +333,8 @@ namespace Edu.Repository.EduTask
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
#endregion
......@@ -366,8 +367,8 @@ namespace Edu.Repository.EduTask
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
#endregion
#region 即将欠费提醒(管理者)
......@@ -394,7 +395,8 @@ namespace Edu.Repository.EduTask
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
#endregion
......@@ -428,7 +430,8 @@ namespace Edu.Repository.EduTask
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
#endregion
......@@ -458,7 +461,8 @@ namespace Edu.Repository.EduTask
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
#endregion
......@@ -492,8 +496,8 @@ namespace Edu.Repository.EduTask
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
#endregion
......@@ -522,7 +526,8 @@ namespace Edu.Repository.EduTask
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
#endregion
......@@ -560,7 +565,8 @@ namespace Edu.Repository.EduTask
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
......@@ -658,8 +664,8 @@ namespace Edu.Repository.EduTask
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
#endregion
......@@ -687,7 +693,8 @@ namespace Edu.Repository.EduTask
Platform = 5,
ReceiveId = x.WorkUserId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
});
}
#endregion
......
......@@ -2340,10 +2340,11 @@ namespace Edu.WebApi.Controllers.Course
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
Common.Message.MessageHelper.SendMessage(model);
List<Common.Message.PushMessageModel> pushList2 = new List<Common.Message.PushMessageModel>() { model };
new Common.Message.MessageHelper().SendMessage(pushList2);
}
return flag ? ApiResult.Success() : ApiResult.Failed();
}
......
......@@ -413,10 +413,10 @@ namespace Edu.WebApi.Controllers.User
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
}
return ApiResult.Success();
}
else
......@@ -548,8 +548,8 @@ namespace Edu.WebApi.Controllers.User
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
#endregion
......@@ -578,7 +578,8 @@ namespace Edu.WebApi.Controllers.User
Platform = 5,
ReceiveId = to
};
Common.Message.MessageHelper.SendMessage(modelPubWork);
List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelPubWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}
}
......
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