Example #1
0
 public object DeleteApplicationSysInfo(string id)
 {
     try
     {
         SystemSettingBase settings = SystemSettingBase.CreateInstance();
         if (settings.SysMySqlDB != null)
         {
             ConnString.MySqldb = settings.SysMySqlDB.ConnectionString;
         }
         ApplicationSysInfo info = ApplicationSysInfoLogical.GetApplicationSysInfoById(new Guid(id));
         if (null != info)
         {
             ApplicationSysInfoLogical.DeleteApplicationSysInfoById(new Guid(id));
             return(string.Format("删除【{0}】应用系统成功!", info.name));
         }
         else
         {
             return(string.Format("系统不存在【{0}】应用系统信息!", info.name));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
        /// <summary>
        /// 接口初始化业务逻辑方法
        /// </summary>
        /// <param name="interfaceName">接口名</param>
        /// <param name="applicationName">应用系统名</param>
        /// <param name="server">服务器地址</param>
        /// <param name="user">用户名</param>
        /// <param name="userPwd">密码</param>
        /// <param name="charger">负责人</param>
        /// <param name="phone">负责人联系号码</param>
        /// <param name="timeout">超时时间</param>
        /// <param name="path">帮助文档存放路径</param>
        /// <param name="descript">描述</param>
        /// <param name="appid">应用编号</param>
        public static void SaveInterfaceInitial(string interfaceName, string user, string userPwd, string charger, string phone, int timeout, string path, string descript, string urlAddress, string exeptionlevel, string affectProduction, string type, string appid, string destAppid)
        {
            //生成接口编号id
            Guid id = Guid.NewGuid();
            ApplicationSysInfo appinfo = ApplicationSysInfoLogical.GetApplicationSysInfoById(new Guid(appid));
            ApplicationSysInfo destapp = ApplicationSysInfoLogical.GetApplicationSysInfoById(new Guid(destAppid));

            //判断接口配置信息是否存在,如果不存在则新增
            if (InterfaceConfigInfoOperation.GetInterfaceConfigInfo(interfaceName, appinfo.name, appinfo.server) == null)
            {
                //接口配置信息
                InterfaceConfigInfo config = new InterfaceConfigInfo();
                config.Id                  = id;
                config.InterfaceName       = interfaceName;
                config.ApplicationName     = appinfo.name;
                config.ServerAddress       = appinfo.server;
                config.ServerUser          = user;
                config.UserPwd             = userPwd;
                config.PersonOfChargeName  = charger;
                config.PersonOfChargePhone = phone;
                config.ConnectedTimeout    = timeout;
                config.DocumentHelpPath    = path;
                config.UrlAddress          = urlAddress;
                config.Description         = descript;
                config.Exeptionlevel       = Int32.Parse(exeptionlevel);
                config.AffectProduction    = Int32.Parse(affectProduction);
                config.Type                = Int32.Parse(type);
                config.appid               = new Guid(appid);
                config.CreateTime          = DateTime.Now;
                //应用系统接口关系
                ApplicationInterfaceRelation relation = new ApplicationInterfaceRelation();
                relation.Id            = Guid.NewGuid();
                relation.appId         = appinfo.Id;
                relation.appname       = appinfo.name;
                relation.interfaceId   = id;
                relation.interfacename = interfaceName;
                relation.destinappid   = destapp.Id;
                relation.destinappname = destapp.name;
                relation.updatetime    = DateTime.Now;
                //接口实时状态信息
                InterfaceRealtimeInfo realtime = new InterfaceRealtimeInfo();
                realtime.Id              = id;
                realtime.InterfaceName   = interfaceName;
                realtime.ApplicationName = appinfo.name;
                realtime.ServerAddress   = appinfo.server;
                realtime.appid           = new Guid(appid);
                realtime.StateCode       = 0;
                realtime.UpdateTime      = DateTime.Now;

                InterfaceConfigInfoOperation.AddOrUpdateInterfaceConfigInfo(config, ModifierType.Add);
                InterfaceRealtimeInfoOperation.AddOrUpdateInterceRealtimeInfo(realtime, ModifierType.Add);
                ApplicationInterfaceRelationOperation.AddOrUpdateApplicationInterfaceRelation(relation, ModifierType.Add);
            }
        }
Example #3
0
 public object GetApplicationSysInfo(string name, string server)
 {
     try
     {
         SystemSettingBase settings = SystemSettingBase.CreateInstance();
         if (settings.SysMySqlDB != null)
         {
             ConnString.MySqldb = settings.SysMySqlDB.ConnectionString;
         }
         ApplicationSysInfo info = ApplicationSysInfoLogical.GetApplicationSysInfo(name, server);
         return(new JsonResult(info));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
 public object GetApplicationSysInfoById(string id)
 {
     try
     {
         SystemSettingBase settings = SystemSettingBase.CreateInstance();
         if (settings.SysMySqlDB != null)
         {
             ConnString.MySqldb = settings.SysMySqlDB.ConnectionString;
         }
         ApplicationSysInfo info = ApplicationSysInfoLogical.GetApplicationSysInfoById(new Guid(id));
         return(new JsonResult(info));
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Example #5
0
 public object GetApplicationSysInfoList(string fields, string key, string order, string ascOrdesc, int page, int rows)
 {
     try
     {
         SystemSettingBase settings = SystemSettingBase.CreateInstance();
         if (settings.SysMySqlDB != null)
         {
             ConnString.MySqldb = settings.SysMySqlDB.ConnectionString;
         }
         PageInfo pageInfo = new PageInfo()
         {
             PageIndex = rows * (page - 1),
             PageSize  = rows,
             RecCount  = 0
         };
         if (string.IsNullOrEmpty(fields))
         {
             fields = "*";
         }
         string whereCondition = string.Empty;
         if (!string.IsNullOrEmpty(key))
         {
             whereCondition = string.Format(" where name like '%{0}%' or server like '%{0}%' or userdep like '%{0}%' or chargeman like '%{0}%' or phone like '%{0}%' ", key);
         }
         string orderby = string.Empty;
         if (!string.IsNullOrEmpty(order))
         {
             orderby = string.Format(" order by {0} {1}", order, ascOrdesc);
         }
         string limit = string.Empty;
         limit = string.Format(" limit {0},{1} ", pageInfo.PageIndex, pageInfo.PageSize);
         List <ApplicationSysInfo> list = ApplicationSysInfoLogical.GetApplicationSysInfoList(fields, whereCondition);
         pageInfo.RecCount = list.Count;
         List <ApplicationSysInfo>       target = ApplicationSysInfoLogical.GetApplicationSysInfoList(fields, whereCondition, orderby, limit);
         GridResult <ApplicationSysInfo> result = new GridResult <ApplicationSysInfo>(target, pageInfo.RecCount);
         return(new JsonResult(result));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #6
0
 public object UpdateInterfaceConfigInfo(string id, string interfaceName, string user, string pwd, string charger, string phone, int timeout, string docPath, string desc, string urlAddress, string exeptionlevel, string affectProduction, string type, string appid, string destapp)
 {
     try
     {
         ApplicationSysInfo appinfo = ApplicationSysInfoLogical.GetApplicationSysInfoById(new Guid(appid));
         if (null != InterfaceConfigInfoOperation.GetInterfaceConfigInfo(interfaceName, appinfo.name, appinfo.server))
         {
             InterfaceConfigInitBizProcess.UpdateInterfaceConfigInfo(id, interfaceName, user, pwd, charger, phone, timeout, docPath, desc, urlAddress, exeptionlevel, affectProduction, type, appid, destapp);
             return(string.Format("更新【{0}】配置信息成功!", interfaceName));
         }
         else
         {
             return(string.Format("不存在【{0}】配置信息!", interfaceName));
         }
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Example #7
0
        public static List <destinaappStatics> GetDestinapplicationList(Guid appid)
        {
            List <destinaappStatics> dlist = new List <destinaappStatics>();

            try
            {
                DataTable dt2 = ApplicationSysInfoLogical.GetApplicationInfoStaticsDetails(appid);
                if (dt2.Rows.Count > 0)
                {
                    foreach (DataRow dr2 in dt2.Rows)
                    {
                        destinaappStatics o = new destinaappStatics();
                        o.destinappid      = dr2.Field <Guid>("destinappid");
                        o.destinappname    = dr2.Field <string>("destinappname");
                        o.interfaceId      = dr2.Field <Guid>("interfaceId");
                        o.interfacename    = dr2.Field <string>("interfacename");
                        o.StateCode        = dr2.Field <int>("StateCode");
                        o.updatetime       = dr2.Field <DateTime>("UpdateTime");
                        o.ConnectedTimeout = dr2.Field <int>("ConnectedTimeout");
                        if (o != null)
                        {
                            if ((DateTime.Now - o.updatetime).TotalMinutes > o.ConnectedTimeout)
                            {
                                o.StateCode = 0;
                            }
                            else
                            {
                                o.StateCode = 1;
                            }
                            dlist.Add(o);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(string.Format("GetDestinapplicationList()发生错误,错误信息如下:{0}", ex));
            }
            return(dlist);
        }
Example #8
0
 public static void UpdateApplicationSysInfo(Guid id, string name, string server, string userdep, string chargeman, string phone, string description)
 {
     try
     {
         ApplicationSysInfo info = new ApplicationSysInfo();
         if (null != ApplicationSysInfoLogical.GetApplicationSysInfo(name, server))
         {
             info.Id          = id;
             info.name        = name;
             info.server      = server;
             info.userdep     = userdep;
             info.chargeman   = chargeman;
             info.phone       = phone;
             info.description = description;
             info.createtime  = DateTime.Now;
             ApplicationSysInfoLogical.AddOrUpdateApplicationSysInfo(info, ModifierType.Update);
         }
     }
     catch (Exception ex)
     {
         log.Error(string.Format("UpdateApplicationSysInfo()发生错误,错误信息如下:{0}", ex));
     }
 }
Example #9
0
 public object UpdateApplicationSysInfo(string id, string name, string server, string userdep, string chargeman, string phone, string description, string level)
 {
     try
     {
         SystemSettingBase settings = SystemSettingBase.CreateInstance();
         if (null != settings.SysMySqlDB)
         {
             ConnString.MySqldb = settings.SysMySqlDB.ConnectionString;
         }
         if (null != ApplicationSysInfoLogical.GetApplicationSysInfoById(new Guid(id)))
         {
             ApplicationSysInfo info = new ApplicationSysInfo()
             {
                 Id          = new Guid(id),
                 name        = name,
                 server      = server,
                 userdep     = userdep,
                 chargeman   = chargeman,
                 phone       = phone,
                 description = description,
                 level       = Int32.Parse(level),
                 createtime  = DateTime.Now
             };
             ApplicationSysInfoLogical.AddOrUpdateApplicationSysInfo(info, ModifierType.Update);
             return(string.Format("更新【{0},{1}】应用系统信息成功!", name, server));
         }
         else
         {
             return(string.Format("不存在【{0},{1}】该应用系统信息!", name, server));
         }
     }
     catch (Exception ex)
     {
         return(string.Format("更新【{0,{1}}】应用系统信息失败!异常信息如下:{2}", name, server, ex.Message));
     }
 }
Example #10
0
        public static List <DataStatics> GetDataStaics()
        {
            List <DataStatics> list = new List <DataStatics>();

            try
            {
                DataTable dt1 = ApplicationSysInfoLogical.GetApplicationInfoStatics();
                if (dt1.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt1.Rows)
                    {
                        DataStatics obj = new DataStatics();
                        obj.appId     = dr.Field <Guid>("Id");
                        obj.appname   = dr.Field <string>("name");
                        obj.server    = dr.Field <string>("server");
                        obj.chargeman = dr.Field <string>("chargeman");
                        obj.level     = dr.Field <int>("level");
                        obj.phone     = dr.Field <string>("phone");
                        obj.userdep   = dr.Field <string>("userdep");
                        obj.num       = dr.Field <long>("num");
                        List <destinaappStatics> excplist = new List <destinaappStatics>();
                        DataTable dt2 = ApplicationSysInfoLogical.GetApplicationInfoStaticsDetails(obj.appId);
                        if (dt2.Rows.Count > 0)
                        {
                            foreach (DataRow dr2 in dt2.Rows)
                            {
                                destinaappStatics o = new destinaappStatics();
                                o.destinappid      = dr2.Field <Guid>("destinappid");
                                o.destinappname    = dr2.Field <string>("destinappname");
                                o.interfaceId      = dr2.Field <Guid>("interfaceId");
                                o.interfacename    = dr2.Field <string>("interfacename");
                                o.StateCode        = dr2.Field <int>("StateCode");
                                o.updatetime       = dr2.Field <DateTime>("UpdateTime");
                                o.ConnectedTimeout = dr2.Field <int>("ConnectedTimeout");
                                if (o != null)
                                {
                                    //double i = (DateTime.Now - o.updatetime).TotalMinutes;
                                    //接口状态码为0或上次更新时间与当前时间差大于超时时间间隔
                                    if (o.ConnectedTimeout < (DateTime.Now - o.updatetime).TotalMinutes || o.StateCode == 0)
                                    {
                                        excplist.Add(o);
                                    }
                                }
                            }
                        }
                        if (excplist.Count > 0)
                        {
                            obj.errorNum = excplist.Count;
                            obj.statu    = 0;
                        }
                        else
                        {
                            obj.errorNum = 0;
                            obj.statu    = 1;
                        }
                        if (obj != null)
                        {
                            list.Add(obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(string.Format("GetDataStaics()发生错误,错误信息如下:{0}", ex));
            }
            return(list);
        }