fix: 优化逻辑

This commit is contained in:
tangwei 2026-07-06 16:09:40 +08:00
parent 25aeb62e95
commit c6dc532040
3 changed files with 48 additions and 4 deletions

View File

@ -61,6 +61,7 @@ public class MapLegendController {
// 执行分页查询 // 执行分页查询
Page<MsMaplegendB> page = DataSourceRequestUtil.getPage(dataSourceRequest); Page<MsMaplegendB> page = DataSourceRequestUtil.getPage(dataSourceRequest);
Page<MsMaplegendB> resultPage; Page<MsMaplegendB> resultPage;
wrapper.eq("IS_DELETED", 0);
if (page != null) { if (page != null) {
resultPage = mapLegendService.page(page, wrapper); resultPage = mapLegendService.page(page, wrapper);
} else { } else {
@ -110,7 +111,7 @@ public class MapLegendController {
String parentId = entity.getParentId(); String parentId = entity.getParentId();
if (parentId != null && parentMap.containsKey(parentId)) { if (parentId != null && parentMap.containsKey(parentId)) {
MsMaplegendB parent = parentMap.get(parentId); MsMaplegendB parent = parentMap.get(parentId);
entity.setParentCode(parent.getCode()); entity.setParentCode(parent.getNameEn());
entity.setParentName(parent.getName()); entity.setParentName(parent.getName());
} else { } else {
entity.setParentCode(null); entity.setParentCode(null);

View File

@ -178,8 +178,8 @@ public class MapLegendBizServiceImpl implements IMapLegendBizService {
collect.forEach((str, mapLegendVoList) -> { collect.forEach((str, mapLegendVoList) -> {
MapLegendVo mapLegendVo = new MapLegendVo(); MapLegendVo mapLegendVo = new MapLegendVo();
mapLegendVo.setName(str); mapLegendVo.setName(str);
mapLegendVo.setPSort(mapLegendVoList.get(0).getPSort()); mapLegendVo.setPSort(mapLegendVoList.getFirst().getPSort());
mapLegendVo.setLayerCode(finalLayerCodeMap.get(mapLegendVoList.get(0).getParentId())); mapLegendVo.setLayerCode(finalLayerCodeMap.get(mapLegendVoList.getFirst().getParentId()));
// 按子级分组名分组 // 按子级分组名分组
Map<String, List<MapLegendVo>> collect1 = mapLegendVoList.stream() Map<String, List<MapLegendVo>> collect1 = mapLegendVoList.stream()
.collect(Collectors.groupingBy(MapLegendVo::getGroupName)); .collect(Collectors.groupingBy(MapLegendVo::getGroupName));
@ -188,7 +188,7 @@ public class MapLegendBizServiceImpl implements IMapLegendBizService {
List<MapLegendVo> list1 = collect1.get(groupNameStr); List<MapLegendVo> list1 = collect1.get(groupNameStr);
// 如果子级和父级名称相同则不用子级 // 如果子级和父级名称相同则不用子级
if (groupNameStr.equalsIgnoreCase(str)) { if (groupNameStr.equalsIgnoreCase(str)) {
childrenList = list1; childrenList.addAll(list1);
} else { } else {
MapLegendVo mapLegendVoChild = new MapLegendVo(); MapLegendVo mapLegendVoChild = new MapLegendVo();
mapLegendVoChild.setName(groupNameStr); mapLegendVoChild.setName(groupNameStr);

View File

@ -0,0 +1,43 @@
package com.yfd.platform.utils;
import java.util.UUID;
public class UUIDUtil {
public UUIDUtil() {
}
public static String generateTenantUUID(String tenantId) {
return tenantId + generateUUID();
}
public static String generateUUID() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
public static String generateUUIDWithEnDash() {
return UUID.randomUUID().toString();
}
public static String generateUpperUUIDWithEnDash() {
return UUID.randomUUID().toString().toUpperCase();
}
public static boolean checkUuid(String uuid) {
boolean isUuid = false;
return uuid.matches("([0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}?)") ? true : isUuid;
}
public static String md5ToUUID(String md5) {
if (!StringUtils.isBlank(md5) && md5.length() == 32) {
md5 = md5.toUpperCase();
String var1 = md5.substring(0, 8);
String var2 = md5.substring(8, 12);
String var3 = md5.substring(12, 16);
String var4 = md5.substring(16, 20);
String var5 = md5.substring(20);
return var1 + "-" + var2 + "-" + var3 + "-" + var4 + "-" + var5;
} else {
return null;
}
}
}