diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java index 5c80996..b807633 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java @@ -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 getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode) { return organizationManage.getChildOrganizationList(parentCode); } + + @ApiModelProperty("综合列表筛选") + @PostMapping("/synthesize-list") + public List organizationSynthesizeList(@Valid @RequestBody ReqSynthesizePO request) { + return organizationManage.organizationSynthesizeList(request); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java index 2a2eb19..7226d3e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java @@ -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 organizationList(ReqOrganizationListPO reqOrganizationListPO) { String orgName = reqOrganizationListPO.getOrgName(); @@ -101,4 +109,45 @@ public class OrganizationManage { }).collect(Collectors.toList()); } + public List organizationSynthesizeList(ReqSynthesizePO request) { + String parentCode = request.getParentCode(); + Boolean needMember = request.getNeedMember(); + + List childOrganizationList = getChildOrganizationList(parentCode); + + List 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 organizationCodeList = organizationSynthesizeTreeVOList.stream() + .map(OrganizationSynthesizeTreeVO::getOrganizationCode).collect(Collectors.toList()); + List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getMainJob, "true") + .in(DingEmployeeInfo::getOrganizationCode, organizationCodeList)); + + Map> organizationCodeGroupMap = dingEmployeeInfoList.stream() + .collect(Collectors.groupingBy(DingEmployeeInfo::getOrganizationCode)); + + for (OrganizationSynthesizeTreeVO organizationSynthesizeTreeVO : organizationSynthesizeTreeVOList) { + String organizationCode = organizationSynthesizeTreeVO.getOrganizationCode(); + List dingEmployeeInfoGroupList = organizationCodeGroupMap.get(organizationCode); + if (CollUtil.isNotEmpty(dingEmployeeInfoGroupList)) { + List 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; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java new file mode 100644 index 0000000..2060986 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java @@ -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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationSynthesizeTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationSynthesizeTreeVO.java new file mode 100644 index 0000000..35ccd63 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationSynthesizeTreeVO.java @@ -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 childOrganizationList; + + @ApiModelProperty("组织下成员列表") + private List memberList; + + + @ApiModel + @Data + public static class OrganizationMemberInfo { + + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + + @ApiModelProperty("姓名") + private String name; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java index ce41441..cb9a254 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java @@ -33,11 +33,11 @@ public class ToBeProcessedReq extends PagePo implements Serializable { private Integer projectYear; @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") private LocalDateTime createOnMin; @ApiModelProperty("创建时间") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") private LocalDateTime createOnMax; @ApiModelProperty(value = "是否增补项目",allowableValues = "0,1")