| | |
| | | var policy = new Service.LogicPolicy().GetByID(input.PolicyID); |
| | | if (policy == null) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"PolicyID:{input.PolicyID} 数据不存在"); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"PolicyID:{input.PolicyID} 数据不存在"); |
| | | } |
| | | if (_service.IsExist(input.PolicyID, input.LogicType, input.LogicID)) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"LogicType:{input.LogicType},LogicID:{input.LogicID} 已存在"); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.V001, $"LogicType:{input.LogicType},LogicID:{input.LogicID} 已存在"); |
| | | } |
| | | var parentIds = new List<long>(); |
| | | if (input.ParentID > 0) |
| | |
| | | var parent = _service.GetByID(input.ParentID); |
| | | if (parent == null) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"ParentID:{input.ParentID} 数据不存在"); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ParentID:{input.ParentID} 数据不存在"); |
| | | } |
| | | if (parent.PolicyID != input.PolicyID) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"ParentID:{input.ParentID} 与 PolicyID:{input.PolicyID} 不匹配"); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.V001, $"ParentID:{input.ParentID} 与 PolicyID:{input.PolicyID} 不匹配"); |
| | | } |
| | | parentIds = TreeParentIdsHelper.GetChildParentIds(parent.ID, parent.ParentIds); |
| | | } |
| | |
| | | var model = _service.GetByID(input.ID); |
| | | if (model == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D001, $"ID:{input.ID}"); |
| | | throw Oops.Oh(InternalErrorCodes.D001, $"ID:{input.ID}"); |
| | | } |
| | | var parentIds = new List<long>(); |
| | | if (input.ParentID > 0) |
| | |
| | | var parent = _service.GetByID(input.ParentID); |
| | | if (parent == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D001, $"ParentID:{input.ParentID}"); |
| | | throw Oops.Oh(InternalErrorCodes.D001, $"ParentID:{input.ParentID}"); |
| | | } |
| | | parentIds = TreeParentIdsHelper.GetChildParentIds(parent.ID, parent.ParentIds); |
| | | } |
| | |
| | | var bol = _service.DeleteByID(input.ID, out string Msg); |
| | | if (!bol) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, Msg); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, Msg); |
| | | } |
| | | return bol; |
| | | } |
| | |
| | | var policy = new Service.LogicPolicy().GetByID(input.PolicyID); |
| | | if (policy == null) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"PolicyID:{input.PolicyID} 数据不存在"); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"PolicyID:{input.PolicyID} 数据不存在"); |
| | | } |
| | | if (input.TreeList != null && input.TreeList.Count > 0) |
| | | { |
| | |
| | | |
| | | if (tempList.Exists(x => x.LogicType == IStation.DataType.LogicSite && x.Children != null && x.Children.Count > 0)) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"节点逻辑关系错误,请检查后重试!"); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.V001, $"节点逻辑关系错误,请检查后重试!"); |
| | | } |
| | | |
| | | var groupTreeList = tempList.GroupBy(x => new { x.LogicType, x.LogicID }).ToList(); |
| | | if (groupTreeList.Exists(x => x.Count() > 1)) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"节点不能重复,请检查后重试!"); |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.V001, $"节点不能重复,请检查后重试!"); |
| | | } |
| | | |
| | | } |