分部接口整理、代码优化
This commit is contained in:
parent
8c5106d06b
commit
aa3d0742ff
|
|
@ -9,12 +9,12 @@ import com.engine.organization.component.OrganizationWeaTable;
|
|||
import com.engine.organization.entity.browser.bo.CusBowserTreeBO;
|
||||
import com.engine.organization.entity.browser.enums.TreeNodeTypeEnum;
|
||||
import com.engine.organization.entity.browser.po.CusBrowserTree;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.job.vo.JobBrowserVO;
|
||||
import com.engine.organization.entity.searchtree.SearchTree;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
|
|
@ -165,41 +165,41 @@ public class JobBrowserService extends BrowserService {
|
|||
List<String> compHasSubs;
|
||||
if (detachUtil.isDETACH()) {
|
||||
if (CollectionUtils.isNotEmpty(jclRoleLevelList)) {
|
||||
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasDetachSubs(jclRoleLevelList);
|
||||
compHasSubs = MapperProxyFactory.getProxy(CompanyMapper.class).hasDetachSubs(jclRoleLevelList);
|
||||
} else {
|
||||
compHasSubs = new ArrayList<>();
|
||||
}
|
||||
} else {
|
||||
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs();
|
||||
compHasSubs = MapperProxyFactory.getProxy(CompanyMapper.class).hasSubs();
|
||||
}
|
||||
// 部门存在下级的ID
|
||||
List<String> hasSubDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).hasSubs();
|
||||
|
||||
if ("0".equals(params.getId())) {
|
||||
List<CompPO> compList;
|
||||
List<CompanyPO> compList;
|
||||
if (detachUtil.isDETACH()) {
|
||||
if (CollectionUtils.isNotEmpty(jclRoleLevelList)) {
|
||||
compList = MapperProxyFactory.getProxy(CompMapper.class).getCompsByIds(jclRoleLevelList);
|
||||
compList = MapperProxyFactory.getProxy(CompanyMapper.class).getCompsByIds(jclRoleLevelList);
|
||||
// 处理上下级关系
|
||||
Set<Long> collectIds = compList.stream().map(CompPO::getId).collect(Collectors.toSet());
|
||||
compList.removeIf(item->collectIds.contains(item.getParentCompany()));
|
||||
Set<Integer> collectIds = compList.stream().map(CompanyPO::getId).collect(Collectors.toSet());
|
||||
compList.removeIf(item -> collectIds.contains(item.getSupSubComId()));
|
||||
|
||||
} else {
|
||||
compList = new ArrayList<>();
|
||||
}
|
||||
} else {
|
||||
compList = MapperProxyFactory.getProxy(CompMapper.class).listParent();
|
||||
compList = MapperProxyFactory.getProxy(CompanyMapper.class).listParent();
|
||||
}
|
||||
// 获取顶层分部
|
||||
compList.stream().sorted(Comparator.comparing(CompPO::getShowOrder)).forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
|
||||
compList.stream().sorted(Comparator.comparing(CompanyPO::getShowOrder)).forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
|
||||
} else if ("1".equals(params.getType())) {
|
||||
// 当前节点下的元素
|
||||
CompPO compBuild = CompPO.builder().parentCompany(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
|
||||
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listByFilter(compBuild, "show_order");
|
||||
CompanyPO compBuild = CompanyPO.builder().supSubComId(Integer.parseInt(params.getId())).canceled(0).build();
|
||||
List<CompanyPO> compList = MapperProxyFactory.getProxy(CompanyMapper.class).listByFilter(compBuild, "show_order");
|
||||
if (detachUtil.isDETACH()) {
|
||||
detachUtil.filterCompanyList(compList);
|
||||
}
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().parentComp(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().parentComp(Integer.parseInt(params.getId())).forbiddenTag(0).deleteType(0).build();
|
||||
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order");
|
||||
compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
|
||||
|
||||
|
|
@ -222,11 +222,11 @@ public class JobBrowserService extends BrowserService {
|
|||
* @param compHasSubs
|
||||
* @param company
|
||||
*/
|
||||
private void buildCompNodes(List<TreeNode> treeNodes, List<String> compHasSubs, CompPO company) {
|
||||
private void buildCompNodes(List<TreeNode> treeNodes, List<String> compHasSubs, CompanyPO company) {
|
||||
SearchTree searchTree = new SearchTree();
|
||||
searchTree.setId(company.getId().toString());
|
||||
searchTree.setType(TreeNodeTypeEnum.TYPE_COMP.getValue());
|
||||
searchTree.setName(company.getCompName());
|
||||
searchTree.setName(company.getSubCompanyName());
|
||||
searchTree.setIsParent(compHasSubs.contains(company.getId().toString()));
|
||||
treeNodes.add(searchTree);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import weaver.general.StringUtil;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -24,7 +24,7 @@ import java.util.stream.Collectors;
|
|||
public class DeleteParam {
|
||||
private String ids;
|
||||
|
||||
public Collection<Long> getIds() {
|
||||
public List<Long> getIds() {
|
||||
if(StringUtil.isEmpty(ids)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,154 +0,0 @@
|
|||
package com.engine.organization.entity.company.bo;
|
||||
|
||||
import com.engine.organization.entity.company.dto.CompListDTO;
|
||||
import com.engine.organization.entity.company.param.CompSearchParam;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.searchtree.SearchTree;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import weaver.crm.Maint.SectorInfoComInfo;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class CompBO {
|
||||
|
||||
public static List<CompListDTO> buildCompDTOList(Collection<CompPO> list) {
|
||||
|
||||
Map<Long, CompPO> poMaps = list.stream().collect(Collectors.toMap(CompPO::getId, item -> item));
|
||||
|
||||
List<CompListDTO> dtoList = list.stream().map(e ->
|
||||
CompListDTO
|
||||
.builder()
|
||||
.id(e.getId())
|
||||
.compNo(e.getCompNo())
|
||||
.compName(e.getCompName())
|
||||
.compNameShort(e.getCompNameShort())
|
||||
.parentCompany(e.getParentCompany())
|
||||
.parentCompName(null == poMaps.get(e.getParentCompany()) ? "" : poMaps.get(e.getParentCompany()).getCompName())
|
||||
.orgCode(e.getOrgCode())
|
||||
.industry(new SectorInfoComInfo().getSectorInfoname(Util.null2String(e.getIndustry())))
|
||||
.compPrincipal(getUserNameById( Util.null2String(e.getCompPrincipal())))
|
||||
.showOrder(e.getShowOrder())
|
||||
.forbiddenTag(e.getForbiddenTag())
|
||||
.build()).collect(Collectors.toList());
|
||||
Map<Long, List<CompListDTO>> collects = dtoList.stream().filter(item -> null != item.getParentCompany() && 0 != item.getParentCompany()).collect(Collectors.groupingBy(CompListDTO::getParentCompany));
|
||||
// 处理被引用数据
|
||||
List<String> usedIds = MapperProxyFactory.getProxy(CompMapper.class).listUsedId();
|
||||
// 兼容MySQL
|
||||
usedIds.addAll(MapperProxyFactory.getProxy(CompMapper.class).listUsedIds());
|
||||
List<String> collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList());
|
||||
Set<Long> leafs = new HashSet<>();
|
||||
List<CompListDTO> collectTree = dtoList.stream().peek(e -> {
|
||||
List<CompListDTO> childList = collects.get(e.getId());
|
||||
leafs.add(e.getId());
|
||||
if (CollectionUtils.isNotEmpty(childList)) {
|
||||
e.setChildren(childList);
|
||||
e.setIsUsed(1);
|
||||
} else {
|
||||
if (collect.contains(Util.null2String(e.getId()))) {
|
||||
e.setIsUsed(1);
|
||||
} else {
|
||||
e.setIsUsed(0);
|
||||
}
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
return collectTree.stream().filter(item->!leafs.contains(item.getParentCompany())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<CompListDTO> buildCompDTOList(Collection<CompPO> list, List<CompPO> filterList) {
|
||||
// 搜索结果为空,直接返回空
|
||||
if (CollectionUtils.isEmpty(filterList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 递归添加父级数据
|
||||
Map<Long, CompPO> poMaps = list.stream().collect(Collectors.toMap(CompPO::getId, item -> item));
|
||||
List<CompPO> addedList = new ArrayList<>();
|
||||
for (CompPO po : filterList) {
|
||||
dealParentData(addedList, po, poMaps);
|
||||
}
|
||||
|
||||
return buildCompDTOList(addedList);
|
||||
}
|
||||
|
||||
public static CompPO convertParamToPO(CompSearchParam param, Long employeeId) {
|
||||
if (null == param) {
|
||||
return null;
|
||||
}
|
||||
return CompPO
|
||||
.builder()
|
||||
.id(param.getId() == null ? 0 : param.getId())
|
||||
.compNo(param.getCompNo())
|
||||
.compName(param.getCompName())
|
||||
.compNameShort(param.getCompNameShort())
|
||||
.parentCompany(param.getParentCompany())
|
||||
.ecCompany(param.getEcCompany())
|
||||
.orgCode(param.getOrgCode())
|
||||
.industry(param.getIndustry())
|
||||
.compPrincipal(param.getCompPrincipal())
|
||||
.description(param.getDescription())
|
||||
.forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1)
|
||||
.deleteType(0)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.creator(employeeId)
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
public static List<SearchTree> buildSetToSearchTree(Set<CompPO> comps) {
|
||||
return comps.stream().sorted(Comparator.comparing(CompPO::getShowOrder)).map(item -> {
|
||||
SearchTree tree = new SearchTree();
|
||||
tree.setCanClick(true);
|
||||
tree.setCanceled(item.getForbiddenTag() != 0);
|
||||
tree.setIcon("icon-coms-LargeArea");
|
||||
tree.setId(item.getId().toString());
|
||||
tree.setIsParent(false);
|
||||
tree.setIsVirtual("0");
|
||||
tree.setName(item.getCompName());
|
||||
tree.setPid(null == item.getParentCompany() ? "0" : item.getParentCompany().toString());
|
||||
tree.setSelected(false);
|
||||
tree.setType("1");
|
||||
tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder());
|
||||
return tree;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归获取查询后数据的父级数据
|
||||
*
|
||||
* @param addedList
|
||||
* @param po
|
||||
* @param poMaps
|
||||
*/
|
||||
private static void dealParentData(List<CompPO> addedList, CompPO po, Map<Long, CompPO> poMaps) {
|
||||
if (!addedList.contains(po)) {
|
||||
addedList.add(po);
|
||||
}
|
||||
CompPO parentCompPO = poMaps.get(po.getParentCompany());
|
||||
if (null != parentCompPO) {
|
||||
dealParentData(addedList, parentCompPO, poMaps);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getUserNameById(String userId) {
|
||||
try {
|
||||
if (StringUtil.isEmpty(userId)) {
|
||||
return "";
|
||||
}
|
||||
return new ResourceComInfo().getLastname(userId);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.engine.organization.entity.company.bo;
|
|||
import com.engine.organization.entity.company.dto.CompanyListDTO;
|
||||
import com.engine.organization.entity.company.param.CompanyParam;
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import com.engine.organization.entity.searchtree.SearchTree;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
|
@ -22,6 +23,24 @@ public class CompanyBO {
|
|||
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
||||
}
|
||||
|
||||
public static List<SearchTree> buildSetToSearchTree(Set<CompanyPO> comps) {
|
||||
return comps.stream().sorted(Comparator.comparing(CompanyPO::getShowOrder)).map(item -> {
|
||||
SearchTree tree = new SearchTree();
|
||||
tree.setCanClick(true);
|
||||
tree.setCanceled(item.getCanceled() != 0);
|
||||
tree.setIcon("icon-coms-LargeArea");
|
||||
tree.setId(item.getId().toString());
|
||||
tree.setIsParent(false);
|
||||
tree.setIsVirtual("0");
|
||||
tree.setName(item.getSubCompanyName());
|
||||
tree.setPid(item.getSupSubComId().toString());
|
||||
tree.setSelected(false);
|
||||
tree.setType("1");
|
||||
tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder());
|
||||
return tree;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索条件转换实体对象
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,95 +0,0 @@
|
|||
package com.engine.organization.entity.company.dto;
|
||||
|
||||
import com.engine.organization.annotation.OrganizationTable;
|
||||
import com.engine.organization.annotation.TableTitle;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@OrganizationTable(pageId = "2c66b3a4-d4f8-11ec-9774-00ffcbed7508")
|
||||
public class CompListDTO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 是否被引用
|
||||
*/
|
||||
private Integer isUsed;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableTitle(title = "名称", dataIndex = "compName", key = "compName")
|
||||
private String compName;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableTitle(title = "编号", dataIndex = "compNo", key = "compNo")
|
||||
private String compNo;
|
||||
|
||||
/**
|
||||
* 简称
|
||||
*/
|
||||
@TableTitle(title = "简称", dataIndex = "compNameShort", key = "compNameShort")
|
||||
private String compNameShort;
|
||||
|
||||
/**
|
||||
* 上级公司
|
||||
*/
|
||||
@TableTitle(title = "上级分部", dataIndex = "parentCompName", key = "parentCompName")
|
||||
private String parentCompName;
|
||||
|
||||
private Long parentCompany;
|
||||
|
||||
/**
|
||||
* 组织机构代码
|
||||
*/
|
||||
@TableTitle(title = "组织机构代码", dataIndex = "orgCode", key = "orgCode")
|
||||
private String orgCode;
|
||||
|
||||
/**
|
||||
* 行业
|
||||
*/
|
||||
@TableTitle(title = "行业", dataIndex = "industry", key = "industry")
|
||||
private String industry;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@TableTitle(title = "负责人", dataIndex = "compPrincipal", key = "compPrincipal")
|
||||
private String compPrincipal;
|
||||
|
||||
@TableTitle(title = "显示顺序", dataIndex = "showOrder", key = "showOrder", sorter = true)
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 禁用标记
|
||||
*/
|
||||
@TableTitle(title = "是否启用", dataIndex = "forbiddenTag", key = "forbiddenTag")
|
||||
private int forbiddenTag;
|
||||
|
||||
/**
|
||||
* 操作列
|
||||
*/
|
||||
@TableTitle(title = "", dataIndex = "operate", key = "operate")
|
||||
private String operate;
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<CompListDTO> children;
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
package com.engine.organization.entity.company.param;
|
||||
|
||||
import com.engine.organization.common.BaseQueryParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CompSearchParam extends BaseQueryParam {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String compNo;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String compName;
|
||||
|
||||
/**
|
||||
* 简称
|
||||
*/
|
||||
private String compNameShort;
|
||||
|
||||
/**
|
||||
* 上级公司
|
||||
*/
|
||||
private Long parentCompany;
|
||||
private Long ecCompany;
|
||||
|
||||
/**
|
||||
* 组织机构代码
|
||||
*/
|
||||
private String orgCode;
|
||||
|
||||
/**
|
||||
* 行业
|
||||
*/
|
||||
private Integer industry;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private Integer compPrincipal;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 禁用标记
|
||||
*/
|
||||
private Boolean forbiddenTag;
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
package com.engine.organization.entity.company.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CompPO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String compNo;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String compName;
|
||||
|
||||
/**
|
||||
* 简称
|
||||
*/
|
||||
private String compNameShort;
|
||||
|
||||
/**
|
||||
* 上级公司
|
||||
*/
|
||||
private Long parentCompany;
|
||||
|
||||
private Long ecCompany;
|
||||
|
||||
/**
|
||||
* 组织机构代码
|
||||
*/
|
||||
private String orgCode;
|
||||
|
||||
/**
|
||||
* 行业
|
||||
*/
|
||||
private Integer industry;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private Integer compPrincipal;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 禁用标记
|
||||
*/
|
||||
private Integer forbiddenTag;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer showOrder;
|
||||
|
||||
private String uuid;
|
||||
|
||||
private Long creator;
|
||||
private int deleteType;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ import com.engine.organization.entity.department.param.DeptSearchParam;
|
|||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
|
||||
import com.engine.organization.entity.searchtree.SearchTree;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.employee.EmployeeMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
|
|
@ -34,7 +34,7 @@ public class DepartmentBO {
|
|||
.deptNo(e.getDeptNo())
|
||||
.deptName(e.getDeptName())
|
||||
.deptNameShort(e.getDeptNameShort())
|
||||
.parentComp(null == e.getParentComp() ? "" : MapperProxyFactory.getProxy(CompMapper.class).listById(e.getParentComp()).getCompName())
|
||||
.parentComp(null == e.getParentComp() ? "" : MapperProxyFactory.getProxy(CompanyMapper.class).listById(e.getParentComp().intValue()).getSubCompanyName())
|
||||
.parentDept(e.getParentDept())
|
||||
.parentDeptName(null == poMaps.get(e.getParentDept()) ? "" : poMaps.get(e.getParentDept()).getDeptName())
|
||||
.deptPrincipal(getEmployeeNameById(e.getDeptPrincipal()))
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@ import lombok.NoArgsConstructor;
|
|||
public class DepartmentMoveParam {
|
||||
private Long id;
|
||||
private String moveType;
|
||||
private Long company;
|
||||
private Integer company;
|
||||
private Long department;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ public class DeptSearchParam extends BaseQueryParam {
|
|||
|
||||
private String deptNameShort;
|
||||
|
||||
private Long parentComp;
|
||||
private Long ecCompany;
|
||||
private Integer parentComp;
|
||||
private Integer ecCompany;
|
||||
|
||||
private Long parentDept;
|
||||
private Long ecDepartment;
|
||||
|
|
@ -39,7 +39,7 @@ public class DeptSearchParam extends BaseQueryParam {
|
|||
|
||||
private Boolean forbiddenTag;
|
||||
|
||||
private Long subcompanyid1;
|
||||
private Integer subcompanyid1;
|
||||
|
||||
private Long departmentid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ public class DepartmentPO {
|
|||
|
||||
private String deptNameShort;
|
||||
|
||||
private Long parentComp;
|
||||
private Long ecCompany;
|
||||
private Integer parentComp;
|
||||
private Integer ecCompany;
|
||||
|
||||
private Long parentDept;
|
||||
private Long ecDepartment;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class SingleDeptTreeVO {
|
|||
@TableTitle(title = "部门名称", dataIndex = "deptName", key = "deptName")
|
||||
private String deptName;
|
||||
|
||||
private Long parentComp; //上级分部
|
||||
private Integer parentComp; //上级分部
|
||||
|
||||
private Long parentDept; //上级部门id
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class JobSearchParam extends BaseQueryParam {
|
|||
/**
|
||||
* ec分部
|
||||
*/
|
||||
private Long ecCompany;
|
||||
private Integer ecCompany;
|
||||
/**
|
||||
* ec部门
|
||||
*/
|
||||
|
|
@ -79,7 +79,7 @@ public class JobSearchParam extends BaseQueryParam {
|
|||
*/
|
||||
private Integer showOrder;
|
||||
|
||||
private Long subcompanyid1;
|
||||
private Integer subcompanyid1;
|
||||
|
||||
private Long departmentid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ public class JobPO {
|
|||
/**
|
||||
* 所属分部
|
||||
*/
|
||||
private Long parentComp;
|
||||
private Integer parentComp;
|
||||
|
||||
/**
|
||||
* ec分部
|
||||
*/
|
||||
private Long ecCompany;
|
||||
private Integer ecCompany;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ public class StaffSearchParam {
|
|||
/**
|
||||
* 分部
|
||||
*/
|
||||
private Long compId;
|
||||
private Long ecCompany;
|
||||
private Integer compId;
|
||||
private Integer ecCompany;
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ public class StaffPO {
|
|||
/**
|
||||
* 分部
|
||||
*/
|
||||
private Long compId;
|
||||
private Long ecCompany;
|
||||
private Integer compId;
|
||||
private Integer ecCompany;
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,181 +0,0 @@
|
|||
package com.engine.organization.mapper.comp;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface CompMapper {
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<CompPO> list(@Param("orderSql") String orderSql);
|
||||
|
||||
/**
|
||||
* 查询所有被引用的ID
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<String> listUsedId();
|
||||
|
||||
List<String> listUsedIds();
|
||||
|
||||
List<String> hasSubs();
|
||||
|
||||
List<String> hasDetachSubs(@Param("companyIds") Collection<Long> companyIds);
|
||||
|
||||
/**
|
||||
* 根据搜索条件查询数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<CompPO> listByFilter(@Param("compPO") CompPO compPO, @Param("orderSql") String orderSql);
|
||||
|
||||
/**
|
||||
* 获取顶级数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<CompPO> listParent();
|
||||
|
||||
/**
|
||||
* 获取子层级数据
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<CompPO> listChild(@Param("ids") Collection ids);
|
||||
|
||||
/**
|
||||
* 获取当前ID的子元素
|
||||
*
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
List<CompPO> listChildByPID(@Param("pid") String pid);
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前ID的子元素个数
|
||||
*
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
int countChildByPID(@Param("pid") long pid);
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
CompPO listById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 根据UUID查询数据
|
||||
*
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
CompPO getCompanyByUUID(@Param("uuid") String uuid);
|
||||
|
||||
|
||||
/**
|
||||
* 根据No查询数据
|
||||
*
|
||||
* @param compNo
|
||||
* @return
|
||||
*/
|
||||
List<CompPO> listByNo(@Param("compNo") String compNo);
|
||||
|
||||
|
||||
/**
|
||||
* 浏览按钮展示数据查询
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> listCompsByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据ID批量查询数据
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<CompPO> getCompsByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 保存公司/分部基础信息
|
||||
*
|
||||
* @param compPO
|
||||
* @return
|
||||
*/
|
||||
int insertIgnoreNull(CompPO compPO);
|
||||
|
||||
|
||||
/**
|
||||
* 更新主表内容
|
||||
*
|
||||
* @param compPO
|
||||
* @return
|
||||
*/
|
||||
int updateBaseComp(CompPO compPO);
|
||||
|
||||
/**
|
||||
* 更新禁用标记
|
||||
*
|
||||
* @param compPO
|
||||
* @return
|
||||
*/
|
||||
int updateForbiddenTagById(CompPO compPO);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
int deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取最大排序
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Integer getMaxShowOrder();
|
||||
|
||||
/**
|
||||
* 根据名称和上级查找ID
|
||||
*
|
||||
* @param companyName
|
||||
* @param parentCompany
|
||||
* @return
|
||||
*/
|
||||
Long getIdByNameAndPid(@Param("companyName") String companyName, @Param("parentCompany") Long parentCompany);
|
||||
|
||||
/**
|
||||
* 统计顶层分部个数
|
||||
*
|
||||
* @param parentCompany
|
||||
* @return
|
||||
*/
|
||||
Integer countTopCompany(@Param("parentCompany") Long parentCompany);
|
||||
|
||||
int checkRepeatNo(@Param("companyNo") String companyNo, @Param("id") Long id);
|
||||
|
||||
CompPO getCompanyByNo(@Param("companyNo") String companyNo);
|
||||
|
||||
List<Long> getCompanyIdsByUuid(@Param("uuids") List<String> uuids);
|
||||
|
||||
}
|
||||
|
|
@ -1,550 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.engine.organization.mapper.comp.CompMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.organization.entity.company.po.CompPO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="comp_no" property="compNo"/>
|
||||
<result column="comp_name" property="compName"/>
|
||||
<result column="comp_name_short" property="compNameShort"/>
|
||||
<result column="parent_company" property="parentCompany"/>
|
||||
<result column="ec_company" property="ecCompany"/>
|
||||
<result column="org_code" property="orgCode"/>
|
||||
<result column="industry" property="industry"/>
|
||||
<result column="comp_principal" property="compPrincipal"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="forbidden_tag" property="forbiddenTag"/>
|
||||
<result column="show_order" property="showOrder"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="delete_type" property="deleteType"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
|
||||
<result column="uuid" property="uuid"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t
|
||||
.
|
||||
id
|
||||
, t.comp_no
|
||||
, t.comp_name
|
||||
, t.comp_name_short
|
||||
, t.parent_company
|
||||
, t.ec_company
|
||||
, t.org_code
|
||||
, t.industry
|
||||
, t.comp_principal
|
||||
, t.description
|
||||
, t.forbidden_tag
|
||||
, t.show_order
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
, t.uuid
|
||||
</sql>
|
||||
|
||||
<sql id="nullSql">
|
||||
and ifnull(parent_company,'0')='0'
|
||||
</sql>
|
||||
|
||||
<sql id="nullSql" databaseId="sqlserver">
|
||||
and isnull(parent_company,'0')='0'
|
||||
</sql>
|
||||
|
||||
<sql id="nullSql" databaseId="oracle">
|
||||
and NVL(parent_company,'0')='0'
|
||||
</sql>
|
||||
|
||||
<sql id="nullParentCompany">
|
||||
and ifnull(parent_company,0) =
|
||||
#{parentCompany}
|
||||
</sql>
|
||||
|
||||
<sql id="nullParentCompany" databaseId="sqlserver">
|
||||
and isnull(parent_company,0) =
|
||||
#{parentCompany}
|
||||
</sql>
|
||||
|
||||
<sql id="nullParentCompany" databaseId="oracle">
|
||||
and NVL(parent_company,0) =
|
||||
#{parentCompany}
|
||||
</sql>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.company.po.CompPO" keyProperty="id"
|
||||
keyColumn="id" useGeneratedKeys="true">
|
||||
INSERT INTO jcl_org_comp
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="compNo != null ">
|
||||
comp_no,
|
||||
</if>
|
||||
<if test="compName != null ">
|
||||
comp_name,
|
||||
</if>
|
||||
<if test="compNameShort != null ">
|
||||
comp_name_short,
|
||||
</if>
|
||||
<if test="parentCompany != null ">
|
||||
parent_company,
|
||||
</if>
|
||||
<if test="ecCompany != null ">
|
||||
ec_company,
|
||||
</if>
|
||||
<if test="orgCode != null ">
|
||||
org_code,
|
||||
</if>
|
||||
<if test="industry != null ">
|
||||
industry,
|
||||
</if>
|
||||
<if test="compPrincipal != null ">
|
||||
comp_principal,
|
||||
</if>
|
||||
<if test="description != null ">
|
||||
description,
|
||||
</if>
|
||||
forbidden_tag,
|
||||
<if test="showOrder != null ">
|
||||
show_order,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="compNo != null ">
|
||||
#{compNo},
|
||||
</if>
|
||||
<if test="compName != null ">
|
||||
#{compName},
|
||||
</if>
|
||||
<if test="compNameShort != null ">
|
||||
#{compNameShort},
|
||||
</if>
|
||||
<if test="parentCompany != null ">
|
||||
#{parentCompany},
|
||||
</if>
|
||||
<if test="ecCompany != null ">
|
||||
#{ecCompany},
|
||||
</if>
|
||||
<if test="orgCode != null ">
|
||||
#{orgCode},
|
||||
</if>
|
||||
<if test="industry != null ">
|
||||
#{industry},
|
||||
</if>
|
||||
<if test="compPrincipal != null ">
|
||||
#{compPrincipal},
|
||||
</if>
|
||||
<if test="description != null ">
|
||||
#{description},
|
||||
</if>
|
||||
0,
|
||||
<if test="showOrder != null ">
|
||||
#{showOrder},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.company.po.CompPO" databaseId="oracle">
|
||||
<selectKey keyProperty="id" resultType="long" order="AFTER">
|
||||
select JCL_ORG_COMP_ID.currval from dual
|
||||
</selectKey>
|
||||
INSERT INTO jcl_org_comp
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="compNo != null ">
|
||||
comp_no,
|
||||
</if>
|
||||
<if test="compName != null ">
|
||||
comp_name,
|
||||
</if>
|
||||
<if test="compNameShort != null ">
|
||||
comp_name_short,
|
||||
</if>
|
||||
<if test="parentCompany != null ">
|
||||
parent_company,
|
||||
</if>
|
||||
<if test="ecCompany != null ">
|
||||
ec_company,
|
||||
</if>
|
||||
<if test="orgCode != null ">
|
||||
org_code,
|
||||
</if>
|
||||
<if test="industry != null ">
|
||||
industry,
|
||||
</if>
|
||||
<if test="compPrincipal != null ">
|
||||
comp_principal,
|
||||
</if>
|
||||
<if test="description != null ">
|
||||
description,
|
||||
</if>
|
||||
forbidden_tag,
|
||||
<if test="showOrder != null ">
|
||||
show_order,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="compNo != null ">
|
||||
#{compNo},
|
||||
</if>
|
||||
<if test="compName != null ">
|
||||
#{compName},
|
||||
</if>
|
||||
<if test="compNameShort != null ">
|
||||
#{compNameShort},
|
||||
</if>
|
||||
<if test="parentCompany != null ">
|
||||
#{parentCompany},
|
||||
</if>
|
||||
<if test="ec_company != null ">
|
||||
#{ecCompany},
|
||||
</if>
|
||||
<if test="orgCode != null ">
|
||||
#{orgCode},
|
||||
</if>
|
||||
<if test="industry != null ">
|
||||
#{industry},
|
||||
</if>
|
||||
<if test="compPrincipal != null ">
|
||||
#{compPrincipal},
|
||||
</if>
|
||||
<if test="description != null ">
|
||||
#{description},
|
||||
</if>
|
||||
0,
|
||||
<if test="showOrder != null ">
|
||||
#{showOrder},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="list" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0 order by ${orderSql}
|
||||
</select>
|
||||
|
||||
<select id="listParent" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0
|
||||
<include refid="nullSql"/>
|
||||
</select>
|
||||
|
||||
<select id="listChild" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0
|
||||
AND parent_company IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="listById" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0
|
||||
and id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="listByNo" parameterType="com.engine.organization.entity.company.po.CompPO" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_comp t where comp_no = #{compNo} AND delete_type = 0
|
||||
</select>
|
||||
<select id="listByFilter" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0
|
||||
<include refid="likeSQL"/>
|
||||
<if test=" compPO.parentCompany != null ">
|
||||
and t.parent_company = #{compPO.parentCompany}
|
||||
</if>
|
||||
<if test=" compPO.ecCompany != null ">
|
||||
and t.ec_company = #{compPO.ecCompany}
|
||||
</if>
|
||||
<if test=" compPO.industry != null ">
|
||||
and t.industry = #{compPO.industry}
|
||||
</if>
|
||||
<if test=" compPO.compPrincipal != null ">
|
||||
and t.comp_principal = #{compPO.compPrincipal}
|
||||
</if>
|
||||
<if test=" compPO.forbiddenTag != null ">
|
||||
and t.forbidden_tag = #{compPO.forbiddenTag}
|
||||
</if>
|
||||
order by ${orderSql}
|
||||
</select>
|
||||
|
||||
<select id="listCompsByIds" resultType="java.util.Map">
|
||||
select
|
||||
id as "id",
|
||||
comp_name as "name"
|
||||
from jcl_org_comp t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="listChildByPID" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0
|
||||
and parent_company = #{pid}
|
||||
</select>
|
||||
<select id="countChildByPID" resultType="java.lang.Integer">
|
||||
SELECT count(1)
|
||||
FROM jcl_org_comp t
|
||||
WHERE t.delete_type = 0
|
||||
and parent_company = #{pid}
|
||||
</select>
|
||||
<select id="getCompsByIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_comp t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="listUsedId" resultType="java.lang.String">
|
||||
select parent_comp
|
||||
from JCL_ORG_DEPT
|
||||
where delete_type = 0
|
||||
union
|
||||
select parent_comp
|
||||
from JCL_ORG_JOB
|
||||
where delete_type = 0
|
||||
union
|
||||
select comp_id
|
||||
from JCL_ORG_STAFF
|
||||
where delete_type = 0
|
||||
</select>
|
||||
<select id="getMaxShowOrder" resultType="java.lang.Integer">
|
||||
select max(show_order)
|
||||
from jcl_org_comp
|
||||
</select>
|
||||
<select id="getIdByNameAndPid" resultType="java.lang.Long">
|
||||
select id
|
||||
from jcl_org_comp
|
||||
where delete_type = 0 and comp_name = #{companyName}
|
||||
<include refid="nullParentCompany"/>
|
||||
</select>
|
||||
<select id="countTopCompany" resultType="java.lang.Integer">
|
||||
select COUNT(id) from jcl_org_comp where 1=1
|
||||
<include refid="nullParentCompany"/>
|
||||
</select>
|
||||
<select id="listUsedIds" resultType="java.lang.String">
|
||||
select company_id
|
||||
from JCL_ORG_STAFFPLAN
|
||||
where delete_type = 0
|
||||
union
|
||||
select jcl_rolelevel
|
||||
from jcl_org_detach
|
||||
where delete_type = 0
|
||||
</select>
|
||||
<select id="getCompanyByUUID" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0
|
||||
and uuid = #{uuid}
|
||||
</select>
|
||||
<select id="checkRepeatNo" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from jcl_org_comp t
|
||||
where t.delete_type = 0
|
||||
AND comp_no = #{companyNo}
|
||||
<if test=" id != null ">
|
||||
and t.id != #{id}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getCompanyByNo" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from from jcl_org_comp t
|
||||
where t.delete_type = 0
|
||||
AND comp_no = #{companyNo}
|
||||
</select>
|
||||
<select id="hasSubs" resultType="java.lang.String">
|
||||
select parent_company
|
||||
from jcl_org_comp
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
union
|
||||
select parent_comp
|
||||
from jcl_org_dept
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
</select>
|
||||
<select id="getCompanyIdsByUuid" resultType="java.lang.Long">
|
||||
select id from jcl_org_comp
|
||||
where delete_type = 0 and uuid in
|
||||
<foreach collection="uuids" open="(" item="uuid" separator="," close=")">
|
||||
#{uuid}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="hasDetachSubs" resultType="java.lang.String">
|
||||
select parent_company
|
||||
from jcl_org_comp
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
and id in
|
||||
<foreach collection="companyIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
union
|
||||
select parent_comp
|
||||
from jcl_org_dept
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
and parent_comp in
|
||||
<foreach collection="companyIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.sequence.po.SequencePO">
|
||||
update jcl_org_comp
|
||||
<set>
|
||||
forbidden_tag=#{forbiddenTag},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<update id="deleteByIds">
|
||||
UPDATE jcl_org_comp
|
||||
SET delete_type = 1
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateBaseComp" parameterType="com.engine.organization.entity.company.po.CompPO">
|
||||
update jcl_org_comp
|
||||
<set>
|
||||
creator=#{creator},
|
||||
update_time=#{updateTime},
|
||||
comp_name=#{compName},
|
||||
comp_name_short=#{compNameShort},
|
||||
parent_company=#{parentCompany},
|
||||
ec_company=#{ecCompany},
|
||||
org_code=#{orgCode},
|
||||
industry=#{industry},
|
||||
comp_principal=#{compPrincipal},
|
||||
description=#{description},
|
||||
show_order=#{showOrder},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<sql id="likeSQL">
|
||||
<if test=" compPO.compNo != null and compPO.compNo != '' ">
|
||||
and t.comp_no like CONCAT('%',#{compPO.compNo},'%')
|
||||
</if>
|
||||
<if test=" compPO.compName != null and compPO.compName != '' ">
|
||||
and t.comp_name like CONCAT('%',#{compPO.compName},'%')
|
||||
</if>
|
||||
<if test=" compPO.compNameShort != null and compPO.compNameShort != '' ">
|
||||
and t.comp_name_short like CONCAT('%',#{compPO.compNameShort},'%')
|
||||
</if>
|
||||
<if test=" compPO.orgCode != null and compPO.orgCode != '' ">
|
||||
and t.org_code like CONCAT('%',#{compPO.orgCode},'%')
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="likeSQL" databaseId="oracle">
|
||||
<if test=" compPO.compNo != null and compPO.compNo != '' ">
|
||||
and t.comp_no like '%'||#{compPO.compNo}||'%'
|
||||
</if>
|
||||
<if test=" compPO.compName != null and compPO.compName != '' ">
|
||||
and t.comp_name like '%'||#{compPO.compName}||'%'
|
||||
</if>
|
||||
<if test=" compPO.compNameShort != null and compPO.compNameShort != '' ">
|
||||
and t.comp_name_short like '%'||#{compPO.compNameShort}||'%'
|
||||
</if>
|
||||
<if test=" compPO.orgCode != null and compPO.orgCode != '' ">
|
||||
and t.org_code like '%'||#{compPO.orgCode}||'%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="likeSQL" databaseId="sqlserver">
|
||||
<if test=" compPO.compNo != null and compPO.compNo != '' ">
|
||||
and t.comp_no like '%'+#{compPO.compNo}+'%'
|
||||
</if>
|
||||
<if test=" compPO.compName != null and compPO.compName != '' ">
|
||||
and t.comp_name like '%'+#{compPO.compName}+'%'
|
||||
</if>
|
||||
<if test=" compPO.compNameShort != null and compPO.compNameShort != '' ">
|
||||
and t.comp_name_short like '%'+#{compPO.compNameShort}+'%'
|
||||
</if>
|
||||
<if test=" compPO.orgCode != null and compPO.orgCode != '' ">
|
||||
and t.org_code like '%'+#{compPO.orgCode}+'%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -38,4 +38,47 @@ public interface CompanyMapper {
|
|||
* @return
|
||||
*/
|
||||
List<CompanyPO> listChild(@Param("ids") Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
CompanyPO listById(@Param("id") Integer id);
|
||||
|
||||
/**
|
||||
* 根据ID批量查询数据
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<CompanyPO> getCompsByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取顶级数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<CompanyPO> listParent();
|
||||
|
||||
List<String> hasSubs();
|
||||
|
||||
List<String> hasDetachSubs(@Param("companyIds") Collection<Long> companyIds);
|
||||
|
||||
/**
|
||||
* 根据名称和上级查找ID
|
||||
*
|
||||
* @param subCompanyName
|
||||
* @param supSubComId
|
||||
* @return
|
||||
*/
|
||||
Long getIdByNameAndPid(@Param("subCompanyName") String subCompanyName, @Param("supSubComId") Integer supSubComId);
|
||||
|
||||
/**
|
||||
* 获取最大排序
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Integer getMaxShowOrder();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,6 +91,77 @@
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="listById" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
hrmsubcompany t
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getCompsByIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from hrmsubcompany t
|
||||
WHERE id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="listParent" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
hrmsubcompany t
|
||||
WHERE t.SUPSUBCOMID = 0
|
||||
</select>
|
||||
|
||||
<select id="hasSubs" resultType="java.lang.String">
|
||||
select supsubcomid
|
||||
from hrmsubcompany
|
||||
where 1=1
|
||||
<include refid="subsWhere"/>
|
||||
union
|
||||
select subcompanyid1
|
||||
from hrmdepartment
|
||||
where 1=1
|
||||
<include refid="subsWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="hasDetachSubs" resultType="java.lang.String">
|
||||
select supsubcomid
|
||||
from hrmsubcompany
|
||||
where 1=1
|
||||
<include refid="subsWhere"/>
|
||||
and id in
|
||||
<foreach collection="companyIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
union
|
||||
select subcompanyid1
|
||||
from hrmdepartment
|
||||
where 1=1
|
||||
<include refid="subsWhere"/>
|
||||
and subcompanyid1 in
|
||||
<foreach collection="companyIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getIdByNameAndPid" resultType="java.lang.Long">
|
||||
select id
|
||||
from hrmsubcompany
|
||||
where subcompanyname = #{subCompanyName}
|
||||
and supsubcomid = #{supSubComId}
|
||||
</select>
|
||||
|
||||
<select id="getMaxShowOrder" resultType="java.lang.Integer">
|
||||
select max(showorder)
|
||||
from hrmsubcompany
|
||||
</select>
|
||||
|
||||
|
||||
<sql id="likeSQL">
|
||||
<if test=" CompanyPO.subCompanyCode != null and CompanyPO.subCompanyCode != '' ">
|
||||
and t.subCompanyCode like CONCAT('%',#{CompanyPO.subCompanyCode},'%')
|
||||
|
|
@ -127,4 +198,14 @@
|
|||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="subsWhere">
|
||||
and ifnull(canceled,0)=0
|
||||
</sql>
|
||||
<sql id="subsWhere" databaseId="oracle">
|
||||
and nvl(canceled,0)=0
|
||||
</sql>
|
||||
<sql id="subsWhere" databaseId="sqlserver">
|
||||
and isnull(canceled,0)=0
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -138,4 +138,7 @@ public interface DepartmentMapper {
|
|||
List<String> hasSubs();
|
||||
|
||||
int countUsedInJob(@Param("departmentId") Long departmentId);
|
||||
|
||||
/**************************************************/
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ public interface JobMapper {
|
|||
* @param parentCompany
|
||||
* @return
|
||||
*/
|
||||
int updateJobCompany(@Param("ids") Collection<Long> ids, @Param("parentCompany") Long parentCompany, @Param("ecCompany") String ecCompany);
|
||||
int updateJobCompany(@Param("ids") Collection<Long> ids, @Param("parentCompany") Integer parentCompany, @Param("ecCompany") String ecCompany);
|
||||
|
||||
int isHasResource(@Param("jobId") Long jobId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public interface ResourceMapper {
|
|||
|
||||
List<HrmResourcePO> getResourceListByJobId(@Param("jobId") Long jobId);
|
||||
|
||||
int updateResourceJob(@Param("originalJobId") Long originalJobId, @Param("targetJobId") Long targetJobId, @Param("parentComp") Long parentComp, @Param("parentDept") Long parentDept, @Param("ecCompany") Long ecCompany, @Param("ecDepartment") Long ecDepartment);
|
||||
int updateResourceJob(@Param("originalJobId") Long originalJobId, @Param("targetJobId") Long targetJobId, @Param("parentComp") Integer parentComp, @Param("parentDept") Long parentDept, @Param("ecCompany") Integer ecCompany, @Param("ecDepartment") Long ecDepartment);
|
||||
|
||||
HrmResourcePO getResourceById(@Param("id") String id);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.engine.organization.service;
|
||||
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.engine.organization.entity.company.param.CompSearchParam;
|
||||
import com.engine.organization.entity.company.param.CompanyParam;
|
||||
import com.engine.organization.entity.department.param.DepartmentMoveParam;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
|
|
@ -38,7 +37,7 @@ public interface CompService {
|
|||
*
|
||||
* @param params
|
||||
*/
|
||||
int updateForbiddenTagById(CompSearchParam params);
|
||||
int updateForbiddenTagById(CompanyParam params);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -72,7 +71,7 @@ public interface CompService {
|
|||
Map<String, List<MenuBtn>> getHasRight();
|
||||
|
||||
/**
|
||||
* 获取基本信息表单
|
||||
* 获取编辑表单
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.hrm.bean.HrmFieldBean;
|
||||
|
|
@ -10,37 +9,28 @@ import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
|||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hrm.entity.RuleCodeType;
|
||||
import com.engine.hrm.service.impl.OrganizationServiceImpl;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
||||
import com.engine.organization.entity.company.bo.CompanyBO;
|
||||
import com.engine.organization.entity.company.dto.CompListDTO;
|
||||
import com.engine.organization.entity.company.dto.CompanyListDTO;
|
||||
import com.engine.organization.entity.company.param.CompSearchParam;
|
||||
import com.engine.organization.entity.company.param.CompanyParam;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import com.engine.organization.entity.department.param.DepartmentMoveParam;
|
||||
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.service.CompService;
|
||||
import com.engine.organization.service.ExtService;
|
||||
import com.engine.organization.thread.OrganizationSyncEc;
|
||||
import com.engine.organization.util.*;
|
||||
import com.engine.organization.util.coderule.CodeRuleUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
import com.engine.organization.util.page.Column;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
import com.engine.organization.util.page.PageUtil;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.Util;
|
||||
|
|
@ -94,18 +84,10 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
||||
}
|
||||
|
||||
private static CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
private ExtendTitleMapper getExtendTitleMapper() {
|
||||
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
|
||||
}
|
||||
|
||||
private SystemDataMapper getSystemDataMapper() {
|
||||
return MapperProxyFactory.getProxy(SystemDataMapper.class);
|
||||
}
|
||||
|
||||
private ExtService getExtService(User user) {
|
||||
return ServiceUtil.getService(ExtServiceImpl.class, user);
|
||||
}
|
||||
|
|
@ -125,13 +107,13 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams());
|
||||
List<CompanyPO> allList = getCompanyMapper().listAll(orderSql);
|
||||
|
||||
//TODO new DetachUtil(user.getUID()).filterCompanyList(allList);
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allList);
|
||||
|
||||
// 通过子级遍历父级元素
|
||||
if (filter) {
|
||||
// 根据条件获取元素
|
||||
List<CompanyPO> filterCompPOs = getCompanyMapper().listByFilter(companyPO, orderSql);
|
||||
//TODO new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs);
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs);
|
||||
|
||||
// 添加父级元素
|
||||
List<CompanyListDTO> compListDTOS = CompanyBO.buildCompDTOList(allList, filterCompPOs);
|
||||
|
|
@ -149,7 +131,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
pageInfos.setPageNum(params.getCurrent());
|
||||
pageInfos.setPageSize(params.getPageSize());
|
||||
|
||||
OrganizationWeaTable<CompListDTO> table = new OrganizationWeaTable<>(user, CompListDTO.class);
|
||||
OrganizationWeaTable<CompanyListDTO> table = new OrganizationWeaTable<>(user, CompanyListDTO.class);
|
||||
List<Column> columns = pageInfos.getColumns();
|
||||
List<WeaTableColumn> weaTableColumn = columns.stream().map(v -> new WeaTableColumn("100", v.getTitle(), v.getKey())).collect(Collectors.toList());
|
||||
table.setColumns(weaTableColumn);
|
||||
|
|
@ -173,49 +155,22 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int updateForbiddenTagById(CompSearchParam params) {
|
||||
public int updateForbiddenTagById(CompanyParam params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
CompPO compPO = CompPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build();
|
||||
CompanyPO compPO = CompanyPO.builder().id(params.getId()).canceled(params.getCanceled() ? 0 : 1).build();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", compPO.getId());
|
||||
map.put("forbiddenTag", compPO.getForbiddenTag());
|
||||
map.put("id", compPO.getId().toString());
|
||||
map.put("forbiddenTag", compPO.getCanceled());
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.CANCELED, map).sync();
|
||||
return getCompMapper().updateForbiddenTagById(compPO);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long updateComp(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
CompSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), CompSearchParam.class);
|
||||
String groupId = (String) params.get("viewCondition");
|
||||
if ("0".equals(groupId) || GROUP_ID.toString().equals(groupId)) {
|
||||
String oldCompNo = getCompMapper().listById(searchParam.getId()).getCompNo();
|
||||
String compNo = searchParam.getCompNo();
|
||||
if (!compNo.equals(oldCompNo)) {
|
||||
compNo = repeatDetermine(compNo);
|
||||
params.put("comp_no", compNo);
|
||||
}
|
||||
// 上级分部
|
||||
String ecCompany = Util.null2String(params.get("ec_company"));
|
||||
if (StringUtils.isNotBlank(ecCompany)) {
|
||||
Long parent_company = Objects.requireNonNull(EcHrmRelationUtil.getJclCompanyId(ecCompany)).getId();
|
||||
// 上级分部不能选择本身
|
||||
OrganizationAssert.isFalse(parent_company.equals(searchParam.getId()), "上级分部不能选择本身");
|
||||
params.put("parent_company", parent_company);
|
||||
} else {
|
||||
params.put("parent_company", "");
|
||||
}
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, params).sync();
|
||||
// 更新主表数据
|
||||
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMP, params, "", searchParam.getId());
|
||||
}
|
||||
|
||||
// 更新主表拓展表
|
||||
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMPEXT, params, "", searchParam.getId());
|
||||
//更新明细表
|
||||
getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_COMPEXT_DT1, params, searchParam.getId());
|
||||
|
||||
return searchParam.getId();
|
||||
String ecCompanyId = Util.null2String(params.get("id"));
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, params).sync();
|
||||
return Long.parseLong(ecCompanyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -489,31 +444,32 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
* @return
|
||||
*/
|
||||
public static String repeatDetermine(String compNo) {
|
||||
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.SUBCOMPANY.getValue());
|
||||
if (StringUtils.isNotBlank(compNo)) {
|
||||
compNo = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, compNo);
|
||||
List<CompPO> list = getCompMapper().listByNo(Util.null2String(compNo));
|
||||
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
||||
} else {
|
||||
OrganizationAssert.isTrue(null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable()), "编号不允许为空");
|
||||
compNo = autoCreateCompanyNo();
|
||||
}
|
||||
return compNo;
|
||||
//CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.SUBCOMPANY.getValue());
|
||||
//if (StringUtils.isNotBlank(compNo)) {
|
||||
// compNo = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, compNo);
|
||||
// List<CompPO> list = getCompMapper().listByNo(Util.null2String(compNo));
|
||||
// OrganizationAssert.isEmpty(list, "编号不允许重复");
|
||||
//} else {
|
||||
// OrganizationAssert.isTrue(null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable()), "编号不允许为空");
|
||||
// compNo = autoCreateCompanyNo();
|
||||
//}
|
||||
//return compNo;
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动编号处理
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static String autoCreateCompanyNo() {
|
||||
String generateCode = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, "");
|
||||
List<CompPO> list = getCompMapper().listByNo(Util.null2String(generateCode));
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
generateCode = autoCreateCompanyNo();
|
||||
}
|
||||
return generateCode;
|
||||
}
|
||||
///**
|
||||
// * 自动编号处理
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
//private static String autoCreateCompanyNo() {
|
||||
// String generateCode = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, "");
|
||||
// List<CompPO> list = getCompMapper().listByNo(Util.null2String(generateCode));
|
||||
// if (CollectionUtils.isNotEmpty(list)) {
|
||||
// generateCode = autoCreateCompanyNo();
|
||||
// }
|
||||
// return generateCode;
|
||||
//}
|
||||
|
||||
/**
|
||||
* 添加子元素ID
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
|
|
@ -13,8 +12,8 @@ import com.engine.organization.component.OrganizationWeaTable;
|
|||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
import com.engine.organization.entity.company.bo.CompBO;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.company.bo.CompanyBO;
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import com.engine.organization.entity.department.bo.DepartmentBO;
|
||||
import com.engine.organization.entity.department.dto.DepartmentListDTO;
|
||||
import com.engine.organization.entity.department.param.*;
|
||||
|
|
@ -31,7 +30,7 @@ import com.engine.organization.enums.LogModuleNameEnum;
|
|||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtDTMapper;
|
||||
import com.engine.organization.mapper.extend.ExtMapper;
|
||||
|
|
@ -111,8 +110,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
private CompanyMapper getCompanyMapper() {
|
||||
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
||||
}
|
||||
|
||||
private ExtendTitleMapper getExtendTitleMapper() {
|
||||
|
|
@ -218,44 +217,45 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
@Override
|
||||
public Long saveBaseForm(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
String deptNo = (String) params.get("dept_no");
|
||||
// 判断是否开启自动编号
|
||||
deptNo = repeatDetermine(deptNo);
|
||||
params.put("dept_no", deptNo);
|
||||
if (StringUtils.isBlank(Util.null2String(params.get("show_order")))) {
|
||||
Integer maxShowOrder = getDepartmentMapper().getMaxShowOrder();
|
||||
if (null == maxShowOrder) {
|
||||
maxShowOrder = 0;
|
||||
}
|
||||
params.put("show_order", maxShowOrder + 1);
|
||||
}
|
||||
// 上级分部
|
||||
String ecCompany = Util.null2String(params.get("ec_company"));
|
||||
if (StringUtils.isNotBlank(ecCompany)) {
|
||||
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(ecCompany);
|
||||
if (null != jclCompanyId) {
|
||||
params.put("parent_comp", jclCompanyId.getId());
|
||||
}
|
||||
}
|
||||
// 上级部门
|
||||
String ecDepartment = Util.null2String(params.get("ec_department"));
|
||||
if (StringUtils.isNotBlank(ecDepartment)) {
|
||||
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(ecDepartment);
|
||||
if (null != jclDepartmentId) {
|
||||
params.put("parent_dept", jclDepartmentId.getId());
|
||||
// 部门不为空,自动指定所属分部
|
||||
params.put("parent_comp", jclDepartmentId.getParentComp());
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartmentId.getParentComp())));
|
||||
}
|
||||
|
||||
}
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, params).sync();
|
||||
String ecCompanyID = Util.null2String(syncMap.get("id"));
|
||||
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecCompanyID), syncMap.get("message").toString());
|
||||
// 查询UUID
|
||||
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_DEPARTMENT, ecCompanyID);
|
||||
params.put("uuid", recordInfo.getUuid());
|
||||
return getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPT, params, "", null);
|
||||
//String deptNo = (String) params.get("dept_no");
|
||||
//// 判断是否开启自动编号
|
||||
//deptNo = repeatDetermine(deptNo);
|
||||
//params.put("dept_no", deptNo);
|
||||
//if (StringUtils.isBlank(Util.null2String(params.get("show_order")))) {
|
||||
// Integer maxShowOrder = getDepartmentMapper().getMaxShowOrder();
|
||||
// if (null == maxShowOrder) {
|
||||
// maxShowOrder = 0;
|
||||
// }
|
||||
// params.put("show_order", maxShowOrder + 1);
|
||||
//}
|
||||
//// 上级分部
|
||||
//String ecCompany = Util.null2String(params.get("ec_company"));
|
||||
//if (StringUtils.isNotBlank(ecCompany)) {
|
||||
// CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(ecCompany);
|
||||
// if (null != jclCompanyId) {
|
||||
// params.put("parent_comp", jclCompanyId.getId());
|
||||
// }
|
||||
//}
|
||||
//// 上级部门
|
||||
//String ecDepartment = Util.null2String(params.get("ec_department"));
|
||||
//if (StringUtils.isNotBlank(ecDepartment)) {
|
||||
// DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(ecDepartment);
|
||||
// if (null != jclDepartmentId) {
|
||||
// params.put("parent_dept", jclDepartmentId.getId());
|
||||
// // 部门不为空,自动指定所属分部
|
||||
// params.put("parent_comp", jclDepartmentId.getParentComp());
|
||||
// params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartmentId.getParentComp())));
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, params).sync();
|
||||
//String ecCompanyID = Util.null2String(syncMap.get("id"));
|
||||
//OrganizationAssert.isTrue(StringUtils.isNotBlank(ecCompanyID), syncMap.get("message").toString());
|
||||
//// 查询UUID
|
||||
//RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_DEPARTMENT, ecCompanyID);
|
||||
//params.put("uuid", recordInfo.getUuid());
|
||||
//return getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPT, params, "", null);
|
||||
return 1L;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -278,60 +278,61 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
|
||||
@Override
|
||||
public Long updateForm(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
DeptSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), DeptSearchParam.class);
|
||||
String groupId = (String) params.get("viewCondition");
|
||||
if ("0".equals(groupId) || GROUP_ID.toString().equals(groupId)) {
|
||||
DepartmentPO oldDept = getDepartmentMapper().getDeptById(searchParam.getId());
|
||||
String deptNo = searchParam.getDeptNo();
|
||||
if (!deptNo.equals(oldDept.getDeptNo())) {
|
||||
deptNo = repeatDetermine(deptNo);
|
||||
params.put("dept_no", deptNo);
|
||||
}
|
||||
// 上级分部
|
||||
String ecCompany = Util.null2String(params.get("ec_company"));
|
||||
if (StringUtils.isNotBlank(ecCompany)) {
|
||||
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(ecCompany);
|
||||
if (null != jclCompanyId) {
|
||||
params.put("parent_comp", jclCompanyId.getId());
|
||||
}
|
||||
}
|
||||
// 上级部门
|
||||
String ecDepartment = Util.null2String(params.get("ec_department"));
|
||||
if (StringUtils.isNotBlank(ecDepartment)) {
|
||||
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(ecDepartment);
|
||||
if (null != jclDepartmentId) {
|
||||
// 上级部门不能选择本身
|
||||
OrganizationAssert.isFalse(jclDepartmentId.getId().equals(searchParam.getId()), "上级部门不能选择本身");
|
||||
params.put("parent_dept", jclDepartmentId.getId());
|
||||
// 部门不为空,自动指定所属分部
|
||||
params.put("parent_comp", jclDepartmentId.getParentComp());
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartmentId.getParentComp())));
|
||||
}
|
||||
|
||||
} else {
|
||||
params.put("parent_dept", "");
|
||||
}
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, params).sync();
|
||||
// 更新主表数据
|
||||
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPT, params, "", searchParam.getId());
|
||||
|
||||
DepartmentPO newDeptById = getDepartmentMapper().getDeptById(searchParam.getId());
|
||||
new DepartmentTriggerRunnable(oldDept, newDeptById).run();
|
||||
|
||||
Long parentComp = StringUtils.isNotEmpty(Util.null2String(params.get("parent_comp"))) ? Long.parseLong(Util.null2String(params.get("parent_comp"))) : null;
|
||||
// 刷新岗位所属分部
|
||||
refreshJobComp(searchParam.getId(), parentComp);
|
||||
List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(searchParam.getId());
|
||||
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(Util.null2String(parentComp));
|
||||
forbiddenChildTag(parentComp, ecCompanyId, childList);
|
||||
}
|
||||
// 更新主表拓展表
|
||||
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPTEXT, params, "", searchParam.getId());
|
||||
//更新明细表
|
||||
getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_DEPTEXT_DT1, params, searchParam.getId());
|
||||
|
||||
return searchParam.getId();
|
||||
//HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
//DeptSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), DeptSearchParam.class);
|
||||
//String groupId = (String) params.get("viewCondition");
|
||||
//if ("0".equals(groupId) || GROUP_ID.toString().equals(groupId)) {
|
||||
// DepartmentPO oldDept = getDepartmentMapper().getDeptById(searchParam.getId());
|
||||
// String deptNo = searchParam.getDeptNo();
|
||||
// if (!deptNo.equals(oldDept.getDeptNo())) {
|
||||
// deptNo = repeatDetermine(deptNo);
|
||||
// params.put("dept_no", deptNo);
|
||||
// }
|
||||
// // 上级分部
|
||||
// String ecCompany = Util.null2String(params.get("ec_company"));
|
||||
// if (StringUtils.isNotBlank(ecCompany)) {
|
||||
// CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(ecCompany);
|
||||
// if (null != jclCompanyId) {
|
||||
// params.put("parent_comp", jclCompanyId.getId());
|
||||
// }
|
||||
// }
|
||||
// // 上级部门
|
||||
// String ecDepartment = Util.null2String(params.get("ec_department"));
|
||||
// if (StringUtils.isNotBlank(ecDepartment)) {
|
||||
// DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(ecDepartment);
|
||||
// if (null != jclDepartmentId) {
|
||||
// // 上级部门不能选择本身
|
||||
// OrganizationAssert.isFalse(jclDepartmentId.getId().equals(searchParam.getId()), "上级部门不能选择本身");
|
||||
// params.put("parent_dept", jclDepartmentId.getId());
|
||||
// // 部门不为空,自动指定所属分部
|
||||
// params.put("parent_comp", jclDepartmentId.getParentComp());
|
||||
// params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartmentId.getParentComp())));
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// params.put("parent_dept", "");
|
||||
// }
|
||||
// new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, params).sync();
|
||||
// // 更新主表数据
|
||||
// getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPT, params, "", searchParam.getId());
|
||||
//
|
||||
// DepartmentPO newDeptById = getDepartmentMapper().getDeptById(searchParam.getId());
|
||||
// new DepartmentTriggerRunnable(oldDept, newDeptById).run();
|
||||
//
|
||||
// Long parentComp = StringUtils.isNotEmpty(Util.null2String(params.get("parent_comp"))) ? Long.parseLong(Util.null2String(params.get("parent_comp"))) : null;
|
||||
// // 刷新岗位所属分部
|
||||
// refreshJobComp(searchParam.getId(), parentComp);
|
||||
// List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(searchParam.getId());
|
||||
// String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(Util.null2String(parentComp));
|
||||
// forbiddenChildTag(parentComp, ecCompanyId, childList);
|
||||
//}
|
||||
//// 更新主表拓展表
|
||||
//getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPTEXT, params, "", searchParam.getId());
|
||||
////更新明细表
|
||||
//getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_DEPTEXT_DT1, params, searchParam.getId());
|
||||
//
|
||||
//return searchParam.getId();
|
||||
return 1L;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -451,10 +452,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
Map<String, Object> params = new HashMap<>();
|
||||
// 分部
|
||||
if (StringUtils.isNotBlank(Util.null2String(param.getSubcompanyid1()))) {
|
||||
CompPO compPO = getCompMapper().listById(param.getSubcompanyid1());
|
||||
if (null != compPO) {
|
||||
params.put("parent_comp", compPO.getId());
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(compPO.getId().toString()));
|
||||
CompanyPO companyPO = getCompanyMapper().listById(param.getSubcompanyid1());
|
||||
if (null != companyPO) {
|
||||
params.put("parent_comp", companyPO.getId());
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(companyPO.getId().toString()));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
|
|
@ -521,19 +522,19 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
maxShowOrder = null == maxShowOrder ? 0 : maxShowOrder;
|
||||
for (Long departmentId : idList) {
|
||||
// 复制当前部门
|
||||
recursionCopyDept(departmentId, null, Long.parseLong(copyParam.getCompany()), maxShowOrder, copyParam.getCopyJob(), copyParam.getCopySubDept(), copyParam.getCopySubJob());
|
||||
recursionCopyDept(departmentId, null,Integer.parseInt(copyParam.getCompany()), maxShowOrder, copyParam.getCopyJob(), copyParam.getCopySubDept(), copyParam.getCopySubJob());
|
||||
}
|
||||
return insertCount;
|
||||
}
|
||||
|
||||
private void recursionCopyDept(Long originalDeptId, Long parentDepartmentId, Long companyId, Integer maxShowOrder, String copyJob, String copySubDept, String copySubJob) {
|
||||
private void recursionCopyDept(Long originalDeptId, Long parentDepartmentId, Integer companyId, Integer maxShowOrder, String copyJob, String copySubDept, String copySubJob) {
|
||||
// 源部门
|
||||
DepartmentPO deptById = getDepartmentMapper().getDeptById(originalDeptId);
|
||||
long timeMillis = System.currentTimeMillis();
|
||||
// 处理自动编号
|
||||
deptById.setDeptNo(CodeRuleUtil.generateCode(RuleCodeType.DEPARTMENT, deptById.getDeptNo(), timeMillis));
|
||||
// 设置上级分部
|
||||
deptById.setParentComp(EcHrmRelationUtil.getJclCompanyId(Util.null2String(companyId)).getId());
|
||||
deptById.setParentComp(companyId);
|
||||
deptById.setEcCompany(companyId);
|
||||
deptById.setParentDept(parentDepartmentId);
|
||||
if (null != parentDepartmentId) {
|
||||
|
|
@ -718,10 +719,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
DepartmentPO deptById = getDepartmentMapper().getDeptById(moveParam.getId());
|
||||
// 0:公司/分部 1:部门
|
||||
if ("0".equals(moveParam.getMoveType())) {
|
||||
Long company = moveParam.getCompany();
|
||||
Integer company = moveParam.getCompany();
|
||||
OrganizationAssert.notNull(company, "请选择要转移到的分部");
|
||||
deptById.setEcCompany(company);
|
||||
deptById.setParentComp(Objects.requireNonNull(EcHrmRelationUtil.getJclCompanyId(Util.null2String(company))).getId());
|
||||
deptById.setParentComp(company);
|
||||
deptById.setParentDept(null);
|
||||
deptById.setEcDepartment(null);
|
||||
|
||||
|
|
@ -775,11 +776,11 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
* @param parentComp
|
||||
* @param deptList
|
||||
*/
|
||||
void forbiddenChildTag(Long parentComp, String ecCompanyId, List<DepartmentPO> deptList) {
|
||||
void forbiddenChildTag(Integer parentComp, String ecCompanyId, List<DepartmentPO> deptList) {
|
||||
if (CollectionUtils.isNotEmpty(deptList)) {
|
||||
for (DepartmentPO departmentPO : deptList) {
|
||||
departmentPO.setParentComp(parentComp);
|
||||
departmentPO.setEcCompany(Long.parseLong(ecCompanyId));
|
||||
departmentPO.setEcCompany(Integer.parseInt(ecCompanyId));
|
||||
// 更新EC表部门
|
||||
updateEcDepartment(departmentPO);
|
||||
|
||||
|
|
@ -832,20 +833,20 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
*/
|
||||
private List<SearchTree> getFilterCompany(String id, String keyword) {
|
||||
// 查询部门信息
|
||||
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id);
|
||||
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).forbiddenTag(0).build();
|
||||
List<CompPO> allCompanys = getCompMapper().list("show_order");
|
||||
Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
|
||||
CompanyPO compBuild = CompanyPO.builder().subCompanyName(keyword).supSubComId(parentCompId).canceled(0).build();
|
||||
List<CompanyPO> allCompanys = getCompanyMapper().listAll("show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
|
||||
List<CompanyPO> filterComps = getCompanyMapper().listByFilter(compBuild, "show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
|
||||
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Map<Integer, CompanyPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompanyPO::getId, item -> item, (k1, k2) -> k1));
|
||||
|
||||
Set<CompPO> builderComps = new HashSet<>();
|
||||
for (CompPO compPO : filterComps) {
|
||||
buildParentComps(compPO, builderComps, allMaps);
|
||||
Set<CompanyPO> builderComps = new HashSet<>();
|
||||
for (CompanyPO companyPO : filterComps) {
|
||||
buildParentComps(companyPO, builderComps, allMaps);
|
||||
}
|
||||
return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps));
|
||||
return SearchTreeUtil.builderTreeMode(CompanyBO.buildSetToSearchTree(builderComps));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -855,10 +856,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
* @param compPO
|
||||
* @param builderComps
|
||||
*/
|
||||
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps, Map<Long, CompPO> allMaps) {
|
||||
private void buildParentComps(CompanyPO compPO, Set<CompanyPO> builderComps, Map<Integer, CompanyPO> allMaps) {
|
||||
builderComps.add(compPO);
|
||||
CompPO parentComp = allMaps.get(compPO.getParentCompany());
|
||||
if (null != parentComp && 0 == parentComp.getForbiddenTag()) {
|
||||
CompanyPO parentComp = allMaps.get(compPO.getSupSubComId());
|
||||
if (null != parentComp && 0 == parentComp.getCanceled()) {
|
||||
buildParentComps(parentComp, builderComps, allMaps);
|
||||
}
|
||||
}
|
||||
|
|
@ -903,7 +904,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
* @param parentDeptId
|
||||
* @param orderNum
|
||||
*/
|
||||
private void recursionCopyJob(List<JobPO> jobPOS, Long parentCompId, Long parentDeptId, Long currentParentJobId, int orderNum, long timeMillis) {
|
||||
private void recursionCopyJob(List<JobPO> jobPOS, Integer parentCompId, Long parentDeptId, Long currentParentJobId, int orderNum, long timeMillis) {
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
orderNum++;
|
||||
|
||||
|
|
@ -921,10 +922,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
}
|
||||
// 所属分部赋值
|
||||
jobPO.setEcCompany(parentCompId);
|
||||
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(Util.null2String(parentCompId));
|
||||
if (null != jclCompanyId) {
|
||||
jobPO.setParentComp(jclCompanyId.getId());
|
||||
}
|
||||
jobPO.setParentComp(parentCompId);
|
||||
|
||||
// 指定上级岗位
|
||||
jobPO.setParentJob(currentParentJobId);
|
||||
jobPO.setCreator((long) user.getUID());
|
||||
|
|
@ -1004,7 +1003,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
* @param parentDepartment
|
||||
* @param parentComp
|
||||
*/
|
||||
private void refreshJobComp(Long parentDepartment, Long parentComp) {
|
||||
private void refreshJobComp(Long parentDepartment, Integer parentComp) {
|
||||
List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment);
|
||||
jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(jobPOS)) {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import com.engine.organization.entity.DeleteParam;
|
|||
import com.engine.organization.entity.browser.po.CustomBrowserBean;
|
||||
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
import com.engine.organization.entity.company.bo.CompBO;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.company.bo.CompanyBO;
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import com.engine.organization.entity.department.bo.DepartmentBO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
||||
|
|
@ -32,7 +32,7 @@ import com.engine.organization.entity.searchtree.SearchTreeParams;
|
|||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
||||
import com.engine.organization.mapper.hrmresource.HrmRelationMapper;
|
||||
|
|
@ -149,8 +149,8 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
private CompanyMapper getCompanyMapper() {
|
||||
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
||||
}
|
||||
|
||||
private JobMapper getJobMapper() {
|
||||
|
|
@ -541,9 +541,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
List<SearchTree> searchTree = new ArrayList<>();
|
||||
// 通过分部、公司 组装数据
|
||||
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
|
||||
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id);
|
||||
Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentComp(parentCompId).build();
|
||||
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).build();
|
||||
CompanyPO compBuild = CompanyPO.builder().subCompanyName(keyword).supSubComId(parentCompId.intValue()).build();
|
||||
// 所属分部下的岗位
|
||||
JobPO jobBuild = JobPO.builder().jobName(keyword).parentComp(parentCompId).build();
|
||||
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild, jobBuild);
|
||||
|
|
@ -574,7 +574,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
* @param jobBuild
|
||||
* @return
|
||||
*/
|
||||
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild, JobPO jobBuild) {
|
||||
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompanyPO compBuild, JobPO jobBuild) {
|
||||
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
|
||||
new DetachUtil(user.getUID()).filterJobList(jobPOS);
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
|
||||
|
|
@ -607,7 +607,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
}
|
||||
|
||||
// 查询分部信息
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
|
||||
List<CompanyPO> filterComps = getCompanyMapper().listByFilter(compBuild, "show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
|
|
@ -619,19 +619,19 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
// 添加部门的上级分部
|
||||
String parentCompS = deptTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
|
||||
if (!StringUtil.isEmpty(parentCompS)) {
|
||||
List<CompPO> compsByIds = getCompMapper().getCompsByIds(DeleteParam.builder().ids(parentCompS).build().getIds());
|
||||
List<CompanyPO> compsByIds = getCompanyMapper().getCompsByIds(DeleteParam.builder().ids(parentCompS).build().getIds());
|
||||
if (CollectionUtils.isNotEmpty(compsByIds)) {
|
||||
filterComps.addAll(compsByIds);
|
||||
}
|
||||
}
|
||||
List<CompPO> allCompanys = getCompMapper().list("show_order");
|
||||
List<CompanyPO> allCompanys = getCompanyMapper().listAll("show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Set<CompPO> builderComps = new HashSet<>();
|
||||
for (CompPO compPO : filterComps) {
|
||||
Map<Integer, CompanyPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompanyPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Set<CompanyPO> builderComps = new HashSet<>();
|
||||
for (CompanyPO compPO : filterComps) {
|
||||
buildParentComps(compPO, builderComps, allMaps);
|
||||
}
|
||||
return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps), searchTrees);
|
||||
return SearchTreeUtil.builderTreeMode(CompanyBO.buildSetToSearchTree(builderComps), searchTrees);
|
||||
}
|
||||
|
||||
private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild) {
|
||||
|
|
@ -704,9 +704,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
* @param compPO
|
||||
* @param builderComps
|
||||
*/
|
||||
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps, Map<Long, CompPO> allMaps) {
|
||||
private void buildParentComps(CompanyPO compPO, Set<CompanyPO> builderComps, Map<Integer, CompanyPO> allMaps) {
|
||||
builderComps.add(compPO);
|
||||
CompPO parentComp = allMaps.get(compPO.getParentCompany());
|
||||
CompanyPO parentComp = allMaps.get(compPO.getSupSubComId());
|
||||
if (null != parentComp) {
|
||||
buildParentComps(parentComp, builderComps, allMaps);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import com.engine.organization.enums.LogModuleNameEnum;
|
|||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.enums.OrgImportEnum;
|
||||
import com.engine.organization.exception.OrganizationRunTimeException;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.employee.EmployeeMapper;
|
||||
import com.engine.organization.mapper.extend.ExtMapper;
|
||||
|
|
@ -715,7 +715,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
continue nextRow;
|
||||
}
|
||||
for (int index = 0; index < split.length - 1; index++) {
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(split[index], parentCompanyId == null ? 0 : parentCompanyId);
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(split[index], parentCompanyId == null ? 0 : parentCompanyId.intValue());
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(split[index] + "分部未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
|
|
@ -745,7 +745,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
continue;
|
||||
}
|
||||
String compNo = (String) map.get("comp_no");
|
||||
Long companyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(companyName, parentCompanyId == null ? 0 : parentCompanyId);
|
||||
Long companyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(companyName, parentCompanyId == null ? 0 : parentCompanyId.intValue());
|
||||
if ("add".equals(operateType)) {
|
||||
if (companyId != null) {
|
||||
historyDetailPO.setOperateDetail("数据已存在");
|
||||
|
|
@ -772,7 +772,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
}
|
||||
String showOrder = Util.null2String(map.get("show_order"));
|
||||
if (StringUtils.isBlank(showOrder)) {
|
||||
Integer maxShowOrder = MapperProxyFactory.getProxy(CompMapper.class).getMaxShowOrder();
|
||||
Integer maxShowOrder = MapperProxyFactory.getProxy(CompanyMapper.class).getMaxShowOrder();
|
||||
if (null == maxShowOrder) {
|
||||
maxShowOrder = 0;
|
||||
}
|
||||
|
|
@ -788,7 +788,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("JCL_ORG_COMP").params(map).build();
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams);
|
||||
// 刷新组织架构图
|
||||
new CompanyTriggerRunnable(infoParams.getId()).run();
|
||||
//TODO new CompanyTriggerRunnable(infoParams.getId()).run();
|
||||
historyDetailPO.setOperateDetail("添加成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
} else {
|
||||
|
|
@ -813,7 +813,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
map.remove("id");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(companyId).tableName("JCL_ORG_COMP").params(map).build());
|
||||
// 刷新组织架构图
|
||||
new CompanyTriggerRunnable(companyId).run();
|
||||
//TODO new CompanyTriggerRunnable(companyId).run();
|
||||
historyDetailPO.setOperateDetail("更新成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
} else {
|
||||
|
|
@ -924,7 +924,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId.intValue());
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
|
|
@ -1162,7 +1162,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId.intValue());
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
|
|
@ -1426,7 +1426,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId.intValue());
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
|
|
@ -2026,7 +2026,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
if (null != extendType) {
|
||||
switch (extendType.toString()) {
|
||||
case "1":
|
||||
return 0 == MapperProxyFactory.getProxy(CompMapper.class).checkRepeatNo(no, id);
|
||||
// return 0 == MapperProxyFactory.getProxy(CompMapper.class).checkRepeatNo(no, id);
|
||||
case "2":
|
||||
return 0 == MapperProxyFactory.getProxy(DepartmentMapper.class).checkRepeatNo(no, id);
|
||||
case "3":
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import com.engine.organization.entity.DeleteParam;
|
|||
import com.engine.organization.entity.browser.po.CustomBrowserBean;
|
||||
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
import com.engine.organization.entity.company.bo.CompBO;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.company.bo.CompanyBO;
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import com.engine.organization.entity.department.bo.DepartmentBO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.employee.vo.EmployeeTableVO;
|
||||
|
|
@ -33,7 +33,7 @@ import com.engine.organization.entity.searchtree.SearchTreeParams;
|
|||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtDTMapper;
|
||||
import com.engine.organization.mapper.extend.ExtMapper;
|
||||
|
|
@ -117,8 +117,8 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
private CompanyMapper getCompanyMapper() {
|
||||
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
||||
}
|
||||
|
||||
private DepartmentMapper getDepartmentMapper() {
|
||||
|
|
@ -275,7 +275,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
Map<String, Object> params = new HashMap<>();
|
||||
// 分部
|
||||
if (StringUtils.isNotBlank(Util.null2String(param.getSubcompanyid1()))) {
|
||||
CompPO compPO = getCompMapper().listById(param.getSubcompanyid1());
|
||||
CompanyPO compPO = getCompanyMapper().listById(param.getSubcompanyid1());
|
||||
if (null != compPO) {
|
||||
params.put("parent_comp", compPO.getId());
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(compPO.getId().toString()));
|
||||
|
|
@ -600,7 +600,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
}
|
||||
|
||||
|
||||
void recursionMergeJob(List<JobPO> jobs, Long parentCompany, Long ecCompany, Long parentDepartment, Long ecDepartment, Long parentJob) {
|
||||
void recursionMergeJob(List<JobPO> jobs, Integer parentCompany, Integer ecCompany, Long parentDepartment, Long ecDepartment, Long parentJob) {
|
||||
for (JobPO job : jobs) {
|
||||
job.setParentComp(parentCompany);
|
||||
job.setEcCompany(ecCompany);
|
||||
|
|
@ -642,10 +642,10 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
* @param compPO
|
||||
* @param builderComps
|
||||
*/
|
||||
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps, Map<Long, CompPO> allMaps) {
|
||||
private void buildParentComps(CompanyPO compPO, Set<CompanyPO> builderComps, Map<Integer, CompanyPO> allMaps) {
|
||||
builderComps.add(compPO);
|
||||
CompPO parentComp = allMaps.get(compPO.getParentCompany());
|
||||
if (null != parentComp && 0 == parentComp.getForbiddenTag()) {
|
||||
CompanyPO parentComp = allMaps.get(compPO.getSupSubComId());
|
||||
if (null != parentComp && 0 == parentComp.getCanceled()) {
|
||||
buildParentComps(parentComp, builderComps, allMaps);
|
||||
}
|
||||
}
|
||||
|
|
@ -662,9 +662,9 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
List<SearchTree> searchTree = new ArrayList<>();
|
||||
// 通过分部、公司 组装数据
|
||||
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
|
||||
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id);
|
||||
Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentComp(parentCompId).forbiddenTag(0).build();
|
||||
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).forbiddenTag(0).build();
|
||||
CompanyPO compBuild = CompanyPO.builder().subCompanyName(keyword).supSubComId(parentCompId).canceled(0).build();
|
||||
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild);
|
||||
} else if (TYPE_DEPT.equals(type)) {
|
||||
//
|
||||
|
|
@ -687,11 +687,11 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
* @param compBuild
|
||||
* @return
|
||||
*/
|
||||
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild) {
|
||||
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompanyPO compBuild) {
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
|
||||
// 查询分部信息
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
|
||||
List<CompanyPO> filterComps = getCompanyMapper().listByFilter(compBuild, "show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
|
|
@ -701,19 +701,19 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 添加部门的上级分部
|
||||
String parentCompS = deptTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
|
||||
if (!StringUtil.isEmpty(parentCompS)) {
|
||||
List<CompPO> compsByIds = getCompMapper().getCompsByIds(DeleteParam.builder().ids(parentCompS).build().getIds());
|
||||
List<CompanyPO> compsByIds = getCompanyMapper().getCompsByIds(DeleteParam.builder().ids(parentCompS).build().getIds());
|
||||
if (CollectionUtils.isNotEmpty(compsByIds)) {
|
||||
filterComps.addAll(compsByIds);
|
||||
}
|
||||
}
|
||||
List<CompPO> allCompanys = getCompMapper().list("show_order");
|
||||
List<CompanyPO> allCompanys = getCompanyMapper().listAll("show_order");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Set<CompPO> builderComps = new HashSet<>();
|
||||
for (CompPO compPO : filterComps) {
|
||||
Map<Integer, CompanyPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompanyPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Set<CompanyPO> builderComps = new HashSet<>();
|
||||
for (CompanyPO compPO : filterComps) {
|
||||
buildParentComps(compPO, builderComps, allMaps);
|
||||
}
|
||||
return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps), deptTrees);
|
||||
return SearchTreeUtil.builderTreeMode(CompanyBO.buildSetToSearchTree(builderComps), deptTrees);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -774,30 +774,6 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
return generateCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有子部门id
|
||||
*
|
||||
* @param parentComp
|
||||
* @param parentDept
|
||||
* @param jobList
|
||||
*/
|
||||
void forbiddenChildTag(Long parentComp, Long parentDept, Long parentJob, List<JobPO> jobList) {
|
||||
if (CollectionUtils.isNotEmpty(jobList)) {
|
||||
for (JobPO job : jobList) {
|
||||
job.setParentComp(parentComp);
|
||||
job.setParentDept(parentDept);
|
||||
job.setParentJob(parentJob);
|
||||
job.setForbiddenTag(1);
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.CANCELED, null, job).sync();
|
||||
getJobMapper().updateBaseJob(job);
|
||||
// 更新组织架构图
|
||||
new JobTriggerRunnable(job.getId()).run();
|
||||
List<JobPO> childJobs = getJobMapper().getJobsByPid(job.getId());
|
||||
forbiddenChildTag(parentComp, parentDept, job.getId(), childJobs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加子元素ID
|
||||
*
|
||||
|
|
@ -879,9 +855,9 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 更新岗位下的人员
|
||||
Long originalJobId = originalJob.getId();
|
||||
Long targetJobId = targetJob.getId();
|
||||
Long parentComp = targetJob.getParentComp();
|
||||
Integer parentComp = targetJob.getParentComp();
|
||||
Long parentDept = targetJob.getParentDept();
|
||||
Long ecCompany = targetJob.getEcCompany();
|
||||
Integer ecCompany = targetJob.getEcCompany();
|
||||
Long ecDepartment = targetJob.getEcDepartment();
|
||||
List<HrmResourcePO> resourceList = getResourceMapper().getResourceListByJobId(originalJobId);
|
||||
getResourceMapper().updateResourceJob(originalJobId, targetJobId, parentComp, parentDept, ecCompany, ecDepartment);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import com.engine.organization.util.HasRightUtil;
|
|||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import com.weaver.file.ConfigOperator;
|
||||
import com.weaver.general.BaseBean;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
|
@ -125,7 +124,6 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|||
.ecManager(param.getEcManager())
|
||||
.jclManager(getResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
|
||||
.ecRolelevel(param.getEcRolelevel())
|
||||
.jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
|
||||
.manageModule("组织管理")
|
||||
.creator((long)user.getUID())
|
||||
.deleteType(0)
|
||||
|
|
@ -143,7 +141,6 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|||
.ecManager(param.getEcManager())
|
||||
.jclManager(getResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
|
||||
.ecRolelevel(param.getEcRolelevel())
|
||||
.jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
|
||||
.build();
|
||||
return getMangeDetachMapper().updateDetach(managerDetachPO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,19 +6,16 @@ import com.api.browser.bean.SearchConditionOption;
|
|||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.staff.bo.StaffPlanBO;
|
||||
import com.engine.organization.entity.staff.param.StaffPlanSearchParam;
|
||||
import com.engine.organization.entity.staff.po.StaffPlanPO;
|
||||
import com.engine.organization.entity.staff.vo.StaffPlanTableVO;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.staff.StaffPlanMapper;
|
||||
import com.engine.organization.service.StaffPlanService;
|
||||
import com.engine.organization.util.*;
|
||||
import com.engine.organization.util.browser.OrganizationBrowserUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
|
|
@ -40,11 +37,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|||
private StaffPlanMapper getStaffPlanMapper() {
|
||||
return MapperProxyFactory.getProxy(StaffPlanMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(StaffPlanSearchParam params) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
|
@ -74,7 +67,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|||
// 结束时间大于开始时间
|
||||
StaffPlanPO staffPlanPO = StaffPlanBO.convertParamToPO(param, (long) user.getUID());
|
||||
// 多选赋值
|
||||
staffPlanPO.setCompanyId(getJclCompanyIdsByEcIds(staffPlanPO.getEcCompany()));
|
||||
staffPlanPO.setCompanyId(staffPlanPO.getEcCompany());
|
||||
String timeStart = param.getTimeStart();
|
||||
String timeEnd = param.getTimeEnd();
|
||||
Date startDate = DateUtil.parseToDate(timeStart);
|
||||
|
|
@ -100,7 +93,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|||
Date endDate = DateUtil.parseToDate(timeEnd);
|
||||
OrganizationAssert.isFalse(startDate.after(endDate), "开始时间不允许在结束时间之后");
|
||||
// 多选赋值
|
||||
staffPlanPO.setCompanyId(getJclCompanyIdsByEcIds(staffPlanPO.getEcCompany()));
|
||||
staffPlanPO.setCompanyId(staffPlanPO.getEcCompany());
|
||||
return getStaffPlanMapper().updateStaffPlan(staffPlanPO);
|
||||
}
|
||||
|
||||
|
|
@ -285,18 +278,4 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
|
||||
private String getJclCompanyIdsByEcIds(String ecIds) {
|
||||
List<String> jclCompanyIds = new ArrayList<>();
|
||||
String[] split = ecIds.split(",");
|
||||
for (String s : split) {
|
||||
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(s);
|
||||
if (null != jclCompanyId) {
|
||||
jclCompanyIds.add(jclCompanyId.getId().toString());
|
||||
}
|
||||
}
|
||||
return StringUtils.join(jclCompanyIds, ",");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import com.engine.core.impl.Service;
|
|||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.browser.po.CustomBrowserBean;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.staff.bo.StaffBO;
|
||||
|
|
@ -19,8 +18,6 @@ import com.engine.organization.entity.staff.po.StaffPO;
|
|||
import com.engine.organization.entity.staff.po.StaffPlanPO;
|
||||
import com.engine.organization.entity.staff.po.StaffsPO;
|
||||
import com.engine.organization.entity.staff.vo.StaffTableVO;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.staff.StaffMapper;
|
||||
import com.engine.organization.mapper.staff.StaffPlanMapper;
|
||||
|
|
@ -64,14 +61,6 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|||
return MapperProxyFactory.getProxy(StaffPlanMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
private DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
||||
private JobMapper getJobMapper() {
|
||||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
|
@ -373,7 +362,7 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|||
} else {
|
||||
sqlWhere = " where 1 = 2 ";
|
||||
}
|
||||
Long compId = param.getCompId();
|
||||
Integer compId = param.getCompId();
|
||||
if (null != compId) {
|
||||
sqlWhere += " AND t.comp_id = '" + compId + "'";
|
||||
}
|
||||
|
|
@ -381,7 +370,7 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|||
if (null != deptId) {
|
||||
sqlWhere += " AND t.dept_id = '" + deptId + "'";
|
||||
}
|
||||
Long ecCompany = param.getEcCompany();
|
||||
Integer ecCompany = param.getEcCompany();
|
||||
if (null != ecCompany) {
|
||||
sqlWhere += " AND t.ec_company = '" + ecCompany + "'";
|
||||
}
|
||||
|
|
@ -440,10 +429,7 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|||
switch (staffPlanByID.getControlDimension()) {
|
||||
case "1":// 分部
|
||||
OrganizationAssert.notNull(staffPO.getEcCompany(), "编制维度选择分部时,分部必填!");
|
||||
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(Util.null2String(staffPO.getEcCompany()));
|
||||
if (null != jclCompanyId) {
|
||||
staffPO.setCompId(jclCompanyId.getId());
|
||||
}
|
||||
staffPO.setCompId(staffPO.getEcCompany());
|
||||
break;
|
||||
case "2":// 部门
|
||||
OrganizationAssert.notNull(staffPO.getEcDepartment(), "编制维度选择部门时,部门必填!");
|
||||
|
|
|
|||
|
|
@ -1,159 +1,140 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.map.JclOrgMap;
|
||||
import com.engine.organization.entity.personnelcard.UserCard;
|
||||
import com.engine.organization.entity.staff.po.StaffPO;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.staff.StaffMapper;
|
||||
import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
||||
import com.engine.organization.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import weaver.common.DateUtil;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/08/30
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class CompanyTriggerRunnable implements Runnable {
|
||||
|
||||
private final CompPO oldCompany;
|
||||
private final CompPO newCompany;
|
||||
|
||||
private CompTriggerMapper getCompTriggerMapper() {
|
||||
return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
||||
}
|
||||
|
||||
public CompanyTriggerRunnable(CompPO oldCompany, CompPO newCompany) {
|
||||
this.oldCompany = oldCompany;
|
||||
this.newCompany = newCompany;
|
||||
}
|
||||
|
||||
public CompanyTriggerRunnable(Long companyId) {
|
||||
this.oldCompany = new CompPO();
|
||||
this.newCompany = MapperProxyFactory.getProxy(CompMapper.class).listById(companyId);
|
||||
}
|
||||
|
||||
public CompanyTriggerRunnable(CompPO newCompany) {
|
||||
this.oldCompany = new CompPO();
|
||||
this.newCompany = newCompany;
|
||||
this.newCompany.setDeleteType(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// 判断
|
||||
JclOrgMap jclMap = new JclOrgMap();
|
||||
|
||||
jclMap.setFType(1);
|
||||
// 更新逻辑
|
||||
jclMap.setFObjId(newCompany.getId().intValue());
|
||||
jclMap.setId(newCompany.getId().intValue());
|
||||
jclMap.setUuid(newCompany.getUuid());
|
||||
jclMap.setFNumber(newCompany.getCompNo());
|
||||
jclMap.setFName(newCompany.getCompName());
|
||||
jclMap.setFParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
|
||||
jclMap.setFObjParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
|
||||
jclMap.setFEcId(getCompTriggerMapper().getEcCompanyIdByUuid(jclMap.getUuid()));
|
||||
|
||||
|
||||
jclMap.setFClass(0);
|
||||
jclMap.setFClassName("行政维度");
|
||||
|
||||
Integer ecResourceId = newCompany.getCompPrincipal();
|
||||
HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId);
|
||||
if (null != hrmResourcePO) {
|
||||
jclMap.setFLeader(hrmResourcePO.getId().intValue());
|
||||
jclMap.setFLeaderName(hrmResourcePO.getLastName());
|
||||
jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
|
||||
jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
|
||||
jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
|
||||
String image = UserCard.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
|
||||
jclMap.setFLeaderImg(image);
|
||||
if (null != hrmResourcePO.getJobTitle()) {
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());
|
||||
if (null != jobById) {
|
||||
jclMap.setFLeaderJob(jobById.getJobName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
|
||||
StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(jclMap.getFType(), jclMap.getFObjId().toString(), null, null);
|
||||
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.subcompanyfielddefined.getValue().toString(), jclMap.getFObjId().toString());
|
||||
if (null != jclOrgMapByObjID) {
|
||||
jclMap.setFPlan(jclOrgMapByObjID.getFPlan());
|
||||
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
|
||||
} else {
|
||||
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
jclMap.setFOnJob(0);
|
||||
}
|
||||
jclMap.setFIsVitual(0);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(jclMap.getFDateBegin());
|
||||
Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
Date time = new Date(calendar.getTime().getTime());
|
||||
getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
|
||||
getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
|
||||
|
||||
if (1 != newCompany.getDeleteType() && 1 != newCompany.getForbiddenTag()) {
|
||||
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
||||
}
|
||||
if (null != jclOrgMapByObjID) {
|
||||
if (null != jclOrgMapByObjID.getFParentId()) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
|
||||
}
|
||||
}
|
||||
if (null != oldCompany) {
|
||||
if (null != oldCompany.getId()) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), oldCompany.getId().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新上级部门在编、在岗数
|
||||
*/
|
||||
void updateParentPlanAndJob(Date currentDate, String parentId) {
|
||||
JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId);
|
||||
if (null != parentJclOrgMap) {
|
||||
// 上级部门当前在编、在岗数
|
||||
JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
|
||||
StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(parentJclOrgMap.getFType(), parentId, null, null);
|
||||
if (null != jclOrgMapSum) {
|
||||
parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
|
||||
parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
|
||||
} else {
|
||||
parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
parentJclOrgMap.setFOnJob(0);
|
||||
}
|
||||
parentJclOrgMap.setFDateBegin(currentDate);
|
||||
parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(parentJclOrgMap.getFDateBegin());
|
||||
Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
Date time = new Date(calendar.getTime().getTime());
|
||||
getCompTriggerMapper().deleteMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin());
|
||||
getCompTriggerMapper().updateMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin(), time);
|
||||
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(parentJclOrgMap);
|
||||
if (null != parentJclOrgMap.getFParentId() && -1 != parentJclOrgMap.getFParentId()) {
|
||||
updateParentPlanAndJob(currentDate, parentJclOrgMap.getFParentId().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//public class CompanyTriggerRunnable implements Runnable {
|
||||
//
|
||||
// private final CompPO oldCompany;
|
||||
// private final CompPO newCompany;
|
||||
//
|
||||
// private CompTriggerMapper getCompTriggerMapper() {
|
||||
// return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
||||
// }
|
||||
//
|
||||
// public CompanyTriggerRunnable(CompPO oldCompany, CompPO newCompany) {
|
||||
// this.oldCompany = oldCompany;
|
||||
// this.newCompany = newCompany;
|
||||
// }
|
||||
//
|
||||
// public CompanyTriggerRunnable(Long companyId) {
|
||||
// this.oldCompany = new CompPO();
|
||||
// this.newCompany = MapperProxyFactory.getProxy(CompMapper.class).listById(companyId);
|
||||
// }
|
||||
//
|
||||
// public CompanyTriggerRunnable(CompPO newCompany) {
|
||||
// this.oldCompany = new CompPO();
|
||||
// this.newCompany = newCompany;
|
||||
// this.newCompany.setDeleteType(1);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// // 判断
|
||||
// JclOrgMap jclMap = new JclOrgMap();
|
||||
//
|
||||
// jclMap.setFType(1);
|
||||
// // 更新逻辑
|
||||
// jclMap.setFObjId(newCompany.getId().intValue());
|
||||
// jclMap.setId(newCompany.getId().intValue());
|
||||
// jclMap.setUuid(newCompany.getUuid());
|
||||
// jclMap.setFNumber(newCompany.getCompNo());
|
||||
// jclMap.setFName(newCompany.getCompName());
|
||||
// jclMap.setFParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
|
||||
// jclMap.setFObjParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
|
||||
// jclMap.setFEcId(getCompTriggerMapper().getEcCompanyIdByUuid(jclMap.getUuid()));
|
||||
//
|
||||
//
|
||||
// jclMap.setFClass(0);
|
||||
// jclMap.setFClassName("行政维度");
|
||||
//
|
||||
// Integer ecResourceId = newCompany.getCompPrincipal();
|
||||
// HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId);
|
||||
// if (null != hrmResourcePO) {
|
||||
// jclMap.setFLeader(hrmResourcePO.getId().intValue());
|
||||
// jclMap.setFLeaderName(hrmResourcePO.getLastName());
|
||||
// jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
|
||||
// jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
|
||||
// jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
|
||||
// String image = UserCard.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
|
||||
// jclMap.setFLeaderImg(image);
|
||||
// if (null != hrmResourcePO.getJobTitle()) {
|
||||
// JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());
|
||||
// if (null != jobById) {
|
||||
// jclMap.setFLeaderJob(jobById.getJobName());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
// jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
// jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
//
|
||||
// StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(jclMap.getFType(), jclMap.getFObjId().toString(), null, null);
|
||||
// JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.subcompanyfielddefined.getValue().toString(), jclMap.getFObjId().toString());
|
||||
// if (null != jclOrgMapByObjID) {
|
||||
// jclMap.setFPlan(jclOrgMapByObjID.getFPlan());
|
||||
// jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
|
||||
// } else {
|
||||
// jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
// jclMap.setFOnJob(0);
|
||||
// }
|
||||
// jclMap.setFIsVitual(0);
|
||||
//
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.setTime(jclMap.getFDateBegin());
|
||||
// Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
// Date time = new Date(calendar.getTime().getTime());
|
||||
// getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
|
||||
// getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
|
||||
//
|
||||
// if (1 != newCompany.getDeleteType() && 1 != newCompany.getForbiddenTag()) {
|
||||
// MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
||||
// }
|
||||
// if (null != jclOrgMapByObjID) {
|
||||
// if (null != jclOrgMapByObjID.getFParentId()) {
|
||||
// updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
|
||||
// }
|
||||
// }
|
||||
// if (null != oldCompany) {
|
||||
// if (null != oldCompany.getId()) {
|
||||
// updateParentPlanAndJob(jclMap.getFDateBegin(), oldCompany.getId().toString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 更新上级部门在编、在岗数
|
||||
// */
|
||||
// void updateParentPlanAndJob(Date currentDate, String parentId) {
|
||||
// JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId);
|
||||
// if (null != parentJclOrgMap) {
|
||||
// // 上级部门当前在编、在岗数
|
||||
// JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
|
||||
// StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(parentJclOrgMap.getFType(), parentId, null, null);
|
||||
// if (null != jclOrgMapSum) {
|
||||
// parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
|
||||
// parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
|
||||
// } else {
|
||||
// parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
// parentJclOrgMap.setFOnJob(0);
|
||||
// }
|
||||
// parentJclOrgMap.setFDateBegin(currentDate);
|
||||
// parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
//
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.setTime(parentJclOrgMap.getFDateBegin());
|
||||
// Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
// Date time = new Date(calendar.getTime().getTime());
|
||||
// getCompTriggerMapper().deleteMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin());
|
||||
// getCompTriggerMapper().updateMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin(), time);
|
||||
// MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(parentJclOrgMap);
|
||||
// if (null != parentJclOrgMap.getFParentId() && -1 != parentJclOrgMap.getFParentId()) {
|
||||
// updateParentPlanAndJob(currentDate, parentJclOrgMap.getFParentId().toString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -1,478 +0,0 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.hrm.service.impl.HrmJobServiceImpl;
|
||||
import com.engine.hrm.service.impl.OrganizationServiceImpl;
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.extend.param.ExtendInfoParams;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/07/12
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class OrganizationRunable implements Runnable {
|
||||
private LogModuleNameEnum moduleName;
|
||||
private OperateTypeEnum operateType;
|
||||
private Map<String, Object> params;
|
||||
private User user;
|
||||
private JobPO oldJobPO;
|
||||
|
||||
private static final String HRM_COMPANY = "hrmsubcompany";
|
||||
private static final String HRM_DEPARTMENT = "hrmdepartment";
|
||||
|
||||
private static final String JCL_COMPANY = "jcl_org_comp";
|
||||
private static final String JCL_DEPARTMENT = "jcl_org_dept";
|
||||
|
||||
private SystemDataMapper getSystemDataMapper() {
|
||||
return MapperProxyFactory.getProxy(SystemDataMapper.class);
|
||||
}
|
||||
|
||||
private ExtMapper getExtMapper() {
|
||||
return MapperProxyFactory.getProxy(ExtMapper.class);
|
||||
}
|
||||
|
||||
public OrganizationRunable(User user, LogModuleNameEnum moduleName, OperateTypeEnum operateType, Map<String, Object> params) {
|
||||
this.moduleName = moduleName;
|
||||
this.operateType = operateType;
|
||||
this.params = params;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public OrganizationRunable(User user, LogModuleNameEnum moduleName, OperateTypeEnum operateType, Map<String, Object> params, JobPO oldJobPO) {
|
||||
this.moduleName = moduleName;
|
||||
this.operateType = operateType;
|
||||
this.params = params;
|
||||
this.user = user;
|
||||
this.oldJobPO = oldJobPO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
switch (moduleName) {
|
||||
case COMPANY:
|
||||
refreshCompany();
|
||||
break;
|
||||
case DEPARTMENT:
|
||||
refreshDepartment();
|
||||
break;
|
||||
case JOB:
|
||||
refreshJob();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新HrmSubCompany表数据
|
||||
*/
|
||||
private void refreshCompany() {
|
||||
switch (operateType) {
|
||||
case ADD:
|
||||
addCompany();
|
||||
break;
|
||||
case UPDATE:
|
||||
updateCompany();
|
||||
break;
|
||||
case CANCELED:
|
||||
cancelCompany();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新HrmDepartment表数据
|
||||
*/
|
||||
private void refreshDepartment() {
|
||||
switch (operateType) {
|
||||
case ADD:
|
||||
addDepartment();
|
||||
break;
|
||||
case UPDATE:
|
||||
updateDepartment();
|
||||
break;
|
||||
case CANCELED:
|
||||
cancelDepartment();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshJob() {
|
||||
switch (operateType) {
|
||||
case ADD:
|
||||
addJob();
|
||||
break;
|
||||
case UPDATE:
|
||||
updateJob();
|
||||
break;
|
||||
case CANCELED:
|
||||
cancelJob();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*
|
||||
* <p>
|
||||
* 1、EC表HrmJobTitles
|
||||
* <p>
|
||||
* 2、系统中新建“聚才林”、“默认职务”(sql写入)
|
||||
* <p>
|
||||
* 3、检索岗位名称jobtitlename,如果已存在,判断是否封存,对已封存数据解封操作
|
||||
* <p>
|
||||
* 4、如果不存在,在“聚才林--默认职务”下新建岗位
|
||||
*/
|
||||
private void addJob() {
|
||||
// 判断是否存在同名岗位、存在不做处理,不存在,在“默认职务分类--默认职务”下新建岗位
|
||||
String jobName = Util.null2String(params.get("job_name"));
|
||||
RecordInfo hrmJobActivity = getSystemDataMapper().getHrmJobTitleByName(jobName);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//存在且已封存,对岗位解封
|
||||
if (null != hrmJobActivity && "1".equals(hrmJobActivity.getCanceled())) {
|
||||
map.put("ids", hrmJobActivity.getId());
|
||||
map.put("canceled", "docanceled");
|
||||
ServiceUtil.getService(HrmJobServiceImpl.class, user).doCanceled(map, user);
|
||||
} else {
|
||||
// 不存在则新建职务
|
||||
map.put("operateIp", Util.null2String(user.getLoginip()));
|
||||
map.put("jobtitlemark", jobName);
|
||||
map.put("jobtitlename", jobName);
|
||||
map.put("jobactivityid", Util.null2String(params.get("jobactivityid")));
|
||||
map.put("jobresponsibility", Util.null2String(params.get("work_duty")));
|
||||
map.put("jobcompetency", Util.null2String(params.get("work_authority")));
|
||||
map.put("jobtitleremark", Util.null2String(params.get("description")));
|
||||
map.put("jobtitlecode", Util.null2String(params.get("job_no")));
|
||||
|
||||
ServiceUtil.getService(HrmJobServiceImpl.class, user).addJobTitle(map, user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新岗位
|
||||
*/
|
||||
private void updateJob() {
|
||||
Long jclJobId = oldJobPO.getId();
|
||||
String oldName = oldJobPO.getJobName();
|
||||
|
||||
String newName = Util.null2String(params.get("job_name"));
|
||||
RecordInfo oldHrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(oldName);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 修改前不存在共用
|
||||
if (EcHrmRelationUtil.isNotExistJob(oldName, jclJobId)) {
|
||||
// 修改后不存在共用、直接修改EC岗位表数据
|
||||
if (EcHrmRelationUtil.isNotExistJob(newName, jclJobId)) {
|
||||
// 查询ec表ID
|
||||
RecordInfo hrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(oldName);
|
||||
map.put("id", Util.null2String(hrmJobTitle.getId()));
|
||||
map.put("operateIp", Util.null2String(user.getLoginip()));
|
||||
map.put("jobtitlemark", newName);
|
||||
map.put("jobtitlename", newName);
|
||||
map.put("jobactivityid", Util.null2String(params.get("jobactivityid")));
|
||||
map.put("jobresponsibility", Util.null2String(params.get("work_duty")));
|
||||
map.put("jobcompetency", Util.null2String(params.get("work_authority")));
|
||||
map.put("jobtitleremark", Util.null2String(params.get("description")));
|
||||
map.put("jobtitlecode", Util.null2String(params.get("job_no")));
|
||||
// 修改岗位表数据
|
||||
ServiceUtil.getService(HrmJobServiceImpl.class, user).editJobTitle(map, user);
|
||||
} else {
|
||||
// 修改后存在共用、不修改岗位表数据,更新对应人员的岗位信息为当前岗位的ID
|
||||
RecordInfo hrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(newName);
|
||||
// 查询原分部、原岗位下的人员,并更新岗位ID
|
||||
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIds(oldJobPO.getParentDept(), oldHrmJobTitle.getId());
|
||||
getSystemDataMapper().updateResourceJobTitleByIds(Util.null2String(hrmJobTitle.getId()), hrmResourceIds);
|
||||
// 封存原名称岗位
|
||||
map.clear();
|
||||
map.put("ids", oldHrmJobTitle.getId());
|
||||
map.put("canceled", "canceled");
|
||||
ServiceUtil.getService(HrmJobServiceImpl.class, user).doCanceled(map, user);
|
||||
}
|
||||
} else {
|
||||
// 修改前存在共用,不对原有数据进行操作。
|
||||
|
||||
// 修改后不存在共用、新建岗位,更新原有岗位下人员的岗位ID
|
||||
if (EcHrmRelationUtil.isNotExistJob(newName, jclJobId)) {
|
||||
// 不存在则新建职务
|
||||
map.put("operateIp", Util.null2String(user.getLoginip()));
|
||||
map.put("jobtitlemark", newName);
|
||||
map.put("jobtitlename", newName);
|
||||
map.put("jobactivityid", Util.null2String(params.get("jobactivityid")));
|
||||
map.put("jobresponsibility", Util.null2String(params.get("work_duty")));
|
||||
map.put("jobcompetency", Util.null2String(params.get("work_authority")));
|
||||
map.put("jobtitleremark", Util.null2String(params.get("description")));
|
||||
map.put("jobtitlecode", Util.null2String(params.get("job_no")));
|
||||
ServiceUtil.getService(HrmJobServiceImpl.class, user).addJobTitle(map, user);
|
||||
// 新建岗位
|
||||
RecordInfo hrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(newName);
|
||||
// 查询原分部、原岗位下的人员,并更新岗位ID
|
||||
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIds(oldJobPO.getParentDept(), oldHrmJobTitle.getId());
|
||||
getSystemDataMapper().updateResourceJobTitleByIds(Util.null2String(hrmJobTitle.getId()), hrmResourceIds);
|
||||
} else {
|
||||
// 修改后存在共用,更新原有岗位下人员的岗位ID
|
||||
RecordInfo hrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(newName);
|
||||
// 查询原分部、原岗位下的人员,并更新岗位ID
|
||||
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIds(oldJobPO.getParentDept(), oldHrmJobTitle.getId());
|
||||
getSystemDataMapper().updateResourceJobTitleByIds(Util.null2String(hrmJobTitle.getId()), hrmResourceIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 封存、解封岗位
|
||||
*/
|
||||
private void cancelJob() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
RecordInfo hrmJobTitleByName = getSystemDataMapper().getHrmJobTitleByName(oldJobPO.getJobName());
|
||||
if (0 == oldJobPO.getForbiddenTag()) {
|
||||
// 启用
|
||||
map.put("ids", hrmJobTitleByName.getId());
|
||||
map.put("canceled", "docanceled");
|
||||
ServiceUtil.getService(HrmJobServiceImpl.class, user).doCanceled(map, user);
|
||||
} else {
|
||||
// 禁用
|
||||
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listByNameExceptId(oldJobPO.getJobName(), oldJobPO.getId());
|
||||
// 不存在共用
|
||||
if (CollectionUtils.isEmpty(jobPOS)) {
|
||||
map.put("ids", hrmJobTitleByName.getId());
|
||||
map.put("canceled", "canceled");
|
||||
ServiceUtil.getService(HrmJobServiceImpl.class, user).doCanceled(map, user);
|
||||
} else {
|
||||
List<JobPO> collect = jobPOS.stream().filter(item -> 0 == item.getForbiddenTag()).collect(Collectors.toList());
|
||||
// 不存在非禁用
|
||||
if (CollectionUtils.isEmpty(collect)) {
|
||||
map.put("ids", hrmJobTitleByName.getId());
|
||||
map.put("canceled", "canceled");
|
||||
ServiceUtil.getService(HrmJobServiceImpl.class, user).doCanceled(map, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*/
|
||||
private void addDepartment() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("departmentmark", Util.null2String(params.get("dept_name_short")));
|
||||
map.put("departmentname", Util.null2String(params.get("dept_name")));
|
||||
|
||||
// 上级分部通过UUID联查ec表ID
|
||||
String parentCompany = Util.null2String(params.get("parent_comp"));
|
||||
if (StringUtils.isNotBlank(parentCompany)) {
|
||||
map.put("subcompanyid1", EcHrmRelationUtil.getEcCompanyId(parentCompany));
|
||||
}
|
||||
|
||||
// 上级部门通过UUID联查ec表ID
|
||||
String parentDepartment = Util.null2String(params.get("parent_dept"));
|
||||
if (StringUtils.isNotBlank(parentDepartment)) {
|
||||
map.put("supdepid", EcHrmRelationUtil.getEcDepartmentId(parentDepartment));
|
||||
}
|
||||
|
||||
map.put("showorder", Util.null2String(params.get("show_order")));
|
||||
map.put("departmentcode", Util.null2String(params.get("dept_no")));
|
||||
map.put("coadjutant", Util.null2String(params.get("dept_principal")));
|
||||
Map<String, Object> returnMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).addDepartment(map, user);
|
||||
// 更新jcl_org_dept表 uuid字段
|
||||
if ("1".equals(Util.null2String(returnMap.get("status"))) && null != returnMap.get("id")) {
|
||||
updateJclUUID(Util.null2String(returnMap.get("id")), HRM_DEPARTMENT, JCL_DEPARTMENT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 封存、解封部门
|
||||
*/
|
||||
private void cancelDepartment() {
|
||||
String departmentIds = Util.null2String(params.get("id"));
|
||||
String forbiddenTag = Util.null2String(params.get("forbiddenTag"));
|
||||
List<String> idList = new ArrayList<>();
|
||||
String[] split = departmentIds.split(",");
|
||||
if (StringUtils.isBlank(forbiddenTag)) {
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
for (String s : split) {
|
||||
DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(Long.parseLong(s));
|
||||
params.put("dept_name_short", departmentPO.getDeptNameShort() + currentTimeMillis);
|
||||
params.put("dept_name", departmentPO.getDeptName() + currentTimeMillis);
|
||||
params.put("parent_comp", departmentPO.getParentComp());
|
||||
params.put("parent_dept", departmentPO.getParentDept());
|
||||
params.put("show_order", departmentPO.getShowOrder());
|
||||
params.put("dept_no", departmentPO.getDeptNo());
|
||||
params.put("dept_principal", departmentPO.getDeptPrincipal());
|
||||
updateDepartment();
|
||||
idList.add(EcHrmRelationUtil.getEcDepartmentId(s));
|
||||
}
|
||||
} else {
|
||||
for (String s : split) {
|
||||
idList.add(EcHrmRelationUtil.getEcDepartmentId(s));
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", StringUtils.join(idList, ","));
|
||||
if ("0".equals(forbiddenTag)) {
|
||||
// 解封
|
||||
ServiceUtil.getService(OrganizationServiceImpl.class, user).doDepartmentISCanceled(map, user);
|
||||
} else {
|
||||
// 封存
|
||||
ServiceUtil.getService(OrganizationServiceImpl.class, user).doDepartmentCancel(map, user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新部门
|
||||
*/
|
||||
private void updateDepartment() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 获取ec表ID
|
||||
map.put("id", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(params.get("id"))));
|
||||
map.put("departmentmark", Util.null2String(params.get("dept_name_short")));
|
||||
map.put("departmentname", Util.null2String(params.get("dept_name")));
|
||||
|
||||
// 上级分部通过UUID联查ec表ID
|
||||
String parentCompany = Util.null2String(params.get("parent_comp"));
|
||||
if (StringUtils.isNotBlank(parentCompany)) {
|
||||
map.put("subcompanyid1", EcHrmRelationUtil.getEcCompanyId(parentCompany));
|
||||
}
|
||||
|
||||
// 上级部门通过UUID联查ec表ID
|
||||
String parentDepartment = Util.null2String(params.get("parent_dept"));
|
||||
if (StringUtils.isNotBlank(parentDepartment)) {
|
||||
map.put("supdepid", EcHrmRelationUtil.getEcDepartmentId(parentDepartment));
|
||||
}
|
||||
|
||||
map.put("showorder", Util.null2String(params.get("show_order")));
|
||||
map.put("departmentcode", Util.null2String(params.get("dept_no")));
|
||||
map.put("coadjutant", Util.null2String(params.get("dept_principal")));
|
||||
ServiceUtil.getService(OrganizationServiceImpl.class, user).editDepartment(map, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增分部
|
||||
*/
|
||||
private void addCompany() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("subcompanyname", Util.null2String(params.get("comp_name_short")));
|
||||
|
||||
// 上级分部通过UUID联查ec表ID
|
||||
String parentCompany = Util.null2String(params.get("parent_company"));
|
||||
if (StringUtils.isNotBlank(parentCompany)) {
|
||||
map.put("supsubcomid", EcHrmRelationUtil.getEcCompanyId(parentCompany));
|
||||
}
|
||||
|
||||
map.put("subcompanycode", params.get("comp_no").toString());
|
||||
map.put("subcompanydesc", params.get("comp_name").toString());
|
||||
map.put("showorder", Util.null2String(params.get("show_order")));
|
||||
Map<String, Object> returnMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).addSubCompany(map, user);
|
||||
|
||||
// 更新jcl_org_comp表 uuid字段
|
||||
if ("1".equals(Util.null2String(returnMap.get("status"))) && null != returnMap.get("id")) {
|
||||
updateJclUUID(Util.null2String(returnMap.get("id")), HRM_COMPANY, JCL_COMPANY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新分部
|
||||
*/
|
||||
private void updateCompany() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 获取ec表ID
|
||||
map.put("id", EcHrmRelationUtil.getEcCompanyId(Util.null2String(params.get("id"))));
|
||||
|
||||
// 上级分部通过UUID联查ec表ID
|
||||
String parentCompany = Util.null2String(params.get("parent_company"));
|
||||
if (StringUtils.isNotBlank(parentCompany)) {
|
||||
map.put("supsubcomid", EcHrmRelationUtil.getEcCompanyId(parentCompany));
|
||||
}
|
||||
map.put("subcompanycode", Util.null2String(params.get("comp_no")));
|
||||
map.put("subcompanyname", Util.null2String(params.get("comp_name_short")));
|
||||
map.put("subcompanydesc", Util.null2String(params.get("comp_name")));
|
||||
map.put("showorder", Util.null2String(params.get("show_order")));
|
||||
ServiceUtil.getService(OrganizationServiceImpl.class, user).editSubCompany(map, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 封存、解封分部
|
||||
*/
|
||||
private void cancelCompany() {
|
||||
String companyIds = Util.null2String(params.get("id"));
|
||||
String forbiddenTag = Util.null2String(params.get("forbiddenTag"));
|
||||
List<String> idList = new ArrayList<>();
|
||||
String[] split = companyIds.split(",");
|
||||
if (StringUtils.isBlank(forbiddenTag)) {
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
for (String s : split) {
|
||||
// 更新名称为:名称+时间戳
|
||||
CompPO comp = MapperProxyFactory.getProxy(CompMapper.class).listById(Long.parseLong(s));
|
||||
params.put("parent_company", comp.getParentCompany());
|
||||
params.put("comp_no", comp.getCompNo());
|
||||
params.put("comp_name", comp.getCompName() + currentTimeMillis);
|
||||
params.put("comp_name_short", comp.getCompNameShort() + currentTimeMillis);
|
||||
params.put("show_order", comp.getShowOrder());
|
||||
updateCompany();
|
||||
idList.add(EcHrmRelationUtil.getEcCompanyId(s));
|
||||
}
|
||||
} else {
|
||||
for (String s : split) {
|
||||
idList.add(EcHrmRelationUtil.getEcCompanyId(s));
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", StringUtils.join(idList, ","));
|
||||
|
||||
if ("0".equals(forbiddenTag)) {
|
||||
// 解封
|
||||
ServiceUtil.getService(OrganizationServiceImpl.class, user).doSubCompanyISCanceled(map, user);
|
||||
} else {
|
||||
// 删除封存、禁用封存
|
||||
ServiceUtil.getService(OrganizationServiceImpl.class, user).doSubCompanyCancel(map, user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新聚才林组织UUID
|
||||
*
|
||||
* @param id
|
||||
* @param ecTableName
|
||||
* @param jclTableName
|
||||
*/
|
||||
private void updateJclUUID(String id, String ecTableName, String jclTableName) {
|
||||
RecordInfo hrmDepartment = getSystemDataMapper().getHrmObjectByID(ecTableName, id);
|
||||
String uuid = hrmDepartment.getUuid();
|
||||
Map<String, Object> departmentMap = new HashMap<>();
|
||||
departmentMap.put("uuid", uuid);
|
||||
long jclTableId = Long.parseLong(Util.null2String(params.get("id")));
|
||||
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName(jclTableName).params(departmentMap).id(jclTableId).build();
|
||||
getExtMapper().updateTable(infoParams);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,12 +4,10 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.hrm.service.impl.HrmJobServiceImpl;
|
||||
import com.engine.hrm.service.impl.OrganizationServiceImpl;
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
|
|
@ -465,40 +463,21 @@ public class OrganizationSyncEc {
|
|||
* 封存、解封分部
|
||||
*/
|
||||
private void cancelCompany() {
|
||||
String companyIds = Util.null2String(params.get("id"));
|
||||
// TODO
|
||||
String forbiddenTag = Util.null2String(params.get("forbiddenTag"));
|
||||
List<String> idList = new ArrayList<>();
|
||||
String[] split = companyIds.split(",");
|
||||
if (StringUtils.isBlank(forbiddenTag)) {
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
for (String s : split) {
|
||||
// 更新名称为:名称+时间戳
|
||||
CompPO comp = MapperProxyFactory.getProxy(CompMapper.class).listById(Long.parseLong(s));
|
||||
params.put("parent_company", comp.getParentCompany());
|
||||
params.put("comp_no", comp.getCompNo() + currentTimeMillis);
|
||||
params.put("comp_name", comp.getCompName() + currentTimeMillis);
|
||||
params.put("comp_name_short", comp.getCompNameShort() + currentTimeMillis);
|
||||
params.put("show_order", comp.getShowOrder());
|
||||
updateCompany();
|
||||
idList.add(EcHrmRelationUtil.getEcCompanyId(s));
|
||||
}
|
||||
} else {
|
||||
for (String s : split) {
|
||||
idList.add(EcHrmRelationUtil.getEcCompanyId(s));
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", StringUtils.join(idList, ","));
|
||||
|
||||
if ("0".equals(forbiddenTag)) {
|
||||
// 解封
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doSubCompanyISCanceled(map, user);
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doSubCompanyISCanceled(params, user);
|
||||
} else {
|
||||
// 删除封存、禁用封存
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doSubCompanyCancel(map, user);
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doSubCompanyCancel(params, user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 补全分部参数信息
|
||||
* @param map
|
||||
*/
|
||||
private void buildEcCompanyData(Map<String, Object> map) {
|
||||
String ecCompanyId = Util.null2String(params.get("id"));
|
||||
|
||||
|
|
@ -522,6 +501,10 @@ public class OrganizationSyncEc {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 补全部门参数信息
|
||||
* @param map
|
||||
*/
|
||||
private void buildEcDepartmentData(Map<String, Object> map) {
|
||||
String ecDepartment = EcHrmRelationUtil.getEcDepartmentId(Util.null2String(params.get("id")));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.map.JclOrgMap;
|
||||
import com.engine.organization.entity.staff.po.StaffPO;
|
||||
import com.engine.organization.entity.staff.po.StaffPlanPO;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
|
|
@ -37,8 +37,8 @@ public class StaffTriggerRunnable implements Runnable {
|
|||
return MapperProxyFactory.getProxy(StaffTriggerMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
private CompanyMapper getCompanyMapper() {
|
||||
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
||||
}
|
||||
|
||||
private DepartmentMapper getDepartmentMapper() {
|
||||
|
|
@ -84,18 +84,18 @@ public class StaffTriggerRunnable implements Runnable {
|
|||
switch (fType) {
|
||||
case "1":
|
||||
// 更新分部编制
|
||||
refreshCompanyStaff(staffPO.getCompId());
|
||||
refreshCompanyStaff(staffPO.getCompId().intValue());
|
||||
break;
|
||||
case "2":
|
||||
// 更新部门编制
|
||||
refreshDepartmentStaff(staffPO.getDeptId());
|
||||
refreshCompanyStaff(staffPO.getCompId());
|
||||
refreshCompanyStaff(staffPO.getCompId().intValue());
|
||||
break;
|
||||
case "3":
|
||||
// 更新岗位编制
|
||||
refreshJobStaff(staffPO.getJobId());
|
||||
refreshDepartmentStaff(staffPO.getDeptId());
|
||||
refreshCompanyStaff(staffPO.getCompId());
|
||||
refreshCompanyStaff(staffPO.getCompId().intValue());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -104,15 +104,15 @@ public class StaffTriggerRunnable implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
private void refreshCompanyStaff(Long companyId) {
|
||||
private void refreshCompanyStaff(Integer companyId) {
|
||||
if (null == companyId) {
|
||||
return;
|
||||
}
|
||||
CompPO compPO = getCompMapper().listById(companyId);
|
||||
CompanyPO compPO = getCompanyMapper().listById(companyId);
|
||||
if (null != compPO) {
|
||||
updateOrgMap(ModuleTypeEnum.subcompanyfielddefined.getValue().toString(), companyId.toString());
|
||||
if (null != compPO.getParentCompany() && 0 != compPO.getParentCompany()) {
|
||||
refreshCompanyStaff(compPO.getParentCompany());
|
||||
if (null != compPO.getSupSubComId() && 0 != compPO.getSupSubComId()) {
|
||||
refreshCompanyStaff(compPO.getSupSubComId());
|
||||
} else {
|
||||
// 刷新集团数据
|
||||
refreshGroupStaff();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package com.engine.organization.transmethod;
|
||||
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -17,9 +17,8 @@ import java.util.stream.Collectors;
|
|||
public class CompTransMethod {
|
||||
|
||||
public static String getSpanById(String planId) {
|
||||
CompMapper compMapper = MapperProxyFactory.getProxy(CompMapper.class);
|
||||
List<Map<String, Object>> maps = compMapper.listCompsByIds(DeleteParam.builder().ids(planId).build().getIds());
|
||||
String names = maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(","));
|
||||
return names;
|
||||
CompanyMapper compMapper = MapperProxyFactory.getProxy(CompanyMapper.class);
|
||||
List<CompanyPO> maps = compMapper.getCompsByIds(DeleteParam.builder().ids(planId).build().getIds());
|
||||
return maps.stream().map(CompanyPO::getSubCompanyName).collect(Collectors.joining(","));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.engine.organization.transmethod;
|
||||
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
|
|
@ -19,7 +19,7 @@ public class HrmResourceTransMethod {
|
|||
}
|
||||
|
||||
public static String getCompanyName(String companyId) {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class).listById(Long.parseLong(companyId)).getCompName();
|
||||
return MapperProxyFactory.getProxy(CompanyMapper.class).listById(Integer.parseInt(companyId)).getSubCompanyName();
|
||||
}
|
||||
public static String getJobName(String jobTitle) {
|
||||
return MapperProxyFactory.getProxy(JobMapper.class).getJobById(Long.parseLong(jobTitle)).getJobName();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.engine.organization.util.detach;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.job.dto.JobListDTO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
|
|
@ -36,9 +36,9 @@ public class DetachUtil {
|
|||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterCompanyList(List<CompPO> companyList) {
|
||||
public void filterCompanyList(List<CompanyPO> companyList) {
|
||||
if (DETACH && CollectionUtils.isNotEmpty(companyList)) {
|
||||
companyList.removeIf(item -> !jclRoleLevels.contains(item.getId()));
|
||||
companyList.removeIf(item -> !jclRoleLevels.contains((long) item.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package com.engine.organization.util.relation;
|
||||
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
|
|
@ -12,7 +12,6 @@ import com.engine.organization.util.db.MapperProxyFactory;
|
|||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -30,8 +29,8 @@ public class EcHrmRelationUtil {
|
|||
return MapperProxyFactory.getProxy(SystemDataMapper.class);
|
||||
}
|
||||
|
||||
private static CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
private static CompanyMapper getCompanyMapper() {
|
||||
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
||||
}
|
||||
|
||||
private static DepartmentMapper getDepartmentMapper() {
|
||||
|
|
@ -49,7 +48,7 @@ public class EcHrmRelationUtil {
|
|||
* @return
|
||||
*/
|
||||
public static String getEcCompanyId(String companyId) {
|
||||
CompPO compPO = getCompMapper().listById(Long.parseLong(companyId));
|
||||
CompanyPO compPO = getCompanyMapper().listById(Integer.parseInt(companyId));
|
||||
RecordInfo supSubCompany = getSystemDataMapper().getHrmObjectByUUID(HRM_COMPANY, compPO.getUuid());
|
||||
if (null == supSubCompany) {
|
||||
return "0";
|
||||
|
|
@ -69,30 +68,6 @@ public class EcHrmRelationUtil {
|
|||
return supDepartment.getId();
|
||||
}
|
||||
|
||||
public static CompPO getJclCompanyId(String ecCompanyId) {
|
||||
if (StringUtils.isBlank(ecCompanyId)) {
|
||||
return null;
|
||||
}
|
||||
RecordInfo ecCompany = getSystemDataMapper().getHrmObjectByID(HRM_COMPANY, ecCompanyId);
|
||||
if (null == ecCompany) {
|
||||
return null;
|
||||
}
|
||||
String uuid = ecCompany.getUuid();
|
||||
return getCompMapper().getCompanyByUUID(uuid);
|
||||
}
|
||||
|
||||
public static String getBatchJclCompanyId(String ecBatchCompanyId) {
|
||||
if (StringUtils.isBlank(ecBatchCompanyId)) {
|
||||
return null;
|
||||
}
|
||||
List<String> strings = Arrays.asList(ecBatchCompanyId.split(","));
|
||||
List<String> uuids = getSystemDataMapper().getBatchUuidByIds(HRM_COMPANY, strings);
|
||||
List<Long> companyIdsByUuid = getCompMapper().getCompanyIdsByUuid(uuids);
|
||||
if (CollectionUtils.isNotEmpty(companyIdsByUuid)) {
|
||||
return StringUtils.join(companyIdsByUuid, ",");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public static DepartmentPO getJclDepartmentId(String ecDepartmentId) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import com.engine.organization.entity.staff.bo.StaffBO;
|
|||
import com.engine.organization.entity.staff.param.StaffSearchParam;
|
||||
import com.engine.organization.entity.staff.po.StaffPO;
|
||||
import com.engine.organization.entity.staff.po.StaffPlanPO;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.staff.StaffMapper;
|
||||
|
|
@ -151,7 +151,7 @@ public class StaffInfoImportUtil {
|
|||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId.intValue());
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
|
|
|
|||
|
|
@ -3,13 +3,11 @@ package com.engine.organization.web;
|
|||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.company.param.CompSearchParam;
|
||||
import com.engine.organization.entity.company.param.CompanyParam;
|
||||
import com.engine.organization.entity.department.param.DepartmentMoveParam;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.CompWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -65,10 +63,10 @@ public class CompController {
|
|||
@POST
|
||||
@Path("/saveBaseComp")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult saveBaseComp(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map<String, Object> params) {
|
||||
public ReturnResult saveBaseComp(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getCompWrapper(user).saveBaseComp(params));
|
||||
return ReturnResult.successed(getCompWrapper(user).saveBaseComp(ParamUtil.request2Map(request)));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
|
|
@ -85,7 +83,7 @@ public class CompController {
|
|||
@POST
|
||||
@Path("/updateForbiddenTagById")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult updateForbiddenTagById(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody CompSearchParam param) {
|
||||
public ReturnResult updateForbiddenTagById(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody CompanyParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getCompWrapper(user).updateForbiddenTagById(param));
|
||||
|
|
@ -128,9 +126,7 @@ public class CompController {
|
|||
public ReturnResult deleteByIds(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeleteParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
params.put("id", StringUtils.join(param.getIds(), ","));
|
||||
return ReturnResult.successed(getCompWrapper(user).deleteByIds(params));
|
||||
return ReturnResult.successed(getCompWrapper(user).deleteByIds(param.getIds()));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,21 +4,21 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.annotation.Log;
|
||||
import com.engine.organization.entity.company.param.CompSearchParam;
|
||||
import com.engine.organization.entity.company.param.CompanyParam;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import com.engine.organization.entity.department.param.DepartmentMoveParam;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.service.CompService;
|
||||
import com.engine.organization.service.impl.CompServiceImpl;
|
||||
import com.engine.organization.thread.CompanyTriggerRunnable;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -33,8 +33,8 @@ public class CompWrapper extends OrganizationWrapper {
|
|||
return ServiceUtil.getService(CompServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
private CompanyMapper getCompanyMapper() {
|
||||
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -57,10 +57,9 @@ public class CompWrapper extends OrganizationWrapper {
|
|||
@Log(operateType = OperateTypeEnum.ADD, operateDesc = "新增分部", operateModule = LogModuleNameEnum.COMPANY)
|
||||
public Long saveBaseComp(Map<String, Object> params) {
|
||||
Long companyId = getCompService(user).saveBaseComp(params);
|
||||
// TODO
|
||||
//writeOperateLog(new Object() {
|
||||
//}.getClass(), params.get("comp_name").toString(), JSON.toJSONString(params), "新增分部");
|
||||
//new Thread(new CompanyTriggerRunnable(companyId)).start();
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), params.get("subcompanyname").toString(), JSON.toJSONString(params), "新增分部");
|
||||
//TODO new Thread(new CompanyTriggerRunnable(companyId)).start();
|
||||
return companyId;
|
||||
}
|
||||
|
||||
|
|
@ -70,13 +69,13 @@ public class CompWrapper extends OrganizationWrapper {
|
|||
* @param params
|
||||
*/
|
||||
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部禁用标识", operateModule = LogModuleNameEnum.COMPANY)
|
||||
public int updateForbiddenTagById(CompSearchParam params) {
|
||||
CompPO compPO = getCompMapper().listById(params.getId());
|
||||
public int updateForbiddenTagById(CompanyParam params) {
|
||||
CompanyPO compPO = getCompanyMapper().listById(params.getId());
|
||||
int updateForbiddenTagById = getCompService(user).updateForbiddenTagById(params);
|
||||
CompPO newCompPO = getCompMapper().listById(params.getId());
|
||||
CompanyPO newCompPO = getCompanyMapper().listById(params.getId());
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), compPO.getCompName(), JSON.toJSONString(params), compPO, newCompPO);
|
||||
new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
|
||||
}.getClass(), compPO.getSubCompanyName(), JSON.toJSONString(params), compPO, newCompPO);
|
||||
//TODO new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
|
||||
return updateForbiddenTagById;
|
||||
}
|
||||
|
||||
|
|
@ -88,31 +87,33 @@ public class CompWrapper extends OrganizationWrapper {
|
|||
*/
|
||||
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部信息", operateModule = LogModuleNameEnum.COMPANY)
|
||||
public Long updateComp(Map<String, Object> params) {
|
||||
long id = Long.parseLong(params.get("id").toString());
|
||||
CompPO compPO = getCompMapper().listById(id);
|
||||
Integer id = Integer.parseInt(params.get("id").toString());
|
||||
CompanyPO compPO = getCompanyMapper().listById(id);
|
||||
Long companyId = getCompService(user).updateComp(params);
|
||||
CompPO newCompPO = getCompMapper().listById(id);
|
||||
CompanyPO newCompPO = getCompanyMapper().listById(id);
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), compPO.getCompName(), JSON.toJSONString(params), compPO, newCompPO);
|
||||
new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
|
||||
}.getClass(), compPO.getSubCompanyName(), JSON.toJSONString(params), compPO, newCompPO);
|
||||
//TODO new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
|
||||
return companyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID批量删除
|
||||
*
|
||||
* @param params
|
||||
* @param ids
|
||||
*/
|
||||
@Log(operateType = OperateTypeEnum.DELETE, operateDesc = "删除分部信息", operateModule = LogModuleNameEnum.COMPANY)
|
||||
public Map<String, Object> deleteByIds(Map<String, Object> params) {
|
||||
//List<CompPO> compsByIds = getCompMapper().getCompsByIds(ids);
|
||||
return getCompService(user).deleteByIds(params);
|
||||
//for (CompPO compsById : compsByIds) {
|
||||
// writeOperateLog(new Object() {
|
||||
// }.getClass(), compsById.getCompName(), JSON.toJSONString(ids), "删除分部信息");
|
||||
// new CompanyTriggerRunnable(compsById).run();
|
||||
//}
|
||||
//return deleteByIds;
|
||||
public Map<String, Object> deleteByIds(List<Long> ids) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", StringUtils.join(ids, ","));
|
||||
List<CompanyPO> compsByIds = getCompanyMapper().getCompsByIds(ids);
|
||||
Map<String, Object> map = getCompService(user).deleteByIds(params);
|
||||
for (CompanyPO compsById : compsByIds) {
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), compsById.getSubCompanyName(), JSON.toJSONString(ids), "删除分部信息");
|
||||
//TODO new CompanyTriggerRunnable(compsById).run();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -123,12 +124,12 @@ public class CompWrapper extends OrganizationWrapper {
|
|||
*/
|
||||
@Log(operateType = OperateTypeEnum.MOVE, operateDesc = "转移分部", operateModule = LogModuleNameEnum.COMPANY)
|
||||
public int moveCompany(DepartmentMoveParam moveParam) {
|
||||
CompPO compPO = getCompMapper().listById(moveParam.getId());
|
||||
CompanyPO compPO = getCompanyMapper().listById(moveParam.getId().intValue());
|
||||
int moveCompany = getCompService(user).moveCompany(moveParam);
|
||||
CompPO newCompPO = getCompMapper().listById(moveParam.getId());
|
||||
CompanyPO newCompPO = getCompanyMapper().listById(moveParam.getId().intValue());
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), compPO.getCompName(), JSON.toJSONString(moveParam), compPO, newCompPO);
|
||||
new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
|
||||
}.getClass(), compPO.getSubCompanyName(), JSON.toJSONString(moveParam), compPO, newCompPO);
|
||||
//TODO new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
|
||||
return moveCompany;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package com.engine.organization.wrapper;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -33,24 +31,24 @@ public class JclOrgWrapper extends OrganizationWrapper {
|
|||
if (StringUtils.isAnyBlank(ecId, type)) {
|
||||
return null;
|
||||
}
|
||||
String jclOrgId = "";
|
||||
switch (type) {
|
||||
case "1":
|
||||
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(ecId);
|
||||
if (null != jclCompanyId) {
|
||||
jclOrgId = jclCompanyId.getId().toString();
|
||||
}
|
||||
break;
|
||||
case "2":
|
||||
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(ecId);
|
||||
if (null != jclDepartmentId) {
|
||||
jclOrgId = jclDepartmentId.getId().toString();
|
||||
}
|
||||
case "3":
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return jclOrgId;
|
||||
//String jclOrgId = "";
|
||||
//switch (type) {
|
||||
// case "1":
|
||||
// CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(ecId);
|
||||
// if (null != jclCompanyId) {
|
||||
// jclOrgId = jclCompanyId.getId().toString();
|
||||
// }
|
||||
// break;
|
||||
// case "2":
|
||||
// DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(ecId);
|
||||
// if (null != jclDepartmentId) {
|
||||
// jclOrgId = jclDepartmentId.getId().toString();
|
||||
// }
|
||||
// case "3":
|
||||
// default:
|
||||
// break;
|
||||
//}
|
||||
return ecId;
|
||||
}
|
||||
|
||||
public void syncCusFieldData(String id) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue