package com.sooka.sponest.monitor.remoteapi.service.center.system;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.system.api.domain.SysUser;
import com.sooka.sponest.monitor.remoteapi.fallback.center.system.RemoteSystemBaseServiceFallbackFactory;
import com.sooka.sponest.monitor.remoteapi.service.ModulesServiceNameContants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(contextId = "remoteService", fallbackFactory = RemoteSystemBaseServiceFallbackFactory.class,value = ModulesServiceNameContants.SYSTEM_SERVICE)
public interface RemoteService {
    /**
     * 获取系统用户
     *
     * @param user
     * @return com.ruoyi.common.core.domain.R<java.util.List < com.ruoyi.system.api.domain.SysUser>>
     * @author pengyu
     * @date 2023/3/8 16:27
     **/
    @PostMapping("/user/userFeginlist")
    public R<List<SysUser>> userFeginlist(@RequestBody SysUser user);

    /**
     * 获取系统参数配置
     *
     * @return com.ruoyi.common.core.domain.R<java.lang.String>
     * @author pengyu
     * @date 2023/3/8 16:27
     **/
    @GetMapping("/config/selectConfigKey/insectPestsUrl")
    public R<String> selectConfigKey_insectPestsUrl();

    /**
     * 获取参数配置_文件地址
     */
    @GetMapping("/config/selectConfigKey/fileUrl")
    public R<String> selectConfigKey_fileUrl();

    /**
     * 获取参数配置
     */
    @PostMapping(value = "/config/remotegetConfigKey")
    R<String> remotegetConfigKey(@RequestBody String configKey);

    /**
     * 获取大华账号密码
     */
    @GetMapping(value = "/user/selectById/{userId}")
    R<SysUser> selectById(@PathVariable("userId") Long userId);

    /**
     * 根据用户名查询dept_id, parent_id, ancestors, dept_name
     */
    @GetMapping(value = "/dept/findDeptIdByUserName/{userName}")
    R<SysDept> findDeptIdByUserName(@PathVariable("userName") String userName);

    /**
     * 根据DEPT_ID查询下级的乡镇或区县部门列表，如果传入市级部门则查询区县，如果传入区县部门则查询乡镇街道（不带数据权限）
     *
     * @param deptId 部门id
     * @return 部门信息集合
     */
    @GetMapping(value = "/dept/selectChildrenCountyOrVillagesDeptListByDeptId")
    R<List<SysDept>> selectChildrenCountyOrVillagesDeptListByDeptId(@RequestParam(value = "deptId") Long deptId);

}
