package cn.com.taiji.beidou.ship.archives.service.impl;

import cn.com.taiji.beidou.common.constant.Constants;
import cn.com.taiji.beidou.common.utils.SecurityUtils;
import cn.com.taiji.beidou.common.utils.uuid.SnowFlakeIdWorker;
import cn.com.taiji.beidou.ship.archives.domain.*;
import cn.com.taiji.beidou.ship.archives.mapper.ShipArchivesMapper;
import cn.com.taiji.beidou.ship.archives.service.ShipArchivesService;
import cn.com.taiji.beidou.ship.warning.record.mapper.WarningRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.token.TokenService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author CHEN
 * @Date 2022/11/9 9:45
 */
@Service
public class ShipArchivesServiceImpl implements ShipArchivesService {

    @Resource
    private ShipArchivesMapper shipArchivesMapper;


    @Override
    public List<ShipArchivesData> findShipList(ShipArchivesREQ req) {
        String online = req.getOnline();
        if(Constants.ONE.equals(online)){
            req.setOnline("ONLINE");
        }else if(Constants.TWO.equals(online)){
            req.setOnline("OFFLINE");
        }else if(Constants.THREE.equals(online)){
            req.setOnline("MARK");
        }
        List<ShipArchivesData> list = shipArchivesMapper.selectShipArchivesList(req);
        return list;
    }

    @Override
    public ShipArchivesData findShipById(String devideNo) {
        ShipArchivesData data = shipArchivesMapper.selectById(devideNo);
        if(null==data.getLastStatus()){
            data.setLastStatus(1);
        }
        return data;
    }

    @Override
    public ShipDisposeResult selectDisposeById(String devideNo, String warningId) {

        return shipArchivesMapper.selectDisposeById(devideNo,warningId);
    }

    @Override
    public ShipArchivesTotal getShipTotal(String shipId,String deptId){
        return shipArchivesMapper.getShipTotal(shipId,deptId);
    }

}
