package com.tuoheng.admin.service.inspection.update.flyer;

import com.tuoheng.admin.entity.domain.Inspection;
import com.tuoheng.admin.mapper.InspectionMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class OffLineCompleteService {

    @Autowired
    private InspectionMapper inspectionMapper;

    public void handle(Inspection inspection) {
        log.info("离线完成飞行,任务编号：{}", inspection.getId());
        Inspection inspectionUpdate = new Inspection();
        inspectionUpdate.setId(inspection.getId());
        inspectionUpdate.setAnalyseStatus(1);
        inspectionUpdate.setHeartbeatTime(System.currentTimeMillis());
        inspectionMapper.updateById(inspectionUpdate);
        log.info("离线完成飞行，设置分析状态：{}", inspection.getId());
    }

}
