| | |
| | | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),uavResultDTOS); |
| | | } |
| | | |
| | | @PostMapping("getUavMore") |
| | | public ResultMessage getUavMore(@RequestBody Map<String, Object> params){ |
| | | //判断是否缺少参数 |
| | | if (!params.containsKey("mac") || !params.containsKey("batch") || !params.containsKey("height1")|| !params.containsKey("uvasize")|| !params.containsKey("height2")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | List<UAVResultDTO> uavResultDTOS = uavService.getUav(params); |
| | | if (ObjectUtils.isEmpty(uavResultDTOS)){ |
| | | return new ResultMessage(ResponseCodeEnum.SENSOR_IS_NOT_EXIST,"null"); |
| | | } |
| | | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),uavResultDTOS); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: 查询组织在哪天有无人机飞行,返回具体日期 |
| | |
| | | |
| | | import com.moral.api.entity.HistorySecondUav; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.moral.api.pojo.dto.uav.UAVGetBD; |
| | | import com.moral.api.pojo.dto.uav.UAVResultDTO; |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | List<HistorySecondUav> reList(Map<String,Object> map); |
| | | |
| | | List<UAVGetBD> reListDetail(Map<String,Object> map); |
| | | } |
| | |
| | | |
| | | |
| | | private String value; |
| | | |
| | | private Double num; |
| | | } |
| | |
| | | import java.util.Map; |
| | | |
| | | import com.moral.api.pojo.dto.uav.UAVResultDTO; |
| | | import com.moral.api.pojo.dto.uav.UAVResultListDTO; |
| | | |
| | | public interface UAVService { |
| | | |
| | | |
| | | List<UAVResultDTO> getUav(Map<String, Object> params); |
| | | |
| | | UAVResultListDTO getUavMore(Map<String, Object> params); |
| | | } |
| | |
| | | package com.moral.api.service.impl; |
| | | |
| | | import com.moral.api.pojo.dto.uav.UAVResultListDTO; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private HistorySecondUavMapper historySecondUavMapper; |
| | | |
| | | @Override |
| | | public UAVResultListDTO getUavMore(Map<String, Object> params) { |
| | | UAVResultListDTO uavResultListDTO = new UAVResultListDTO(); |
| | | String uvasize = params.get("uvasize").toString(); |
| | | int size = Integer.parseInt(uvasize); |
| | | //纬度 |
| | | ArrayList<Double> flyLatList = new ArrayList<>(); |
| | | //经度 |
| | | ArrayList<Double> flyLonList = new ArrayList<>(); |
| | | String type = params.get("type").toString(); |
| | | params.put("type","$."+type); |
| | | List<UAVGetBD> historySecondUavs = historySecondUavMapper.reListDetail(params); |
| | | if (ObjectUtils.isEmpty(historySecondUavs)){ |
| | | return null; |
| | | } |
| | | ArrayList<UAVGetBD> rsBDList = new ArrayList<>(); |
| | | for (UAVGetBD historySecondUav : historySecondUavs) { |
| | | UAVGetBD uavGetBD = new UAVGetBD(); |
| | | //WGS84 转 百度坐标 |
| | | double[] doubles = transformWGS84ToBD09(historySecondUav.getFlyLon(), historySecondUav.getFlyLat()); |
| | | uavGetBD.setFlyLon(doubles[0]); |
| | | uavGetBD.setFlyLat(doubles[1]); |
| | | uavGetBD.setNum(historySecondUav.getNum()); |
| | | rsBDList.add(uavGetBD); |
| | | flyLatList.add(doubles[1]); |
| | | flyLonList.add(doubles[0]); |
| | | } |
| | | //获取最大最小的经纬度 |
| | | Double maxLat = Collections.max(flyLatList); |
| | | Double maxLon = Collections.max(flyLonList); |
| | | Double minLat = Collections.min(flyLatList); |
| | | Double minLon = Collections.min(flyLonList); |
| | | double distance1 = getDistance(maxLon, minLat, maxLon, maxLat); |
| | | //计算经度的距离 |
| | | double distance2 = getDistance(maxLon, minLat, minLon, minLat); |
| | | ArrayList<UAVGteForDTO> list = new ArrayList<>(); |
| | | String[] youshang = calLocationByDistanceAndLocationAndDirection(90, minLon, maxLat, size); |
| | | //右下2 |
| | | String[] youxia = calLocationByDistanceAndLocationAndDirection(180, Double.parseDouble(youshang[0]), Double.parseDouble(youshang[1]), size); |
| | | //左下2 |
| | | String[] zuoxia = calLocationByDistanceAndLocationAndDirection(180, minLon, maxLat, size); |
| | | for (int i = 0; i <distance2 ; i+=size) { |
| | | UAVGteForDTO dto1 = new UAVGteForDTO(); |
| | | String[] strings2 = calLocationByDistanceAndLocationAndDirection(90, minLon, maxLat, i); |
| | | String[] strings3 = calLocationByDistanceAndLocationAndDirection(90, Double.parseDouble(youshang[0].toString()), Double.parseDouble(youshang[1].toString()), i); |
| | | String[] strings4 = calLocationByDistanceAndLocationAndDirection(90, Double.parseDouble(youxia[0].toString()), Double.parseDouble(youxia[1].toString()), i); |
| | | String[] strings5 = calLocationByDistanceAndLocationAndDirection(90, Double.parseDouble(zuoxia[0].toString()), Double.parseDouble(zuoxia[1].toString()), i); |
| | | dto1.setLeftTop(strings2); |
| | | dto1.setRightTop(strings3); |
| | | dto1.setRightBottom(strings4); |
| | | dto1.setLeftBottom(strings5); |
| | | list.add(dto1); |
| | | for (int j = 0; j < distance1; j+=size) { |
| | | UAVGteForDTO dto2 = new UAVGteForDTO(); |
| | | String[] strings6 = calLocationByDistanceAndLocationAndDirection(180, Double.parseDouble(strings2[0].toString()), Double.parseDouble(strings2[1].toString()), j); |
| | | String[] strings7 = calLocationByDistanceAndLocationAndDirection(180, Double.parseDouble(strings3[0].toString()), Double.parseDouble(strings3[1].toString()), j); |
| | | String[] strings8 = calLocationByDistanceAndLocationAndDirection(180, Double.parseDouble(strings4[0].toString()), Double.parseDouble(strings4[1].toString()), j); |
| | | String[] strings9 = calLocationByDistanceAndLocationAndDirection(180, Double.parseDouble(strings5[0].toString()), Double.parseDouble(strings5[1].toString()), j); |
| | | dto2.setLeftTop(strings6); |
| | | dto2.setRightTop(strings7); |
| | | dto2.setRightBottom(strings8); |
| | | dto2.setLeftBottom(strings9); |
| | | if (j!=0){ |
| | | list.add(dto2); |
| | | } |
| | | } |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | @Override |
| | | public List<UAVResultDTO> getUav(Map<String, Object> params) { |
| | | |
| | | String uvasize = params.get("uvasize").toString(); |
| | |
| | | HAVING abs(`value`->>'$.flyhig') <![CDATA[>=]]> #{height1} |
| | | and abs(`value`->>'$.flyhig') <![CDATA[<=]]> #{height2} |
| | | </select> |
| | | |
| | | <select id="reListDetail" resultType="com.moral.api.pojo.dto.uav.UAVGetBD"> |
| | | SELECT history_second_uav.time,value->>#{type} as num,value->>'$.flylon' as flyLon,value->>'$.flylat' as flyLat |
| | | FROM history_second_uav WHERE mac = #{mac} |
| | | AND batch = #{batch} |
| | | HAVING abs(`value`->>'$.flyhig') <![CDATA[>=]]> #{height1} |
| | | and abs(`value`->>'$.flyhig') <![CDATA[<=]]> #{height2} |
| | | </select> |
| | | </mapper> |
| | |
| | | date: |
| | | changshu: P5DND7A0245358,P5DND7A0245364,P5DND7A0245413,P5DND7A0245355,P5DND7A0245416,P5DND7A0245426,P5DND7A0245398,P5DND7A0245441,P5DND7A0245429,P5DND7A0245435,P5DND7A0245372,P5DND7A0245397,P5DND7A0245415,P5DND7A0245411,P5DND7A0245407,P5DND7A0245418,P5DND7A0245430,P5DND7A0245493,P5DND7A0245414,P5DND7A0245366,P5DND7A0245442,P5DND7A0245386,P5DND7A0245431,P5DND7A0245394,P5DND7A0245380,P5DND7A0245420,P5DND7A0245440,P5DND7A0245432,P5DND7A0391974,P5DND7A0391989,P5DND7A0245481,P5DND7A0392001,P5DND7A0391991,P5DND7A0391978,P5DND7A0245499 |
| | | device: |
| | | list: p5dnd7a0245499,p5dnd7a0391962 |
| | | list: p5dnd7a0245499,p5dnd7a0391962,HJS00002156B89 |
| | |
| | | foh3wi2ooghiCh5 |
| | | result: |
| | | device: |
| | | list: p5dnd7a0245499,p5dnd7a0391962 |
| | | list: p5dnd7a0245499,p5dnd7a0391962,HJS00002156B89 |
| | | |
| | | |