Beispiel #1
0
        /// <summary>
        /// 获取火险等级数据
        /// </summary>
        /// <returns></returns>
        public JsonResult GetFireLevelData()
        {
            var result           = new List <OutData>();
            MessageListObject ms = new MessageListObject(false, null);
            var dataList         = YJ_DANGERCLASSCls.getListModel(new YJ_DANGERCLASS_SW {
                DCDATE = "2017-04-26 00:00:00.000"
            });

            if (dataList.Any())
            {
                var list = dataList.Where(p => p.BYORGNO.Substring(p.BYORGNO.Length - 3, 3) == "000");
                if (list.Any())
                {
                    foreach (var item in list)
                    {
                        var levelData = new OutData();
                        levelData.name  = item.TOWNNAME;
                        levelData.value = item.DANGERCLASS;
                        result.Add(levelData);
                    }
                }
                ms = new MessageListObject(true, result);
            }
            return(Json(ms));
        }
        /// <summary>
        /// 火险等级
        /// </summary>
        /// <returns></returns>
        public ActionResult FireLeverIndex(string level = "")
        {
            if (string.IsNullOrEmpty(level))
            {
                ViewBag.loadFunc = "loadFireLevel()";
            }
            else
            {
                ViewBag.loadFunc = "loadFireLevelStr(" + level + ")";
            }
            var list  = YJ_DANGERCLASSCls.getListModelTop(new YJ_DANGERCLASS_SW {
            });
            var model = new FireLevelCountModel();

            model.CountA = list.Count().ToString();
            model.CountB = list.Where(p => Convert.ToInt32(p.DANGERCLASS) >= 2).ToList().Count.ToString();
            model.CountC = list.Where(p => Convert.ToInt32(p.DANGERCLASS) >= 3).ToList().Count.ToString();
            model.CountD = list.Where(p => Convert.ToInt32(p.DANGERCLASS) >= 4).ToList().Count.ToString();
            model.CountE = list.Where(p => Convert.ToInt32(p.DANGERCLASS) >= 5).ToList().Count.ToString();
            if (list.Count() > 0)
            {
                model.Time = Convert.ToDateTime(list.FirstOrDefault().DCDATE).ToString("yyyy年MM月dd日");
            }
            else
            {
                model.Time = "";
            }
            ViewBag.url = ConfigCls.getConfigValue("2DMAPUrl");
            return(View(model));
        }
Beispiel #3
0
        /// <summary>
        /// 根据条件选出火险等级
        /// </summary>
        /// <param name="level"></param>
        /// <returns></returns>
        private IEnumerable <YJJCFireLevelModel> GetModelListBy(string level)
        {
            var result = new List <YJJCFireLevelModel>();
            var list   = YJ_DANGERCLASSCls.getListModelTop(new YJ_DANGERCLASS_SW()
            {
            });

            if (list.Any())
            {
                var recordlist = list.Where(p => Convert.ToInt32(p.DANGERCLASS) >= Convert.ToInt32(level));
                foreach (var item in recordlist.OrderByDescending(p => p.DANGERCLASS))
                {
                    var model = new YJJCFireLevelModel();
                    if (!string.IsNullOrEmpty(item.TOPTOWNNAME))
                    {
                        model.AreaName = item.TOPTOWNNAME + "==>";
                    }
                    model.AreaName += item.TOWNNAME;    //区域
                    model.FireLevel = item.DANGERCLASS; //等级
                    //model.SourceForm = "人工导入";
                    result.Add(model);
                }
            }
            return(result);
        }
