package com.bankaudit.service;

import com.bankaudit.constants.BankAuditConstant;
import com.bankaudit.dao.ExcelMaintEntityDao;
import com.bankaudit.dao.MaintEntityDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("excelMaintEntityService")
public class ExcelMaintEntityServiceImpl implements ExcelMaintEntityService{

    @Autowired
    MaintEntityDao maintEntityDao;

    @Autowired
    ExcelMaintEntityDao excelMaintEntityDao;

    @Override
    @Transactional("transactionManager")
    public void createTempMaintEntity(Integer legalEntityCode, String userId, Integer uploadDocId) {
        maintEntityDao.saveMaintEntity(legalEntityCode, userId, uploadDocId);
        maintEntityDao.flushSession();
    }

    @Override
    @Transactional("transactionManager")
    public void updateMaintEntityData(Integer uploadDocId) {
        excelMaintEntityDao.updateTempMaintEntity(uploadDocId);
        excelMaintEntityDao.flushSession();
    }
}
