| | |
| | | defense_scene_ids, |
| | | area_divide_ids, |
| | | device_ids, |
| | | concat(ST_AsText(geom), ' | ', ST_SRID(geom)) as geom, |
| | | 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, |
| | | area_code, |
| | | create_user, |
| | | create_dept, |
| | |
| | | defense_scene_ids, |
| | | area_divide_ids, |
| | | device_ids, |
| | | concat(ST_AsText(geom), ' | ', ST_SRID(geom)) as geom, |
| | | 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, |
| | | area_code, |
| | | create_user, |
| | | create_dept, |
| | |
| | | #{deviceIds}, |
| | | <choose> |
| | | <when test="geom != null and geom != ''"> |
| | | ST_SRID( |
| | | ST_GeomFromText( |
| | | trim(case when instr(#{geom}, '|') > 0 then substring_index(#{geom}, '|', 1) else #{geom} end) |
| | | ), |
| | | case when instr(#{geom}, '|') > 0 then cast(trim(substring_index(#{geom}, '|', -1)) as unsigned) else 4326 end |
| | | ) |
| | | case |
| | | when instr(#{geom}, '|') > 0 then ST_GeomFromText( |
| | | trim(substring_index(#{geom}, '|', 1)), |
| | | cast(trim(substring_index(#{geom}, '|', -1)) as unsigned) |
| | | ) |
| | | else ST_GeomFromText(trim(#{geom})) |
| | | end |
| | | </when> |
| | | <otherwise>null</otherwise> |
| | | </choose>, |
| | |
| | | <if test="areaDivideIds != null">area_divide_ids = #{areaDivideIds},</if> |
| | | <if test="deviceIds != null">device_ids = #{deviceIds},</if> |
| | | <if test="geom != null and geom != ''"> |
| | | geom = ST_SRID( |
| | | ST_GeomFromText( |
| | | trim(case when instr(#{geom}, '|') > 0 then substring_index(#{geom}, '|', 1) else #{geom} end) |
| | | ), |
| | | case when instr(#{geom}, '|') > 0 then cast(trim(substring_index(#{geom}, '|', -1)) as unsigned) else 4326 end |
| | | ), |
| | | geom = case |
| | | when instr(#{geom}, '|') > 0 then ST_GeomFromText( |
| | | trim(substring_index(#{geom}, '|', 1)), |
| | | cast(trim(substring_index(#{geom}, '|', -1)) as unsigned) |
| | | ) |
| | | else ST_GeomFromText(trim(#{geom})) |
| | | end, |
| | | </if> |
| | | <if test="areaCode != null">area_code = #{areaCode},</if> |
| | | <if test="createUser != null">create_user = #{createUser},</if> |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | |
| | | record.setSceneCount(0); |
| | | record.setDeviceCount(0); |
| | | record.setAreaCount(0); |
| | | record.setZoneArea(BigDecimal.ZERO); |
| | | } |
| | | return; |
| | | } |
| | | Map<Long, BigDecimal> areaSizeMap = new HashMap<>(); |
| | | Map<Long, List<Long>> areaDeviceMap = new HashMap<>(); |
| | | if (!areaIdSet.isEmpty()) { |
| | | List<FwAreaDivideEntity> areaList = fwAreaDivideService.listByIds(areaIdSet); |
| | |
| | | if (area == null || area.getId() == null) { |
| | | continue; |
| | | } |
| | | areaSizeMap.put(area.getId(), area.getAreaSize()); |
| | | areaDeviceMap.put(area.getId(), parseIdList(area.getDeviceIds())); |
| | | } |
| | | } |
| | |
| | | } |
| | | record.setAreaCount(areaIds.size()); |
| | | record.setDeviceCount(deviceIds.size()); |
| | | record.setZoneArea(sumAreaSize(areaIds, areaSizeMap)); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return idList; |
| | | } |
| | | |
| | | private BigDecimal sumAreaSize(Set<Long> areaIds, Map<Long, BigDecimal> areaSizeMap) { |
| | | if (areaIds == null || areaIds.isEmpty()) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | for (Long areaId : areaIds) { |
| | | BigDecimal areaSize = areaSizeMap.get(areaId); |
| | | if (areaSize != null) { |
| | | total = total.add(areaSize); |
| | | } |
| | | } |
| | | if (BigDecimal.ZERO.compareTo(total) == 0) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | return total.setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<FwDefenseZoneExcel> exportFwDefenseZone(Wrapper<FwDefenseZoneEntity> queryWrapper) { |