package com.tuoheng.admin.service.inspection.query.handle;

import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.vo.inspection.InspectionVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service("playBackHandle")
public class PlayBackHandle implements GenerateInspectionFieldHander {

    private GenerateInspectionFieldHander handler;

    @Override
    public void setNextHandler(GenerateInspectionFieldHander handler) {
        this.handler = handler;
    }

    /**
     * 处于任务已完成状态时显示
     *
     * @param inspectionVo
     */
    @Override
    public void handler(User user, Dept dept, InspectionVo inspectionVo) {
//        log.info("处理回放执行字段");
        if (InspectionStatusEnum.FLIGHT_COMPLETED.getCode() == inspectionVo.getStatus()) {
            inspectionVo.setPlayback(true);
        }
        if (null != handler) {
            handler.handler(user, dept,inspectionVo);
            return;
        }
    }

}
