吉安感知网项目-后端
linwei
2026-02-28 465580e3b8c4e26b4dd8f35524c0cd2fc87d9652
ai识别结果接口
13 files added
831 ■■■■■ changed files
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/controller/GdAiResultsController.java 119 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/dto/GdAiResultsDTO.java 108 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/entity/GdAiResultsEntity.java 67 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/excel/GdAiResultsExcel.java 78 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/mapper/GdAiResultsMapper.java 54 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/mapper/GdAiResultsMapper.xml 48 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/param/GdAiResultsAddParam.java 45 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/param/GdAiResultsPageParam.java 23 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/param/GdAiResultsParam.java 19 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/service/IGdAiResultsService.java 61 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/service/impl/GdAiResultsServiceImpl.java 90 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/vo/GdAiResultsVO.java 64 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/wrapper/GdAiResultsWrapper.java 55 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/controller/GdAiResultsController.java
New file
@@ -0,0 +1,119 @@
/*
 *      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.airesults.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.sxkj.gd.common.GenericConverter;
import org.sxkj.gd.airesults.entity.GdAiResultsEntity;
import org.sxkj.gd.airesults.param.GdAiResultsAddParam;
import org.sxkj.gd.airesults.param.GdAiResultsPageParam;
import org.sxkj.gd.airesults.param.GdAiResultsParam;
import org.sxkj.gd.airesults.vo.GdAiResultsVO;
import org.sxkj.gd.airesults.excel.GdAiResultsExcel;
import org.sxkj.gd.airesults.wrapper.GdAiResultsWrapper;
import org.sxkj.gd.airesults.service.IGdAiResultsService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.constant.BladeConstant;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
/**
 * AI成果表 控制器
 *
 * @author lw
 * @since 2026-02-28
 */
