|
@@ -131,6 +131,85 @@ public class UserController {
|
|
|
* @param page
|
|
|
* @return
|
|
|
*/
|
|
|
+ @ApiLog("项目组成员查询用户使用")
|
|
|
+ @ApiOperation(value = "项目组成员查询用户使用")
|
|
|
+ //@PreAuthorize("hasAuthority('sys:user:list')")
|
|
|
+ @GetMapping("memberList")
|
|
|
+ public ResponseEntity memberList(UserDTO userDTO, Page <UserDTO> page) throws Exception {
|
|
|
+
|
|
|
+ QueryWrapper <UserDTO> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( userDTO, UserDTO.class );
|
|
|
+ // 管理员查询不限制
|
|
|
+ if (!UserUtils.getCurrentUserDTO().isAdmin()) {
|
|
|
+ queryWrapper.isNull("a.is_admin");
|
|
|
+ if (ObjectUtil.isNotEmpty(userDTO)){
|
|
|
+ if (ObjectUtil.isNotEmpty(userDTO.getCompanyDTO()) && ObjectUtil.isNotEmpty(userDTO.getOfficeDTO())) {
|
|
|
+ OfficeDTO officeDTO = UserUtils.getCurrentUserDTO().getOfficeDTO();
|
|
|
+ if (StringUtils.isNotBlank(userDTO.getCertType())) {
|
|
|
+
|
|
|
+ }else{
|
|
|
+ // 当不是精确的部门查询时,再添加下面的筛选条件
|
|
|
+ if ((StringUtils.isNotBlank(userDTO.getCompanyDTO().getId()) && StringUtils.isBlank(userDTO.getOfficeDTO().getId()))
|
|
|
+ || "true".equals(userDTO.getSelectAll())) {
|
|
|
+ // officeDTO.id是空,companyDTO.id不是空的话,说明前端组件点击的集团来进行查询
|
|
|
+ // selectAll为‘true’的话,说明前端没有选择集团或者部门查询,这个时候要展示全部人员
|
|
|
+ // 根据当前用户的部门id找到此部门的ids
|
|
|
+ String ids = officeService.getById(UserUtils.getCurrentUserDTO().getOfficeDTO().getId()).getParentIds();
|
|
|
+ // 根据ids分隔后的index[2],找到当前用户的所属公司id
|
|
|
+ String companyId = null;
|
|
|
+ String[] split = ids.split(",");
|
|
|
+ // split.length大于2,说明当前登录人所属部门是普通部门,展示部分人员信息
|
|
|
+ // 否则,当前登录人所属公共类部门(忘了叫什么类部门了,就是总经办那种部门),展示全部人员信息
|
|
|
+ if(split.length>2){
|
|
|
+ companyId = split[2];
|
|
|
+ // 根据公司id,找到此公司下的所有部门
|
|
|
+ List<Office> officeList = officeService.list(new QueryWrapper<Office>().lambda().eq(Office::getParentId, companyId));
|
|
|
+ Set officeIdSet = new HashSet();
|
|
|
+ for (Office office : officeList) {
|
|
|
+ if(StringUtils.isNotBlank(office.getId())){
|
|
|
+ officeIdSet.add(office.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<String> officeIdList = Lists.newArrayList(officeIdSet);
|
|
|
+ // 拿到这些部门的id
|
|
|
+ //List<String> officeIdList = officeList.stream().distinct().map(Office::getId).collect(Collectors.toList());
|
|
|
+ // 拿到所有公有部门的id
|
|
|
+ List<String> officePublicIdList = officeService.list(new LambdaQueryWrapper<Office>().eq(Office::getIsPublic,"1")).stream().map(Office::getId).collect(Collectors.toList());
|
|
|
+ // 拿到直属公司的id
|
|
|
+ officeIdList.add(companyId);
|
|
|
+ // 最后得到的所有部门的id
|
|
|
+ officeIdList.addAll(officePublicIdList);
|
|
|
+ List<String> lastIds = officeIdList.stream().distinct().collect(Collectors.toList());
|
|
|
+ // 添加筛选条件为这些部门的id
|
|
|
+ queryWrapper.in("a.office_id",lastIds);
|
|
|
+ }
|
|
|
+ } else if(StringUtils.isBlank(userDTO.getCompanyDTO().getId()) && StringUtils.isNotBlank(userDTO.getOfficeDTO().getId())) {
|
|
|
+ // officeDTO.id不是空,companyDTO.id是空的话,说明前端组件点击的部门查询
|
|
|
+ queryWrapper.eq("a.office_id",userDTO.getOfficeDTO().getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(userDTO)) {
|
|
|
+ // 当certType传值时,获取拥有此资格证类型的人员
|
|
|
+ if (StringUtils.isNotBlank(userDTO.getCertType())) {
|
|
|
+ queryWrapper.eq("sc.type",userDTO.getCertType());
|
|
|
+ }
|
|
|
+ if ( userDTO.getTenantDTO ( ) != null && StrUtil.isNotBlank ( userDTO.getTenantDTO ( ).getId ( ) ) ) {
|
|
|
+ queryWrapper.eq ( "a.tenant_id", userDTO.getTenantDTO ( ).getId ( ) );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ IPage <UserDTO> result = userService.findMemberPage ( page, queryWrapper );
|
|
|
+ return ResponseEntity.ok ( result );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询列表
|
|
|
+ *
|
|
|
+ * @param userDTO
|
|
|
+ * @param page
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@ApiLog("用户数据列表")
|
|
|
@ApiOperation(value = "用户数据列表")
|
|
|
//@PreAuthorize("hasAuthority('sys:user:list')")
|
|
@@ -205,7 +284,7 @@ public class UserController {
|
|
|
queryWrapper.eq("sc.type",userDTO.getCertType());
|
|
|
}
|
|
|
if ( userDTO.getTenantDTO ( ) != null && StrUtil.isNotBlank ( userDTO.getTenantDTO ( ).getId ( ) ) ) {
|
|
|
- queryWrapper.eq ( "a.tenant_id", userDTO.getTenantDTO ( ).getId ( ) );
|
|
|
+ queryWrapper.eq ( "a.tenant_id", userDTO.getTenantDTO ( ).getId ( ) );
|
|
|
}
|
|
|
}
|
|
|
IPage <UserDTO> result = userService.findPage ( page, queryWrapper );
|
|
@@ -225,6 +304,22 @@ public class UserController {
|
|
|
return ResponseEntity.ok ( result );
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @ApiLog("根据用户id获取被选次数")
|
|
|
+ @ApiOperation(value = "根据用户id获取被选次数")
|
|
|
+ //@PreAuthorize("hasAuthority('sys:user:list')")
|
|
|
+ @GetMapping("getCount")
|
|
|
+ public ResponseEntity getCount(String id){
|
|
|
+ UserDTO userDTO = userService.get(id);
|
|
|
+ if (userDTO.getName().equals("潘中")){
|
|
|
+ userDTO.setAccountantUserFlag(0);
|
|
|
+ }else{
|
|
|
+ userDTO.setAccountantUserFlag(1);
|
|
|
+ }
|
|
|
+ userDTO.setAccountantUserCount(userService.getAccountantUserCount(id));
|
|
|
+ return ResponseEntity.ok(userDTO);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询列表
|
|
|
*
|