吉安感知网项目-后端
linwei
2026-01-29 11ac466c39c972e965dee0c17688a57af86fe4d5
Merge remote-tracking branch 'origin/master'
5 files modified
1 files added
100 ■■■■■ changed files
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/controller/FwPoliceStationController.java 12 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/dto/FwPoliceStationPolygonQueryDTO.java 45 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwPoliceStationMapper.java 8 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwPoliceStationMapper.xml 22 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/service/IFwPoliceStationService.java 8 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/service/impl/FwPoliceStationServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/controller/FwPoliceStationController.java
@@ -31,6 +31,7 @@
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.sxkj.fw.area.dto.FwPoliceStationPolygonQueryDTO;
import org.sxkj.fw.area.entity.FwPoliceStationEntity;
import org.sxkj.fw.area.vo.FwPoliceStationVO;
import org.sxkj.fw.area.excel.FwPoliceStationExcel;
@@ -163,4 +164,15 @@
        ExcelUtil.export(response, "派出所信息表数据" + DateUtil.time(), "派出所信息表数据表", list, FwPoliceStationExcel.class);
    }
    /**
     * 根据多边形区域查询派出所
     */
    @PostMapping("/queryByPolygons")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "根据多边形区域查询派出所", notes = "传入多边形WKT字符串集合")
    public R<List<FwPoliceStationVO>> queryByPolygons(@Valid @RequestBody FwPoliceStationPolygonQueryDTO dto) {
        List<FwPoliceStationVO> result = fwPoliceStationService.selectByPolygons(dto.getPolygons());
        return R.data(result);
    }
}
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/dto/FwPoliceStationPolygonQueryDTO.java
New file
@@ -0,0 +1,45 @@
/*
 *      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.fw.area.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
/**
 * 派出所多边形区域查询 DTO
 *
 * @author lw
 * @since 2026-01-29
 */
@Data
@ApiModel(value = "FwPoliceStationPolygonQueryDTO对象", description = "派出所多边形区域查询入参")
public class FwPoliceStationPolygonQueryDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 多边形WKT字符串集合
     * 格式:POLYGON((114.96898636473107 27.11156483383477,114.97972069576815 27.111564833834766,...))
     */
    @NotEmpty(message = "多边形区域集合不能为空")
    @ApiModelProperty(value = "多边形WKT字符串集合", required = true, example = "[\"POLYGON((114.96898636473107 27.11156483383477,114.97972069576815 27.111564833834766,114.97972069576815 27.120473921808035,114.96898636473107 27.120473921808035,114.96898636473107 27.11156483383477))\"]")
    private List<String> polygons;
}
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwPoliceStationMapper.java
@@ -58,4 +58,12 @@
     */
    List<FwPoliceStationExcel> exportFwPoliceStation(@Param("ew") Wrapper<FwPoliceStationEntity> queryWrapper);
    /**
     * 根据多边形区域查询派出所
     *
     * @param polygons 多边形WKT字符串集合
     * @return
     */
    List<FwPoliceStationVO> selectByPolygons(@Param("polygons") List<String> polygons);
}
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwPoliceStationMapper.xml
@@ -83,4 +83,26 @@
        SELECT * FROM ja_fw_police_station ${ew.customSqlSegment}
    </select>
    <!-- 根据多边形区域查询派出所 -->
    <!--
        历史遗留问题:数据库表中 longitude 字段实际存储的是纬度值,latitude 字段实际存储的是经度值
        解决方案:
        1. POLYGON:用户输入是标准格式(经度 纬度),不做坐标交换
        2. POINT:数据库字段存反,构建时交换为 POINT(latitude, longitude)
    -->
    <select id="selectByPolygons" resultMap="fwPoliceStationResultMap">
        SELECT * FROM ja_fw_police_station
        WHERE is_deleted = 0
          AND longitude IS NOT NULL
          AND latitude IS NOT NULL
          AND (
            <foreach collection="polygons" item="polygon" separator=" OR ">
                ST_Contains(
                    ST_SRID(ST_GeomFromText(#{polygon}), 4326),
                    ST_GeomFromText(CONCAT('POINT(', latitude, ' ', longitude, ')'), 4326)
                )
            </foreach>
          )
    </select>
</mapper>
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/service/IFwPoliceStationService.java
@@ -56,4 +56,12 @@
     */
    List<FwPoliceStationExcel> exportFwPoliceStation(Wrapper<FwPoliceStationEntity> queryWrapper);
    /**
     * 根据多边形区域查询派出所
     *
     * @param polygons 多边形WKT字符串集合
     * @return
     */
    List<FwPoliceStationVO> selectByPolygons(List<String> polygons);
}
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/service/impl/FwPoliceStationServiceImpl.java
@@ -61,6 +61,11 @@
    }
    @Override
    public List<FwPoliceStationVO> selectByPolygons(List<String> polygons) {
        return baseMapper.selectByPolygons(polygons);
    }
    @Override
    public boolean save(FwPoliceStationEntity fwPoliceStation) {
        fillCreateFields(fwPoliceStation);
        return super.save(fwPoliceStation);