Beispiel #4
0
        /// <summary>
        /// 获取火险等级模型列表
        /// </summary>
        /// <returns></returns>
        private IEnumerable <YJJCFireLevelModel> GetModelList()
        {
            var result = new List <YJJCFireLevelModel>();
            var list   = YJ_DANGERCLASSCls.getListModelTop(new YJ_DANGERCLASS_SW()
            {
            });

            if (list.Any())
            {
                foreach (var item in list.OrderByDescending(p => p.DANGERCLASS))
                {
                    var model = new YJJCFireLevelModel();
                    if (!string.IsNullOrEmpty(item.TOPTOWNNAME))
                    {
                        model.AreaName = item.TOPTOWNNAME + "==>";
                    }
                    model.AreaName  += item.TOWNNAME;                   //区域
                    model.FireLevel  = item.DANGERCLASS;                //等级
                    model.LevelDate  = ClsSwitch.SwitDate(item.DCDATE); //等级时间;
                    model.SourceForm = "人工导入";
                    result.Add(model);
                }
            }
            return(result);
        }
        /// <summary>
        /// 获取火险等级
        /// </summary>
        /// <returns></returns>
        public JsonResult GetFireLevelList()
        {
            MessageListObject msg = null;
            var sw   = new YJ_DANGERCLASS_SW();
            var list = YJ_DANGERCLASSCls.getListModelTop(sw).OrderByDescending(p => Convert.ToInt32(p.DANGERCLASS));

            msg = new MessageListObject(true, list);
            return(Json(msg));
        }
        /// <summary>
        /// 页面公用ViewBag
        /// </summary>
        /// <param name="PageCode">页面编码(菜单编码)</param>
        /// <param name="RightCode">权限编码 用于页面级权限验证</param>
        /// <param name="PageTitle">页面标题 标题为空自动获取页面标题及上级页面标题</param>
        public void pubViewBag(string PageCode, string RightCode, string PageTitle)
        {
            CookieModel cookieInfo = SystemCls.getCookieInfo();

            ViewBag.getPageMenuStr = getPageMenuStr(PageCode);
            ViewBag.PageCode       = PageCode;
            string curORGNo = SystemCls.getCurUserOrgNo();

            if (PublicCls.OrgIsShi(curORGNo))
            {
                curORGNo = ConfigCls.getConfigValue("ProvincialCapital");//州府所在地行政区划编码
            }
            //获取火险等级
            ViewBag.fireLevel = YJ_DANGERCLASSCls.getLevelByOrgNo(new YJ_DANGERCLASS_SW {
                BYORGNO = curORGNo
            });

            //获取滚动信息
            if (T_SYS_PARAMETERCls.getValueByFlag(new T_SYS_PARAMETER_SW {
                PARAMFLAG = "LoginInfo"
            }).ToString() == "0")
            {
                ViewBag.marqueeSysInfo = T_SYS_PARAMETERCls.getValueByFlag(new T_SYS_PARAMETER_SW {
                    PARAMFLAG = "marqueeIndexInfo"
                }).ToString();
            }
            else
            {
                ViewBag.marqueeSysInfo = YJ_WEATHERCls.getWeather(new YJ_WEATHER_SW {
                    BYORGNO = curORGNo
                });
            }

            ViewBag.PageLeftMenu = getPageLeftMenu(PageCode);                          //左侧菜单
            ViewBag.isPageRight  = SystemCls.isRight(RightCode);                       //判断页面是否有权限
            ViewBag.SystemName   = ConfigCls.getSystemName();                          //系统名称
            ViewBag.noticeRefreshTimeInterval = ConfigCls.noticeRefreshTimeInterval(); //菜单自动刷新间隔
            ViewBag.PageTitle = PageTitle;
            //如果页面标题为空,则自动通过页面编码从系统菜单表中获取菜单名称及上级菜单名称
            if (string.IsNullOrEmpty(PageTitle))
            {
                ViewBag.PageTitle = T_SYS_MENUCls.getModel(new T_SYS_MENU_SW {
                    MENUCODE = PageCode, SYSFLAG = ConfigCls.getSystemFlag()
                }).MENUNAME;
            }
            ViewBag.Title        = ConfigCls.getSystemName() + "-" + ViewBag.PageTitle;        //Title名称
            ViewBag.SystemLogo   = ConfigCls.getSystemLogo();                                  //获取系统logo图片
            ViewBag.trueName     = cookieInfo.trueName;                                        //当前登录用户姓名
            ViewBag.TopFireAlarm = ConfigCls.getTopFireAlarm();                                //是否火情报警
            ViewBag.TopFireLevel = ConfigCls.getTopFireLevel();                                //是否显示火险等级
            ViewBag.depName      = StateSwitch.GetOrgNameByOrgNO(SystemCls.getCurUserOrgNo()); //部门名称
            string systemFlag = ConfigCls.getSystemFlag();                                     //系统标识 如Springer

            ViewBag.T_UrlReferrer = Request.UrlReferrer;
        }
        /// <summary>
        /// 下载森林高火险警报
        /// </summary>
        /// <returns></returns>
        public ActionResult DownloadFireLevelFile()
        {
            string   tmppath    = Server.MapPath("~/UploadFile/MBDoc/firelevelmb.doc");
            string   outputPath = Server.MapPath("~/UploadFile/Output/");
            Document doc        = new Document(tmppath);                                                    //载入模板
            //提供数据源
            var value = System.Configuration.ConfigurationManager.AppSettings["FireLevelValue"].ToString(); //火险等级以上

            if (string.IsNullOrEmpty(value.Trim()))
            {
                value = "4";
            }
            var resultlist = YJ_DANGERCLASSCls.getListModelTop(new YJ_DANGERCLASS_SW {
            }).Where(p => Convert.ToInt32(p.DANGERCLASS) >= 4);                                                                           //获取最新4级别以上的火险信息
            var orgstr     = string.Join("、", resultlist.Select(p => p.TOWNNAME).ToArray());

            var date = DateTime.Now;

            if (resultlist.Any())
            {
                date = Convert.ToDateTime(resultlist.FirstOrDefault().DCDATE);
            }
            else
            {
                //return Content(@"<script>alert('无火险等级报告!');history.go(-1)</script>");
                return(null);
            }

            var datafrom = date.ToString("MM月dd日 16时");
            var datato   = date.AddDays(1).ToString("MM月dd日 16时");

            String[] fieldNames  = new String[] { "year", "date", "orgstr", "datafrom", "datato" };
            Object[] fieldValues = new Object[] { DateTime.Now.Year.ToString(), DateTime.Now.ToString("yyyy年MM月dd日"), orgstr, datafrom, datato };
            //合并模版,相当于页面的渲染
            doc.MailMerge.Execute(fieldNames, fieldValues);

            #region DataTable数据集合拼接
            DataTable dt;
            dt           = ConvertToDataTableLevelList(resultlist.ToList());
            dt.TableName = "PlaceList";
            doc.MailMerge.ExecuteWithRegions(dt);
            #endregion
            var TemplateName = DateTime.Now.ToString("yyyy年MM月dd日") + "森林高火险警报.doc";
            //保存合并后的文档
            doc.Save(outputPath + Guid.NewGuid().ToString().Replace("-", "") + ".doc");

            var docStream = new MemoryStream();
            doc.Save(docStream, SaveFormat.Doc);
            return(File(docStream.ToArray(), "application/msword", TemplateName));
        }
