diff --git a/src/main/java/neatlogic/module/cmdb/matrix/constvalue/MatrixType.java b/src/main/java/neatlogic/module/cmdb/matrix/constvalue/MatrixType.java
index 63d42ce48e6ec6288e3d24b2c62e218e14c77d9d..9872eea27c67ad3a647d4308c3e4ac5f9c8fde6f 100644
--- a/src/main/java/neatlogic/module/cmdb/matrix/constvalue/MatrixType.java
+++ b/src/main/java/neatlogic/module/cmdb/matrix/constvalue/MatrixType.java
@@ -23,7 +23,9 @@ import neatlogic.framework.util.$;
* @since 2021/11/16 15:21
**/
public enum MatrixType implements IMatrixType {
- CMDBCI("cmdbci", "配置项", "ciId", 4);
+ CMDBCI("cmdbci", "nmcfe.cmdbfulltextindextype.cientity", "ciId", 4),
+ CMDBCUSTOMVIEW("cmdbcustomview", "nmcmc.matrixtype.cmdbcustomview", "customViewId", 5)
+ ;
private String value;
private String name;
diff --git a/src/main/java/neatlogic/module/cmdb/matrix/handler/CmdbCustomViewDataSourceHandler.java b/src/main/java/neatlogic/module/cmdb/matrix/handler/CmdbCustomViewDataSourceHandler.java
new file mode 100644
index 0000000000000000000000000000000000000000..0a86aa3071afc02c0833cda310e5dd53589fafb0
--- /dev/null
+++ b/src/main/java/neatlogic/module/cmdb/matrix/handler/CmdbCustomViewDataSourceHandler.java
@@ -0,0 +1,469 @@
+/*
+ * Copyright (C) 2024 深圳极向量科技有限公司 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.cmdb.matrix.handler;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import neatlogic.framework.cmdb.dto.customview.*;
+import neatlogic.framework.cmdb.exception.customview.CustomViewNotFoundException;
+import neatlogic.framework.common.constvalue.Expression;
+import neatlogic.framework.exception.type.ParamNotExistsException;
+import neatlogic.framework.matrix.constvalue.MatrixAttributeType;
+import neatlogic.framework.matrix.constvalue.SearchExpression;
+import neatlogic.framework.matrix.core.MatrixDataSourceHandlerBase;
+import neatlogic.framework.matrix.dto.*;
+import neatlogic.framework.matrix.exception.MatrixAttributeNotFoundException;
+import neatlogic.framework.matrix.exception.MatrixCmdbCustomViewNotFoundException;
+import neatlogic.framework.util.UuidUtil;
+import neatlogic.module.cmdb.dao.mapper.customview.CustomViewMapper;
+import neatlogic.module.cmdb.matrix.constvalue.MatrixType;
+import neatlogic.module.cmdb.service.customview.CustomViewDataService;
+import neatlogic.module.cmdb.workerdispatcher.exception.CmdbDispatcherDispatchFailedException;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Component
+public class CmdbCustomViewDataSourceHandler extends MatrixDataSourceHandlerBase {
+
+ private final static Logger logger = LoggerFactory.getLogger(CmdbCustomViewDataSourceHandler.class);
+
+ @Resource
+ private CustomViewMapper customViewMapper;
+
+ @Resource
+ private CustomViewDataService customViewDataService;
+
+ @Override
+ public String getHandler() {
+ return MatrixType.CMDBCUSTOMVIEW.getValue();
+ }
+
+ @Override
+ protected boolean mySaveMatrix(MatrixVo matrixVo) throws Exception {
+ Long customViewId = matrixVo.getCustomViewId();
+ if (customViewId == null) {
+ throw new ParamNotExistsException("customViewId");
+ }
+ CustomViewVo customView = customViewMapper.getCustomViewById(customViewId);
+ if (customView == null) {
+ throw new CmdbDispatcherDispatchFailedException(customViewId);
+ }
+ JSONObject config = matrixVo.getConfig();
+ if (MapUtils.isEmpty(config)) {
+ throw new ParamNotExistsException("config");
+ }
+ JSONArray showAttributeLabelArray = config.getJSONArray("showAttributeLabelList");
+ if (CollectionUtils.isEmpty(showAttributeLabelArray)) {
+ throw new ParamNotExistsException("config.showAttributeLabelList");
+ }
+ Map oldShowAttributeUuidMap = new HashMap<>();
+ MatrixCmdbCustomViewVo oldMatrixCmdbCustomViewVo = matrixMapper.getMatrixCmdbCustomViewByMatrixUuid(matrixVo.getUuid());
+ if (oldMatrixCmdbCustomViewVo != null) {
+ if (customViewId.equals(oldMatrixCmdbCustomViewVo.getCustomViewId())) {
+ JSONObject oldConfig = oldMatrixCmdbCustomViewVo.getConfig();
+ if (MapUtils.isNotEmpty(oldConfig)) {
+ JSONArray oldShowAttributeUuidArray = oldConfig.getJSONArray("showAttributeLabelList");
+ if (CollectionUtils.isNotEmpty(oldShowAttributeUuidArray)) {
+ if (CollectionUtils.isEqualCollection(oldShowAttributeUuidArray, showAttributeLabelArray)) {
+ return false;
+ }
+ JSONArray showAttributeArray = oldConfig.getJSONArray("showAttributeList");
+ if (CollectionUtils.isNotEmpty(showAttributeArray)) {
+ for (int i = 0; i < showAttributeArray.size(); i++) {
+ JSONObject showAttributeObj = showAttributeArray.getJSONObject(i);
+ if (MapUtils.isNotEmpty(showAttributeObj)) {
+ String uuid = showAttributeObj.getString("uuid");
+ if (uuid != null) {
+ oldShowAttributeUuidMap.put(showAttributeObj.getString("label"), uuid);
+// DependencyManager.delete(CiAttr2MatrixAttrDependencyHandler.class, uuid);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ JSONArray showAttributeArray = new JSONArray();
+ Iterator