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.AccessRecordsDto;
import com.sptg.estate.api.entity.AccessRecords;
import com.sptg.estate.api.feigns.fallback.AccessRecordsFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

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

/**
 * title: AccessRecordsFeignFallbackFactory
 * package: com.sptg.estate.api.feigns
 * description: 出入记录 服务接口
 *
 *
 *
 */
@FeignClient(value = "smart-house-estate",fallbackFactory = AccessRecordsFeignFallbackFactory.class)
public interface AccessRecordsFeign {

    /**
     * 功能描述:出入记录查询列表
     * @param accessRecordsDto 出入记录业务对象（含分页及查询条件）
     * @return ResultBean<Page<AccessRecords>>
     *
     *
     */
    @PostMapping(value = "/accessRecords/showAccessRecordsList")
    ResultBean<Page<AccessRecords>> showAccessRecordsList(@RequestBody AccessRecordsDto accessRecordsDto);

    /**
     * 功能描述:memberId查询出入记录
     * @param accessRecordsDto 出入记录业务对象（含分页及查询条件）
     * @return ResultBean<Page<AccessRecords>>
     *
     *
     */
    @PostMapping(value = "/accessRecords/accessRecordsListByMemberId")
    ResultBean<Page<AccessRecords>> accessRecordsListByMemberId(@RequestBody AccessRecordsDto accessRecordsDto);


    @PostMapping(value = "/accessRecords/addRecords")
    ResultBean<?> addRecords(@RequestBody AccessRecords records);


    /**
     * 功能描述:新增出入记录
     * @param records 出入记录业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/accessRecords/addAccessRecords")
    ResultBean<Boolean> addAccessRecords(@RequestBody AccessRecords records);

    /**
     * 功能描述:新增出入记录
     * @param records 出入记录业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/accessRecords/addDHAccessRecords")
    ResultBean<Boolean> addDHAccessRecords(@RequestBody AccessRecords records);

    /**
     * 根据Id 查找出入记录
     * @param id 必填
     * @return AccessRecords
     *
     *
     */
    @GetMapping(value = "/accessRecords/findAccessRecordsById/{id}")
    AccessRecords findAccessRecordsById(@PathVariable(value = "id") Long id);

    /**
     * 功能描述:编辑出入记录
     * @param accessRecordsDto 出入记录业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/accessRecords/updateAccessRecords")
    ResultBean<Boolean> updateAccessRecords(@RequestBody AccessRecordsDto accessRecordsDto);

    /**
     * 功能描述:删除出入记录
     * @param accessRecordsDto 出入记录业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/accessRecords/deleteAccessRecords")
    ResultBean<Boolean> deleteAccessRecords(@RequestBody AccessRecordsDto accessRecordsDto);

    /**
     * 功能描述:按某时间分组查询天出入次数
     * @param accessRecordsDto
     * {
     *     beginDate 查询开始时间
     *     endDate 查询截止时间
     *     accessDate 查询时间
     *     groupType   数据分组类型  0 按时  1按日 2按周  3按月
     *     orgPosition 机构位置
     * }
     * @return List<Map<String, Object>>
     *
     *
     */
    @PostMapping(value = "/accessRecords/accessCountListForGroupType")
    List<Map<String, Object>> accessCountListForGroupType(@RequestBody AccessRecordsDto accessRecordsDto);

    /**
     * 功能描述:查询不同方式出入次数
     * @param accessRecordsDto
     * {
     *     orgPosition 机构位置
     * }
     * @return Map<String, Object>
     *
     *
     */
    @PostMapping(value = "/accessRecords/accessCountForOpenWay")
    Map<String, Object> accessCountForOpenWay(@RequestBody AccessRecordsDto accessRecordsDto);

    /**
     * 功能描述:查询出入次数
     * @param accessRecordsDto
     * {
     *     selectMonth 查询某月数量
     *     orgPosition 机构位置
     * }
     * @return Long
     *
     *
     */
    @PostMapping(value = "/accessRecords/getAccessRecordsCount")
    Long getAccessRecordsCount(@RequestBody AccessRecordsDto accessRecordsDto);
    /**
     * 功能描述:根据userId查询
     * @param userIds
     * @return ResultBean<AccessRecords>
     *
     *
     */
    @PostMapping(value = "/accessRecords/getListByUserId")
    ResultBean<AccessRecords> getListByUserId(@RequestBody List<Long> userIds);

    /**
     * 功能描述:获取当日开门次数
     * @param accessRecordsDto{
     *           residentialId:小区Id必填
     * }
     * @return int
     *
     *
     */
    @PostMapping(value = "/accessRecords/getAccessRecordsCountByDay")
    Integer getAccessRecordsCountByDay(@RequestBody AccessRecordsDto accessRecordsDto);

    /**
     * 功能描述:分页查询设备开门次数
     * @param accessRecordsDto
     * @return  ResultBean<Page<Map<String, Object>>>
     *
     *
     */
    @PostMapping(value = "/accessRecords/getDeviceOpenCountList")
    ResultBean<Page<Map<String, Object>>> getDeviceOpenCountList(@RequestBody AccessRecordsDto accessRecordsDto);

    /**
     * 查询密码开门
     * @param accessRecordsDto
     * @return
     */
    @PostMapping(value = "/accessRecords/getAccessRecordsList")
    ResultBean<Page<AccessRecords>> getAccessRecordsList(@RequestBody AccessRecordsDto accessRecordsDto);

    @PostMapping(value = "/accessRecords/getListByCondition")
    List<AccessRecords> getListByCondition(@RequestBody AccessRecordsDto accessRecordsDto);

    @PostMapping(value = "/accessRecords/updateBatchList")
    boolean updateBatchList(@RequestBody List<AccessRecords> accessRecordList);
}
