Merge branch 'develop' of https://gitee.com/jmlcl/weaver-hrm-organization into feature/dxf
Conflicts: src/com/engine/organization/service/FieldDefinedService.java src/com/engine/organization/service/impl/FieldDefinedServiceImpl.java
This commit is contained in:
commit
079addd6c7
|
|
@ -0,0 +1,57 @@
|
|||
package com.engine.organization.entity.extend.bo;
|
||||
|
||||
import com.engine.organization.entity.extend.po.ExtendGroupPO;
|
||||
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/6/14
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class ExtendGroupBO {
|
||||
|
||||
public static List<TypeTreeVO> buildTypeTree(List<ExtendGroupPO> extendGroupPOS) {
|
||||
|
||||
if(CollectionUtils.isEmpty(extendGroupPOS)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<TypeTreeVO> typeTreeVOS = extendGroupPOS.stream().map(e ->
|
||||
TypeTreeVO.builder()
|
||||
.addChild(e.getId() >= 0)
|
||||
.canClick(true)
|
||||
.domid(String.valueOf(e.getId()))
|
||||
.hasGroup(isHasGroup(e.getId()))
|
||||
.haschild(getHasChild(e.getId()))
|
||||
.isShow(e.getIsShow())
|
||||
.key(e.getId())
|
||||
.name(e.getGroupName())
|
||||
.viewAttr(e.getId() <= 0 ? 1 : 2)
|
||||
.pid(e.getPid())
|
||||
.build()).collect(Collectors.toList());
|
||||
|
||||
//获取非一级
|
||||
Map<Long, List<TypeTreeVO>> collects = typeTreeVOS.stream().filter(item -> item.getPid() != null).collect(Collectors.groupingBy(TypeTreeVO ::getPid));
|
||||
|
||||
return typeTreeVOS.stream().peek(e -> e.setSubs(collects.get(e.getKey()))).filter(item -> item.getPid() == null).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static boolean getHasChild(Long id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private static boolean isHasGroup(Long id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -34,10 +34,12 @@ public class ExtendGroupPO {
|
|||
private String groupName;
|
||||
|
||||
/**
|
||||
* 所属分组
|
||||
* 父级
|
||||
*/
|
||||
private Long pid;
|
||||
|
||||
private String isShow;
|
||||
|
||||
private Long creator;
|
||||
private int deleteType;
|
||||
private Date createTime;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.engine.organization.entity.fieldset;
|
||||
package com.engine.organization.entity.fieldset.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
|
@ -17,9 +17,9 @@ import java.util.List;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TypeTreeDTO {
|
||||
public class TypeTreeVO {
|
||||
|
||||
//是否可以增加子节点 默认都为false
|
||||
//是否可以增加子节点
|
||||
private boolean addChild;
|
||||
|
||||
private boolean canCanceled;
|
||||
|
|
@ -30,7 +30,7 @@ public class TypeTreeDTO {
|
|||
//树id
|
||||
private String domid;
|
||||
|
||||
//是否存在分组title
|
||||
//是否存在分组
|
||||
private boolean hasGroup;
|
||||
|
||||
//是否有子节点
|
||||
|
|
@ -52,15 +52,18 @@ public class TypeTreeDTO {
|
|||
private boolean isopen;
|
||||
|
||||
//键
|
||||
private String key;
|
||||
private Long key;
|
||||
|
||||
//树名称
|
||||
private String name;
|
||||
|
||||
//子节点
|
||||
private List<TypeTreeDTO> subs;
|
||||
private List<TypeTreeVO> subs;
|
||||
|
||||
//
|
||||
private int viewAttr;
|
||||
|
||||
//父节点id
|
||||
private Long pid;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.engine.organization.enums;
|
||||
|
||||
import com.engine.salary.enums.BaseEnum;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/6/14
|
||||
* @Version V1.0
|
||||
**/
|
||||
public enum ModuleTypeEnum implements BaseEnum<Integer> {
|
||||
|
||||
subcompanyfielddefined(1, "分部", -84967),
|
||||
departmentfielddefined(2, "部门", -84967),
|
||||
jobfielddefined(3, "岗位", -84967),
|
||||
resourcefielddefined(4, "人员", -84967);
|
||||
|
||||
private int value;
|
||||
|
||||
private String defaultLabel;
|
||||
|
||||
private int labelId;
|
||||
|
||||
ModuleTypeEnum(int value, String defaultLabel, int labelId) {
|
||||
this.value = value;
|
||||
this.defaultLabel = defaultLabel;
|
||||
this.labelId = labelId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getLabelId() {
|
||||
return labelId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultLabel() {
|
||||
return defaultLabel;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.engine.organization.enums;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @description:
|
||||
* @Date 2022/6/14
|
||||
* @Version V1.0
|
||||
**/
|
||||
public enum OrganizationTypeEnum {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ public interface ExtendGroupMapper {
|
|||
* @param extendType
|
||||
* @return
|
||||
*/
|
||||
List<ExtendGroupPO> listByType(@Param("extendType") String extendType);
|
||||
List<ExtendGroupPO> listByType(@Param("extendType") Integer extendType);
|
||||
|
||||
/**
|
||||
* 根据ID 查询数据
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.organization.service;
|
||||
|
||||
import com.engine.organization.entity.fieldset.TypeTreeDTO;
|
||||
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -14,7 +15,7 @@ import java.util.Map;
|
|||
public interface FieldDefinedService {
|
||||
|
||||
|
||||
List<TypeTreeDTO> getTree(String moduleName);
|
||||
List<TypeTreeVO> getTree(ModuleTypeEnum moduleTypeEnum);
|
||||
|
||||
/**
|
||||
* 获取标题分组
|
||||
|
|
|
|||
|
|
@ -1,22 +1,15 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
||||
import com.engine.organization.entity.fieldset.TypeTreeDTO;
|
||||
import com.engine.organization.mapper.extend.ExtendInfoMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
||||
import com.engine.organization.entity.extend.bo.ExtendGroupBO;
|
||||
import com.engine.organization.entity.extend.po.ExtendGroupPO;
|
||||
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.mapper.extend.ExtendGroupMapper;
|
||||
import com.engine.organization.service.FieldDefinedService;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -34,10 +27,10 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<TypeTreeDTO> getTree(String moduleName) {
|
||||
List<TypeTreeDTO> typeTreeDTOS = new ArrayList<>();
|
||||
//int extendType =
|
||||
return typeTreeDTOS;
|
||||
public List<TypeTreeVO> getTree(ModuleTypeEnum moduleTypeEnum) {
|
||||
Integer extendType = moduleTypeEnum.getValue();
|
||||
List<ExtendGroupPO> extendGroupPOS = MapperProxyFactory.getProxy(ExtendGroupMapper.class).listByType(extendType);
|
||||
return ExtendGroupBO.buildTypeTree(extendGroupPOS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.engine.organization.web;
|
|||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.FieldDefinedWrapper;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
|
|
@ -30,13 +31,13 @@ public class FieldDefinedController {
|
|||
}
|
||||
|
||||
@GET
|
||||
@Path("/{moduleName}/getTree")
|
||||
@Path("/{moduleTypeEnum}/getTree")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getHasRight(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@PathParam("moduleName") String moduleName) {
|
||||
@PathParam("moduleTypeEnum") ModuleTypeEnum moduleTypeEnum) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getFieldDefinedWrapper(user).getTree(moduleName));
|
||||
return getFieldDefinedWrapper(user).getTree(moduleTypeEnum);
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ package com.engine.organization.wrapper;
|
|||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.fieldset.TypeTreeDTO;
|
||||
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.service.FieldDefinedService;
|
||||
import com.engine.organization.service.impl.FieldDefinedServiceImpl;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
|
|
@ -24,9 +25,9 @@ public class FieldDefinedWrapper extends Service {
|
|||
}
|
||||
|
||||
|
||||
public ReturnResult getTree(String moduleName) {
|
||||
List<TypeTreeDTO> treeDTOS = getFieldDefinedService(user).getTree(moduleName);
|
||||
return ReturnResult.successed();
|
||||
public ReturnResult getTree(ModuleTypeEnum moduleTypeEnum) {
|
||||
List<TypeTreeVO> treeDTOS = getFieldDefinedService(user).getTree(moduleTypeEnum);
|
||||
return ReturnResult.successed(treeDTOS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue