From e2bb5ac6bc6082118ae799aa4b921896abe46e5c Mon Sep 17 00:00:00 2001 From: ZZX9599 <536509593@qq.com> Date: Wed, 5 Nov 2025 14:28:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=81=E5=8A=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FileInfoController.java | 7 -- .../business/controller/RoleController.java | 28 +++++ .../controller/RoleMenuController.java | 49 ++++++-- .../controller/RoleOperateController.java | 14 ++- .../controller/TsEventController.java | 39 ++++++- .../controller/TsSourceController.java | 38 +++++++ .../business/controller/UserController.java | 10 +- .../controller/WebSourceController.java | 2 +- .../earth/business/service/SourceService.java | 4 +- .../business/service/TsSourceService.java | 13 +-- .../service/impl/SourceServiceImpl.java | 1 - .../service/impl/TsSourceServiceImpl.java | 106 ++++++++++++++++-- .../yj/earth/dto/roleMenu/UpdateMenuDto.java | 11 +- .../dto/roleOperate/UpdateRoleOperateDto.java | 6 +- .../dto/tsSource/AddTsModelSourceDto.java | 22 ++++ .../yj/earth/params/ArcgisBlueImagery.java | 15 +++ .../com/yj/earth/params/ArcgisWximagery.java | 15 +++ .../java/com/yj/earth/params/GdlwImagery.java | 15 +++ .../java/com/yj/earth/params/GdslImagery.java | 15 +++ src/main/java/com/yj/earth/params/Sector.java | 76 +++++++++++++ .../java/com/yj/earth/word/GenerateDocx.java | 104 +++++++++++++++++ 21 files changed, 532 insertions(+), 58 deletions(-) create mode 100644 src/main/java/com/yj/earth/dto/tsSource/AddTsModelSourceDto.java create mode 100644 src/main/java/com/yj/earth/params/ArcgisBlueImagery.java create mode 100644 src/main/java/com/yj/earth/params/ArcgisWximagery.java create mode 100644 src/main/java/com/yj/earth/params/GdlwImagery.java create mode 100644 src/main/java/com/yj/earth/params/GdslImagery.java create mode 100644 src/main/java/com/yj/earth/params/Sector.java create mode 100644 src/main/java/com/yj/earth/word/GenerateDocx.java diff --git a/src/main/java/com/yj/earth/business/controller/FileInfoController.java b/src/main/java/com/yj/earth/business/controller/FileInfoController.java index 1b41ae5..e906428 100644 --- a/src/main/java/com/yj/earth/business/controller/FileInfoController.java +++ b/src/main/java/com/yj/earth/business/controller/FileInfoController.java @@ -91,13 +91,6 @@ public class FileInfoController { // 计算文件MD5(用于校验文件完整性) String fileMd5 = DigestUtil.md5Hex(destFile); - // 查询有没有文件名一样并且 MD5 也一样的数据 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(FileInfo::getFileName, originalFilename).eq(FileInfo::getFileMd5, fileMd5); - if (fileInfoService.count(queryWrapper) > 0) { - return ApiResponse.failure("已存在文件名相同且内容完全一致的文件"); - } - // 保存文件信息到数据库 FileInfo fileInfo = new FileInfo(); fileInfo.setFileName(originalFilename); diff --git a/src/main/java/com/yj/earth/business/controller/RoleController.java b/src/main/java/com/yj/earth/business/controller/RoleController.java index 11de754..5c8de56 100644 --- a/src/main/java/com/yj/earth/business/controller/RoleController.java +++ b/src/main/java/com/yj/earth/business/controller/RoleController.java @@ -5,7 +5,11 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yj.earth.annotation.CheckAuth; import com.yj.earth.business.domain.Role; +import com.yj.earth.business.domain.RoleMenu; +import com.yj.earth.business.domain.RoleOperate; import com.yj.earth.business.domain.User; +import com.yj.earth.business.service.RoleMenuService; +import com.yj.earth.business.service.RoleOperateService; import com.yj.earth.business.service.RoleService; import com.yj.earth.business.service.UserService; import com.yj.earth.common.util.ApiResponse; @@ -34,12 +38,18 @@ public class RoleController { private RoleService roleService; @Resource private UserService userService; + @Resource + private RoleOperateService roleOperateService; + @Resource + private RoleMenuService roleMenuService; @Operation(summary = "新增角色") @PostMapping("/add") public ApiResponse save(@RequestBody AddRoleDto addRoleDto) { Role role = new Role(); BeanUtils.copyProperties(addRoleDto, role); + // 设置默认不是管理员 + role.setIsSuper(0); roleService.save(role); return ApiResponse.success(null); } @@ -126,6 +136,24 @@ public class RoleController { return ApiResponse.success(null); } + @Operation(summary = "根据角色ID返回权限信息") + @GetMapping("/getOptionByRoleId") + public ApiResponse getOptionByRoleId(@RequestParam(required = true) @Parameter(description = "角色ID") String roleId) { + // 查询角色操作表 + LambdaQueryWrapper operateLambdaQueryWrapper = new LambdaQueryWrapper<>(); + operateLambdaQueryWrapper.eq(RoleOperate::getRoleId, roleId); + List roleOperates = roleOperateService.list(operateLambdaQueryWrapper); + // 查询角色菜单表 + LambdaQueryWrapper menuLambdaQueryWrapper = new LambdaQueryWrapper<>(); + menuLambdaQueryWrapper.eq(RoleMenu::getRoleId, roleId); + List roleMenus = roleMenuService.list(menuLambdaQueryWrapper); + // 返回数据 + Map data = new HashMap<>(); + data.put("roleOperates", roleOperates); + data.put("roleMenus", roleMenus); + return ApiResponse.success(data); + } + @Operation(summary = "根据角色ID返回用户信息") @GetMapping("/getUsersByRoleId") public ApiResponse getUsersByRoleId(@Parameter(description = "角色ID") String roleId) { diff --git a/src/main/java/com/yj/earth/business/controller/RoleMenuController.java b/src/main/java/com/yj/earth/business/controller/RoleMenuController.java index 0239d3e..e2cc8f7 100644 --- a/src/main/java/com/yj/earth/business/controller/RoleMenuController.java +++ b/src/main/java/com/yj/earth/business/controller/RoleMenuController.java @@ -35,23 +35,19 @@ public class RoleMenuController { if (permissionList == null || permissionList.isEmpty()) { return ApiResponse.success(null); } - // 遍历权限列表中的每一组配置 for (Map> permissionMap : permissionList) { if (permissionMap == null || permissionMap.isEmpty()) { continue; } - // 遍历每个菜单的权限配置 Set>> entries = permissionMap.entrySet(); for (Map.Entry> entry : entries) { String menu = entry.getKey(); List permissions = entry.getValue(); - if (permissions == null) { permissions = new ArrayList<>(); } - if (permissions.isEmpty()) { RoleMenu roleMenu = new RoleMenu(); roleMenu.setRoleId(roleId); @@ -69,7 +65,6 @@ public class RoleMenuController { } } } - return ApiResponse.success(null); } @@ -83,9 +78,47 @@ public class RoleMenuController { @Operation(summary = "修改角色菜单权限") @PostMapping("/update") public ApiResponse update(@RequestBody UpdateMenuDto updateMenuDto) { - RoleMenu roleMenu = new RoleMenu(); - BeanUtils.copyProperties(updateMenuDto, roleMenu); - roleMenuService.updateById(roleMenu); + // 先删除角色菜单权限 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(RoleMenu::getRoleId, updateMenuDto.getRoleId()); + roleMenuService.remove(queryWrapper); + // 再新增 + String roleId = updateMenuDto.getRoleId(); + List>> permissionList = updateMenuDto.getPermissionList(); + + if (permissionList == null || permissionList.isEmpty()) { + return ApiResponse.success(null); + } + // 遍历权限列表中的每一组配置 + for (Map> permissionMap : permissionList) { + if (permissionMap == null || permissionMap.isEmpty()) { + continue; + } + // 遍历每个菜单的权限配置 + Set>> entries = permissionMap.entrySet(); + for (Map.Entry> entry : entries) { + String menu = entry.getKey(); + List permissions = entry.getValue(); + if (permissions == null) { + permissions = new ArrayList<>(); + } + if (permissions.isEmpty()) { + RoleMenu roleMenu = new RoleMenu(); + roleMenu.setRoleId(roleId); + roleMenu.setMenu(menu); + roleMenu.setPermission(null); + roleMenuService.save(roleMenu); + } else { + for (String permission : permissions) { + RoleMenu roleMenu = new RoleMenu(); + roleMenu.setRoleId(roleId); + roleMenu.setMenu(menu); + roleMenu.setPermission(permission); + roleMenuService.save(roleMenu); + } + } + } + } return ApiResponse.success(null); } diff --git a/src/main/java/com/yj/earth/business/controller/RoleOperateController.java b/src/main/java/com/yj/earth/business/controller/RoleOperateController.java index c3b1a7d..cdba9ea 100644 --- a/src/main/java/com/yj/earth/business/controller/RoleOperateController.java +++ b/src/main/java/com/yj/earth/business/controller/RoleOperateController.java @@ -46,9 +46,17 @@ public class RoleOperateController { @Operation(summary = "修改角色操作权限") @PostMapping("/update") public ApiResponse update(@RequestBody UpdateRoleOperateDto updateRoleOperateDto) { - RoleOperate roleOperate = new RoleOperate(); - BeanUtils.copyProperties(updateRoleOperateDto, roleOperate); - roleOperateService.updateById(roleOperate); + // 删除原有的角色操作权限 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(RoleOperate::getRoleId, updateRoleOperateDto.getRoleId()); + roleOperateService.remove(queryWrapper); + List operateList = updateRoleOperateDto.getOperateList(); + for (String operate : operateList) { + RoleOperate roleOperate = new RoleOperate(); + roleOperate.setRoleId(updateRoleOperateDto.getRoleId()); + roleOperate.setOperate(operate); + roleOperateService.save(roleOperate); + } return ApiResponse.success(null); } diff --git a/src/main/java/com/yj/earth/business/controller/TsEventController.java b/src/main/java/com/yj/earth/business/controller/TsEventController.java index a8db49a..8b6a17d 100644 --- a/src/main/java/com/yj/earth/business/controller/TsEventController.java +++ b/src/main/java/com/yj/earth/business/controller/TsEventController.java @@ -2,7 +2,9 @@ package com.yj.earth.business.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.yj.earth.business.domain.TsEvent; +import com.yj.earth.business.domain.TsSource; import com.yj.earth.business.service.TsEventService; +import com.yj.earth.business.service.TsSourceService; import com.yj.earth.common.util.ApiResponse; import com.yj.earth.dto.tsEvent.AddTsEventDto; import com.yj.earth.dto.tsEvent.UpdateTsEventDto; @@ -13,6 +15,9 @@ import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; @Tag(name = "态势事件管理") @@ -21,6 +26,8 @@ import javax.annotation.Resource; public class TsEventController { @Resource private TsEventService tsEventService; + @Resource + private TsSourceService tsSourceService; @PostMapping("/add") @Operation(summary = "添加态势事件") @@ -50,10 +57,32 @@ public class TsEventController { @Operation(summary = "查询某个态势方案下资源下的事件") public ApiResponse query( @Parameter(description = "态势方案ID") @RequestParam(required = true) String planId, - @Parameter(description = "态势资源ID") @RequestParam(required = true) String sourceId) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(TsEvent::getPlanId, planId); - queryWrapper.eq(TsEvent::getSourceId, sourceId); - return ApiResponse.success(tsEventService.list(queryWrapper)); + @Parameter(description = "态势资源ID") @RequestParam(required = false) String sourceId) { + List sourceIdList; + if (sourceId == null) { + // 查询该方案下所有资源ID + LambdaQueryWrapper sourceWrapper = new LambdaQueryWrapper<>(); + sourceWrapper.eq(TsSource::getPlanId, planId); + sourceIdList = tsSourceService.list(sourceWrapper) + .stream() + .map(TsSource::getId) + .collect(Collectors.toList()); + } else { + sourceIdList = Collections.singletonList(sourceId); + } + + // 若资源ID列表为空、直接返回空结果、避免无效查询 + if (sourceIdList.isEmpty()) { + return ApiResponse.success(Collections.emptyList()); + } + + // 查询事件 + LambdaQueryWrapper eventWrapper = new LambdaQueryWrapper<>(); + eventWrapper.eq(TsEvent::getPlanId, planId).in(TsEvent::getSourceId, sourceIdList); + return ApiResponse.success(tsEventService.list(eventWrapper)); } } + + + + diff --git a/src/main/java/com/yj/earth/business/controller/TsSourceController.java b/src/main/java/com/yj/earth/business/controller/TsSourceController.java index e63c957..28381af 100644 --- a/src/main/java/com/yj/earth/business/controller/TsSourceController.java +++ b/src/main/java/com/yj/earth/business/controller/TsSourceController.java @@ -1,9 +1,13 @@ package com.yj.earth.business.controller; +import cn.hutool.core.io.FileUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.yj.earth.business.domain.TsSource; import com.yj.earth.business.service.TsSourceService; import com.yj.earth.common.util.ApiResponse; +import com.yj.earth.common.util.JsonUtil; +import com.yj.earth.common.util.MapUtil; +import com.yj.earth.dto.tsSource.AddTsModelSourceDto; import com.yj.earth.dto.tsSource.AddTsSourceDto; import com.yj.earth.dto.tsSource.UpdateTsSourceDto; import io.swagger.v3.oas.annotations.Operation; @@ -14,6 +18,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import static com.yj.earth.common.constant.GlobalConstant.SHOW; + @Tag(name = "态势资源管理") @RestController @RequestMapping("/tsSource") @@ -52,4 +58,36 @@ public class TsSourceController { queryWrapper.eq(TsSource::getPlanId, id); return ApiResponse.success(tsSourceService.list(queryWrapper)); } + + @Operation(summary = "添加态势模型资源") + @PostMapping("/addTsModelSource") + public ApiResponse addTsModelSource(@RequestBody AddTsModelSourceDto addTsModelSourceDto) { + // 获取资源绝对路径 + String sourcePath = addTsModelSourceDto.getSourcePath(); + // 获取资源名称 + String sourceName = FileUtil.mainName(sourcePath); + // 校验是否通过 + String message = tsSourceService.checkIsPass(addTsModelSourceDto.getParentId(), sourceName); + if (message != null) { + return null; + } + // 调用SDK加载资源 + String sourceId = tsSourceService.addAndGetSourceId(sourcePath); + // 获取文件路径并处理详情 + String detail = tsSourceService.getDetail(sourcePath, sourceId); + // 构建并保存资源对象 + TsSource tsSource = new TsSource(); + tsSource.setId(addTsModelSourceDto.getId()); + tsSource.setSourcePath(sourcePath); + tsSource.setSourceName(sourceName); + tsSource.setParentId(addTsModelSourceDto.getParentId()); + tsSource.setTreeIndex(addTsModelSourceDto.getTreeIndex()); + tsSource.setParams(JsonUtil.mapToJson(addTsModelSourceDto.getParams())); + tsSource.setDetail(detail); + tsSource.setSourceType(MapUtil.getString(MapUtil.jsonToMap(detail), "fileType")); + tsSource.setIsShow(SHOW); + tsSource.setPlanId(addTsModelSourceDto.getPlanId()); + tsSourceService.save(tsSource); + return ApiResponse.success(tsSource); + } } diff --git a/src/main/java/com/yj/earth/business/controller/UserController.java b/src/main/java/com/yj/earth/business/controller/UserController.java index e093521..b783147 100644 --- a/src/main/java/com/yj/earth/business/controller/UserController.java +++ b/src/main/java/com/yj/earth/business/controller/UserController.java @@ -45,7 +45,7 @@ public class UserController { @Operation(summary = "新增用户") @PostMapping("/add") - @RoleAccess(roleNames = "管理员") + public ApiResponse save(@RequestBody AddUserDto addUserDto) { User user = new User(); BeanUtils.copyProperties(addUserDto, user); @@ -90,7 +90,6 @@ public class UserController { @Operation(summary = "用户列表") @GetMapping("/list") - @RoleAccess(roleNames = "管理员") public ApiResponse list(@Parameter(description = "分页数量") Integer pageNum, @Parameter(description = "分页大小") Integer pageSize, @Parameter(description = "搜索字段") String searchKey, @Parameter(description = "角色ID") String roleId, @Parameter(description = "用户状态") Integer status) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); // 根据用户名或者昵称进行模糊搜索 @@ -111,7 +110,7 @@ public class UserController { @Operation(summary = "设置角色") @PostMapping("/userBindOrUnBindRole") - @RoleAccess(roleNames = "管理员") + public ApiResponse userBindOrUnBindRole(@RequestBody UserBindOrUnBindRoleDto userBindOrUnBindRoleDto) { userService.lambdaUpdate().set(User::getRoleId, userBindOrUnBindRoleDto.getRoleId()).eq(User::getId, userBindOrUnBindRoleDto.getUserId()).update(); return ApiResponse.success(null); @@ -145,6 +144,7 @@ public class UserController { data.put("token", tokenInfo.getTokenValue()); data.put("roleOperates", roleOperates); data.put("roleMenus", roleMenus); + data.put("avatar", user.getAvatar()); return ApiResponse.success(data); } @@ -180,7 +180,7 @@ public class UserController { @Operation(summary = "设置新密码") @PostMapping("/setNewPassword") - @RoleAccess(roleNames = "管理员") + public ApiResponse setNewPassword(@RequestBody SetNewPasswordDto setNewPasswordDto) { User user = userService.getById(setNewPasswordDto.getId()); if (user == null) { @@ -206,7 +206,7 @@ public class UserController { if (role == null) { return ApiResponse.failure("角色不存在"); } - if (role.getIsSuper() == 1) { + if (role.getIsSuper() != null && role.getIsSuper() == 1) { return ApiResponse.success(true); } return ApiResponse.success(false); diff --git a/src/main/java/com/yj/earth/business/controller/WebSourceController.java b/src/main/java/com/yj/earth/business/controller/WebSourceController.java index abb569f..e3f2d80 100644 --- a/src/main/java/com/yj/earth/business/controller/WebSourceController.java +++ b/src/main/java/com/yj/earth/business/controller/WebSourceController.java @@ -45,7 +45,7 @@ public class WebSourceController { private PbfInfoService pbfInfoService; private static final List SUPPORT_EXTENSIONS = Arrays.asList("clt", "mbtiles", "pak", "pbf", "model"); - @RoleAccess(roleNames = "管理员") + @Operation(summary = "同步数据") @PostMapping("/sync") public ApiResponse sync() { diff --git a/src/main/java/com/yj/earth/business/service/SourceService.java b/src/main/java/com/yj/earth/business/service/SourceService.java index 05ac447..2ccb58a 100644 --- a/src/main/java/com/yj/earth/business/service/SourceService.java +++ b/src/main/java/com/yj/earth/business/service/SourceService.java @@ -11,6 +11,8 @@ import java.util.List; import java.util.Map; public interface SourceService extends IService { + String checkIsPass(String parentId, String sourceName); + String addAndGetSourceId(String sourcePath); String getDetail(String sourcePath, String sourceId); @@ -25,7 +27,5 @@ public interface SourceService extends IService { Map getSourceListByUserId(String userId, String type, String name, Integer pageNum, Integer pageSize, LocalDateTime startTime, LocalDateTime endTime); - String checkIsPass(String parentId, String sourceName); - Source addModelSource(AddModelSourceDto addModelSourceDto); } diff --git a/src/main/java/com/yj/earth/business/service/TsSourceService.java b/src/main/java/com/yj/earth/business/service/TsSourceService.java index fb3d104..5858317 100644 --- a/src/main/java/com/yj/earth/business/service/TsSourceService.java +++ b/src/main/java/com/yj/earth/business/service/TsSourceService.java @@ -3,14 +3,11 @@ package com.yj.earth.business.service; import com.yj.earth.business.domain.TsSource; import com.baomidou.mybatisplus.extension.service.IService; -/** - *

- * 服务类 - *

- * - * @author 周志雄 - * @since 2025-11-03 - */ + public interface TsSourceService extends IService { + String checkIsPass(String parentId, String sourceName); + String addAndGetSourceId(String sourcePath); + String getDetail(String sourcePath, String sourceId); + } diff --git a/src/main/java/com/yj/earth/business/service/impl/SourceServiceImpl.java b/src/main/java/com/yj/earth/business/service/impl/SourceServiceImpl.java index 4f4fc21..4a0338a 100644 --- a/src/main/java/com/yj/earth/business/service/impl/SourceServiceImpl.java +++ b/src/main/java/com/yj/earth/business/service/impl/SourceServiceImpl.java @@ -83,7 +83,6 @@ public class SourceServiceImpl extends ServiceImpl impleme if (parentId != null) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Source::getId, parentId); - List list = sourceService.list(queryWrapper); if (sourceService.count(queryWrapper) == 0) { return "父级不存在"; } diff --git a/src/main/java/com/yj/earth/business/service/impl/TsSourceServiceImpl.java b/src/main/java/com/yj/earth/business/service/impl/TsSourceServiceImpl.java index 110082d..21a94af 100644 --- a/src/main/java/com/yj/earth/business/service/impl/TsSourceServiceImpl.java +++ b/src/main/java/com/yj/earth/business/service/impl/TsSourceServiceImpl.java @@ -1,20 +1,108 @@ package com.yj.earth.business.service.impl; +import cn.hutool.core.io.FileUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.yj.earth.business.domain.TsSource; import com.yj.earth.business.mapper.TsSourceMapper; import com.yj.earth.business.service.TsSourceService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yj.earth.common.config.ServerConfig; +import com.yj.earth.common.util.HttpUtil; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -/** - *

- * 服务实现类 - *

- * - * @author 周志雄 - * @since 2025-11-03 - */ +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + @Service +@Slf4j public class TsSourceServiceImpl extends ServiceImpl implements TsSourceService { + @Resource + private ServerConfig serverConfig; + @Resource + private TsSourceService tsSourceService; + + // 存储文件后缀与对应处理函数的映射关系 + public final Map> detailFetchers; + + // 初始化映射关系 + public TsSourceServiceImpl() { + detailFetchers = new HashMap<>(); + detailFetchers.put("clt", this::fetchCltDetail); + detailFetchers.put("mbtiles", this::fetchMbtilesDetail); + detailFetchers.put("pak", this::fetchPakDetail); + } + + /** + * 调用SDK获取资源ID + */ + @Override + public String addAndGetSourceId(String sourcePath) { + Map addParams = new HashMap<>(); + addParams.put("filePath", sourcePath); + String url = buildSdkUrl("/sourceMap/add"); + return HttpUtil.doPostForm(url, addParams); + } + + /** + * 检测资源是否通过审核 + */ + @Override + public String checkIsPass(String parentId, String sourceName) { + // 先查询父节点是否存在 + if (parentId != null) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TsSource::getId, parentId); + if (tsSourceService.count(queryWrapper) == 0) { + return "父级不存在"; + } + } + return null; + } + + @Override + public String getDetail(String sourcePath, String sourceId) { + String ext = FileUtil.extName(sourcePath); + // 通过映射关系获取并执行对应的处理函数 + Function fetcher = detailFetchers.get(ext); + if (fetcher != null) { + String detailResult = fetcher.apply(sourceId); + return detailResult; + } else { + log.info("未找到{}类型的处理方式", ext); + } + return null; + } + + public String buildSdkUrl(String path) { + return "http://" + serverConfig.getHost() + ":" + serverConfig.getSdkPort() + path; + } + + /** + * 获取 CLT 类型资源详情 + */ + public String fetchCltDetail(String sourceId) { + String url = buildSdkUrl("/data/clt/detail/" + sourceId); + return HttpUtil.doGet(url); + } + + /** + * 获取 MBTiles 类型资源详情 + */ + public String fetchMbtilesDetail(String sourceId) { + String url = buildSdkUrl("/data/mbtiles/detail/" + sourceId); + return HttpUtil.doGet(url); + } + + /** + * 获取 PAK 类型资源详情 + */ + public String fetchPakDetail(String sourceId) { + String url = buildSdkUrl("/data/pak/detail/" + sourceId); + return HttpUtil.doGet(url); + } + } diff --git a/src/main/java/com/yj/earth/dto/roleMenu/UpdateMenuDto.java b/src/main/java/com/yj/earth/dto/roleMenu/UpdateMenuDto.java index 844fbce..a182c2c 100644 --- a/src/main/java/com/yj/earth/dto/roleMenu/UpdateMenuDto.java +++ b/src/main/java/com/yj/earth/dto/roleMenu/UpdateMenuDto.java @@ -3,14 +3,13 @@ package com.yj.earth.dto.roleMenu; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import java.util.List; +import java.util.Map; + @Data public class UpdateMenuDto { - @Schema(description = "主键") - private String id; @Schema(description = "角色ID") private String roleId; - @Schema(description = "菜单") - private String menu; - @Schema(description = "权限") - private String permission; + @Schema(description = "权限列表") + private List>> permissionList; } diff --git a/src/main/java/com/yj/earth/dto/roleOperate/UpdateRoleOperateDto.java b/src/main/java/com/yj/earth/dto/roleOperate/UpdateRoleOperateDto.java index 9c84924..6e36b34 100644 --- a/src/main/java/com/yj/earth/dto/roleOperate/UpdateRoleOperateDto.java +++ b/src/main/java/com/yj/earth/dto/roleOperate/UpdateRoleOperateDto.java @@ -3,12 +3,12 @@ package com.yj.earth.dto.roleOperate; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import java.util.List; + @Data public class UpdateRoleOperateDto { - @Schema(description = "主键") - private String id; @Schema(description = "角色ID") private String roleId; @Schema(description = "操作") - private String operate; + private List operateList; } diff --git a/src/main/java/com/yj/earth/dto/tsSource/AddTsModelSourceDto.java b/src/main/java/com/yj/earth/dto/tsSource/AddTsModelSourceDto.java new file mode 100644 index 0000000..7774b2c --- /dev/null +++ b/src/main/java/com/yj/earth/dto/tsSource/AddTsModelSourceDto.java @@ -0,0 +1,22 @@ +package com.yj.earth.dto.tsSource; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.Map; + +@Data +public class AddTsModelSourceDto { + @Schema(description = "态势方案ID") + private String planId; + @Schema(description = "资源ID") + private String id; + @Schema(description = "资源路径") + private String sourcePath; + @Schema(description = "父节点ID") + private String parentId; + @Schema(description = "树状索引") + private Integer treeIndex; + @Schema(description = "前端参数") + private Map params; +} diff --git a/src/main/java/com/yj/earth/params/ArcgisBlueImagery.java b/src/main/java/com/yj/earth/params/ArcgisBlueImagery.java new file mode 100644 index 0000000..b603e39 --- /dev/null +++ b/src/main/java/com/yj/earth/params/ArcgisBlueImagery.java @@ -0,0 +1,15 @@ +package com.yj.earth.params; + +import com.yj.earth.annotation.SourceType; +import lombok.Data; + +@Data +@SourceType("arcgisBlueImagery") +public class ArcgisBlueImagery { + private String id; + private String name; + private Boolean show; + private Integer alpha; + private Integer brightness; + private Integer layerIndex; +} diff --git a/src/main/java/com/yj/earth/params/ArcgisWximagery.java b/src/main/java/com/yj/earth/params/ArcgisWximagery.java new file mode 100644 index 0000000..c85ecd7 --- /dev/null +++ b/src/main/java/com/yj/earth/params/ArcgisWximagery.java @@ -0,0 +1,15 @@ +package com.yj.earth.params; + +import com.yj.earth.annotation.SourceType; +import lombok.Data; + +@Data +@SourceType("arcgisWximagery") +public class ArcgisWximagery { + private String id; + private String name; + private Boolean show; + private Integer alpha; + private Integer brightness; + private Integer layerIndex; +} diff --git a/src/main/java/com/yj/earth/params/GdlwImagery.java b/src/main/java/com/yj/earth/params/GdlwImagery.java new file mode 100644 index 0000000..b9e7eb5 --- /dev/null +++ b/src/main/java/com/yj/earth/params/GdlwImagery.java @@ -0,0 +1,15 @@ +package com.yj.earth.params; + +import com.yj.earth.annotation.SourceType; +import lombok.Data; + +@Data +@SourceType("gdlwImagery") +public class GdlwImagery { + private String id; + private String name; + private Boolean show; + private Integer alpha; + private Integer brightness; + private Integer layerIndex; +} diff --git a/src/main/java/com/yj/earth/params/GdslImagery.java b/src/main/java/com/yj/earth/params/GdslImagery.java new file mode 100644 index 0000000..114c9cd --- /dev/null +++ b/src/main/java/com/yj/earth/params/GdslImagery.java @@ -0,0 +1,15 @@ +package com.yj.earth.params; + +import com.yj.earth.annotation.SourceType; +import lombok.Data; + +@Data +@SourceType("gdslImagery") +public class GdslImagery { + private String id; + private String name; + private Boolean show; + private Integer alpha; + private Integer brightness; + private Integer layerIndex; +} diff --git a/src/main/java/com/yj/earth/params/Sector.java b/src/main/java/com/yj/earth/params/Sector.java new file mode 100644 index 0000000..4021b3b --- /dev/null +++ b/src/main/java/com/yj/earth/params/Sector.java @@ -0,0 +1,76 @@ +package com.yj.earth.params; + +import com.yj.earth.annotation.SourceType; +import lombok.Data; + +import java.util.List; +import java.util.Map; + +@Data +@SourceType("sector") +public class Sector { + private String id; + private String name; + private Center center; + private double radius; + private double startAngle; + private double endAngle; + private boolean show; + private String color; + private int heightMode; + private int semiMinorAxis; + private int semiMajorAxis; + private Line line; + private Label label; + private Attribute attribute; + private String richTextContent; + private Map customView; + + @Data + public static class Center { + private double lng; + private double lat; + private double alt; + } + + @Data + public static class Line { + private int width; + private String color; + } + + @Data + public static class Label { + private String text; + private boolean show; + private Position position; + private int fontSize; + private int fontFamily; + private String color; + private int lineWidth; + private int pixelOffset; + private List backgroundColor; + private String lineColor; + private boolean scaleByDistance; + private int near; + private int far; + private boolean ground; + + @Data + public static class Position { + private double lng; + private double lat; + private double alt; + } + } + + @Data + public static class Attribute { + private Link link; + } + + @Data + public static class Link { + private List content; + } +} diff --git a/src/main/java/com/yj/earth/word/GenerateDocx.java b/src/main/java/com/yj/earth/word/GenerateDocx.java new file mode 100644 index 0000000..43bccdc --- /dev/null +++ b/src/main/java/com/yj/earth/word/GenerateDocx.java @@ -0,0 +1,104 @@ +package com.yj.earth.word; + +import org.apache.poi.xwpf.usermodel.*; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTShd; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.STShd; + +import java.io.FileOutputStream; +import java.io.IOException; + +public class GenerateDocx { + public static void main(String[] args) { + // 创建文档对象 + XWPFDocument document = new XWPFDocument(); + + try { + // 添加标题段落 + XWPFParagraph titlePara = document.createParagraph(); + titlePara.setAlignment(ParagraphAlignment.CENTER); + XWPFRun titleRun = titlePara.createRun(); + titleRun.setText("POI 生成 Docx 示例"); + // 字体大小 + titleRun.setFontSize(20); + // 加粗 + titleRun.setBold(true); + // 字体 + titleRun.setFontFamily("宋体"); + + // 添加正文段落 + XWPFParagraph contentPara1 = document.createParagraph(); + contentPara1.setAlignment(ParagraphAlignment.LEFT); + XWPFRun run1 = contentPara1.createRun(); + run1.setText("这是使用 Apache POI 生成的 docx 文档。"); + run1.setFontSize(12); + run1.setFontFamily("微软雅黑"); + + // 换行 + XWPFParagraph contentPara2 = document.createParagraph(); + XWPFRun run2 = contentPara2.createRun(); + run2.setText("支持设置文本样式,如:"); + run2.setFontSize(12); + + // 文本样式示例(同一行不同样式) + XWPFRun run3 = contentPara2.createRun(); + run3.setText(" 加粗 "); + run3.setBold(true); + + XWPFRun run4 = contentPara2.createRun(); + run4.setText(" 斜体 "); + run4.setItalic(true); + + XWPFRun run5 = contentPara2.createRun(); + run5.setText(" 下划线 "); + run5.setUnderline(UnderlinePatterns.SINGLE); // 单下划线 + + XWPFRun run6 = contentPara2.createRun(); + run6.setText(" 红色 "); + run6.setColor("FF0000"); // 红色 + + // 添加表格 + int rows = 3; // 3行 + int cols = 3; // 3列 + XWPFTable table = document.createTable(rows, cols); + table.setWidth("100%"); // 表格宽度 + + // 设置表头 + XWPFTableRow headerRow = table.getRow(0); + headerRow.getCell(0).setText("ID"); + headerRow.getCell(1).setText("名称"); + headerRow.getCell(2).setText("描述"); + // 表头背景色(浅灰色) + for (XWPFTableCell cell : headerRow.getTableCells()) { + CTShd cTShd = cell.getCTTc().addNewTcPr().addNewShd(); + cTShd.setVal(STShd.CLEAR); + cTShd.setFill("D9D9D9"); // 浅灰色 + } + + // 设置表格内容 + XWPFTableRow row1 = table.getRow(1); + row1.getCell(0).setText("1"); + row1.getCell(1).setText("POI"); + row1.getCell(2).setText("处理 Office 文档的 Java 库"); + + XWPFTableRow row2 = table.getRow(2); + row2.getCell(0).setText("2"); + row2.getCell(1).setText("Docx"); + row2.getCell(2).setText("Word 2007+ 格式"); + + // 保存文档到本地 + FileOutputStream out = new FileOutputStream("poi-demo.docx"); + document.write(out); + out.close(); + System.out.println("docx 生成成功!"); + + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + document.close(); // 关闭文档,释放资源 + } catch (IOException e) { + e.printStackTrace(); + } + } + } +}