Beispiel #8
0
        /// <summary>
        /// 火险等级上传
        /// </summary>
        /// <param name="filePath">文件路径</param>
        public static void HXDJUpload(string filePath)
        {
            HSSFWorkbook hssfworkbook;

            try
            {
                using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                {
                    hssfworkbook = new HSSFWorkbook(file);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            NPOI.SS.UserModel.ISheet sheet = hssfworkbook.GetSheetAt(0);
            int rowCount = sheet.LastRowNum;//LastRowNum = PhysicalNumberOfRows - 1

            for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
            {
                IRow     row = sheet.GetRow(i);
                string[] arr = new string[3];
                for (int k = 0; k < arr.Length; k++)
                {
                    if (k != 2)
                    {
                        arr[k] = row.GetCell(k) == null ? "" : row.GetCell(k).ToString();//循环获取每一单元格内容
                    }
                    else
                    {
                        arr[k] = row.GetCell(k).DateCellValue.ToString("yyyy-MM-dd");
                    }
                }
                YJ_DANGERCLASS_Model m = new YJ_DANGERCLASS_Model();
                //地区  火险等级  日期
                if (string.IsNullOrEmpty(arr[0]) || string.IsNullOrEmpty(arr[1]) || string.IsNullOrEmpty(arr[2]))
                {
                    continue;
                }
                m.TOWNNAME    = arr[0];
                m.DANGERCLASS = arr[1];
                m.DCDATE      = arr[2];
                m.opMethod    = "Add";
                YJ_DANGERCLASSCls.Manager(m);
            }
        }
Beispiel #9
0
        public string GetFireLevelHtml(YJ_DANGERCLASS_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<table cellpadding=\"0\" cellspacing=\"0\" >");
            sb.Append(" <thead>");
            sb.Append("<tr><th>区域</th><th>等级</th><th>时间</th></tr>");
            sb.Append("</thead>");
            sb.Append("<tbody>");
            var list = new List <YJ_DANGERCLASS_Model>();

            if (string.IsNullOrEmpty(sw.DCDATE))
            {
                list = YJ_DANGERCLASSCls.getListModelTop(new YJ_DANGERCLASS_SW()
                {
                }).ToList();
                if (!string.IsNullOrEmpty(sw.DANGERCLASS) && sw.DANGERCLASS != "0")
                {
                    list = list.Where(p => p.DANGERCLASS == sw.DANGERCLASS).ToList();
                }
            }
            else
            {
                list = YJ_DANGERCLASSCls.getListModel(sw).ToList();
            }
            if (list.Any())
            {
                foreach (var item in list)
                {
                    sb.Append("<tr>");
                    sb.AppendFormat("<td class=\"center\">{0}</td>", item.TOPTOWNNAME + "==>" + item.TOWNNAME);
                    sb.AppendFormat("<td class=\"center\">{0}</td>", item.DANGERCLASS);
                    sb.AppendFormat("<td class=\"center\">{0}</td>", ClsSwitch.SwitDate(item.DCDATE));
                    sb.Append("</tr>");
                }
            }
            else
            {
                sb.Append("<tr>");
                sb.Append("<td colspan=\"3\"><em>暂未查询到记录!</em></td>");
                sb.Append("</tr>");
            }
            sb.Append("</tbody>");
            sb.Append("</table>");
            return(sb.ToString());
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public JsonResult GetFireLevelFData()
        {
            Message ms = null;
            //提供数据源
            var value = System.Configuration.ConfigurationManager.AppSettings["FireLevelValue"].ToString();//火险等级以上

            if (string.IsNullOrEmpty(value.Trim()))
            {
                value = "4";
            }
            var resultlist = YJ_DANGERCLASSCls.getListModelTop(new YJ_DANGERCLASS_SW {
            }).Where(p => Convert.ToInt32(p.DANGERCLASS) >= 4);                                                                           //获取最新4级别以上的火险信息

            if (!resultlist.Any())
            {
                ms = new Message(false, "无报告数据", "");
            }
            else
            {
                ms = new Message(true, "有报告数据", "");
            }
            return(Json(ms));
        }
Beispiel #11
0
        /// <summary>
        /// 自动发送短信
        /// </summary>
        /// <returns></returns>
        public JsonResult AutoSendMsg()
        {
            Message ms = null;
            var     st = ConfigCls.getIsAutoSendFireLevelMsg(); //读取配置

            if (st == "1")                                      //自动
            {
                var smsmodel = YJ_DCSMS_TMPCls.GetListModel(new YJ_DCSMS_TMP_SW {
                    ISENABLE = "1"
                });                                                                                 //获取短信模板
                if (smsmodel.Any())
                {
                    int levelnum = 0;
                    foreach (var sms in smsmodel)
                    {
                        var FireLevellist = YJ_DANGERCLASSCls.getListModelTop(new YJ_DANGERCLASS_SW()
                        {
                        }).Where(p => p.DANGERCLASS == sms.DANGERCLASS);                                                                                //获取最新的火险等级
                        if (FireLevellist.Any())
                        {
                            var _cityorg  = "";               //市机构中间变量
                            var _contyorg = "";               //县机构中间变量
                            int i         = 0;
                            levelnum = FireLevellist.Count(); //当前火险等级个数
                            foreach (var level in FireLevellist)
                            {
                                var info = new YJ_DCSMS_SEND_SW();
                                info.opMethod        = "Add";
                                info.SMSSENDUSERLIST = sms.SMSSENDUSERLIST;
                                info.DCDATE          = level.DCDATE;
                                info.BYORGNO         = level.BYORGNO;
                                info.YJ_DCSMS_TMPID  = sms.YJ_DCSMS_TMPID;
                                //info.TMPCONTENT = sms.TMPCONTENT;

                                #region 通讯录接收人员
                                if (!string.IsNullOrEmpty(info.SMSSENDUSERLIST))
                                {
                                    var arrperson = info.SMSSENDUSERLIST.Split(',');
                                    info.TMPCONTENT = sms.TMPCONTENT.Replace("[num]", levelnum.ToString());//短信内容replace
                                    if (!string.IsNullOrEmpty(info.TMPCONTENT))
                                    {
                                        foreach (var p in arrperson)
                                        {
                                            var txlmodel = T_SYS_ADDREDDBOOKCls.getModel(new T_SYS_ADDREDDBOOK_SW {
                                                ADID = p
                                            });                                                                                 //通讯录
                                            if (txlmodel != null && !string.IsNullOrEmpty(txlmodel.PHONE))
                                            {
                                                try
                                                {
                                                    ////TODO  Send Message
                                                    //add redis
                                                    //队列
                                                    var msg = txlmodel.PHONE.Trim() + "|" + info.TMPCONTENT;
                                                    redisclient.EnqueueItemOnList("SendMsg", msg);//入队。
                                                    logs.Info("==入队列号码信息==" + msg);
                                                    //  client.SendMsg(info.TMPCONTENT, txlmodel.PHONE);
                                                    Thread.Sleep(200);
                                                }
                                                catch (Exception ex)
                                                {
                                                    logs.Error(ex.Message);
                                                }
                                            }
                                        }
                                        info.SMSSENDSTATUS = "1";//0 未发送 1 已发送 -1 发送失败
                                    }
                                }
                                #endregion

                                #region  发送值班员与护林员
                                if (string.IsNullOrEmpty(sms.SMSSENDUSERLIST))//接收人为空 发送值班员与护林员
                                {
                                    #region 值班员 与护林员
                                    if (sms.SMSGROUPTYPE == "1")                                //值班员
                                    {
                                        var cityorg  = level.BYORGNO.Substring(0, 4) + "00000"; //市机构码
                                        var contyorg = level.BYORGNO.Substring(0, 6) + "000";   //县机构码
                                        if (i == 0)                                             //初次
                                        {
                                            _cityorg  = cityorg;
                                            _contyorg = contyorg;
                                        }
                                        else
                                        {
                                            if (_cityorg == cityorg)//循环相同的市级单位 跳出循环
                                            {
                                                continue;
                                            }
                                            if (_contyorg == contyorg)//循环相同的县级单位 跳出循环
                                            {
                                                continue;
                                            }
                                        }
                                        info.TMPCONTENT = sms.TMPCONTENT.Replace("[cityconty]", level.TOPTOWNNAME).Replace("[num]", levelnum.ToString()); //短信内容replace
                                        string str     = cityorg + "," + contyorg;
                                        var    zbylist = OD_USERCls.GetOndutyUserid(level.DCDATE, str);                                                   //获取值班员useridlist
                                        if (zbylist.Any())
                                        {
                                            var zbystr = "";
                                            foreach (var zby in zbylist)
                                            {
                                                var m = T_SYSSEC_IPSUSERCls.getModel(new T_SYSSEC_IPSUSER_SW {
                                                    USERID = zby.ToString()
                                                });
                                                if (!string.IsNullOrEmpty(m.PHONE))
                                                {
                                                    if (zbylist.Count() == 1)
                                                    {
                                                        zbystr = zby;
                                                    }
                                                    else
                                                    {
                                                        zbystr += zby + ",";
                                                    }
                                                    try
                                                    {
                                                        ////TODO  Send Message
                                                        //add redis
                                                        //队列
                                                        var msg = m.PHONE.Trim() + "|" + info.TMPCONTENT;
                                                        redisclient.EnqueueItemOnList("SendMsg", msg);//入队。
                                                        logs.Info("==入队列号码信息==" + msg);
                                                        //client.SendMsg(info.TMPCONTENT, m.PHONE);
                                                        Thread.Sleep(200);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        logs.Error(ex.Message);
                                                    }
                                                }
                                            }
                                            info.SMSSENDUSERLIST = zbystr; //值班员人员
                                            info.SMSSENDSTATUS   = "1";    //0 未发送 1 已发送 -1 发送失败
                                            // ms = YJ_DCSMS_SENDCls.Manager(info);
                                        }
                                        ++i;
                                    }
                                    else if (sms.SMSGROUPTYPE == "2")                                            //护林员
                                    {
                                        info.TMPCONTENT = sms.TMPCONTENT.Replace("[cityconty]", level.TOWNNAME); //短信内容replace
                                        var hlylist = T_IPSFR_USERCls.getListModel(new T_IPSFR_USER_SW {
                                            BYORGNO = info.BYORGNO
                                        });                                                                                        //护林员
                                        if (hlylist.Any())
                                        {
                                            var hlystr = "";//护林员人员 逗号分隔
                                            foreach (var hly in hlylist)
                                            {
                                                if (!string.IsNullOrEmpty(hly.PHONE))
                                                {
                                                    if (hlylist.Count() == 1)
                                                    {
                                                        hlystr = hly.HID;
                                                    }
                                                    else
                                                    {
                                                        hlystr += hly.HID + ",";
                                                    }
                                                    try
                                                    {
                                                        //TODO  Send Message
                                                        //add redis
                                                        //队列
                                                        var msg = hly.PHONE.Trim() + "|" + info.TMPCONTENT;
                                                        redisclient.EnqueueItemOnList("SendMsg", msg);//入队。
                                                        logs.Info("==入队列号码信息==" + msg);
                                                        //client.SendMsg(info.TMPCONTENT, hly.PHONE);
                                                        Thread.Sleep(200);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        logs.Error(ex.Message);
                                                    }
                                                }
                                            }
                                            info.SMSSENDUSERLIST = hlystr; //护林员人员
                                            info.SMSSENDSTATUS   = "1";    //0 未发送 1 已发送 -1 发送失败
                                            //ms = YJ_DCSMS_SENDCls.Manager(info);
                                        }
                                    }
                                    #endregion
                                }
                                #endregion
                            }
                        }
                    }
                }
                else
                {
                    ms = new Message(true, "短信未设置模板!", "");
                }
            }
            else
            {
                ms = new Message(true, "短信发送已设置为手动发送,请手动发送短信!", "");
            }
            return(Json(ms));
        }
Beispiel #12
0
        /// <summary>
        /// 手动发送短信
        /// </summary>
        /// <returns></returns>
        public JsonResult SendMsg()
        {
            Message ms            = new Message(false, "错误信息初始化!", "");
            string  SubjectPerson = Request.Params["SubjectPerson"];
            var     paraArry1     = SubjectPerson.Split('|');//获取主题+;+人员+;+短信内容|

            if (paraArry1.Length > 0)
            {
                foreach (var item in paraArry1)
                {
                    if (string.IsNullOrEmpty(item))
                    {
                        continue;
                    }
                    var subject = item.Split(';');//获取主题+;+人员+;+短信内容
                    var model   = YJ_DCSMS_TMPCls.GetListModel(new YJ_DCSMS_TMP_SW {
                        YJ_DCSMS_TMPID = subject[0], ISENABLE = "1"
                    }).FirstOrDefault();
                    if (model != null && !string.IsNullOrEmpty(model.TMPCONTENT))
                    {
                        var info = new YJ_DCSMS_SEND_SW();
                        info.opMethod        = "Add";                   //增加
                        info.YJ_DCSMS_TMPID  = subject[0];
                        info.SMSSENDUSERLIST = subject[1];              //接收人员
                        info.TMPCONTENT      = subject[2];              //获取界面的短信内容
                        info.DCDATE          = DateTime.Now.ToString(); //火险等级时间
                        info.BYORGNO         = "";                      //所属机构 适用于值班员与护林员
                        int levelnum      = 0;
                        var FireLevellist = YJ_DANGERCLASSCls.getListModelTop(new YJ_DANGERCLASS_SW()
                        {
                        }).Where(p => p.DANGERCLASS == model.DANGERCLASS);                                                                                //获取最新的火险等级
                        if (FireLevellist.Any())
                        {
                            levelnum = FireLevellist.Count();//当前火险等级个数
                            #region 通讯录接收人员
                            if (!string.IsNullOrEmpty(info.SMSSENDUSERLIST))
                            {
                                info.DCDATE     = FireLevellist.FirstOrDefault().DCDATE;
                                info.TMPCONTENT = subject[2].Replace("[num]", levelnum.ToString());//短信内容replace
                                if (!string.IsNullOrEmpty(info.TMPCONTENT))
                                {
                                    var    arrpersonlist = info.SMSSENDUSERLIST.Split(',').Where(p => p != "" && p != null);
                                    string arrperson     = string.Join(",", arrpersonlist);
                                    string txlMobile     = arrperson; //通讯录电话列表
                                    string txlContent    = "";        // 通讯录模板

                                    #region 注释
                                    // foreach (var p in arrperson)
                                    //  {
                                    //  var txlmodel = T_SYS_ADDREDDBOOKCls.getModel(new T_SYS_ADDREDDBOOK_SW { ADID = p });//通讯录
                                    //  if (txlmodel != null && !string.IsNullOrEmpty(txlmodel.PHONE))
                                    // {
                                    ////TODO  Send Message
                                    //add redis
                                    //队列
                                    //try
                                    //{
                                    //    var msg = txlmodel.PHONE.Trim() + "|" + info.TMPCONTENT;
                                    //    redisclient.EnqueueItemOnList("SendMsg", msg);//入队。
                                    //    logs.Info("==入队列号码信息==" + msg);
                                    //    Thread.Sleep(100);
                                    //    // client.SendMsg(info.TMPCONTENT, txlmodel.PHONE);
                                    //    // Thread.Sleep(200);
                                    //}
                                    //catch (Exception ex)
                                    //{
                                    //    logs.Error(ex.Message);
                                    //}
                                    //  txlMobile += txlmodel.PHONE.Trim() + ",";
                                    //   }
                                    //}
                                    #endregion

                                    txlContent = info.TMPCONTENT;
                                    var mm = SmsCom.SendMsg(txlContent, txlMobile.TrimEnd(','));//发送短信
                                    if (mm.Success)
                                    {
                                        ms.Msg     = mm.Msg;
                                        ms.Success = mm.Success;
                                        ms.Url     = "";
                                    }
                                    //ms
                                    // var mm = Smsclient.SendMsg(txlContent, txlMobile);
                                    // ms = SmsMsgCom.SendMsg(txlContent, txlMobile);//发送短信
                                    // info.SMSSENDSTATUS = "1";//0 未发送 1 已发送 -1 发送失败
                                    // ms = YJ_DCSMS_SENDCls.Manager(info);
                                }
                            }
                            #endregion

                            #region 值班员 、护林员
                            if (string.IsNullOrEmpty(info.SMSSENDUSERLIST))                 //值班员 、护林员
                            {
                                var _cityorg  = "";                                         //市机构中间变量
                                var _contyorg = "";                                         //县机构中间变量
                                int i         = 0;
                                if (model.SMSGROUPTYPE == "2" || model.SMSGROUPTYPE == "1") //护林员接收人员 或者 值班员接收人员
                                {
                                    foreach (var level in FireLevellist)
                                    {
                                        info.DCDATE  = level.DCDATE;  //火险等级时间
                                        info.BYORGNO = level.BYORGNO; //火险等级所属机构
                                        #region 护林员接收人员
                                        if (model.SMSGROUPTYPE == "2")
                                        {
                                            info.TMPCONTENT = subject[2].Replace("[cityconty]", level.TOWNNAME);//短信内容replace
                                            var hlylist = T_IPSFR_USERCls.getListModel(new T_IPSFR_USER_SW {
                                                BYORGNO = level.BYORGNO
                                            });                                                                                         //护林员
                                            if (hlylist.Any())
                                            {
                                                // var hlystr = "";//护林员人员 逗号分隔
                                                string hlyMobile  = ""; //护林员电话
                                                string hlyContent = ""; //护林员模板
                                                foreach (var hly in hlylist.MyDistinct(s => s.PHONE))
                                                {
                                                    if (!string.IsNullOrEmpty(hly.PHONE))
                                                    {
                                                        hlyMobile += hly.PHONE.Trim() + ",";
                                                        //if (hlylist.Count() == 1)
                                                        //{
                                                        //    hlystr = hly.HID;
                                                        //}
                                                        //else
                                                        //{
                                                        //    hlystr += hly.HID + ",";
                                                        //}
                                                        //try
                                                        //{
                                                        //    //TODO Send Message
                                                        //    //add redis
                                                        //    //队列
                                                        //    var msg = hly.PHONE.Trim() + "|" + info.TMPCONTENT;
                                                        //    redisclient.EnqueueItemOnList("SendMsg", msg);//入队。
                                                        //    logs.Info("==入队列号码信息==" + msg);
                                                        //    //client.SendMsg(info.TMPCONTENT, hly.PHONE);
                                                        //    Thread.Sleep(200);
                                                        //}
                                                        //catch (Exception ex)
                                                        //{
                                                        //    logs.Error(ex.Message);
                                                        //}
                                                    }
                                                }
                                                hlyContent = info.TMPCONTENT;
                                                var mm = SmsCom.SendMsg(hlyContent, hlyMobile.TrimEnd(','));//发送短信
                                                if (mm.Success)
                                                {
                                                    ms.Msg     = mm.Msg;
                                                    ms.Success = mm.Success;
                                                    ms.Url     = "";
                                                }

                                                //info.SMSSENDUSERLIST = hlystr;//护林员人员
                                                //info.SMSSENDSTATUS = "1";//0 未发送 1 已发送 -1 发送失败
                                                // ms = YJ_DCSMS_SENDCls.Manager(info);
                                            }
                                        }
                                        #endregion

                                        #region 值班员接收人员
                                        if (model.SMSGROUPTYPE == "1")
                                        {
                                            var cityorg  = level.BYORGNO.Substring(0, 4) + "00000"; //市机构码
                                            var contyorg = level.BYORGNO.Substring(0, 6) + "000";   //县机构码
                                            if (i == 0)                                             //初次
                                            {
                                                _cityorg  = cityorg;
                                                _contyorg = contyorg;
                                            }
                                            else
                                            {
                                                if (_cityorg == cityorg)//循环相同的市级单位 跳出循环
                                                {
                                                    continue;
                                                }
                                                if (_contyorg == contyorg)//循环相同的县级单位 跳出循环
                                                {
                                                    continue;
                                                }
                                            }
                                            info.TMPCONTENT = subject[2].Replace("[cityconty]", level.TOPTOWNNAME).Replace("[num]", levelnum.ToString()); //短信内容replace
                                            string str     = cityorg + "," + contyorg;
                                            var    zbylist = OD_USERCls.GetOndutyUserid(level.DCDATE, str);                                               //获取值班员useridlist
                                            if (zbylist.Any())
                                            {
                                                //var zbystr = "";
                                                string zbyMobile  = "";              //值班员电话
                                                string zbyContent = info.TMPCONTENT; //值班员模板
                                                foreach (var zby in zbylist)
                                                {
                                                    var m = T_SYSSEC_IPSUSERCls.getModel(new T_SYSSEC_IPSUSER_SW {
                                                        USERID = zby.ToString()
                                                    });
                                                    if (!string.IsNullOrEmpty(m.PHONE))
                                                    {
                                                        zbyMobile += m.PHONE.Trim() + ",";
                                                        //if (zbylist.Count() == 1)
                                                        //{
                                                        //    zbystr = zby;
                                                        //}
                                                        //else
                                                        //{
                                                        //    zbystr += zby + ",";
                                                        //}
                                                        //try
                                                        //{
                                                        //    ////TODO  Send Message
                                                        //    //add redis
                                                        //    //队列
                                                        //    var msg = m.PHONE.Trim() + "|" + info.TMPCONTENT;
                                                        //    redisclient.EnqueueItemOnList("SendMsg", msg);//入队。
                                                        //    logs.Info("==入队列号码信息==" + msg);
                                                        //    // client.SendMsg(info.TMPCONTENT, m.PHONE);
                                                        //    Thread.Sleep(200);

                                                        //}
                                                        //catch (Exception ex)
                                                        //{
                                                        //    logs.Error(ex.Message);
                                                        //}
                                                    }
                                                }
                                                var mm = SmsCom.SendMsg(zbyContent, zbyMobile.TrimEnd(','));//发送短信
                                                if (mm.Success)
                                                {
                                                    ms.Msg     = mm.Msg;
                                                    ms.Success = mm.Success;
                                                    ms.Url     = "";
                                                }
                                                // info.SMSSENDUSERLIST = zbystr;//值班员人员
                                                //info.SMSSENDSTATUS = "1";//0 未发送 1 已发送 -1 发送失败
                                                //ms = YJ_DCSMS_SENDCls.Manager(info);
                                            }
                                            ++i;
                                        }
                                        #endregion
                                    }
                                }
                            }
                            #endregion
                        }
                        else
                        {
                            ms = new Message(false, "当前火险等级未达到预警,无需发短信!", "");
                        }
                    }
                    else
                    {
                        ms = new Message(false, "没有短信模板,不发短信!", "");
                    }
                }
            }
            else
            {
                ms = new Message(false, "传递短信模板主题与人员id参数错误!", "");
            }
            return(Json(ms));
        }
Beispiel #13
0
        /// <summary>
        /// 预警响应措施
        /// </summary>
        /// <returns></returns>
        public string YJXYCS()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("<table style='border:1px solid #c9dfbb;width:100%;height:100% cellpadding=0 cellspacing=0;text-align:center;margin:0 auto;'>");
            var BYORGNO = SystemCls.getCurUserOrgNo();

            if (PublicCls.OrgIsShi(BYORGNO))
            {
                BYORGNO = ConfigCls.getConfigValue("ProvincialCapital");//州府所在地行政区划编码
            }
            var DANGERCLASS = YJ_DANGERCLASSCls.getModel(new YJ_DANGERCLASS_SW {
                BYORGNO = BYORGNO
            }).DANGERCLASS;

            if (string.IsNullOrEmpty(DANGERCLASS))
            {
                BYORGNO     = BYORGNO.Substring(0, 6) + "000000000";//如果乡镇没有,查市的
                DANGERCLASS = YJ_DANGERCLASSCls.getModel(new YJ_DANGERCLASS_SW {
                    BYORGNO = BYORGNO
                }).DANGERCLASS;
                if (string.IsNullOrEmpty(DANGERCLASS))
                {
                    BYORGNO = ConfigCls.getConfigValue("ProvincialCapital");
                    //BYORGNO = ConfigurationManager.AppSettings["ProvincialCapital"].ToString();//如果市没有,查州的
                    DANGERCLASS = YJ_DANGERCLASSCls.getModel(new YJ_DANGERCLASS_SW {
                        BYORGNO = BYORGNO
                    }).DANGERCLASS;
                    if (string.IsNullOrEmpty(DANGERCLASS))
                    {
                        DANGERCLASS = "";
                    }
                }
            }
            ViewBag.DANGERCLASS = DANGERCLASS;
            var result      = YJ_XY_WORKCls.getModelListMan(new YJ_XY_WORK_SW {
            });
            var resultClass = T_SYS_DICTCls.getListModel(new T_SYS_DICTSW
            {
                DICTTYPEID = "24",
                DICTVALUE  = DANGERCLASS
            });//火情预警等级
            var resultDept = T_SYS_DICTCls.getListModel(new T_SYS_DICTSW {
                DICTTYPEID = "25"
            });                                                                                 //预警响应部门

            foreach (var v in resultClass)
            {
                sb.AppendFormat("<tr style='background:{0};color:#000000'>", v.STANDBY1);
                //sb.AppendFormat("<td style='color:#000;font-weight:bold;font-size:14px;'>火险等级</td>");
                sb.AppendFormat("<td colspan=2 style='color:#000000;font-size:14px;text-align:center'>{0}</td>", v.DICTNAME);
                sb.AppendFormat("</tr>");
                foreach (var x in resultDept)
                {
                    sb.AppendFormat("<tr  style='background:{0};color:#000000'>", v.STANDBY1);
                    sb.AppendFormat("<td style='color:#000;font-weight:bold;font-size:9pt;'>{0}</td>", x.DICTNAME);
                    var jbs = result.Where(p => p.DANGERCLASS == DANGERCLASS && p.YJXYDEPT == x.DICTVALUE).FirstOrDefault();
                    if (jbs != null)
                    {
                        sb.AppendFormat("<td style='text-align:left;font-size:9pt;'>{0}</td>", jbs.YJXYCONTENT);
                    }
                    //sb.AppendFormat("{0}", jbs.YJXYCONTENT);
                    //else
                    //    sb.AppendFormat("{0}", "");
                    //sb.AppendFormat("</td>");
                    sb.AppendFormat("</tr>");
                }
            }
            sb.AppendFormat("</table>");
            return(sb.ToString());
        }