Преглед изворни кода

组织列表树形接口接口

master
liuxinxin пре 1 година
родитељ
комит
032ec6490c
9 измењених фајлова са 129 додато и 13 уклоњено
  1. +19
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/config/DingOrganizationProperties.java
  2. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java
  3. +2
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertAvoidCompanyController.java
  4. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java
  5. +10
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java
  6. +47
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java
  7. +43
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationTreeVO.java
  8. +3
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/MenuController.java
  9. +4
    -0
      pmapi/src/main/resources/application-dev.yml

+ 19
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/config/DingOrganizationProperties.java Прегледај датотеку

@@ -0,0 +1,19 @@
package com.ningdatech.pmapi.common.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
* @author liuxinxin
* @date 2022/9/9 下午5:37
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "organization")
public class DingOrganizationProperties {
private List<String> deptVisibleScopes = new ArrayList<>();
}

+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java Прегледај датотеку

@@ -71,7 +71,6 @@ public class EmployeeBatchGetTask {
GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData();
if (CollUtil.isNotEmpty(data.getData())) {

allOrganizationEmployeePositionList.addAll(data.getData());
}
Long totalSize = data.getTotalSize();


+ 2
- 3
pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertAvoidCompanyController.java Прегледај датотеку

@@ -1,13 +1,12 @@
package com.ningdatech.pmapi.expert.controller;


import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
* <p>
* 前端控制器
* 前端控制器
* </p>
*
* @author Liuxinxin


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java Прегледај датотеку

@@ -11,7 +11,7 @@ import java.time.LocalDateTime;

/**
* <p>
*
*
* </p>
*
* @author Liuxinxin


+ 10
- 4
pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java Прегледај датотеку

@@ -4,18 +4,18 @@ 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.vo.OrganizationTreeVO;
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
* <p>
@@ -42,4 +42,10 @@ public class DingOrganizationController {
return organizationManage.organizationList(reqOrganizationListPO);
}

@PostMapping("/get-child-list")
@ApiOperation("获取组织架构的树状结构(单位筛选列表)")
public List<OrganizationTreeVO> getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode) {
return organizationManage.getChildOrganizationList(parentCode);
}

}

+ 47
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java Прегледај датотеку

@@ -1,18 +1,24 @@
package com.ningdatech.pmapi.organization.manage;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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.DingOrganization;
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO;
import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO;
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

@@ -26,6 +32,8 @@ public class OrganizationManage {

private final IDingOrganizationService iDingOrganizationService;

private final DingOrganizationProperties dingOrganizationProperties;

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

@@ -54,4 +62,43 @@ public class OrganizationManage {
return pageVo;
}

public List<OrganizationTreeVO> getChildOrganizationList(String parentCode) {
List<String> parentCodeList = new ArrayList<>();
List<DingOrganization> dingOrganizationList = new ArrayList<>();
if (StrUtils.isBlank(parentCode)) {
parentCodeList = dingOrganizationProperties.getDeptVisibleScopes();
dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.in(DingOrganization::getOrganizationCode, parentCodeList));
} else {
parentCodeList = CollectionUtil.toList(parentCode);
dingOrganizationList = iDingOrganizationService
.list(Wrappers.lambdaQuery(DingOrganization.class).in(DingOrganization::getParentCode, parentCodeList));
}

if (CollectionUtils.isEmpty(dingOrganizationList)) {
return new ArrayList<>();
}

dingOrganizationList.sort(Comparator.comparing(DingOrganization::getDisplayOrder));
return dingOrganizationList.stream().map(r -> {
OrganizationTreeVO treeVO = new OrganizationTreeVO();
treeVO.setId(r.getId());
treeVO.setName(r.getOrganizationName());
// Boolean enabled = "1".equals(r.get());
// treeVO.setEnabled(enabled);
treeVO.setOrganizationCode(r.getOrganizationCode());
treeVO.setParentCode(r.getParentCode());
// treeVO.setSubCount(r.get());
// Boolean isLeaf = true;
// Long subCount = r.getSubCount();
// if (Objects.nonNull(subCount) && subCount > 0) {
// isLeaf = false;
// }
// treeVO.setIsLeaf(isLeaf);
// treeVO.setDeptSort(r.getDeptSort());
// treeVO.setUnionCode(r.getName() + "##" + r.getOrganizationCode());
return treeVO;
}).collect(Collectors.toList());
}

}

+ 43
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationTreeVO.java Прегледај датотеку

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

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

import java.util.List;

/**
* @author liuxinxin
* @date 2022/8/17 下午2:01
*/
@Data
public class OrganizationTreeVO {

private Long id;

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

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

// @ApiModelProperty("子部门数目")
// private Long subCount;
//
// @ApiModelProperty("排序")
// private Long deptSort;
//
// @ApiModelProperty("状态(禁用,启用)")
private Boolean enabled;

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

// @ApiModelProperty(value = "子节点")
// private List<OrganizationTreeVO> children;
//
// @ApiModelProperty(value = "是否为叶子节点")
// private Boolean isLeaf;
//
// @ApiModelProperty(value = "联合唯一字段方便页面使用(name##organizationCode)")
// private String unionCode;
}

+ 3
- 4
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/MenuController.java Прегледај датотеку

@@ -3,18 +3,17 @@ package com.ningdatech.pmapi.sys.controller;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.auth.AbstractLoginUserUtil;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity;
import com.ningdatech.pmapi.common.util.TreeUtil;
import com.ningdatech.pmapi.sys.model.entity.Menu;
import com.ningdatech.pmapi.sys.manage.MenuManage;
import com.ningdatech.pmapi.sys.model.dto.MenuQueryDTO;
import com.ningdatech.pmapi.sys.model.dto.MenuSaveDTO;
import com.ningdatech.pmapi.sys.model.dto.MenuUpdateDTO;
import com.ningdatech.pmapi.sys.model.entity.Menu;
import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO;
import com.ningdatech.pmapi.sys.model.vo.MenuVO;
import com.ningdatech.pmapi.sys.manage.MenuManage;
import com.ningdatech.pmapi.sys.service.IMenuService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import io.swagger.annotations.Api;
@@ -93,7 +92,7 @@ public class MenuController {
@PostMapping("/modify")
@WebLog("编辑菜单")
public MenuVO handlerUpdate(@RequestBody MenuUpdateDTO data) {
menuService.update(data, AbstractLoginUserUtil.getUserId());
menuService.update(data, LoginUserUtil.getUserId());
return BeanUtil.toBean(data, MenuVO.class);
}



+ 4
- 0
pmapi/src/main/resources/application-dev.yml Прегледај датотеку

@@ -170,6 +170,10 @@ sa-token:
token-style: uuid
# 是否输出操作日志
is-log: false
#浙政钉公司顶级organizationCode
organization:
dept-visible-scopes:
- 430857a6-fa0b-49f6-89f8-5437b0e2d234

yxt:
wsdl-url: http://115.239.137.23:9501/ws/v1?wsdl


Loading…
Откажи
Сачувај