From 19feb13f7402a4fcd6ed594bba583310a7e9c8d2 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 6 Dec 2023 11:20:40 +0800 Subject: [PATCH 01/24] =?UTF-8?q?style:=20=E5=9C=B0=E7=90=86=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=A0=91=E8=8A=82=E7=82=B9=E8=B6=85=E5=87=BA=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E6=9C=AA=E5=A4=84=E7=90=86=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/map/manage/MapManage.java | 31 ++++++++++++++++--- .../views/system/parameter/map/Geometry.vue | 10 ++++-- de-xpack | 2 +- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/map/manage/MapManage.java b/core/core-backend/src/main/java/io/dataease/map/manage/MapManage.java index 448339da25..f774538ef8 100644 --- a/core/core-backend/src/main/java/io/dataease/map/manage/MapManage.java +++ b/core/core-backend/src/main/java/io/dataease/map/manage/MapManage.java @@ -1,5 +1,7 @@ package io.dataease.map.manage; +import cn.hutool.core.collection.ListUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.dataease.api.map.dto.GeometryNodeCreator; import io.dataease.api.map.vo.AreaNode; import io.dataease.constant.StaticResourceConstants; @@ -29,6 +31,7 @@ import java.util.HashMap; import java.util.List; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; +import java.util.stream.Stream; import static io.dataease.constant.CacheConstant.CommonCacheConstant.WORLD_MAP_CACHE; @@ -147,10 +150,30 @@ public class MapManage { if (!StringUtils.startsWith(code, GEO_PREFIX)) { DEException.throwException("内置Geometry,禁止删除"); } - coreAreaCustomMapper.deleteById(code); - File file = buildGeoFile(code); - if (file.exists()) { - file.delete(); + CoreAreaCustom coreAreaCustom = coreAreaCustomMapper.selectById(code); + if (ObjectUtils.isEmpty(coreAreaCustom)) { + DEException.throwException("Geometry code 不存在!"); + } + List codeResultList = new ArrayList<>(); + codeResultList.add(code); + childTreeIdList(ListUtil.of(code), codeResultList); + coreAreaCustomMapper.deleteBatchIds(codeResultList); + codeResultList.forEach(id -> { + File file = buildGeoFile(id); + if (file.exists()) { + file.delete(); + } + }); + } + + public void childTreeIdList(List pidList, List resultList) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("pid", pidList); + List coreAreaCustoms = coreAreaCustomMapper.selectList(queryWrapper); + if (CollectionUtils.isNotEmpty(coreAreaCustoms)) { + List codeList = coreAreaCustoms.stream().map(CoreAreaCustom::getId).toList(); + resultList.addAll(codeList); + childTreeIdList(codeList, resultList); } } diff --git a/core/core-frontend/src/views/system/parameter/map/Geometry.vue b/core/core-frontend/src/views/system/parameter/map/Geometry.vue index 67244cba94..0c899a1066 100644 --- a/core/core-frontend/src/views/system/parameter/map/Geometry.vue +++ b/core/core-frontend/src/views/system/parameter/map/Geometry.vue @@ -40,6 +40,7 @@