Commit 4fa6fd9c authored by 吴春's avatar 吴春

提交管理配置

parent 6fbd9cc9
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum.Public;
using VT.FW.DB;
namespace Edu.Model.Entity.System
{
/// <summary>
/// 短信发送记录实体表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Msg_Base
{
public int ID { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
public int Status { get; set; }
/// <summary>
/// 存储位置,1-腾讯云,2-阿里,3-其他
/// </summary>
public StoreTypeEnum StoreType { get; set; }
/// <summary>
/// 消息配置信息
/// </summary>
public string MsgConfigure { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
}
}
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_Msg_Log
{
public int ID { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 学生id
/// </summary>
public int Student_Id { get; set; }
/// <summary>
/// 发送时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 发送状态1-失败,2-成功
/// </summary>
public int SendStatus { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 发送内容
/// </summary>
public string SendContent { get; set; }
/// <summary>
/// 接收人姓名
/// </summary>
public string ReceiverName { get; set; }
/// <summary>
/// 接收人电话
/// </summary>
public string ReceiverPhone { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.System;
namespace Edu.Model.ViewModel.System
{
/// <summary>
/// 新增修改基础设置信息
///
/// </summary>
[Serializable]
public class RB_Msg_Base_Function_ViewModel : RB_Msg_Base
{
public RB_Msg_Base_ViewModel MsgBase { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.System
{
public class RB_Msg_Base_ViewModel
{
/// <summary>
/// 地区id
/// </summary>
public string RegionId { get; set; }
/// <summary>
/// 域名
/// </summary>
public string Domain { get; set; }
/// <summary>
/// 密钥ID
/// </summary>
public string AccessKeyId { get; set; }
/// <summary>
/// 秘钥密码
/// </summary>
public string AccessSecret { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.System
{
public class RB_Msg_Log_ViewModel : Entity.System.RB_Msg_Log
{
/// <summary>
/// 创建时间字符串
/// </summary>
public string CreateDateStr
{
get
{
return Common.ConvertHelper.FormatTime(this.CreateDate);
}
}
/// <summary>
/// 开始时间
/// </summary>
public string StartDate { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public string EndDate { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum;
using Edu.Model.Entity.System;
using Edu.Model.ViewModel.System;
using Edu.Repository.System;
using VT.FW.DB;
namespace Edu.Module.System
{
public class MsgLogModule
{
/// <summary>
/// 短信记录仓储层对象
/// </summary>
private readonly RB_Msg_LogRepository msgLogRepository = new RB_Msg_LogRepository();
/// <summary>
/// 短信配置仓储层对象
/// </summary>
private readonly RB_Msg_BaseRepository msgBaseRepository = new RB_Msg_BaseRepository();
#region 短信记录
/// <summary>
/// 获取发送短信记录信息
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Msg_Log_ViewModel> GetPageListRepository(int pageIndex, int pageSize, out long rowsCount, Model.ViewModel.System.RB_Msg_Log_ViewModel query)
{
return msgLogRepository.GetPageListRepository(pageIndex, pageSize, out rowsCount, query);
}
#endregion
#region 短信配置
/// <summary>
/// 获取班级列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Msg_Base_Function_ViewModel> GetMsgBaseListModule(RB_Msg_Base_Function_ViewModel query)
{
return msgBaseRepository.GetListRepository(query);
}
/// <summary>
/// 获取班级分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Msg_Base_Function_ViewModel> GetMsgBasePageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Msg_Base_Function_ViewModel query)
{
return msgBaseRepository.GetPageListRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 新增修改 短信配置
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetMsgBaseModule(RB_Msg_Base model)
{
if (model.ID > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Msg_Base.CreateDate),model.CreateDate},
{ nameof(RB_Msg_Base.CreateBy),model.CreateBy},
{ nameof(RB_Msg_Base.MsgConfigure),model.MsgConfigure}
};
return msgBaseRepository.Update(fileds, new WhereHelper(nameof(RB_Msg_Base.ID), model.ID));
}
else
{
var newId = msgBaseRepository.Insert(model);
return newId > 0;
}
}
/// <summary>
/// 根据短信配置编号获取短信配置详细信息
/// </summary>
/// <param name="ClassId"></param>
/// <returns></returns>
public RB_Msg_Base_Function_ViewModel GetMsgBaseModule(object ClassId)
{
return msgBaseRepository.GetEntity<RB_Msg_Base_Function_ViewModel>(ClassId);
}
/// <summary>
/// 删除短信配置
/// </summary>
/// <param name="ClassId"></param>
/// <returns></returns>
public bool RemoveMsgBaseModule(object ID)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Msg_Base.Status),(int)DateStateEnum.Delete},
};
return msgBaseRepository.Update(fileds, new WhereHelper(nameof(RB_Msg_Base.ID), ID));
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Model.Entity.System;
using Edu.Model.ViewModel.System;
namespace Edu.Repository.System
{
public class RB_Msg_BaseRepository:BaseRepository<RB_Msg_Base>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_Msg_Base); } }
/// <summary>
/// 获取短信配置信息
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Msg_Base_Function_ViewModel> GetListRepository(RB_Msg_Base_Function_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.Append($" AND {nameof(RB_Msg_Base.Group_Id)}={query.Group_Id}");
}
if (query.StoreType > 0)
{
builder.Append($" AND {nameof(RB_Msg_Base.StoreType)}={query.StoreType}");
}
}
return Get<RB_Msg_Base_Function_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 获取短信配置信息
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Msg_Base_Function_ViewModel> GetPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Msg_Base_Function_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} where 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.Append($" AND {nameof(RB_Msg_Base.Group_Id)}={query.Group_Id}");
}
if (query.StoreType > 0)
{
builder.Append($" AND {nameof(RB_Msg_Base.StoreType)}={query.StoreType}");
}
}
return GetPage<RB_Msg_Base_Function_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Model.Entity.System;
using Edu.Model.ViewModel.System;
namespace Edu.Repository.System
{
public class RB_Msg_LogRepository : BaseRepository<RB_Msg_Log>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_Msg_Log); } }
/// <summary>
/// 获取发送短信记录信息
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Msg_Log> GetListRepository(RB_Msg_Log query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.Append($" AND {nameof(RB_Msg_Log.Group_Id)}={query.Group_Id}");
}
if (query.School_Id > 0)
{
builder.Append($" AND {nameof(RB_Msg_Log.School_Id)}={query.School_Id}");
}
if (query.SendStatus > 0)
{
builder.Append($" AND {nameof(RB_Msg_Log.SendStatus)}={(int)query.SendStatus}");
}
}
return Get<RB_Msg_Log>(builder.ToString()).ToList();
}
/// <summary>
/// 获取发送短信记录信息
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Msg_Log_ViewModel> GetPageListRepository(int pageIndex, int pageSize, out long rowsCount, Model.ViewModel.System.RB_Msg_Log_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} where 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.Append($" AND {nameof(RB_Msg_Log.Group_Id)}={query.Group_Id}");
}
if (query.School_Id > 0)
{
builder.Append($" AND {nameof(RB_Msg_Log.School_Id)}={query.School_Id}");
}
if (query.SendStatus > 0)
{
builder.Append($" AND {nameof(RB_Msg_Log.SendStatus)}={(int)query.SendStatus}");
}
if (!string.IsNullOrWhiteSpace(query.StartDate))
{
builder.Append($" and DATE_FORMAT({nameof(RB_Msg_Log.CreateDate)},'%Y-%m-%d' )>=DATE_FORMAT('{query.StartDate}','%Y-%m-%d' ) ");
}
if (!string.IsNullOrWhiteSpace(query.EndDate))
{
builder.Append($" and DATE_FORMAT({nameof(RB_Msg_Log.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{query.EndDate}','%Y-%m-%d' ) ");
}
if (!string.IsNullOrWhiteSpace(query.ReceiverName))
{
builder.Append($" and ( {nameof(RB_Msg_Log.ReceiverName)} like '%{query.ReceiverName}%' or {nameof(RB_Msg_Log.ReceiverPhone)} like '%{query.ReceiverName}%' )");
}
if (!string.IsNullOrWhiteSpace(query.SendContent))
{
builder.Append($" and {nameof(RB_Msg_Log.SendContent)} like '%{query.SendContent}%' ");
}
}
return GetPage<RB_Msg_Log_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Edu.Common.API;
using Edu.Common.Plugin;
using Edu.Model.Entity.System;
using Edu.Model.ViewModel.System;
using Edu.Module.System;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
namespace Edu.WebApi.Controllers.Public
{
/// <summary>
/// 系统公用接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class MsgController : BaseController
{
/// <summary>
/// 短信处理类对象
/// </summary>
private readonly MsgLogModule msgLogModule = new MsgLogModule();
/// <summary>
/// 获取短信记录分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMsgLogPageList()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Msg_Log_ViewModel>(RequestParm.Msg.ToString());
query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id;
var list = msgLogModule.GetPageListRepository(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = rowsCount;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
#region 短信配置
/// <summary>
/// 获取短信配置页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMsgBasePageList()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Msg_Base_Function_ViewModel>(RequestParm.Msg.ToString());
query.Group_Id = base.UserInfo.Group_Id;
var list = msgLogModule.GetMsgBasePageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
if (!string.IsNullOrWhiteSpace(item.MsgConfigure))
{
item.MsgBase = Common.Plugin.JsonHelper.DeserializeObject<RB_Msg_Base_ViewModel>(item.MsgConfigure);
}
}
pageModel.Count = rowsCount;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取短信配置列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMsgBaseList()
{
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Msg_Base_Function_ViewModel>(RequestParm.Msg.ToString());
query.Group_Id = base.UserInfo.Group_Id;
var list = msgLogModule.GetMsgBaseModule(query);
if (!string.IsNullOrWhiteSpace(list.MsgConfigure))
{
list.MsgBase = Common.Plugin.JsonHelper.DeserializeObject<RB_Msg_Base_ViewModel>(list.MsgConfigure);
}
return ApiResult.Success(data: list);
}
/// <summary>
/// 添加修改短信配置
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetMsgBase()
{
var extModel = Common.Plugin.JsonHelper.DeserializeObject<RB_Msg_Base_Function_ViewModel>(RequestParm.Msg.ToString());
var model = new RB_Msg_Base();
model.CreateDate = DateTime.Now;
model.CreateBy = UserInfo.Id;
model.Group_Id = this.UserInfo.Group_Id;
model.ID = extModel.ID;
if (extModel.MsgBase != null)
{
model.MsgConfigure = Common.Plugin.JsonHelper.Serialize(extModel.MsgBase);
}
bool flag = msgLogModule.SetMsgBaseModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取短信配置实体
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMsgBase()
{
var ID = base.ParmJObj.GetInt("ID", 0);
var extModel = msgLogModule.GetMsgBaseModule(ID);
if (!string.IsNullOrWhiteSpace(extModel.MsgConfigure))
{
extModel.MsgBase = Common.Plugin.JsonHelper.DeserializeObject<RB_Msg_Base_ViewModel>(extModel.MsgConfigure);
}
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 删除短信配置
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult RemoveMsgBase()
{
var ClassId = base.ParmJObj.GetInt("ID", 0);
var flag = msgLogModule.RemoveMsgBaseModule(ClassId);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
}
}
......@@ -35,6 +35,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{297A2A6E-5
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Edu.Module.User", "Edu.Module.User\Edu.Module.User.csproj", "{AD259CCC-048A-4F65-A368-91B8B4A9F200}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Edu.Module.Public", "Edu.Module.Public\Edu.Module.Public.csproj", "{8E34CE2D-AAF3-481C-A5E3-5AECC8F7F1B5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -81,6 +83,10 @@ Global
{AD259CCC-048A-4F65-A368-91B8B4A9F200}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD259CCC-048A-4F65-A368-91B8B4A9F200}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD259CCC-048A-4F65-A368-91B8B4A9F200}.Release|Any CPU.Build.0 = Release|Any CPU
{8E34CE2D-AAF3-481C-A5E3-5AECC8F7F1B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E34CE2D-AAF3-481C-A5E3-5AECC8F7F1B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E34CE2D-AAF3-481C-A5E3-5AECC8F7F1B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E34CE2D-AAF3-481C-A5E3-5AECC8F7F1B5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -95,6 +101,7 @@ Global
{3B21886D-A9E1-4C74-85B4-7740935AF791} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
{F3E4D4C5-FD08-44DE-AB65-850071BE7FEF} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
{AD259CCC-048A-4F65-A368-91B8B4A9F200} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
{8E34CE2D-AAF3-481C-A5E3-5AECC8F7F1B5} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8763B446-FAB1-46BF-9743-F2628533241B}
......
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