Browse Source

修改原获取用户信息接口不能使用问题及新增修改用户信息接口

tuonina 6 years ago
parent
commit
32568d682d
1 changed files with 46 additions and 7 deletions
  1. 46 7
      zen-api/src/main/kotlin/cn/gygxzc/envir/sys/service/IFUserService.kt

+ 46 - 7
zen-api/src/main/kotlin/cn/gygxzc/envir/sys/service/IFUserService.kt

@@ -1,8 +1,13 @@
 package cn.gygxzc.envir.sys.service
 
+import cn.gygxzc.cloud.tina.auth.annotation.ResourceApi
+import cn.gygxzc.cloud.tina.auth.enums.ResourceLevel
 import cn.gygxzc.tina.cloud.jwt.session.bean.User
 import org.springframework.cloud.openfeign.FeignClient
-import org.springframework.web.bind.annotation.*
+import org.springframework.web.bind.annotation.PathVariable
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RequestMethod
 
 /**
  * Created by niantuo on 2018/12/17.
@@ -11,16 +16,50 @@ import org.springframework.web.bind.annotation.*
 @FeignClient("sys")
 interface IFUserService {
 
-    @RequestMapping(method = [RequestMethod.POST], value = ["/feign/user/account"])
-    fun getAccountByIds(@RequestBody ids: List<Long>): List<String>
 
-    @RequestMapping(value = ["/feign/user/account/{id}"], method = [RequestMethod.GET])
-    fun getAccountById(@PathVariable("id") id: Long): String?
+    /**
+     * 根据用户的id获取用户信息
+     */
+    @RequestMapping(method = [RequestMethod.POST], value = ["/feign/user"])
+    fun getUserInfoByIds(@RequestBody ids: List<Long>): List<User>
 
-    @RequestMapping(value = ["/feign/user/{id}"], method = [RequestMethod.GET])
+    /**
+     * 根据用户的id获取用户信息
+     */
+    @RequestMapping("/feign/user/{id}", method = [RequestMethod.GET])
     fun getUserInfo(@PathVariable("id") id: Long): User?
 
-    @RequestMapping(value = ["/feign/user/info/{account}"], method = [RequestMethod.GET])
+    /**
+     * 根据用户的账号获取用户信息
+     */
+    @RequestMapping("/feign/user/info/{account}", method = [RequestMethod.GET])
     fun getUserByAccount(@PathVariable("account") account: String): User?
 
+    /**
+     * 根据用户的id获取用户的账号信息
+     */
+    @RequestMapping("/feign/user/account/{id}", method = [RequestMethod.GET])
+    fun getAccountById(@PathVariable("id") id: Long): String?
+
+    /**
+     * 根据用户id获取用户的账号信息...
+     * 这个不知道有什么用...
+     */
+    @RequestMapping("/feign/user/accounts", method = [RequestMethod.POST])
+    fun getAccountByIds(@RequestBody ids: List<Long>): List<String>
+
+
+    /**
+     * 根据用户的id修改用户信息,并不是全部信息。
+     */
+    @RequestMapping("/feign/user/{id}", method = [RequestMethod.PUT])
+    fun updateUserInfo(@PathVariable("id") id: Long, @RequestBody user: User)
+
+    /**
+     * 根据用户账户批量获取用户信息
+     */
+    @RequestMapping("/feign/user/info", method = [RequestMethod.POST])
+    @ResourceApi(name = "", level = ResourceLevel.AUTHC)
+    fun getUserInfoByAccounts(@RequestBody accounts: List<String>): List<User>
+
 }