package com.sptg.estate.api.feigns;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.estate.api.dto.ResidentialDto;
import com.sptg.estate.api.entity.Residential;
import com.sptg.estate.api.feigns.fallback.ResidentialFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * title: ResidentialFeign
 * package: com.sptg.estate.api.feigns.fallback
 * description: 小区 服务接口
 *
 *             
 *                
 */
@FeignClient(value = "smart-house-estate",fallbackFactory = ResidentialFeignFallbackFactory.class)
public interface ResidentialFeign {
    /**
     * 功能描述:小区列表查询
     * @param residentialDto 小区业务对象（含分页及查询条件）
     * @return  ResultBean<Page<Residential>>
     *             
     *                      
     */
    @PostMapping(value = "/residential/showResidentialList")
    ResultBean<Page<Residential>> showResidentialList(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:新增小区
     * @param residentialDto 小区业务对象
     * @return ResultBean<Boolean>
     *             
     *                      
     */
    @PostMapping(value = "/residential/addResidential")
    ResultBean<Residential> addResidential(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:根据Id查找小区
     * @param id 必填
     * @return Residential
     *             
     *                      
     */
    @GetMapping(value = "/residential/findResidentialById/{id}")
    Residential findResidentialById(@PathVariable(value = "id")Long id);

    /**
     * 功能描述:编辑小区
     * @param residentialDto 小区业务对象
     * @return ResultBean<Boolean>
     *             
     *                       
     */
    @PostMapping(value = "/residential/updateResidential")
    ResultBean<Boolean> updateResidential(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:删除小区
     * @param residentialDto 小区业务对象
     * @return ResultBean<Boolean>
     *             
     *                       
     */
    @PostMapping(value = "/residential/deleteResidential")
    ResultBean<Boolean> deleteResidential(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:小区放入垃圾箱
     * @param residentialDto 小区业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/residential/trashOrRecover")
    ResultBean<Boolean> trashOrRecover(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:批量删除小区
     * @param residentialDto 小区业务对象
     * @return ResultBean<Boolean>
     *             
     *                       
     */
    @PostMapping(value = "/residential/deleteResidentialList")
    ResultBean<Boolean> deleteResidentialList(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:根据位置查找小区
     * @param residentialDto 小区业务对象
     * @return ResultBean<Boolean>
     *             
     *                       
     */
    @PostMapping(value = "/residential/findListByPosition")
    ResultBean<Residential> findListByPosition(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:分页查询按小区分组统计住户人数列表
     * @param residentialDto
     * @return  ResultBean<Page<Residential>>
     *                
     *                       
     */
    @PostMapping(value = "/residential/statisticsUserCountList")
    ResultBean<Page<Residential>> statisticsUserCountList(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:查询按小区分组统计住户人数列表
     * @param residentialDto
     * @return java.util.List<com.sptg.estate.api.entity.Residential>
     *                
     *                      
     */
    @PostMapping(value = "/residential/getStatisticsUserCountList")
    List<Residential> getStatisticsUserCountList(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述: 根据小区Id列表 查询小区
     * @param idList 小区Id列表
     * @return List<Residential>
     *                  
     *                       
     */
    @PostMapping(value = "/residential/getByOrgIdList")
    List<Residential> getByOrgIdList(@RequestBody List<Long> idList);

    /**
     * 功能描述:住户总人数
     * @param orgPosition
     * @return ResultBean<Long>
     *                
     *                       
     */
    @PostMapping(value = "/residential/statisticsUserCount")
    ResultBean<Long> statisticsUserCount(@RequestParam(value = "orgPosition") String orgPosition);

    /**
     * 功能描述:导入小区
     * @param list 小区业务对象集合
     * @return ResultBean<Boolean>
     *             
     *                     
     */
    @PostMapping(value = "/residential/importResidentialList")
    ResultBean<Boolean> importResidentialList(@RequestBody List<ResidentialDto> list);

    /**
     * 功能描述:根据位置查询小区数量
     * @param residentialDto 小区业务传输对象
     * {
     *    orgPosition : 位置信息
     * }
     * @return ResultBean<Map<String,Integer>>
     *             
     *                      
     */
    @PostMapping(value = "/residential/getResidentialAccount")
    ResultBean<Map<String,Integer>> getResidentialAccount(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:根据区编号查询
     * @param residential 小区业务传输对象
     * @return
     *               
     *                      
     */
    @PostMapping(value = "/residential/getByRegionArea")
    ResultBean<Residential> getByRegionArea(@RequestBody Residential residential);

    /**
     * 功能描述:根据位置查询小区数量
     * @param residentialDto 小区业务传输对象
     * {
     *    orgPosition : 位置信息
     * }
     * @return long
     *                
     *                      
     */
    @PostMapping(value = "/residential/getResidentialCount")
    Integer getResidentialCount(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:根据位置查询单元数量
     * @param residentialDto 小区业务传输对象
     * {
     *    orgPosition : 位置信息
     * }
     * @return long
     *                
     *                      
     */
    @PostMapping(value = "/residential/getUnitCount")
    Long getUnitCount(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:按城市分组设备,小区,住户(跨数据库查询)
     * @param residentialDto 小区业务传输对象
     * {
     *    regionProvince : 省份
     *    orgPosition : 位置信息
     * }
     * @return  List<Map<String,Object>>
     *                
     *                      
     */
    @PostMapping(value = "/residential/statisticsCityCountList")
    List<Map<String,Object>> statisticsCityCountList(@RequestBody ResidentialDto residentialDto);

    /**
     * 功能描述:根据名称和地址查询
     * @param residentialDto 小区业务对象
     * @return int 数量
     *             
     *                      
     */
    @PostMapping(value = "/residential/getResidentialByNameAndRegion")
    int getResidentialByNameAndRegion(@RequestBody ResidentialDto residentialDto);
    
    /**
     * 功能描述:根据小区编号查找小区
     * @param residentialNumber 小区编号
     * @return Residential
     *             
     *                      
     */
    @GetMapping(value = "/residential/findResidentialByNumber/{residentialNumber}")
    Residential findResidentialByNumber(@PathVariable(value = "residentialNumber")String residentialNumber);

    /**
     * 功能描述:获取有区域权限小区用户数量
     * @param orgPosition 位置信息
     * @return long
     *                
     *                      
     */
    @PostMapping(value = "/residential/getUserCountForRegionAuthorize")
    long getUserCountForRegionAuthorize(@RequestParam(value = "orgPosition") String orgPosition);

    @PostMapping(value = "/residential/updateResidentialEntity")
    ResultBean<Boolean> updateResidentialEntity(@RequestBody Residential residential);

    @PostMapping(value = "/residential/getListByCondition")
    ResultBean<Residential> getListByCondition(@RequestBody ResidentialDto residentialDto);

    @PostMapping(value = "/residential/updateEntity")
    boolean updateEntity(@RequestBody Residential residential);

    /**
     * 功能描述: 根据名称模糊查询
     * @param dto
     * @return List<Residential>
     *
     */
    @PostMapping(value = "/residential/getListByLikeName")
    List<Residential> getListByLikeName(@RequestBody ResidentialDto dto);

    @GetMapping(value = "/residential/{oldId}")
    Residential getByOldId(@PathVariable(value = "oldId") String oldId);
//
//    @PostMapping(value = "residential/getResidentialList")
//    ResultBean<Residential> getResidentialList(ResidentialDto residentialDto);
}
