吉安感知网项目-后端
linwei
2026-02-05 0f7b8894b4aee83083518c3c4698fa24fa65b0d2
工单负载接口
2 files modified
11 files added
757 ■■■■■ changed files
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/controller/GdManageDevicePayloadController.java 137 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/dto/GdManageDevicePayloadDTO.java 34 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/dto/GdXingtuPayloadListDTO.java 23 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/dto/GdXingtuPilotListDTO.java 4 ●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/entity/GdManageDevicePayloadEntity.java 64 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/excel/GdManageDevicePayloadExcel.java 80 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDevicePayloadMapper.java 52 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDevicePayloadMapper.xml 37 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/IGdManageDevicePayloadService.java 52 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdManageDevicePayloadServiceImpl.java 54 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdManageDeviceServiceImpl.java 120 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/vo/GdManageDevicePayloadVO.java 50 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/wrapper/GdManageDevicePayloadWrapper.java 50 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/controller/GdManageDevicePayloadController.java
New file
@@ -0,0 +1,137 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.gd.workorder.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import org.sxkj.gd.workorder.vo.GdManageDevicePayloadVO;
import org.sxkj.gd.workorder.service.IGdManageDevicePayloadService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.List;
/**
 * 负载设备表 控制器
 *
 * @author lw
 * @since 2026-02-05
 */
