/// <summary> /// 组织字段添加逻辑 /// </summary> /// <param name="id"></param> /// <returns></returns> public IActionResult AggregateFieldAddLogic(int id) { string metaFieldIdsString = Request.Form["metaFieldIds"]; //get metafield ids var metaFieldIdsSplit = !string.IsNullOrEmpty(metaFieldIdsString) ? metaFieldIdsString.Split(',') : Array.Empty <string>(); int[] metaFieldIds = (metaFieldIdsSplit != null && metaFieldIdsSplit.Any()) ? metaFieldIdsSplit.Select(t => Convert.ToInt32(t)).ToArray() : new int[0]; int[] fieldAggregationIds = fieldAggregationService.GetByFieldListId(id)?.Select(t => t.MetaFieldId)?.ToArray() ?? new int[0]; IEnumerable <int> addIds = metaFieldIds.Except(fieldAggregationIds); //ids will add IEnumerable <int> deleteIds = fieldAggregationIds.Except(metaFieldIds); //ids will delete IList <FieldListAggregation> fieldAggregations = new List <FieldListAggregation>(); foreach (var item in addIds) { fieldAggregations.Add(new FieldListAggregation { FieldListId = id, MetaFieldId = item }); } if (fieldAggregations.Any()) { fieldAggregationService.Add(fieldAggregations); } foreach (var item in deleteIds) { fieldAggregationService.DeleteByMetaFieldId(item); } //对当前列表配置的顺序进行重新排序 fieldAggregationService.SortFields(id, metaFieldIds); return(JsonResultModel.Success("保存成功!")); }
public IActionResult Update([FromQuery] QueryArgs queryArgs, [FromBody] JObject jObj) { try { var json = jObj.ToString(); var bson = BsonDocument.Parse(json); if (bson == null || !bson.Any()) { return(JsonResultModel.Error("Parameter invalid:jObj = null 业务数据为空")); } //Pretreatment create queryContext QueryPiplineContext queryContext = PretreatmentAndCreateQueryPiplineContext(queryArgs); //缓存某个服务下的全部触发器脚本,包括before和after queryContext.TriggerScriptsOfOneServiceType = _triggerScriptService.GetTriggerScriptsUnDeletedByMetaObjectIdAndServiceType(queryContext.MetaObjectId, (int)ServiceType.Interface_Update); //查询条件 FilterDefinition <BsonDocument> filter = conditionAggregationService.AnalysisConditionToFilterDefinitionByConditionId(queryContext, queryContext.ArgumentsDic); //trigger before bson = _triggerScriptService.RunTriggerScript(queryContext, TriggerPoint.Before, TriggerScriptService.FunctionName_MetaObject_Interface_Update_Before, bson, CurrentApplicationContext, queryContext.InterfaceCode, bson, filter); //check data by form if (queryContext.FormId != default(int)) { var formCheckResult = _formMetaFieldService.ValidateFormData(queryContext.FormId, bson); if (!formCheckResult.IsSuccess) { return(formCheckResult.ToJsonResultModel()); } } //update data dataAccessService.Update(queryContext.TenantId, queryContext.MetaObjectId, filter, bson); //trigger after _triggerScriptService.RunTriggerScript(queryContext, TriggerPoint.After, TriggerScriptService.FunctionName_MetaObject_Interface_Update_After, bson, CurrentApplicationContext, queryContext.InterfaceCode, bson); return(JsonResultModel.Success("success")); } catch (ArgumentNullException argNullEx) { return(JsonResultModel.Error(argNullEx.Message)); } catch (ArgumentException argEx) { return(JsonResultModel.Error(argEx.Message)); } catch (Exception ex) { return(JsonResultModel.Error(ex.Message)); } }
public IActionResult GetDefaultTriggerScript(int serviceType, int triggerPoint) { string script = string.Empty; if (triggerPoint == (int)TriggerPoint.Before) { script = triggerScriptService.GetDefaultMetaObjectTriggerScriptByServiceTypeBefore(serviceType).TrimStart().TrimEnd(); } else if (triggerPoint == (int)TriggerPoint.After) { script = triggerScriptService.GetDefaultMetaObjectTriggerScriptByServiceTypeAfter(serviceType).TrimStart().TrimEnd(); } return(JsonResultModel.Success("get default trigger script", script)); }
public IActionResult Update(string conditionCode, [FromBody] JObject jObj) { try { //args check if (string.IsNullOrEmpty(conditionCode)) { return(JsonResultModel.Error($"Parameter invalid:conditionCode = null")); } if (jObj == null) { return(JsonResultModel.Error($"Parameter invalid:data = null")); } //argumentsDic generate Dictionary <string, object> argumentsDic = new Dictionary <string, object>(); foreach (var item in Request.Query) { if (!argumentsDic.ContainsKey(item.Key)) { argumentsDic.Add(item.Key.ToUpperInvariant(), item.Value); } } //get filter var searchCondition = searchConditionService.GetByCode(conditionCode); if (searchCondition == null) { return(JsonResultModel.Error($"SearchCondition not found by conditionCode[{searchCondition}]")); } var filter = conditionAggregationService.AnalysisConditionToFilterDefinitionByConditionId(searchCondition.MetaObjectId, searchCondition.Id, argumentsDic); //get object var json = jObj.ToString(); var bson = BsonDocument.Parse(json); //update before filter = triggerScriptEngineService.UpdateBefore(searchCondition.MetaObjectId, searchCondition.Code, filter); //update data dataAccessService.Update(searchCondition.MetaObjectId, filter, bson); return(JsonResultModel.Success("success")); } catch (Exception ex) { return(JsonResultModel.Error(ex.ToString())); } }
/// <summary> /// 预约日期是否可以预约 /// </summary> /// <returns></returns> public ActionResult IsReservationForDateValid(DateTime reservationForDate) { var isValid = HttpContext.RequestServices.GetService <ReservationHelper>().IsReservationForDateAvailable(reservationForDate, false, out var msg); if (isValid) { return(Json(JsonResultModel.Success(true))); } else { var jsonResult = new JsonResultModel <bool> { Status = JsonResultStatus.Success, Result = false, ErrorMsg = msg }; return(Json(jsonResult)); } }
public IActionResult Delete([FromQuery] QueryArgs queryArgs) { try { //Pretreatment create queryContext QueryPiplineContext queryContext = PretreatmentAndCreateQueryPiplineContext(queryArgs); //缓存某个服务下的全部触发器脚本,包括before和after queryContext.TriggerScriptsOfOneServiceType = _triggerScriptService.GetTriggerScriptsUnDeletedByMetaObjectIdAndServiceType(queryContext.MetaObjectId, (int)ServiceType.Interface_Delete); //查询条件 FilterDefinition <BsonDocument> filter = conditionAggregationService.AnalysisConditionToFilterDefinitionByConditionId(queryContext, queryContext.ArgumentsDic); //trigger before filter = _triggerScriptService.RunTriggerScript(queryContext, TriggerPoint.Before, TriggerScriptService.FunctionName_MetaObject_Interface_Delete_Before, filter, CurrentApplicationContext, queryContext.InterfaceCode, filter); //queryResult var queryDatas = dataAccessService.GetList(queryContext.TenantId, queryContext.MetaObjectId, filter, null); //delete dataAccessService.Delete(queryContext.TenantId, queryContext.MetaObjectId, filter); //trigger after _triggerScriptService.RunTriggerScript(queryContext, TriggerPoint.After, TriggerScriptService.FunctionName_MetaObject_Interface_Delete_After, filter, CurrentApplicationContext, queryContext.InterfaceCode, queryDatas); return(JsonResultModel.Success("success")); } catch (ArgumentNullException argNullEx) { return(JsonResultModel.Error(argNullEx.Message)); } catch (ArgumentException argEx) { return(JsonResultModel.Error(argEx.Message)); } catch (Exception ex) { return(JsonResultModel.Error(ex.Message)); } }
public IActionResult AggregateConditionTreeView(int id) { List <SearchConditionNode> conditions = conditionAggregationService.GetListBySearchConditionId(id); SearchConditionNode condition = conditions?.FirstOrDefault(t => t.ParentId == -1); if (condition != null) { condition.Children = GetTree(conditions, condition.Id); } //Tree Search List <SearchConditionNode> GetTree(List <SearchConditionNode> source, int parentId) { var childs = source.Where(t => t.ParentId == parentId).ToList(); if (childs == null) { return(new List <SearchConditionNode>()); } else { childs.ForEach(t => t.Children = GetTree(source, t.Id)); } return(childs); } if (condition != null) { return(JsonResultModel.Success("构造树成功!", new List <SearchConditionNode> { condition })); } else { return(JsonResultModel.Success("构造树成功!", new List <SearchConditionNode>())); } }
public IActionResult LogicDelete(int id) { metaObjectService.LogicDelete(id); return(JsonResultModel.Success("删除成功")); }
public IActionResult LogicDelete(int id) { interfaceAggregationService.LogicDelete(id); return(JsonResultModel.Success("删除成功")); }
public IActionResult Delete(int id) { _tenantApplicationLicenseService.Delete(id); return(JsonResultModel.Success("删除成功")); }
public IActionResult Recover(int id) { _menueService.Recover(id); return(JsonResultModel.Success("恢复成功")); }
public IActionResult LogicDelete(int id) { fieldListService.LogicDelete(id); return(JsonResultModel.Success("删除成功")); }
public IActionResult LogicDelete(int id) { _tenantInfoService.LogicDelete(id); return(JsonResultModel.Success("删除成功")); }
public IActionResult Get([FromQuery] QueryArgs queryArgs) { try { //Pretreatment create queryContext QueryPiplineContext queryContext = PretreatmentAndCreateQueryPiplineContext(queryArgs); //查询条件 FilterDefinition <BsonDocument> filter = FilterDefinition <BsonDocument> .Empty; //【SingleObject,TableList,Count】预处理一些逻辑 if (new InterfaceType[] { InterfaceType.SingleObject, InterfaceType.TableList, InterfaceType.Count }.Contains(queryContext.InterfaceType)) { //缓存对象下的全部未删除字段信息 queryContext.MetaFieldsUnDeleted = metaFieldService.GetEntitiesUnDeletedByMetaObjectId(queryContext.MetaObjectId); //组织查询条件 filter = conditionAggregationService.AnalysisConditionToFilterDefinitionByConditionId(queryContext, queryContext.ArgumentsDic); //缓存列字段信息 if (queryContext.InterfaceType == InterfaceType.SingleObject || queryContext.InterfaceType == InterfaceType.TableList) { queryContext.FieldListMetaFieldsOfFieldListId = _fieldListMetaFieldService.GetByFieldListId(queryContext.FieldListId); } } switch (queryContext.InterfaceType) { case InterfaceType.SingleObject: //缓存某个服务下的全部触发器脚本,包括before和after queryContext.TriggerScriptsOfOneServiceType = _triggerScriptService.GetTriggerScriptsUnDeletedByMetaObjectIdAndServiceType(queryContext.MetaObjectId, (int)ServiceType.Interface_SingleObject); filter = _triggerScriptService.RunTriggerScript(queryContext, TriggerPoint.Before, TriggerScriptService.FunctionName_MetaObject_Interface_SingleObject_Before, filter, CurrentApplicationContext, queryContext.InterfaceCode, filter); var singleObjectComponent = dataAccessService.GetSingleObjectComponent(queryContext, filter); singleObjectComponent = _triggerScriptService.RunTriggerScript(queryContext, TriggerPoint.After, TriggerScriptService.FunctionName_MetaObject_Interface_SingleObject_After, singleObjectComponent, CurrentApplicationContext, queryContext.InterfaceCode, singleObjectComponent); return(JsonResultModel.Success("get single data success", singleObjectComponent)); case InterfaceType.TableList: //缓存某个服务下的全部触发器脚本,包括before和after queryContext.TriggerScriptsOfOneServiceType = _triggerScriptService.GetTriggerScriptsUnDeletedByMetaObjectIdAndServiceType(queryContext.MetaObjectId, (int)ServiceType.Interface_TableList); filter = _triggerScriptService.RunTriggerScript(queryContext, TriggerPoint.Before, TriggerScriptService.FunctionName_MetaObject_Interface_TableList_Before, filter, CurrentApplicationContext, queryContext.InterfaceCode, filter); var sort = metaFieldService.GetSortDefinitionBySortFields(queryContext, new[] { new SortField { Column = "ModifyTime", IsDesc = true } }); var tableListComponent = dataAccessService.GetTableListComponent(queryContext, filter, queryArgs._pageIndex, queryArgs._pageSize, sort, out int totalCount); tableListComponent = _triggerScriptService.RunTriggerScript(queryContext, TriggerPoint.After, TriggerScriptService.FunctionName_MetaObject_Interface_TableList_After, tableListComponent, CurrentApplicationContext, queryContext.InterfaceCode, tableListComponent); return(JsonResultModel.Success("get data list success", tableListComponent)); case InterfaceType.Count: //缓存某个服务下的全部触发器脚本,包括before和after queryContext.TriggerScriptsOfOneServiceType = _triggerScriptService.GetTriggerScriptsUnDeletedByMetaObjectIdAndServiceType(queryContext.MetaObjectId, (int)ServiceType.Interface_Count); filter = _triggerScriptService.RunTriggerScript(queryContext, TriggerPoint.Before, TriggerScriptService.FunctionName_MetaObject_Interface_Count_Before, filter, CurrentApplicationContext, queryContext.InterfaceCode, filter); var count = dataAccessService.GetCount(queryContext.TenantId, queryContext.MetaObjectId, filter); count = _triggerScriptService.RunTriggerScript(queryContext, TriggerPoint.After, TriggerScriptService.FunctionName_MetaObject_Interface_Count_After, count, CurrentApplicationContext, queryContext.InterfaceCode, filter, count); return(JsonResultModel.Success("get data count success", count)); case InterfaceType.JsonDataSource: return(new JsonResult(Newtonsoft.Json.JsonConvert.DeserializeObject(_dataSourceService.GetById(queryContext.DataSourceId).Script))); case InterfaceType.ExecutableScriptDataSource: object triggerScriptDataSourceResult = _triggerScriptService.RunDataSourceScript(queryContext, CurrentApplicationContext, queryContext.InterfaceCode, queryContext.ArgumentsDic); return(JsonResultModel.Success("get trigger script result success", triggerScriptDataSourceResult)); default: break; } return(JsonResultModel.Success("success,no data")); } catch (ArgumentNullException argNullEx) { return(JsonResultModel.Error(argNullEx.Message)); } catch (ArgumentException argEx) { return(JsonResultModel.Error(argEx.Message)); } catch (Exception ex) { return(JsonResultModel.Error(ex.Message)); } }
public IActionResult Recover(int id) { metaObjectService.Recover(id); return(JsonResultModel.Success("恢复成功")); }
public IActionResult Get([FromQuery] QueryArgs queryArgs) { try { //args check if (queryArgs == null) { return(JsonResultModel.Error($"Parameter invalid:queryArgs = null")); } var checkResult = queryArgs.QueryArgsCheck(); if (!checkResult.IsSuccess) { return(checkResult.ToJsonResultModel()); } //argumentsDic generate Dictionary <string, object> argumentsDic = new Dictionary <string, object>(); foreach (var item in Request.Query) { if (!argumentsDic.ContainsKey(item.Key)) { argumentsDic.Add(item.Key.ToUpperInvariant(), item.Value); } } //get filter var interfaceAggregation = interfaceAggregationService.GetByInterfaceAggregationCode(queryArgs.interfaceCode); if (interfaceAggregation == null) { return(JsonResultModel.Error($"未能找到接口编码为[{queryArgs.interfaceCode}]对应的接口信息")); } var filter = conditionAggregationService.AnalysisConditionToFilterDefinitionByConditionId(interfaceAggregation.MetaObjectId, interfaceAggregation.SearchConditionId, argumentsDic); //get result switch ((InterfaceType)interfaceAggregation.InterfaceType) { case InterfaceType.CloudSingleObject: filter = triggerScriptEngineService.SingleObjectBefore(interfaceAggregation.MetaObjectId, interfaceAggregation.Code, filter); var singleObjectComponent = dataAccessService.GetSingleObjectComponent(interfaceAggregation.MetaObjectId, interfaceAggregation.FieldListId, filter); singleObjectComponent = triggerScriptEngineService.SingleObjectAfter(interfaceAggregation.MetaObjectId, interfaceAggregation.Code, singleObjectComponent); return(JsonResultModel.Success("get single data success", singleObjectComponent)); case InterfaceType.CloudTableList: filter = triggerScriptEngineService.TableListBefore(interfaceAggregation.MetaObjectId, interfaceAggregation.Code, filter); var sort = metaFieldService.GetSortDefinitionBySortFields(interfaceAggregation.MetaObjectId, null); var tableListComponent = dataAccessService.GetTableListComponent(interfaceAggregation.MetaObjectId, interfaceAggregation.FieldListId, filter, queryArgs.pageIndex, queryArgs.pageSize, sort, out int totalCount); tableListComponent = triggerScriptEngineService.TableListAfter(interfaceAggregation.MetaObjectId, interfaceAggregation.Code, tableListComponent); return(JsonResultModel.Success("get data list success", tableListComponent)); case InterfaceType.CloudCount: filter = triggerScriptEngineService.CountBefore(interfaceAggregation.MetaObjectId, interfaceAggregation.Code, filter); var count = dataAccessService.GetCount(interfaceAggregation.MetaObjectId, filter); count = triggerScriptEngineService.CountAfter(interfaceAggregation.MetaObjectId, interfaceAggregation.Code, count); return(JsonResultModel.Success("get data count success", count)); case InterfaceType.EnumeDataSource: break; case InterfaceType.TriggerScriptDataSource: object triggerScriptDataSourceResult = triggerScriptEngineService.TriggerScriptDataSource(interfaceAggregation.Code, argumentsDic, interfaceAggregation.Script); return(JsonResultModel.Success("get trigger script result success", triggerScriptDataSourceResult)); default: break; } return(JsonResultModel.Success("success,no data")); } catch (ArgumentNullException argNullEx) { return(JsonResultModel.Error(argNullEx.Message)); } catch (ArgumentException argEx) { return(JsonResultModel.Error(argEx.Message)); } catch (Exception ex) { return(JsonResultModel.Error(ex.Message)); } }
public IActionResult LogicDelete(int id) { _userAccountService.LogicDelete(id); return(JsonResultModel.Success("删除成功")); }
public IActionResult LogicDelete(int id) { _dataSourceService.LogicDelete(id); return(JsonResultModel.Success("删除成功")); }
public IActionResult LogicDelete(int id) { indexViewService.LogicDelete(id); return(JsonResultModel.Success("删除成功")); }
public IActionResult Delete(int id) { _menueService.Delete(id); return(JsonResultModel.Success("删除成功")); }
public IActionResult LogicDelete(int id) { applicationService.LogicDelete(id); return(JsonResultModel.Success("删除成功")); }
public IActionResult DisableApplication(int id) { var entity = _tenantApplicationLicenseService.DisableApplication(id); return(JsonResultModel.Success("停用成功"));; }
public IActionResult LogicDelete(int id) { triggerScriptService.LogicDelete(id); return(JsonResultModel.Success("删除成功")); }
public IActionResult Post([FromBody] UIIndexPageQueryArgs queryArgs) { try { //args check if (queryArgs == null) { return(JsonResultModel.Error($"Parameter invalid:queryArgs = null")); } var checkResult = queryArgs.ArgsCheck(); if (!checkResult.IsSuccess) { return(checkResult.ToJsonResultModel()); } //argumentsDic generate Dictionary <string, object> argumentsDic = new Dictionary <string, object>(); foreach (var item in Request.Query) { if (!argumentsDic.ContainsKey(item.Key)) { argumentsDic.Add(item.Key.ToUpperInvariant(), item.Value); } } //get filter var indexView = indexViewService.GetByCode(queryArgs.ViewName); if (indexView == null) { return(JsonResultModel.Error($"未能找到视图编码为[{queryArgs.ViewName}]对应的视图信息")); } //分析搜索条件,是否忽略参数校验为true,如果参数没传递则不抛出异常且处理为忽略参数 var filter = conditionAggregationService.AnalysisConditionToFilterDefinitionByConditionId(indexView.MetaObjectId, indexView.SearchConditionId, argumentsDic, true); //如果参数都没传递或者其他原因导致条件没有,则直接返回全部 if (filter == null) { filter = Builders <BsonDocument> .Filter.Empty; } //filter = triggerScriptEngineService.TableListBefore(indexView.MetaObjectId, indexView.Code, filter); //var sort = metaFieldService.GetSortDefinitionBySortFields(indexView.MetaObjectId, queryArgs.SortFields); //var tableListComponent = dataAccessService.GetTableListComponent(indexView.MetaObjectId, indexView.FieldListId, filter, queryArgs.PageIndex, queryArgs.PageSize, sort, out int totalCount); //tableListComponent = triggerScriptEngineService.TableListAfter(indexView.MetaObjectId, indexView.Code, tableListComponent); return(JsonResultModel.Success("get data list success", null)); } catch (ArgumentNullException argNullEx) { return(JsonResultModel.Error(argNullEx.Message)); } catch (ArgumentException argEx) { return(JsonResultModel.Error(argEx.Message)); } catch (Exception ex) { return(JsonResultModel.Error(ex.Message)); } }
public IActionResult Recover(int id) { triggerScriptService.Recover(id); return(JsonResultModel.Success("恢复成功")); }
public IActionResult Recover(int id) { interfaceAggregationService.Recover(id); return(JsonResultModel.Success("恢复成功")); }
public IActionResult GetDefaultTriggerScript(int scriptType) { string script = triggerScriptService.GetDefaultTriggerScriptByScriptType(scriptType); return(JsonResultModel.Success("get default trigger script", script)); }