package com.huiju.estateagents.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.huiju.estateagents.base.ResponseBean;
import com.huiju.estateagents.entity.TaBuildingApartment;
import com.huiju.estateagents.entity.TaHousingResources;
import com.huiju.estateagents.po.TaHousingResourcesPO;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 房源表  服务类
 * </p>
 *
 * @author jobob
 * @since 2020-02-10
 */
public interface ITaHousingResourcesService extends IService<TaHousingResources> {

    /* 分页获取房源列表
     *
     * @param salesBatchId 销售批次ID
     * @param startPrice
     * @param endPrice
     * @param apartmentId
     * @param type  为1只展示已发布的房源
     * @return
     */
    List<TaHousingResourcesPO> listHousingResources(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId, String personId, String source);


    /* 分页获取房源列表-后台管理端
     *
     * @param salesBatchId 销售批次ID
     * @param startPrice
     * @param endPrice
     * @param apartmentId
     * @param type  为1只展示已发布的房源
     * @return
     */
    List<TaHousingResourcesPO> listHousingResourcesForCms(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId, Integer type);

    /**
     * 获取某销售批次下所有房源户型
     *
     * @param salesBatchId
     * @return
     */
    List<TaBuildingApartment> listBuildApartmentBySalesBatchId(String salesBatchId);

    /**
     * 根据房源ID获取房源详情
     *
     * @param personId 用户ID
     * @param houseId  房源ID
     * @return
     */
    TaHousingResourcesPO getHousingDetailById(String personId, Integer houseId) throws Exception;

    /**
     * 校验楼栋信息存不存在
     *
     * @param taHousingResources
     * @return
     */
    StringBuffer checked(TaHousingResources taHousingResources);

    /**
     * 添加楼栋信息
     *
     * @param taHousingResources
     * @return
     */
    ResponseBean addHouseResources(TaHousingResources taHousingResources);

    /**
     * 分页获取房源信息
     *
     * @param salesBatchId
     * @param buildingId
     * @param pageNumber
     * @param pageSize
     * @param orgId
     * @param termName
     * @param blockName
     * @param unitName
     * @param floorName
     * @param roomName
     * @param apartmentId
     * @param status
     * @param houseId
     * @return
     */
    ResponseBean selectPageList(Integer salesBatchId, String buildingId, Integer pageNumber, Integer pageSize, Integer orgId, String termName,
                                String blockName, String unitName, String floorName, String roomName, String apartmentId, Integer status, String houseId, String lockingStatus,
                                String actulStartHot, String actulEndHot);

    /**
     * 更新房源信息
     *
     * @param taHousingResources
     * @return
     */
    ResponseBean updateHouseResources(TaHousingResources taHousingResources);

    /**
     * 获取表格中的数据
     *
     * @param file
     * @param salesBatchId
     * @param buildingId
     * @param orgId
     * @return
     */
    ResponseBean getExcelData(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId);

    /**
     * 保存文件
     *
     * @param file
     * @param salesBatchId
     * @param buildingId
     * @param orgId
     * @return
     */
    ResponseBean saveExcelValue(MultipartFile file, Integer salesBatchId, String buildingId, Integer orgId);

    /**
     * 批量更新认筹基础数据
     *
     * @param housingResourcesList
     * @param raiseHeat
     * @param salesBatchId
     * @param orgId
     * @return
     */
    ResponseBean batchUpdateRaiseHeat(List<TaHousingResources> housingResourcesList, Integer raiseHeat, Integer salesBatchId, Integer orgId, Integer updateUser);

    /**
     * 批量更新预选基础数据
     *
     * @param housingResourcesList
     * @param heat
     * @param salesBatchId
     * @param orgId
     * @param updateUser
     * @return
     */
    ResponseBean batchUpdateHeat(List<TaHousingResources> housingResourcesList, Integer heat, Integer salesBatchId, Integer orgId, Integer updateUser);

    /**
     * 根据认筹记录查询房源信息
     *
     * @param raiseRecordId
     * @param orgId
     * @param pageNumber
     * @param pageSize
     * @return
     */
    ResponseBean listHouseByRaiseRecordId(Integer raiseRecordId, Integer orgId, Integer pageNumber, Integer pageSize);

    /**
     * 更新房源状态
     *
     * @param houseId
     * @param type
     * @param orgId
     * @param personId
     * @return
     */
    ResponseBean updateLockingStatus(Integer houseId, String type, Integer orgId, Integer raiseHouseId, String personId, Integer raiseRecordId, Integer userId);

    /**
     * 校验房源的认筹状态
     *
     * @param houseIds
     * @param personId
     * @param orgId
     * @return
     */
    boolean checkRaiseState(String houseIds, String personId, Integer orgId) throws Exception;
}
