package com.style24.batch.biz.job.display;

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

import com.style24.batch.biz.job.TsbAbstractJob;
import com.style24.batch.biz.service.TsbDisplayService;

import lombok.extern.slf4j.Slf4j;

/**
 * 최근등록된 상품 생성
 * 		1.몰메인(브랜드그룹번호 0)과 브랜드메인에서 사용됨
 * 		2.일배치
 *
 * @author gagamel
 * @since 2021. 7. 9
 */
@Component
@Slf4j
public class TsbRecentlyRegGoodsJob extends TsbAbstractJob<String, String, String> {

	@Autowired
	private TsbDisplayService displayService;

	@Override
	public String read() throws Exception {
		return "OK";
	}

	@Override
	public String process(String result) throws Exception {
		int cnt = displayService.createRecentlyRegisterGoods();
		log.info("최근등록된 상품 생성: 총 {}건", cnt);
		return result;
	}

	@Override
	public String write(String result) throws Exception {
		return result;
	}

	@Override
	public void notify(String result) throws Exception {
		// Do nothing
	}

}