package com.zhiwei.manage.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiwei.manage.bean.Data;
import com.zhiwei.manage.bean.EasyNews;
import com.zhiwei.manage.dao.CrawTemplateDao;
import com.zhiwei.manage.dao.DataDao;
@Service
public class DataServiceImpl implements DataService{

	@Autowired
	private DataDao dataDao;
	@Autowired
	private CrawTemplateDao crd;
	
	@Override
	public void insert(Data data) {
		dataDao.insert(data);
	}

	@Override
	public List<Data> findByPt(Date startTime, Date endTime, String pt) {
		return dataDao.findByPt(startTime, endTime, pt);
	}

	@Override
	public List<Data> findBySource(Date startTime, Date endTime, String source) {
		return dataDao.findBySource(startTime, endTime, source);
	}

	@Override
	public List<Data> findBytempName(Date startTime, Date endTime, String tempName) {
		return dataDao.findBytempName(startTime, endTime, tempName);
	}

	@Override
	public List<EasyNews> findByAccurateSource(String startTime, String endTime, String source) {
		return dataDao.findByAccurateSource(startTime, endTime, source);
	}

	@Override
	public List<EasyNews> findByAccurateSpId(String startTime, String endTime, String SpId) {
		return dataDao.findByAccurateSpId(startTime, endTime, SpId);
	}

	@Override
	public long findWeiboCount(Date start, Date end) {		
		return dataDao.findWeiboCount(start, end);
	}

	@Override
	public long findWeixinCount(Date start, Date end,String pt) {
		return dataDao.findWeixinCount(start, end,pt);
	}

	@Override
	public List<EasyNews> findBySourceFromLibrary(Date startTime, Date endTime, String source) {
		return dataDao.findBySourceFromLibrary(startTime, endTime, source);
	}

	@Override
	public List<String> findSourceByLikeParam(String param) {
		return dataDao.findSourceByLikeParam(param);
	}

	@Override
	public List<String> findTmpNameByLikeParam(String param) {
		return dataDao.findTmpNameByLikeParam(param);
	}

	@Override
	public List<EasyNews> findByAccurateType(Date startTime, Date endTime, String type) {
		return dataDao.findByAccurateType(startTime, endTime, type);
	}

	@Override
	public List<String> findTypeByLikeParam(String param) {
		return dataDao.findTypeByLikeParam(param);
	}

	@Override
	public List<Data> findByMethod(Date startTime, Date endTime, String method, Object value) {
		return dataDao.findByMethod(startTime, endTime, method, value);
	}

	@Override
	public long finCountByDayData(Date startTime, Date endTime, String pt, String id) {
		return dataDao.finCountByDayData(startTime, endTime, pt, id);
	}

	@Override
	public List<EasyNews> findByTempName(Date startTime, Date endTime, String tempName) {
		String spId=crd.getSpIdByConfigName(tempName);
		return dataDao.findBySpId(startTime, endTime, spId);
	}
	
	

}
