package cn.cecep.talroad.service.impl.analysis;

import cn.cecep.talroad.common.core.utils.poi.ExcelUtil;
import cn.cecep.talroad.domain.analysis.SRaActionReportsAudit;
import cn.cecep.talroad.domain.vo.AuditRecordLIstVO;
import cn.cecep.talroad.mapper.analysis.SRaActionReportsAuditFactoryInfoMapper;
import cn.cecep.talroad.mapper.analysis.SRaActionReportsAuditMapper;
import cn.cecep.talroad.service.analysis.ISRaActionReportsAuditService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 执行报告规范性审核Service业务层处理
 *
 * @author szhpt
 * @date 2023-03-28*/
@Service
public class SRaActionReportsAuditServiceImpl extends ServiceImpl<SRaActionReportsAuditMapper, SRaActionReportsAudit> implements ISRaActionReportsAuditService
{
    @Autowired
    private SRaActionReportsAuditMapper sRaActionReportsAuditMapper;

    @Resource
    private SRaActionReportsAuditFactoryInfoMapper sRaActionReportsAuditFactoryInfoMapper;

    /**
     * 查询执行报告规范性审核列表
     *
     * @param sRaActionReportsAudit 执行报告规范性审核
     * @return 执行报告规范性审核
     */
    @Override
    public List<SRaActionReportsAudit> selectSRaActionReportsAuditList(SRaActionReportsAudit sRaActionReportsAudit)
    {
        return sRaActionReportsAuditMapper.selectSRaActionReportsAuditList(sRaActionReportsAudit);
    }

    /**
     * 下载未提交的企业清单
     * @param reportId
     */
    @Override
    public void reportDownload(String reportId,HttpServletResponse response) {
        List<AuditRecordLIstVO> auditRecordLIstVOS = sRaActionReportsAuditFactoryInfoMapper.selectUnAuditFactory(reportId);
        ExcelUtil<AuditRecordLIstVO> excelUtil = new ExcelUtil<>(AuditRecordLIstVO.class);
        excelUtil.exportExcel(response,auditRecordLIstVOS,"未提交的企业清单");
    }
}
