object HandleState(APIContext context) { List <object> retList = new List <object>(); retList.Add(new { StateName = "待受理", Count = QueryDb.ExecuteScalar <int>("SELECT count(*) FROM event_info where (evtState='unAccept' or (evtState!='unAccept' and evtState!='doing' and evtState!='done')) and OriginalID is not null ") }); retList.Add(new { StateName = "处理中", Count = QueryDb.ExecuteScalar <int>("SELECT count(*) FROM event_info where evtState='doing' and OriginalID is not null") }); retList.Add(new { StateName = "已处理", Count = QueryDb.ExecuteScalar <int>("SELECT count(*) FROM event_info where evtState='done' and OriginalID is not null") }); return(retList); }
/// <summary> /// 创建后续任务 /// </summary> /// <param name="NextTasks"></param> /// <param name="sourcetaskid"></param> public object CreatTasksAndCreatWorkrecor(work_task[] NextTasks, string sourcetaskid) { if (NextTasks == null) { return(null); } if (NextTasks.Length < 1) { return(null); } foreach (var Task in NextTasks) { //保存任务 Task.LaskTaskId = sourcetaskid; //上一个任务id Task.InitiationTime = DateTime.Now; //状态 Task.TaskStatus = (int)WorkTaskStatus.Normal; //状态 Task.ExpectedCompletionTime = DateTime.Now.AddDays(1); //期望完成时间 var loginClientInfo = SysContext.GetService <ClientInfo>(); if (loginClientInfo != null) { Task.CreateUserID = loginClientInfo.UserId ?? null; //任务创建人 } string id = SaveWorkTask(Task); Task.ID = id; //发送待办 if (!string.IsNullOrEmpty(Task.AppLinks)) { Task.AppLinks += (Task.AppLinks.Contains("?") ? "&" : "?") + "taskid=" + Task.ID; } if (!string.IsNullOrEmpty(Task.PCLinks)) { Task.PCLinks += (Task.PCLinks.Contains("?") ? "&" : "?") + "taskid=" + Task.ID; } var dic = new Dictionary <string, string>(); dic.Add("任务说明", Task.TaskContent); dic.Add("任务发起时间", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); dic.Add("期望完成时间", Task.ExpectedCompletionTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); if (Task.TaskType.ToUpper() == TaskType.Punishment.ToString().ToUpper()) { string taskTypeStr = QueryDb.ExecuteScalar <string>("select title from res_dictionaryitems where itemcode=@0", Task.TaskType); //获取任务类型中文描述 string caseNumber = QueryDb.ExecuteScalar <string>("select caseNumber from case_info where id=@0", Task.CaseID); Task.TaskTitle = caseNumber + "-" + taskTypeStr; } Task.TodotaskID = CreateWorkrecor(Task.AssignUsers, Task.TaskTitle, Task.AppLinks, dic); //待办id //记录待办id ServiceHelper.GetService("work_task").Update(Task); //修改关联的 //修改关联事件状态已分配任务 UpdateEventState(Task.EventInfoId, EventStatus.dispose); } return(true); }
public object Handle(APIContext context) { List <object> retList = new List <object>(); retList.Add(new { TypeName = "钉钉", Count = QueryDb.ExecuteScalar <int>("SELECT count(*) FROM event_info where reportType='DD_REPORT' and OriginalID is not null") }); retList.Add(new { TypeName = "微信", Count = QueryDb.ExecuteScalar <int>("SELECT count(*) FROM event_info where reportType='WX_REPORT' and OriginalID is not null") }); retList.Add(new { TypeName = "AI告警", Count = QueryDb.ExecuteScalar <int>("SELECT count(*) FROM event_info where reportType='AI_REPORT' and OriginalID is not null") }); retList.Add(new { TypeName = "APP", Count = QueryDb.ExecuteScalar <int>("SELECT count(*) FROM event_info where reportType='APP_REPORT' and OriginalID is not null") }); retList.Add(new { TypeName = "其他", Count = QueryDb.ExecuteScalar <int>("SELECT count(*) FROM event_info where reportType='OTHER' and OriginalID is not null") }); return(retList); }
private object CheckStaffList(APIContext context) { try { ServiceConfig organzationConfig = ServiceHelper.GetServiceConfig("organization"); ServiceConfig organizationuserServiceConfig = ServiceHelper.GetServiceConfig("organizationuser"); ServiceConfig userConfig = ServiceHelper.GetServiceConfig("user"); List <organization> orgs = new List <organization>(); var org1 = SysContext.GetOtherDB(organzationConfig.model.dbName).FirstOrDefault <organization>($"select * from organization where Name='综合行政执法一大队'"); var org2 = SysContext.GetOtherDB(organzationConfig.model.dbName).FirstOrDefault <organization>($"select * from organization where Name='综合行政执法二大队'"); var org3 = SysContext.GetOtherDB(organzationConfig.model.dbName).FirstOrDefault <organization>($"select * from organization where Name='综合行政执法三大队'"); var org4 = SysContext.GetOtherDB(organzationConfig.model.dbName).FirstOrDefault <organization>($"select * from organization where Name='综合行政执法四大队'"); if (org1 != null) { orgs.Add(org1); } if (org2 != null) { orgs.Add(org2); } if (org3 != null) { orgs.Add(org3); } if (org4 != null) { orgs.Add(org4); } if (orgs == null || orgs.Count < 1) { return(null); } List <organizationuser> orgulist = new List <organizationuser>(); foreach (var o in orgs) { var orgus = SysContext.GetOtherDB(organizationuserServiceConfig.model.dbName).Query <organizationuser>($"select * from organizationuser where OrganizationId={o.Id}"); if (orgus != null) { orgulist.AddRange(orgus); } } if (orgulist == null || orgulist.Count < 1) { return(null); } List <Dictionary <string, object> > returncollection = new List <Dictionary <string, object> >(); foreach (var u in orgulist) { Dictionary <string, object> udic = new Dictionary <string, object>(); var organzation = orgs.FirstOrDefault(o => o.Id == u.OrganizationId); var ur = SysContext.GetOtherDB(userConfig.model.dbName).FirstOrDefault <user>($"select * from user where Id={u.UserId}"); if (ur != null) { int taskunm = QueryDb.ExecuteScalar <int>("select count(*) from work_task where MainHandler=@0 and TaskStatus=1", ur.Id); udic.Add("Organization", organzation.Name); udic.Add("OrganizationId", organzation.Id); udic.Add("userId", ur.Id); udic.Add("userName", ur.Name); udic.Add("Tel", ur.Mobile); udic.Add("TaskNum", taskunm); //请求四方人员在线 udic.Add("Online", false); //范围 udic.Add("Range", null); returncollection.Add(udic); } } return(returncollection); } catch (Exception ex) { return(null); } }
private object TakeUserTask(APIContext context) { var userid = JsonHelper.DeserializeJsonToObject <string>(context.Data); return(QueryDb.ExecuteScalar <int>("select count(*) from work_task where MainHandler=@0 and TaskStatus=1", userid)); }