package com.hxhq.system.api;

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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import com.hxhq.common.core.constant.SecurityConstants;
import com.hxhq.common.core.constant.ServiceNameConstants;
import com.hxhq.common.core.domain.R;
import com.hxhq.system.api.domain.SysUser;
import com.hxhq.system.api.factory.RemoteUserFallbackFactory;
import com.hxhq.system.api.model.LoginUser;

/**
 * 用户服务
 * 
 * @author hxhq
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService
{
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/user/info/{username}")
    public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 注册用户信息
     *
     * @param sysUser 用户信息
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/user/register")
    public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 记录用户登录IP地址和登录时间
     *
     * @param sysUser 用户信息
     * @param source 请求来源
     * @return 结果
     */
    @PutMapping("/user/recordlogin")
    public R<Boolean> recordUserLogin(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 测试Feign跨服务调用
     */
    @PostMapping("/business/study/testFeign")
    public void testFeign();

    /**
     * 自动归还试验
     */
    @PostMapping("/business/study/autoGh")
    public void autoGhStudy();

    /**
     * 自动归还麻精药
     */
    @PostMapping("/business/mjy/autoGh")
    public void autoGhMjy();

    /**
     * 自动归还麻精药发放记录
     */
    @PostMapping("/business/mjyFfjl/autoGh")
    public void autoGhMjyFfjl();

    /**
     * 自动归还给药制剂
     */
    @PostMapping("/business/gyzj/autoGh")
    public void autoGhGyzj();

    /**
     * 自动归还给药制剂发放记录
     */
    @PostMapping("/business/gyzjFfjl/autoGh")
    public void autoGhGyzjFfjl();

    /**
     * 自动归还试剂档案
     */
    @PostMapping("/business/sjArchive/autoGh")
    public void autoGhSj();

    /**
     * 自动归还供试品档案
     */
    @PostMapping("/business/gspArchive/autoGh")
    public void autoGhGsp();

    /**
     * 自动归还供试品发放记录档案
     */
    @PostMapping("/business/gspFfjlArchive/autoGh")
    public void autoGhGspFfjl();

    /**
     * 自动归还供试品入库记录档案
     */
    @PostMapping("/business/gspRkjlArchive/autoGh")
    public void autoGhGspRkjl();
}
