lixiaojun
2024-04-04 0a48aec6a38d34db6e9194920aac7d2d19cadcb3
IStation.Application.SZJT/04-logic-tree/1-mgr/LogicTree_Controller.cs
@@ -98,11 +98,11 @@
            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)
@@ -110,11 +110,11 @@
                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);
            }
@@ -162,7 +162,7 @@
            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)
@@ -170,7 +170,7 @@
                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);
            }
@@ -235,7 +235,7 @@
            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;
        }
@@ -254,7 +254,7 @@
            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)
            {
@@ -268,13 +268,13 @@
                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, $"节点不能重复,请检查后重试!");
                }
            }