From 2814fa6a903c7194325a53edbac5058dba3d69a5 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Tue, 24 Dec 2024 16:34:14 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E8=A7=86=E5=9B=BE=E6=B7=BB=E5=8A=A0=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1318860777553920]自定义视图添加引用列表 http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1318860777553920 --- .../constvalue/FrameworkFromType.java | 2 - .../CiAttr2MatrixAttrDependencyHandler.java | 97 --------------- .../CmdbCiMatrixDependencyHandler.java | 117 ------------------ 3 files changed, 216 deletions(-) delete mode 100644 src/main/java/neatlogic/module/framework/dependency/handler/CiAttr2MatrixAttrDependencyHandler.java delete mode 100644 src/main/java/neatlogic/module/framework/dependency/handler/CmdbCiMatrixDependencyHandler.java diff --git a/src/main/java/neatlogic/framework/dependency/constvalue/FrameworkFromType.java b/src/main/java/neatlogic/framework/dependency/constvalue/FrameworkFromType.java index 4e3b8d85b..abf8c706e 100644 --- a/src/main/java/neatlogic/framework/dependency/constvalue/FrameworkFromType.java +++ b/src/main/java/neatlogic/framework/dependency/constvalue/FrameworkFromType.java @@ -32,8 +32,6 @@ public enum FrameworkFromType implements IFromType { FORMSCENE("formscene", new I18n("表单场景")), FORMATTR("formattr", new I18n("表单属性")), INTEGRATION("integration", new I18n("集成")), - CMDBCI("cmdbci", new I18n("cmdb模型")), - CMDBCIATTR("cmdbciattr", new I18n("cmdb模型属性")), WORKTIME("worktime", new I18n("服务窗口")), NOTIFY_POLICY("notifypolicy", new I18n("通知策略")); diff --git a/src/main/java/neatlogic/module/framework/dependency/handler/CiAttr2MatrixAttrDependencyHandler.java b/src/main/java/neatlogic/module/framework/dependency/handler/CiAttr2MatrixAttrDependencyHandler.java deleted file mode 100644 index eaf6244e8..000000000 --- a/src/main/java/neatlogic/module/framework/dependency/handler/CiAttr2MatrixAttrDependencyHandler.java +++ /dev/null @@ -1,97 +0,0 @@ -/*Copyright (C) $today.year 深圳极向量科技有限公司 All Rights Reserved. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see .*/ - -package neatlogic.module.framework.dependency.handler; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import neatlogic.framework.asynchronization.threadlocal.TenantContext; -import neatlogic.framework.dependency.constvalue.FrameworkFromType; -import neatlogic.framework.dependency.core.DefaultDependencyHandlerBase; -import neatlogic.framework.dependency.core.IFromType; -import neatlogic.framework.dependency.dto.DependencyInfoVo; -import neatlogic.framework.dependency.dto.DependencyVo; -import neatlogic.framework.matrix.dao.mapper.MatrixMapper; -import neatlogic.framework.matrix.dto.MatrixCiVo; -import neatlogic.framework.matrix.dto.MatrixVo; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.MapUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; - -/** - * 矩阵属性引用cmdbci模型属性或关系 - * @author linbq - * @since 2022/1/11 13:05 - **/ -@Component -public class CiAttr2MatrixAttrDependencyHandler extends DefaultDependencyHandlerBase { - - @Resource - private MatrixMapper matrixMapper; - - @Override - protected DependencyInfoVo parse(DependencyVo dependencyVo) { - JSONObject config = dependencyVo.getConfig(); - if (MapUtils.isNotEmpty(config)) { - String matrixUuid = config.getString("matrixUuid"); - if (StringUtils.isNotBlank(matrixUuid)) { - MatrixVo matrixVo = matrixMapper.getMatrixByUuid(matrixUuid); - if (matrixVo != null) { - MatrixCiVo matrixCiVo = matrixMapper.getMatrixCiByMatrixUuid(matrixUuid); - if (matrixCiVo != null) { - JSONObject matrixCiconfig = matrixCiVo.getConfig(); - if (MapUtils.isNotEmpty(matrixCiconfig)) { - JSONArray showAttributeArray = matrixCiconfig.getJSONArray("showAttributeList"); - if (CollectionUtils.isNotEmpty(showAttributeArray)) { - for (int i = 0; i < showAttributeArray.size(); i++) { - JSONObject showAttributeObj = showAttributeArray.getJSONObject(i); - if (MapUtils.isNotEmpty(showAttributeObj)) { - String label = showAttributeObj.getString("label"); - if (label.endsWith(dependencyVo.getFrom())) { - JSONObject dependencyInfoConfig = new JSONObject(); - dependencyInfoConfig.put("matrixUuid", matrixVo.getUuid()); - dependencyInfoConfig.put("matrixName", matrixVo.getName()); - dependencyInfoConfig.put("matrixType", matrixVo.getType()); - String toName = showAttributeObj.getString("name"); -// dependencyInfoConfig.put("attributeName", toName); - List pathList = new ArrayList<>(); - pathList.add("矩阵管理"); - pathList.add(matrixVo.getName()); - String lastName = toName; -// String pathFormat = "矩阵-${DATA.matrixName}-${DATA.attributeName}"; - String urlFormat = "/" + TenantContext.get().getTenantUuid() + "/framework.html#/matrix-view-edit?uuid=${DATA.matrixUuid}&name=${DATA.matrixName}&type=${DATA.matrixType}"; - return new DependencyInfoVo(matrixVo.getUuid(), dependencyInfoConfig, lastName, pathList, urlFormat, this.getGroupName()); - } - } - } - } - } - } - } - } - } - return null; - } - - @Override - public IFromType getFromType() { - return FrameworkFromType.CMDBCIATTR; - } -} diff --git a/src/main/java/neatlogic/module/framework/dependency/handler/CmdbCiMatrixDependencyHandler.java b/src/main/java/neatlogic/module/framework/dependency/handler/CmdbCiMatrixDependencyHandler.java deleted file mode 100644 index bbc28cbdc..000000000 --- a/src/main/java/neatlogic/module/framework/dependency/handler/CmdbCiMatrixDependencyHandler.java +++ /dev/null @@ -1,117 +0,0 @@ -/*Copyright (C) 2023 深圳极向量科技有限公司 All Rights Reserved. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see .*/ - -package neatlogic.module.framework.dependency.handler; - -import com.alibaba.fastjson.JSONObject; -import neatlogic.framework.asynchronization.threadlocal.TenantContext; -import neatlogic.framework.dependency.constvalue.FrameworkFromType; -import neatlogic.framework.dependency.core.CustomDependencyHandlerBase; -import neatlogic.framework.dependency.core.IFromType; -import neatlogic.framework.dependency.dto.DependencyInfoVo; -import neatlogic.framework.matrix.dao.mapper.MatrixMapper; -import neatlogic.framework.matrix.dto.MatrixVo; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * 矩阵引用cmdb模型 - * - * @author: linbq - * @since: 2021/4/6 15:21 - **/ -@Service -public class CmdbCiMatrixDependencyHandler extends CustomDependencyHandlerBase { - - @Resource - private MatrixMapper matrixMapper; - - /** - * 表名 - * - * @return - */ - @Override - protected String getTableName() { - return "matrix_ci"; - } - - /** - * 被引用者(上游)字段 - * - * @return - */ - @Override - protected String getFromField() { - return "ci_id"; - } - - /** - * 引用者(下游)字段 - * - * @return - */ - @Override - protected String getToField() { - return "matrix_uuid"; - } - - @Override - protected List getToFieldList() { - return null; - } - - /** - * 解析数据,拼装跳转url,返回引用下拉列表一个选项数据结构 - * - * @param dependencyObj 引用关系数据 - * @return - */ - @Override - protected DependencyInfoVo parse(Object dependencyObj) { - if (dependencyObj instanceof Map) { - Map map = (Map) dependencyObj; - String matrixUuid = (String) map.get("matrix_uuid"); - MatrixVo matrixVo = matrixMapper.getMatrixByUuid(matrixUuid); - if (matrixVo != null) { - JSONObject dependencyInfoConfig = new JSONObject(); - dependencyInfoConfig.put("matrixUuid", matrixVo.getUuid()); - dependencyInfoConfig.put("matrixName", matrixVo.getName()); - dependencyInfoConfig.put("matrixType", matrixVo.getType()); - List pathList = new ArrayList<>(); - pathList.add("矩阵管理"); - String lastName = matrixVo.getName(); -// String pathFormat = "矩阵-${DATA.matrixName}"; - String urlFormat = "/" + TenantContext.get().getTenantUuid() + "/framework.html#/matrix-view-edit?uuid=${DATA.matrixUuid}&name=${DATA.matrixName}&type=${DATA.matrixType}"; - return new DependencyInfoVo(matrixVo.getUuid(), dependencyInfoConfig, lastName, pathList, urlFormat, this.getGroupName()); - } - } - return null; - } - - /** - * 被引用者(上游)类型 - * - * @return - */ - @Override - public IFromType getFromType() { - return FrameworkFromType.CMDBCI; - } -} -- Gitee