| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dji.sample.common.error.CommonErrorEnum; |
| | | import com.dji.sample.common.model.CustomClaim; |
| | |
| | | return waylineJobEntity; |
| | | } |
| | | |
| | | @Override |
| | | public WaylineJobCountDTO patrolStatistics(String workspaceId) { |
| | | WaylineJobCountDTO waylineJobCountDTO = new WaylineJobCountDTO(); |
| | | List<WaylineJobEntity> list = new LambdaQueryChainWrapper<>(mapper).eq(WaylineJobEntity::getStatus, 3).list(); |
| | | if (!CollectionUtils.isEmpty(list)){ |
| | | waylineJobCountDTO.setTotalNumber(list.size()); |
| | | long totalTime = list.stream().mapToLong(s -> s.getEndTime() - s.getBeginTime()).sum() / 1000; |
| | | StringBuffer buffer = new StringBuffer(); |
| | | long h = totalTime / 3600; |
| | | long m = (totalTime % 3600) / 60; |
| | | buffer.append(h).append(" h "); |
| | | buffer.append(m).append(" min"); |
| | | waylineJobCountDTO.setTotalDuration(buffer.toString()); |
| | | } |
| | | return waylineJobCountDTO; |
| | | } |
| | | |
| | | @Override |
| | | public void updateJobCollect(WaylineJobEntity waylineJob) { |
| | | new LambdaUpdateChainWrapper<>(mapper) |
| | | .eq(WaylineJobEntity::getJobId,waylineJob.getJobId()) |
| | | .set(WaylineJobEntity::getCollectStatus,waylineJob.getCollectStatus()) |
| | | .set(WaylineJobEntity::getUserId,waylineJob.getUserId()) |
| | | .update(); |
| | | } |
| | | |
| | | private void pauseJob(String workspaceId, String dockSn, String jobId, WaylineJobStatusEnum statusEnum) { |
| | | if (WaylineJobStatusEnum.PAUSED == statusEnum && jobId.equals(waylineRedisService.getPausedWaylineJobId(dockSn))) { |
| | | waylineRedisService.setPausedWaylineJob(dockSn, jobId); |