public JsonResult MethodNameChange(ServiceMethodMapViewModel model) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); result = ParseParam(model.SchemaCode, model.Method, model.MethodType); if (!result.Success) { return Json(result, JsonRequestBehavior.AllowGet); } DataModel.ServiceMethodMap buldMap = BuldMap(model.ServiceCode, model.MethodName); if (buldMap == null) { result.Success = false; } else { result.Extend = new { ParamGridData = GetGridData(buldMap, "param"), ReturnGridData = GetGridData(buldMap, "return"), }; result.Success = true; } return Json(result, JsonRequestBehavior.AllowGet); })); }
public JsonResult GetServiceMethodNamesList(string serviceCode, string schemaCode, string method, string methodType) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); result = ParseParam(schemaCode, method, methodType); if (!result.Success) { return Json(result, JsonRequestBehavior.AllowGet); } List <Item> methodNames = null; if (methodType.Equals("RuleMethod", StringComparison.OrdinalIgnoreCase)) {// 业务规则 methodNames = GetBizRuleMethodNamesList(serviceCode); } else { methodNames = GetMethodNamesList(serviceCode); } string methodName = methodNames.Count > 0 ? methodNames.FirstOrDefault().Value : ""; DataModel.ServiceMethodMap buldMap = BuldMap(serviceCode, methodName); result.Extend = new { MethodNames = methodNames, ParamGridData = GetGridData(buldMap, "param"), ReturnGridData = GetGridData(buldMap, "return"), MethodName = methodName }; return Json(result, JsonRequestBehavior.AllowGet); })); }
/// <summary> /// 获取列表数据 /// </summary> /// <param name="serviceCode">业务模型编码</param> /// <param name="methodName">方法名称</param> /// <returns>数据</returns> private object GetBuldMapGridData(string serviceCode, string methodName) { DataModel.ServiceMethodMap buldMap = BuldMap(serviceCode, methodName); if (buldMap == null) { return(null); } return(new { ParamGridData = GetGridData(buldMap, "param"), ReturnGridData = GetGridData(buldMap, "return") }); }
/// <summary> /// 获取列表展示内容 /// </summary> /// <param name="buldMap">复合类</param> /// <param name="type">表格名称</param> /// <returns>表格内容</returns> private object GetGridData(DataModel.ServiceMethodMap buldMap, string type) { List <ServiceMethodMapDetailViewModel> list = new List <ServiceMethodMapDetailViewModel>(); int totalCount = 0; if (null == buldMap) { return(new { Rows = list, Total = totalCount }); } else { DataMapCollection map; if ("param".Equals(type)) { map = buldMap.ParamMaps; } else { map = buldMap.ReturnMaps; } string[] Names = map.GetParamNames(); DataModel.DataMap[] mapArray = map.ToArray(); foreach (OThinker.H3.DataModel.DataMap m in mapArray) { ServiceMethodMapDetailViewModel temMap = new ServiceMethodMapDetailViewModel(); string ItemName = m.ItemName; foreach (string Name in Names) { if (Name.Contains("[" + m.ItemName + "]")) { ItemName = Name; break; } } temMap.ItemName = ItemName; temMap.MapTo = m.MapTo; temMap.MapType = m.MapType.ToString(); list.Add(temMap); } return(new { Rows = list, Total = list.Count }); } }
public JsonResult GetServiceMethodMap(string mapIndex, string schemaCode, string method, string methodType) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); result = ParseParam(schemaCode, method, methodType); if (!result.Success) { return Json(result, JsonRequestBehavior.AllowGet); } int isLocked = BizWorkflowPackageLockByID(this.SchemaCode); ServiceMethodMapViewModel model = GetServiceMethodMapViewModel(mapIndex); List <Item> serviceCodes = GetServiceCodesList(); List <Item> methodNames = null; if (methodType.Equals("RuleMethod", StringComparison.OrdinalIgnoreCase)) {// 业务规则 methodNames = GetBizRuleMethodNamesList(model.ServiceCode); } else { methodNames = GetMethodNamesList(model.ServiceCode); } DataModel.ServiceMethodMap buldMap = BuldMap(model.ServiceCode, model.MethodName); result.Extend = new { ServiceMethodMap = model, ServiceCodes = serviceCodes, MethodNames = methodNames, ParamGridData = GetGridData(buldMap, "param"), ReturnGridData = GetGridData(buldMap, "return"), IsLocked = isLocked }; return Json(result, JsonRequestBehavior.AllowGet); })); }
public JsonResult UpgradeServiceMethodMap(ServiceMethodMapViewModel model) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); result = ParseParam(model.SchemaCode, model.Method, model.MethodType); if (!result.Success) { return Json(result, JsonRequestBehavior.AllowGet); } if (string.IsNullOrWhiteSpace(model.ServiceCode)) { result.Success = false; result.Message = "EditBizObjectSchemaMethodMap.SelectBiz"; return Json(result, JsonRequestBehavior.AllowGet); } GetServiceMethodMapViewModel(model.MapIndex); H3.DataModel.MethodGroupSchema methodGroup = this.Schema.GetMethod(this.SelectedMethod); H3.DataModel.ServiceMethodMap map = null; if (methodGroup.MethodType == H3.DataModel.MethodType.Normal || methodGroup.MethodType == H3.DataModel.MethodType.Static) { // 获得最新的方法 H3.BizBus.BizService.MethodSchema methodSchema = this.Engine.BizBus.GetMethod(this.SelectedMap.ServiceCode, this.SelectedMap.MethodName); if (methodSchema == null) { result.Success = false; return Json(result, JsonRequestBehavior.AllowGet); } map = new DataModel.ServiceMethodMap( this.SelectedMap.ServiceCode, methodSchema); } else if (methodGroup.MethodType == H3.DataModel.MethodType.Filter) { // 获得最新的搜索方法 H3.BizBus.Filter.FilterSchema filterSchema = this.Engine.BizBus.GetFilterSchema(this.SelectedMap.ServiceCode, this.SelectedMap.MethodName); if (filterSchema == null) { result.Success = false; return Json(result, JsonRequestBehavior.AllowGet); } map = new DataModel.ServiceMethodMap( this.SelectedMap.ServiceCode, filterSchema); } else { throw new NotImplementedException(); } map.ExeCondition = model.ExeCondition; // 更新方法的参数映射 if (map.ParamMaps != null) { H3.DataModel.DataMap[] dataMaps = map.ParamMaps.ToArray(); if (dataMaps != null) { foreach (H3.DataModel.DataMap dataMap in dataMaps) { dataMap.MapTo = this.SelectedMap.ParamMaps.GetMappingPropertyName(dataMap.ItemName); } } } // 更新方法的返回值映射 if (map.ReturnMaps != null) { H3.DataModel.DataMap[] dataMaps = map.ReturnMaps.ToArray(); if (dataMaps != null) { foreach (H3.DataModel.DataMap dataMap in dataMaps) { dataMap.MapTo = this.SelectedMap.ReturnMaps.GetMappingPropertyName(dataMap.ItemName); } } } // 更新的方法集合中 this.Schema.GetMethod(this.SelectedMethod).RemoveMethodMap(this.SelectedMapIndex); this.Schema.GetMethod(this.SelectedMethod).InsertMethodMap(this.SelectedMapIndex, map); result.Success = this.Engine.BizObjectManager.UpdateDraftSchema(this.Schema); if (result.Success) { result.Extend = new { ParamGridData = GetGridData(map, "param"), ReturnGridData = GetGridData(map, "return") }; } return Json(result, JsonRequestBehavior.AllowGet); })); }