@RestController
@AllArgsConstructor
@RequestMapping("workorder/gdManageDevicePayload")
@Api(value = "负载设备表", tags = "负载设备表接口")
public class GdManageDevicePayloadController extends BladeController {
    private final IGdManageDevicePayloadService gdManageDevicePayloadService;
    /**
     * 负载设备表 详情
     */
    // @GetMapping("/detail")
    // @ApiOperationSupport(order = 1)
    // @ApiOperation(value = "详情", notes = "传入gdManageDevicePayload")
    // public R<GdManageDevicePayloadVO> detail(GdManageDevicePayloadEntity gdManageDevicePayload) {
    //     GdManageDevicePayloadEntity detail = gdManageDevicePayloadService.getOne(Condition.getQueryWrapper(gdManageDevicePayload));
    //     return R.data(GdManageDevicePayloadWrapper.build().entityVO(detail));
    // }
    /**
     * 负载设备表 分页
     */
    // @GetMapping("/list")
    // @ApiOperationSupport(order = 2)
    // @ApiOperation(value = "分页", notes = "传入gdManageDevicePayload")
    // public R<IPage<GdManageDevicePayloadVO>> list(@ApiIgnore @RequestParam Map<String, Object> gdManageDevicePayload, Query query) {
    //     IPage<GdManageDevicePayloadEntity> pages = gdManageDevicePayloadService.page(Condition.getPage(query), Condition.getQueryWrapper(gdManageDevicePayload, GdManageDevicePayloadEntity.class));
    //     return R.data(GdManageDevicePayloadWrapper.build().pageVO(pages));
    // }
    /**
     * 负载设备表 自定义分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入gdManageDevicePayload")
    public R<List<GdManageDevicePayloadVO>> list(GdManageDevicePayloadVO gdManageDevicePayload, Query query) {
        List<GdManageDevicePayloadVO> lists = gdManageDevicePayloadService.selectGdManageDevicePayloadList();
        return R.data(lists);
    }
    /**
     * 负载设备表 新增
     */
    // @PostMapping("/save")
    // @ApiOperationSupport(order = 4)
    // @ApiOperation(value = "新增", notes = "传入gdManageDevicePayload")
    // public R save(@Valid @RequestBody GdManageDevicePayloadEntity gdManageDevicePayload) {
    //     return R.status(gdManageDevicePayloadService.save(gdManageDevicePayload));
    // }
    /**
     * 负载设备表 修改
     */
    // @PostMapping("/update")
    // @ApiOperationSupport(order = 5)
    // @ApiOperation(value = "修改", notes = "传入gdManageDevicePayload")
    // public R update(@Valid @RequestBody GdManageDevicePayloadEntity gdManageDevicePayload) {
    //     return R.status(gdManageDevicePayloadService.updateById(gdManageDevicePayload));
    // }
    /**
     * 负载设备表 新增或修改
     */
    // @PostMapping("/submit")
    // @ApiOperationSupport(order = 6)
    // @ApiOperation(value = "新增或修改", notes = "传入gdManageDevicePayload")
    // public R submit(@Valid @RequestBody GdManageDevicePayloadEntity gdManageDevicePayload) {
    //     return R.status(gdManageDevicePayloadService.saveOrUpdate(gdManageDevicePayload));
    // }
    /**
     * 负载设备表 删除
     */
    // @PostMapping("/remove")
    // @ApiOperationSupport(order = 7)
    // @ApiOperation(value = "逻辑删除", notes = "传入ids")
    // public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
    //     return R.status(gdManageDevicePayloadService.deleteLogic(Func.toLongList(ids)));
    // }
    /**
     * 导出数据
     */
    // @GetMapping("/export-gdManageDevicePayload")
    // @ApiOperationSupport(order = 9)
    // @ApiOperation(value = "导出数据", notes = "传入gdManageDevicePayload")
    // public void exportGdManageDevicePayload(@ApiIgnore @RequestParam Map<String, Object> gdManageDevicePayload, BladeUser bladeUser, HttpServletResponse response) {
    //     QueryWrapper<GdManageDevicePayloadEntity> queryWrapper = Condition.getQueryWrapper(gdManageDevicePayload, GdManageDevicePayloadEntity.class);
    //     //if (!AuthUtil.isAdministrator()) {
    //     //    queryWrapper.lambda().eq(GdManageDevicePayload::getTenantId, bladeUser.getTenantId());
    //     //}
    //     queryWrapper.lambda().eq(GdManageDevicePayloadEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
    //     List<GdManageDevicePayloadExcel> list = gdManageDevicePayloadService.exportGdManageDevicePayload(queryWrapper);
    //     ExcelUtil.export(response, "负载设备表数据" + DateUtil.time(), "负载设备表数据表", list, GdManageDevicePayloadExcel.class);
    // }
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/dto/GdManageDevicePayloadDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.gd.workorder.dto;
import org.sxkj.gd.workorder.entity.GdManageDevicePayloadEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 负载设备表 数据传输对象实体类
 *
 * @author lw
 * @since 2026-02-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class GdManageDevicePayloadDTO extends GdManageDevicePayloadEntity {
    private static final long serialVersionUID = 1L;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/dto/GdXingtuPayloadListDTO.java
New file
@@ -0,0 +1,23 @@
package org.sxkj.gd.workorder.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GdXingtuPayloadListDTO {
    @ApiModelProperty("id")
    private String id;
    @ApiModelProperty("负载名称")
    private String name;
    @ApiModelProperty("负载类型")
    private String type;
    @ApiModelProperty("负载序列号")
    private String snCode;
    @ApiModelProperty("设备序列号")
    private String pilotSnCode;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/dto/GdXingtuPilotListDTO.java
@@ -20,6 +20,7 @@
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
 * 星图接口-设备列表(无人机)数据对象
@@ -83,6 +84,9 @@
    @ApiModelProperty("负载类型")
    private String loadType;
    @ApiModelProperty("负载设备集合")
    private List<GdXingtuPayloadListDTO> loadList;
    @ApiModelProperty("是否喷涂")
    private Integer isPainting;
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/entity/GdManageDevicePayloadEntity.java
New file
@@ -0,0 +1,64 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.gd.workorder.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
/**
 * 负载设备表 实体类
 *
 * @author lw
 * @since 2026-02-05
 */
@Data
@TableName(value = "ja_gd_manage_device_payload" )
@ApiModel(value = "GdManageDevicePayload对象", description = "负载设备表")
@EqualsAndHashCode(callSuper = true)
public class GdManageDevicePayloadEntity extends BaseEntity {
    /**
     * 负载名称
     */
    @ApiModelProperty(value = "负载名称")
    private String name;
    /**
     * 负载类型
     */
    @ApiModelProperty(value = "负载类型")
    private String type;
    /**
     * 负载序列号
     */
    @ApiModelProperty(value = "负载序列号")
    private String snCode;
    /**
     * 飞行员序列号
     */
    @ApiModelProperty(value = "飞行员序列号")
    private String pilotSnCode;
    /**
     * 区域编码
     */
    @ApiModelProperty(value = "区域编码")
    private String areaCode;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/excel/GdManageDevicePayloadExcel.java
New file
@@ -0,0 +1,80 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.gd.workorder.excel;
import lombok.Data;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import java.io.Serializable;
/**
 * 负载设备表 Excel实体类
 *
 * @author lw
 * @since 2026-02-05
 */
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class GdManageDevicePayloadExcel implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 负载名称
     */
    @ColumnWidth(20)
    @ExcelProperty("负载名称")
    private String name;
    /**
     * 负载类型
     */
    @ColumnWidth(20)
    @ExcelProperty("负载类型")
    private String type;
    /**
     * 负载序列号
     */
    @ColumnWidth(20)
    @ExcelProperty("负载序列号")
    private String snCode;
    /**
     * 飞行员序列号
     */
    @ColumnWidth(20)
    @ExcelProperty("飞行员序列号")
    private String pilotSnCode;
    /**
     * 区域编码
     */
    @ColumnWidth(20)
    @ExcelProperty("区域编码")
    private String areaCode;
    /**
     * 删除标志(0存在 1删除)
     */
    @ColumnWidth(20)
    @ExcelProperty("删除标志(0存在 1删除)")
    private Byte isDeleted;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDevicePayloadMapper.java
New file
@@ -0,0 +1,52 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.gd.workorder.mapper;
import org.sxkj.gd.workorder.entity.GdManageDevicePayloadEntity;
import org.sxkj.gd.workorder.vo.GdManageDevicePayloadVO;
import org.sxkj.gd.workorder.excel.GdManageDevicePayloadExcel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * 负载设备表 Mapper 接口
 *
 * @author lw
 * @since 2026-02-05
 */
public interface GdManageDevicePayloadMapper extends BaseMapper<GdManageDevicePayloadEntity> {
    /**
     * 自定义分页
     *
     * @return
     */
    List<GdManageDevicePayloadVO> selectGdManageDevicePayloadPage();
    /**
     * 获取导出数据
     *
     * @param queryWrapper
     * @return
     */
    List<GdManageDevicePayloadExcel> exportGdManageDevicePayload(@Param("ew") Wrapper<GdManageDevicePayloadEntity> queryWrapper);
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDevicePayloadMapper.xml
New file
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.sxkj.gd.workorder.mapper.GdManageDevicePayloadMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="gdManageDevicePayloadResultMap" type="org.sxkj.gd.workorder.entity.GdManageDevicePayloadEntity">
        <result column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="type" property="type"/>
        <result column="sn_code" property="snCode"/>
        <result column="pilot_sn_code" property="pilotSnCode"/>
        <result column="area_code" property="areaCode"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
    <select id="selectGdManageDevicePayloadPage" resultMap="gdManageDevicePayloadResultMap">
        select
            *
        from
            ja_gd_manage_device_payload
        where is_deleted = 0
        group by name
    </select>
    <select id="exportGdManageDevicePayload" resultType="org.sxkj.gd.workorder.excel.GdManageDevicePayloadExcel">
        SELECT * FROM ja_gd_manage_device_payload ${ew.customSqlSegment}
    </select>
</mapper>
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/IGdManageDevicePayloadService.java
New file
@@ -0,0 +1,52 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.gd.workorder.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.sxkj.gd.workorder.entity.GdManageDevicePayloadEntity;
import org.sxkj.gd.workorder.vo.GdManageDevicePayloadVO;
import org.sxkj.gd.workorder.excel.GdManageDevicePayloadExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
 * 负载设备表 服务类
 *
 * @author lw
 * @since 2026-02-05
 */
public interface IGdManageDevicePayloadService extends BaseService<GdManageDevicePayloadEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param gdManageDevicePayload
     * @return
     */
    List<GdManageDevicePayloadVO> selectGdManageDevicePayloadList();
    /**
     * 导出数据
     *
     * @param queryWrapper
     * @return
     */
    List<GdManageDevicePayloadExcel> exportGdManageDevicePayload(Wrapper<GdManageDevicePayloadEntity> queryWrapper);
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdManageDevicePayloadServiceImpl.java
New file
@@ -0,0 +1,54 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.gd.workorder.service.impl;
import org.sxkj.gd.workorder.entity.GdManageDevicePayloadEntity;
import org.sxkj.gd.workorder.vo.GdManageDevicePayloadVO;
import org.sxkj.gd.workorder.excel.GdManageDevicePayloadExcel;
import org.sxkj.gd.workorder.mapper.GdManageDevicePayloadMapper;
import org.sxkj.gd.workorder.service.IGdManageDevicePayloadService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import java.util.List;
/**
 * 负载设备表 服务实现类
 *
 * @author lw
 * @since 2026-02-05
 */
@Service
public class GdManageDevicePayloadServiceImpl extends BaseServiceImpl<GdManageDevicePayloadMapper, GdManageDevicePayloadEntity> implements IGdManageDevicePayloadService {
    @Override
    public List<GdManageDevicePayloadVO> selectGdManageDevicePayloadList() {
        return  baseMapper.selectGdManageDevicePayloadPage();
    }
    @Override
    public List<GdManageDevicePayloadExcel> exportGdManageDevicePayload(Wrapper<GdManageDevicePayloadEntity> queryWrapper) {
        List<GdManageDevicePayloadExcel> gdManageDevicePayloadList = baseMapper.exportGdManageDevicePayload(queryWrapper);
        //gdManageDevicePayloadList.forEach(gdManageDevicePayload -> {
        //    gdManageDevicePayload.setTypeName(DictCache.getValue(DictEnum.YES_NO, GdManageDevicePayload.getType()));
        //});
        return gdManageDevicePayloadList;
    }
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdManageDeviceServiceImpl.java
@@ -24,9 +24,12 @@
import org.sxkj.gd.utils.GdGeoAddressUtil;
import org.sxkj.gd.utils.GeomUtils;
import org.sxkj.gd.workorder.dto.GdXingtuAirportListDTO;
import org.sxkj.gd.workorder.dto.GdXingtuPayloadListDTO;
import org.sxkj.gd.workorder.dto.GdXingtuPilotListDTO;
import org.sxkj.gd.workorder.entity.GdManageDeviceEntity;
import org.sxkj.gd.workorder.entity.GdManageDevicePayloadEntity;
import org.sxkj.gd.workorder.param.GdManageDevicePageParam;
import org.sxkj.gd.workorder.service.IGdManageDevicePayloadService;
import org.sxkj.gd.workorder.vo.GdManageDeviceVO;
import org.sxkj.gd.workorder.excel.GdManageDeviceExcel;
import org.sxkj.gd.workorder.mapper.GdManageDeviceMapper;
@@ -41,9 +44,8 @@
import org.springblade.core.tool.utils.StringUtil;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
 * 设备信息 服务实现类
@@ -57,6 +59,7 @@
public class GdManageDeviceServiceImpl extends BaseServiceImpl<GdManageDeviceMapper, GdManageDeviceEntity> implements IGdManageDeviceService {
    private final JianXingtuApiService jianXingtuApiService;
    private final IGdManageDevicePayloadService iGdManageDevicePayloadService;
    @Override
    public IPage<GdManageDeviceVO> selectGdManageDevicePage(IPage<GdManageDeviceVO> page, GdManageDevicePageParam gdManageDevice) {
@@ -109,7 +112,7 @@
        total += syncAirportDevices();
        // 1.同步无人机设备
        total += syncPilotDevices();
        log.info("更新或新增设备"+total);
        log.info("更新或新增设备" + total);
        return total;
    }
@@ -131,6 +134,9 @@
                continue;
            }
            if (saveOrUpdateByAirportId(entity)) {
                // 同步负载设备
                List<GdXingtuPayloadListDTO> loadList = item.getLoadList();
                syncPayloadDevices(loadList);
                count++;
            }
        }
@@ -159,6 +165,102 @@
            }
        }
        return count;
    }
    /**
     * 同步负载设备
     *
     * @param loadList 负载设备列表
     */
    private void syncPayloadDevices(List<GdXingtuPayloadListDTO> loadList) throws Exception {
        // 1. 收集所有负载设备的飞行员序列号,用于后续查询和删除操作
        Set<String> allPilotSnCodes = new HashSet<>();
        if (loadList != null && !loadList.isEmpty()) {
            for (GdXingtuPayloadListDTO load : loadList) {
                if (load.getPilotSnCode() != null) {
                    allPilotSnCodes.add(load.getPilotSnCode());
                }
            }
        }
        // 2. 获取当前数据库中这些飞行员序列号对应的所有负载设备
        List<GdManageDevicePayloadEntity> existingPayloads = new ArrayList<>();
        if (!allPilotSnCodes.isEmpty()) {
            existingPayloads = iGdManageDevicePayloadService.list(
                Wrappers.<GdManageDevicePayloadEntity>lambdaQuery().in(GdManageDevicePayloadEntity::getPilotSnCode, allPilotSnCodes)
            );
        }
        // 3. 创建现有负载设备的序列号映射,用于快速查找
        Map<String, GdManageDevicePayloadEntity> existingPayloadMap = new HashMap<>();
        for (GdManageDevicePayloadEntity payload : existingPayloads) {
            if (payload.getPilotSnCode() != null && payload.getSnCode() != null) {
                existingPayloadMap.put(payload.getPilotSnCode() + "_" + payload.getSnCode() + "_" + payload.getName(), payload);
            }
        }
        // 4. 处理负载设备列表
        if (loadList != null && !loadList.isEmpty()) {
            List<GdManageDevicePayloadEntity> toSaveOrUpdate = new ArrayList<>();
            Set<String> currentPayloadKeys = new HashSet<>();
            // 对负载设备列表进行去重处理,确保每个负载设备只被处理一次
            Map<String, GdXingtuPayloadListDTO> uniqueLoadMap = new HashMap<>();
            for (GdXingtuPayloadListDTO load : loadList) {
                if (load.getSnCode() != null && load.getPilotSnCode() != null) {
                    String payloadKey = load.getPilotSnCode() + "_" + load.getSnCode() + "_" + load.getName();
                    uniqueLoadMap.put(payloadKey, load);
                }
            }
            // 处理去重后的负载设备列表
            for (GdXingtuPayloadListDTO load : uniqueLoadMap.values()) {
                String snCode = load.getSnCode();
                String pilotSnCode1 = load.getPilotSnCode();
                String name = load.getName();
                String payloadKey = pilotSnCode1 + "_" + snCode + "_" + name;
                currentPayloadKeys.add(payloadKey);
                // 检查是否已存在
                GdManageDevicePayloadEntity existing = existingPayloadMap.remove(payloadKey);
                if (existing != null) {
                    // 更新现有负载
                    existing.setName(load.getName());
                    existing.setType(load.getType());
                    toSaveOrUpdate.add(existing);
                } else {
                    // 新增负载
                    GdManageDevicePayloadEntity newPayload = new GdManageDevicePayloadEntity();
                    newPayload.setName(load.getName());
                    newPayload.setType(load.getType());
                    newPayload.setSnCode(snCode);
                    newPayload.setPilotSnCode(pilotSnCode1);
                    // 可以根据需要设置区域编码等其他字段
                    toSaveOrUpdate.add(newPayload);
                }
            }
            // 4. 批量保存或更新负载设备
            if (!toSaveOrUpdate.isEmpty()) {
                iGdManageDevicePayloadService.saveOrUpdateBatch(toSaveOrUpdate);
            }
            // 5. 删除数据库中存在但负载列表中不存在的负载设备
            if (!existingPayloadMap.isEmpty()) {
                List<Long> toDeleteIds = existingPayloadMap.values().stream()
                    .map(GdManageDevicePayloadEntity::getId)
                    .collect(Collectors.toList());
                iGdManageDevicePayloadService.removeByIds(toDeleteIds);
            }
        } else {
            // 如果负载列表为空,删除该飞行员序列号对应的所有负载设备
            if (!existingPayloads.isEmpty()) {
                List<Long> toDeleteIds = existingPayloads.stream()
                    .map(GdManageDevicePayloadEntity::getId)
                    .collect(Collectors.toList());
                iGdManageDevicePayloadService.removeByIds(toDeleteIds);
            }
        }
    }
    /**
@@ -222,6 +324,16 @@
        entity.setInsureExpiredTime(parseInsuranceDate(item.getInsuranceInfo()));
        entity.setAreaCode(extractAreaCode(item.getRegionCode()));
        entity.setIsWithDock(item.getIsWithDock());
        entity.setDevicePayload(
            Optional.ofNullable(item.getLoadList())
                .orElse(Collections.emptyList())
                .stream()
                .filter(Objects::nonNull)
                .map(load -> load.getName())
                .filter(Objects::nonNull)
                .collect(Collectors.joining(","))
        );
        return entity;
    }
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/vo/GdManageDevicePayloadVO.java
New file
@@ -0,0 +1,50 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.gd.workorder.vo;
import io.swagger.annotations.ApiModelProperty;
import org.sxkj.gd.workorder.entity.GdManageDevicePayloadEntity;
import org.springblade.core.tool.node.INode;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 负载设备表 视图实体类
 *
 * @author lw
 * @since 2026-02-05
 */
@Data
public class GdManageDevicePayloadVO {
    private static final long serialVersionUID = 1L;
    /**
     * 负载名称
     */
    @ApiModelProperty(value = "负载名称")
    private String name;
    /**
     * 负载类型
     */
    @ApiModelProperty(value = "负载类型")
    private String type;
    /**
     * 负载序列号
     */
    @ApiModelProperty(value = "负载序列号")
    private String snCode;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/wrapper/GdManageDevicePayloadWrapper.java
New file
@@ -0,0 +1,50 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.gd.workorder.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.sxkj.gd.workorder.entity.GdManageDevicePayloadEntity;
import org.sxkj.gd.workorder.vo.GdManageDevicePayloadVO;
import java.util.Objects;
/**
 * 负载设备表 包装类,返回视图层所需的字段
 *
 * @author lw
 * @since 2026-02-05
 */
public class GdManageDevicePayloadWrapper extends BaseEntityWrapper<GdManageDevicePayloadEntity, GdManageDevicePayloadVO>  {
    public static GdManageDevicePayloadWrapper build() {
        return new GdManageDevicePayloadWrapper();
     }
    @Override
    public GdManageDevicePayloadVO entityVO(GdManageDevicePayloadEntity gdManageDevicePayload) {
        GdManageDevicePayloadVO gdManageDevicePayloadVO = Objects.requireNonNull(BeanUtil.copy(gdManageDevicePayload, GdManageDevicePayloadVO.class));
        //User createUser = UserCache.getUser(gdManageDevicePayload.getCreateUser());
        //User updateUser = UserCache.getUser(gdManageDevicePayload.getUpdateUser());
        //gdManageDevicePayloadVO.setCreateUserName(createUser.getName());
        //gdManageDevicePayloadVO.setUpdateUserName(updateUser.getName());
        return gdManageDevicePayloadVO;
    }
}