package com.style24.batch.biz.service;

import java.util.Collection;

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

import com.style24.batch.biz.dao.TsbDeliveryDao;
import com.style24.batch.support.env.TsbConstants;
import com.style24.persistence.domain.Delivery;

import lombok.extern.slf4j.Slf4j;

/**
 * 배치 Service
 *
 * @author moon
 * @since 2020. 12. 08
 */
@Service
@Slf4j
public class TsbDeliveryService {

	@Autowired
	private TsbDeliveryDao deliveryDao;

	/**
	 * 총알배송 권역정보 갱신 
	 * @param  Collection<Delivery>
	 * @return 
	 * @author moon
	 * @since  2020. 12. 08
	 */
	public void mergeDailyDeliveryZone(Collection<Delivery> dailyDeliZoneList) {
        
		for(Delivery delivery : dailyDeliZoneList) {
			deliveryDao.mergeDailyDeliveryZone(delivery);
		}
	}

	/**
	 * 배치로그 생성
	 * @param batchId - 배치ID
	 * @return 배치로그일련번호
	 * @author gagamel
	 * @since 2020. 12. 2
	 */
//	@Transactional("shopTxnManager")
//	public Integer createBatchLog(String batchId) {
//
//		BatchLog batchLog = new BatchLog();
//		batchLog.setBatchId(batchId);
//		batchLog.setRegNo(TsbConstants.REG_NO);
//		batchDao.createBatchLog(batchLog);
//
//		return batchLog.getBatchLogSq();
//	}

	/**
	 * 배치로그 종료 처리
	 * @param batchLogSq - 배치로그일련번호
	 * @return
	 * @author gagamel
	 * @since 2020. 12. 2
	 */
//	public void updateBatchLog(Integer batchLogSq) {
//		batchDao.updateBatchLog(batchLogSq);
//	}

}
