| | |
| | | import cn.flightfeather.supervision.lightshare.vo.UserSearchCondition |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import org.springframework.web.multipart.MultipartFile |
| | | import javax.servlet.http.HttpServletResponse |
| | |
| | | // @GetMapping("") |
| | | // fun getAll() = userinfoService.findAll() |
| | | |
| | | @ApiOperation(value = "根据用户id获取用户信息") |
| | | @GetMapping("/{id}") |
| | | fun getById(@PathVariable id: String) = userinfoService.findOne(id) |
| | | fun getById( |
| | | @ApiParam("用户id") @PathVariable id: String |
| | | ) = userinfoService.findOne(id) |
| | | |
| | | @ApiOperation(value = "上传用户信息") |
| | | @PutMapping("") |
| | | fun add(@RequestBody userinfo: Userinfo) = userinfoService.save(userinfo) |
| | | fun add( |
| | | @ApiParam("用户信息") @RequestBody userinfo: Userinfo |
| | | ) = userinfoService.save(userinfo) |
| | | |
| | | @ApiOperation(value = "更新用户信息") |
| | | @PostMapping("") |
| | | fun update(@RequestBody userinfo: Userinfo) = userinfoService.update(userinfo) |
| | | fun update( |
| | | @ApiParam("用户信息") @RequestBody userinfo: Userinfo |
| | | ) = userinfoService.update(userinfo) |
| | | |
| | | // @DeleteMapping("/{id}") |
| | | // fun delete(@PathVariable id: String) = userinfoService.delete(id) |
| | | |
| | | @ApiOperation(value = "登录") |
| | | @PostMapping("/login") |
| | | fun login(@RequestBody loginRequestVo: LoginRequestVo) = userinfoService.login(loginRequestVo) |
| | | fun login( |
| | | @ApiParam("登录信息") @RequestBody loginRequestVo: LoginRequestVo |
| | | ) = userinfoService.login(loginRequestVo) |
| | | |
| | | @ApiOperation(value = "注册") |
| | | @PostMapping("/register") |
| | | fun register(@RequestBody loginRequestVo: LoginRequestVo) = userinfoService.register(loginRequestVo) |
| | | fun register( |
| | | @ApiParam("注册信息") @RequestBody loginRequestVo: LoginRequestVo |
| | | ) = userinfoService.register(loginRequestVo) |
| | | |
| | | @ApiOperation(value = "注册") |
| | | @PostMapping("/register2") |
| | | fun register2( |
| | | @ApiParam("注册信息") @RequestBody loginRequestVo: LoginRequestVo |
| | | ) = userinfoService.register2(loginRequestVo) |
| | | |
| | | @ApiOperation(value = "获取用户通讯录") |
| | | @GetMapping("/addressBook") |
| | | fun getAddressBook(@RequestParam("userId") userId: String) = userinfoService.getAddressBook(userId) |
| | | fun getAddressBook( |
| | | @ApiParam("用户id") @RequestParam("userId") userId: String |
| | | ) = userinfoService.getAddressBook(userId) |
| | | |
| | | @ApiOperation(value = "上传用户头像") |
| | | @PostMapping("/accountPic/upLoad") |
| | | fun upLoadUserAccountPic( |
| | | @RequestParam("userId") userId: String, |
| | | @RequestPart("images") files: Array<MultipartFile> |
| | | @ApiParam("用户id") @RequestParam("userId") userId: String, |
| | | @ApiParam("图片") @RequestPart("images") files: Array<MultipartFile> |
| | | ) = userinfoService.upLoadAccountPic(userId, files) |
| | | |
| | | @ApiOperation(value = "修改密码") |
| | | @PostMapping("/password/change/{userId}") |
| | | fun changePassword( |
| | | @RequestParam("userId") userId: String, |
| | | @RequestParam("oldPassword") oldPassword: String, |
| | | @RequestParam("newPassword") newPassword: String |
| | | @ApiParam("用户id") @RequestParam("userId") userId: String, |
| | | @ApiParam("旧密码") @RequestParam("oldPassword") oldPassword: String, |
| | | @ApiParam("新密码") @RequestParam("newPassword") newPassword: String |
| | | ) = userinfoService.changePassword(userId, oldPassword, newPassword) |
| | | |
| | | @ApiOperation(value = "根据查询者,找到同区县的用户") |
| | | @PostMapping("/searchUser/{userId}") |
| | | fun searchUser( |
| | | @PathVariable("userId") userId: String, |
| | | @RequestBody condition: UserSearchCondition, |
| | | @RequestParam(value = "page") page: Int, |
| | | @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | @ApiParam("用户id") @PathVariable("userId") userId: String, |
| | | @ApiParam("查询条件") @RequestBody condition: UserSearchCondition, |
| | | @ApiParam("页码") @RequestParam(value = "page") page: Int, |
| | | @ApiParam("单页数据量") @RequestParam(value = "per_page") perPage: Int, |
| | | response: HttpServletResponse |
| | | ) = userinfoService.searchUser(userId, condition, page, perPage, response) |
| | | |
| | | @ApiOperation(value = "获取用户基本信息") |
| | | @GetMapping("/baseInfo") |
| | | fun getBaseInfo( |
| | | @RequestParam("userId") userId: String |
| | | @ApiParam("用户id") @RequestParam("userId") userId: String |
| | | ) = userinfoService.getBaseInfo(userId) |
| | | |
| | | @ApiOperation(value = "根据给定条件,搜索用户") |
| | | @GetMapping("/search") |
| | | fun search( |
| | | @ApiParam("区县", example = "徐汇区") @RequestParam("district", required = false) district: String, |
| | | @ApiParam("场景类型", example = "1", allowableValues = "0,1,2,3,4,5,6,7") @RequestParam("sceneType", required = false) sceneType: Int, |
| | | @ApiParam("用户类型", example = "0", allowableValues = "0,1,2,3") @RequestParam("userType", required = false) userType: Int, |
| | | @ApiParam("页码") @RequestParam(value = "page") page: Int, |
| | | @ApiParam("单页数据量") @RequestParam(value = "per_page") perPage: Int, |
| | | ) = userinfoService.search(district, sceneType, userType, page, perPage) |
| | | } |