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.PositionDto;
import com.sptg.estate.api.entity.EnvironmentalReview;
import com.sptg.estate.api.entity.InstallationReview;
import com.sptg.estate.api.entity.Position;
import com.sptg.estate.api.entity.PositionRecord;
import com.sptg.estate.api.feigns.fallback.PositionFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * title: PositionFeign
 * package: com.sptg.estate.api.feigns
 * description: 设备定位-服务接口
 *
 *                
 *                
 */
@FeignClient(value= "smart-house-estate",fallbackFactory= PositionFeignFallbackFactory.class)
public interface PositionFeign {

    /**
     * 功能描述:分页查询设备定位
     * @param dto
     * @return ResultBean<Page<Position>>
     *                
     *                      
     */
    @PostMapping("/implement/position/showList")
    ResultBean<Page<Position>> showList(@RequestBody PositionDto dto);

    /**
     * 功能描述:id查询设备定位
     * @param id
     * @return ResultBean<Position>
     *                
     *                      
     */
    @PostMapping("/implement/position/findById")
    ResultBean<Position> findById(@RequestBody Long id);

    /**
     * 功能描述:过项目id查询设备定位
     * @param projectId
     * @return ResultBean<ProjectBook>
     *             
     *                      
     */
    @PostMapping("/implement/position/findByProjectId")
    ResultBean<Position> findByProjectId(@RequestBody Long projectId);

    /**
     * 功能描述:根据id查询设备定位记录
     * @param id
     * @return List<PositionRecord>
     *                
     *                      
     */
    @PostMapping("/implement/position/getPositionRecordListById")
    List<PositionRecord> getPositionRecordListById(@RequestBody Long id);

    /**
     * 功能描述:根据id查询环境评审记录
     * @param id
     * @return  List<EnvironmentalReview>
     *                
     *                      
     */
    @PostMapping("/implement/position/getEnvironmentalReviewListById")
    List<EnvironmentalReview> getEnvironmentalReviewListById(@RequestBody Long id);

    /**
     * 功能描述:根据id查询安装环境评审
     * @param id
     * @return  List<EnvironmentalReview>
     *                
     *                      
     */
    @PostMapping("/implement/position/getInstallationReviewListById")
    List<InstallationReview> getInstallationReviewListById(@RequestBody Long id);
    /**
     * 功能描述:根据位置统计定位记录数量
     * @param orgPosition
     * @return ResultBean<Project>
     *               
     *                      
     */
    @PostMapping("/implement/position/countByOrgPosition")
    ResultBean<Integer> countByOrgPosition(@RequestBody String orgPosition);

    /**
     * 功能描述:更新状态
     * @param dto
     * {
     *     id:定位id
     *     checkState:工单审核状态：0-待审核 1-审核通过 2-审核不通过
     *     checkOpinion:审核不通过原因，当checkState = 2有值
     *     checkDate:审核时间
     *     checkAccountId:审核人id
     *     CheckName:审核人
     *
     * }
     * @return ResultBean<Boolean>
     *                
     *                      
     */
    @PostMapping("/implement/position/checkState")
    ResultBean<Boolean> checkState(@RequestBody PositionDto dto);


    /**
     * 功能描述:根据位置查询所属设备定位
     * @param dto{
     *         orgPosition : 位置 必填
     * }
     * @return ResultBean<Position>
     *             
     *                      
     */
    @PostMapping("/implement/position/findListByPosition")
    ResultBean<Position> findListByPosition(@RequestBody PositionDto dto);
    /**
     * 功能描述:检测项目是否已经创建定位记录
     * @param projectId
     * @return ResultBean<Boolean>
     *               
     *                      
     */
    @PostMapping("/implement/position/countByProjectId")
    ResultBean<Boolean> countByProjectId(@RequestBody Long projectId);
    /**
     * 功能描述:新增
     * @param dto
     * @return ResultBean<Boolean>
     *               
     *                      
     */
    @PostMapping("/implement/position/insert")
    ResultBean<Boolean> insert(@RequestBody PositionDto dto);
    /**
     * 功能描述:修改
     * @param dto
     * @return ResultBean<Boolean>
     *               
     *                      
     */
    @PostMapping("/implement/position/editEntity")
    ResultBean<Boolean> editEntity(@RequestBody PositionDto dto);
}
