package com.fs.company.service;

import java.math.BigDecimal;
import java.time.LocalTime;
import java.util.List;

import com.fs.common.core.domain.R;
import com.fs.company.domain.Company;
import com.fs.company.domain.CompanyUser;
import com.fs.company.param.CompanyLiveShowParam;
import com.fs.company.param.CompanyParam;
import com.fs.company.vo.CompanyCrmVO;
import com.fs.company.vo.CompanyNameVO;
import com.fs.company.vo.CompanyVO;
import com.fs.company.vo.DeptDataVO;
import com.fs.his.domain.FsInquiryOrder;
import com.fs.his.domain.FsStoreOrder;
import com.fs.his.domain.FsStorePayment;
import com.fs.his.vo.OptionsVO;
import com.fs.hisStore.domain.FsStoreOrderScrm;
import com.fs.hisStore.domain.FsStorePaymentScrm;
import com.fs.live.domain.LiveOrder;
import org.springframework.transaction.annotation.Transactional;


/**
 * 企业Service接口
 *
 * @author fs
 * @date 2021-10-04
 */
public interface ICompanyService
{
     List<OptionsVO> selectAllCompanyList(Long deptId) ;

    /**
     * 查询企业
     *
     * @param companyId 企业ID
     * @return 企业
     */
    public Company selectCompanyById(Long companyId);

    /**
     * 查询企业列表
     *
     * @param company 企业
     * @return 企业集合
     */
    public List<Company> selectCompanyList(Company company);

    /**
     * 新增企业
     *
     * @param company 企业
     * @return 结果
     */
    public R insertCompany(Company company);

    /**
     * 修改企业
     *
     * @param company 企业
     * @return 结果
     */
    public int updateCompany(Company company);

    /**
     * 批量删除企业
     *
     * @param companyIds 需要删除的企业ID
     * @return
     */
    public int deleteCompanyByIds(Long[] companyIds);

    /**
     * 删除企业信息
     *
     * @param companyId 企业ID
     * @return 结果
     */
    public int deleteCompanyById(Long companyId);

    List<CompanyVO> selectCompanyVOList(CompanyParam param);
    List<CompanyNameVO> selectCompanyNameVOList(CompanyParam param);

    List<CompanyCrmVO> selectCompanyCrmDayCountList(CompanyParam param);

    Integer selectCompanyCount();

    void addCompanyTuiMoney(FsStoreOrder order);


    @Transactional
    void addCompanyTuiMoney(FsStoreOrderScrm order);

    void addCompanyMoney(FsStoreOrder order);

    @Transactional
    void addCompanyMoney(FsStoreOrderScrm order);

    @Transactional
    void addCompanyMoney(LiveOrder order);

    void subCompanyMoney(FsStoreOrder order);

    @Transactional
    void subCompanyMoney(FsStoreOrderScrm order);

    Company selectCompanyByAppId(String appId);

    void resetMoney(Long companyId);

    void addCompanyPaymentMoney(FsStorePayment storePayment);

    @Transactional
    void addCompanyPaymentMoney(FsStorePaymentScrm storePayment);

    void subCompanyPaymentMoney(FsStorePayment payment);

    @Transactional
    void subCompanyPaymentMoney(FsStorePaymentScrm payment);

    String selectOmsCodeByCompanyId(Long companyId);

    void updateOmsCodeByCompanyIds(List<Long> companyIds,String omsCode);

    List<Long> selectCompanyByOmsCode(String omsCode);

    List<CompanyVO> selectCompanyListVO(Company company);

    void subtractCompanyMoney(FsStoreOrder order);

    @Transactional
    void subtractCompanyMoneyScrm(FsStoreOrderScrm order);

    void inquirySubtractCompanyMoney(FsInquiryOrder order);
    void refundCompanyMoney(FsStoreOrder order);

    @Transactional
    void refundCompanyMoneyScrm(FsStoreOrderScrm order);

    Company selectCompanyByIdForUpdate(Long companyId);

    public void subtractCompanyMoney(BigDecimal money, Long companyId);

    List<Long> selectCompanyIds();

    /**
     * 查询多个公司的名字
     * @param companyIds
     * @return
     */
    String selectCompanyByIds(String companyIds);

    List<DeptDataVO> getDeptData(Long companyId);
    List<DeptDataVO> getDeptData(Long companyId,Long currentCompanyUserId,Long currentDeptId);

    void configUserCheck(Long companyId, Integer userIsDefaultBlack);

    void addRedPacketCompanyMoney(BigDecimal money, Long companyId);
    /**
     * 根据多个id查询多个qw_user_id
     * @param result
     * @return
     */
    List<CompanyUser> selectCompanyListByIds(String result);

    /**
     * 查询企微主体管理公司列表
     */
    List<OptionsVO> getCompanyListByCorpId(String corpId);

    void subtractCompanyMoneyHourse(BigDecimal money, Long companyId, LocalTime start, LocalTime end);

    void syncCompanyBalance();

    void redPacketTopUpCompany(Long companyId, BigDecimal money,String type);

    void asyncRecordBalanceLog(Long companyId, BigDecimal money,Integer logType, BigDecimal balance, String remark);

    void recordRedPacketBalance();

    /**
     * 批量更新公司余额
     * @param list 公司列表
     */
    void batchUpdateCompany(List<Company> list);

    void rollbackRedPacketMoney();


    List<CompanyVO> liveShowList(CompanyParam param);

    void batchUpdateLiveShow(CompanyLiveShowParam param);

    void addCompanyTuiLiveMoney(LiveOrder order);

    void subLiveCompanyMoney(LiveOrder order);
}
