123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- using PMS.BusinessModels.Account;
- using PMS.BusinessModels.Problem;
- using PMS.DBService.MessageManage;
- using PMS.Interface.MessageManage;
- using QWPlatform.IService;
- using QWPlatform.SystemLibrary;
- using QWPlatform.SystemLibrary.Utils;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using PMS.EntityModels.NoticeManager;
- using PMS.Plugins.Common;
- using PMS.Plugins.WeChart;
- using PMS.Plugins.PluginsModels;
- using PMS.BusinessModels.SMS;
- namespace PMS.BusinessService.MessageManag
- {
- public class MessageManageBLL: IMessageManage
- {
- private MessageManageServe Message_Service = DataServiceBase.Instance<MessageManageServe>();
- public bool AddMessage(MessageManageModel model,UserInfo user,string ID)
- {
- if(user.PersonProperty!=1)
- {
- return Message_Service.AddMessageByQD(model, user,ID);
- }
- return Message_Service.AddMessageByBB(model,ID);
- }
- public bool DeleteMessage(MessageManageModel model)
- {
- return Message_Service.DeleteMessage(model);
- }
- public string SelecteMessageById(string id)
- {
- return Message_Service.SelecteMessageById(id).ToJson();
- }
- //公告信息绑定
- public string DataBind(int page, int rows, string query,UserInfo user)
- {
- int defaultrow = 10;
- int startnumber = Startnumber(page, rows, defaultrow);
- int endnumber = Endnumbers(page, rows, defaultrow);
- return Message_Service.DataBind(startnumber,endnumber,query, user);
- }
- public string GetHome(UserInfo user)
- {
- return Message_Service.GetHome(user).ToJson();
- }
- //首页获取公告列表
- public string HomeGetList(int page, int rows, UserInfo user)
- {
- var total = 0;
- var dt = Message_Service.HomeGetList(page, rows, user, out total);
- return QWPlatform.SystemLibrary.Utils.Strings.ObjectToJson(
- new { total = total, rows = dt });
- }
- //首页获取通知列表
- public string HomeGetNotice(int page, int rows, UserInfo user)
- {
- var total = 0;
- var dt = Message_Service.HomeGetNotice(page, rows, user, out total);
- return QWPlatform.SystemLibrary.Utils.Strings.ObjectToJson(
- new { total = total, rows = dt });
- }
- //结束行
- private int Endnumbers(int page, int row, int defaultrow)
- {
- if (page == 0 && row == 0)
- {
- row = defaultrow;
- page = 1;
- }
- return (page) * row;
- }
- //起始行
- private int Startnumber(int page, int row, int defaultrow)
- {
- if (page == 0 && row == 0)
- {
- row = defaultrow;
- page = 1;
- }
- return (page - 1) * row + 1;
- }
- /// <summary>
- /// 通知类型
- /// </summary>
- /// <returns></returns>
- public string NoticeType()
- {
- return Message_Service.NoticeType().ToJson();
- }
- /// <summary>
- /// 通知优先级
- /// </summary>
- /// <returns></returns>
- public string NoticeOrder()
- {
- return Message_Service.NoticeOrder().ToJson();
- }
- /// <summary>
- /// 通知对象
- /// </summary>
- /// <returns></returns>
- public string NoticePerson(int PersonProperty)
- {
- return Message_Service.NoticePerson(PersonProperty).ToJson();
- }
- /// <summary>
- /// 根据ID获取通知信息
- /// </summary>
- /// <param name="v"></param>
- /// <param name="id"></param>
- /// <returns></returns>
- public string GetNoticeByID(string id)
- {
- return Message_Service.GetNoticeByID(id).ToJson();
- }
- /// <summary>
- /// 根据公告ID获取通知对象
- /// </summary>
- /// <param name="v"></param>
- /// <param name="id"></param>
- /// <returns></returns>
- public string GetNatureByID(string id)
- {
- return Message_Service.GetNatureByID(id).ToJson();
- }
- /// <summary>
- /// 修改操作
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public bool Edit_Notice(MessageManageModel model)
- {
- return Message_Service.Edit_Notice(model)!=0;
- }
- /// <summary>
- /// 获取渠道
- /// </summary>
- /// <param name="personProperty"></param>
- /// <returns></returns>
- public string GetChannelByNature(UserInfo user)
- {
- return Message_Service.GetChannelByNature(user).ToJson();
- }
- public string ShowNotice(UserInfo user)
- {
- return Message_Service.ShowNotice(user).ToJson();
- }
- /// <summary>
- /// 显示总部和渠道的最新公告通知
- /// </summary>
- /// <param name="user"></param>
- /// <returns></returns>
- public string GetMessageOnIndex(UserInfo user)
- {
- return Message_Service.GetMessageOnIndexChannel(user).ToJson();
- }
- /// <summary>
- /// 查询通知数量
- /// </summary>
- /// <param name="ChannelId"></param>
- /// <returns></returns>
- public int GetCount(UserInfo user)
- {
- return Message_Service.GetCount(user);
- }
- /// <summary>
- /// 判断是否显示
- /// </summary>
- /// <param name="userInfo"></param>
- /// <returns></returns>
- public Mssage_config PanDuanIsShow(UserInfo userInfo)
- {
- return Message_Service.PanDuanIsShow(userInfo);
- }
- //保存单个公告显示配置
- public bool SaveNoticeConfig(string PersonId, string NoticeId, bool IsOpen)
- {
- return Message_Service.SaveNoticeConfig(PersonId, NoticeId, IsOpen);
- }
-
- //是否启用
- public int NoticeStatus(string id)
- {
- return Message_Service.NoticeStatus(id);
- }
- public int AppNoticeStatus(string id)
- {
- return Message_Service.AppNoticeStatus(id);
- }
- /// <summary>
- /// APP公告获取
- /// </summary>
- public string APPDataBind(int page, int rows)
- {
- var total = 0;
- int startnumber = Startnumber(page, rows,10);
- int endnumber = Endnumbers(page, rows,10);
- DataTable dt= Message_Service.APPDataBind(startnumber, endnumber,out total);
- return Strings.ObjectToJson(new
- {
- total = total,
- rows = dt,
- });
- }
- public string Add_AppPush(AppPush_Model model)
- {
- return Message_Service.Add_AppPush(model);
- }
- /// <summary>
- /// 修改App图片公告
- /// </summary>
- /// <param name="data"></param>
- public int Edit_AppNotice(AppPush_Model model)
- {
- return Message_Service.Edit_AppImg(model);
- }
- public int Del_AppNotice(string id)
- {
- return Message_Service.Del_AppNotice(id);
- }
- //获取启用的app公告
- public string GetWorkNotice()
- {
- return Message_Service.GetWorkNotice().ToJson();
- }
- public string GetWorkNotiveById(string id)
- {
- return Message_Service.GetWorkNotiveById(id).ToJson();
- }
- public int Edit_NoticeFJ(string v, string ID)
- {
- return Message_Service.Edit_NoticeFJ(v,ID);
- }
- public int DeleteFJ(string id)
- {
- return Message_Service.DeleteFJ(id);
- }
- public string ConvertWeChatTemp(int type, string TemplateID, Dictionary<string, string> TempParame, string sign_name)
- {
-
- return Message_Service.ConvertWeChatTemp(type, TemplateID, TempParame, sign_name);
- }
- /// <summary>
- /// 发送微信消息
- /// </summary>
- /// <param name="notification"></param>
- /// <returns></returns>
- public string SendWeChartTempletMessge(NotificationDto notificationDto)
- {
- string strReturn = string.Empty;
- try
- {
-
- foreach (var items in notificationDto.record_items)
- {
- WxMessgPush wxMessgPush = new WxMessgPush();
- wxMessgPush.wx_openid = items.接收人id;
- wxMessgPush.url = notificationDto.url;
- wxMessgPush.template_id = notificationDto.template_code;
- wxMessgPush.data = notificationDto.template_value;
- strReturn = WeChartMessage.SendWeChartTempletMessge(wxMessgPush);
- }
- }
- catch (Exception ex)
- {
- strReturn = ex.Message;
- }
- return strReturn;
- }
- }
- }
|