123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- package com.dragoninfo.dcuc.authweb.restcontroller.sub;
- import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
- import com.dragoninfo.dcuc.auth.sub.enumresource.JobTypeEnum;
- import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade;
- import com.dragoninfo.dcuc.auth.sub.vo.AuthUserVo;
- import com.dragoninfo.duceap.core.response.Result;
- import com.dragonsoft.duceap.base.entity.search.SearchDTO;
- import com.dragonsoft.duceap.core.search.Searchable;
- import com.dragonsoft.duceap.core.search.enums.SearchOperator;
- 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 authUserInfoFacade;
- /**
- * 同角色授权-人员视图列表
- * @param searchDTO
- * @return
- */
- @RequestMapping("/page")
- @ApiImplicitParam(name = "searchable", value = "查询条件")
- @ApiOperation(value = "分页查询用户信息")
- public Page<AuthUserDTO> page(SearchDTO searchDTO) {
- //职位状态只查询在职、挂职、借调
- Searchable searchable = getUserQuerySearchable(searchDTO);
- return authUserInfoFacade.roleAuthUserViewPage(searchable.toSearchDTO());
- }
- private Searchable getUserQuerySearchable(SearchDTO searchDTO) {
- Searchable searchable = Searchable.toSearchable(searchDTO);
- String[] jobTypes = new String[]{JobTypeEnum.ZZ.getValue(), JobTypeEnum.GZ.getValue(), JobTypeEnum.JD.getValue()};
- searchable.addSearchFilter("relStatus", SearchOperator.in, jobTypes);
- return searchable;
- }
- @ApiOperation(value = "用户信息详情")
- @ApiImplicitParam(name = "id", value = "id")
- @GetMapping(value = "/detail/{id}")
- public AuthUserVo detail(@PathVariable(value = "id") String id) {
- AuthUserDTO authUserInfo = authUserInfoFacade.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) {
- authUserInfoFacade.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<AuthUserDTO> userPage = authUserInfoFacade.notInWhiteListUserPage(searchable.toSearchDTO());
- List<AuthUserDTO> content = userPage.getContent();
- List<AuthUserVo> voList = content.stream().map(item -> {
- AuthUserVo vo = new AuthUserVo();
- BeanUtils.copyProperties(item, vo);
- return vo;
- }).collect(Collectors.toList());
- return Result.success(userPage.getTotalElements(), voList);
- }
- }
|