| | |
| | | } |
| | | |
| | | */ |
| | | /** |
| | | /** |
| | | * 使用json序列化机制,进行消息转换 |
| | | * @return - |
| | | *//* |
| | |
| | | */ |
| | | public interface IDroneFlightLogMapper extends BaseMapper<DroneFlightLogEntity> { |
| | | |
| | | List<DroneFlightLogEntity> patrolStatistics(@Param("workspaceId") String workspaceId, @Param("queryTime") String queryTime); |
| | | List<DroneFlightLogEntity> patrolStatistics(@Param("workspaceId") String workspaceId, @Param("queryTime") String queryTime, @Param("deviceSn") String deviceSn); |
| | | } |
| | |
| | | <if test="workspaceId != null and workspaceId != ''"> |
| | | and fl.workspace_id = #{workspaceId} |
| | | </if> |
| | | <if test="deviceSn !=null and deviceSn != ''" > |
| | | and fl.device_sn = #{deviceSn} |
| | | </if> |
| | | ORDER BY fl.end_time DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | @GetMapping("/{workspace_id}/waylines_list") |
| | | @SysLogAnnotation(operModul = "航线库", operType = "查询", operDesc = "查询当前工作区航线库列表") |
| | | public ResponseResult<List<WaylineListDTO>> waylineList(@PathVariable(name = "workspace_id") String workspaceId) { |
| | | return ResponseResult.success(waylineFileService.waylineList(workspaceId)) ; |
| | | public ResponseResult<List<WaylineListDTO>> waylineList(@PathVariable(name = "workspace_id") String workspaceId,String droneName) { |
| | | return ResponseResult.success(waylineFileService.waylineList(workspaceId,droneName)) ; |
| | | } |
| | | } |
| | |
| | | * 统计飞行次数 |
| | | */ |
| | | @PostMapping("/{workspace_id}/patrol_statistics") |
| | | public ResponseResult<WaylineJobCountDTO> patrolStatistics(@PathVariable(name = "workspace_id") String workspaceId,String queryTime) { |
| | | public ResponseResult<WaylineJobCountDTO> patrolStatistics(@PathVariable(name = "workspace_id") String workspaceId,String queryTime,String deviceSn) { |
| | | |
| | | WaylineJobCountDTO waylineJobCountDTO = waylineJobService.patrolStatistics(workspaceId,queryTime); |
| | | WaylineJobCountDTO waylineJobCountDTO = waylineJobService.patrolStatistics(workspaceId,queryTime,deviceSn); |
| | | |
| | | return ResponseResult.success(waylineJobCountDTO); |
| | | } |
| | |
| | | */ |
| | | void importKmzFile(MultipartFile file, String workspaceId, String creator); |
| | | |
| | | List<WaylineListDTO> waylineList(String workspaceId); |
| | | List<WaylineListDTO> waylineList(String workspaceId,String droneName); |
| | | } |
| | |
| | | */ |
| | | WaylineJobEntity getLatestJob(String workspaceId, WaylineJobQueryParam waylineJobQueryParam); |
| | | |
| | | WaylineJobCountDTO patrolStatistics(String workspaceId,String queryTime); |
| | | WaylineJobCountDTO patrolStatistics(String workspaceId,String queryTime,String deviceSn); |
| | | |
| | | void updateJobCollect(WaylineJobEntity waylineJob); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<WaylineListDTO> waylineList(String workspaceId) { |
| | | return new LambdaQueryChainWrapper<>(mapper).eq(WaylineFileEntity::getWorkspaceId, workspaceId) |
| | | .list().stream().map(r -> WaylineListDTO.builder().waylineFileId(r.getWaylineId()).name(r.getName()).build()) |
| | | .collect(Collectors.toList()); |
| | | public List<WaylineListDTO> waylineList(String workspaceId,String droneName) { |
| | | LambdaQueryChainWrapper<WaylineFileEntity> wrapper = |
| | | new LambdaQueryChainWrapper<>(mapper).eq(WaylineFileEntity::getWorkspaceId, workspaceId); |
| | | if (StringUtils.hasText(droneName)){ |
| | | wrapper.like(WaylineFileEntity::getName,droneName); |
| | | } |
| | | |
| | | return wrapper.list().stream().map(r -> WaylineListDTO.builder().waylineFileId(r.getWaylineId()).name(r.getName()).build()) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | private Optional<WaylineFileDTO> validKmzFile(MultipartFile file) { |
| | |
| | | |
| | | |
| | | @Override |
| | | public WaylineJobCountDTO patrolStatistics(String workspaceId, String queryTime) { |
| | | public WaylineJobCountDTO patrolStatistics(String workspaceId, String queryTime,String deviceSn) { |
| | | WaylineJobCountDTO waylineJobCountDTO = new WaylineJobCountDTO(); |
| | | List<DroneFlightLogEntity> list = flightLogMapper.patrolStatistics(workspaceId,queryTime); |
| | | List<DroneFlightLogEntity> list = flightLogMapper.patrolStatistics(workspaceId,queryTime,deviceSn); |
| | | if (!CollectionUtils.isEmpty(list)) { |
| | | waylineJobCountDTO.setTotalNumber(list.size()); |
| | | long totalTime = list.stream().filter(task -> task.getEndTime()!= null && task.getStartTime()!= null).mapToLong(s -> s.getEndTime() - s.getStartTime()).sum() / 1000; |
| | | long h = totalTime / 3600; |
| | | long m = (totalTime % 3600) / 60; |
| | | waylineJobCountDTO.setTotalDuration( String.format("%02d h %02d min", h, m)); |
| | | List<String> deviceSn = list.stream().map(DroneFlightLogEntity::getDeviceSn).distinct().collect(Collectors.toList()); |
| | | List<String> deviceSns = list.stream().map(DroneFlightLogEntity::getDeviceSn).distinct().collect(Collectors.toList()); |
| | | double sum = 0.0; |
| | | for (String sn : deviceSn) { |
| | | for (String sn : deviceSns) { |
| | | Double totalFlightDistance = new LambdaQueryChainWrapper<>(flightLogMapper) |
| | | .eq(DroneFlightLogEntity::getDeviceSn, sn).orderByDesc(DroneFlightLogEntity::getEndTime).last("limit 1").one().getTotalFlightDistance(); |
| | | if (totalFlightDistance!= null){ |