Commit 557dac2f authored by 黄奎's avatar 黄奎

新增接口

parent 2bad09f4
using Edu.Common.Enum; using Edu.Common.Enum;
using System; using System;
using VT.FW.DB;
namespace Edu.Model.Entity.Duty namespace Edu.Model.Entity.Duty
{ {
/// <summary> /// <summary>
/// 值班内容实体类 /// 值班内容实体类
/// </summary> /// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Duty_Content public class RB_Duty_Content
{ {
/// <summary> /// <summary>
...@@ -29,29 +32,39 @@ namespace Edu.Model.Entity.Duty ...@@ -29,29 +32,39 @@ namespace Edu.Model.Entity.Duty
public int PlanId { get; set; } public int PlanId { get; set; }
/// <summary> /// <summary>
/// 附件内容 /// 突发事项、工作交接(值班类型为2.3是使用)文件
/// </summary> /// </summary>
public string FileContent { get; set; } public string FileURL { get; set; }
/// <summary> /// <summary>
/// 文本内容 /// 突发事项、工作交接(值班类型为2.3是使用)内容
/// </summary> /// </summary>
public string Content { get; set; } public string OtherContent { get; set; }
/// <summary> /// <summary>
/// 备注 /// 突发事项、工作交接(值班类型为2.3是使用)备注
/// </summary> /// </summary>
public string Remark { get; set; } public string OtherRemark { get; set; }
/// <summary> /// <summary>
/// 创建人 /// 值班事项(值班类型为1是使用)填写内容
/// </summary> /// </summary>
public int CreateBy { get; set; } public string WorkContent { get; set; }
/// <summary> /// <summary>
/// 创建时间 /// 值班事项(值班类型为1是使用)是否完成(1-已完成)
/// </summary> /// </summary>
public DateTime CreateTime { get; set; } public int WorkIsFinish { get; set; }
/// <summary>
/// 事项编号
/// </summary>
public int ItemId { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary> /// <summary>
/// 集团编号 /// 集团编号
...@@ -59,13 +72,23 @@ namespace Edu.Model.Entity.Duty ...@@ -59,13 +72,23 @@ namespace Edu.Model.Entity.Duty
public int Group_Id { get; set; } public int Group_Id { get; set; }
/// <summary> /// <summary>
/// 值班事项(值班类型为1是使用) /// 创建人
/// </summary> /// </summary>
public string PlanContent { get; set; } public int CreateBy { get; set; }
/// <summary> /// <summary>
/// 删除状态 /// 创建时间
/// </summary> /// </summary>
public DateStateEnum Status { get; set; } public DateTime CreateTime { get; set; }
/// <summary>
/// 更新人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
} }
} }
...@@ -29,7 +29,7 @@ namespace Edu.Model.Entity.Duty ...@@ -29,7 +29,7 @@ namespace Edu.Model.Entity.Duty
/// <summary> /// <summary>
/// 访客微信号 /// 访客微信号
/// </summary> /// </summary>
public int? WeChatNum { get; set; } public string WeChatNum { get; set; }
/// <summary> /// <summary>
/// 兴趣课程 /// 兴趣课程
...@@ -49,7 +49,7 @@ namespace Edu.Model.Entity.Duty ...@@ -49,7 +49,7 @@ namespace Edu.Model.Entity.Duty
/// <summary> /// <summary>
/// 关联人员 /// 关联人员
/// </summary> /// </summary>
public string CreateBy { get; set; } public int CreateBy { get; set; }
/// <summary> /// <summary>
/// 访客状态(1-正常,2-贵宾,3-黑名单) /// 访客状态(1-正常,2-贵宾,3-黑名单)
......
using Edu.Model.Entity.Duty; using Edu.Common.Enum.Duty;
using Edu.Model.Entity.Duty;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
......
...@@ -43,6 +43,11 @@ namespace Edu.Module.Duty ...@@ -43,6 +43,11 @@ namespace Edu.Module.Duty
/// </summary> /// </summary>
private readonly RB_Duty_ContentRepository duty_ContentRepository = new RB_Duty_ContentRepository(); private readonly RB_Duty_ContentRepository duty_ContentRepository = new RB_Duty_ContentRepository();
/// <summary>
/// 访客仓储层对象
/// </summary>
private readonly RB_VisitorRepository visitorRepository = new RB_VisitorRepository();
/// <summary> /// <summary>
/// 获取值班计划分页列表【管理端】 /// 获取值班计划分页列表【管理端】
/// </summary> /// </summary>
...@@ -60,7 +65,7 @@ namespace Edu.Module.Duty ...@@ -60,7 +65,7 @@ namespace Edu.Module.Duty
List<RB_Duty_PlanDetails_ViewModel> planDetails = new List<RB_Duty_PlanDetails_ViewModel>(); List<RB_Duty_PlanDetails_ViewModel> planDetails = new List<RB_Duty_PlanDetails_ViewModel>();
if (!string.IsNullOrEmpty(ids)) if (!string.IsNullOrEmpty(ids))
{ {
planDetails= GetDutyPlanDetailsListModule(new RB_Duty_PlanDetails_ViewModel() { QPlanIds = ids },IsQueryDutyMan:true); planDetails = GetDutyPlanDetailsListModule(new RB_Duty_PlanDetails_ViewModel() { QPlanIds = ids }, IsQueryDutyMan: true);
} }
foreach (var item in list) foreach (var item in list)
{ {
...@@ -84,7 +89,7 @@ namespace Edu.Module.Duty ...@@ -84,7 +89,7 @@ namespace Edu.Module.Duty
if (list != null && list.Count > 0) if (list != null && list.Count > 0)
{ {
var ids = string.Join(",", list.Select(qitem => qitem.Id)); var ids = string.Join(",", list.Select(qitem => qitem.Id));
string schoolIds=string.Join(",", list.Select(qitem => qitem.School_Id)); string schoolIds = string.Join(",", list.Select(qitem => qitem.School_Id));
string shiftIds = ""; string shiftIds = "";
List<RB_Duty_PlanDetails_ViewModel> planDetails = new List<RB_Duty_PlanDetails_ViewModel>(); List<RB_Duty_PlanDetails_ViewModel> planDetails = new List<RB_Duty_PlanDetails_ViewModel>();
List<RB_Duty_Item_ViewModel> dutyItemList = new List<RB_Duty_Item_ViewModel>(); List<RB_Duty_Item_ViewModel> dutyItemList = new List<RB_Duty_Item_ViewModel>();
...@@ -126,7 +131,7 @@ namespace Edu.Module.Duty ...@@ -126,7 +131,7 @@ namespace Edu.Module.Duty
/// <param name="query"></param> /// <param name="query"></param>
/// <param name="IsQueryDutyMan">true-查询人员</param> /// <param name="IsQueryDutyMan">true-查询人员</param>
/// <returns></returns> /// <returns></returns>
public List<RB_Duty_PlanDetails_ViewModel> GetDutyPlanDetailsListModule(RB_Duty_PlanDetails_ViewModel query,bool IsQueryDutyMan=false) public List<RB_Duty_PlanDetails_ViewModel> GetDutyPlanDetailsListModule(RB_Duty_PlanDetails_ViewModel query, bool IsQueryDutyMan = false)
{ {
var list = duty_PlanDetailsRepository.GetDutyPlanDetailsListRepository(query); var list = duty_PlanDetailsRepository.GetDutyPlanDetailsListRepository(query);
if (IsQueryDutyMan && list != null && list.Count > 0) if (IsQueryDutyMan && list != null && list.Count > 0)
...@@ -135,7 +140,7 @@ namespace Edu.Module.Duty ...@@ -135,7 +140,7 @@ namespace Edu.Module.Duty
List<Employee_ViewModel> empList = new List<Employee_ViewModel>(); List<Employee_ViewModel> empList = new List<Employee_ViewModel>();
if (!string.IsNullOrEmpty(ids)) if (!string.IsNullOrEmpty(ids))
{ {
empList= accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = ids }); empList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = ids });
} }
foreach (var item in list) foreach (var item in list)
{ {
...@@ -259,7 +264,7 @@ namespace Edu.Module.Duty ...@@ -259,7 +264,7 @@ namespace Edu.Module.Duty
/// <param name="Id"></param> /// <param name="Id"></param>
/// <param name="user"></param> /// <param name="user"></param>
/// <returns></returns> /// <returns></returns>
public object OnDutyModule(int Id,int Shift, UserInfo user) public object OnDutyModule(int Id, int Shift, UserInfo user)
{ {
object result = new object(); object result = new object();
var model = GetMyDutyPlanPageModule(1, 1, out _, new RB_Duty_Plan_ViewModel() { Id = Id, QDutyMan = user.Id, QShift = Shift })?.FirstOrDefault(); var model = GetMyDutyPlanPageModule(1, 1, out _, new RB_Duty_Plan_ViewModel() { Id = Id, QDutyMan = user.Id, QShift = Shift })?.FirstOrDefault();
...@@ -317,11 +322,26 @@ namespace Edu.Module.Duty ...@@ -317,11 +322,26 @@ namespace Edu.Module.Duty
DutyStatusStr = "值班结束"; DutyStatusStr = "值班结束";
} }
var PlanList = currentModel?.DutyItemList ?? new List<RB_Duty_Item_ViewModel>(); var PlanList = currentModel?.DutyItemList ?? new List<RB_Duty_Item_ViewModel>();
List<object> pList = new List<object>();
var currentPlanContetList = contentList.Where(qitem => qitem.PlanShift == Shift && qitem.PlanType == 1)?.ToList();
foreach (var item in PlanList)
{
var c_workModel = currentPlanContetList?.Where(qitem => qitem.ItemId == item.Id)?.FirstOrDefault();
var pObj = new
{
item.Id,
item.ItemName,
item.ItemType,
IsChecked = c_workModel?.WorkIsFinish ?? 0,
WorkContent = c_workModel?.WorkContent ?? "",
};
pList.Add(pObj);
}
result = new result = new
{ {
model?.Id, model?.Id,
PlanDate= Common.ConvertHelper.FormatDate(model?.Date), PlanDate = Common.ConvertHelper.FormatDate(model?.Date),
WeekDay=Common.ConvertHelper.GetWeekDay(model?.Date), WeekDay = Common.ConvertHelper.GetWeekDay(model?.Date),
model?.SchoolName, model?.SchoolName,
currentModel?.ShiftName, currentModel?.ShiftName,
currentModel?.StartTime, currentModel?.StartTime,
...@@ -330,7 +350,10 @@ namespace Edu.Module.Duty ...@@ -330,7 +350,10 @@ namespace Edu.Module.Duty
currentModel?.DutyManIcon, currentModel?.DutyManIcon,
currentModel?.Status, currentModel?.Status,
currentModel?.StatusStr, currentModel?.StatusStr,
WorkList= PlanList, WorkList = pList,
EmergenciesList = contentList?.Where(qitem => qitem.PlanType == 3)?.ToList() ?? new List<RB_Duty_Content_ViewModel>(),
//todo
HandoverList = contentList?.Where(qitem => qitem.PlanType == 2)?.ToList() ?? new List<RB_Duty_Content_ViewModel>(),
ReciveMan = nextModel?.DutyManName ?? "", ReciveMan = nextModel?.DutyManName ?? "",
GiveMan = previousModel?.DutyManName ?? "", GiveMan = previousModel?.DutyManName ?? "",
DutyStatus, DutyStatus,
...@@ -370,5 +393,154 @@ namespace Edu.Module.Duty ...@@ -370,5 +393,154 @@ namespace Edu.Module.Duty
var flag = duty_PlanDetailsRepository.Update(fileds, list); var flag = duty_PlanDetailsRepository.Update(fileds, list);
return flag; return flag;
} }
/// <summary>
/// 新增修改值班事项
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetDutyContentModule(RB_Duty_Content_ViewModel model)
{
bool flag = false;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Duty_Content_ViewModel.PlanShift),model.PlanShift},
{ nameof(RB_Duty_Content_ViewModel.PlanType),model.PlanType},
{ nameof(RB_Duty_Content_ViewModel.PlanId),model.PlanId},
{ nameof(RB_Duty_Content_ViewModel.FileURL),model.FileURL},
{ nameof(RB_Duty_Content_ViewModel.OtherContent),model.OtherContent},
{ nameof(RB_Duty_Content_ViewModel.OtherRemark),model.OtherRemark},
{ nameof(RB_Duty_Content_ViewModel.WorkContent),model.WorkContent},
{ nameof(RB_Duty_Content_ViewModel.WorkIsFinish),model.WorkIsFinish},
{ nameof(RB_Duty_Content_ViewModel.ItemId),model.ItemId},
{ nameof(RB_Duty_Content_ViewModel.UpdateBy),model.UpdateBy},
{ nameof(RB_Duty_Content_ViewModel.UpdateTime),model.UpdateTime},
};
flag = duty_ContentRepository.Update(fileds, new WhereHelper(nameof(RB_Duty_Content_ViewModel.Id), model.Id));
}
else
{
var newId = duty_ContentRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 删除值班内容
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool RemoveDutyContentModule(int Id)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Duty_Content_ViewModel.Status),(int)DateStateEnum.Delete},
};
var flag = duty_ContentRepository.Update(fileds, new WhereHelper(nameof(RB_Duty_Content_ViewModel.Id), Id));
return flag;
}
/// <summary>
/// 获取访客分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Visitor_ViewModel> GetVisitorPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Visitor_ViewModel query)
{
return visitorRepository.GetVisitorPageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 新增修改访客
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetVisitorModule(RB_Visitor_ViewModel model)
{
bool flag = false;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Visitor_ViewModel.Name), model.Name},
{ nameof(RB_Visitor_ViewModel.Tel), model.Tel},
{ nameof(RB_Visitor_ViewModel.WeChatNum), model.WeChatNum},
{ nameof(RB_Visitor_ViewModel.CourseName), model.CourseName},
{ nameof(RB_Visitor_ViewModel.StudyTime), model.StudyTime},
{ nameof(RB_Visitor_ViewModel.LevelType), model.LevelType},
{ nameof(RB_Visitor_ViewModel.Evaluate), model.Evaluate},
{ nameof(RB_Visitor_ViewModel.Remark), model.Remark},
};
flag = visitorRepository.Update(fileds, new WhereHelper(nameof(RB_Visitor_ViewModel.Id), model.Id));
}
else
{
model.VisitTimes = GetVisitorCountModule(model);
var newId = visitorRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 修改访客状态
/// </summary>
/// <param name="Id"></param>
/// <param name="Status"></param>
/// <returns></returns>
public bool RemoveVisitorModule(int Id, int Status)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Visitor_ViewModel.Status), Status},
};
var flag = visitorRepository.Update(fileds, new WhereHelper(nameof(RB_Visitor_ViewModel.Id), Id));
return flag;
}
/// <summary>
/// 根据编号获取访客信息
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Visitor_ViewModel GetVisitorModule(int Id)
{
return visitorRepository.GetEntity<RB_Visitor_ViewModel>(Id);
}
/// <summary>
/// 修改访客状态
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool UpdateVisitorModule(RB_Visitor_ViewModel model)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Visitor_ViewModel.VisitorStatus), model.VisitorStatus},
{ nameof(RB_Visitor_ViewModel.Evaluate), model.Evaluate},
{ nameof(RB_Visitor_ViewModel.Remark), model.Remark},
};
var flag = visitorRepository.Update(fileds, new WhereHelper(nameof(RB_Visitor_ViewModel.Id), model.Id));
return flag;
}
/// <summary>
/// 获取访客访问次数
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int GetVisitorCountModule(RB_Visitor_ViewModel model)
{
return visitorRepository.GetVisitorCountRepository(model);
}
} }
} }
...@@ -39,8 +39,49 @@ WHERE 1=1 ...@@ -39,8 +39,49 @@ WHERE 1=1
{ {
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Visitor_ViewModel.Group_Id), query.Group_Id); builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Visitor_ViewModel.Group_Id), query.Group_Id);
} }
if (query.PlanId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Visitor_ViewModel.PlanId), query.PlanId);
}
} }
return GetPage<RB_Visitor_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList(); return GetPage<RB_Visitor_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
} }
/// <summary>
/// 获取访客
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public int GetVisitorCountRepository(RB_Visitor_ViewModel query)
{
int result = 0;
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT COUNT(1)
FROM rb_visitor
WHERE 1=1
");
if (query != null)
{
if (!string.IsNullOrEmpty(query.WeChatNum) && !string.IsNullOrEmpty(query.Tel))
{
builder.AppendFormat(@" AND ( WeChatNum='{0}' OR Tel='{1}') ", query.WeChatNum, query.Tel);
}
if (!string.IsNullOrEmpty(query.WeChatNum) && string.IsNullOrEmpty(query.Tel))
{
builder.AppendFormat(@" AND ( WeChatNum='{0}' ) ", query.WeChatNum);
}
if (string.IsNullOrEmpty(query.WeChatNum) && !string.IsNullOrEmpty(query.Tel))
{
builder.AppendFormat(@" AND ( Tel='{0}' ) ", query.Tel);
}
}
var obj = base.ExecuteScalar(builder.ToString());
if (obj != null)
{
Int32.TryParse(obj.ToString(), out result);
}
return result;
}
} }
} }
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