package com.zcloud.service.bus.impl;

import java.util.List;

import com.zcloud.mapper.dsno2.corp.CorpTimeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.bus.CorpTimeService;

/**
 * 说明：企业有效期日志
 * 作者：luoxiaobao
 * 时间：2022-03-03
 * 官网：www.zcloudchina.com
 */
@Service
@Transactional //开启事物
public class CorpTimeServiceImpl implements CorpTimeService{

	@Autowired
	private CorpTimeMapper corpTimeMapper;

	/**新增
	 * @param pd
	 * @throws Exception
	 */
	public void save(PageData pd)throws Exception{
		corpTimeMapper.save(pd);
	}

	/**删除
	 * @param pd
	 * @throws Exception
	 */
	public void delete(PageData pd)throws Exception{
		corpTimeMapper.delete(pd);
	}

	/**修改
	 * @param pd
	 * @throws Exception
	 */
	public void edit(PageData pd)throws Exception{
		corpTimeMapper.edit(pd);
	}

	/**列表
	 * @param page
	 * @throws Exception
	 */
	public List<PageData> list(Page page)throws Exception{
		return corpTimeMapper.datalistPage(page);
	}

	/**列表(全部)
	 * @param pd
	 * @throws Exception
	 */
	public List<PageData> listAll(PageData pd)throws Exception{
		return corpTimeMapper.listAll(pd);
	}

	/**通过id获取数据
	 * @param pd
	 * @throws Exception
	 */
	public PageData findById(PageData pd)throws Exception{
		return corpTimeMapper.findById(pd);
	}

	/**批量删除
	 * @param ArrayDATA_IDS
	 * @throws Exception
	 */
	public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
		corpTimeMapper.deleteAll(ArrayDATA_IDS);
	}

	/**获取所有企业在日期内。但是isin字段为0的数据
	 * @param pd
	 * @throws Exception
	 */
	public List<PageData> getInTimeList(PageData pd)throws Exception{
		return corpTimeMapper.getInTimeList(pd);
	}

	/**修改到周期内
	 * @param pd
	 * @throws Exception
	 */
	public void editInPeriod(PageData pd)throws Exception{
		corpTimeMapper.editInPeriod(pd);
	}

	/**修改到周期外
	 * @param pd
	 * @throws Exception
	 */
	public void editOutPeriod(PageData pd)throws Exception{
		corpTimeMapper.editOutPeriod(pd);
	}
	/**
	 * 查询企业最终到期时间
	 */
	public PageData findMaxEndDate(PageData pd) throws Exception {
		return corpTimeMapper.findMaxEndDate(pd);
	}

	@Override
	public void updateCorpTime(PageData pd) throws Exception {
		corpTimeMapper.updateCorpTime(pd);
	}

	/**
	 * 保存定时停用企业
	 * @param stopSchedule
	 */
	@Override
	public void saveStopSchedule(PageData stopSchedule) throws Exception {
		corpTimeMapper.saveStopSchedule(stopSchedule);
	}

	/**
	 * 获取要停用的企业列表
	 * @return
	 */
	@Override
	public List<PageData> getStopCorpScheduledList() throws Exception {
		return corpTimeMapper.getStopCorpScheduledList();
	}
}

