package com.docus.server.common.service.impl;

import com.docus.infrastructure.redis.service.IdService;
import com.docus.server.common.entity.SdryPacsPrintExcept;
import com.docus.server.common.mapper.SdryPacsPrintExceptMapper;
import com.docus.server.common.service.SdryPacsPrintExceptService;
import org.springframework.stereotype.Service;

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

/**
 * 远程调用存储服务业务实现
 *
 * @author wyb
 */
@Service
public class SdryPacsPrintExceptServiceImpl implements SdryPacsPrintExceptService {
    @Resource
    private IdService idService;
    @Resource
    private SdryPacsPrintExceptMapper sdryPacsPrintExceptMapper;

    @Override
    public int insert(SdryPacsPrintExcept pacsPrintExcept) {
        Long id = pacsPrintExcept.getId();
        id = id == null ? idService.getDateSeq() : id;
        pacsPrintExcept.setId(id);
        return sdryPacsPrintExceptMapper.saveExcept(pacsPrintExcept);
    }

    @Override
    public SdryPacsPrintExcept getById(Long id) {
        return sdryPacsPrintExceptMapper.getById(id);
    }

    @Override
    public int compensateSuccuss(Long id) {
        return sdryPacsPrintExceptMapper.compensateSuccuss(id);
    }

    @Override
    public List<Long> getCompensateIds(String beginDateTime) {
       List<Long> ids= sdryPacsPrintExceptMapper.getCompensateIds(beginDateTime);
       if(Objects.isNull(ids)){
           return new ArrayList<>();
       }
        return ids;
    }
}
