private void task_surveyService_OnAfterGetDetailData(object query, object data) { var o = data as Dictionary <string, object>; string taskType = o["ProcessingDecisions"].ToString(); if (taskType == "1") { o["ProcessingDecisions"] = "不予处罚"; } if (taskType == "2") { o["ProcessingDecisions"] = "移送其他部门"; } if (taskType == "3") { o["ProcessingDecisions"] = "处罚程序"; } 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.ID, v => v.Title); var eventType = o["EventType"].ToString(); if (dicItems.ContainsKey(eventType)) { o["EventType"] = dicItems[eventType]; } }
private object FORMBYEVENT(APIContext context) { string id = JsonHelper.DeserializeJsonToObject <string>(context.Data); if (string.IsNullOrEmpty(id)) { return(null); } var list = QueryDb.Query <formwith_eventcase>("SELECT * FROM formwith_eventcase where EventInfoId=@0 Order by CreatTime desc", id); //TODO return(list); }
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); }
private void Case_InfoService_GetDetail(object query, object data) { //var caseinfo = data as Dictionary<string, object>; //var userid = caseinfo["CreateUser"] as List<string>; //if (userid != null) //{ // ServiceConfig userServiceConfig = ServiceHelper.GetServiceConfig("user"); // var user = SysContext.GetOtherDB(userServiceConfig.model.dbName).First<user>($"select * from user where Id={userid[0] }"); // caseinfo.Add("Jobnumber",user.Jobnumber); //} var caseinfo = data as Dictionary <string, object>; 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); var caseType = caseinfo["CaseType"].ToString(); if (dicItems.ContainsKey(caseType)) { caseinfo["CaseType"] = dicItems[caseType]; } }
public override object GetPageData(QueryDescriptor descriptor) { //处理查询条件,排序 //FilterTranslator filterTranslator = new FilterTranslator(); //if (descriptor.Condition != null) //{ // filterTranslator.Group = descriptor.Condition; //} //filterTranslator.Translate(); //string whereTxt = filterTranslator.CommandText; //string text = ""; //string text2 = ""; //if (descriptor.OrderBy != null && descriptor.OrderBy.Any()) //{ // text = descriptor.OrderBy[0].Key; // if (string.IsNullOrEmpty(text)) // text = "CreateDate"; // text2 = ((descriptor.OrderBy[0].Order == OrderSequence.ASC) ? "asc" : "desc"); //} //whereTxt += string.Format(" order by {0} {1}", text, text2); //StringBuilder sqlBuild = new StringBuilder(); //sqlBuild.AppendLine("select a.* from case_info a where 1=1 "); //if (parties != null && parties.Count() > 0) //{ // sqlBuild.AppendLine(string.Format("and ID in ({0}) and ", string.Join(",", parties.Select(m => "'" + m.AssociationobjectID + "'")))); //} //sqlBuild.AppendLine(whereTxt); //var cases = QueryDb.Query<case_Info>(sqlBuild.ToString()); var filter = descriptor.Condition; if (filter == null) { filter = new FilterGroup(); } #region 新增定义当事人名称(party),当事人号码(partyPhone) FilterGroup filterParty = new FilterGroup() { op = "or" }; var partyWhere = DeepPartyGroups(filter.groups); if (partyWhere.Count > 0) { var parties = QueryDb.Query <law_party>("select * from law_party where " + string.Join(descriptor.Condition.op, partyWhere)); if (parties.Count() > 0) { foreach (var item in parties) { filterParty.rules.Add(new FilterRule { field = "ID", op = "in", type = "select", value = item.CaseId }); } } DeletePartyRules(filter.groups); //FilterTranslator filterTranslator = new FilterTranslator(); //if (descriptor.Condition != null) //{ // filterTranslator.Group = descriptor.Condition; //} //filterTranslator.Translate(); //string whereTxt = filterTranslator.CommandText; } #endregion #region 过滤掉PreviousformID为空的数据 FilterGroup filterNew = new FilterGroup(); filterNew.rules = new List <FilterRule> { new FilterRule("PreviousformID", null, "isnotnull") }; FilterGroup filterOut = new FilterGroup(); filterOut.op = "and"; filterOut.groups = new List <FilterGroup> { filter, filterNew, filterParty }; descriptor.Condition = filterOut; #endregion return(base.GetPageData(descriptor)); }
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]; } } }
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); }