package com.reyun.service.impl;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.reyun.model.ReportLog;
import com.reyun.repository.ReportLogRepository;
import com.reyun.service.ReportLogService;

@Service
public class ReportLogServiceImpl implements ReportLogService {
	protected Logger logger = LoggerFactory.getLogger(ReportLogServiceImpl.class);

	
	@Autowired
	ReportLogRepository reportLogRepository;
	@Override
	public boolean updateTimes(String reportName, String category) {
		try {
			/*ReportLog log = reportLogRepository.findByReportNameAndCategory(reportName, category);
			if (log == null) {
				log = new ReportLog();
				log.setCategory(category);
				log.setModifyDate(new Date());
				log.setReportName(reportName);
			}
			log.setTimes(log.getTimes() == null ? 1 : log.getTimes() + 1);
			reportLogRepository.save(log);*/
			return true;
		} catch (Exception e) {
			logger.error("fail to update report log");
			e.printStackTrace();
		}
		return true;
	}
	

}
