package com.prolog.rdc.tms.rmi.feign;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import com.prolog.cs.platform.power.model.Organization;
import com.prolog.cs.platform.power.model.enterprise.User;
import com.prolog.framework.authority.core.dto.UserDTO;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.rdc.tms.rmi.hystrix.UserHystrix;

import io.swagger.annotations.ApiOperation;

/**
 * 
 *
 * 用户服务调用
 *
 * @className :UserFeign
 * @author :fanzw
 * @creationTime :2022/05/18
 * @description :
 *
 * @modifier :fanzw
 * @modifyTime :2022/05/18
 * @reviseRemarks:
 *
 * @version :1.0.0
 *
 */
@FeignClient(value = "${prolog.rdc.services.tms.user.name}", url = "${prolog.rdc.services.tms.user.url}", fallbackFactory = UserHystrix.class)
public interface UserFeign {

	@ApiOperation(value = "根据角色ID查询用户信息", notes = "pageNum/pageSize为null返回list")
	@GetMapping("/userpower/usersByRoleId")
	RestMessage<List<User>> usersByRoleId(@RequestParam("Integer") Integer pageNum, @RequestParam("pageSize") Integer pageSize, @RequestParam("roleId") String roleId);

	@ApiOperation(value = "根据code/name查询部门信息", notes = "parentId:父级部门ID")
	@GetMapping("/organization/all")
	RestMessage<List<Organization>> search(@RequestParam("parentId") String parentId, @RequestParam("name") String name, @RequestParam("code") String code, @RequestParam("enterpriseId") String enterpriseId);

	@ApiOperation(value = "根据ID查询部门信息", notes = "根据ID查询部门信息")
	@GetMapping("/organization/byid")
	RestMessage<Organization> getById(@RequestParam("id") String id);

	@ApiOperation(value = "用户信息注册", notes = "用户信息注册")
	@PostMapping("/userpower/addTmsUser")
	RestMessage<String> addTmsUser(@RequestBody User user);

	@ApiOperation(value = "根据用户名查询用户信息", notes = "根据用户名查询用户信息")
	@GetMapping("/userpower/getEnterpriseUserByUserName")
	RestMessage<UserDTO> getPlatformUserByUserName(@RequestParam("username") String username, @RequestParam("userkey") String userkey);

	@ApiOperation(value = "删除企业用户", notes = "删除企业用户")
	@PostMapping("/userpower/delEnterpriseUser")
	RestMessage<Boolean> delEnterpriseUser(@RequestParam("ids") String ids);

	@ApiOperation(value = "修改企业用户", notes = "修改企业用户")
	@PostMapping("/userpower/updateEnterpriseUser2")
	RestMessage<Boolean> updateEnterpriseUser2(@RequestBody User user);

	@ApiOperation(value = "查询用户部门列表", notes = "查询用户部门列表")
	@GetMapping("/organization/byUserId")
	RestMessage<List<Organization>> selectByUserId(@RequestParam("userId") String userId);

	@ApiOperation(value = "根据用户id集合查询用户信息", notes = "根据用户id集合查询用户信息")
	@GetMapping("/userpower/getEnterpriseUserByUserIds")
	RestMessage<List<User>> getUserByIdList(@RequestParam("userIds") String userIdList);

	@ApiOperation(value = "查询企业用户列表", notes = "查询企业用户列表")
	@GetMapping("/userpower/getEnterpriseUsers")
	RestMessage<List<User>> getEnterpriseUsers(@RequestParam(value = "pageNum", required = false) Integer pageNum, @RequestParam(value = "pageSize", required = false) Integer pageSize, @RequestParam(value = "name", required = false) String name, @RequestParam(value = "enterpriseId", required = false) String enterpriseId, @RequestParam(value = "companyName", required = false) String companyName, @RequestParam(value = "employeeNum", required = false) String employeeNum, @RequestParam(value = "type", required = false) Integer type, @RequestParam(value = "userCategory", required = false) String userCategory, @RequestParam(value = "companyId", required = false) String companyId);
}
