AuthUserInfoController.java 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package com.dragoninfo.dcuc.authweb.restcontroller.sub;
  2. import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
  3. import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade;
  4. import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.user.AuthUserVo;
  5. import com.dragoninfo.duceap.core.response.Result;
  6. import com.dragonsoft.duceap.core.search.Searchable;
  7. import io.swagger.annotations.Api;
  8. import io.swagger.annotations.ApiImplicitParam;
  9. import io.swagger.annotations.ApiOperation;
  10. import org.springframework.beans.BeanUtils;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.data.domain.Page;
  13. import org.springframework.web.bind.annotation.*;
  14. import java.util.List;
  15. import java.util.stream.Collectors;
  16. /**
  17. * @author wangrs
  18. * @date 2021-04-27
  19. */
  20. @Api(tags = {"授权管理-主客体管理-用户信息"})
  21. @RestController
  22. @RequestMapping(value = "authsvr/v2/authuserinfo")
  23. public class AuthUserInfoController {
  24. @Autowired
  25. private IAuthUserInfoFacade userInfoFacade;
  26. @RequestMapping("/page")
  27. @ApiImplicitParam(name = "searchable", value = "查询条件")
  28. @ApiOperation(value = "分页查询用户信息")
  29. public Page<AuthUserDTO> page(Searchable searchable) {
  30. return userInfoFacade.page(searchable.toSearchDTO());
  31. }
  32. @ApiOperation(value = "用户信息详情")
  33. @ApiImplicitParam(name = "id", value = "id")
  34. @GetMapping(value = "/detail/{id}")
  35. public AuthUserVo detail(@PathVariable(value = "id") String id) {
  36. AuthUserDTO authUserInfo = userInfoFacade.get(id);
  37. AuthUserVo authUserVo = new AuthUserVo();
  38. BeanUtils.copyProperties(authUserInfo,authUserVo);
  39. return authUserVo;
  40. }
  41. @ApiOperation(value = "用户信息删除")
  42. @ApiImplicitParam(name = "id", value = "id")
  43. @DeleteMapping(value = "/delete/{id}")
  44. public Result delete(@PathVariable(value = "id") String id) {
  45. userInfoFacade.delete(id);
  46. return Result.success();
  47. }
  48. @ApiOperation(value = "机构下未添加白名单的人员")
  49. @ApiImplicitParam(name = "searchable", value = "searchable 查询条件:orgId:= ; name:like; idcard:like")
  50. @PostMapping("whiteListUserPage")
  51. public Result whiteListUserPage(Searchable searchable) {
  52. Page<AuthUserDTO> userPage = userInfoFacade.whiteListUserPage(searchable.toSearchDTO());
  53. List<AuthUserDTO> content = userPage.getContent();
  54. List<AuthUserVo> voList = content.stream().map(item -> {
  55. AuthUserVo vo = new AuthUserVo();
  56. BeanUtils.copyProperties(item, vo);
  57. return vo;
  58. }).collect(Collectors.toList());
  59. return Result.success(userPage.getTotalElements(), voList);
  60. }
  61. }