Browse Source

组织综合列表筛选

master
niohe·erbao 1 year ago
parent
commit
1250ef774e
4 changed files with 126 additions and 0 deletions
  1. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java
  2. +49
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java
  3. +24
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java
  4. +45
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationSynthesizeTreeVO.java

+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java View File

@@ -4,6 +4,8 @@ package com.ningdatech.pmapi.organization.controller;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.organization.manage.OrganizationManage;
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO;
import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO;
import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO;
import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO;
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO;
import io.swagger.annotations.Api;
@@ -47,4 +49,10 @@ public class DingOrganizationController {
public List<OrganizationTreeVO> getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode) {
return organizationManage.getChildOrganizationList(parentCode);
}

@ApiModelProperty("综合列表筛选")
@PostMapping("/synthesize-list")
public List<OrganizationSynthesizeTreeVO> organizationSynthesizeList(@Valid @RequestBody ReqSynthesizePO request) {
return organizationManage.organizationSynthesizeList(request);
}
}

+ 49
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java View File

@@ -8,10 +8,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.config.DingOrganizationProperties;
import com.ningdatech.pmapi.common.util.StrUtils;
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO;
import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO;
import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO;
import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO.OrganizationMemberInfo;
import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO;
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO;
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
@@ -20,6 +25,7 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
@@ -34,6 +40,8 @@ public class OrganizationManage {

private final DingOrganizationProperties dingOrganizationProperties;

private final IDingEmployeeInfoService iDingEmployeeInfoService;

public PageVo<ResOrganizationListVO> organizationList(ReqOrganizationListPO reqOrganizationListPO) {
String orgName = reqOrganizationListPO.getOrgName();

@@ -101,4 +109,45 @@ public class OrganizationManage {
}).collect(Collectors.toList());
}

public List<OrganizationSynthesizeTreeVO> organizationSynthesizeList(ReqSynthesizePO request) {
String parentCode = request.getParentCode();
Boolean needMember = request.getNeedMember();

List<OrganizationTreeVO> childOrganizationList = getChildOrganizationList(parentCode);

List<OrganizationSynthesizeTreeVO> organizationSynthesizeTreeVOList = childOrganizationList.stream().map(r -> {
OrganizationSynthesizeTreeVO organizationSynthesizeTreeVO = new OrganizationSynthesizeTreeVO();
organizationSynthesizeTreeVO.setName(r.getName());
organizationSynthesizeTreeVO.setOrganizationCode(r.getOrganizationCode());
organizationSynthesizeTreeVO.setParentCode(r.getParentCode());
return organizationSynthesizeTreeVO;
}).collect(Collectors.toList());

if (needMember && organizationSynthesizeTreeVOList.size() > 0) {
List<String> organizationCodeList = organizationSynthesizeTreeVOList.stream()
.map(OrganizationSynthesizeTreeVO::getOrganizationCode).collect(Collectors.toList());
List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getMainJob, "true")
.in(DingEmployeeInfo::getOrganizationCode, organizationCodeList));

Map<String, List<DingEmployeeInfo>> organizationCodeGroupMap = dingEmployeeInfoList.stream()
.collect(Collectors.groupingBy(DingEmployeeInfo::getOrganizationCode));

for (OrganizationSynthesizeTreeVO organizationSynthesizeTreeVO : organizationSynthesizeTreeVOList) {
String organizationCode = organizationSynthesizeTreeVO.getOrganizationCode();
List<DingEmployeeInfo> dingEmployeeInfoGroupList = organizationCodeGroupMap.get(organizationCode);
if (CollUtil.isNotEmpty(dingEmployeeInfoGroupList)) {
List<OrganizationMemberInfo> organizationMemberInfoList = dingEmployeeInfoGroupList.stream().map(r -> {
OrganizationMemberInfo organizationMemberInfo = new OrganizationMemberInfo();
organizationMemberInfo.setEmployeeCode(r.getEmployeeCode());
organizationMemberInfo.setName(r.getEmployeeName());
return organizationMemberInfo;
}).collect(Collectors.toList());
organizationSynthesizeTreeVO.setMemberList(organizationMemberInfoList);
}
}
}

return organizationSynthesizeTreeVOList;
}
}

+ 24
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java View File

@@ -0,0 +1,24 @@
package com.ningdatech.pmapi.organization.model.po;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;

/**
* @author liuxinxin
* @date 2023/3/28 上午10:11
*/

@Data
@ApiModel("单位列表综合筛选请求")
public class ReqSynthesizePO {

@NotBlank(message = "父组织code不能为空")
@ApiModelProperty("父组织code")
private String parentCode;

@ApiModelProperty("是否需要组织成员列表")
private Boolean needMember;
}

+ 45
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationSynthesizeTreeVO.java View File

@@ -0,0 +1,45 @@
package com.ningdatech.pmapi.organization.model.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
* @author liuxinxin
* @date 2023/3/28 上午10:40
*/

@Data
@ApiModel("组织列表")
public class OrganizationSynthesizeTreeVO {

@ApiModelProperty("上级部门")
private String parentCode;

@ApiModelProperty("浙政钉组织编号")
private String organizationCode;

@ApiModelProperty("名称")
private String name;

// @ApiModelProperty("自己组织列表")
// private List<OrganizationSynthesizeTreeVO> childOrganizationList;

@ApiModelProperty("组织下成员列表")
private List<OrganizationMemberInfo> memberList;


@ApiModel
@Data
public static class OrganizationMemberInfo {

@ApiModelProperty("浙政钉 用户编码")
private String employeeCode;

@ApiModelProperty("姓名")
private String name;
}

}

Loading…
Cancel
Save