package com.fs.survey.service.impl;

import java.util.Collections;
import java.util.List;
import com.fs.common.utils.DateUtils;
import com.fs.survey.dto.PeriodDataDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.survey.mapper.SurveyTaskPeriodMapper;
import com.fs.survey.domain.SurveyTaskPeriod;
import com.fs.survey.service.ISurveyTaskPeriodService;

/**
 * 问卷任务期次Service业务层处理
 * 
 * @author fs
 * @date 2026-02-06
 */
@Service
public class SurveyTaskPeriodServiceImpl implements ISurveyTaskPeriodService
{
    @Autowired
    private SurveyTaskPeriodMapper surveyTaskPeriodMapper;

    /**
     * 查询问卷任务期次
     * 
     * @param id 问卷任务期次主键
     * @return 问卷任务期次
     */
    @Override
    public SurveyTaskPeriod selectSurveyTaskPeriodById(Long id)
    {
        return surveyTaskPeriodMapper.selectSurveyTaskPeriodById(id);
    }

    /**
     * 查询问卷任务期次列表
     * 
     * @param surveyTaskPeriod 问卷任务期次
     * @return 问卷任务期次
     */
    @Override
    public List<SurveyTaskPeriod> selectSurveyTaskPeriodList(SurveyTaskPeriod surveyTaskPeriod)
    {
        return surveyTaskPeriodMapper.selectSurveyTaskPeriodList(surveyTaskPeriod);
    }

    /**
     * 新增问卷任务期次
     * 
     * @param surveyTaskPeriod 问卷任务期次
     * @return 结果
     */
    @Override
    public int insertSurveyTaskPeriod(SurveyTaskPeriod surveyTaskPeriod)
    {
        return surveyTaskPeriodMapper.insertSurveyTaskPeriod(surveyTaskPeriod);
    }

    /**
     * 修改问卷任务期次
     * 
     * @param surveyTaskPeriod 问卷任务期次
     * @return 结果
     */
    @Override
    public int updateSurveyTaskPeriod(SurveyTaskPeriod surveyTaskPeriod)
    {
        return surveyTaskPeriodMapper.updateSurveyTaskPeriod(surveyTaskPeriod);
    }

    /**
     * 批量删除问卷任务期次
     * 
     * @param ids 需要删除的问卷任务期次主键
     * @return 结果
     */
    @Override
    public int deleteSurveyTaskPeriodByIds(Long[] ids)
    {
        return surveyTaskPeriodMapper.deleteSurveyTaskPeriodByIds(ids);
    }

    /**
     * 删除问卷任务期次信息
     * 
     * @param id 问卷任务期次主键
     * @return 结果
     */
    @Override
    public int deleteSurveyTaskPeriodById(Long id)
    {
        return surveyTaskPeriodMapper.deleteSurveyTaskPeriodById(id);
    }


    @Override
    public List<SurveyTaskPeriod> selectSurveyTaskPeriodListByTaskId(Long taskId) {
        return surveyTaskPeriodMapper.selectSurveyTaskPeriodListByTaskId(taskId);
    }

    @Override
    public void deleteSurveyTaskPeriodByTaskId(Long taskId) {
        surveyTaskPeriodMapper.deleteSurveyTaskPeriodByTaskId(taskId);

    }

    @Override
    public PeriodDataDto getPeriodData(Long taskId) {
        PeriodDataDto periodDataDto = surveyTaskPeriodMapper.getPeriodData(taskId);
        return periodDataDto;
    }

    @Override
    public Long getPeriodNum(Long taskId) {
        Long periodNum = surveyTaskPeriodMapper.getPeriodNum(taskId);
        return periodNum;
    }
}
