Browse Source

组织综合列表筛选

master
niohe·erbao 1 year ago
parent
commit
b2695a419a
4 changed files with 82 additions and 1 deletions
  1. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java
  2. +44
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java
  3. +30
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/KeyTreeVO.java
  4. +1
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java

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

@@ -5,6 +5,7 @@ import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.organization.manage.OrganizationManage; import com.ningdatech.pmapi.organization.manage.OrganizationManage;
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO;
import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO; import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO;
import com.ningdatech.pmapi.organization.model.vo.KeyTreeVO;
import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO; import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO;
import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO; import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO;
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO; import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO;
@@ -54,4 +55,10 @@ public class DingOrganizationController {
public List<OrganizationSynthesizeTreeVO> organizationSynthesizeList(@Valid @RequestBody ReqSynthesizePO request) { public List<OrganizationSynthesizeTreeVO> organizationSynthesizeList(@Valid @RequestBody ReqSynthesizePO request) {
return organizationManage.organizationSynthesizeList(request); return organizationManage.organizationSynthesizeList(request);
} }

@ApiOperation("组织树状列表筛选")
@PostMapping("/tree-list")
public List<KeyTreeVO> treeVOList(@Valid @RequestBody ReqSynthesizePO request) {
return organizationManage.treeVOList(request);
}
} }

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

@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO;
import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO; import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO;
import com.ningdatech.pmapi.organization.model.vo.KeyTreeVO;
import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO; import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO;
import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO.OrganizationMemberInfo; import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO.OrganizationMemberInfo;
import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO; import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO;
@@ -150,4 +151,47 @@ public class OrganizationManage {


return organizationSynthesizeTreeVOList; return organizationSynthesizeTreeVOList;
} }

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

List<OrganizationTreeVO> childOrganizationList = getChildOrganizationList(parentCode);

List<KeyTreeVO> orgKeyTreeVOList = childOrganizationList.stream().map(r -> {
KeyTreeVO keyTreeVO = new KeyTreeVO();
keyTreeVO.setTitle(r.getName());
keyTreeVO.setKey(r.getOrganizationCode());
keyTreeVO.setType("ORGANIZATION");
return keyTreeVO;
}).collect(Collectors.toList());

if (needMember && orgKeyTreeVOList.size() > 0) {
List<String> organizationCodeList = orgKeyTreeVOList.stream()
.map(KeyTreeVO::getKey).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 (KeyTreeVO keyTreeVO : orgKeyTreeVOList) {
String organizationCode = keyTreeVO.getKey();
List<DingEmployeeInfo> dingEmployeeInfoGroupList = organizationCodeGroupMap.get(organizationCode);
if (CollUtil.isNotEmpty(dingEmployeeInfoGroupList)) {
List<KeyTreeVO> memberChildren = dingEmployeeInfoGroupList.stream().map(r -> {
KeyTreeVO child = new KeyTreeVO();
child.setKey(r.getEmployeeCode());
child.setTitle(r.getEmployeeName());
child.setType("MEMBER");
return child;
}).collect(Collectors.toList());
keyTreeVO.setChildren(memberChildren);
}
}
}

return orgKeyTreeVOList;
}
} }

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

@@ -0,0 +1,30 @@
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/29 下午2:38
*/

@Data
@ApiModel("树形定制化接口")
public class KeyTreeVO {

@ApiModelProperty("编码")
private String key;

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

@ApiModelProperty("类型 ORGANIZATION/MEMBER")
private String type;

@ApiModelProperty("子集")
private List<KeyTreeVO> children;

}

+ 1
- 1
pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java View File

@@ -131,7 +131,7 @@ public class TodoCenterTest extends AppTests {
String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), "测试项目0301-1"); String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), "测试项目0301-1");
passWorkNoticeInfo.setMsg(passMsg); passWorkNoticeInfo.setMsg(passMsg);
// 放入工作通知暂存表中,通过扫表异步发送 // 放入工作通知暂存表中,通过扫表异步发送
workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.AUDIT);
// workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.AUDIT);
} }


@Test @Test


Loading…
Cancel
Save