package com.dragoninfo.dcuc.authweb.restcontroller.sub; import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO; import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade; import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.user.AuthUserVo; import com.dragoninfo.duceap.core.response.Result; import com.dragonsoft.duceap.core.search.Searchable; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.stream.Collectors; /** * @author wangrs * @date 2021-04-27 */ @Api(tags = {"授权管理-主客体管理-用户信息"}) @RestController @RequestMapping(value = "authsvr/v2/authuserinfo") public class AuthUserInfoController { @Autowired private IAuthUserInfoFacade userInfoFacade; @RequestMapping("/page") @ApiImplicitParam(name = "searchable", value = "查询条件") @ApiOperation(value = "分页查询用户信息") public Page page(Searchable searchable) { return userInfoFacade.page(searchable.toSearchDTO()); } @ApiOperation(value = "用户信息详情") @ApiImplicitParam(name = "id", value = "id") @GetMapping(value = "/detail/{id}") public AuthUserVo detail(@PathVariable(value = "id") String id) { AuthUserDTO authUserInfo = userInfoFacade.get(id); AuthUserVo authUserVo = new AuthUserVo(); BeanUtils.copyProperties(authUserInfo,authUserVo); return authUserVo; } @ApiOperation(value = "用户信息删除") @ApiImplicitParam(name = "id", value = "id") @DeleteMapping(value = "/delete/{id}") public Result delete(@PathVariable(value = "id") String id) { userInfoFacade.delete(id); return Result.success(); } @ApiOperation(value = "机构下未添加白名单的人员") @ApiImplicitParam(name = "searchable", value = "searchable 查询条件:orgId:= ; name:like; idcard:like") @PostMapping("notInWhiteListUserPage") public Result notInWhiteListUserPage(Searchable searchable) { Page userPage = userInfoFacade.notInWhiteListUserPage(searchable.toSearchDTO()); List content = userPage.getContent(); List voList = content.stream().map(item -> { AuthUserVo vo = new AuthUserVo(); BeanUtils.copyProperties(item, vo); return vo; }).collect(Collectors.toList()); return Result.success(userPage.getTotalElements(), voList); } }