package com.ym.mec.biz.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ym.mec.biz.dal.dao.TenantInfoDao;
import com.ym.mec.biz.dal.dto.TenantInfoDto;
import com.ym.mec.biz.dal.entity.*;
import com.ym.mec.biz.dal.enums.TenantOrderRecordEnum;
import com.ym.mec.biz.dal.vo.TenantInfoPageVo;
import com.ym.mec.common.page.PageInfo;
import org.redisson.api.RBucket;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Map;

public interface TenantInfoService extends IService<TenantInfo> {

    TenantInfoDao getDao();

    void addTenantInfo(TenantInfoDto dto);

    void updateTenantInfo(TenantInfoDto dto);

    TenantInfoDto queryTenantInfo(Integer tenantId);

    TenantInfoDto queryTenantInfoCheck(Integer tenantId);

    Map<String, Object> opsTenantState(Integer id, Integer state);

    PageInfo<TenantInfoPageVo> queryPage(Map<String, Object> param);

    TenantInfo get(Integer tenantId);

    String getContract(Integer tenantId, TenantContractRecord.TenantContractRecordEnum en, Integer val);

    Map<String, Object> tenantOpenPay(Integer tenantId) throws Exception;

    Map<String, Object> tenantRenewPay(Integer tenantId, Integer val) throws Exception;

    RBucket<Integer> opsRenewInfo(Integer tenantId);

    void renewSuccess(Integer val, TenantProductInfo productInfo, BigDecimal amount);

    TenantOrderRecord createOrderRecord(Integer tenantId, BigDecimal payAmount, String orderNo, TenantOrderRecordEnum
            tenantEnum, Integer orderState, String merNos);

    void tenantOpenSuccess(Integer tenantId);

    Map<String, Object> recharge(Integer tenantId, BigDecimal amount) throws Exception;

    Boolean rechargeCheck(String orderNo) throws Exception;

    TenantProductSumm queryTenantInfoProductSumm(Integer id);

    /**
     * @param request
     * @return void
     * @description: 保存tenantId
     * @author zx
     * @date 2022/1/7 14:42
     */
    void saveTenantContextHolder(HttpServletRequest request);

    /**
     * 按部门查询机构信息
     *
     * @return 机构信息
     */
    TenantInfo queryTenantInfoByOrgan(Integer organId);

    void updatePhone(String newPhone, String oldPhone);

    void checkTenantState();
}