package cn.com.victorysoft.business.calc.service;

import cn.com.victorysoft.business.calc.dao.AbnormalDataSyncDao;
import cn.com.victorysoft.business.calc.dao.ConditionDataSyncDao;
import cn.com.victorysoft.business.condition.service.AbnormalUnitService;
import cn.com.victorysoft.business.condition.service.AbnormalWellService;
import cn.com.victorysoft.business.condition.service.ConditionUnitService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;

/**
 * 工况数据同步服务
 */
@Slf4j
@Service
public class ConditionDataSyncService {

    @Resource
    private ConditionUnitService conditionUnitService;
    @Resource
    private ConditionDataSyncDao conditionDataSyncDao;

    /**
     * 汇总
     */
    @Transactional
    public void summary(Date date) {
        // 先删除
        conditionUnitService.deleteByDate(date);
        conditionDataSyncDao.summary(date);
    }
}
