public MessageEntity GetTable(DateTime?startTime, DateTime?endTime) { var whereStr = ""; if (startTime != null && endTime != null) { whereStr = $" and E.UpTime >='{startTime}'and E.UpTime <= '{endTime}' "; } var sqlStr = $@"SELECT ISNULL(P.PersonName,'匿名') as PersonName ,COUNT(EventID)as ECount FROM M_Event E LEFT JOIN M_EventFrom as c ON E.EventFromId=c.EventFromId left join L_Person P ON E.PersonId=P.PersonId where E.DeleteStatus=0 and c.EventFromId=3 {whereStr} GROUP BY P.PersonName"; try { using (var conn = ConnectionFactory.GetDBConn(ConnectionFactory.DBConnNames.PipeInspectionBase_Gis_OutSide)) { List <dynamic> eventType = conn.Query <dynamic>(sqlStr).ToList(); return(MessageEntityTool.GetMessage(eventType.Count(), eventType)); } } catch (Exception e) { return(MessageEntityTool.GetMessage(ErrorType.SqlError, e.Message)); } }
/// <summary> /// 获取管网信息通过坐标(EPSG:4547) /// </summary> /// <param name="latitude">纬度</param> /// <param name="longitude">精度</param> /// <returns></returns> public MessageEntity Get(string latitude, string longitude) { if (!string.IsNullOrEmpty(latitude) && !string.IsNullOrEmpty(longitude)) { string regexExpression = @"^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$"; if (Regex.IsMatch(latitude, regexExpression) && Regex.IsMatch(longitude, regexExpression)) { var pipe = _pipeDAL.Get(latitude, longitude, out string errMessage); if (pipe != null) { return(MessageEntityTool.GetMessage(1, pipe)); } else { return(MessageEntityTool.GetMessage(ErrorType.SqlError, errMessage)); } } else { return(MessageEntityTool.GetMessage(ErrorType.FieldError, "", "坐标格式有误")); } } else { return(MessageEntityTool.GetMessage(ErrorType.FieldError, "", "坐标格式有误")); } }
public MessageEntity RefreshFunPurview(int[] functionIds, int iPurviewID, int iPurviewType) { if (functionIds == null || functionIds.Length == 0) { return(MessageEntityTool.GetMessage(ErrorType.FieldError, "functionIds参数有误")); } List <P_FunPurview> funPurviews = new List <P_FunPurview>(); foreach (int id in functionIds) { funPurviews.Add(new P_FunPurview() { iPurviewID = iPurviewID, iPurviewType = iPurviewType, iFunID = id }); } bool result = _p_FunPurviewDAL.RefreshFunPurview(funPurviews, out string msg); if (result) { return(MessageEntityTool.GetMessage(1)); } else { return(MessageEntityTool.GetMessage(ErrorType.SystemError, msg)); } }
public MessageEntity GetPipeAndPointStatistic(string equipment_type, string installation_address, string material_science, string caliber, string startCompletion_date, string endCompletion_date, string sort, string ordering, string[] groupFields) { MessageEntity mEntity; if (groupFields != null) { groupFields = groupFields.Where(s => !string.IsNullOrEmpty(s)).ToArray(); } if (!string.IsNullOrEmpty(startCompletion_date) && !string.IsNullOrEmpty(endCompletion_date)) { if (!DateTime.TryParse(startCompletion_date, out DateTime sDate) || !DateTime.TryParse(endCompletion_date, out DateTime eDate)) { return(MessageEntityTool.GetMessage(ErrorType.FieldError, "", "日期格式有误")); } if (sDate > eDate) { return(MessageEntityTool.GetMessage(ErrorType.FieldError, "", "起始日期不能大于结束日期")); } var result = _pipeDAL.GetPipeAndPointStatistics(equipment_type, installation_address, material_science, caliber, sDate, eDate, sort, ordering, groupFields, out string errMessge, out mEntity); } else { var result = _pipeDAL.GetPipeAndPointStatistics(equipment_type, installation_address, material_science, caliber, null, null, sort, ordering, groupFields, out string errMessge, out mEntity); } return(mEntity); }
public MessageEntity Post(string planName, int planTypeId, int planTypeLB, int planCycleId, int isFeedBack, int isNomalPlan, int moveType, string equipmentIdList, string equipmentNameList, [FromBody] List <Equipment> equmentInfo, DateTime?invalidationDate, int?planAreaId = 0, int?planLineId = 0, string planPath = "") { if (UserInfoCache.Authorize == null) { return(MessageEntityTool.GetMessage(ErrorType.NotAvilebalToken)); } if (string.IsNullOrEmpty(planName) || string.IsNullOrEmpty(equipmentIdList) || string.IsNullOrEmpty(equipmentNameList)) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } if (invalidationDate == null) { invalidationDate = DateTime.Now; } if (planTypeId == 1) { //区域巡检 planLineId = 0; } else { //路线巡检 planAreaId = 0; } //List<Equipment> equipmentList = new List<Equipment>(); //if (!string.IsNullOrEmpty(equmentInfo)) //{ // equipmentList = JsonConvert.DeserializeObject<List<Equipment>>("[" + equmentInfo + "]"); //} var result = _planManageDAL.Add(planName, planTypeId, planTypeLB, equipmentIdList, planPath, planCycleId, isFeedBack, isNomalPlan, equipmentNameList, "", moveType, invalidationDate.Value, planAreaId.Value, planLineId.Value, UserInfoCache.Authorize.UserName, equmentInfo); return(result); }
/// <summary> /// /// </summary> /// <param name="pointId"></param> /// <param name="pointTable"></param> /// <returns></returns> public MessageEntity UpdatePointTableByPointId(PointAreaInfo pointTable) { using (var conn = ConnectionFactory.GetDBConn(ConnectionFactory.DBConnNames.PipeInspectionBase_Gis_OutSide)) { var rows = 0; string sql = $@"select count(0) as count from PointAreaInfo p where p.PlanAreaId = {pointTable.PlanAreaId} and p.PointName='{ pointTable.PointName}'"; List <dynamic> pointcc = conn.Query <dynamic>(sql).ToList(); if (pointcc[0].count > 0) { return(MessageEntityTool.GetMessage(ErrorType.SqlError, "同一区域内不能添加相同关键点")); } var updateSql = DapperExtentions.MakeUpdateSql(pointTable); if (string.IsNullOrEmpty(updateSql)) { return(MessageEntityTool.GetMessage(ErrorType.SqlError, "请检查实体类")); } try { rows = conn.Execute(updateSql, pointTable); return(MessageEntityTool.GetMessage(rows)); } catch (Exception e) { return(MessageEntityTool.GetMessage(ErrorType.SqlError, e.Message)); } } }
public MessageEntity AssignTask(string taskName, string proraterDeptName, int proraterDeptId, string proraterName, int proraterId, DateTime starTime, DateTime endTime, string descript, int planId, string planName) { if (starTime == endTime) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } L_Task task = new L_Task() { TaskName = taskName, ProraterDeptName = proraterDeptName, ProraterDeptId = proraterDeptId, ProraterName = proraterName, ProraterId = proraterId, VisitStarTime = starTime, VisitOverTime = endTime, Descript = descript, Operator = UserInfoCache.Authorize.UserName, OperateDate = DateTime.Now, PlanId = planId, PlanName = planName }; return(_planManageDAL.AssignTask(task)); }
/// <summary> /// 修改用户 /// </summary> /// <param name="iAdminID"></param> /// <param name="admin"></param> public MessageEntity Put(int iAdminID, [FromBody] P_Admin admin) { if (admin == null) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } var checkAdmin = base.CommonDAL.IsUserExist(admin.cAdminName, admin.CJobNumber, iAdminID, out string errorMsg); if (checkAdmin != null && !string.IsNullOrEmpty(checkAdmin.cAdminName)) { if (string.IsNullOrEmpty(errorMsg)) { if (checkAdmin.cAdminName == admin.cAdminName) { return(MessageEntityTool.GetMessage(ErrorType.NotUnique, "", "用户名称不能重复")); } if (checkAdmin.CJobNumber == admin.CJobNumber) { return(MessageEntityTool.GetMessage(ErrorType.NotUnique, "", "用户工号不能重复")); } } else { return(MessageEntityTool.GetMessage(ErrorType.SqlError, errorMsg)); } } admin.iAdminID = iAdminID; return(base.CommonDAL.UpdateUser(admin)); }
public MessageEntity GetLineChart(string[] monthArry, string yearStr, string startMStr, string endMStr) { var sTime = yearStr + "-" + ChangeStr(startMStr) + "-" + "01"; var eTime = yearStr + "-" + ChangeStr((Convert.ToInt32(endMStr) + 1).ToString()) + "-" + "01"; if ((Convert.ToInt32(endMStr) + 1).ToString() == "13") { eTime = (Convert.ToInt32(yearStr) + 1).ToString() + "-01-01"; } string sqlstr = string.Format(@"SELECT SUM(1) [Count], et.EventTypeName,datepart(mm,e.UpTime) [Month] FROM M_Event e LEFT JOIN M_EventType et ON e.EventTypeId = et.EventTypeId WHERE e.DeleteStatus = 0 AND EventFromId = 3 AND UpTime >= '{0}' AND UpTime < '{1}' GROUP BY et.EventTypeName,datepart(mm,e.UpTime)" , sTime, eTime); using (var conn = ConnectionFactory.GetDBConn(ConnectionFactory.DBConnNames.PipeInspectionBase_Gis_OutSide)) { try { DataTable dt_type = new DataTable(); dt_type.Load(conn.ExecuteReader(sqlstr)); return(MessageEntityTool.GetMessage(dt_type.Rows.Count, dt_type)); } catch (Exception e) { return(MessageEntityTool.GetMessage(ErrorType.SqlError, e.Message)); } } }
/// <summary> /// 新增 /// </summary> /// <param name="value"></param> /// <returns></returns> public MessageEntity Post([FromBody] P_Role value) { if (value == null) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } return(_roleDAL.Add(value)); }
/// <summary> /// 添加工作时段列表 /// </summary> /// <param name="value">StartTime/EndTime不能为空 格式HH:mm:ss</param> public MessageEntity Post([FromBody] L_WorkTimeInterval value) { if (string.IsNullOrEmpty(value.StartTime) || string.IsNullOrEmpty(value.EndTime)) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } return(_workTimeInterval.Add(value)); }
public MessageEntity GetPOI(string name) { if (string.IsNullOrEmpty(name)) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } return(_pOIDAL.Get(name)); }
/// <summary> /// 新增 /// </summary> /// <param name="value"></param> /// <returns></returns> public MessageEntity Post([FromBody] P_Department value) { if (value == null) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } return(_departmentDAL.Add(value)); }
public MessageEntity Update(P_Department department) { if (IsExist(department)) { return(MessageEntityTool.GetMessage(ErrorType.NotUnique, "已存在相同部门名称")); } base.UpdateEntity(department, ConnectionFactory.DBConnNames.GisPlateform, out MessageEntity messageEntity); return(messageEntity); }
public MessageEntity Update(P_Role role) { if (IsExist(role)) { return(MessageEntityTool.GetMessage(ErrorType.OprationError, "", "已存在相同角色名称")); } base.UpdateEntity(role, ConnectionFactory.DBConnNames.GisPlateform, out MessageEntity messageEntity); return(messageEntity); }
public MessageEntity Delete(string taskIds) { if (string.IsNullOrEmpty(taskIds)) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } return(_taskManageDAL.Delete(taskIds.Split(','))); }
/// <summary> /// 巡检人员上报位置 /// </summary> /// <param name="positionX">上报位置经度</param> /// <param name="positionY">上报位置纬度</param> /// <param name="upTime">位置上报事件</param> /// <param name="personId">位置上报人员</param> /// <param name="isOnline">是否在线0:不在线,1:在线</param> /// <returns></returns> public MessageEntity Post(string positionX, string positionY, DateTime upTime, int personId, int isOnline) { if (string.IsNullOrEmpty(positionX) || string.IsNullOrEmpty(positionY) || isOnline > 1) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } return(_currentPositonDAL.Add(positionX, positionY, upTime.ToString(), personId, isOnline)); }
/// <summary> /// 修改 /// </summary> /// <param name="iDeptID"></param> /// <param name="value"></param> /// <returns></returns> public MessageEntity Put(int iDeptID, [FromBody] P_Department value) { if (value == null) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } value.iDeptID = iDeptID; return(_departmentDAL.Update(value)); }
public MessageEntity Delete(P_Department department) { if (IsExistUser(department)) { return(MessageEntityTool.GetMessage(ErrorType.OprationError, "", "该部门下存在用户,不允许删除")); } base.DeleteEntity(department, ConnectionFactory.DBConnNames.GisPlateform, out MessageEntity messageEntity); return(messageEntity); }
/// <summary> /// 和达第三方登陆 /// </summary> /// <param name="hdAcc">用户名</param> /// <param name="hdStamp">时间戳</param> /// <param name="hdSSOKey">公钥</param> /// <param name="systemType">登陆类型 1:web 3手机App 4c/s</param> /// <returns></returns> public MessageEntity HDLogin(string hdAcc, string hdStamp, string hdSSOKey, int systemType = 1) { if (string.IsNullOrEmpty(hdAcc)) { return(MessageEntityTool.GetMessage(ErrorType.OprationError, "", "用户名不能为空")); } if (string.IsNullOrEmpty(hdStamp)) { return(MessageEntityTool.GetMessage(ErrorType.OprationError, "", "时间戳不能为空")); } if (string.IsNullOrEmpty(hdSSOKey)) { return(MessageEntityTool.GetMessage(ErrorType.OprationError, "", "公钥不能为空")); } string hdKey = string.Empty; try { hdKey = Sha1Helper.Encryption(ConfigurationManager.AppSettings["hdSalt"].ToString() + hdAcc + hdStamp); } catch (Exception e) { return(MessageEntityTool.GetMessage(ErrorType.FieldError, e.Message)); } if (hdKey.ToLower().Equals(hdSSOKey.Trim().ToString().ToLower())) { var admin = base.CommonDAL.GetUserInfoByName(hdAcc, out string errorMsg); if (admin != null && admin.cAdminName != null) { admin.cAdminPassWord = ""; admin.Token = CreateAuthention(admin); var funcs = base.CommonDAL.GetUserAuthority(admin.iAdminID.ToString(), systemType, out string userAuthorityErrorMsg); if (funcs != null && funcs.Count() > 0) { admin.UserAuthority = funcs; } var result = MessageEntityTool.GetMessage(1, admin, true, "登陆成功", 1); return(result); } else if (string.IsNullOrEmpty(errorMsg)) { return(MessageEntityTool.GetMessage(ErrorType.NoLogin, "", "没有该用户")); } else { return(MessageEntityTool.GetMessage(ErrorType.SystemError, errorMsg)); } } else { return(MessageEntityTool.GetMessage(ErrorType.NoAuthority, "", "第三方登陆验证失败")); } }
/// <summary> /// 登陆 /// </summary> /// <param name="loginContent">登陆名称</param> /// <param name="password">密码</param> /// <param name="systemType">登陆类型 1:web 3手机App 4c/s</param> /// <returns></returns> public MessageEntity Login(string loginContent, string password, int systemType = 1) { if (string.IsNullOrEmpty(loginContent)) { return(MessageEntityTool.GetMessage(ErrorType.OprationError, "", "用户名不能为空")); } if (string.IsNullOrEmpty(password)) { return(MessageEntityTool.GetMessage(ErrorType.OprationError, "", "密码不能为空")); } //验证用户是否输入密码错误超过4次 var isDayFee = base.CommonDAL.IsDayFeezing(loginContent, out string errMsg1); //密码输错超过4次 不允许登录 if (isDayFee) { return(MessageEntityTool.GetMessage(ErrorType.OprationError, "", "已限制登录,请在10分钟后重试!")); } var admin = base.CommonDAL.GetUserInfo(loginContent, password, out string errorMsg); if (admin != null && admin.cAdminName != null) { #region 验证用户是否锁定 //验证用户是否锁定,锁定不允许登录 var islocked = base.CommonDAL.IsLocked(loginContent, out string errMsg2); //密码输错超过4次 不允许登录 if (islocked) { return(MessageEntityTool.GetMessage(ErrorType.OprationError, "", "已限制登录,用户账户已被锁定")); } #endregion admin.cAdminPassWord = ""; admin.Token = CreateAuthention(admin); var funcs = base.CommonDAL.GetUserAuthority(admin.iAdminID.ToString(), systemType, out string userAuthorityErrorMsg); if (funcs != null && funcs.Count() > 0) { admin.UserAuthority = funcs; } var result = MessageEntityTool.GetMessage(1, admin, true, "登陆成功", 1); //插入密码错误日冻结表中 var funcssucess = base.CommonDAL.InsertDayFeezing(loginContent, "1"); return(result); } else if (string.IsNullOrEmpty(errorMsg)) { //插入密码错误日冻结表中 var funcs = base.CommonDAL.InsertDayFeezing(loginContent, "0"); return(MessageEntityTool.GetMessage(ErrorType.NoLogin, "", "用户名或密码错误")); } else { return(MessageEntityTool.GetMessage(ErrorType.SystemError, errorMsg)); } }
/// <summary> /// 修改工作时段列表 /// </summary> /// <param name="intervalId">id</param> /// <param name="value">StartTime/EndTime不能为空 格式HH:mm:ss</param> public MessageEntity Put(int intervalId, [FromBody] L_WorkTimeInterval value) { if (string.IsNullOrEmpty(value.StartTime) || string.IsNullOrEmpty(value.EndTime)) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } value.IntervalId = intervalId; return(_workTimeInterval.Update(value)); }
/// <summary> /// 修改 /// </summary> /// <param name="iRoleID"></param> /// <param name="value"></param> /// <returns></returns> public MessageEntity Put(int iRoleID, [FromBody] P_Role value) { if (value == null) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } value.iRoleID = iRoleID; return(_roleDAL.Update(value)); }
/// <summary> /// 事件类型分析--pieChart /// </summary> /// <param name="startTime">yyyy-MM-dd(必填)</param> /// <param name="endTime">yyyy-MM-dd(必填)</param> /// <returns></returns> public MessageEntity GetEventTypePieChart(DateTime?startTime = null, DateTime?endTime = null) { if (startTime == null || endTime == null || startTime.Value > endTime.Value) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } endTime = endTime.Value.AddDays(1).AddSeconds(-1); return(_eventTypeStatisticsDAL.GetPieChart(startTime.Value, endTime.Value)); }
/// <summary> /// 获取错误信息枚举 /// </summary> /// <returns></returns> public MessageEntity GetErrorEnum() { Dictionary <string, int> errorEnum = new Dictionary <string, int>(); foreach (ErrorType item in Enum.GetValues(typeof(ErrorType))) { errorEnum.Add(item.ToString(), (int)item); } return(MessageEntityTool.GetMessage(1, errorEnum, true, "", 1)); }
public MessageEntity Logout() { //if (base.CheckUserLoginState()) //{ // HttpCookie userCookie = Request.Cookies[FormsAuthentication.FormsCookieName]; // FormsAuthentication.SignOut(); // Response.Cookies["FormsAuthentication.FormsCookieName"].Expires = DateTime.Now.AddDays(-1); //} return(MessageEntityTool.GetMessage(0)); }
/// <summary> /// 添加事件分类内容 /// </summary> /// <param name="eventType"> string EventTypeName 事件名称 /// /int ExecTime 执行时间/int ParentTypeId 上级分类Id/</param> /// <returns></returns> // POST api/<controller> public MessageEntity Post([FromBody] M_EventType eventType) { if (string.IsNullOrEmpty(eventType.EventTypeName) || eventType.ExecTime == null) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } var messageEntity = _eventTypeDAL.AddEventType(eventType); return(messageEntity); }
/// <summary> /// 添加功能模块 /// </summary> /// <param name="eventType"> string EventTypeName 事件名称 /// <returns></returns> // POST api/<controller> public MessageEntity Post([FromBody] P_Function function) { if (function.FunctionType != 4) { if (string.IsNullOrEmpty(function.cFunName)) { return(MessageEntityTool.GetMessage(ErrorType.FieldError, "", "非C/S端 模块URL不能为空")); } } return(_p_FunPurviewDAL.PostFunction(function)); }
/// <summary> ///按照时间统计事件来源统计上报数量(折线图) /// </summary> /// <param name="startTime">开始事件</param> /// <param name="endTime">结束事件</param> /// <returns></returns> public MessageEntity EChatLineEventFromStatistics(DateTime?startTime = null, DateTime?endTime = null) { string EChatX = ""; string Distinct = "";//折线图类型组,字符串 //1.按照事件和事件来源统计数量 DataTable eventFromdt = _mainTainStatisticsDAL.EventFromStatisticsbyDate(startTime, endTime); //2.查询唯一时间(事件上报时间) DataTable DtDatedt = _mainTainStatisticsDAL.DtDateByEventfromStatistics(startTime, endTime); //3.查找折线图类型(事件来源名称) DataTable EventFromNamedt = _mainTainStatisticsDAL.EventFromNameStatistics(startTime, endTime); List <dynamic> seriesList = new List <dynamic>(); //遍历时间类别,电话上报,巡检上报等 for (int i = 0; i < EventFromNamedt.Rows.Count; i++) { List <double> EChatValue = new List <double>(); Distinct += EventFromNamedt.Rows[i]["EventFromName"].ToString(); if (i != EventFromNamedt.Rows.Count - 1) { Distinct += ","; } //使用唯一时间进行遍历查询 for (int j = 0; j < DtDatedt.Rows.Count; j++) { DataRow[] drEventInfoByDate = eventFromdt.Select(" EventFromName = '" + EventFromNamedt.Rows[i]["EventFromName"].ToString() + "' and LineDate = '" + DtDatedt.Rows[j]["LineDate"] + "'"); if (drEventInfoByDate.Length > 0) { EChatValue.Add(Convert.ToDouble(drEventInfoByDate[0]["CCount"])); } else { EChatValue.Add(0); } } //series += " { name: '" + DistinctDT.Rows[i]["PersonName"].ToString() + "', type: 'line', data: [" + EChatValue + "], },|"; EchartSeries s = new EchartSeries(); s.name = EventFromNamedt.Rows[i]["EventFromName"].ToString(); s.type = "line"; s.data = EChatValue; seriesList.Add(s); } //获取X轴坐标 for (int x = 0; x < DtDatedt.Rows.Count; x++) { EChatX += DtDatedt.Rows[x]["LineDate"].ToString(); if (x != DtDatedt.Rows.Count - 1) { EChatX += ","; } } var returnJson = new { p1 = EChatX, p2 = Distinct, p3 = seriesList }; return(MessageEntityTool.GetMessage(1, returnJson)); }
/// <summary> /// 根据pointId修改pointAreaInfo /// </summary> /// <param name="pointId">PointId</param> /// <param name="pointAreaInfo">实体PointX/PointY/PointName不可为空</param> /// <returns></returns> // PUT api/<controller>/5 public MessageEntity Put(int pointId, [FromBody] PointAreaInfo pointAreaInfo) { if (string.IsNullOrEmpty(pointAreaInfo.PointX) || string.IsNullOrEmpty(pointAreaInfo.PointY) || string.IsNullOrEmpty(pointAreaInfo.PointName)) { return(MessageEntityTool.GetMessage(ErrorType.FieldError)); } pointAreaInfo.PointId = pointId; var messageEntity = _pointAreaInfoDAL.UpdatePointTableByPointId(pointAreaInfo); return(messageEntity); }