18 files modified
1 files added
| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | return R.fail("区域信息不能为空"); |
| | | } |
| | | FwAreaDivideEntity fwAreaDivideEntity = fwAreaDivideSubmit.getAreaDivide(); |
| | | // if (isGeomInvalid(fwAreaDivideEntity.getGeom())) { |
| | | // return R.fail("几何数据格式不正确"); |
| | | // } |
| | | return R.status(fwAreaDivideService.saveOrUpdateWithExt(fwAreaDivideEntity, fwAreaDivideSubmit.getAreaDivideExtList())); |
| | | } |
| | | |
| | |
| | | queryWrapper.lambda().eq(FwAreaDivideEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); |
| | | List<FwAreaDivideExcel> list = fwAreaDivideService.exportFwAreaDivide(queryWrapper); |
| | | ExcelUtil.export(response, "区域划分表数据" + DateUtil.time(), "区域划分表数据表", list, FwAreaDivideExcel.class); |
| | | } |
| | | |
| | | private boolean isGeomInvalid(String geom) { |
| | | if (StringUtil.isBlank(geom)) { |
| | | return false; |
| | | } |
| | | String upper = geom.trim().toUpperCase(); |
| | | return !upper.contains("POLYGON"); |
| | | } |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "区域类型数字字典value") |
| | | private String areaTypeValue; |
| | | /** |
| | | * 面数据(空间类型,便于地理查询) |
| | | * 几何JSON |
| | | */ |
| | | @ApiModelProperty(value = "面数据(空间类型,便于地理查询)") |
| | | private String geom; |
| | | @ApiModelProperty(value = "几何JSON") |
| | | private String geomJson; |
| | | /** |
| | | * 区域编码 |
| | | */ |
| | |
| | | @TableField("area_code") |
| | | @ApiModelProperty(value = "区域编码") |
| | | private String areaCode; |
| | | /** |
| | | * 区域面的类型集合,逗号隔开 |
| | | */ |
| | | @TableField("area_type_keys") |
| | | @ApiModelProperty(value = "区域面的类型集合逗号隔开") |
| | | private String areaTypeKeys; |
| | | |
| | | } |
| | |
| | | */ |
| | | package org.sxkj.fw.area.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @ApiModelProperty(value = "区域类型数字字典value") |
| | | private String areaTypeValue; |
| | | /** |
| | | * 面数据(空间类型,便于地理查询) |
| | | * 几何JSON |
| | | */ |
| | | @ApiModelProperty(value = "面数据(空间类型,便于地理查询)") |
| | | private String geom; |
| | | @ApiModelProperty(value = "几何JSON") |
| | | @TableField("geom_json") |
| | | private String geomJson; |
| | | /** |
| | | * 区域编码 |
| | | */ |
| | |
| | | @ExcelProperty("区域类型数字字典value") |
| | | private String areaTypeValue; |
| | | /** |
| | | * 面数据(空间类型,便于地理查询) |
| | | * 几何JSON |
| | | */ |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("面数据(空间类型,便于地理查询)") |
| | | private byte[] geom; |
| | | @ExcelProperty("几何JSON") |
| | | private String geomJson; |
| | | /** |
| | | * 区域编码 |
| | | */ |
| | |
| | | List<FwAreaDivideExtExcel> exportFwAreaDivideExt(@Param("ew") Wrapper<FwAreaDivideExtEntity> queryWrapper); |
| | | |
| | | /** |
| | | * 批量新增(geom 文本转 geometry) |
| | | * 批量新增(geomJson 文本直接入库) |
| | | * |
| | | * @param fwAreaDivideExtList |
| | | * @return |
| | |
| | | <result column="area_divide_id" property="areaDivideId"/> |
| | | <result column="area_type_key" property="areaTypeKey"/> |
| | | <result column="area_type_value" property="areaTypeValue"/> |
| | | <result column="geom" property="geom"/> |
| | | <result column="geom_json" property="geomJson"/> |
| | | <result column="area_code" property="areaCode"/> |
| | | </resultMap> |
| | | |
| | |
| | | area_divide_id, |
| | | area_type_key, |
| | | area_type_value, |
| | | case |
| | | when geom is null then null |
| | | when ST_SRID(geom) is null |
| | | or ST_SRID(geom) = 0 then ST_AsText(geom) |
| | | else concat(ST_AsText(ST_SwapXY(geom)), ' | ', ST_SRID(geom)) |
| | | end as geom, |
| | | geom_json, |
| | | area_code, |
| | | create_user, |
| | | create_dept, |
| | |
| | | area_divide_id, |
| | | area_type_key, |
| | | area_type_value, |
| | | geom, |
| | | geom_json, |
| | | area_code, |
| | | create_user, |
| | | create_dept, |
| | |
| | | #{item.areaDivideId}, |
| | | #{item.areaTypeKey}, |
| | | #{item.areaTypeValue}, |
| | | <choose> |
| | | <when test="item.geom != null and item.geom != ''"> |
| | | case |
| | | when instr(#{item.geom}, '|') > 0 then ST_SRID( |
| | | ST_GeomFromText(trim(substring_index(#{item.geom}, '|', 1))), |
| | | cast(trim(substring_index(#{item.geom}, '|', -1)) as unsigned) |
| | | ) |
| | | else ST_GeomFromText(trim(#{item.geom})) |
| | | end |
| | | </when> |
| | | <otherwise>null</otherwise> |
| | | </choose>, |
| | | #{item.geomJson}, |
| | | #{item.areaCode}, |
| | | #{item.createUser}, |
| | | #{item.createDept}, |
| | |
| | | <result column="fly_date_start" property="flyDateStart"/> |
| | | <result column="fly_date_end" property="flyDateEnd"/> |
| | | <result column="area_code" property="areaCode"/> |
| | | <result column="area_type_keys" property="areaTypeKeys"/> |
| | | <result column="police_station_name" property="policeStationName"/> |
| | | <result column="police_station_contact_person" property="policeStationContactPerson"/> |
| | | <result column="police_station_contact_phone" property="policeStationContactPhone"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="fwAreaDivideStatisticsResultMap" type="org.sxkj.fw.area.vo.FwAreaDivideStatisticsVO"> |
| | |
| | | |
| | | <select id="selectFwAreaDividePage" resultMap="fwAreaDivideResultMap"> |
| | | select |
| | | ad.* |
| | | ad.*, |
| | | ps.station_name as police_station_name, |
| | | ps.contact_person as police_station_contact_person, |
| | | ps.contact_phone as police_station_contact_phone |
| | | from |
| | | ja_fw_area_divide ad |
| | | left join |
| | |
| | | |
| | | <select id="selectFwAreaDivideList" resultMap="fwAreaDivideResultMap"> |
| | | select |
| | | ad.* |
| | | ad.*, |
| | | ps.station_name as police_station_name, |
| | | ps.contact_person as police_station_contact_person, |
| | | ps.contact_phone as police_station_contact_phone |
| | | from ja_fw_area_divide ad |
| | | left join ja_fw_police_station ps on ps.id = ad.police_station_id and ps.is_deleted = 0 |
| | | <where> |
| | |
| | | fly_date_start, |
| | | fly_date_end, |
| | | area_code, |
| | | area_type_keys, |
| | | create_user, |
| | | create_dept, |
| | | create_time, |
| | |
| | | #{flyDateStart}, |
| | | #{flyDateEnd}, |
| | | #{areaCode}, |
| | | #{areaTypeKeys}, |
| | | #{createUser}, |
| | | #{createDept}, |
| | | #{createTime}, |
| | |
| | | <if test="flyDateStart != null">fly_date_start = #{flyDateStart},</if> |
| | | <if test="flyDateEnd != null">fly_date_end = #{flyDateEnd},</if> |
| | | <if test="areaCode != null">area_code = #{areaCode},</if> |
| | | <if test="areaTypeKeys != null">area_type_keys = #{areaTypeKeys},</if> |
| | | <if test="createUser != null">create_user = #{createUser},</if> |
| | | <if test="createDept != null">create_dept = #{createDept},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | |
| | | List<FwAreaDivideExtExcel> exportFwAreaDivideExt(Wrapper<FwAreaDivideExtEntity> queryWrapper); |
| | | |
| | | /** |
| | | * 批量新增(geom 文本转 geometry) |
| | | * 批量新增(geomJson 文本直接入库) |
| | | * |
| | | * @param fwAreaDivideExtList |
| | | * @return |
| | |
| | | |
| | | @Override |
| | | public FwAreaDivideVO selectFwAreaDivideDetail(Long id) { |
| | | return baseMapper.selectFwAreaDivideDetail(id); |
| | | FwAreaDivideVO detail = baseMapper.selectFwAreaDivideDetail(id); |
| | | if (detail == null || detail.getId() == null) { |
| | | return detail; |
| | | } |
| | | List<FwAreaDivideExtVO> extList = fwAreaDivideExtService.getByAreaDivideId(detail.getId()); |
| | | detail.setFwAreaDivideExtList(extList); |
| | | return detail; |
| | | } |
| | | |
| | | @Override |
| | |
| | | // 主表与扩展面数据保持同一事务,扩展面列表为空时仅保存主表 |
| | | if (fwAreaDivide == null) { |
| | | return false; |
| | | } |
| | | if (fwAreaDivideExtList != null && !fwAreaDivideExtList.isEmpty()) { |
| | | String areaTypeKeys = buildAreaTypeKeys(fwAreaDivideExtList); |
| | | if (StringUtil.isNotBlank(areaTypeKeys)) { |
| | | fwAreaDivide.setAreaTypeKeys(areaTypeKeys); |
| | | } |
| | | } |
| | | boolean isCreate = fwAreaDivide.getId() == null; |
| | | boolean mainResult = saveOrUpdate(fwAreaDivide); |
| | |
| | | } |
| | | } |
| | | |
| | | private String buildAreaTypeKeys(List<FwAreaDivideExtEntity> fwAreaDivideExtList) { |
| | | if (fwAreaDivideExtList == null || fwAreaDivideExtList.isEmpty()) { |
| | | return null; |
| | | } |
| | | Set<String> keySet = new LinkedHashSet<>(); |
| | | for (FwAreaDivideExtEntity ext : fwAreaDivideExtList) { |
| | | if (ext == null) { |
| | | continue; |
| | | } |
| | | String key = ext.getAreaTypeKey(); |
| | | if (StringUtil.isNotBlank(key)) { |
| | | keySet.add(key); |
| | | } |
| | | } |
| | | if (keySet.isEmpty()) { |
| | | return null; |
| | | } |
| | | return String.join(",", keySet); |
| | | } |
| | | |
| | | private List<Long> parseIdList(String ids) { |
| | | if (StringUtil.isBlank(ids)) { |
| | | return new ArrayList<>(); |
| | |
| | | @ApiModelProperty(value = "区域类型数字字典value") |
| | | private String areaTypeValue; |
| | | /** |
| | | * 面数据(空间类型,便于地理查询) |
| | | * 几何JSON |
| | | */ |
| | | @ApiModelProperty(value = "面数据(空间类型,便于地理查询)") |
| | | private String geom; |
| | | @ApiModelProperty(value = "几何JSON") |
| | | private String geomJson; |
| | | /** |
| | | * 区域编码 |
| | | */ |
| | |
| | | * 关联派出所id |
| | | */ |
| | | @ApiModelProperty(value = "关联派出所id") |
| | | private Long policeStationId; |
| | | private String policeStationId; |
| | | /** |
| | | * 关联设备ID,逗号分隔 |
| | | */ |
| | |
| | | */ |
| | | @ApiModelProperty(value = "区域编码") |
| | | private String areaCode; |
| | | /** |
| | | * 区域面的类型集合,逗号隔开 |
| | | */ |
| | | @ApiModelProperty(value = "区域面的类型集合逗号隔开") |
| | | private String areaTypeKeys; |
| | | |
| | | /** |
| | | * 派出所名称 |
| | | */ |
| | | @ApiModelProperty(value = "派出所名称") |
| | | private String policeStationName; |
| | | |
| | | /** |
| | | * 派出所联系人 |
| | | */ |
| | | @ApiModelProperty(value = "派出所联系人") |
| | | private String policeStationContactPerson; |
| | | |
| | | /** |
| | | * 派出所联系电话 |
| | | */ |
| | | @ApiModelProperty(value = "派出所联系电话") |
| | | private String policeStationContactPhone; |
| | | /** |
| | | * 面数据 |
| | | */ |
| | | @ApiModelProperty(value = "面数据") |
| | | private List<FwAreaDivideExtVO> fwAreaDivideExtList; |
| | | |
| | |
| | | import org.sxkj.fw.common.GenericConverter; |
| | | import org.sxkj.fw.common.IdParam; |
| | | import org.sxkj.fw.device.dto.FwDeviceDTO; |
| | | import org.sxkj.fw.device.dto.FwDevicePolygonQueryDTO; |
| | | import org.sxkj.fw.device.entity.FwDeviceEntity; |
| | | import org.sxkj.fw.device.excel.FwDeviceExcel; |
| | | import org.sxkj.fw.device.param.FwDevicePageParam; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设备表 列表(多边形过滤) |
| | | */ |
| | | @PostMapping("/listByPolygons") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "列表-多边形过滤", notes = "传入isAreaSelect、areaId、status、isTrack、polygons") |
| | | public R<List<FwDeviceVO>> listByPolygons(@Valid @RequestBody FwDevicePolygonQueryDTO query) { |
| | | List<FwDeviceEntity> list = fwDeviceService.selectFwDeviceListByPolygons(query); |
| | | FwDeviceWrapper wrapper = FwDeviceWrapper.build(); |
| | | return R.data(list.stream().map(wrapper::entityVO).collect(Collectors.toList())); |
| | | } |
| | | |
| | | /** |
| | | * 设备表 自定义分页 |
| | | */ |
| | | @GetMapping("/page") |
| New file |
| | |
| | | /* |
| | | * 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.device.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 设备列表(多边形过滤)查询参数 |
| | | * |
| | | * @author aix |
| | | * @since 2026-01-29 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "FwDevicePolygonQueryDTO", description = "设备列表多边形查询参数") |
| | | public class FwDevicePolygonQueryDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "是否区域选择(1过滤)") |
| | | private Integer isAreaSelect; |
| | | |
| | | @ApiModelProperty(value = "区域id") |
| | | private Long areaId; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "是否出入库 1已出库 2未出库") |
| | | private Integer isTrack; |
| | | |
| | | @ApiModelProperty(value = "多边形WKT集合") |
| | | private List<String> polygons; |
| | | } |
| | |
| | | import org.sxkj.fw.device.vo.DeviceTypeStatisticsVO; |
| | | import org.sxkj.fw.cockpit.vo.DeviceStatisticsVO; |
| | | import org.sxkj.fw.device.dto.FwDeviceDTO; |
| | | import org.sxkj.fw.device.dto.FwDevicePolygonQueryDTO; |
| | | import org.sxkj.fw.device.entity.FwDeviceEntity; |
| | | import org.sxkj.fw.device.excel.FwDeviceExcel; |
| | | import org.sxkj.fw.device.vo.CockpitFwDeviceVO; |
| | |
| | | * @return |
| | | */ |
| | | List<FwDeviceEntity> selectFwDeviceList(@Param("isAreaSelect") Integer isAreaSelect, @Param("areaId") Long areaId, |
| | | @Param("status") Integer status, @Param("isTrack") Integer isTrack); |
| | | @Param("status") Integer status, @Param("isTrack") Integer isTrack); |
| | | |
| | | /** |
| | | * 根据多边形查询设备列表 |
| | | * |
| | | * @param query 查询条件 |
| | | * @return 设备列表 |
| | | */ |
| | | List<FwDeviceEntity> selectFwDeviceListByPolygons(@Param("query") FwDevicePolygonQueryDTO query); |
| | | |
| | | |
| | | /** |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectFwDeviceListByPolygons" resultMap="fwDeviceResultMap"> |
| | | select * from ja_fw_device |
| | | <where> |
| | | is_deleted = 0 |
| | | <if test="query.isAreaSelect != null and query.isAreaSelect == 1"> |
| | | and ( |
| | | <choose> |
| | | <when test="query.areaId != null"> |
| | | exists ( |
| | | select 1 |
| | | from ja_fw_area_divide ad |
| | | where ad.is_deleted = 0 |
| | | and ad.id = #{query.areaId} |
| | | and ad.device_ids is not null |
| | | and ad.device_ids != '' |
| | | and find_in_set(ja_fw_device.id, ad.device_ids) |
| | | ) |
| | | or not exists ( |
| | | select 1 |
| | | from ja_fw_area_divide ad |
| | | where ad.is_deleted = 0 |
| | | and ad.device_ids is not null |
| | | and ad.device_ids != '' |
| | | and find_in_set(ja_fw_device.id, ad.device_ids) |
| | | and ad.id != #{query.areaId} |
| | | ) |
| | | </when> |
| | | <otherwise> |
| | | not exists ( |
| | | select 1 |
| | | from ja_fw_area_divide ad |
| | | where ad.is_deleted = 0 |
| | | and ad.device_ids is not null |
| | | and ad.device_ids != '' |
| | | and find_in_set(ja_fw_device.id, ad.device_ids) |
| | | ) |
| | | </otherwise> |
| | | </choose> |
| | | ) |
| | | </if> |
| | | <if test="query.status != null"> |
| | | and status = #{query.status} |
| | | </if> |
| | | <if test="query.isTrack != null and query.isTrack == 1"> |
| | | and (SELECT COUNT(*) FROM ja_fw_device_track tmp WHERE ja_fw_device.id = tmp.device_id) > 0 |
| | | </if> |
| | | <if test="query.isTrack != null and query.isTrack == 2"> |
| | | and (SELECT COUNT(*) FROM ja_fw_device_track tmp WHERE ja_fw_device.id = tmp.device_id) = 0 |
| | | </if> |
| | | and longitude is not null |
| | | and longitude != '' |
| | | and latitude is not null |
| | | and latitude != '' |
| | | <if test="query.polygons != null and query.polygons.size > 0"> |
| | | and ( |
| | | <foreach collection="query.polygons" item="polygon" separator=" OR "> |
| | | ST_Contains( |
| | | ST_SRID(ST_GeomFromText(#{polygon}), 4326), |
| | | ST_GeomFromText(CONCAT('POINT(', latitude, ' ', longitude, ')'), 4326) |
| | | ) |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="exportFwDevice" resultType="org.sxkj.fw.device.excel.FwDeviceExcel"> |
| | | SELECT * FROM ja_fw_device ${ew.customSqlSegment} |
| | |
| | | import org.sxkj.fw.cockpit.vo.AlarmStatisticsVO; |
| | | import org.sxkj.fw.cockpit.vo.DeviceStatisticsVO; |
| | | import org.sxkj.fw.device.dto.FwDeviceDTO; |
| | | import org.sxkj.fw.device.dto.FwDevicePolygonQueryDTO; |
| | | import org.sxkj.fw.device.entity.FwDeviceEntity; |
| | | import org.sxkj.fw.device.param.FwDevicePageParam; |
| | | import org.sxkj.fw.device.vo.CockpitFwDeviceVO; |
| | |
| | | */ |
| | | List<FwDeviceEntity> selectFwDeviceList(Integer isAreaSelect, Long areaId, Integer status, Integer isTrack); |
| | | |
| | | /** |
| | | * 根据多边形查询设备列表 |
| | | * |
| | | * @param query 查询条件 |
| | | * @return 设备列表 |
| | | */ |
| | | List<FwDeviceEntity> selectFwDeviceListByPolygons(FwDevicePolygonQueryDTO query); |
| | | |
| | | |
| | | /** |
| | | * 导出数据 |
| | |
| | | import org.sxkj.fw.cockpit.vo.DeviceStatisticsVO; |
| | | import org.sxkj.fw.common.GenericConverter; |
| | | import org.sxkj.fw.device.dto.FwDeviceDTO; |
| | | import org.sxkj.fw.device.dto.FwDevicePolygonQueryDTO; |
| | | import org.sxkj.fw.device.entity.FwDeviceEntity; |
| | | import org.sxkj.fw.device.param.FwDevicePageParam; |
| | | import org.sxkj.fw.device.vo.CockpitFwDeviceVO; |
| | |
| | | return baseMapper.selectFwDeviceList(isAreaSelect, areaId, status, isTrack); |
| | | } |
| | | |
| | | @Override |
| | | public List<FwDeviceEntity> selectFwDeviceListByPolygons(FwDevicePolygonQueryDTO query) { |
| | | return baseMapper.selectFwDeviceListByPolygons(query); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<FwDeviceExcel> exportFwDevice(Wrapper<FwDeviceEntity> queryWrapper) { |
| | |
| | | * @return 同步数量 |
| | | */ |
| | | @Override |
| | | @Async |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | public int syncXingtuDevice() throws Exception { |
| | | int total = 0; |