package com.zhiwei.manage.service;

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

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

import com.zhiwei.manage.bean.EasyNews;
import com.zhiwei.manage.bean.News;
import com.zhiwei.manage.dao.NewsDao;
import com.zhiwei.manage.util.ESUtil;
@Service
public class NewsServiceImpl implements NewsService{
	
	@Autowired
	private NewsDao newsDao;

	@Override
	public List<News> findByNew(int delayedCount, String type, String source) {
		return newsDao.findByNew(delayedCount, type, source);
	}

	@Override
	public List<News> findByFiled(int filedCount, String type, String source) {
		return newsDao.findByFiled(filedCount, type, source);
	}

	@Override
	public int findCount(String spyId,Date start,Date end) {
		return (int) newsDao.findCount(spyId, start, end);
	}

	@Override
	public List<Object> findAllSource() {
		return newsDao.findSource();
	}

	@Override
	public int findCountBySource(String source, Date start, Date end) {
		return newsDao.findBySource(source, start, end);
	}

	@Override
	public List<EasyNews> findAllNews(Date start, Date end) {
		return newsDao.finAllNews(start, end);
	}


	@Override
	public List<Map<String, Object>> findNews(String host, int port, String dbNamel, String collection, int count,
			String id,String pt) {
		return ESUtil.getDatasMap(host, port, dbNamel, collection, count, id, pt);
	}
	
	

}
