package com.zehong.system.service.impl;

import java.util.Date;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TSupBalStopSupMapper;
import com.zehong.system.domain.TSupBalStopSup;
import com.zehong.system.service.ITSupBalStopSupService;

/**
 * 供需平衡-停气监管Service业务层处理
 * 
 * @author zehong
 * @date 2024-06-21
 */
@Service
public class TSupBalStopSupServiceImpl implements ITSupBalStopSupService 
{
    @Autowired
    private TSupBalStopSupMapper tSupBalStopSupMapper;

    /**
     * 查询供需平衡-停气监管
     * 
     * @param fGasStopId 供需平衡-停气监管ID
     * @return 供需平衡-停气监管
     */
    @Override
    public TSupBalStopSup selectTSupBalStopSupById(Long fGasStopId)
    {
        return tSupBalStopSupMapper.selectTSupBalStopSupById(fGasStopId);
    }

    /**
     * 查询供需平衡-停气监管列表
     * 
     * @param tSupBalStopSup 供需平衡-停气监管
     * @return 供需平衡-停气监管
     */
    @Override
    public List<TSupBalStopSup> selectTSupBalStopSupList(TSupBalStopSup tSupBalStopSup)
    {
        return tSupBalStopSupMapper.selectTSupBalStopSupList(tSupBalStopSup);
    }

    /**
     * 新增供需平衡-停气监管
     * 
     * @param tSupBalStopSup 供需平衡-停气监管
     * @return 结果
     */
    @Override
    public int insertTSupBalStopSup(TSupBalStopSup tSupBalStopSup)
    {
        tSupBalStopSup.setCreateTime(DateUtils.getNowDate());
        tSupBalStopSup.setfCompanyInfoId(SecurityUtils.getLoginUser().getUser().getDeptId());
        return tSupBalStopSupMapper.insertTSupBalStopSup(tSupBalStopSup);
    }

    /**
     * 修改供需平衡-停气监管
     * 
     * @param tSupBalStopSup 供需平衡-停气监管
     * @return 结果
     */
    @Override
    public int updateTSupBalStopSup(TSupBalStopSup tSupBalStopSup)
    {
        tSupBalStopSup.setUpdateTime(DateUtils.getNowDate());
        if("2".equals(tSupBalStopSup.getfStopProgress())){
            tSupBalStopSup.setfRecoveryGasTime(new Date());
        }
        return tSupBalStopSupMapper.updateTSupBalStopSup(tSupBalStopSup);
    }

    /**
     * 批量删除供需平衡-停气监管
     * 
     * @param fGasStopIds 需要删除的供需平衡-停气监管ID
     * @return 结果
     */
    @Override
    public int deleteTSupBalStopSupByIds(Long[] fGasStopIds)
    {
        return tSupBalStopSupMapper.deleteTSupBalStopSupByIds(fGasStopIds);
    }

    /**
     * 删除供需平衡-停气监管信息
     * 
     * @param fGasStopId 供需平衡-停气监管ID
     * @return 结果
     */
    @Override
    public int deleteTSupBalStopSupById(Long fGasStopId)
    {
        return tSupBalStopSupMapper.deleteTSupBalStopSupById(fGasStopId);
    }
}
