吉安感知网项目-后端
rain
2026-01-31 d71974c74d885eb44bfacf186345f4762c7f9158
优化部分私有类注释

Signed-off-by: rain <1679827795@qq.com>
2 files modified
101 ■■■■■ changed files
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdManageDeviceServiceImpl.java 59 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdPatrolTaskServiceImpl.java 42 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdManageDeviceServiceImpl.java
@@ -113,6 +113,11 @@
        return total;
    }
    /**
     * 同步星图无人机设备并入库
     *
     * @return 新增或更新数量
     */
    private int syncPilotDevices() throws Exception {
        R response = jianXingtuApiService.getDevicePilotList(null);
        List<GdXingtuPilotListDTO> items = parseList(response, GdXingtuPilotListDTO.class);
@@ -132,6 +137,11 @@
        return count;
    }
    /**
     * 同步星图机巢设备并入库
     *
     * @return 新增或更新数量
     */
    private int syncAirportDevices() throws Exception {
        R response = jianXingtuApiService.getDeviceAirportList(null);
        List<GdXingtuAirportListDTO> items = parseList(response, GdXingtuAirportListDTO.class);
@@ -151,6 +161,12 @@
        return count;
    }
    /**
     * 按机场ID保存或更新设备信息
     *
     * @param entity 设备信息
     * @return 是否保存成功
     */
    private boolean saveOrUpdateByAirportId(GdManageDeviceEntity entity) throws Exception {
        if (StringUtil.isBlank(entity.getAirportId())) {
            return false;
@@ -173,6 +189,12 @@
        return saveOrUpdateDevice(entity);
    }
    /**
     * 从星图无人机数据构建设备实体
     *
     * @param item 星图无人机数据
     * @return 设备实体
     */
    private GdManageDeviceEntity buildFromPilot(GdXingtuPilotListDTO item) {
        if (item == null) {
            return null;
@@ -192,6 +214,12 @@
        return entity;
    }
    /**
     * 从星图机巢数据构建设备实体
     *
     * @param item 星图机巢数据
     * @return 设备实体
     */
    private GdManageDeviceEntity buildFromAirport(GdXingtuAirportListDTO item) {
        if (item == null) {
            return null;
@@ -212,6 +240,12 @@
        return entity;
    }
    /**
     * 将设备在线状态转换为模式码
     *
     * @param status 状态文本
     * @return 模式码
     */
    private Long parseModeCode(String status) {
        if ("在线".equals(status)) {
            return 0L;
@@ -222,6 +256,12 @@
        return null;
    }
    /**
     * 安全解析字符串为 Double
     *
     * @param value 字符串值
     * @return Double 或 null
     */
    private Double parseDouble(String value) {
        if (StringUtil.isBlank(value)) {
            return null;
@@ -233,6 +273,12 @@
        }
    }
    /**
     * 提取区域编码中的末级编码
     *
     * @param regionCode 区域编码
     * @return 末级区域编码
     */
    private String extractAreaCode(String regionCode) {
        if (StringUtil.isBlank(regionCode)) {
            return null;
@@ -249,6 +295,12 @@
        return regionCode;
    }
    /**
     * 解析保险信息并获取最新保险日期
     *
     * @param insuranceInfo 保险信息JSON
     * @return 保险日期
     */
    private Date parseInsuranceDate(String insuranceInfo) {
        if (StringUtil.isBlank(insuranceInfo)) {
            return null;
@@ -282,6 +334,13 @@
        }
    }
    /**
     * 解析星图接口返回的列表数据
     *
     * @param response 接口响应
     * @param clazz    目标类型
     * @return 列表数据
     */
    private <T> List<T> parseList(R response, Class<T> clazz) {
        if (response == null || !response.isSuccess() || response.getData() == null) {
            return Collections.emptyList();
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdPatrolTaskServiceImpl.java
@@ -486,6 +486,12 @@
        return baseDesc + newStatus.getDesc();
    }
    /**
     * 根据部门ID获取部门名称
     *
     * @param deptId 部门ID
     * @return 部门名称,缺失时返回"/"
     */
    private String getDeptName(Long deptId) {
        if (deptId == null) {
            return "/";
@@ -498,6 +504,12 @@
        return dept.getDeptName();
    }
    /**
     * 根据用户ID获取用户姓名
     *
     * @param userId 用户ID
     * @return 用户姓名,缺失时返回"/"
     */
    private String getUserName(Long userId) {
        if (userId == null) {
            return "/";
@@ -514,6 +526,13 @@
        return StringUtil.isBlank(realName) ? "/" : realName;
    }
    /**
     * 上传巡查报告并保存附件信息
     *
     * @param reportFile 报告文件
     * @param taskEntity 巡查任务
     * @return 是否保存成功
     */
    private boolean saveAttachFile(File reportFile, GdPatrolTaskEntity taskEntity) throws IOException {
        if (reportFile == null || !reportFile.exists()) {
            throw new RuntimeException("巡查报告文件不存在");
@@ -537,6 +556,16 @@
        return true;
    }
    /**
     * 构建附件元数据
     *
     * @param taskEntity  巡查任务
     * @param reportFile  报告文件
     * @param bladeFile   文件上传结果
     * @param resultType  结果类型
     * @param desiredName 期望文件名
     * @return 附件信息
     */
    private Attach buildAttachInfo(GdPatrolTaskEntity taskEntity, File reportFile, BladeFile bladeFile, Integer resultType, String desiredName) {
        Attach attach = new Attach();
        attach.setDomainUrl(bladeFile.getDomain());
@@ -568,6 +597,13 @@
        return attach;
    }
    /**
     * 生成报告附件名称
     *
     * @param taskEntity   巡查任务
     * @param fallbackName 兜底文件名
     * @return 附件名称
     */
    private String buildReportAttachName(GdPatrolTaskEntity taskEntity, String fallbackName) {
        String taskNo = taskEntity != null ? taskEntity.getTaskNo() : null;
        if (StringUtil.isBlank(taskNo)) {
@@ -576,6 +612,12 @@
        return taskNo + ".docx";
    }
    /**
     * 解析巡查任务类型为结果类型
     *
     * @param patrolTaskType 巡查任务类型
     * @return 结果类型
     */
    private Integer parseResultType(String patrolTaskType) {
        if (StringUtil.isBlank(patrolTaskType)) {
            return null;