示例#1
0
        //获取表单的状态
        public string GetFormStatus()
        {
            //request
            string formId = "";

            ServiceConfig userServiceConfig = ServiceHelper.GetServiceConfig("user");
            var           OTDB   = SysContext.GetOtherDB(userServiceConfig.model.dbName);
            var           Status = OTDB.FirstOrDefault <string>("select Status from processinstance where Id=@0", formId);

            if (Status == null)
            {
                return(null);
            }
            switch (Status)
            {
            case "TERMINATED":
                break;

            case "COMPLETED":
                break;

            case "RUNNING":
                break;
            }
            return("");
        }
示例#2
0
        private object GetAllFormByEventId(string eventinfoid)
        {
            if (string.IsNullOrEmpty(eventinfoid))
            {
                return(null);
            }
            ServiceConfig userServiceConfig = ServiceHelper.GetServiceConfig("user");
            var           formall           = QueryDb.Query <formwith_eventcase>("where EventInfoId=@0 order by CreateDate", eventinfoid);
            List <Dictionary <string, object> > formlist = new List <Dictionary <string, object> >();

            foreach (var f in formall)
            {
                try
                {
                    Dictionary <string, object> temp = new Dictionary <string, object>();
                    if (!string.IsNullOrEmpty(f.CreateUserID))
                    {
                        var user = SysContext.GetOtherDB(userServiceConfig.model.dbName).First <user>($"select * from user where Id='{f.CreateUserID}'");
                        temp.Add("CreateUser", user.Name);
                    }
                    else
                    {
                        temp.Add("CreateUser", "");
                    }
                    temp.Add("CreateDate", f.CreateDate);

                    if (f.FormType == "case_report")
                    {
                        temp.Add("state", f.FormState);
                        if (f.FormState == "审核通过")
                        {
                            closeDate = f.CreateDate.ToString();
                        }
                    }
                    else
                    {
                        temp.Add("state", "已完成");
                    }

                    temp.Add("FormType", f.FormName);
                    formlist.Add(temp);
                }
                catch (Exception e)
                {
                    continue;
                }
            }
            return(formlist);
        }
示例#3
0
 /// <summary>
 /// 通过Account获取首个ORG的deptID
 /// </summary>
 /// <param name="AccountId"></param>
 /// <returns></returns>
 public string GetUserDetail(string AccountId)
 {
     try
     {
         ServiceConfig userServiceConfig = ServiceHelper.GetServiceConfig("user");
         var           OTDB   = SysContext.GetOtherDB(userServiceConfig.model.dbName);
         var           deptId = OTDB.FirstOrDefault <long>(@"SELECT org.id FROM organization org 
                             inner join organizationuser ou on ou.OrganizationId = org.Id
                             inner join user usr on usr.Id = ou.UserId
                             where usr.AccountId = @0", AccountId);
         return(deptId.ToString());
     }
     catch (Exception e)
     {
         return(null);
     }
 }
示例#4
0
        private void Case_InfoService_OnAfterListData(object query, object data)
        {
            var lst = (data as PagedData).Records;

            var      db  = this.QueryDb;
            IService svc = ServiceHelper.GetService("law_party");


            ServiceConfig userServiceConfig = ServiceHelper.GetServiceConfig("user");

            for (int i = 0; i < lst.Count; i++)
            {
                var item = lst[i] as Dictionary <string, object>;

                FilterGroup filterGroup = new FilterGroup();
                filterGroup.rules = new List <FilterRule>();

                filterGroup.rules.Add(new FilterRule
                {
                    field = "Associatedobjecttype",
                    value = "case_info",
                    op    = "equal"
                });
                filterGroup.op = "and";
                filterGroup.rules.Add(new FilterRule
                {
                    field = "CaseId",
                    value = item["ID"].ToString(),
                    op    = "equal"
                });
                if (item["CreateUserID"] != null)
                {
                    string userid = item["CreateUserID"].ToString();
                    var    user   = SysContext.GetOtherDB(userServiceConfig.model.dbName).First <user>($"select * from user where Id={userid}");
                    item.Add("CreatUser", user.Name);
                    item.Add("Jobnumber", user.Jobnumber);
                }
                var partys = svc.GetListData(filterGroup);

                item.Add("LawPartys", partys);
            }
        }
示例#5
0
 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);
     }
 }
