package com.iwunu.nbiot.lock.service.impl;

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

import com.iwunu.nbiot.common.util.DateUtil;
import com.iwunu.nbiot.lock.entity.ReportLog;
import com.iwunu.nbiot.lock.repository.IotLogRepository;
import com.iwunu.nbiot.lock.service.IotLogService;

@Service
public class IotLogServiceImpl implements IotLogService{
	@Autowired
	private IotLogRepository iotNbLogRepository;

	@Override
	public void updateLog(String deviceId,String random,Integer status) {
		 iotNbLogRepository.updateLog(deviceId,random,DateUtil.nowDateTime(),status);
	
	}

	@Override
	public void saveLog(ReportLog reportLog) {
		try {
			iotNbLogRepository.saveAndFlush(reportLog);
		} catch (Exception e) {
			e.getMessage();
			e.printStackTrace();
		}
		
	}
}