@RestController
@AllArgsConstructor
@RequestMapping("airesults/gdAiResults")
@Api(value = "AI成果表", tags = "AI成果表接口")
public class GdAiResultsController extends BladeController {
    private final IGdAiResultsService gdAiResultsService;
    /**
     * AI成果表 详情
     *
     * @param gdAiResults 查询参数
     * @return AI成果详情信息
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入gdAiResults")
    public R<GdAiResultsVO> detail(GdAiResultsParam gdAiResults) {
        GdAiResultsEntity detail = gdAiResultsService.getOne(Condition.getQueryWrapper(GenericConverter.convert(gdAiResults, GdAiResultsEntity.class)));
        return R.data(GdAiResultsWrapper.build().entityVO(detail));
    }
    /**
     * AI成果表 自定义分页
     *
     * @param gdAiResults 查询参数
     * @param query 分页参数
     * @return AI成果分页列表
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入gdAiResults")
    public R<IPage<GdAiResultsVO>> page(GdAiResultsPageParam gdAiResults, Query query) {
        IPage<GdAiResultsVO> pages = gdAiResultsService.selectGdAiResultsPage(Condition.getPage(query), gdAiResults);
        return R.data(pages);
    }
    /**
     * AI成果表 新增或修改
     *
     * @param gdAiResults 新增或修改参数
     * @return 操作结果
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入gdAiResults")
    public R submit(@Valid @RequestBody GdAiResultsAddParam gdAiResults) {
        return R.status(gdAiResultsService.saveOrUpdateAiResults(GenericConverter.convert(gdAiResults, GdAiResultsEntity.class)));
    }
    /**
     * AI成果表 删除
     *
     * @param ids 主键集合
     * @return 操作结果
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(gdAiResultsService.deleteLogic(Func.toLongList(ids)));
    }
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/dto/GdAiResultsDTO.java
New file
@@ -0,0 +1,108 @@
/*
 *      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.airesults.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
/**
 * AI成果表 数据传输对象实体类
 *
 * @author lw
 * @since 2026-02-28
 */
@Data
public class GdAiResultsDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty("主键id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * AI流请求key
     */
    @ApiModelProperty(value = "AI流请求key")
    private String aiReqKey;
    /**
     * 识别结果附件地址无框
     */
    @ApiModelProperty(value = "识别结果附件地址无框")
    private String orgAttUrl;
    /**
     * 识别框坐标点,格式:x1,y1,x2,y2,x3,y3,x4,y4
     */
    @ApiModelProperty(value = "识别框坐标点,格式:x1,y1,x2,y2,x3,y3,x4,y4")
    private List<String> points;
    /**
     * 区域编码
     */
    @ApiModelProperty(value = "区域编码")
    private String areaCode;
    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    private Long createUser;
    /**
     * 创建部门
     */
    @ApiModelProperty(value = "创建部门")
    private Long createDept;
    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    /**
     * 更新人
     */
    @ApiModelProperty(value = "更新人")
    private Long updateUser;
    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;
    /**
     * 状态(0正常 1停用)
     */
    @ApiModelProperty(value = "状态(0正常 1停用)")
    private Integer status;
    /**
     * 删除标志(0存在 1删除)
     */
    @ApiModelProperty(value = "删除标志(0存在 1删除)")
    private Integer isDeleted;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/entity/GdAiResultsEntity.java
New file
@@ -0,0 +1,67 @@
/*
 *      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.airesults.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.util.List;
/**
 * AI成果表 实体类
 *
 * @author lw
 * @since 2026-02-28
 */
@Data
@TableName(value = "ja_gd_ai_results", autoResultMap = true)
@ApiModel(value = "GdAiResults对象", description = "AI成果表")
@EqualsAndHashCode(callSuper = true)
public class GdAiResultsEntity extends BaseEntity {
    /**
     * AI流请求key
     */
    @ApiModelProperty(value = "AI流请求key")
    private String aiReqKey;
    /**
     * 识别结果附件地址无框
     */
    @ApiModelProperty(value = "识别结果附件地址无框")
    private String orgAttUrl;
    /**
     * 识别框坐标点,格式:x1,y1,x2,y2,x3,y3,x4,y4
     */
    @ApiModelProperty(value = "识别框坐标点,格式:x1,y1,x2,y2,x3,y3,x4,y4")
    // @TableField(typeHandler = JacksonTypeHandler.class)
    private String points;
    /**
     * 区域编码
     */
    @ApiModelProperty(value = "区域编码")
    private String areaCode;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/excel/GdAiResultsExcel.java
New file
@@ -0,0 +1,78 @@
/*
 *      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.airesults.excel;
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 lombok.Data;
import java.io.Serializable;
/**
 * AI成果表 Excel实体类
 *
 * @author lw
 * @since 2026-02-28
 */
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class GdAiResultsExcel implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * AI流请求key
     */
    @ColumnWidth(20)
    @ExcelProperty("AI流请求key")
    private String aiReqKey;
    /**
     * 识别结果附件地址无框
     */
    @ColumnWidth(30)
    @ExcelProperty("识别结果附件地址无框")
    private String orgAttUrl;
    /**
     * 区域编码
     */
    @ColumnWidth(20)
    @ExcelProperty("区域编码")
    private String areaCode;
    /**
     * 状态(0正常 1停用)
     */
    @ColumnWidth(20)
    @ExcelProperty("状态")
    private String status;
    /**
     * 删除标志(0存在 1删除)
     */
    @ColumnWidth(20)
    @ExcelProperty("删除标志")
    private Byte isDeleted;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/mapper/GdAiResultsMapper.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.airesults.mapper;
import org.sxkj.gd.airesults.entity.GdAiResultsEntity;
import org.sxkj.gd.airesults.param.GdAiResultsPageParam;
import org.sxkj.gd.airesults.vo.GdAiResultsVO;
import org.sxkj.gd.airesults.excel.GdAiResultsExcel;
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;
/**
 * AI成果表 Mapper 接口
 *
 * @author lw
 * @since 2026-02-28
 */
public interface GdAiResultsMapper extends BaseMapper<GdAiResultsEntity> {
    /**
     * 自定义分页查询
     *
     * @param page 分页对象
     * @param gdAiResults 查询参数
     * @return AI成果VO列表
     */
    List<GdAiResultsVO> selectGdAiResultsPage(IPage page, GdAiResultsPageParam gdAiResults);
    /**
     * 获取导出数据
     *
     * @param queryWrapper 查询条件
     * @return AI成果Excel列表
     */
    List<GdAiResultsExcel> exportGdAiResults(@Param("ew") Wrapper<GdAiResultsEntity> queryWrapper);
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/mapper/GdAiResultsMapper.xml
New file
@@ -0,0 +1,48 @@
<?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.airesults.mapper.GdAiResultsMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="gdAiResultsResultMap" type="org.sxkj.gd.airesults.entity.GdAiResultsEntity">
        <result column="id" property="id"/>
        <result column="ai_req_key" property="aiReqKey"/>
        <result column="org_att_url" property="orgAttUrl"/>
        <result column="points" property="points" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
        <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>
    <resultMap id="gdAiResultsVOResultMap" type="org.sxkj.gd.airesults.vo.GdAiResultsVO">
        <result column="id" property="id"/>
        <result column="ai_req_key" property="aiReqKey"/>
        <result column="org_att_url" property="orgAttUrl"/>
        <result column="points" property="points"/>
        <result column="area_code" property="areaCode"/>
    </resultMap>
    <select id="selectGdAiResultsPage" resultMap="gdAiResultsVOResultMap">
        select
            *
        from
            ja_gd_ai_results
        <where>
                is_deleted = 0
            <if test="param2.aiReqKey != null and param2.aiReqKey != ''">
                and ai_req_key = #{param2.aiReqKey}
            </if>
        </where>
    </select>
    <select id="exportGdAiResults" resultType="org.sxkj.gd.airesults.excel.GdAiResultsExcel">
        SELECT * FROM ja_gd_ai_results ${ew.customSqlSegment}
    </select>
</mapper>
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/param/GdAiResultsAddParam.java
New file
@@ -0,0 +1,45 @@
package org.sxkj.gd.airesults.param;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
 * AI成果表 新增/修改参数类
 *
 * @author lw
 * @since 2026-02-28
 */
@Data
public class GdAiResultsAddParam {
    @ApiModelProperty("主键id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * AI流请求key
     */
    @ApiModelProperty(value = "AI流请求key")
    private String aiReqKey;
    /**
     * 识别结果附件地址无框
     */
    @ApiModelProperty(value = "识别结果附件地址无框")
    private String orgAttUrl;
    /**
     * 识别框坐标点,格式:x1,y1,x2,y2,x3,y3,x4,y4
     */
    @ApiModelProperty(value = "识别框坐标点,格式:x1,y1,x2,y2,x3,y3,x4,y4")
    private List<String> points;
    /**
     * 区域编码
     */
    @ApiModelProperty(value = "区域编码")
    private String areaCode;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/param/GdAiResultsPageParam.java
New file
@@ -0,0 +1,23 @@
package org.sxkj.gd.airesults.param;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * AI成果表 分页查询参数类
 *
 * @author lw
 * @since 2026-02-28
 */
@Data
public class GdAiResultsPageParam {
    /**
     * AI流请求key
     */
    @ApiModelProperty(value = "AI流请求key")
    private String aiReqKey;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/param/GdAiResultsParam.java
New file
@@ -0,0 +1,19 @@
package org.sxkj.gd.airesults.param;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * AI成果表 查询参数类
 *
 * @author lw
 * @since 2026-02-28
 */
@Data
public class GdAiResultsParam {
    @ApiModelProperty("主键id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/service/IGdAiResultsService.java
New file
@@ -0,0 +1,61 @@
/*
 *      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.airesults.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.sxkj.gd.airesults.entity.GdAiResultsEntity;
import org.sxkj.gd.airesults.param.GdAiResultsPageParam;
import org.sxkj.gd.airesults.vo.GdAiResultsVO;
import org.sxkj.gd.airesults.excel.GdAiResultsExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
 * AI成果表 服务类
 *
 * @author lw
 * @since 2026-02-28
 */
public interface IGdAiResultsService extends BaseService<GdAiResultsEntity> {
    /**
     * 自定义分页查询
     *
     * @param page 分页对象
     * @param gdAiResults 查询参数
     * @return AI成果分页结果
     */
    IPage<GdAiResultsVO> selectGdAiResultsPage(IPage<GdAiResultsVO> page, GdAiResultsPageParam gdAiResults);
    /**
     * 导出数据
     *
     * @param queryWrapper 查询条件
     * @return AI成果Excel列表
     */
    List<GdAiResultsExcel> exportGdAiResults(Wrapper<GdAiResultsEntity> queryWrapper);
    /**
     * 新增或修改AI成果
     *
     * @param entity AI成果实体对象
     * @return 保存或更新成功返回true,失败返回false
     */
    boolean saveOrUpdateAiResults(GdAiResultsEntity entity);
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/service/impl/GdAiResultsServiceImpl.java
New file
@@ -0,0 +1,90 @@
/*
 *      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.airesults.service.impl;
import org.springblade.core.tool.utils.StringUtil;
import org.sxkj.gd.airesults.entity.GdAiResultsEntity;
import org.sxkj.gd.airesults.param.GdAiResultsPageParam;
import org.sxkj.gd.airesults.vo.GdAiResultsVO;
import org.sxkj.gd.airesults.excel.GdAiResultsExcel;
import org.sxkj.gd.airesults.mapper.GdAiResultsMapper;
import org.sxkj.gd.airesults.service.IGdAiResultsService;
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;
/**
 * AI成果表 服务实现类
 *
 * @author lw
 * @since 2026-02-28
 */
@Service
public class GdAiResultsServiceImpl extends BaseServiceImpl<GdAiResultsMapper, GdAiResultsEntity> implements IGdAiResultsService {
    /**
     * 自定义分页查询
     *
     * @param page 分页对象
     * @param gdAiResults 查询参数
     * @return AI成果分页结果
     */
    @Override
    public IPage<GdAiResultsVO> selectGdAiResultsPage(IPage<GdAiResultsVO> page, GdAiResultsPageParam gdAiResults) {
        return page.setRecords(baseMapper.selectGdAiResultsPage(page, gdAiResults));
    }
    /**
     * 导出数据
     *
     * @param queryWrapper 查询条件
     * @return AI成果Excel列表
     */
    @Override
    public List<GdAiResultsExcel> exportGdAiResults(Wrapper<GdAiResultsEntity> queryWrapper) {
        List<GdAiResultsExcel> gdAiResultsList = baseMapper.exportGdAiResults(queryWrapper);
        return gdAiResultsList;
    }
    /**
     * 新增或修改AI成果
     *
     * @param entity AI成果实体对象
     * @return 保存或更新成功返回true,失败返回false
     */
    @Override
    public boolean saveOrUpdateAiResults(GdAiResultsEntity entity) {
        // 步骤1:校验AI流请求key是否为空
        if (StringUtil.isNotBlank(entity.getAiReqKey())) {
            // 步骤2:查询数据库中是否存在相同AI流请求key的记录
            Long count = baseMapper.selectCount(
                new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<GdAiResultsEntity>()
                    .eq(GdAiResultsEntity::getAiReqKey, entity.getAiReqKey())
                    .ne(entity.getId() != null, GdAiResultsEntity::getId, entity.getId())
            );
            // 步骤3:如果存在重复的AI流请求key,抛出异常
            if (count > 0) {
                throw new RuntimeException("AI流请求key已存在,请使用其他key");
            }
        }
        // 步骤4:执行保存或更新操作
        return saveOrUpdate(entity);
    }
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/vo/GdAiResultsVO.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.airesults.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
/**
 * AI成果表 视图实体类
 *
 * @author lw
 * @since 2026-02-28
 */
@Data
public class GdAiResultsVO implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty("主键id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * AI流请求key
     */
    @ApiModelProperty(value = "AI流请求key")
    private String aiReqKey;
    /**
     * 识别结果附件地址无框
     */
    @ApiModelProperty(value = "识别结果附件地址无框")
    private String orgAttUrl;
    /**
     * 识别框坐标点,格式:x1,y1,x2,y2,x3,y3,x4,y4
     */
    @ApiModelProperty(value = "识别框坐标点,格式:x1,y1,x2,y2,x3,y3,x4,y4")
    private String points;
    /**
     * 区域编码
     */
    @ApiModelProperty(value = "区域编码")
    private String areaCode;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/airesults/wrapper/GdAiResultsWrapper.java
New file
@@ -0,0 +1,55 @@
/*
 *      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.airesults.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.sxkj.gd.airesults.entity.GdAiResultsEntity;
import org.sxkj.gd.airesults.vo.GdAiResultsVO;
import java.util.Objects;
/**
 * AI成果表 包装类,返回视图层所需的字段
 *
 * @author lw
 * @since 2026-02-28
 */
public class GdAiResultsWrapper extends BaseEntityWrapper<GdAiResultsEntity, GdAiResultsVO>  {
    /**
     * 构建Wrapper实例
     *
     * @return Wrapper实例
     */
    public static GdAiResultsWrapper build() {
        return new GdAiResultsWrapper();
     }
    /**
     * 实体转VO
     *
     * @param entity AI成果实体对象
     * @return AI成果VO对象
     */
    @Override
    public GdAiResultsVO entityVO(GdAiResultsEntity entity) {
        GdAiResultsVO vo = Objects.requireNonNull(BeanUtil.copy(entity, GdAiResultsVO.class));
        return vo;
    }
}