示例#6
0
        private void Formwith_eventcaseService_OnAfterGetPagedData(object query, object data)
        {
            var    filtercase  = query as FilterGroup;
            string eventinfoid = null;

            try
            {
                if (filtercase != null)
                {
                    if (filtercase.groups.Count > 0)
                    {
                        foreach (var f in filtercase.groups)
                        {
                            if (f.groups.Count > 0)
                            {
                                foreach (var f0 in f.groups)
                                {
                                    if (f0.rules != null)
                                    {
                                        if (f0.rules[0].field == "CaseId")
                                        {
                                            var caseinfo = QueryDb.FirstOrDefault <formwith_eventcase>("where FormID=@0", f0.rules[0].value);
                                            eventinfoid = caseinfo.EventInfoId;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch {
                eventinfoid = null;
            }
            var lst = (data as PagedData).Records;


            ServiceConfig userServiceConfig = ServiceHelper.GetServiceConfig("user");

            var dicUserOrg = SysContext.GetOtherDB(userServiceConfig.model.dbName).Query <FD.Model.Dto.UserOrganizationName>("SELECT a.Id AS UserId,a.`Name` as UserName,c.`Name` as OrgName FROM	USER a LEFT JOIN organizationuser b ON a.Id = b.UserId LEFT JOIN organization c ON b.OrganizationId = c.Id WHERE c.Id !=1")
                             .GroupBy(m => m.UserId).ToDictionary(g => g.Key, g => g.ToList());

            for (int i = 0; i < lst.Count; i++)
            {
                var item = lst[i] as Dictionary <string, object>;

                string userid = item["CreateUserID"] == null ? string.Empty : item["CreateUserID"].ToString();

                if (!string.IsNullOrWhiteSpace(userid) && dicUserOrg.ContainsKey(userid))
                {
                    item["handler"]    = dicUserOrg[userid].FirstOrDefault()?.UserName;
                    item["Department"] = dicUserOrg[userid].FirstOrDefault()?.OrgName;
                }

                var formType = item["FormType"].ToString().ToLower();
                if (formType == "form_confiscated")   // 没收清单表查询出对应的当事人姓名
                {
                    var formlawpary = QueryDb.FirstOrDefault <string>("SELECT lawpartyid FROM  form_confiscated where ID=@0", item["FormID"].ToString());
                    if (formlawpary != null)
                    {
                        var lawpartyName = QueryDb.FirstOrDefault <string>("SELECT Name FROM  law_party where ID=@0", formlawpary);
                        item["FormName"] = "[" + lawpartyName + "]" + item["FormName"];
                    }
                }

                if (formType == "law_punishmentinfo")  //当场处罚决定书 新增处罚决定书文号
                {
                    item.Add("PunishmentTitle", QueryDb.FirstOrDefault <string>("SELECT PunishmentTitle FROM law_punishmentinfo where ID=@0", item["FormID"].ToString()));
                }

                if (formType == "law_punishmentinfo" || formType == "form_inquiryrecord" || formType == "case_report") //处罚当场决定书、勘察、结案、没收、询问表单新增详情的pdf文件地址
                {
                    item.Add("PdfFilePath", QueryDb.FirstOrDefault <string>("SELECT FilePath FROM form_printpdf where FormID=@0", item["FormID"].ToString()));
                }
                if (formType == "form_inquiryrecord")
                {
                    var lawpartyName = QueryDb.FirstOrDefault <string>("SELECT InquiryType FROM law_party where AssociationobjectID=@0", item["FormID"].ToString());
                    item["FormName"] = "[" + lawpartyName + "]" + item["FormName"];
                }
            }
            //添加事件巡查勘察
            if (!string.IsNullOrEmpty(eventinfoid))
            {
                var patrol = QueryDb.FirstOrDefault <formwith_eventcase>("where EventInfoId=@0 and FormType='task_patrol'", eventinfoid);
                if (patrol != null)
                {
                    var obj  = JsonConvert.DeserializeObject <Dictionary <string, object> >(JsonConvert.SerializeObject(patrol));
                    var user = SysContext.GetOtherDB(userServiceConfig.model.dbName).First <user>($"select * from user where Id={obj["CreateUserID"]}");
                    obj["handler"] = user.Name;
                    lst.Add(obj);
                }
                var survey = QueryDb.FirstOrDefault <formwith_eventcase>("where EventInfoId=@0 and FormType='task_survey'", eventinfoid);
                if (survey != null)
                {
                    var obj  = JsonConvert.DeserializeObject <Dictionary <string, object> >(JsonConvert.SerializeObject(survey));
                    var user = SysContext.GetOtherDB(userServiceConfig.model.dbName).First <user>($"select * from user where Id={obj["CreateUserID"]}");
                    obj["handler"] = user.Name;
                    lst.Add(obj);
                }
            }
        }
示例#7
0
        private void Case_InfoService_OnAfterGetPagedData(object query, object data)
        {
            var lst = (data as PagedData).Records;

            var      db  = this.QueryDb;
            IService svc = ServiceHelper.GetService("law_party");

            var res_dictionary = QueryDb.FirstOrDefault <res_dictionary>("where DicCode=@0", "CaseType");
            var dicItems       = QueryDb.Query <res_dictionaryItems>("SELECT * FROM res_dictionaryitems where DicID=@0", res_dictionary.ID).ToDictionary(k => k.ItemCode, v => v.Title);

            IService psm = ServiceHelper.GetService("law_punishmentInfo");



            ServiceConfig userServiceConfig = ServiceHelper.GetServiceConfig("user");

            for (int i = 0; i < lst.Count; i++)
            {
                var item = lst[i] as Dictionary <string, object>;

                FilterGroup filterGroup = new FilterGroup();
                filterGroup.rules = new List <FilterRule>();

                filterGroup.rules.Add(new FilterRule
                {
                    field = "Associatedobjecttype",
                    value = "case_info",
                    op    = "equal"
                });
                filterGroup.op = "and";
                filterGroup.rules.Add(new FilterRule
                {
                    field = "CaseId",
                    value = item["ID"].ToString(),
                    op    = "equal"
                });
                if (item["CreateUserID"] != null)
                {
                    string userid = item["CreateUserID"].ToString();
                    var    user   = SysContext.GetOtherDB(userServiceConfig.model.dbName).First <user>($"select * from user where Id={userid}");
                    item.Add("CreatUser", user.Name);
                    item.Add("Jobnumber", user.Jobnumber);
                }
                //var partys = svc.GetListData(filterGroup) ;
                var partys = QueryDb.Query <law_party>("where ASSOCIATIONOBJECTID=@0", item["ID"].ToString());

                //添加附件
                var pulishment = QueryDb.FirstOrDefault <law_punishmentInfo>("where caseid=@0", item["ID"].ToString());
                if (pulishment != null)
                {
                    var atts = QueryDb.Query <attachment>("where ASSOCIATIONOBJECTID=@0", pulishment.ID);
                    if (atts != null)
                    {
                        item.Add("attachments", atts);
                    }
                }
                else
                {
                    item.Add("attachments", null);
                }

                //事件图片返回
                if (!string.IsNullOrEmpty((string)item["EventInfoId"]))
                {
                    var eventinfo = QueryDb.FirstOrDefault <event_info>("where objId=@0", item["EventInfoId"].ToString());
                    if (eventinfo != null)
                    {
                        item.Add("evtFileUrl", eventinfo.evtFileUrl);
                        item.Add("posFileUrl", eventinfo.posFileUrl);
                    }
                }
                else
                {
                    item.Add("evtFileUrl", null);
                    item.Add("posFileUrl", null);
                }
                item.Add("LawPartys", partys);

                var caseType = item["CaseType"].ToString();
                if (dicItems.ContainsKey(caseType))  // CaseType 显示中文title
                {
                    item["CaseType"] = dicItems[caseType];
                }
            }
        }
示例#8
0
        public object FormData(FormDataReq data)
        {
            var res_dictionarycase = QueryDb.FirstOrDefault <res_dictionary>("where DicCode=@0", "CaseType");
            var dicItemscase       = QueryDb.Query <res_dictionaryItems>("SELECT * FROM res_dictionaryitems where DicID=@0", res_dictionarycase.ID).ToDictionary(k => k.ItemCode, v => v.Title);

            if (data.Model.ToUpper() == "case_Info".ToUpper())
            {
                data.Model = "case_Info";
            }
            IService service = ServiceHelper.GetService(data.Model);

            //根据事件id或者id查询数据
            var filter = new FilterGroup();

            if (!string.IsNullOrEmpty(data.FormId))
            {
                filter.rules.Add(new FilterRule("ID", data.FormId, "equal"));
            }
            if (!string.IsNullOrEmpty(data.EventInfoId))
            {
                filter.rules.Add(new FilterRule("EventInfoId", data.EventInfoId, "equal"));
            }
            object atlist = null;

            //案件特殊判断
            if (data.Model.ToUpper() == "case_Info".ToUpper())
            {
                filter.rules.Add(new FilterRule("PreviousformID", "", "notequal"));
                atlist = Getpunishattchment(data.FormId);
            }
            ServiceConfig userServiceConfig = ServiceHelper.GetServiceConfig("user");
            //查询主表数据
            var obj = service.GetListData(filter).OrderByDescending(s => s.Keys.Contains("createTime") ? s["createTime"] : s["CreateDate"]).FirstOrDefault();  //查询主表单

            if (obj == null)
            {
                return(null);            //throw new Exception("未取得关联数据");
            }
            obj.Add("publishtype", publishtypet);
            if (obj.ContainsKey("PunishmentTitle"))
            {
                obj["PunishmentTitle"] = publishTitle;
            }
            else
            {
                obj.Add("PunishmentTitle", publishTitle);
            }
            if (obj["CreateUserID"] != null)
            {
                var user = SysContext.GetOtherDB(userServiceConfig.model.dbName).First <user>($"select * from user where Id='{obj["CreateUserID"]}'");
                if (user != null)
                {
                    obj["CreateUserID"] = user.Name;
                }
            }
            if (data.Model.ToUpper() == "case_Info".ToUpper())
            {
                if (obj.ContainsKey("CaseType"))
                {
                    if (obj["CaseType"] != null)
                    {
                        if (dicItemscase.ContainsKey(obj["CaseType"].ToString()))  // CaseType 显示中文title
                        {
                            obj["CaseType"] = dicItemscase[obj["CaseType"].ToString()];
                        }
                    }
                }
            }
            string formId      = obj["ID"].ToString(); //得到id
            string eventinfoid = null;

            if (obj.ContainsKey("EventInfoId"))
            {
                eventinfoid = obj["EventInfoId"] != null ? obj["EventInfoId"].ToString() : string.Empty;
            }
            if (data.Model.ToLower() == "task_survey")  // 现场勘查 EventType 显示中文title
            {
                var res_dictionary = QueryDb.FirstOrDefault <res_dictionary>("where DicCode=@0", "EventType");
                var dicItems       = QueryDb.Query <res_dictionaryItems>("SELECT * FROM res_dictionaryitems where DicID=@0", res_dictionary.ID).ToDictionary(k => k.ItemCode, v => v.Title);
                var eventType      = obj["EventType"].ToString();
                if (dicItems.ContainsKey(eventType))
                {
                    obj["EventType"] = dicItems[eventType];
                }
            }

            //构建其他需要查询的数据
            var dicData = BuildData(data, formId, eventinfoid);

            obj.Add("closeDate", closeDate);
            dicData.Add("MainForm", obj);
            //添加处罚决定书证据附件
            if (atlist != null)
            {
                if (dicData.ContainsKey("attachment"))
                {
                    var als = dicData["attachment"] as List <attachment>;
                    if (als != null)
                    {
                        als.AddRange(atlist as List <attachment>);
                        dicData["attachment"] = als;
                    }
                    else
                    {
                        dicData["attachment"] = atlist;
                    }
                }
                else
                {
                    dicData.Add("attachment", atlist);
                }
            }
            return(dicData);
        }