Merge pull request '分部、部门数据源调整;功能逻辑修改' (#79) from feature/dxf into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/79
This commit is contained in:
commit
34bab24a0c
|
|
@ -181,8 +181,8 @@ public class JobBrowserService extends BrowserService {
|
|||
if (CollectionUtils.isNotEmpty(jclRoleLevelList)) {
|
||||
compList = MapperProxyFactory.getProxy(CompMapper.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(CompPO::getId).collect(Collectors.toSet());
|
||||
compList.removeIf(item -> collectIds.contains(item.getSupSubComId()));
|
||||
|
||||
} else {
|
||||
compList = new ArrayList<>();
|
||||
|
|
@ -194,19 +194,19 @@ public class JobBrowserService extends BrowserService {
|
|||
compList.stream().sorted(Comparator.comparing(CompPO::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");
|
||||
CompPO compBuild = CompPO.builder().supSubComId(Integer.parseInt(params.getId())).canceled(0).build();
|
||||
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listByFilter(compBuild, "showorder");
|
||||
if (detachUtil.isDETACH()) {
|
||||
detachUtil.filterCompanyList(compList);
|
||||
}
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().parentComp(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
|
||||
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order");
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().subCompanyId1(Integer.parseInt(params.getId())).canceled(0).build();
|
||||
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "showorder");
|
||||
compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
|
||||
|
||||
departmentList.stream().filter(item -> null == item.getParentDept() || 0 == item.getParentDept()).forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item));
|
||||
departmentList.stream().filter(item -> null == item.getSupDepId() || 0 == item.getSupDepId()).forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item));
|
||||
} else if ("2".equals(params.getType())) {
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().parentDept(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
|
||||
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order");
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().supDepId(Integer.parseInt(params.getId())).canceled(0).build();
|
||||
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "showorder");
|
||||
departmentList.forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item));
|
||||
}
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ public class JobBrowserService extends BrowserService {
|
|||
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);
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ public class JobBrowserService extends BrowserService {
|
|||
private void buildDeptNodes(List<TreeNode> treeNodes, List<String> hasSubDepartment, DepartmentPO department) {
|
||||
SearchTree searchTree = new SearchTree();
|
||||
searchTree.setId(department.getId().toString());
|
||||
searchTree.setName(department.getDeptName());
|
||||
searchTree.setName(department.getDepartmentName());
|
||||
searchTree.setType(TreeNodeTypeEnum.TYPE_DEPT.getValue());
|
||||
searchTree.setIsParent(hasSubDepartment.contains(department.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<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class CodeSettingBO {
|
|||
if(Objects.nonNull(param)) {
|
||||
String enable = Util.null2String(param.getEnable(),"0");
|
||||
String key = param.getKey();
|
||||
if (enable.equals("1") && StringUtils.isNotEmpty(key)) {
|
||||
if ("1".equals(enable) && StringUtils.isNotEmpty(key)) {
|
||||
sb.append(key);
|
||||
sb.append(",");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,8 +96,12 @@ public class FieldInfo {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
FieldInfo fieldInfo = (FieldInfo) o;
|
||||
return Objects.equals(fieldName, fieldInfo.fieldName) &&
|
||||
Objects.equals(firstFieldType, fieldInfo.firstFieldType) &&
|
||||
|
|
|
|||
|
|
@ -1,54 +1,118 @@
|
|||
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.param.CompParam;
|
||||
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
|
||||
* @createTime: 2022/11/24
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class CompBO {
|
||||
|
||||
public static List<CompListDTO> buildCompDTOList(Collection<CompPO> list) {
|
||||
private static CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
Map<Long, CompPO> poMaps = list.stream().collect(Collectors.toMap(CompPO::getId, item -> item));
|
||||
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.getCanceled() != null && 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());
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索条件转换实体对象
|
||||
*
|
||||
* @param param
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public static CompPO convertParamToPO(CompParam param, Integer userId) {
|
||||
if (null == param) {
|
||||
return null;
|
||||
}
|
||||
return CompPO
|
||||
.builder()
|
||||
.id(param.getId() == null ? 0 : param.getId())
|
||||
.subCompanyName(param.getSubCompanyName())
|
||||
.subCompanyDesc(param.getSubCompanyDesc())
|
||||
// 所属集团默认为1
|
||||
.companyId(null == param.getCompanyId() ? 1 : param.getCompanyId())
|
||||
.supSubComId(param.getSupSubComId())
|
||||
.url(param.getUrl())
|
||||
.canceled(param.getCanceled() == null ? null : param.getCanceled() ? 0 : 1)
|
||||
.subCompanyCode(param.getSubCompanyCode())
|
||||
.outKey(param.getOutKey())
|
||||
.limitUsers(null == param.getLimitUsers() ? 0 : param.getLimitUsers())
|
||||
.uuid(param.getUuid())
|
||||
.showOrder(param.getShowOrder())
|
||||
.showOrderOfTree(param.getShowOrderOfTree())
|
||||
.created(new Date())
|
||||
.creater(userId)
|
||||
.modified(new Date())
|
||||
.modifier(userId)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static List<CompListDTO> buildCompDTOList(Collection<CompPO> list, List<CompPO> filterList) {
|
||||
// 搜索结果为空,直接返回空
|
||||
if (CollectionUtils.isEmpty(filterList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 递归添加父级数据
|
||||
Map<Integer, 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 List<CompListDTO> buildCompDTOList(List<CompPO> list) {
|
||||
|
||||
Map<Integer, 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())))
|
||||
.subCompanyCode(e.getSubCompanyCode())
|
||||
.subCompanyDesc(e.getSubCompanyDesc())
|
||||
.subCompanyName(e.getSubCompanyName())
|
||||
.supSubComId(e.getSupSubComId())
|
||||
.supSubComName(null == poMaps.get(e.getSupSubComId()) ? "" : poMaps.get(e.getSupSubComId()).getSubCompanyName())
|
||||
.showOrder(e.getShowOrder())
|
||||
.forbiddenTag(e.getForbiddenTag())
|
||||
.canceled(null == e.getCanceled() ? 0 : e.getCanceled())
|
||||
.build()).collect(Collectors.toList());
|
||||
Map<Long, List<CompListDTO>> collects = dtoList.stream().filter(item -> null != item.getParentCompany() && 0 != item.getParentCompany()).collect(Collectors.groupingBy(CompListDTO::getParentCompany));
|
||||
Map<Integer, List<CompListDTO>> collects = dtoList.stream().filter(item -> 0 != item.getSupSubComId()).collect(Collectors.groupingBy(CompListDTO::getSupSubComId));
|
||||
// 处理被引用数据
|
||||
List<String> usedIds = MapperProxyFactory.getProxy(CompMapper.class).listUsedId();
|
||||
List<String> usedIds = getCompMapper().listUsedId();
|
||||
// 兼容MySQL
|
||||
usedIds.addAll(MapperProxyFactory.getProxy(CompMapper.class).listUsedIds());
|
||||
usedIds.addAll(getCompMapper().listUsedIds());
|
||||
List<String> collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList());
|
||||
Set<Long> leafs = new HashSet<>();
|
||||
Set<Integer> leafs = new HashSet<>();
|
||||
List<CompListDTO> collectTree = dtoList.stream().peek(e -> {
|
||||
List<CompListDTO> childList = collects.get(e.getId());
|
||||
leafs.add(e.getId());
|
||||
|
|
@ -63,65 +127,7 @@ public class CompBO {
|
|||
}
|
||||
}
|
||||
}).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());
|
||||
return collectTree.stream().filter(item -> !leafs.contains(item.getSupSubComId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -131,24 +137,13 @@ public class CompBO {
|
|||
* @param po
|
||||
* @param poMaps
|
||||
*/
|
||||
private static void dealParentData(List<CompPO> addedList, CompPO po, Map<Long, CompPO> poMaps) {
|
||||
private static void dealParentData(List<CompPO> addedList, CompPO po, Map<Integer, CompPO> poMaps) {
|
||||
if (!addedList.contains(po)) {
|
||||
addedList.add(po);
|
||||
}
|
||||
CompPO parentCompPO = poMaps.get(po.getParentCompany());
|
||||
CompPO parentCompPO = poMaps.get(po.getSupSubComId());
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,130 +0,0 @@
|
|||
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.mapper.comp.CompanyMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/11/24
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class CompanyBO {
|
||||
|
||||
private static CompanyMapper getCompanyMapper() {
|
||||
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索条件转换实体对象
|
||||
*
|
||||
* @param param
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public static CompanyPO convertParamToPO(CompanyParam param, Integer userId) {
|
||||
if (null == param) {
|
||||
return null;
|
||||
}
|
||||
return CompanyPO
|
||||
.builder()
|
||||
.id(param.getId() == null ? 0 : param.getId())
|
||||
.subCompanyName(param.getSubCompanyName())
|
||||
.subCompanyDesc(param.getSubCompanyDesc())
|
||||
// 所属集团默认为1
|
||||
.companyId(null == param.getCompanyId() ? 1 : param.getCompanyId())
|
||||
.supSubComId(param.getSupSubComId())
|
||||
.url(param.getUrl())
|
||||
.canceled(param.getCanceled() == null ? null : param.getCanceled() ? 0 : 1)
|
||||
.subCompanyCode(param.getSubCompanyCode())
|
||||
.outKey(param.getOutKey())
|
||||
.limitUsers(null == param.getLimitUsers() ? 0 : param.getLimitUsers())
|
||||
.uuid(param.getUuid())
|
||||
.showOrder(param.getShowOrder())
|
||||
.showOrderOfTree(param.getShowOrderOfTree())
|
||||
.created(new Date())
|
||||
.creater(userId)
|
||||
.modified(new Date())
|
||||
.modifier(userId)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static List<CompanyListDTO> buildCompDTOList(Collection<CompanyPO> list, List<CompanyPO> filterList) {
|
||||
// 搜索结果为空,直接返回空
|
||||
if (CollectionUtils.isEmpty(filterList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 递归添加父级数据
|
||||
Map<Integer, CompanyPO> poMaps = list.stream().collect(Collectors.toMap(CompanyPO::getId, item -> item));
|
||||
List<CompanyPO> addedList = new ArrayList<>();
|
||||
for (CompanyPO po : filterList) {
|
||||
dealParentData(addedList, po, poMaps);
|
||||
}
|
||||
|
||||
return buildCompDTOList(addedList);
|
||||
}
|
||||
|
||||
public static List<CompanyListDTO> buildCompDTOList(List<CompanyPO> list) {
|
||||
|
||||
Map<Integer, CompanyPO> poMaps = list.stream().collect(Collectors.toMap(CompanyPO::getId, item -> item));
|
||||
|
||||
List<CompanyListDTO> dtoList = list.stream().map(e ->
|
||||
CompanyListDTO
|
||||
.builder()
|
||||
.id(e.getId())
|
||||
.subCompanyCode(e.getSubCompanyCode())
|
||||
.subCompanyDesc(e.getSubCompanyDesc())
|
||||
.subCompanyName(e.getSubCompanyName())
|
||||
.supSubComId(e.getSupSubComId())
|
||||
.supSubComName(null == poMaps.get(e.getSupSubComId()) ? "" : poMaps.get(e.getSupSubComId()).getSubCompanyName())
|
||||
.showOrder(e.getShowOrder())
|
||||
.canceled(null == e.getCanceled() ? 0 : e.getCanceled())
|
||||
.build()).collect(Collectors.toList());
|
||||
Map<Integer, List<CompanyListDTO>> collects = dtoList.stream().filter(item -> 0 != item.getSupSubComId()).collect(Collectors.groupingBy(CompanyListDTO::getSupSubComId));
|
||||
// 处理被引用数据
|
||||
List<String> usedIds = getCompanyMapper().listUsedId();
|
||||
// 兼容MySQL
|
||||
usedIds.addAll(getCompanyMapper().listUsedIds());
|
||||
List<String> collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList());
|
||||
Set<Integer> leafs = new HashSet<>();
|
||||
List<CompanyListDTO> collectTree = dtoList.stream().peek(e -> {
|
||||
List<CompanyListDTO> 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.getSupSubComId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归获取查询后数据的父级数据
|
||||
*
|
||||
* @param addedList
|
||||
* @param po
|
||||
* @param poMaps
|
||||
*/
|
||||
private static void dealParentData(List<CompanyPO> addedList, CompanyPO po, Map<Integer, CompanyPO> poMaps) {
|
||||
if (!addedList.contains(po)) {
|
||||
addedList.add(po);
|
||||
}
|
||||
CompanyPO parentCompPO = poMaps.get(po.getSupSubComId());
|
||||
if (null != parentCompPO) {
|
||||
dealParentData(addedList, parentCompPO, poMaps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,21 +10,20 @@ import lombok.NoArgsConstructor;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/16
|
||||
* @createTime: 2022/11/24
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@OrganizationTable(pageId = "2c66b3a4-d4f8-11ec-9774-00ffcbed7508")
|
||||
@OrganizationTable(pageId = "dcfd9d27-6ba2-11ed-996a-00ffcbed7508")
|
||||
public class CompListDTO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
private Integer id;
|
||||
/**
|
||||
* 是否被引用
|
||||
*/
|
||||
|
|
@ -32,46 +31,29 @@ public class CompListDTO {
|
|||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableTitle(title = "名称", dataIndex = "compName", key = "compName")
|
||||
private String compName;
|
||||
@TableTitle(title = "名称", dataIndex = "subCompanyDesc", key = "subCompanyDesc")
|
||||
private String subCompanyDesc;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableTitle(title = "编号", dataIndex = "compNo", key = "compNo")
|
||||
private String compNo;
|
||||
@TableTitle(title = "编号", dataIndex = "subCompanyCode", key = "subCompanyCode")
|
||||
private String subCompanyCode;
|
||||
|
||||
/**
|
||||
* 简称
|
||||
*/
|
||||
@TableTitle(title = "简称", dataIndex = "compNameShort", key = "compNameShort")
|
||||
private String compNameShort;
|
||||
@TableTitle(title = "简称", dataIndex = "subCompanyName", key = "subCompanyName")
|
||||
private String subCompanyName;
|
||||
|
||||
/**
|
||||
* 上级公司
|
||||
*/
|
||||
@TableTitle(title = "上级分部", dataIndex = "parentCompName", key = "parentCompName")
|
||||
private String parentCompName;
|
||||
@TableTitle(title = "上级分部", dataIndex = "supSubComName", key = "supSubComName")
|
||||
private String supSubComName;
|
||||
|
||||
private Long parentCompany;
|
||||
private Integer supSubComId;
|
||||
|
||||
/**
|
||||
* 组织机构代码
|
||||
*/
|
||||
@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;
|
||||
|
|
@ -79,8 +61,8 @@ public class CompListDTO {
|
|||
/**
|
||||
* 禁用标记
|
||||
*/
|
||||
@TableTitle(title = "是否启用", dataIndex = "forbiddenTag", key = "forbiddenTag")
|
||||
private int forbiddenTag;
|
||||
@TableTitle(title = "是否启用", dataIndex = "canceled", key = "canceled")
|
||||
private Integer canceled;
|
||||
|
||||
/**
|
||||
* 操作列
|
||||
|
|
|
|||
|
|
@ -1,77 +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;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/11/24
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@OrganizationTable(pageId = "dcfd9d27-6ba2-11ed-996a-00ffcbed7508")
|
||||
public class CompanyListDTO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 是否被引用
|
||||
*/
|
||||
private Integer isUsed;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableTitle(title = "名称", dataIndex = "subCompanyDesc", key = "subCompanyDesc")
|
||||
private String subCompanyDesc;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableTitle(title = "编号", dataIndex = "subCompanyCode", key = "subCompanyCode")
|
||||
private String subCompanyCode;
|
||||
|
||||
/**
|
||||
* 简称
|
||||
*/
|
||||
@TableTitle(title = "简称", dataIndex = "subCompanyName", key = "subCompanyName")
|
||||
private String subCompanyName;
|
||||
|
||||
/**
|
||||
* 上级公司
|
||||
*/
|
||||
@TableTitle(title = "上级分部", dataIndex = "supSubComName", key = "supSubComName")
|
||||
private String supSubComName;
|
||||
|
||||
private Integer supSubComId;
|
||||
|
||||
|
||||
@TableTitle(title = "显示顺序", dataIndex = "showOrder", key = "showOrder", sorter = true)
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 禁用标记
|
||||
*/
|
||||
@TableTitle(title = "是否启用", dataIndex = "canceled", key = "canceled")
|
||||
private Integer canceled;
|
||||
|
||||
/**
|
||||
* 操作列
|
||||
*/
|
||||
@TableTitle(title = "", dataIndex = "operate", key = "operate")
|
||||
private String operate;
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<CompanyListDTO> children;
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CompanyParam extends BaseQueryParam {
|
||||
public class CompParam extends BaseQueryParam {
|
||||
private Integer Id;
|
||||
private String subCompanyName;
|
||||
private String subCompanyDesc;
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -8,9 +8,8 @@ import lombok.NoArgsConstructor;
|
|||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/16
|
||||
* @createTime: 2022/11/24
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
|
|
@ -18,68 +17,21 @@ import java.util.Date;
|
|||
@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 Integer id;
|
||||
private String subCompanyName;
|
||||
private String subCompanyDesc;
|
||||
private Integer companyId;
|
||||
private Integer supSubComId;
|
||||
private String url;
|
||||
private Integer canceled;
|
||||
private String subCompanyCode;
|
||||
private String outKey;
|
||||
private Integer limitUsers;
|
||||
private Date created;
|
||||
private Integer creater;
|
||||
private Date modified;
|
||||
private Integer modifier;
|
||||
private String uuid;
|
||||
|
||||
private Long creator;
|
||||
private int deleteType;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private Integer showOrder;
|
||||
private Integer showOrderOfTree;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +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;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/11/24
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CompanyPO {
|
||||
private Integer id;
|
||||
private String subCompanyName;
|
||||
private String subCompanyDesc;
|
||||
private Integer companyId;
|
||||
private Integer supSubComId;
|
||||
private String url;
|
||||
private Integer canceled;
|
||||
private String subCompanyCode;
|
||||
private String outKey;
|
||||
private Integer limitUsers;
|
||||
private Date created;
|
||||
private Integer creater;
|
||||
private Date modified;
|
||||
private Integer modifier;
|
||||
private String uuid;
|
||||
private Integer showOrder;
|
||||
private Integer showOrderOfTree;
|
||||
}
|
||||
|
|
@ -26,22 +26,23 @@ public class DepartmentBO {
|
|||
public static List<DepartmentListDTO> buildDeptDTOList(Collection<DepartmentPO> list) {
|
||||
|
||||
// 递归添加父级数据
|
||||
Map<Long, DepartmentPO> poMaps = list.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item));
|
||||
Map<Integer, DepartmentPO> poMaps = list.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item));
|
||||
List<DepartmentListDTO> dtoList = list.stream().map(e ->
|
||||
DepartmentListDTO
|
||||
.builder()
|
||||
.id(e.getId())
|
||||
.deptNo(e.getDeptNo())
|
||||
.deptName(e.getDeptName())
|
||||
.deptNameShort(e.getDeptNameShort())
|
||||
.parentComp(null == e.getParentComp() ? "" : MapperProxyFactory.getProxy(CompMapper.class).listById(e.getParentComp()).getCompName())
|
||||
.parentDept(e.getParentDept())
|
||||
.parentDeptName(null == poMaps.get(e.getParentDept()) ? "" : poMaps.get(e.getParentDept()).getDeptName())
|
||||
.deptPrincipal(getEmployeeNameById(e.getDeptPrincipal()))
|
||||
.departmentMark(e.getDepartmentMark())
|
||||
.departmentName(e.getDepartmentName())
|
||||
.departmentCode(e.getDepartmentCode())
|
||||
.subCompanyId1(e.getSubCompanyId1())
|
||||
.subCompanyName(0 == e.getSubCompanyId1() ? "" : MapperProxyFactory.getProxy(CompMapper.class).listById(e.getSubCompanyId1()).getSubCompanyName())
|
||||
.supDepId(e.getSupDepId())
|
||||
.supDepName(null == poMaps.get(e.getSupDepId()) ? "" : poMaps.get(e.getSupDepId()).getDepartmentName())
|
||||
// .deptPrincipal(getEmployeeNameById(e.getDeptPrincipal()))
|
||||
.showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder())
|
||||
.forbiddenTag(e.getForbiddenTag())
|
||||
.canceled(null == e.getCanceled() ? 0 : e.getCanceled())
|
||||
.build()).collect(Collectors.toList());
|
||||
Map<Long, List<DepartmentListDTO>> collects = dtoList.stream().filter(item -> null != item.getParentDept() && 0 != item.getParentDept()).collect(Collectors.groupingBy(DepartmentListDTO::getParentDept));
|
||||
Map<Integer, List<DepartmentListDTO>> collects = dtoList.stream().filter(item -> 0 != item.getSupDepId()).collect(Collectors.groupingBy(DepartmentListDTO::getSupDepId));
|
||||
// 处理被引用数据
|
||||
List<String> usedIds = MapperProxyFactory.getProxy(DepartmentMapper.class).listUsedId();
|
||||
List<String> collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList());
|
||||
|
|
@ -57,7 +58,7 @@ public class DepartmentBO {
|
|||
e.setIsUsed(0);
|
||||
}
|
||||
}
|
||||
}).filter(item -> null == item.getParentDept() || 0 == item.getParentDept()).collect(Collectors.toList());
|
||||
}).filter(item -> null == item.getSupDepId() || 0 == item.getSupDepId()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<DepartmentListDTO> buildDeptDTOList(Collection<DepartmentPO> list, List<DepartmentPO> filterList) {
|
||||
|
|
@ -66,7 +67,7 @@ public class DepartmentBO {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
// 递归添加父级数据
|
||||
Map<Long, DepartmentPO> poMaps = list.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item));
|
||||
Map<Integer, DepartmentPO> poMaps = list.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item));
|
||||
List<DepartmentPO> addedList = new ArrayList<>();
|
||||
for (DepartmentPO po : filterList) {
|
||||
dealParentData(addedList, po, poMaps);
|
||||
|
|
@ -74,32 +75,32 @@ public class DepartmentBO {
|
|||
return buildDeptDTOList(addedList);
|
||||
}
|
||||
|
||||
public static DepartmentPO convertParamsToPO(DeptSearchParam param, long employeeId) {
|
||||
public static DepartmentPO convertParamsToPO(DeptSearchParam param, Integer employeeId) {
|
||||
if (null == param) {
|
||||
return null;
|
||||
}
|
||||
return DepartmentPO
|
||||
.builder()
|
||||
.id(param.getId() == null ? 0 : param.getId())
|
||||
.deptNo(param.getDeptNo())
|
||||
.deptName(param.getDepartmentName())
|
||||
.deptNameShort(param.getDeptNameShort())
|
||||
.parentComp(null == param.getParentComp() ? param.getSubcompanyid1() : param.getParentComp())
|
||||
.ecCompany(param.getEcCompany())
|
||||
.parentDept(null == param.getParentDept() ? param.getDepartmentid() : param.getParentDept())
|
||||
.ecDepartment(param.getEcDepartment())
|
||||
.deptPrincipal(param.getDeptPrincipal())
|
||||
.departmentMark(param.getDepartmentMark())
|
||||
.departmentName(param.getDepartmentName())
|
||||
.subCompanyId1(param.getSubCompanyId1())
|
||||
.supDepId(param.getSupDepId())
|
||||
.allSupDepId(param.getAllSupDepId())
|
||||
.canceled(param.getCanceled() == null ? null : param.getCanceled() ? 0 : 1)
|
||||
.departmentCode(param.getDepartmentCode())
|
||||
.coadjutant(param.getCoadjutant())
|
||||
.uuid(param.getUuid())
|
||||
.showOrder(param.getShowOrder())
|
||||
.forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1)
|
||||
.description(param.getDescription())
|
||||
.deleteType(0)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.creator(employeeId)
|
||||
.showOrderOfTree(param.getShowOrderOfTree())
|
||||
.created(new Date())
|
||||
.modified(new Date())
|
||||
.creater(employeeId)
|
||||
.modifier(employeeId)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static List<SingleDeptTreeVO> buildSingleDeptTreeVOS(List<DepartmentPO> departmentPOs, Long parentComp) {
|
||||
public static List<SingleDeptTreeVO> buildSingleDeptTreeVOS(List<DepartmentPO> departmentPOs, Integer parentComp) {
|
||||
|
||||
if (CollectionUtils.isEmpty(departmentPOs)) {
|
||||
return Collections.emptyList();
|
||||
|
|
@ -109,17 +110,17 @@ public class DepartmentBO {
|
|||
SingleDeptTreeVO
|
||||
.builder()
|
||||
.id(e.getId())
|
||||
.deptNo(e.getDeptNo())
|
||||
.deptName(e.getDeptName())
|
||||
.parentComp(e.getParentComp())
|
||||
.parentDept(e.getParentDept())
|
||||
.parentDeptName(e.getParentDept() == null ? "" : getDeptNameById(e.getParentDept()))
|
||||
.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal()))
|
||||
.departmentCode(e.getDepartmentCode())
|
||||
.departmentMark(e.getDepartmentMark())
|
||||
.subCompanyId1(e.getSubCompanyId1())
|
||||
.supDepId(e.getSupDepId())
|
||||
.supDepName(e.getSupDepId() == 0 ? "" : getDeptNameById(e.getSupDepId()))
|
||||
//.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal()))
|
||||
.build()).collect(Collectors.toList());
|
||||
//获取非一级部门
|
||||
Map<Long, List<SingleDeptTreeVO>> collects = singleDeptTreeVOS.stream().filter(item -> !parentComp.equals(item.getParentComp()) && null != item.getParentDept()).collect(Collectors.groupingBy(SingleDeptTreeVO::getParentDept));
|
||||
Map<Integer, List<SingleDeptTreeVO>> collects = singleDeptTreeVOS.stream().filter(item -> !parentComp.equals(item.getSubCompanyId1()) && 0 != item.getSupDepId()).collect(Collectors.groupingBy(SingleDeptTreeVO::getSupDepId));
|
||||
|
||||
return singleDeptTreeVOS.stream().peek(e -> e.setChildren(collects.get(e.getId()))).filter(item -> parentComp.equals(item.getParentComp())).collect(Collectors.toList());
|
||||
return singleDeptTreeVOS.stream().peek(e -> e.setChildren(collects.get(e.getId()))).filter(item -> parentComp.equals(item.getSubCompanyId1())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<SearchTree> buildSetToSearchTree(Set<DepartmentPO> departmentPOS) {
|
||||
|
|
@ -131,23 +132,23 @@ public class DepartmentBO {
|
|||
return departmentPOS.stream().map(item -> {
|
||||
SearchTree tree = new SearchTree();
|
||||
tree.setCanClick(true);
|
||||
tree.setCanceled(item.getForbiddenTag() != 0);
|
||||
tree.setCanceled(item.getCanceled() != null && item.getCanceled() != 0);
|
||||
tree.setIcon(isLeaf ? "icon-coms-Branch" : "icon-coms-LargeArea");
|
||||
tree.setId(item.getId().toString());
|
||||
tree.setIsParent(false);
|
||||
tree.setIsVirtual("0");
|
||||
tree.setName(item.getDeptName());
|
||||
tree.setPid(null == item.getParentDept() ? "0" : item.getParentDept().toString());
|
||||
tree.setName(item.getDepartmentName());
|
||||
tree.setPid(item.getSupDepId().toString());
|
||||
tree.setSelected(false);
|
||||
tree.setType("2");
|
||||
tree.setParentComp(null == item.getParentComp() ? "0" : item.getParentComp().toString());
|
||||
tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder());
|
||||
tree.setParentComp(item.getSubCompanyId1().toString());
|
||||
tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder().intValue());
|
||||
return tree;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public static String getDeptNameById(Long id) {
|
||||
public static String getDeptNameById(Integer id) {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(id);
|
||||
}
|
||||
|
||||
|
|
@ -163,11 +164,11 @@ public class DepartmentBO {
|
|||
* @param po
|
||||
* @param poMaps
|
||||
*/
|
||||
private static void dealParentData(List<DepartmentPO> addedList, DepartmentPO po, Map<Long, DepartmentPO> poMaps) {
|
||||
private static void dealParentData(List<DepartmentPO> addedList, DepartmentPO po, Map<Integer, DepartmentPO> poMaps) {
|
||||
if (!addedList.contains(po)) {
|
||||
addedList.add(po);
|
||||
}
|
||||
DepartmentPO parentPO = poMaps.get(po.getParentDept());
|
||||
DepartmentPO parentPO = poMaps.get(po.getSupDepId());
|
||||
if (null != parentPO) {
|
||||
dealParentData(addedList, parentPO, poMaps);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
tableType = WeaTableType.NONE)
|
||||
public class DepartmentListDTO {
|
||||
|
||||
private Long id;
|
||||
private Integer id;
|
||||
/**
|
||||
* 是否被引用
|
||||
*/
|
||||
|
|
@ -33,58 +33,54 @@ public class DepartmentListDTO {
|
|||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableTitle(title = "名称", dataIndex = "deptName", key = "deptName",width = "200")
|
||||
private String deptName;
|
||||
@TableTitle(title = "名称", dataIndex = "departmentMark", key = "departmentMark", width = "200")
|
||||
private String departmentMark;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableTitle(title = "编号", dataIndex = "deptNo", key = "deptNo")
|
||||
private String deptNo;
|
||||
@TableTitle(title = "编号", dataIndex = "departmentCode", key = "departmentCode")
|
||||
private String departmentCode;
|
||||
|
||||
/**
|
||||
* 简称
|
||||
*/
|
||||
@TableTitle(title = "简称", dataIndex = "deptNameShort", key = "deptNameShort")
|
||||
private String deptNameShort;
|
||||
@TableTitle(title = "简称", dataIndex = "departmentName", key = "departmentName")
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 所属分部
|
||||
*/
|
||||
@TableTitle(title = "所属分部", dataIndex = "parentComp", key = "parentComp")
|
||||
private String parentComp;
|
||||
@TableTitle(title = "所属分部", dataIndex = "subCompanyName", key = "subCompanyName")
|
||||
private String subCompanyName;
|
||||
private Integer subCompanyId1;
|
||||
|
||||
/**
|
||||
* 上级部门
|
||||
*/
|
||||
@TableTitle(title = "上级部门", dataIndex = "parentDeptName", key = "parentDeptName")
|
||||
private String parentDeptName;
|
||||
@TableTitle(title = "上级部门", dataIndex = "supDepName", key = "supDepName")
|
||||
private String supDepName;
|
||||
|
||||
private Long parentDept;
|
||||
private Integer supDepId;
|
||||
|
||||
/**
|
||||
* 部门负责人
|
||||
*/
|
||||
@TableTitle(title = "部门负责人", dataIndex = "deptPrincipal", key = "deptPrincipal")
|
||||
private String deptPrincipal;
|
||||
///**
|
||||
// * 部门负责人
|
||||
// */
|
||||
//@TableTitle(title = "部门负责人", dataIndex = "deptPrincipal", key = "deptPrincipal")
|
||||
//private String deptPrincipal;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
@TableTitle(title = "显示顺序", dataIndex = "showOrder", key = "showOrder",sorter = true)
|
||||
private int showOrder;
|
||||
@TableTitle(title = "显示顺序", dataIndex = "showOrder", key = "showOrder", sorter = true)
|
||||
private Double showOrder;
|
||||
|
||||
///**
|
||||
// * 说明
|
||||
// */
|
||||
//@TableTitle(title = "说明", dataIndex = "description", key = "description")
|
||||
//private String description;
|
||||
|
||||
/**
|
||||
* 禁用标记
|
||||
*/
|
||||
@TableTitle(title = "是否启用", dataIndex = "forbiddenTag", key = "forbiddenTag")
|
||||
private int forbiddenTag;
|
||||
@TableTitle(title = "是否启用", dataIndex = "canceled", key = "canceled")
|
||||
private int canceled;
|
||||
/**
|
||||
* 操作列
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ public class DepartmentMergeParam {
|
|||
/**
|
||||
* 所选部门
|
||||
*/
|
||||
private Long id;
|
||||
private Integer id;
|
||||
/**
|
||||
* 合并部门
|
||||
*/
|
||||
private Long department;
|
||||
private Integer department;
|
||||
/**
|
||||
* 合并后名称
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ import lombok.NoArgsConstructor;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DepartmentMoveParam {
|
||||
private Long id;
|
||||
private Integer id;
|
||||
private String moveType;
|
||||
private Long company;
|
||||
private Long department;
|
||||
private Integer company;
|
||||
private Integer department;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,29 +17,17 @@ import lombok.NoArgsConstructor;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DeptSearchParam extends BaseQueryParam {
|
||||
private Long id;
|
||||
|
||||
private String deptNo;
|
||||
|
||||
private Integer id;
|
||||
private String departmentMark;
|
||||
private String departmentName;
|
||||
private Integer subCompanyId1;
|
||||
private Integer supDepId;
|
||||
private String allSupDepId;
|
||||
private Boolean canceled;
|
||||
private String departmentCode;
|
||||
private Integer coadjutant;
|
||||
|
||||
private String deptNameShort;
|
||||
|
||||
private Long parentComp;
|
||||
private Long ecCompany;
|
||||
|
||||
private Long parentDept;
|
||||
private Long ecDepartment;
|
||||
|
||||
private Long deptPrincipal;
|
||||
|
||||
private Integer showOrder;
|
||||
|
||||
private String description;
|
||||
|
||||
private Boolean forbiddenTag;
|
||||
|
||||
private Long subcompanyid1;
|
||||
|
||||
private Long departmentid;
|
||||
private String uuid;
|
||||
private Double showOrder;
|
||||
private Integer showOrderOfTree;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
public class QuerySingleDeptListParam extends BaseQueryParam {
|
||||
|
||||
private Long parentComp;
|
||||
private Integer parentComp;
|
||||
|
||||
private Long parentDept;
|
||||
private Integer parentDept;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,36 +18,22 @@ import java.util.Date;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DepartmentPO {
|
||||
private Integer id;
|
||||
private String departmentMark;
|
||||
private String departmentName;
|
||||
private Integer subCompanyId1;
|
||||
private Integer supDepId;
|
||||
private String allSupDepId;
|
||||
private Integer canceled;
|
||||
private String departmentCode;
|
||||
private Integer coadjutant;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String deptNo;
|
||||
|
||||
private String deptName;
|
||||
|
||||
private String deptNameShort;
|
||||
|
||||
private Long parentComp;
|
||||
private Long ecCompany;
|
||||
|
||||
private Long parentDept;
|
||||
private Long ecDepartment;
|
||||
|
||||
private Long deptPrincipal; //部门负责人
|
||||
|
||||
private Integer showOrder;
|
||||
|
||||
private String description;
|
||||
|
||||
private Integer forbiddenTag;
|
||||
|
||||
private Date created;
|
||||
private Integer creater;
|
||||
private Date modified;
|
||||
private Integer modifier;
|
||||
private String uuid;
|
||||
private Double showOrder;
|
||||
private Integer showOrderOfTree;
|
||||
|
||||
private Long creator;
|
||||
|
||||
private int deleteType;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,23 +24,23 @@ import java.util.List;
|
|||
tableType = WeaTableType.NONE)
|
||||
public class SingleDeptTreeVO {
|
||||
|
||||
private Long id;
|
||||
private Integer id;
|
||||
|
||||
@TableTitle(title = "编号", dataIndex = "deptNo", key = "deptNo")
|
||||
private String deptNo;
|
||||
@TableTitle(title = "编号", dataIndex = "departmentCode", key = "departmentCode")
|
||||
private String departmentCode;
|
||||
|
||||
@TableTitle(title = "部门名称", dataIndex = "deptName", key = "deptName")
|
||||
private String deptName;
|
||||
@TableTitle(title = "部门名称", dataIndex = "departmentMark", key = "departmentMark")
|
||||
private String departmentMark;
|
||||
|
||||
private Long parentComp; //上级分部
|
||||
private Integer subCompanyId1; //上级分部
|
||||
|
||||
private Long parentDept; //上级部门id
|
||||
private Integer supDepId; //上级部门id
|
||||
|
||||
@TableTitle(title = "上级部门", dataIndex = "parentDeptName", key = "parentDeptName")
|
||||
private String parentDeptName; //上级部门
|
||||
@TableTitle(title = "上级部门", dataIndex = "supDepName", key = "supDepName")
|
||||
private String supDepName; //上级部门
|
||||
|
||||
@TableTitle(title = "部门负责人", dataIndex = "deptPrincipalName", key = "deptPrincipalName")
|
||||
private String deptPrincipalName; //部门负责人
|
||||
//@TableTitle(title = "部门负责人", dataIndex = "deptPrincipalName", key = "deptPrincipalName")
|
||||
//private String deptPrincipalName; //部门负责人
|
||||
|
||||
//子节点
|
||||
private List<SingleDeptTreeVO> children;
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ public class ExtendInfoBO {
|
|||
|
||||
switch (fieldhtmltype) {
|
||||
case "1": //单行文本框
|
||||
if (detailtype.equals("2")) {//数字
|
||||
if ("2".equals(detailtype)) {//数字
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUTNUMBER, fieldlabel, fieldname, isQuickSearch);
|
||||
} else {
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, "25034", fieldname, isQuickSearch);
|
||||
|
|
@ -347,14 +347,14 @@ public class ExtendInfoBO {
|
|||
break;
|
||||
}
|
||||
default:
|
||||
if (detailtype.equals("161") || detailtype.equals("162") || detailtype.equals("256") || detailtype.equals("257")) {
|
||||
if ("161".equals(detailtype) || "162".equals(detailtype) || "256".equals(detailtype) || "257".equals(detailtype)) {
|
||||
BrowserBean browserbean = new BrowserBean(Util.null2String(detailtype));
|
||||
BrowserInitUtil browserInitUtil = new BrowserInitUtil();
|
||||
String fielddbtype = customValue;
|
||||
if (!customValue.startsWith("browser.")) {
|
||||
fielddbtype = "browser." + customValue;
|
||||
}
|
||||
if (detailtype.equals("161") || detailtype.equals("162")) {
|
||||
if ("161".equals(detailtype) || "162".equals(detailtype)) {
|
||||
browserInitUtil.initCustomizeBrow(browserbean, fielddbtype, Util.getIntValue(detailtype), user.getUID());
|
||||
} else {
|
||||
browserbean.getDataParams().put("cube_treeid", customValue);
|
||||
|
|
@ -382,7 +382,9 @@ public class ExtendInfoBO {
|
|||
String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
|
||||
for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) {
|
||||
String fieldshowname = Util.null2String(shiftManagementToolKit.getShiftOnOffWorkSections(fieldvalues[i], user.getLanguage()));
|
||||
if (fieldshowname.length() == 0) continue;
|
||||
if (fieldshowname.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> replaceData = new HashMap<>();
|
||||
replaceData.put("id", fieldvalues[i]);
|
||||
replaceData.put("name", fieldshowname);
|
||||
|
|
@ -395,7 +397,9 @@ public class ExtendInfoBO {
|
|||
String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
|
||||
for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) {
|
||||
String fieldshowname = Util.null2String(sensitiveWordTypeComInfo.getName(fieldvalues[i]));
|
||||
if (fieldshowname.length() == 0) continue;
|
||||
if (fieldshowname.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> replaceData = new HashMap<>();
|
||||
replaceData.put("id", fieldvalues[i]);
|
||||
replaceData.put("name", fieldshowname);
|
||||
|
|
@ -423,7 +427,7 @@ public class ExtendInfoBO {
|
|||
String fieldshowname = hrmFieldManager.getFieldvalue(user, customValue, Util.getIntValue(fieldid), Util.getIntValue(fieldhtmltype), Util.getIntValue(detailtype), tmpFieldValue, 0);
|
||||
String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
|
||||
String[] fieldshownames = Util.splitString(fieldshowname, ",");
|
||||
if (detailtype.equals("257")) {
|
||||
if ("257".equals(detailtype)) {
|
||||
if (fieldshowname.endsWith(" ")) {
|
||||
fieldshowname = fieldshowname.substring(0, fieldshowname.length() - 5);
|
||||
}
|
||||
|
|
@ -450,7 +454,7 @@ public class ExtendInfoBO {
|
|||
break;
|
||||
case "4": //Check框
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.CHECKBOX, fieldlabel, fieldname);
|
||||
if (detailtype.equals("2")) {
|
||||
if ("2".equals(detailtype)) {
|
||||
searchConditionItem.setConditionType(ConditionType.SWITCH);
|
||||
}
|
||||
|
||||
|
|
@ -459,7 +463,7 @@ public class ExtendInfoBO {
|
|||
|
||||
List<SearchConditionOption> searchConditionOptions = SelectOptionParam.convertJsonToListOption(customValue);
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname, searchConditionOptions);
|
||||
if (detailtype.equals("") || detailtype.equals("0")) {
|
||||
if ("".equals(detailtype) || "0".equals(detailtype)) {
|
||||
detailtype = "1";
|
||||
}
|
||||
searchConditionItem.setKey(Util.null2String(fieldvalue));
|
||||
|
|
@ -467,7 +471,7 @@ public class ExtendInfoBO {
|
|||
searchConditionItem.setDetailtype(Util.getIntValue(detailtype, 3));
|
||||
break;
|
||||
case "6": //附件
|
||||
if (fieldname.equals("resourceimageid")) {
|
||||
if ("resourceimageid".equals(fieldname)) {
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, fieldlabel, fieldname, isQuickSearch);
|
||||
} else {
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.UPLOAD, fieldlabel, fieldname, isQuickSearch);
|
||||
|
|
|
|||
|
|
@ -38,17 +38,17 @@ public class ExtendInfoFieldParam {
|
|||
public String getControlType() {
|
||||
JSONArray fieldType = (JSONArray) this.getFieldType();
|
||||
String fieldHtmlType = Util.null2String(fieldType.get(0));
|
||||
if (fieldHtmlType.equals("input")) {
|
||||
if ("input".equals(fieldHtmlType)) {
|
||||
fieldHtmlType = "1";
|
||||
} else if (fieldHtmlType.equals("textarea")) {
|
||||
} else if ("textarea".equals(fieldHtmlType)) {
|
||||
fieldHtmlType = "2";
|
||||
} else if (fieldHtmlType.equals("browser")) {
|
||||
} else if ("browser".equals(fieldHtmlType)) {
|
||||
fieldHtmlType = "3";
|
||||
} else if (fieldHtmlType.equals("check")) {
|
||||
} else if ("check".equals(fieldHtmlType)) {
|
||||
fieldHtmlType = "4";
|
||||
} else if (fieldHtmlType.equals("select")) {
|
||||
} else if ("select".equals(fieldHtmlType)) {
|
||||
fieldHtmlType = "5";
|
||||
} else if (fieldHtmlType.equals("upload")) {
|
||||
} else if ("upload".equals(fieldHtmlType)) {
|
||||
fieldHtmlType = "6";
|
||||
}
|
||||
return fieldHtmlType;
|
||||
|
|
@ -60,27 +60,27 @@ public class ExtendInfoFieldParam {
|
|||
if (fieldType.size() > 1) {
|
||||
browserType = Util.null2String(fieldType.get(1));
|
||||
}
|
||||
if (controlType.equals("1")) {
|
||||
if (browserType.equals("text")) {
|
||||
if ("1".equals(controlType)) {
|
||||
if ("text".equals(browserType)) {
|
||||
browserType = "1";
|
||||
} else if (browserType.equals("int")) {
|
||||
} else if ("int".equals(browserType)) {
|
||||
browserType = "2";
|
||||
} else if (browserType.equals("float")) {
|
||||
} else if ("float".equals(browserType)) {
|
||||
browserType = "3";
|
||||
} else if (browserType.equals("file")) {
|
||||
} else if ("file".equals(browserType)) {
|
||||
browserType = "1";
|
||||
}
|
||||
}
|
||||
if (controlType.equals("2")) {
|
||||
if ("2".equals(controlType)) {
|
||||
browserType = "1";
|
||||
} else if (controlType.equals("3")) {
|
||||
} else if ("3".equals(controlType)) {
|
||||
browserType = Util.null2String(((JSONObject) fieldType.get(1)).get("value"));
|
||||
} else if (controlType.equals("4")) {
|
||||
} else if ("4".equals(controlType)) {
|
||||
browserType = "1";
|
||||
} else if (controlType.equals("5")) {
|
||||
} else if ("5".equals(controlType)) {
|
||||
browserType = "1";
|
||||
} else if (controlType.equals("6")) {
|
||||
if (browserType.equals("file")) {
|
||||
} else if ("6".equals(controlType)) {
|
||||
if ("file".equals(browserType)) {
|
||||
browserType = "1";
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ public class ExtendInfoFieldParam {
|
|||
|
||||
public String getDbType(String controlType, String browserType) {
|
||||
FieldParam fp = new FieldParam();
|
||||
if (controlType.equals("1")) {
|
||||
if ("1".equals(controlType)) {
|
||||
JSONArray fieldType = (JSONArray) this.getFieldType();
|
||||
String dbLength = "100";
|
||||
if (fieldType.size() > 2) {
|
||||
|
|
@ -101,15 +101,15 @@ public class ExtendInfoFieldParam {
|
|||
|
||||
}
|
||||
fp.setSimpleText(Util.getIntValue(browserType, -1), dbLength);
|
||||
} else if (controlType.equals("2")) {
|
||||
} else if ("2".equals(controlType)) {
|
||||
fp.setText();
|
||||
} else if (controlType.equals("3")) {
|
||||
} else if ("3".equals(controlType)) {
|
||||
fp.setBrowser(Util.getIntValue(browserType, -1));
|
||||
} else if (controlType.equals("4")) {
|
||||
} else if ("4".equals(controlType)) {
|
||||
fp.setCheck();
|
||||
} else if (controlType.equals("5")) {
|
||||
} else if ("5".equals(controlType)) {
|
||||
fp.setSelect();
|
||||
} else if (controlType.equals("6")) {
|
||||
} else if ("6".equals(controlType)) {
|
||||
fp.setAttach();
|
||||
}
|
||||
return fp.getFielddbtype();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class JobBO {
|
|||
.ecCompany(param.getEcCompany())
|
||||
.ecDepartment(param.getEcDepartment())
|
||||
.parentComp(param.getSubcompanyid1())
|
||||
.parentDept( param.getDepartmentid())
|
||||
.parentDept(param.getDepartmentid())
|
||||
.sequenceId(param.getSequenceId())
|
||||
.schemeId(param.getSchemeId())
|
||||
.parentJob(param.getParentJob())
|
||||
|
|
@ -53,7 +53,7 @@ public class JobBO {
|
|||
}
|
||||
|
||||
|
||||
public static List<SingleJobTreeVO> buildSingleJobTreeVOS(List<JobPO> jobPOS, Long parentDept) {
|
||||
public static List<SingleJobTreeVO> buildSingleJobTreeVOS(List<JobPO> jobPOS, Integer parentDept) {
|
||||
if (CollectionUtils.isEmpty(jobPOS)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
@ -78,15 +78,13 @@ public class JobBO {
|
|||
|
||||
public static List<JobListDTO> buildDTOList(Collection<JobListDTO> list) {
|
||||
// 递归添加父级数据
|
||||
Map<Long, JobListDTO> poMaps = list.stream().collect(Collectors.toMap(JobListDTO::getId, item -> item));
|
||||
|
||||
List<JobListDTO> dtoList = list.stream().map(e ->
|
||||
JobListDTO.builder()
|
||||
.id(e.getId())
|
||||
.jobNo(e.getJobNo())
|
||||
.jobName(e.getJobName())
|
||||
.compName(e.getCompName())
|
||||
.deptName(e.getDeptName())
|
||||
.subCompanyName(e.getSubCompanyName())
|
||||
.departmentName(e.getDepartmentName())
|
||||
.sequenceName(e.getSequenceName())
|
||||
.schemeName(e.getSchemeName())
|
||||
//.parentJob(e.getParentJob())
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class JobListDTO {
|
|||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableTitle(title = "名称", dataIndex = "jobName", key = "jobName",width = "150")
|
||||
@TableTitle(title = "名称", dataIndex = "jobName", key = "jobName", width = "150")
|
||||
private String jobName;
|
||||
/**
|
||||
* 编号
|
||||
|
|
@ -44,13 +44,13 @@ public class JobListDTO {
|
|||
/**
|
||||
* 所属分部
|
||||
*/
|
||||
@TableTitle(title = "所属分部", dataIndex = "compName", key = "compName")
|
||||
private String compName;
|
||||
@TableTitle(title = "所属分部", dataIndex = "subCompanyName", key = "subCompanyName")
|
||||
private String subCompanyName;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@TableTitle(title = "所属部门", dataIndex = "deptName", key = "deptName")
|
||||
private String deptName;
|
||||
@TableTitle(title = "所属部门", dataIndex = "departmentName", key = "departmentName")
|
||||
private String departmentName;
|
||||
/**
|
||||
* 岗位序列
|
||||
*/
|
||||
|
|
@ -68,7 +68,7 @@ public class JobListDTO {
|
|||
//@TableTitle(title = "上级岗位", dataIndex = "parentJobName", key = "parentJobName")
|
||||
private String parentJobName;
|
||||
private Long parentJob;
|
||||
private Long parentComp;
|
||||
private Integer parentComp;
|
||||
/**
|
||||
* 是否关键岗
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ public class JobSearchParam extends BaseQueryParam {
|
|||
/**
|
||||
* ec分部
|
||||
*/
|
||||
private Long ecCompany;
|
||||
private Integer ecCompany;
|
||||
/**
|
||||
* ec部门
|
||||
*/
|
||||
private Long ecDepartment;
|
||||
private Integer ecDepartment;
|
||||
/**
|
||||
* 岗位序列
|
||||
*/
|
||||
|
|
@ -79,7 +79,7 @@ public class JobSearchParam extends BaseQueryParam {
|
|||
*/
|
||||
private Integer showOrder;
|
||||
|
||||
private Long subcompanyid1;
|
||||
private Integer subcompanyid1;
|
||||
|
||||
private Long departmentid;
|
||||
private Integer departmentid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,20 +33,20 @@ public class JobPO {
|
|||
/**
|
||||
* 所属分部
|
||||
*/
|
||||
private Long parentComp;
|
||||
private Integer parentComp;
|
||||
|
||||
/**
|
||||
* ec分部
|
||||
*/
|
||||
private Long ecCompany;
|
||||
private Integer ecCompany;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private Long parentDept;
|
||||
private Integer parentDept;
|
||||
/**
|
||||
* ec部门
|
||||
*/
|
||||
private Long ecDepartment;
|
||||
private Integer ecDepartment;
|
||||
|
||||
/**
|
||||
* 岗位序列
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class SingleJobTreeVO {
|
|||
|
||||
private Long parentJob;
|
||||
|
||||
private Long parentDept;
|
||||
private Integer parentDept;
|
||||
|
||||
private List<SingleJobTreeVO> children;
|
||||
|
||||
|
|
|
|||
|
|
@ -98,8 +98,12 @@ public class FieldInfo {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
FieldInfo fieldInfo = (FieldInfo) o;
|
||||
return Objects.equals(fieldName, fieldInfo.fieldName) &&
|
||||
Objects.equals(firstFieldType, fieldInfo.firstFieldType) &&
|
||||
|
|
|
|||
|
|
@ -24,8 +24,12 @@ public class SearchTree extends TreeNode {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
SearchTree that = (SearchTree) o;
|
||||
return isCanceled == that.isCanceled && Objects.equals(this.getId(), that.getId()) &&Objects.equals(companyid, that.companyid) && Objects.equals(isVirtual, that.isVirtual) && Objects.equals(psubcompanyid, that.psubcompanyid) && Objects.equals(displayType, that.displayType) && Objects.equals(requestParams, that.requestParams) && Objects.equals(parentComp, that.parentComp) && Objects.equals(orderNum, that.orderNum);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ public class StaffSearchParam {
|
|||
/**
|
||||
* 分部
|
||||
*/
|
||||
private Long compId;
|
||||
private Long ecCompany;
|
||||
private Integer compId;
|
||||
private Integer ecCompany;
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
private Long deptId;
|
||||
private Long ecDepartment;
|
||||
private Integer deptId;
|
||||
private Integer ecDepartment;
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ public class StaffPO {
|
|||
/**
|
||||
* 分部
|
||||
*/
|
||||
private Long compId;
|
||||
private Long ecCompany;
|
||||
private Integer compId;
|
||||
private Integer ecCompany;
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
private Long deptId;
|
||||
private Long ecDepartment;
|
||||
private Integer deptId;
|
||||
private Integer ecDepartment;
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
|
|
@ -19,7 +18,9 @@ public interface CompMapper {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
List<CompPO> list(@Param("orderSql") String orderSql);
|
||||
List<CompPO> listAll(@Param("orderSql") String orderSql);
|
||||
|
||||
List<CompPO> listByFilter(@Param("CompanyPO") CompPO CompanyPO, @Param("orderSql") String orderSql);
|
||||
|
||||
/**
|
||||
* 查询所有被引用的ID
|
||||
|
|
@ -30,48 +31,13 @@ public interface CompMapper {
|
|||
|
||||
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);
|
||||
List<CompPO> listChild(@Param("ids") Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
|
|
@ -79,33 +45,7 @@ public interface CompMapper {
|
|||
* @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);
|
||||
CompPO listById(@Param("id") Integer id);
|
||||
|
||||
/**
|
||||
* 根据ID批量查询数据
|
||||
|
|
@ -115,38 +55,25 @@ public interface CompMapper {
|
|||
*/
|
||||
List<CompPO> getCompsByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 保存公司/分部基础信息
|
||||
* 获取顶级数据
|
||||
*
|
||||
* @param compPO
|
||||
* @return
|
||||
*/
|
||||
int insertIgnoreNull(CompPO compPO);
|
||||
List<CompPO> listParent();
|
||||
|
||||
List<String> hasSubs();
|
||||
|
||||
List<String> hasDetachSubs(@Param("companyIds") Collection<Long> companyIds);
|
||||
|
||||
/**
|
||||
* 更新主表内容
|
||||
* 根据名称和上级查找ID
|
||||
*
|
||||
* @param compPO
|
||||
* @param subCompanyName
|
||||
* @param supSubComId
|
||||
* @return
|
||||
*/
|
||||
int updateBaseComp(CompPO compPO);
|
||||
|
||||
/**
|
||||
* 更新禁用标记
|
||||
*
|
||||
* @param compPO
|
||||
* @return
|
||||
*/
|
||||
int updateForbiddenTagById(CompPO compPO);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
int deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
Integer getIdByNameAndPid(@Param("subCompanyName") String subCompanyName, @Param("supSubComId") Integer supSubComId);
|
||||
|
||||
/**
|
||||
* 获取最大排序
|
||||
|
|
@ -154,28 +81,4 @@ public interface CompMapper {
|
|||
* @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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,23 +3,18 @@
|
|||
<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="subCompanyName" property="subCompanyName"/>
|
||||
<result column="subCompanyDesc" property="subCompanyDesc"/>
|
||||
<result column="companyId" property="companyId"/>
|
||||
<result column="supSubComId" property="supSubComId"/>
|
||||
<result column="url" property="url"/>
|
||||
<result column="canceled" property="canceled"/>
|
||||
<result column="subCompanyCode" property="subCompanyCode"/>
|
||||
<result column="outKey" property="outKey"/>
|
||||
<result column="limitUsers" property="limitUsers"/>
|
||||
<result column="uuid" property="uuid"/>
|
||||
<result column="showOrder" property="showOrder"/>
|
||||
<result column="showOrderOfTree" property="showOrderOfTree"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
|
|
@ -27,267 +22,70 @@
|
|||
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.subCompanyName
|
||||
, t.subCompanyDesc
|
||||
, t.companyId
|
||||
, t.supSubComId
|
||||
, t.url
|
||||
, t.canceled
|
||||
, t.subCompanyCode
|
||||
, t.outKey
|
||||
, t.limitUsers
|
||||
, t.uuid
|
||||
, t.showOrder
|
||||
, t.showOrderOfTree
|
||||
</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 id="listAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0 order by ${orderSql}
|
||||
hrmsubcompany t
|
||||
order by ${orderSql}
|
||||
</select>
|
||||
|
||||
<select id="listParent" resultMap="BaseResultMap">
|
||||
<select id="listByFilter" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0
|
||||
<include refid="nullSql"/>
|
||||
hrmsubcompany t
|
||||
WHERE 1=1
|
||||
<include refid="likeSQL"/>
|
||||
<if test=" CompanyPO.supSubComId != null ">
|
||||
and t.supSubComId = #{CompanyPO.supSubComId}
|
||||
</if>
|
||||
order by ${orderSql}
|
||||
</select>
|
||||
|
||||
<select id="listUsedId" resultType="java.lang.String">
|
||||
select SUBCOMPANYID1
|
||||
from hrmdepartment
|
||||
union
|
||||
select ec_company
|
||||
from JCL_ORG_JOB
|
||||
where delete_type = 0
|
||||
union
|
||||
select ec_company
|
||||
from JCL_ORG_STAFF
|
||||
where delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="listUsedIds" resultType="java.lang.String">
|
||||
select ec_company
|
||||
from JCL_ORG_STAFFPLAN
|
||||
where delete_type = 0
|
||||
union
|
||||
select ec_rolelevel
|
||||
from jcl_org_detach
|
||||
where delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="listChild" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0
|
||||
AND parent_company IN
|
||||
hrmsubcompany t
|
||||
WHERE supsubcomid IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
|
@ -297,254 +95,117 @@
|
|||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0
|
||||
and id = #{id}
|
||||
hrmsubcompany t
|
||||
WHERE 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
|
||||
from hrmsubcompany t
|
||||
WHERE 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 id="listParent" 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}
|
||||
hrmsubcompany t
|
||||
WHERE t.SUPSUBCOMID = 0
|
||||
</select>
|
||||
|
||||
<select id="hasSubs" resultType="java.lang.String">
|
||||
select parent_company
|
||||
from jcl_org_comp
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
select supsubcomid
|
||||
from hrmsubcompany
|
||||
where 1=1
|
||||
<include refid="subsWhere"/>
|
||||
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 subcompanyid1
|
||||
from hrmdepartment
|
||||
where 1=1
|
||||
<include refid="subsWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="hasDetachSubs" resultType="java.lang.String">
|
||||
select parent_company
|
||||
from jcl_org_comp
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
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 parent_comp
|
||||
from jcl_org_dept
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
and parent_comp in
|
||||
select subcompanyid1
|
||||
from hrmdepartment
|
||||
where 1=1
|
||||
<include refid="subsWhere"/>
|
||||
and subcompanyid1 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>
|
||||
<select id="getIdByNameAndPid" resultType="java.lang.Integer">
|
||||
select id
|
||||
from hrmsubcompany
|
||||
where subcompanyname = #{subCompanyName}
|
||||
and supsubcomid = #{supSubComId}
|
||||
</select>
|
||||
|
||||
<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>
|
||||
<select id="getMaxShowOrder" resultType="java.lang.Integer">
|
||||
select max(showorder)
|
||||
from hrmsubcompany
|
||||
</select>
|
||||
|
||||
<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 test=" CompanyPO.subCompanyCode != null and CompanyPO.subCompanyCode != '' ">
|
||||
and t.subCompanyCode like CONCAT('%',#{CompanyPO.subCompanyCode},'%')
|
||||
</if>
|
||||
<if test=" compPO.compName != null and compPO.compName != '' ">
|
||||
and t.comp_name like CONCAT('%',#{compPO.compName},'%')
|
||||
<if test=" CompanyPO.subCompanyDesc != null and CompanyPO.subCompanyDesc != '' ">
|
||||
and t.subCompanyDesc like CONCAT('%',#{CompanyPO.subCompanyDesc},'%')
|
||||
</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 test=" CompanyPO.subCompanyName != null and CompanyPO.subCompanyName != '' ">
|
||||
and t.subCompanyName like CONCAT('%',#{CompanyPO.subCompanyName},'%')
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="likeSQL" databaseId="oracle">
|
||||
<if test=" compPO.compNo != null and compPO.compNo != '' ">
|
||||
and t.comp_no like '%'||#{compPO.compNo}||'%'
|
||||
<if test=" CompanyPO.subCompanyCode != null and CompanyPO.subCompanyCode != '' ">
|
||||
and t.subCompanyCode like '%'||#{CompanyPO.subCompanyCode}||'%'
|
||||
</if>
|
||||
<if test=" compPO.compName != null and compPO.compName != '' ">
|
||||
and t.comp_name like '%'||#{compPO.compName}||'%'
|
||||
<if test=" CompanyPO.subCompanyDesc != null and CompanyPO.subCompanyDesc != '' ">
|
||||
and t.subCompanyDesc like '%'||#{CompanyPO.subCompanyDesc}||'%'
|
||||
</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 test=" CompanyPO.subCompanyName != null and CompanyPO.subCompanyName != '' ">
|
||||
and t.subCompanyName like '%'||#{CompanyPO.subCompanyName}||'%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="likeSQL" databaseId="sqlserver">
|
||||
<if test=" compPO.compNo != null and compPO.compNo != '' ">
|
||||
and t.comp_no like '%'+#{compPO.compNo}+'%'
|
||||
<if test=" CompanyPO.subCompanyCode != null and CompanyPO.subCompanyCode != '' ">
|
||||
and t.subCompanyCode like '%'+#{CompanyPO.subCompanyCode}+'%'
|
||||
</if>
|
||||
<if test=" compPO.compName != null and compPO.compName != '' ">
|
||||
and t.comp_name like '%'+#{compPO.compName}+'%'
|
||||
<if test=" CompanyPO.subCompanyDesc != null and CompanyPO.subCompanyDesc != '' ">
|
||||
and t.subCompanyDesc like '%'+#{CompanyPO.subCompanyDesc}+'%'
|
||||
</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 test=" CompanyPO.subCompanyName != null and CompanyPO.subCompanyName != '' ">
|
||||
and t.subCompanyName like '%'+#{CompanyPO.subCompanyName}+'%'
|
||||
</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>
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
package com.engine.organization.mapper.comp;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompanyPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface CompanyMapper {
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<CompanyPO> listAll(@Param("orderSql") String orderSql);
|
||||
|
||||
List<CompanyPO> listByFilter(@Param("CompanyPO") CompanyPO CompanyPO, @Param("orderSql") String orderSql);
|
||||
|
||||
/**
|
||||
* 查询所有被引用的ID
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<String> listUsedId();
|
||||
|
||||
List<String> listUsedIds();
|
||||
|
||||
/**
|
||||
* 获取子层级数据
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<CompanyPO> listChild(@Param("ids") Collection<Long> ids);
|
||||
}
|
||||
|
|
@ -1,130 +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.CompanyMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.organization.entity.company.po.CompanyPO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="subCompanyName" property="subCompanyName"/>
|
||||
<result column="subCompanyDesc" property="subCompanyDesc"/>
|
||||
<result column="companyId" property="companyId"/>
|
||||
<result column="supSubComId" property="supSubComId"/>
|
||||
<result column="url" property="url"/>
|
||||
<result column="canceled" property="canceled"/>
|
||||
<result column="subCompanyCode" property="subCompanyCode"/>
|
||||
<result column="outKey" property="outKey"/>
|
||||
<result column="limitUsers" property="limitUsers"/>
|
||||
<result column="uuid" property="uuid"/>
|
||||
<result column="showOrder" property="showOrder"/>
|
||||
<result column="showOrderOfTree" property="showOrderOfTree"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t
|
||||
.
|
||||
id
|
||||
, t.subCompanyName
|
||||
, t.subCompanyDesc
|
||||
, t.companyId
|
||||
, t.supSubComId
|
||||
, t.url
|
||||
, t.canceled
|
||||
, t.subCompanyCode
|
||||
, t.outKey
|
||||
, t.limitUsers
|
||||
, t.uuid
|
||||
, t.showOrder
|
||||
, t.showOrderOfTree
|
||||
</sql>
|
||||
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
hrmsubcompany t
|
||||
order by ${orderSql}
|
||||
</select>
|
||||
|
||||
<select id="listByFilter" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
hrmsubcompany t
|
||||
WHERE 1=1
|
||||
<include refid="likeSQL"/>
|
||||
<if test=" CompanyPO.supSubComId != null ">
|
||||
and t.supSubComId = #{CompanyPO.supSubComId}
|
||||
</if>
|
||||
order by ${orderSql}
|
||||
</select>
|
||||
|
||||
<select id="listUsedId" resultType="java.lang.String">
|
||||
select SUBCOMPANYID1
|
||||
from hrmdepartment
|
||||
union
|
||||
select ec_company
|
||||
from JCL_ORG_JOB
|
||||
where delete_type = 0
|
||||
union
|
||||
select ec_company
|
||||
from JCL_ORG_STAFF
|
||||
where delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="listUsedIds" resultType="java.lang.String">
|
||||
select ec_company
|
||||
from JCL_ORG_STAFFPLAN
|
||||
where delete_type = 0
|
||||
union
|
||||
select ec_rolelevel
|
||||
from jcl_org_detach
|
||||
where delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="listChild" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
hrmsubcompany t
|
||||
WHERE supsubcomid IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<sql id="likeSQL">
|
||||
<if test=" CompanyPO.subCompanyCode != null and CompanyPO.subCompanyCode != '' ">
|
||||
and t.subCompanyCode like CONCAT('%',#{CompanyPO.subCompanyCode},'%')
|
||||
</if>
|
||||
<if test=" CompanyPO.subCompanyDesc != null and CompanyPO.subCompanyDesc != '' ">
|
||||
and t.subCompanyDesc like CONCAT('%',#{CompanyPO.subCompanyDesc},'%')
|
||||
</if>
|
||||
<if test=" CompanyPO.subCompanyName != null and CompanyPO.subCompanyName != '' ">
|
||||
and t.subCompanyName like CONCAT('%',#{CompanyPO.subCompanyName},'%')
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="likeSQL" databaseId="oracle">
|
||||
<if test=" CompanyPO.subCompanyCode != null and CompanyPO.subCompanyCode != '' ">
|
||||
and t.subCompanyCode like '%'||#{CompanyPO.subCompanyCode}||'%'
|
||||
</if>
|
||||
<if test=" CompanyPO.subCompanyDesc != null and CompanyPO.subCompanyDesc != '' ">
|
||||
and t.subCompanyDesc like '%'||#{CompanyPO.subCompanyDesc}||'%'
|
||||
</if>
|
||||
<if test=" CompanyPO.subCompanyName != null and CompanyPO.subCompanyName != '' ">
|
||||
and t.subCompanyName like '%'||#{CompanyPO.subCompanyName}||'%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="likeSQL" databaseId="sqlserver">
|
||||
<if test=" CompanyPO.subCompanyCode != null and CompanyPO.subCompanyCode != '' ">
|
||||
and t.subCompanyCode like '%'+#{CompanyPO.subCompanyCode}+'%'
|
||||
</if>
|
||||
<if test=" CompanyPO.subCompanyDesc != null and CompanyPO.subCompanyDesc != '' ">
|
||||
and t.subCompanyDesc like '%'+#{CompanyPO.subCompanyDesc}+'%'
|
||||
</if>
|
||||
<if test=" CompanyPO.subCompanyName != null and CompanyPO.subCompanyName != '' ">
|
||||
and t.subCompanyName like '%'+#{CompanyPO.subCompanyName}+'%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -14,28 +14,22 @@ import java.util.Map;
|
|||
* @Version V1.0
|
||||
**/
|
||||
public interface DepartmentMapper {
|
||||
|
||||
List<DepartmentPO> getDeptListByCompId(@Param("parentComp") Integer parentComp);
|
||||
|
||||
List<DepartmentPO> getDeptListByPId(@Param("PId") Long PId);
|
||||
|
||||
int countChildByPID(@Param("pid") Long pid);
|
||||
|
||||
List<DepartmentPO> getDeptListByPId(@Param("PId") Integer PId);
|
||||
|
||||
/**
|
||||
* 查询所有数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<DepartmentPO> list(@Param("orderSql") String orderSql);
|
||||
List<DepartmentPO> listAll(@Param("orderSql") String orderSql);
|
||||
|
||||
/**
|
||||
* 根据No查询数据
|
||||
*
|
||||
* @param deptNo
|
||||
* @param departmentCode
|
||||
* @return
|
||||
*/
|
||||
List<DepartmentPO> listByNo(@Param("deptNo") String deptNo);
|
||||
List<DepartmentPO> listByNo(@Param("departmentCode") String departmentCode);
|
||||
|
||||
/**
|
||||
* 根据搜索条件查询数据
|
||||
|
|
@ -60,15 +54,7 @@ public interface DepartmentMapper {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
DepartmentPO getDeptById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 根据UUID查询数据
|
||||
*
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
DepartmentPO getDepartmentByUUID(@Param("uuid") String uuid);
|
||||
DepartmentPO getDeptById(@Param("id") Integer id);
|
||||
|
||||
/**
|
||||
* 根据ID查询名称
|
||||
|
|
@ -76,38 +62,7 @@ public interface DepartmentMapper {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
String getDeptNameById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
*
|
||||
* @param departmentPO
|
||||
* @return
|
||||
*/
|
||||
int insertIgnoreNull(DepartmentPO departmentPO);
|
||||
|
||||
/**
|
||||
* 更新主表内容
|
||||
*
|
||||
* @param departmentPO
|
||||
* @return
|
||||
*/
|
||||
int updateBaseDept(DepartmentPO departmentPO);
|
||||
|
||||
/**
|
||||
* 更新禁用标记
|
||||
*
|
||||
* @param departmentPO
|
||||
* @return
|
||||
*/
|
||||
int updateForbiddenTagById(DepartmentPO departmentPO);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
int deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
String getDeptNameById(@Param("id") Integer id);
|
||||
|
||||
/**
|
||||
* 查询所有被引用的ID
|
||||
|
|
@ -121,21 +76,22 @@ public interface DepartmentMapper {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
Integer getMaxShowOrder();
|
||||
Double getMaxShowOrder();
|
||||
|
||||
/**
|
||||
* 根据名称、上级 查询部门元素
|
||||
*
|
||||
* @param departmentName
|
||||
* @param parentCompany
|
||||
* @param parentDepartment
|
||||
* @param subCompanyId1
|
||||
* @param supDepId
|
||||
* @return
|
||||
*/
|
||||
Long getIdByNameAndPid(@Param("departmentName") String departmentName, @Param("parentCompany") Long parentCompany, @Param("parentDepartment") Long parentDepartment);
|
||||
Integer getIdByNameAndPid(@Param("departmentName") String departmentName, @Param("subCompanyId1") Integer subCompanyId1, @Param("supDepId") Integer supDepId);
|
||||
|
||||
int checkRepeatNo(@Param("departmentNo") String departmentNo, @Param("id") Long id);
|
||||
int checkRepeatNo(@Param("departmentCode") String departmentCode, @Param("id") Long id);
|
||||
|
||||
List<String> hasSubs();
|
||||
|
||||
int countUsedInJob(@Param("departmentId") Long departmentId);
|
||||
int countUsedInJob(@Param("supDepId") Long supDepId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,22 +3,15 @@
|
|||
<mapper namespace="com.engine.organization.mapper.department.DepartmentMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.organization.entity.department.po.DepartmentPO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="dept_no" property="deptNo"/>
|
||||
<result column="dept_name" property="deptName"/>
|
||||
<result column="dept_name_short" property="deptNameShort"/>
|
||||
<result column="parent_comp" property="parentComp"/>
|
||||
<result column="ec_company" property="ecCompany"/>
|
||||
<result column="parent_dept" property="parentDept"/>
|
||||
<result column="ec_department" property="ecDepartment"/>
|
||||
<result column="dept_principal" property="deptPrincipal"/>
|
||||
<result column="show_order" property="showOrder"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="forbidden_tag" property="forbiddenTag"/>
|
||||
<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="departmentMark" property="departmentMark"/>
|
||||
<result column="departmentName" property="departmentName"/>
|
||||
<result column="subCompanyId1" property="subCompanyId1"/>
|
||||
<result column="supDepId" property="supDepId"/>
|
||||
<result column="allSupDepId" property="allSupDepId"/>
|
||||
<result column="canceled" property="canceled"/>
|
||||
<result column="departmentCode" property="departmentCode"/>
|
||||
<result column="coadjutant" property="coadjutant"/>
|
||||
<result column="showOrder" property="showOrder"/>
|
||||
<result column="uuid" property="uuid"/>
|
||||
</resultMap>
|
||||
|
||||
|
|
@ -28,39 +21,28 @@
|
|||
.
|
||||
id
|
||||
,
|
||||
t.dept_no,
|
||||
t.dept_name,
|
||||
t.dept_name_short,
|
||||
t.parent_comp,
|
||||
t.ec_company,
|
||||
t.parent_dept,
|
||||
t.ec_department,
|
||||
t.dept_principal,
|
||||
t.show_order,
|
||||
t.description,
|
||||
t.forbidden_tag,
|
||||
t.departmentMark,
|
||||
t.departmentName,
|
||||
t.subCompanyId1,
|
||||
t.supDepId,
|
||||
t.allSupDepId,
|
||||
t.canceled,
|
||||
t.departmentCode,
|
||||
t.coadjutant,
|
||||
t.showOrder,
|
||||
t.uuid
|
||||
</sql>
|
||||
|
||||
<select id="getDeptListByCompId" resultType="com.engine.organization.entity.department.po.DepartmentPO">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_dept t
|
||||
where delete_type = 0
|
||||
and parent_comp = #{parentComp}
|
||||
</select>
|
||||
|
||||
<select id="getDeptListByPId" resultType="com.engine.organization.entity.department.po.DepartmentPO">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_dept t
|
||||
where delete_type = 0
|
||||
and parent_dept = #{PId}
|
||||
from hrmdepartment t
|
||||
where supDepId = #{PId}
|
||||
</select>
|
||||
|
||||
<select id="getDeptNameById" resultType="string">
|
||||
select t.dept_name
|
||||
from jcl_org_dept t
|
||||
select t.departmentName
|
||||
from hrmdepartment t
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
|
@ -68,69 +50,45 @@
|
|||
resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_dept t
|
||||
where delete_type = 0
|
||||
from hrmdepartment t
|
||||
where 1=1
|
||||
<include refid="likeSQL"/>
|
||||
<if test=" departmentPO.ecCompany != null ">
|
||||
and t.ec_company = #{departmentPO.ecCompany}
|
||||
<if test=" departmentPO.subCompanyId1 != null ">
|
||||
and t.subCompanyId1 = #{departmentPO.subCompanyId1}
|
||||
</if>
|
||||
<if test=" departmentPO.ecDepartment != null ">
|
||||
and t.ec_department = #{departmentPO.ecDepartment}
|
||||
</if>
|
||||
<if test=" departmentPO.parentComp != null ">
|
||||
and t.parent_comp = #{departmentPO.parentComp}
|
||||
</if>
|
||||
<if test=" departmentPO.parentDept != null ">
|
||||
and t.parent_dept = #{departmentPO.parentDept}
|
||||
</if>
|
||||
<if test=" departmentPO.deptPrincipal != null ">
|
||||
and t.dept_principal = #{departmentPO.deptPrincipal}
|
||||
</if>
|
||||
<if test=" departmentPO.showOrder != null ">
|
||||
and t.show_order = #{departmentPO.showOrder}
|
||||
</if>
|
||||
<if test=" departmentPO.forbiddenTag != null ">
|
||||
and t.forbidden_tag = #{departmentPO.forbiddenTag}
|
||||
<if test=" departmentPO.supDepId != null ">
|
||||
and t.supDepId = #{departmentPO.supDepId}
|
||||
</if>
|
||||
order by ${orderSql}
|
||||
</select>
|
||||
|
||||
<select id="getDeptById" resultType="com.engine.organization.entity.department.po.DepartmentPO">
|
||||
<select id="getDeptById" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_dept t
|
||||
where delete_type = 0
|
||||
and id = #{id}
|
||||
from hrmdepartment t
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="listDeptsByIds" resultType="java.util.Map">
|
||||
select
|
||||
id as "id",
|
||||
dept_name as "name"
|
||||
from jcl_org_dept t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
departmentName as "name"
|
||||
from hrmdepartment t
|
||||
WHERE id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.engine.organization.entity.department.po.DepartmentPO">
|
||||
<select id="listAll" resultType="com.engine.organization.entity.department.po.DepartmentPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM jcl_org_dept t
|
||||
WHERE t.delete_type = 0 order by ${orderSql}
|
||||
FROM hrmdepartment t order by ${orderSql}
|
||||
</select>
|
||||
<select id="listByNo" resultType="com.engine.organization.entity.department.po.DepartmentPO">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_dept t where dept_no = #{deptNo} AND delete_type = 0
|
||||
</select>
|
||||
<select id="countChildByPID" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from jcl_org_dept t
|
||||
where delete_type = 0
|
||||
and parent_dept = #{pid}
|
||||
from hrmdepartment t where departmentCode = #{departmentCode}
|
||||
</select>
|
||||
<select id="listUsedId" resultType="java.lang.String">
|
||||
select parent_dept
|
||||
|
|
@ -144,361 +102,69 @@
|
|||
<select id="getDeptsByIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_dept t
|
||||
where delete_type = 0
|
||||
AND id IN
|
||||
from hrmdepartment t
|
||||
where id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getMaxShowOrder" resultType="java.lang.Integer">
|
||||
select max(show_order)
|
||||
from jcl_org_dept
|
||||
<select id="getMaxShowOrder" resultType="java.lang.Double">
|
||||
select max(showOrder)
|
||||
from hrmdepartment
|
||||
</select>
|
||||
<select id="getIdByNameAndPid" resultType="java.lang.Long">
|
||||
<select id="getIdByNameAndPid" resultType="java.lang.Integer">
|
||||
select id
|
||||
from jcl_org_dept
|
||||
where delete_type = 0 and dept_name = #{departmentName}
|
||||
and parent_comp = #{parentCompany}
|
||||
<include refid="nullParentDepartment"/>
|
||||
</select>
|
||||
<select id="getDepartmentByUUID" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_dept t
|
||||
where delete_type = 0
|
||||
and uuid = #{uuid}
|
||||
from hrmdepartment
|
||||
where departmentName = #{departmentName}
|
||||
and subCompanyId1 = #{subCompanyId1}
|
||||
and supDepId = #{supDepId}
|
||||
</select>
|
||||
<select id="checkRepeatNo" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from jcl_org_dept t
|
||||
where t.delete_type = 0
|
||||
AND dept_no = #{departmentNo}
|
||||
from hrmdepartment t
|
||||
where departmentCode = #{departmentCode}
|
||||
<if test=" id != null ">
|
||||
and t.id != #{id}
|
||||
</if>
|
||||
</select>
|
||||
<select id="hasSubs" resultType="java.lang.String">
|
||||
select distinct parent_dept
|
||||
from jcl_org_dept
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
select distinct supDepId
|
||||
from hrmdepartment
|
||||
where canceled = 0
|
||||
</select>
|
||||
<select id="countUsedInJob" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from jcl_org_job
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
and parent_dept = #{departmentId}
|
||||
and parent_dept = = #{supDepId}
|
||||
</select>
|
||||
<sql id="nullParentDepartment">
|
||||
and ifnull(parent_dept,0) =
|
||||
#{parentDepartment}
|
||||
</sql>
|
||||
|
||||
<sql id="nullParentDepartment" databaseId="sqlserver">
|
||||
and isnull(parent_dept,0) =
|
||||
#{parentDepartment}
|
||||
</sql>
|
||||
|
||||
<sql id="nullParentDepartment" databaseId="oracle">
|
||||
and NVL(parent_dept,0) =
|
||||
#{parentDepartment}
|
||||
</sql>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.department.po.DepartmentPO"
|
||||
keyProperty="id"
|
||||
keyColumn="id" useGeneratedKeys="true">
|
||||
INSERT INTO jcl_org_dept
|
||||
<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="deptNo != null ">
|
||||
dept_no,
|
||||
</if>
|
||||
<if test="deptName != null ">
|
||||
dept_name,
|
||||
</if>
|
||||
<if test="deptNameShort != null ">
|
||||
dept_name_short,
|
||||
</if>
|
||||
<if test="parentComp != null ">
|
||||
parent_comp,
|
||||
</if>
|
||||
<if test="ecCompany != null ">
|
||||
ec_company,
|
||||
</if>
|
||||
<if test="parentDept != null ">
|
||||
parent_dept,
|
||||
</if>
|
||||
<if test="ecDepartment != null ">
|
||||
ec_department,
|
||||
</if>
|
||||
<if test="deptPrincipal != null ">
|
||||
dept_principal,
|
||||
</if>
|
||||
<if test="showOrder != null ">
|
||||
show_order,
|
||||
</if>
|
||||
<if test="description != null ">
|
||||
description,
|
||||
</if>
|
||||
<if test="uuid != null ">
|
||||
uuid,
|
||||
</if>
|
||||
forbidden_tag,
|
||||
</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="deptNo != null ">
|
||||
#{deptNo},
|
||||
</if>
|
||||
<if test="deptName != null ">
|
||||
#{deptName},
|
||||
</if>
|
||||
<if test="deptNameShort != null ">
|
||||
#{deptNameShort},
|
||||
</if>
|
||||
<if test="parentComp != null ">
|
||||
#{parentComp},
|
||||
</if>
|
||||
<if test="ecCompany != null ">
|
||||
#{ecCompany},
|
||||
</if>
|
||||
<if test="parentDept != null ">
|
||||
#{parentDept},
|
||||
</if>
|
||||
<if test="ecDepartment != null ">
|
||||
#{ecDepartment},
|
||||
</if>
|
||||
<if test="deptPrincipal != null ">
|
||||
#{deptPrincipal},
|
||||
</if>
|
||||
<if test="showOrder != null ">
|
||||
#{showOrder},
|
||||
</if>
|
||||
<if test="description != null ">
|
||||
#{description},
|
||||
</if>
|
||||
<if test="uuid != null ">
|
||||
#{uuid},
|
||||
</if>
|
||||
0,
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.department.po.DepartmentPO"
|
||||
databaseId="oracle">
|
||||
<selectKey keyProperty="id" resultType="long" order="AFTER">
|
||||
select JCL_ORG_DEPT_ID.currval from dual
|
||||
</selectKey>
|
||||
INSERT INTO jcl_org_dept
|
||||
<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="deptNo != null ">
|
||||
dept_no,
|
||||
</if>
|
||||
<if test="deptName != null ">
|
||||
dept_name,
|
||||
</if>
|
||||
<if test="deptNameShort != null ">
|
||||
dept_name_short,
|
||||
</if>
|
||||
<if test="parentComp != null ">
|
||||
parent_comp,
|
||||
</if>
|
||||
<if test="ecCompany != null ">
|
||||
ec_company,
|
||||
</if>
|
||||
<if test="parentDept != null ">
|
||||
parent_dept,
|
||||
</if>
|
||||
<if test="ecDepartment != null ">
|
||||
ec_department,
|
||||
</if>
|
||||
<if test="deptPrincipal != null ">
|
||||
dept_principal,
|
||||
</if>
|
||||
<if test="showOrder != null ">
|
||||
show_order,
|
||||
</if>
|
||||
<if test="description != null ">
|
||||
description,
|
||||
</if>
|
||||
<if test="uuid != null ">
|
||||
uuid,
|
||||
</if>
|
||||
forbidden_tag,
|
||||
</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="deptNo != null ">
|
||||
#{deptNo},
|
||||
</if>
|
||||
<if test="deptName != null ">
|
||||
#{deptName},
|
||||
</if>
|
||||
<if test="deptNameShort != null ">
|
||||
#{deptNameShort},
|
||||
</if>
|
||||
<if test="parentComp != null ">
|
||||
#{parentComp},
|
||||
</if>
|
||||
<if test="ecCompany != null ">
|
||||
#{ecCompany},
|
||||
</if>
|
||||
<if test="parentDept != null ">
|
||||
#{parentDept},
|
||||
</if>
|
||||
<if test="ecDepartment != null ">
|
||||
#{ecDepartment},
|
||||
</if>
|
||||
<if test="deptPrincipal != null ">
|
||||
#{deptPrincipal},
|
||||
</if>
|
||||
<if test="showOrder != null ">
|
||||
#{showOrder},
|
||||
</if>
|
||||
<if test="description != null ">
|
||||
#{description},
|
||||
</if>
|
||||
<if test="uuid != null ">
|
||||
#{uuid},
|
||||
</if>
|
||||
0,
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBaseDept" parameterType="com.engine.organization.entity.department.po.DepartmentPO">
|
||||
update jcl_org_dept
|
||||
<set>
|
||||
creator=#{creator},
|
||||
update_time=#{updateTime},
|
||||
dept_name=#{deptName},
|
||||
dept_name_short=#{deptNameShort},
|
||||
parent_comp=#{parentComp},
|
||||
ec_company=#{ecCompany},
|
||||
parent_dept=#{parentDept},
|
||||
ec_department=#{ecDepartment},
|
||||
dept_principal=#{deptPrincipal},
|
||||
show_order=#{showOrder},
|
||||
description=#{description},
|
||||
<if test="forbiddenTag !=null">
|
||||
forbidden_tag=#{forbiddenTag},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.department.po.DepartmentPO">
|
||||
update jcl_org_dept
|
||||
<set>
|
||||
forbidden_tag=#{forbiddenTag},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<update id="deleteByIds">
|
||||
UPDATE jcl_org_dept
|
||||
SET delete_type = 1
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<sql id="likeSQL">
|
||||
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' ">
|
||||
and t.dept_no like CONCAT('%',#{departmentPO.deptNo},'%')
|
||||
<if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
|
||||
and t.departmentCode like CONCAT('%',#{departmentPO.departmentCode},'%')
|
||||
</if>
|
||||
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
|
||||
and t.dept_name like CONCAT('%',#{departmentPO.deptName},'%')
|
||||
</if>
|
||||
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' ">
|
||||
and t.dept_name_short like CONCAT('%',#{departmentPO.deptNameShort},'%')
|
||||
<if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
|
||||
and t.departmentName like CONCAT('%',#{departmentPO.departmentName},'%')
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="likeSQL" databaseId="oracle">
|
||||
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' ">
|
||||
and t.dept_no like '%'||#{departmentPO.deptNo}||'%'
|
||||
<if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
|
||||
and t.departmentCode like '%'||#{departmentPO.departmentCode}||'%'
|
||||
</if>
|
||||
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
|
||||
and t.dept_name like '%'||#{departmentPO.deptName}||'%'
|
||||
</if>
|
||||
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' ">
|
||||
and t.dept_name_short like '%'||#{departmentPO.deptNameShort}||'%'
|
||||
<if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
|
||||
and t.departmentName like '%'||#{departmentPO.departmentName}||'%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="likeSQL" databaseId="sqlserver">
|
||||
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' ">
|
||||
and t.dept_no like '%'+#{departmentPO.deptNo}+'%'
|
||||
<if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
|
||||
and t.departmentCode like '%'+#{departmentPO.departmentCode}+'%'
|
||||
</if>
|
||||
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
|
||||
and t.dept_name like '%'+#{departmentPO.deptName}+'%'
|
||||
<if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
|
||||
and t.departmentName like '%'+#{departmentPO.departmentName}+'%'
|
||||
</if>
|
||||
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' ">
|
||||
and t.dept_name_short like '%'+#{departmentPO.deptNameShort}+'%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="nullSql">
|
||||
and ifnull(parent_dept,'0')='0'
|
||||
</sql>
|
||||
|
||||
<sql id="nullSql" databaseId="sqlserver">
|
||||
and isnull(parent_dept,'0')='0'
|
||||
</sql>
|
||||
|
||||
<sql id="nullSql" databaseId="oracle">
|
||||
and NVL(parent_dept,'0')='0'
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -31,7 +31,7 @@ public interface SystemDataMapper {
|
|||
|
||||
RecordInfo getHrmJobTitleByName(@Param("name") String name);
|
||||
|
||||
List<Long> getHrmResourceIds(@Param("departmentId") Long departmentId, @Param("jobTitle") String jobTitle);
|
||||
List<Long> getHrmResourceIds(@Param("departmentId") Integer departmentId, @Param("jobTitle") String jobTitle);
|
||||
|
||||
List<Long> getHrmResourceIdsByDept(@Param("departmentId") String departmentId);
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public interface JobMapper {
|
|||
* @param ecDepartment
|
||||
* @return
|
||||
*/
|
||||
Integer countRepeatNameByPid(@Param("jobName") String jobName, @Param("id") Long id, @Param("parentJob") Long parentJob, @Param("ecDepartment") Long ecDepartment);
|
||||
Integer countRepeatNameByPid(@Param("jobName") String jobName, @Param("id") Long id, @Param("parentJob") Long parentJob, @Param("ecDepartment") Integer ecDepartment);
|
||||
|
||||
/**
|
||||
* 根据所属部门查询数据
|
||||
|
|
@ -163,7 +163,7 @@ public interface JobMapper {
|
|||
* @param parentJob
|
||||
* @return
|
||||
*/
|
||||
Long getIdByNameAndPid(@Param("jobName") String jobName, @Param("parentCompany") Long parentCompany, @Param("parentDepartment") Long parentDepartment, @Param("parentJob") Long parentJob);
|
||||
Long getIdByNameAndPid(@Param("jobName") String jobName, @Param("parentCompany") Integer parentCompany, @Param("parentDepartment") Integer parentDepartment, @Param("parentJob") Long parentJob);
|
||||
|
||||
Long getIdByNameAndEcId(@Param("jobName") String jobName, @Param("ecCompany") String ecCompany, @Param("ecDepartment") String ecDepartment);
|
||||
|
||||
|
|
@ -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") Integer ecCompany);
|
||||
|
||||
int isHasResource(@Param("jobId") Long jobId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -367,16 +367,16 @@
|
|||
<select id="listByFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO"
|
||||
parameterType="com.engine.organization.entity.job.po.JobPO">
|
||||
SELECT
|
||||
a.comp_name ,
|
||||
b.dept_name ,
|
||||
a.subcompanyname ,
|
||||
b.departmentname ,
|
||||
c.sequence_name,
|
||||
d.scheme_name,
|
||||
<include refid="baseColumns"/>
|
||||
FROM jcl_org_job t
|
||||
left join jcl_org_comp a on
|
||||
t.parent_comp = a.id
|
||||
left join jcl_org_dept b on
|
||||
t.parent_dept = b.id
|
||||
left join hrmsubcompany a on
|
||||
t.ec_company = a.id
|
||||
left join hrmdepartment b on
|
||||
t.ec_department = b.id
|
||||
left join jcl_org_sequence c on
|
||||
t.sequence_id = c.id
|
||||
left join jcl_org_scheme d on
|
||||
|
|
@ -415,16 +415,16 @@
|
|||
|
||||
<select id="listNoFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO">
|
||||
SELECT
|
||||
a.comp_name ,
|
||||
b.dept_name ,
|
||||
a.subcompanyname ,
|
||||
b.departmentname ,
|
||||
c.sequence_name,
|
||||
d.scheme_name,
|
||||
<include refid="baseColumns"/>
|
||||
FROM jcl_org_job t
|
||||
left join jcl_org_comp a on
|
||||
t.parent_comp = a.id
|
||||
left join jcl_org_dept b on
|
||||
t.parent_dept = b.id
|
||||
left join hrmsubcompany a on
|
||||
t.ec_company = a.id
|
||||
left join hrmdepartment b on
|
||||
t.ec_department = b.id
|
||||
left join jcl_org_sequence c on
|
||||
t.sequence_id = c.id
|
||||
left join jcl_org_scheme d on
|
||||
|
|
|
|||
|
|
@ -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") Integer parentDept, @Param("ecCompany") Integer ecCompany, @Param("ecDepartment") Integer ecDepartment);
|
||||
|
||||
HrmResourcePO getResourceById(@Param("id") String id);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@
|
|||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t.id,t.work_code,t.last_name,t.sex,t.status,t.account_type,
|
||||
t
|
||||
.
|
||||
id
|
||||
,t.work_code,t.last_name,t.sex,t.status,t.account_type,
|
||||
t.belong_to,t.ec_company,t.job_title,t.ec_department,t.
|
||||
scheme_id,t.sequence_id,t.job_grade,t.job_level,t.job_group_id,
|
||||
t.job_activity,t.location_id,t.show_order,t.company_start_date,
|
||||
|
|
@ -53,11 +56,11 @@
|
|||
</update>
|
||||
|
||||
<select id="listAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
|
||||
SELECT t.last_name as lastName,d.dept_name as departmentName,
|
||||
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName
|
||||
SELECT t.last_name as lastName,d.departmentname as departmentName,
|
||||
c.subcompanyname as companyName,t.mobile,t.telephone,t1.last_name as managerName
|
||||
from jcl_org_hrmresource t
|
||||
left join JCL_ORG_DEPT d on t.department_id = d.id
|
||||
left join jcl_org_comp c on t.company_id = c.id
|
||||
left join hrmdepartment d on t.ec_department = d.id
|
||||
left join hrmsubcompany c on t.ec_eompany = c.id
|
||||
left join jcl_org_hrmresource t1 on t.manager_id = t1.id
|
||||
where 1 = 1
|
||||
<if test="ids != null and ids.size > 0">
|
||||
|
|
@ -108,11 +111,11 @@
|
|||
from jcl_org_hrmresource t where delete_type = 0 and work_code = #{workCode}
|
||||
</select>
|
||||
<select id="listDetachAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
|
||||
SELECT t.last_name as lastName,d.dept_name as departmentName,
|
||||
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName
|
||||
SELECT t.last_name as lastName,d.departmentname as departmentName,
|
||||
c.subcompanyname as companyName,t.mobile,t.telephone,t1.last_name as managerName
|
||||
from jcl_org_hrmresource t
|
||||
left join JCL_ORG_DEPT d on t.department_id = d.id
|
||||
left join jcl_org_comp c on t.company_id = c.id
|
||||
left join hrmdepartment d on t.ec_department = d.id
|
||||
left join hrmsubcompany c on t.ec_company = c.id
|
||||
left join jcl_org_hrmresource t1 on t.manager_id = t1.id
|
||||
where 1 = 1
|
||||
<if test="ids != null and ids.size > 0">
|
||||
|
|
|
|||
|
|
@ -12,6 +12,4 @@ import java.sql.Date;
|
|||
**/
|
||||
public interface JobTriggerMapper {
|
||||
Integer sumStaffNum(@Param("fdatebegin") Date fdatebegin, @Param("jobId") Integer jobId);
|
||||
|
||||
Integer countHrmResource(@Param("parentdept") Integer parentdept, @Param("fname") String fname);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,4 @@
|
|||
and time_end >= #{fdatebegin})
|
||||
and job_id = #{jobId}
|
||||
</select>
|
||||
<select id="countHrmResource" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from hrmresource
|
||||
where status <= 3
|
||||
and departmentid =
|
||||
(select id from hrmdepartment where uuid = (select uuid from JCL_ORG_DEPT where id = #{parentdept}))
|
||||
and jobtitle in (select id from hrmjobtitles where JOBTITLENAME = #{fname})
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
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.company.param.CompParam;
|
||||
import com.engine.organization.entity.department.param.DepartmentMoveParam;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
|
||||
|
|
@ -23,7 +22,7 @@ public interface CompService {
|
|||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> listPage(CompanyParam params);
|
||||
Map<String, Object> listPage(CompParam params);
|
||||
|
||||
/**
|
||||
* 保存公司/分部基础信息
|
||||
|
|
@ -38,7 +37,7 @@ public interface CompService {
|
|||
*
|
||||
* @param params
|
||||
*/
|
||||
int updateForbiddenTagById(CompSearchParam params);
|
||||
int updateForbiddenTagById(CompParam params);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -72,7 +71,7 @@ public interface CompService {
|
|||
Map<String, List<MenuBtn>> getHasRight();
|
||||
|
||||
/**
|
||||
* 获取基本信息表单
|
||||
* 获取编辑表单
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import com.engine.organization.entity.searchtree.SearchTreeParams;
|
|||
import com.engine.organization.util.MenuBtn;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -81,9 +80,9 @@ public interface DepartmentService {
|
|||
/**
|
||||
* 根据ID批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @param params
|
||||
*/
|
||||
int deleteByIds(Collection<Long> ids);
|
||||
Map<String, Object> deleteByIds(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 获取搜索条件
|
||||
|
|
@ -114,7 +113,7 @@ public interface DepartmentService {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getSaveForm(DeptSearchParam param);
|
||||
Map<String, Object> getSaveForm(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 复制表单
|
||||
|
|
@ -136,7 +135,7 @@ public interface DepartmentService {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
List<SearchConditionGroup> getMergeForm(Long id);
|
||||
List<SearchConditionGroup> getMergeForm();
|
||||
|
||||
/**
|
||||
* 合并到指定部门
|
||||
|
|
|
|||
|
|
@ -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,29 @@ 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.bo.CompBO;
|
||||
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.param.CompParam;
|
||||
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.exception.OrganizationRunTimeException;
|
||||
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;
|
||||
|
|
@ -90,10 +81,6 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
*/
|
||||
private static final Long GROUP_ID = 1L;
|
||||
|
||||
private static CompanyMapper getCompanyMapper() {
|
||||
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
||||
}
|
||||
|
||||
private static CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
|
@ -102,47 +89,43 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
|
||||
}
|
||||
|
||||
private SystemDataMapper getSystemDataMapper() {
|
||||
return MapperProxyFactory.getProxy(SystemDataMapper.class);
|
||||
}
|
||||
|
||||
private ExtService getExtService(User user) {
|
||||
return ServiceUtil.getService(ExtServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(CompanyParam params) {
|
||||
public Map<String, Object> listPage(CompParam params) {
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
|
||||
datas.put("hasRight", hasRight);
|
||||
if (!hasRight) {
|
||||
return datas;
|
||||
}
|
||||
CompanyPO companyPO = CompanyBO.convertParamToPO(params, user.getUID());
|
||||
CompPO companyPO = CompBO.convertParamToPO(params, user.getUID());
|
||||
boolean filter = isFilter(companyPO);
|
||||
PageInfo<CompanyListDTO> pageInfos;
|
||||
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams());
|
||||
List<CompanyPO> allList = getCompanyMapper().listAll(orderSql);
|
||||
PageInfo<CompListDTO> pageInfos;
|
||||
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams()," showorder ");
|
||||
List<CompPO> allList = getCompMapper().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);
|
||||
List<CompPO> filterCompPOs = getCompMapper().listByFilter(companyPO, orderSql);
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs);
|
||||
|
||||
// 添加父级元素
|
||||
List<CompanyListDTO> compListDTOS = CompanyBO.buildCompDTOList(allList, filterCompPOs);
|
||||
List<CompanyListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
||||
pageInfos = new PageInfo<>(subList, CompanyListDTO.class);
|
||||
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(allList, filterCompPOs);
|
||||
List<CompListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
||||
pageInfos = new PageInfo<>(subList, CompListDTO.class);
|
||||
pageInfos.setTotal(compListDTOS.size());
|
||||
} else {
|
||||
// 组合list
|
||||
List<CompanyListDTO> compListDTOS = CompanyBO.buildCompDTOList(allList);
|
||||
List<CompanyListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
||||
pageInfos = new PageInfo<>(subList, CompanyListDTO.class);
|
||||
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(allList);
|
||||
List<CompListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
||||
pageInfos = new PageInfo<>(subList, CompListDTO.class);
|
||||
pageInfos.setTotal(compListDTOS.size());
|
||||
}
|
||||
|
||||
|
|
@ -173,49 +156,22 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int updateForbiddenTagById(CompSearchParam params) {
|
||||
public int updateForbiddenTagById(CompParam params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
CompPO compPO = CompPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build();
|
||||
CompPO compPO = CompPO.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
|
||||
|
|
@ -308,9 +264,9 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
String addType = Util.null2String(params.get("addType"));
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
String supsubcomid = "";
|
||||
if (addType.equals("sibling")) {
|
||||
if ("sibling".equals(addType)) {
|
||||
supsubcomid = subCompanyComInfo.getSupsubcomid(id);
|
||||
} else if (addType.equals("child")) {
|
||||
} else if ("child".equals(addType)) {
|
||||
supsubcomid = id;
|
||||
}
|
||||
if (StringUtils.isNotBlank(addType)) {
|
||||
|
|
@ -326,7 +282,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
try {
|
||||
hfm = new HrmDeptFieldManagerE9(4);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("");
|
||||
throw new OrganizationRunTimeException("");
|
||||
}
|
||||
hfm.isReturnDecryptData(true);
|
||||
hfm.getCustomData(Util.getIntValue(id));
|
||||
|
|
@ -335,7 +291,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
String groupId = (String) lsGroup.get(tmp);
|
||||
List lsField = hfm.getLsField(groupId);
|
||||
|
||||
boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)).equals("1");
|
||||
boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !"1".equals(Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)));
|
||||
String groupLabel = HrmFieldGroupComInfo.getLabel(groupId);
|
||||
List<Object> itemList = new ArrayList<>();
|
||||
Map<String, Object> groupItem = new HashMap<>();
|
||||
|
|
@ -346,7 +302,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
String fieldId = (String) lsField.get(j);
|
||||
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
|
||||
String isUse = HrmFieldComInfo.getIsused(fieldId);
|
||||
if (!isUse.equals("1")) {
|
||||
if (!"1".equals(isUse)) {
|
||||
continue;
|
||||
}
|
||||
int tmpViewAttr = viewAttr;
|
||||
|
|
@ -358,14 +314,14 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
String fieldValue = "";
|
||||
if (StringUtils.isNotBlank(addType)) {
|
||||
} else {
|
||||
if (HrmFieldComInfo.getIssystem(fieldId).equals("1")) {
|
||||
if ("1".equals(HrmFieldComInfo.getIssystem(fieldId))) {
|
||||
fieldValue = hfm.getData(fieldName);
|
||||
} else {
|
||||
fieldValue = hfm.getData("hrmsubcompanydefined", fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!groupHide && tmpViewAttr == 2 && HrmFieldComInfo.getIsmand(fieldId).equals("1")) {
|
||||
if (!groupHide && tmpViewAttr == 2 && "1".equals(HrmFieldComInfo.getIsmand(fieldId))) {
|
||||
tmpViewAttr = 3;
|
||||
if ("1".equals(fieldHtmlType) && "2".equals(type)) {
|
||||
rules = "required|integer";
|
||||
|
|
@ -375,15 +331,16 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
}
|
||||
|
||||
if ("84".equals(fieldId)) {
|
||||
if (user.getUID() != 1)
|
||||
if (user.getUID() != 1) {
|
||||
continue;
|
||||
fieldValue = fieldValue.equals("0") ? "" : fieldValue;
|
||||
}
|
||||
fieldValue = "0".equals(fieldValue) ? "" : fieldValue;
|
||||
}
|
||||
if (supsubcomid.length() > 0 && fieldName.equals("supsubcomid")) {
|
||||
if (supsubcomid.length() > 0 && "supsubcomid".equals(fieldName)) {
|
||||
fieldValue = supsubcomid;
|
||||
}
|
||||
|
||||
if (fieldName.equals("subshowid")) {
|
||||
if ("subshowid".equals(fieldName)) {
|
||||
if (StringUtils.isNotBlank(addType)) {
|
||||
continue;
|
||||
} else {
|
||||
|
|
@ -404,20 +361,20 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
hrmFieldBean.setViewAttr(tmpViewAttr);
|
||||
hrmFieldBean.setRules(rules);
|
||||
hrmFieldBean.setIssystem("1");
|
||||
if (hrmFieldBean.getFieldname().equals("supsubcomid")) {
|
||||
if ("supsubcomid".equals(hrmFieldBean.getFieldname())) {
|
||||
hrmFieldBean.setHideVirtualOrg(true);
|
||||
}
|
||||
if (hrmFieldBean.getFieldname().equals("subcompanycode")) {
|
||||
if ("subcompanycode".equals(hrmFieldBean.getFieldname())) {
|
||||
hrmFieldBean.setMultilang(false);
|
||||
}
|
||||
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
if (searchConditionItem != null) {
|
||||
searchConditionItem.setLabelcol(8);
|
||||
searchConditionItem.setFieldcol(16);
|
||||
if (hrmFieldBean.getFieldname().equals("showorder")) {
|
||||
if ("showorder".equals(hrmFieldBean.getFieldname())) {
|
||||
searchConditionItem.setPrecision(2);
|
||||
}
|
||||
if (fieldName.equals("subshowid")) {
|
||||
if ("subshowid".equals(fieldName)) {
|
||||
Map<String, Object> otherParams = new HashMap<>();
|
||||
otherParams.put("hasBorder", true);
|
||||
searchConditionItem.setOtherParams(otherParams);
|
||||
|
|
@ -453,12 +410,12 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
|
||||
@Override
|
||||
public int moveCompany(DepartmentMoveParam moveParam) {
|
||||
Integer companyId = moveParam.getId().intValue();
|
||||
Integer targetCompanyId = moveParam.getCompany().intValue();
|
||||
Integer companyId = moveParam.getId();
|
||||
Integer targetCompanyId = moveParam.getCompany();
|
||||
// 判断目标分部是否为它本身以及子元素
|
||||
Set<Integer> disableIds = new HashSet<>();
|
||||
disableIds.add(companyId);
|
||||
List<CompanyPO> compPOS = getCompanyMapper().listChild(DeleteParam.builder().ids(companyId.toString()).build().getIds());
|
||||
List<CompPO> compPOS = getCompMapper().listChild(DeleteParam.builder().ids(companyId.toString()).build().getIds());
|
||||
if (CollectionUtils.isNotEmpty(compPOS)) {
|
||||
addDisableIds(disableIds, compPOS);
|
||||
}
|
||||
|
|
@ -478,7 +435,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
* @param companyPO
|
||||
* @return
|
||||
*/
|
||||
private boolean isFilter(CompanyPO companyPO) {
|
||||
private boolean isFilter(CompPO companyPO) {
|
||||
return StringUtils.isNotBlank(companyPO.getSubCompanyCode()) || StringUtils.isNotBlank(companyPO.getSubCompanyDesc()) || StringUtils.isNotBlank(companyPO.getSubCompanyName()) || null != companyPO.getSupSubComId();
|
||||
}
|
||||
|
||||
|
|
@ -489,31 +446,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
|
||||
|
|
@ -521,10 +479,10 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
* @param disableIds
|
||||
* @param compPOS
|
||||
*/
|
||||
private void addDisableIds(Set<Integer> disableIds, List<CompanyPO> compPOS) {
|
||||
for (CompanyPO compPO : compPOS) {
|
||||
private void addDisableIds(Set<Integer> disableIds, List<CompPO> compPOS) {
|
||||
for (CompPO compPO : compPOS) {
|
||||
disableIds.add(compPO.getId());
|
||||
List<CompanyPO> childCompPOS = getCompanyMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
|
||||
List<CompPO> childCompPOS = getCompMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
|
||||
addDisableIds(disableIds, childCompPOS);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
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;
|
||||
import com.api.hrm.bean.HrmFieldBean;
|
||||
import com.api.hrm.util.HrmFieldSearchConditionComInfo;
|
||||
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.commom.RecordInfo;
|
||||
import com.engine.organization.entity.company.bo.CompBO;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.bo.DepartmentBO;
|
||||
|
|
@ -24,25 +24,18 @@ import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
|||
import com.engine.organization.entity.job.bo.JobBO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.job.vo.SingleJobTreeVO;
|
||||
import com.engine.organization.entity.map.JclOrgMap;
|
||||
import com.engine.organization.entity.searchtree.SearchTree;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.exception.OrganizationRunTimeException;
|
||||
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtDTMapper;
|
||||
import com.engine.organization.mapper.extend.ExtMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.service.DepartmentService;
|
||||
import com.engine.organization.service.ExtService;
|
||||
import com.engine.organization.thread.DepartmentTriggerRunnable;
|
||||
import com.engine.organization.thread.HrmResourceTriggerRunnable;
|
||||
import com.engine.organization.thread.JobTriggerRunnable;
|
||||
import com.engine.organization.thread.OrganizationSyncEc;
|
||||
import com.engine.organization.util.*;
|
||||
|
|
@ -52,7 +45,6 @@ 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 com.engine.organization.util.tree.SearchTreeUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -61,6 +53,11 @@ import weaver.conn.RecordSet;
|
|||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.definedfield.HrmDeptFieldManagerE9;
|
||||
import weaver.hrm.definedfield.HrmFieldComInfo;
|
||||
import weaver.hrm.definedfield.HrmFieldGroupComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -100,8 +97,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
*/
|
||||
private static final Long GROUP_ID = 2L;
|
||||
|
||||
private static final String HRM_DEPARTMENT = "hrmdepartment";
|
||||
|
||||
|
||||
private static DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
|
|
@ -119,10 +114,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
|
||||
}
|
||||
|
||||
private SystemDataMapper getSystemDataMapper() {
|
||||
return MapperProxyFactory.getProxy(SystemDataMapper.class);
|
||||
}
|
||||
|
||||
private ExtService getExtService(User user) {
|
||||
return ServiceUtil.getService(ExtServiceImpl.class, user);
|
||||
}
|
||||
|
|
@ -132,7 +123,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
|
||||
//1.查询分部下所有部门
|
||||
//PageUtil.start(param.getCurrent(), param.getPageSize());
|
||||
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).list("show_order");
|
||||
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).listAll("showOrder");
|
||||
PageInfo<DepartmentPO> pageInfo = new PageInfo<>(departmentPOS);
|
||||
List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS, param.getParentComp());
|
||||
PageInfo<SingleDeptTreeVO> pageInfos = new PageInfo<>(singleDeptTreeVOS, SingleDeptTreeVO.class);
|
||||
|
|
@ -176,8 +167,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(param, user.getUID());
|
||||
boolean filter = isFilter(departmentPO);
|
||||
PageInfo<DepartmentListDTO> pageInfos;
|
||||
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams());
|
||||
List<DepartmentPO> allList = getDepartmentMapper().list(orderSql);
|
||||
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams()," showorder ");
|
||||
List<DepartmentPO> allList = getDepartmentMapper().listAll(orderSql);
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(allList);
|
||||
// 通过子级遍历父级元素
|
||||
if (filter) {
|
||||
|
|
@ -218,137 +209,35 @@ 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);
|
||||
return Long.parseLong(ecCompanyID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateForbiddenTagById(DeptSearchParam params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
DepartmentPO departmentPO = DepartmentPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build();
|
||||
|
||||
if (!params.getForbiddenTag()) {
|
||||
// 判断当前岗位下是否有启用岗位,如有启用岗位,部门无法禁用
|
||||
int countUsedInJob = getDepartmentMapper().countUsedInJob(params.getId());
|
||||
OrganizationAssert.isTrue(countUsedInJob == 0, "部门存在下级岗位,不能封存");
|
||||
}
|
||||
|
||||
DepartmentPO departmentPO = DepartmentPO.builder().id(params.getId()).canceled(params.getCanceled() ? 0 : 1).build();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", departmentPO.getId());
|
||||
map.put("forbiddenTag", departmentPO.getForbiddenTag());
|
||||
map.put("forbiddenTag", departmentPO.getCanceled());
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync();
|
||||
return getDepartmentMapper().updateForbiddenTagById(departmentPO);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@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();
|
||||
String ecCompanyId = Util.null2String(params.get("id"));
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, params).sync();
|
||||
return Long.parseLong(ecCompanyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByIds(Collection<Long> ids) {
|
||||
public Map<String, Object> deleteByIds(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
for (Long id : ids) {
|
||||
map.put("id", id);
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync();
|
||||
// 删除拓展表、明细表
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).deleteByID("jcl_org_deptext", id);
|
||||
MapperProxyFactory.getProxy(ExtDTMapper.class).deleteByMainID("jcl_org_deptext_dt1", id, null);
|
||||
}
|
||||
|
||||
return getDepartmentMapper().deleteByIds(ids);
|
||||
return ServiceUtil.getService(OrganizationServiceImpl.class, user).delDepartment(params, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -357,35 +246,18 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
// 编号
|
||||
SearchConditionItem deptNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "编号", "deptNo");
|
||||
SearchConditionItem departmentCodeItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "编号", "departmentCode");
|
||||
// 名称
|
||||
SearchConditionItem deptNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "departmentName");
|
||||
// 简称
|
||||
SearchConditionItem deptNameShortItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "简称", "deptNameShort");
|
||||
SearchConditionItem departmentNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "departmentName");
|
||||
// 所属分部
|
||||
SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "164", "ecCompany", "");
|
||||
SearchConditionItem subCompanyId1Item = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "164", "subCompanyId1", "");
|
||||
// 上级部门
|
||||
SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级部门", "4", "ecDepartment", "");
|
||||
// 部门负责人
|
||||
SearchConditionItem deptPrincipalBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门负责人", "1", "deptPrincipal", "");
|
||||
// 显示顺序
|
||||
SearchConditionItem showOrderItem = OrganizationFormItemUtil.inputNumberItem(user, 2, 16, 2, "显示顺序", "showOrder");
|
||||
// 禁用标记
|
||||
List<SearchConditionOption> selectOptions = new ArrayList<>();
|
||||
SearchConditionOption enableOption = new SearchConditionOption("true", "启用");
|
||||
SearchConditionOption disableOption = new SearchConditionOption("false", "禁用");
|
||||
selectOptions.add(enableOption);
|
||||
selectOptions.add(disableOption);
|
||||
SearchConditionItem forbiddenTagItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "禁用标记", "forbiddenTag");
|
||||
SearchConditionItem supDepIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级部门", "4", "supDepId", "");
|
||||
|
||||
conditionItems.add(deptNoItem);
|
||||
conditionItems.add(deptNameItem);
|
||||
conditionItems.add(deptNameShortItem);
|
||||
conditionItems.add(parentCompBrowserItem);
|
||||
conditionItems.add(parentDeptBrowserItem);
|
||||
conditionItems.add(deptPrincipalBrowserItem);
|
||||
conditionItems.add(showOrderItem);
|
||||
conditionItems.add(forbiddenTagItem);
|
||||
conditionItems.add(departmentCodeItem);
|
||||
conditionItems.add(departmentNameItem);
|
||||
conditionItems.add(subCompanyId1Item);
|
||||
conditionItems.add(supDepIdItem);
|
||||
|
||||
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
|
||||
apiDatas.put("conditions", addGroups);
|
||||
|
|
@ -442,39 +314,152 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSaveForm(DeptSearchParam param) {
|
||||
public Map<String, Object> getSaveForm(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID, "1");
|
||||
if (CollectionUtils.isNotEmpty(extendTitles)) {
|
||||
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()));
|
||||
List<Map<String, Object>> groupList = new ArrayList<>();
|
||||
Map<String, Object> groupItem;
|
||||
List<Object> itemList;
|
||||
|
||||
String id = Util.null2String(params.get("id"));
|
||||
int viewAttr = Util.getIntValue(Util.null2String(params.get("viewattr")), 1);
|
||||
String nodeType = Util.null2String(params.get("type"));
|
||||
String addType = Util.null2String(params.get("addType"));
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
String subcompanyid1 = "";
|
||||
String supDepId = "";
|
||||
|
||||
switch (addType) {
|
||||
case "normal":
|
||||
if (nodeType.equals("subcompany")) {
|
||||
subcompanyid1 = id;
|
||||
} else {
|
||||
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
if (StringUtils.isNotBlank(Util.null2String(param.getDepartmentid()))) {
|
||||
DepartmentPO deptById = getDepartmentMapper().getDeptById(param.getDepartmentid());
|
||||
if (null != deptById) {
|
||||
params.put("parent_dept", deptById.getId());
|
||||
params.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString()));
|
||||
params.put("parent_comp", deptById.getParentComp());
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(deptById.getParentComp().toString()));
|
||||
}
|
||||
}
|
||||
for (ExtendTitlePO extendTitle : extendTitles) {
|
||||
List<SearchConditionItem> items = getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_DEPT, 2, extendTitle.getId().toString(), "dept_no", RuleCodeType.DEPARTMENT.getValue(), params);
|
||||
if (CollectionUtils.isNotEmpty(items)) {
|
||||
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "sibling":
|
||||
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
|
||||
supDepId = departmentComInfo.getDepartmentsupdepid(id);
|
||||
break;
|
||||
case "child":
|
||||
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
|
||||
supDepId = id;
|
||||
break;
|
||||
}
|
||||
apiDatas.put("condition", addGroups);
|
||||
|
||||
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
|
||||
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
|
||||
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
|
||||
SearchConditionItem searchConditionItem;
|
||||
HrmFieldBean hrmFieldBean;
|
||||
HrmDeptFieldManagerE9 hfm;
|
||||
try {
|
||||
hfm = new HrmDeptFieldManagerE9(5);
|
||||
} catch (Exception e) {
|
||||
throw new OrganizationRunTimeException("");
|
||||
}
|
||||
hfm.isReturnDecryptData(true);
|
||||
hfm.getCustomData(Util.getIntValue(id));
|
||||
List lsGroup = hfm.getLsGroup();
|
||||
for (int tmp = 0; lsGroup != null && tmp < lsGroup.size(); tmp++) {
|
||||
String groupid = (String) lsGroup.get(tmp);
|
||||
List lsField = hfm.getLsField(groupid);
|
||||
|
||||
boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !Util.null2String(HrmFieldGroupComInfo.getIsShow(groupid)).equals("1");
|
||||
String grouplabel = HrmFieldGroupComInfo.getLabel(groupid);
|
||||
itemList = new ArrayList<>();
|
||||
groupItem = new HashMap<>();
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelNames(grouplabel, user.getLanguage()));
|
||||
groupItem.put("hide", groupHide);
|
||||
groupItem.put("defaultshow", true);
|
||||
for (Object o : lsField) {
|
||||
String fieldId = (String) o;
|
||||
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
|
||||
String isUse = HrmFieldComInfo.getIsused(fieldId);
|
||||
if (!isUse.equals("1")) continue;
|
||||
int tmpViewAttr = viewAttr;
|
||||
String rules = "";
|
||||
String fieldLabel = HrmFieldComInfo.getLabel(fieldId);
|
||||
String fieldHtmlType = HrmFieldComInfo.getFieldhtmltype(fieldId);
|
||||
String type = HrmFieldComInfo.getFieldType(fieldId);
|
||||
String dmlUrl = Util.null2String(HrmFieldComInfo.getFieldDmlurl(fieldId));
|
||||
String fieldValue = "";
|
||||
if (StringUtils.isBlank(addType)) {
|
||||
if (HrmFieldComInfo.getIssystem(fieldId).equals("1")) {
|
||||
fieldValue = hfm.getData(fieldName);
|
||||
} else {
|
||||
fieldValue = hfm.getData("hrmdepartmentdefined", fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!groupHide && tmpViewAttr == 2 && HrmFieldComInfo.getIsmand(fieldId).equals("1")) {
|
||||
tmpViewAttr = 3;
|
||||
if ("1".equals(fieldHtmlType) && "2".equals(type)) {
|
||||
rules = "required|integer";
|
||||
} else {
|
||||
rules = "required|string";
|
||||
}
|
||||
}
|
||||
|
||||
if (subcompanyid1.length() > 0 && fieldName.equals("subcompanyid1")) {
|
||||
fieldValue = subcompanyid1;
|
||||
}
|
||||
|
||||
if (supDepId.length() > 0 && fieldName.equals("supdepid")) {
|
||||
fieldValue = supDepId;
|
||||
}
|
||||
|
||||
if (fieldName.equals("showid")) {
|
||||
if (addType.length() > 0) {
|
||||
continue;
|
||||
} else {
|
||||
fieldValue = id;
|
||||
tmpViewAttr = 1;
|
||||
}
|
||||
}
|
||||
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldid(fieldId);
|
||||
hrmFieldBean.setFieldname(fieldName);
|
||||
hrmFieldBean.setFieldlabel(fieldLabel);
|
||||
hrmFieldBean.setFieldhtmltype(fieldHtmlType);
|
||||
hrmFieldBean.setType(type);
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
hrmFieldBean.setIssystem("1");
|
||||
hrmFieldBean.setFieldvalue(fieldValue);
|
||||
hrmFieldBean.setDmlurl(dmlUrl);
|
||||
hrmFieldBean.setViewAttr(tmpViewAttr);
|
||||
hrmFieldBean.setRules(rules);
|
||||
if (hrmFieldBean.getFieldname().equals("subcompanyid1") || hrmFieldBean.getFieldname().equals("supdepid")) {
|
||||
hrmFieldBean.setHideVirtualOrg(true);
|
||||
}
|
||||
if (hrmFieldBean.getFieldname().equals("departmentcode")) {
|
||||
hrmFieldBean.setMultilang(false);
|
||||
}
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
if (searchConditionItem != null) {
|
||||
searchConditionItem.setLabelcol(8);
|
||||
searchConditionItem.setFieldcol(16);
|
||||
if (fieldName.equals("showorder")) {
|
||||
searchConditionItem.setPrecision(2);
|
||||
}
|
||||
if (fieldName.equals("showid")) {
|
||||
Map<String, Object> otherParams = new HashMap<>();
|
||||
otherParams.put("hasBorder", true);
|
||||
searchConditionItem.setOtherParams(otherParams);
|
||||
}
|
||||
if ("6".equals(fieldHtmlType)) {//附件
|
||||
Map<String, Object> otherParams1 = new HashMap<>();
|
||||
otherParams1.put("showOrder", false);
|
||||
searchConditionItem.setOtherParams(otherParams1);
|
||||
}
|
||||
itemList.add(searchConditionItem);
|
||||
}
|
||||
}
|
||||
groupItem.put("items", itemList);
|
||||
groupList.add(groupItem);
|
||||
}
|
||||
apiDatas.put("condition", groupList);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
|
|
@ -516,45 +501,35 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
OrganizationAssert.notBlank(copyParam.getCompany(), "请指定需要复制的公司/分部");
|
||||
int insertCount = 0;
|
||||
// 需复制的部门
|
||||
List<Long> idList = Arrays.stream(copyParam.getIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
Integer maxShowOrder = getDepartmentMapper().getMaxShowOrder();
|
||||
List<Integer> idList = Arrays.stream(copyParam.getIds().split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||
Double maxShowOrder = getDepartmentMapper().getMaxShowOrder();
|
||||
maxShowOrder = null == maxShowOrder ? 0 : maxShowOrder;
|
||||
for (Long departmentId : idList) {
|
||||
for (Integer 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(Integer originalDeptId, Integer parentDepartmentId, Integer companyId, Double 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.setDepartmentCode(null);
|
||||
// 设置上级分部
|
||||
deptById.setParentComp(EcHrmRelationUtil.getJclCompanyId(Util.null2String(companyId)).getId());
|
||||
deptById.setEcCompany(companyId);
|
||||
deptById.setParentDept(parentDepartmentId);
|
||||
if (null != parentDepartmentId) {
|
||||
deptById.setEcDepartment(Long.parseLong(EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId))));
|
||||
}
|
||||
deptById.setSubCompanyId1(companyId);
|
||||
deptById.setSupDepId(parentDepartmentId);
|
||||
// 显示顺序字段
|
||||
deptById.setShowOrder(++maxShowOrder);
|
||||
deptById.setCreator((long) user.getUID());
|
||||
deptById.setCreateTime(new Date());
|
||||
deptById.setDeptPrincipal(null);
|
||||
deptById.setUuid(null);
|
||||
|
||||
// 新增EC表部门
|
||||
Map<String, Object> syncMap = addEcDepartment(deptById);
|
||||
String ecDepartmentID = Util.null2String(syncMap.get("id"));
|
||||
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecDepartmentID), syncMap.get("message").toString());
|
||||
// 查询UUID
|
||||
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_DEPARTMENT, ecDepartmentID);
|
||||
deptById.setUuid(recordInfo.getUuid());
|
||||
getDepartmentMapper().insertIgnoreNull(deptById);
|
||||
// 更新组织架构图
|
||||
new DepartmentTriggerRunnable(deptById.getId()).run();
|
||||
//TODO new DepartmentTriggerRunnable(deptById.getId()).run();
|
||||
|
||||
// 复制当前部门岗位信息
|
||||
if ("1".equals(copyJob)) {
|
||||
|
|
@ -564,7 +539,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
if (maxJobOrder == null) {
|
||||
maxJobOrder = 0;
|
||||
}
|
||||
recursionCopyJob(jobPOS, companyId, deptById.getId(), null, maxJobOrder, timeMillis);
|
||||
recursionCopyJob(jobPOS, companyId, Integer.parseInt(ecDepartmentID), null, maxJobOrder, timeMillis);
|
||||
}
|
||||
|
||||
// 是否复制子部门信息
|
||||
|
|
@ -573,13 +548,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(originalDeptId);
|
||||
for (DepartmentPO departmentPO : deptListByPId) {
|
||||
// 复制子部门信息、子部门岗位信息
|
||||
recursionCopyDept(departmentPO.getId(), deptById.getId(), companyId, maxShowOrder, copySubJob, copySubDept, copySubJob);
|
||||
recursionCopyDept(departmentPO.getId(), Integer.parseInt(ecDepartmentID), companyId, maxShowOrder, copySubJob, copySubDept, copySubJob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SearchConditionGroup> getMergeForm(Long id) {
|
||||
public List<SearchConditionGroup> getMergeForm() {
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionItem> condition = new ArrayList<>();
|
||||
SearchConditionItem deptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "合并到部门", "4", "department", "");
|
||||
|
|
@ -597,19 +572,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
public int mergeDepartment(DepartmentMergeParam mergeParam) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
// 被合并部门
|
||||
Long ecParamDepartment = mergeParam.getDepartment();
|
||||
DepartmentPO targetDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecParamDepartment));
|
||||
// map表中合并部门parentID
|
||||
Long oldParamDepartment = mergeParam.getId();
|
||||
DepartmentPO oldDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(oldParamDepartment));
|
||||
Integer oldFParentId = null;
|
||||
if (null != oldDepartment) {
|
||||
java.sql.Date currentDate = new java.sql.Date(OrganizationDateUtil.stringToDate(OrganizationDateUtil.getFormatLocalDate(new Date())).getTime());
|
||||
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, ModuleTypeEnum.departmentfielddefined.getValue().toString(), oldDepartment.getId().toString());
|
||||
if (null != jclOrgMap) {
|
||||
oldFParentId = jclOrgMap.getFParentId();
|
||||
}
|
||||
}
|
||||
Integer ecParamDepartment = mergeParam.getDepartment();
|
||||
DepartmentPO targetDepartment = getDepartmentMapper().getDeptById(ecParamDepartment);
|
||||
|
||||
|
||||
// 断言判断
|
||||
OrganizationAssert.isFalse(null == targetDepartment, "被合并部门数据有误,暂时无法合并");
|
||||
|
|
@ -618,7 +583,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
OrganizationAssert.notBlank(mergeParam.getMergeName(), "请输入合并后的名称");
|
||||
|
||||
// 不可选择合并的数据,本身及子部门
|
||||
Set<Long> disableIds = new HashSet<>();
|
||||
Set<Integer> disableIds = new HashSet<>();
|
||||
// 添加选择部门本身
|
||||
disableIds.add(mergeParam.getId());
|
||||
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(mergeParam.getId());
|
||||
|
|
@ -631,59 +596,52 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
List<DepartmentPO> firstChildDeptList = getDepartmentMapper().getDeptListByPId(mergeParam.getId());
|
||||
// 更新所属部门、所属分部
|
||||
for (DepartmentPO departmentPO : firstChildDeptList) {
|
||||
departmentPO.setParentDept(targetDepartment.getId());
|
||||
departmentPO.setEcDepartment(ecParamDepartment);
|
||||
departmentPO.setParentComp(targetDepartment.getParentComp());
|
||||
departmentPO.setEcCompany(targetDepartment.getEcCompany());
|
||||
departmentPO.setSupDepId(targetDepartment.getId());
|
||||
departmentPO.setSubCompanyId1(targetDepartment.getSubCompanyId1());
|
||||
updateEcDepartment(departmentPO);
|
||||
getDepartmentMapper().updateBaseDept(departmentPO);
|
||||
// 更新组织架构图
|
||||
new DepartmentTriggerRunnable(departmentPO.getId()).run();
|
||||
//TODO new DepartmentTriggerRunnable(departmentPO.getId()).run();
|
||||
}
|
||||
// 查询该部门一级岗位、更新岗位所属分部、所属部门
|
||||
List<JobPO> firstChildJobList = getJobMapper().listJobsByDepartmentId(mergeParam.getId());
|
||||
firstChildJobList = firstChildJobList.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
|
||||
// 批量更新部门、所属分部
|
||||
RecordSet rs = new RecordSet();
|
||||
String targetEcDeptId = EcHrmRelationUtil.getEcDepartmentId(targetDepartment.getId().toString());
|
||||
String mergeEcDeptId = EcHrmRelationUtil.getEcDepartmentId(mergeParam.getId().toString());
|
||||
rs.executeUpdate("update jcl_org_job set parent_comp =?,ec_company =?,parent_dept =?,ec_department =? where parent_dept =?", targetDepartment.getParentComp(), targetDepartment.getEcCompany(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId());
|
||||
String targetEcDeptId = targetDepartment.getId().toString();
|
||||
String mergeEcDeptId = mergeParam.getId().toString();
|
||||
rs.executeUpdate("update jcl_org_job set parent_comp =?,ec_company =?,parent_dept =?,ec_department =? where ec_department =?", targetDepartment.getSubCompanyId1(), targetDepartment.getSubCompanyId1(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId());
|
||||
// 更新岗位组织架构图
|
||||
for (JobPO jobPO : firstChildJobList) {
|
||||
// 刷新组织架构图
|
||||
new JobTriggerRunnable(jobPO.getId()).run();
|
||||
}
|
||||
// 更新当前部门下的人员
|
||||
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(mergeParam.getId().toString());
|
||||
rs.executeUpdate("update hrmresource set SUBCOMPANYID1 =?,DEPARTMENTID =? where DEPARTMENTID =?", targetDepartment.getEcCompany(), targetEcDeptId, mergeEcDeptId);
|
||||
new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? ,department_id = ?, ec_department = ?where department_id =?", targetDepartment.getParentComp(), targetDepartment.getEcCompany(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId());
|
||||
// 更新人员组织架构图
|
||||
for (Long hrmResourceId : hrmResourceIds) {
|
||||
new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
}
|
||||
rs.executeUpdate("update hrmresource set SUBCOMPANYID1 =?,DEPARTMENTID =? where DEPARTMENTID =?", targetDepartment.getSubCompanyId1(), targetEcDeptId, mergeEcDeptId);
|
||||
//new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? ,department_id = ?, ec_department = ?where department_id =?", targetDepartment.getParentComp(), targetDepartment.getEcCompany(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId());
|
||||
//List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(mergeParam.getId().toString());
|
||||
//// 更新人员组织架构图
|
||||
//for (Long hrmResourceId : hrmResourceIds) {
|
||||
//TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
//}
|
||||
// 更新子部门下岗位的所属分部
|
||||
for (DepartmentPO departmentPO : firstChildDeptList) {
|
||||
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
|
||||
forbiddenChildTag(targetDepartment.getParentComp(), Util.null2String(targetDepartment.getEcCompany()), deptList);
|
||||
forbiddenChildTag(targetDepartment.getSubCompanyId1(), Util.null2String(targetDepartment.getSubCompanyId1()), deptList);
|
||||
}
|
||||
// 原部门删除
|
||||
DepartmentPO mergeDepartment = getDepartmentMapper().getDeptById(mergeParam.getId());
|
||||
// DepartmentPO mergeDepartment = getDepartmentMapper().getDeptById(mergeParam.getId());
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", mergeParam.getId());
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync();
|
||||
// 删除拓展表、明细表
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).deleteByID("jcl_org_deptext", mergeParam.getId());
|
||||
MapperProxyFactory.getProxy(ExtDTMapper.class).deleteByMainID("jcl_org_deptext_dt1", mergeParam.getId(), null);
|
||||
getDepartmentMapper().deleteByIds(DeleteParam.builder().ids(mergeParam.getId().toString()).build().getIds());
|
||||
map.put("id", Util.null2String(mergeParam.getId()));
|
||||
// 删除部门
|
||||
ServiceUtil.getService(OrganizationServiceImpl.class, user).delDepartment(map, user);
|
||||
// 更新组织架构图
|
||||
new DepartmentTriggerRunnable(mergeDepartment).run();
|
||||
// TODO new DepartmentTriggerRunnable(mergeDepartment).run();
|
||||
// 更新部门合并后名称
|
||||
targetDepartment.setDeptName(mergeParam.getMergeName());
|
||||
targetDepartment.setDeptNameShort(mergeParam.getMergeName());
|
||||
targetDepartment.setDepartmentName(mergeParam.getMergeName());
|
||||
targetDepartment.setDepartmentMark(mergeParam.getMergeName());
|
||||
updateEcDepartment(targetDepartment);
|
||||
getDepartmentMapper().updateBaseDept(targetDepartment);
|
||||
// 更新组织架构图
|
||||
new DepartmentTriggerRunnable(oldFParentId, targetDepartment.getId()).run();
|
||||
// TODO new DepartmentTriggerRunnable(oldFParentId, targetDepartment.getId()).run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -718,55 +676,46 @@ 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.setParentDept(null);
|
||||
deptById.setEcDepartment(null);
|
||||
deptById.setSubCompanyId1(company);
|
||||
deptById.setSupDepId(null);
|
||||
|
||||
// 更新组织架构图
|
||||
new DepartmentTriggerRunnable(company.toString(), deptById).run();
|
||||
//TODO new DepartmentTriggerRunnable(company.toString(), deptById).run();
|
||||
} else if ("1".equals(moveParam.getMoveType())) {
|
||||
Long department = moveParam.getDepartment();
|
||||
Long departmentId = Objects.requireNonNull(EcHrmRelationUtil.getJclDepartmentId(Util.null2String(department))).getId();
|
||||
Integer departmentId = moveParam.getDepartment();
|
||||
OrganizationAssert.notNull(departmentId, "请选择要转移到的部门");
|
||||
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(moveParam.getId());
|
||||
Set<Long> disableIds = new HashSet<>();
|
||||
Set<Integer> disableIds = new HashSet<>();
|
||||
disableIds.add(moveParam.getId());
|
||||
if (CollectionUtils.isNotEmpty(deptListByPId)) {
|
||||
addDisableIds(disableIds, deptListByPId);
|
||||
}
|
||||
OrganizationAssert.isFalse(disableIds.contains(departmentId), "请勿选择当前部门本身及其子部门");
|
||||
deptById.setParentDept(departmentId);
|
||||
deptById.setEcDepartment(department);
|
||||
deptById.setSupDepId(departmentId);
|
||||
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(departmentId);
|
||||
deptById.setParentComp(parentDepartment.getParentComp());
|
||||
deptById.setEcCompany(parentDepartment.getEcCompany());
|
||||
deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1());
|
||||
|
||||
// 更新组织架构图
|
||||
new DepartmentTriggerRunnable(Integer.toString(100000000 + department.intValue()), deptById).run();
|
||||
// TODO new DepartmentTriggerRunnable(Integer.toString(100000000 + department.intValue()), deptById).run();
|
||||
}
|
||||
// 更新EC部门
|
||||
updateEcDepartment(deptById);
|
||||
int updateBaseDept = getDepartmentMapper().updateBaseDept(deptById);
|
||||
|
||||
// 刷新岗位分部
|
||||
refreshJobComp(deptById.getId(), deptById.getParentComp());
|
||||
refreshJobComp(deptById.getId(), deptById.getSubCompanyId1());
|
||||
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(deptById.getId());
|
||||
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(Util.null2String(deptById.getParentComp()));
|
||||
// 更新当前部门下的人员
|
||||
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(deptById.getId().toString());
|
||||
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString());
|
||||
new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId);
|
||||
new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", deptById.getParentComp(), ecCompanyId, deptById.getId());
|
||||
// 更新人员组织架构图
|
||||
for (Long hrmResourceId : hrmResourceIds) {
|
||||
new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
}
|
||||
forbiddenChildTag(deptById.getParentComp(), ecCompanyId, deptList);
|
||||
// new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", deptById.getSubCompanyId1(), deptById.getId());
|
||||
//// 更新人员组织架构图
|
||||
//List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(deptById.getId().toString());
|
||||
//for (Long hrmResourceId : hrmResourceIds) {
|
||||
//TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
//}
|
||||
forbiddenChildTag(deptById.getSubCompanyId1(), Util.null2String(deptById.getSubCompanyId1()), deptList);
|
||||
// 递归更新下级部门、岗位
|
||||
return updateBaseDept;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -775,28 +724,26 @@ 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.setSubCompanyId1(parentComp);
|
||||
// 更新EC表部门
|
||||
updateEcDepartment(departmentPO);
|
||||
updateEcDepartment(departmentPO);
|
||||
|
||||
getDepartmentMapper().updateBaseDept(departmentPO);
|
||||
// 更新组织架构图
|
||||
new DepartmentTriggerRunnable(departmentPO.getId()).run();
|
||||
// TODO new DepartmentTriggerRunnable(departmentPO.getId()).run();
|
||||
// 刷新岗位所属分部
|
||||
refreshJobComp(departmentPO.getId(), parentComp);
|
||||
// 更新当前部门下的人员
|
||||
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(departmentPO.getId().toString());
|
||||
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(departmentPO.getId().toString());
|
||||
new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId);
|
||||
new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", parentComp, ecCompanyId, departmentPO.getId());
|
||||
// 更新人员组织架构图
|
||||
for (Long hrmResourceId : hrmResourceIds) {
|
||||
new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
}
|
||||
// String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(departmentPO.getId().toString());
|
||||
//new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId);
|
||||
//new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", parentComp, ecCompanyId, departmentPO.getId());
|
||||
//List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(departmentPO.getId().toString());
|
||||
//// 更新人员组织架构图
|
||||
//for (Long hrmResourceId : hrmResourceIds) {
|
||||
//TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
|
||||
//}
|
||||
List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
|
||||
forbiddenChildTag(parentComp, ecCompanyId, childList);
|
||||
}
|
||||
|
|
@ -810,16 +757,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
* @return
|
||||
*/
|
||||
private boolean isFilter(DepartmentPO departmentPO) {
|
||||
return !(StringUtil.isEmpty(departmentPO.getDeptNo())
|
||||
&& StringUtil.isEmpty(departmentPO.getDeptName())
|
||||
&& StringUtil.isEmpty(departmentPO.getDeptNameShort())
|
||||
&& null == departmentPO.getEcCompany()
|
||||
&& null == departmentPO.getEcDepartment()
|
||||
&& null == departmentPO.getParentComp()
|
||||
&& null == departmentPO.getParentDept()
|
||||
&& null == departmentPO.getDeptPrincipal()
|
||||
&& null == departmentPO.getShowOrder()
|
||||
&& null == departmentPO.getForbiddenTag());
|
||||
return !(StringUtil.isEmpty(departmentPO.getDepartmentCode())
|
||||
&& StringUtil.isEmpty(departmentPO.getDepartmentName())
|
||||
&& null == departmentPO.getSubCompanyId1()
|
||||
&& null == departmentPO.getSupDepId());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -832,18 +773,18 @@ 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);
|
||||
CompPO compBuild = CompPO.builder().subCompanyName(keyword).supSubComId(parentCompId).canceled(0).build();
|
||||
List<CompPO> allCompanys = getCompMapper().listAll("showOrder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "showOrder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
|
||||
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Map<Integer, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
|
||||
Set<CompPO> builderComps = new HashSet<>();
|
||||
for (CompPO compPO : filterComps) {
|
||||
buildParentComps(compPO, builderComps, allMaps);
|
||||
for (CompPO companyPO : filterComps) {
|
||||
buildParentComps(companyPO, builderComps, allMaps);
|
||||
}
|
||||
return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps));
|
||||
|
||||
|
|
@ -855,10 +796,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(CompPO compPO, Set<CompPO> builderComps, Map<Integer, CompPO> allMaps) {
|
||||
builderComps.add(compPO);
|
||||
CompPO parentComp = allMaps.get(compPO.getParentCompany());
|
||||
if (null != parentComp && 0 == parentComp.getForbiddenTag()) {
|
||||
CompPO parentComp = allMaps.get(compPO.getSupSubComId());
|
||||
if (null != parentComp && (null == parentComp.getCanceled() || 0 == parentComp.getCanceled())) {
|
||||
buildParentComps(parentComp, builderComps, allMaps);
|
||||
}
|
||||
}
|
||||
|
|
@ -903,7 +844,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, Integer parentDeptId, Long currentParentJobId, int orderNum, long timeMillis) {
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
orderNum++;
|
||||
|
||||
|
|
@ -915,16 +856,12 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
|
||||
// 所属部门赋值
|
||||
jobPO.setParentDept(parentDeptId);
|
||||
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(parentDeptId.toString());
|
||||
if (StringUtils.isNotBlank(ecDepartmentId)) {
|
||||
jobPO.setEcDepartment(Long.parseLong(ecDepartmentId));
|
||||
}
|
||||
jobPO.setEcDepartment(parentDeptId);
|
||||
|
||||
// 所属分部赋值
|
||||
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());
|
||||
|
|
@ -948,14 +885,14 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
*/
|
||||
private void updateEcDepartment(DepartmentPO departmentPO) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("dept_name_short", departmentPO.getDeptNameShort());
|
||||
map.put("dept_name", departmentPO.getDeptName());
|
||||
map.put("parent_comp", departmentPO.getParentComp());
|
||||
map.put("parent_dept", departmentPO.getParentDept());
|
||||
map.put("show_order", departmentPO.getShowOrder());
|
||||
map.put("dept_no", departmentPO.getDeptNo());
|
||||
map.put("dept_principal", departmentPO.getDeptPrincipal());
|
||||
map.put("id", departmentPO.getId());
|
||||
map.put("departmentmark", departmentPO.getDepartmentMark());
|
||||
map.put("departmentname", departmentPO.getDepartmentName());
|
||||
map.put("subcompanyid1", Util.null2String(departmentPO.getSubCompanyId1()));
|
||||
map.put("supdepid", Util.null2String(departmentPO.getSupDepId()));
|
||||
map.put("showorder", Util.null2String(departmentPO.getShowOrder()));
|
||||
map.put("departmentcode", departmentPO.getDepartmentCode());
|
||||
map.put("coadjutant", Util.null2String(departmentPO.getCoadjutant()));
|
||||
map.put("id", Util.null2String(departmentPO.getId()));
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map).sync();
|
||||
}
|
||||
|
||||
|
|
@ -967,14 +904,12 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
*/
|
||||
private Map<String, Object> addEcDepartment(DepartmentPO departmentPO) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("dept_name_short", departmentPO.getDeptNameShort());
|
||||
map.put("dept_name", departmentPO.getDeptName());
|
||||
map.put("parent_comp", departmentPO.getParentComp());
|
||||
map.put("parent_dept", departmentPO.getParentDept());
|
||||
map.put("show_order", departmentPO.getShowOrder());
|
||||
map.put("dept_no", departmentPO.getDeptNo());
|
||||
map.put("dept_principal", departmentPO.getDeptPrincipal());
|
||||
map.put("id", departmentPO.getId());
|
||||
map.put("departmentmark", departmentPO.getDepartmentMark());
|
||||
map.put("departmentname", departmentPO.getDepartmentName());
|
||||
map.put("subcompanyid1", Util.null2String(departmentPO.getSubCompanyId1()));
|
||||
map.put("supdepid", Util.null2String(departmentPO.getSupDepId()));
|
||||
map.put("showorder", Util.null2String(departmentPO.getShowOrder()));
|
||||
map.put("departmentcode", departmentPO.getDepartmentCode());
|
||||
return new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, map).sync();
|
||||
}
|
||||
|
||||
|
|
@ -990,7 +925,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync();
|
||||
}
|
||||
|
||||
private void addDisableIds(Set<Long> disableIds, List<DepartmentPO> deptListByPId) {
|
||||
private void addDisableIds(Set<Integer> disableIds, List<DepartmentPO> deptListByPId) {
|
||||
for (DepartmentPO departmentPO : deptListByPId) {
|
||||
disableIds.add(departmentPO.getId());
|
||||
List<DepartmentPO> childDeptPOS = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
|
||||
|
|
@ -1004,12 +939,11 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
* @param parentDepartment
|
||||
* @param parentComp
|
||||
*/
|
||||
private void refreshJobComp(Long parentDepartment, Long parentComp) {
|
||||
private void refreshJobComp(Integer 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)) {
|
||||
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(parentComp.toString());
|
||||
getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, ecCompanyId);
|
||||
getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, parentComp);
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
// 刷新组织架构图
|
||||
new JobTriggerRunnable(jobPO.getId()).run();
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|||
fieldTypeObj.add(tmp);
|
||||
fieldType = SystemEnv.getHtmlLabelName(695, user.getLanguage());
|
||||
fieldType += " " + SystemEnv.getHtmlLabelName(Util.getIntValue(BrowserComInfo.getBrowserlabelid(browserType), 0), user.getLanguage());
|
||||
if (browserType.equals("161") || browserType.equals("162") || browserType.equals("256") || browserType.equals("257")) {
|
||||
if ("161".equals(browserType) || "162".equals(browserType) || "256".equals(browserType) || "257".equals(browserType)) {
|
||||
tmp = new HashMap<>();
|
||||
tmp.put("value", SelectOptionParam.getCustomBrowserId(customValue));
|
||||
tmp.put("valueSpan", SelectOptionParam.getCustomBrowserValueSpan(customValue));
|
||||
|
|
@ -448,7 +448,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|||
lsComDetialInfo = new ArrayList<>();
|
||||
comDetialInfo = new HashMap<>();
|
||||
comDetialInfo.put("label", "");
|
||||
comDetialInfo.put("type", fieldHtmlType.equals("5") ? "CUSTOMFIELD" : "TEXT");
|
||||
comDetialInfo.put("type", "5".equals(fieldHtmlType) ? "CUSTOMFIELD" : "TEXT");
|
||||
comDetialInfo.put("width", "60%");
|
||||
comDetialInfo.put("key", "fieldType");
|
||||
lsComDetialInfo.add(comDetialInfo);
|
||||
|
|
@ -462,7 +462,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|||
fieldTypeInfo.add("select");
|
||||
Map<String, Object> fieldTypeParamInfo = new HashMap<>();
|
||||
|
||||
if (fieldHtmlType.equals("5")) {
|
||||
if ("5".equals(fieldHtmlType)) {
|
||||
|
||||
fieldTypeParamInfo.put("datas", SelectOptionParam.getSelectFields(customValue));
|
||||
fieldTypeParamInfo.put("sort", "horizontal");
|
||||
|
|
|
|||
|
|
@ -541,15 +541,15 @@ 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);
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentComp(parentCompId).build();
|
||||
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).build();
|
||||
Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).subCompanyId1(parentCompId).build();
|
||||
CompPO compBuild = CompPO.builder().subCompanyName(keyword).supSubComId(parentCompId).build();
|
||||
// 所属分部下的岗位
|
||||
JobPO jobBuild = JobPO.builder().jobName(keyword).parentComp(parentCompId).build();
|
||||
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild, jobBuild);
|
||||
} else if (TYPE_DEPT.equals(type)) {
|
||||
Long parentDeptId = Long.parseLong(id);
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentDept(parentDeptId).build();
|
||||
Integer parentDeptId = Integer.parseInt(id);
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).supDepId(parentDeptId).build();
|
||||
// 所属分部下的岗位
|
||||
JobPO jobBuild = JobPO.builder().jobName(keyword).parentDept(parentDeptId).build();
|
||||
searchTree = buildTreeByDeptAndJob(departmentBuild, jobBuild);
|
||||
|
|
@ -577,7 +577,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild, JobPO jobBuild) {
|
||||
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
|
||||
new DetachUtil(user.getUID()).filterJobList(jobPOS);
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
|
||||
// 添加父级岗位
|
||||
Set<JobPO> builderJobs = new HashSet<>();
|
||||
|
|
@ -607,7 +607,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
}
|
||||
|
||||
// 查询分部信息
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "showorder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
|
|
@ -624,9 +624,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
filterComps.addAll(compsByIds);
|
||||
}
|
||||
}
|
||||
List<CompPO> allCompanys = getCompMapper().list("show_order");
|
||||
List<CompPO> allCompanys = getCompMapper().listAll("showorder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Map<Integer, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Set<CompPO> builderComps = new HashSet<>();
|
||||
for (CompPO compPO : filterComps) {
|
||||
buildParentComps(compPO, builderComps, allMaps);
|
||||
|
|
@ -636,7 +636,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
|
||||
private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild) {
|
||||
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
|
||||
// 添加父级岗位
|
||||
Set<JobPO> builderJobs = new HashSet<>();
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
|
|
@ -689,10 +689,10 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
*/
|
||||
private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) {
|
||||
builderDeparts.add(departmentPO);
|
||||
if (SearchTreeUtil.isTop(departmentPO.getParentDept())) {
|
||||
if (SearchTreeUtil.isTop(departmentPO.getSupDepId())) {
|
||||
return;
|
||||
}
|
||||
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getParentDept());
|
||||
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getSupDepId());
|
||||
if (null != parentDept) {
|
||||
buildParentDepts(parentDept, builderDeparts);
|
||||
}
|
||||
|
|
@ -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(CompPO compPO, Set<CompPO> builderComps, Map<Integer, CompPO> allMaps) {
|
||||
builderComps.add(compPO);
|
||||
CompPO parentComp = allMaps.get(compPO.getParentCompany());
|
||||
CompPO parentComp = allMaps.get(compPO.getSupSubComId());
|
||||
if (null != parentComp) {
|
||||
buildParentComps(parentComp, builderComps, allMaps);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,12 +35,13 @@ import com.engine.organization.mapper.scheme.GradeMapper;
|
|||
import com.engine.organization.mapper.scheme.LevelMapper;
|
||||
import com.engine.organization.mapper.scheme.SchemeMapper;
|
||||
import com.engine.organization.service.ImportCommonService;
|
||||
import com.engine.organization.thread.*;
|
||||
import com.engine.organization.thread.HrmResourceTriggerRunnable;
|
||||
import com.engine.organization.thread.JobTriggerRunnable;
|
||||
import com.engine.organization.thread.OrganizationSyncEc;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.excel.ExcelUtil;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import com.engine.organization.util.saveimport.OrgImportUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -662,7 +663,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
}
|
||||
// 组装待处理数据
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Long parentCompanyId = null;
|
||||
Integer parentCompanyId = null;
|
||||
String companyName = "";
|
||||
|
||||
historyDetailPO.setRowNums(String.valueOf(i + 1));
|
||||
|
|
@ -725,9 +726,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
}
|
||||
}
|
||||
map.put("parent_company", parentCompanyId);
|
||||
if (null != parentCompanyId) {
|
||||
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(parentCompanyId.toString()));
|
||||
}
|
||||
map.put("ec_company", parentCompanyId);
|
||||
|
||||
companyName = split[split.length - 1];
|
||||
map.put("comp_name", companyName);
|
||||
}
|
||||
|
|
@ -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);
|
||||
Integer companyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(companyName, parentCompanyId == null ? 0 : parentCompanyId);
|
||||
if ("add".equals(operateType)) {
|
||||
if (companyId != null) {
|
||||
historyDetailPO.setOperateDetail("数据已存在");
|
||||
|
|
@ -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 {
|
||||
|
|
@ -805,15 +805,15 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
if (checkRepeatNo(compNo, COMPANY_TYPE, companyId)) {
|
||||
if (checkRepeatNo(compNo, COMPANY_TYPE, Long.valueOf(companyId))) {
|
||||
map.put("update_time", new Date());
|
||||
map.put("id", companyId);
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, map, false).sync();
|
||||
if (isThrowError(syncMap)) {
|
||||
map.remove("id");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(companyId).tableName("JCL_ORG_COMP").params(map).build());
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(Long.valueOf(companyId)).tableName("JCL_ORG_COMP").params(map).build());
|
||||
// 刷新组织架构图
|
||||
new CompanyTriggerRunnable(companyId).run();
|
||||
//TODO new CompanyTriggerRunnable(companyId).run();
|
||||
historyDetailPO.setOperateDetail("更新成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
} else {
|
||||
|
|
@ -870,8 +870,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
}
|
||||
// 组装待处理数据
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Long parentCompanyId = null;
|
||||
Long parentDepartmentId = null;
|
||||
Integer parentCompanyId = null;
|
||||
Integer parentDepartmentId = null;
|
||||
String departmentName = "";
|
||||
|
||||
historyDetailPO.setRowNums(String.valueOf(i + 1));
|
||||
|
|
@ -962,11 +962,10 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
}
|
||||
}
|
||||
map.put("parent_comp", parentCompanyId);
|
||||
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(parentCompanyId.toString()));
|
||||
map.put("ec_company", parentCompanyId);
|
||||
map.put("parent_dept", parentDepartmentId);
|
||||
if (null != parentDepartmentId) {
|
||||
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(parentDepartmentId.toString()));
|
||||
}
|
||||
map.put("ec_department", parentDepartmentId);
|
||||
|
||||
departmentName = split[split.length - 1];
|
||||
map.put("dept_name", departmentName);
|
||||
}
|
||||
|
|
@ -983,7 +982,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
continue;
|
||||
}
|
||||
String deptNo = (String) map.get("dept_no");
|
||||
Long departmentId = MapperProxyFactory.getProxy(DepartmentMapper.class).getIdByNameAndPid(departmentName, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId);
|
||||
Integer departmentId = MapperProxyFactory.getProxy(DepartmentMapper.class).getIdByNameAndPid(departmentName, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId);
|
||||
if ("add".equals(operateType)) {
|
||||
if (departmentId != null) {
|
||||
historyDetailPO.setOperateDetail("数据已存在");
|
||||
|
|
@ -1010,9 +1009,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
}
|
||||
String showOrder = Util.null2String(map.get("show_order"));
|
||||
if (StringUtils.isBlank(showOrder)) {
|
||||
Integer maxShowOrder = MapperProxyFactory.getProxy(DepartmentMapper.class).getMaxShowOrder();
|
||||
Double maxShowOrder = MapperProxyFactory.getProxy(DepartmentMapper.class).getMaxShowOrder();
|
||||
if (null == maxShowOrder) {
|
||||
maxShowOrder = 0;
|
||||
maxShowOrder = 0D;
|
||||
}
|
||||
map.put("show_order", maxShowOrder + 1);
|
||||
}
|
||||
|
|
@ -1025,7 +1024,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("JCL_ORG_DEPT").params(map).build();
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams);
|
||||
// 刷新组织架构图
|
||||
new DepartmentTriggerRunnable(infoParams.getId()).run();
|
||||
//TODO new DepartmentTriggerRunnable(infoParams.getId()).run();
|
||||
map.put("id", infoParams.getId());
|
||||
historyDetailPO.setOperateDetail("添加成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
|
|
@ -1043,15 +1042,15 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
if (checkRepeatNo(deptNo, DEPARTMENT_TYPE, departmentId)) {
|
||||
if (checkRepeatNo(deptNo, DEPARTMENT_TYPE, Long.valueOf(departmentId))) {
|
||||
map.put("update_time", new Date());
|
||||
map.put("id", departmentId);
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map, false).sync();
|
||||
if (isThrowError(syncMap)) {
|
||||
map.remove("id");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(departmentId).tableName("JCL_ORG_DEPT").params(map).build());
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(Long.valueOf(departmentId)).tableName("JCL_ORG_DEPT").params(map).build());
|
||||
// 刷新组织架构图
|
||||
new DepartmentTriggerRunnable(departmentId).run();
|
||||
//TODO new DepartmentTriggerRunnable(departmentId).run();
|
||||
historyDetailPO.setOperateDetail("更新成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
} else {
|
||||
|
|
@ -1107,8 +1106,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
}
|
||||
// 组装待处理数据
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Long parentCompanyId = null;
|
||||
Long parentDepartmentId = null;
|
||||
Integer parentCompanyId = null;
|
||||
Integer parentDepartmentId = null;
|
||||
Long parentJobId = null;
|
||||
String jobName = "";
|
||||
|
||||
|
|
@ -1223,10 +1222,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
}
|
||||
map.put("parent_comp", parentCompanyId);
|
||||
map.put("parent_dept", parentDepartmentId);
|
||||
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(parentCompanyId)));
|
||||
if (null != parentDepartmentId) {
|
||||
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId)));
|
||||
}
|
||||
map.put("ec_company", parentCompanyId);
|
||||
map.put("ec_department", parentDepartmentId);
|
||||
map.put("parent_job", parentJobId);
|
||||
jobName = split[split.length - 1];
|
||||
map.put("job_name", jobName);
|
||||
|
|
@ -1372,8 +1369,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
}
|
||||
// 组装待处理数据
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Long parentCompanyId = null;
|
||||
Long parentDepartmentId = null;
|
||||
Integer parentCompanyId = null;
|
||||
Integer parentDepartmentId = null;
|
||||
Long parentJobId = null;
|
||||
|
||||
historyDetailPO.setRowNums(String.valueOf(i + 1));
|
||||
|
|
@ -1486,10 +1483,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
}
|
||||
map.put("company_id", parentCompanyId);
|
||||
map.put("department_id", parentDepartmentId);
|
||||
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(parentCompanyId)));
|
||||
if (null != parentDepartmentId) {
|
||||
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId)));
|
||||
}
|
||||
map.put("ec_company", parentCompanyId);
|
||||
map.put("ec_department", parentDepartmentId);
|
||||
|
||||
map.put("job_title", parentJobId);
|
||||
}
|
||||
}
|
||||
|
|
@ -1517,7 +1513,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
historyDetailPO.setRelatedName(keyFieldValue);
|
||||
// 判断当前人员是否存在
|
||||
boolean hasSameKeyFieldValue = hasSameKeyFieldValue(historyDetailPO, keyField, keyFieldValue);
|
||||
;
|
||||
if (hasSameKeyFieldValue) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1630,7 +1625,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
XSSFSheet sheetAt = workbook.getSheetAt(s);
|
||||
int lastRow = sheetAt.getLastRowNum();
|
||||
allRow = allRow + lastRow;
|
||||
String relatedName = "";
|
||||
String relatedName;
|
||||
switch (s) {
|
||||
case 0:
|
||||
relatedName = "方案页";
|
||||
|
|
@ -1658,11 +1653,11 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
// 组装待处理数据
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
SchemePO schemePO = new SchemePO();
|
||||
SchemePO schemeNew = new SchemePO();
|
||||
SchemePO schemeNew;
|
||||
GradePO gradePO = new GradePO();
|
||||
GradePO gradeNew = new GradePO();
|
||||
LevelPO levelPO = new LevelPO();
|
||||
LevelPO levelNew = new LevelPO();
|
||||
LevelPO levelNew;
|
||||
|
||||
historyDetailPO.setRowNums(String.valueOf(i + 1));
|
||||
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) {
|
||||
|
|
@ -1738,11 +1733,11 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
if ("level_no".equals(infoPO.getFieldName()) && s == 2) {
|
||||
String[] split = Util.null2String(reallyValue).split(",");
|
||||
if (split.length > 0) {
|
||||
for (int index = 0; index < split.length; index++) {
|
||||
List<LevelPO> levelPOS = MapperProxyFactory.getProxy(LevelMapper.class).listByNo(split[index]);
|
||||
for (String value : split) {
|
||||
List<LevelPO> levelPOS = MapperProxyFactory.getProxy(LevelMapper.class).listByNo(value);
|
||||
if (levelPOS.size() == 0) {
|
||||
historyDetailPO.setRelatedName(relatedName);
|
||||
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等");
|
||||
historyDetailPO.setOperateDetail("未找到编号为[" + value + "]的职等");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
|
|
@ -1790,7 +1785,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
historyDetailPO.setOperateDetail("职等页导入:同一方案" + schemeNo + "下,职等编号不可重复");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
continue;
|
||||
} else {
|
||||
levelPO.setLevelNo(levelNo);
|
||||
levelPO.setLevelName((String) map.get("level_name"));
|
||||
|
|
@ -1810,7 +1805,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
|
@ -1824,7 +1819,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
continue;
|
||||
}
|
||||
|
||||
gradePO.setGradeNo(gradeNo2);
|
||||
|
|
@ -1839,21 +1834,21 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
gradePO.setCreateTime((Date) map.get("create_time"));
|
||||
gradePO.setUpdateTime((Date) map.get("update_time"));
|
||||
String[] split = levelNo2.split(",");
|
||||
String levelIds = null;
|
||||
StringBuilder levelIds = null;
|
||||
if (split.length > 0) {
|
||||
for (int index = 0; index < split.length; index++) {
|
||||
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(split[index], schemeNew.getId());
|
||||
for (String value : split) {
|
||||
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(value, schemeNew.getId());
|
||||
if (levelNew == null) {
|
||||
historyDetailPO.setRelatedName(relatedName);
|
||||
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等");
|
||||
historyDetailPO.setOperateDetail("未找到编号为[" + value + "]的职等");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
if (levelIds != null) {
|
||||
levelIds = levelIds + "," + levelNew.getId();
|
||||
levelIds.append(",").append(levelNew.getId());
|
||||
} else {
|
||||
levelIds = String.valueOf(levelNew.getId());
|
||||
levelIds = new StringBuilder(String.valueOf(levelNew.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1863,10 +1858,10 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
historyDetailPO.setOperateDetail("同一方案[" + schemeNo2 + "]下,职级编号不可重复");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
continue;
|
||||
} else {
|
||||
// 关联职等id
|
||||
gradePO.setLevelId(levelIds);
|
||||
gradePO.setLevelId(levelIds.toString());
|
||||
MapperProxyFactory.getProxy(GradeMapper.class).insertIgnoreNull(gradePO);
|
||||
}
|
||||
break;
|
||||
|
|
@ -1890,7 +1885,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
historyDetailPO.setOperateDetail("未找到编号为[" + map.get("scheme_no") + "]的方案");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
|
|
@ -1911,14 +1906,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
historyDetailPO.setRelatedName(relatedName);
|
||||
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案,无法更新");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
|
@ -1930,25 +1925,25 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
continue;
|
||||
}
|
||||
// 处理职级编号
|
||||
String[] split = levelNo2.split(",");
|
||||
String levelIds = null;
|
||||
StringBuilder levelIds = null;
|
||||
if (split.length > 0) {
|
||||
for (int index = 0; index < split.length; index++) {
|
||||
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(split[index], schemeNew.getId());
|
||||
for (String value : split) {
|
||||
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(value, schemeNew.getId());
|
||||
if (levelNew == null) {
|
||||
historyDetailPO.setRelatedName(relatedName);
|
||||
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等");
|
||||
historyDetailPO.setOperateDetail("未找到编号为[" + value + "]的职等");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
if (levelIds != null) {
|
||||
levelIds = levelIds + "," + levelNew.getId();
|
||||
levelIds.append(",").append(levelNew.getId());
|
||||
} else {
|
||||
levelIds = String.valueOf(levelNew.getId());
|
||||
levelIds = new StringBuilder(String.valueOf(levelNew.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1958,7 +1953,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
gradeNew.setGradeName((String) map.get("grade_name"));
|
||||
gradeNew.setDescription((String) map.get("grade_description"));
|
||||
// 关联职等id
|
||||
gradeNew.setLevelId(levelIds);
|
||||
gradeNew.setLevelId(levelIds.toString());
|
||||
gradeNew.setUpdateTime((Date) map.get("update_time"));
|
||||
MapperProxyFactory.getProxy(GradeMapper.class).updateGrade(gradeNew);
|
||||
} else {
|
||||
|
|
@ -1966,7 +1961,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
historyDetailPO.setOperateDetail("未找到编号[" + schemeNo2 + "]的职级,无法更新");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -1988,8 +1983,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
*/
|
||||
private String getCellValue(XSSFCell cell) {
|
||||
String cellValue = "";
|
||||
if (cell == null)
|
||||
if (cell == null) {
|
||||
return "";
|
||||
}
|
||||
switch (cell.getCellType()) {
|
||||
case BOOLEAN: // 得到Boolean对象的方法
|
||||
cellValue = String.valueOf(cell.getBooleanCellValue());
|
||||
|
|
@ -2000,8 +1996,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
cellValue = sft.format(cell.getDateCellValue()); // 读取日期格式
|
||||
} else {
|
||||
cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字
|
||||
if (cellValue.endsWith(".0"))
|
||||
if (cellValue.endsWith(".0")) {
|
||||
cellValue = cellValue.substring(0, cellValue.indexOf("."));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FORMULA: // 读取公式
|
||||
|
|
@ -2026,7 +2023,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":
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ 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 com.engine.organization.util.tree.SearchTreeUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
|
@ -163,7 +162,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
JobPO jobPO = JobBO.convertParamsToPO(param, user.getUID());
|
||||
boolean filter = isFilter(jobPO);
|
||||
PageInfo<JobListDTO> pageInfos;
|
||||
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams());
|
||||
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams(), " show_order ");
|
||||
List<JobListDTO> allList = getJobMapper().listNoFilter(orderSql);
|
||||
new DetachUtil(user.getUID()).filterJobDTOList(allList);
|
||||
// 通过子级遍历父级元素
|
||||
|
|
@ -278,7 +277,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
CompPO compPO = getCompMapper().listById(param.getSubcompanyid1());
|
||||
if (null != compPO) {
|
||||
params.put("parent_comp", compPO.getId());
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(compPO.getId().toString()));
|
||||
params.put("ec_company", compPO.getId());
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
|
|
@ -286,9 +285,9 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
DepartmentPO deptById = getDepartmentMapper().getDeptById(param.getDepartmentid());
|
||||
if (null != deptById) {
|
||||
params.put("parent_dept", deptById.getId());
|
||||
params.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString()));
|
||||
params.put("parent_comp", deptById.getParentComp());
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(deptById.getParentComp().toString()));
|
||||
params.put("ec_department", deptById.getId());
|
||||
params.put("parent_comp", deptById.getSubCompanyId1());
|
||||
params.put("ec_company", deptById.getSubCompanyId1());
|
||||
}
|
||||
}
|
||||
for (ExtendTitlePO extendTitle : extendTitles) {
|
||||
|
|
@ -371,12 +370,12 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
params.put("ec_company", parentJob.getEcCompany());
|
||||
params.put("ec_department", parentJob.getEcDepartment());
|
||||
} else {
|
||||
Long ecDepartment = searchParam.getEcDepartment();
|
||||
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecDepartment));
|
||||
Integer ecDepartment = searchParam.getEcDepartment();
|
||||
DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
|
||||
params.put("parent_dept", jclDepartment.getId());
|
||||
params.put("parent_comp", jclDepartment.getParentComp());
|
||||
if (null != jclDepartment.getParentComp()) {
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartment.getParentComp())));
|
||||
params.put("parent_comp", jclDepartment.getSubCompanyId1());
|
||||
if (null != jclDepartment.getSubCompanyId1()) {
|
||||
params.put("ec_company", jclDepartment.getSubCompanyId1());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -422,12 +421,12 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
params.put("ec_company", parentJob.getEcCompany());
|
||||
params.put("ec_department", parentJob.getEcDepartment());
|
||||
} else {
|
||||
Long ecDepartment = searchParam.getEcDepartment();
|
||||
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecDepartment));
|
||||
Integer ecDepartment = searchParam.getEcDepartment();
|
||||
DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
|
||||
params.put("parent_dept", jclDepartment.getId());
|
||||
params.put("parent_comp", jclDepartment.getParentComp());
|
||||
if (null != jclDepartment.getParentComp()) {
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartment.getParentComp())));
|
||||
params.put("parent_comp", jclDepartment.getSubCompanyId1());
|
||||
if (null != jclDepartment.getSubCompanyId1()) {
|
||||
params.put("ec_company", jclDepartment.getSubCompanyId1());
|
||||
}
|
||||
}
|
||||
params.put("jobactivityid", JOB_ACTIVITY_ID);
|
||||
|
|
@ -461,13 +460,13 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 处理自动编号
|
||||
jobById.setJobNo(CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, jobById.getJobNo(), System.currentTimeMillis()));
|
||||
// 部门赋值
|
||||
jobById.setEcDepartment(Long.parseLong(department));
|
||||
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(department);
|
||||
jobById.setEcDepartment(Integer.parseInt(department));
|
||||
DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(jobById.getEcDepartment());
|
||||
if (null != jclDepartmentId) {
|
||||
jobById.setParentDept(jclDepartmentId.getId());
|
||||
//分部赋值
|
||||
jobById.setEcCompany(jclDepartmentId.getEcCompany());
|
||||
jobById.setParentComp(jclDepartmentId.getParentComp());
|
||||
jobById.setEcCompany(jclDepartmentId.getSubCompanyId1());
|
||||
jobById.setParentComp(jclDepartmentId.getSubCompanyId1());
|
||||
}
|
||||
// 清空上级岗位
|
||||
jobById.setParentJob(null);
|
||||
|
|
@ -489,7 +488,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
if (params.getForbiddenTag()) {
|
||||
// 启用:判断上级部门是否启用,上级部门启用,岗位才可启用
|
||||
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(jobById.getParentDept());
|
||||
OrganizationAssert.isTrue(0 == parentDepartment.getForbiddenTag(), "该岗位不能解封,请先解封上级部门");
|
||||
OrganizationAssert.isTrue(0 == parentDepartment.getCanceled(), "该岗位不能解封,请先解封上级部门");
|
||||
|
||||
// 启用:判断上级岗位是否启用,上级岗位启用,岗位才可启用
|
||||
if (null != jobById.getParentJob()) {
|
||||
|
|
@ -600,7 +599,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, Integer parentDepartment, Integer ecDepartment, Long parentJob) {
|
||||
for (JobPO job : jobs) {
|
||||
job.setParentComp(parentCompany);
|
||||
job.setEcCompany(ecCompany);
|
||||
|
|
@ -627,11 +626,11 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
*/
|
||||
private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) {
|
||||
builderDeparts.add(departmentPO);
|
||||
if (SearchTreeUtil.isTop(departmentPO.getParentDept())) {
|
||||
if (SearchTreeUtil.isTop(departmentPO.getSupDepId())) {
|
||||
return;
|
||||
}
|
||||
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getParentDept());
|
||||
if (null != parentDept && 0 == parentDept.getForbiddenTag()) {
|
||||
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getSupDepId());
|
||||
if (null != parentDept && (null == parentDept.getCanceled() || 0 == parentDept.getCanceled())) {
|
||||
buildParentDepts(parentDept, builderDeparts);
|
||||
}
|
||||
}
|
||||
|
|
@ -642,10 +641,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(CompPO compPO, Set<CompPO> builderComps, Map<Integer, CompPO> allMaps) {
|
||||
builderComps.add(compPO);
|
||||
CompPO parentComp = allMaps.get(compPO.getParentCompany());
|
||||
if (null != parentComp && 0 == parentComp.getForbiddenTag()) {
|
||||
CompPO parentComp = allMaps.get(compPO.getSupSubComId());
|
||||
if (null != parentComp && (null == parentComp.getCanceled() || 0 == parentComp.getCanceled())) {
|
||||
buildParentComps(parentComp, builderComps, allMaps);
|
||||
}
|
||||
}
|
||||
|
|
@ -662,14 +661,14 @@ 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);
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentComp(parentCompId).forbiddenTag(0).build();
|
||||
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).forbiddenTag(0).build();
|
||||
Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).subCompanyId1(parentCompId).canceled(0).build();
|
||||
CompPO compBuild = CompPO.builder().subCompanyName(keyword).supSubComId(parentCompId).canceled(0).build();
|
||||
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild);
|
||||
} else if (TYPE_DEPT.equals(type)) {
|
||||
//
|
||||
// 查询部门信息
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(DepartmentPO.builder().deptName(keyword).forbiddenTag(0).parentDept(Long.parseLong(id)).build(), "show_order");
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(DepartmentPO.builder().departmentName(keyword).canceled(0).supDepId(Integer.parseInt(id)).build(), "showorder");
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
buildParentDepts(departmentPO, builderDeparts);
|
||||
|
|
@ -688,10 +687,10 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
* @return
|
||||
*/
|
||||
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild) {
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
|
||||
// 查询分部信息
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "showorder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
|
|
@ -706,9 +705,9 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
filterComps.addAll(compsByIds);
|
||||
}
|
||||
}
|
||||
List<CompPO> allCompanys = getCompMapper().list("show_order");
|
||||
List<CompPO> allCompanys = getCompMapper().listAll("showorder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Map<Integer, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Set<CompPO> builderComps = new HashSet<>();
|
||||
for (CompPO compPO : filterComps) {
|
||||
buildParentComps(compPO, builderComps, allMaps);
|
||||
|
|
@ -774,30 +773,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
|
||||
*
|
||||
|
|
@ -832,7 +807,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
/**
|
||||
* 判断相同层级下有无同名岗位
|
||||
*/
|
||||
public static void assertNameRepeat(Long jobId, Long departmentId, Long parentJobId, String jobName) {
|
||||
public static void assertNameRepeat(Long jobId, Integer departmentId, Long parentJobId, String jobName) {
|
||||
assertNameRepeat(jobId, departmentId, parentJobId, jobName, true);
|
||||
}
|
||||
|
||||
|
|
@ -840,7 +815,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
* 判断相同层级下有无同名岗位
|
||||
*/
|
||||
public static boolean assertNameRepeat(String jobId, String departmentId, String parentJobId, String jobName) {
|
||||
return assertNameRepeat(StringUtils.isBlank(jobId) ? null : Long.parseLong(jobId), StringUtils.isBlank(departmentId) ? null : Long.parseLong(departmentId), StringUtils.isBlank(parentJobId) ? null : Long.parseLong(parentJobId), jobName, false);
|
||||
return assertNameRepeat(StringUtils.isBlank(jobId) ? null : Long.parseLong(jobId), StringUtils.isBlank(departmentId) ? null : Integer.parseInt(departmentId), StringUtils.isBlank(parentJobId) ? null : Long.parseLong(parentJobId), jobName, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -853,8 +828,8 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
* @param throwException
|
||||
* @return
|
||||
*/
|
||||
public static boolean assertNameRepeat(Long jobId, Long departmentId, Long parentJobId, String jobName, boolean throwException) {
|
||||
int count = 0;
|
||||
public static boolean assertNameRepeat(Long jobId, Integer departmentId, Long parentJobId, String jobName, boolean throwException) {
|
||||
int count;
|
||||
// 有上级岗位、判断相同层级下有无相同名称岗位
|
||||
if (null != jobId) {
|
||||
count = getJobMapper().countRepeatNameByPid(jobName, jobId, parentJobId, departmentId);
|
||||
|
|
@ -879,10 +854,10 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 更新岗位下的人员
|
||||
Long originalJobId = originalJob.getId();
|
||||
Long targetJobId = targetJob.getId();
|
||||
Long parentComp = targetJob.getParentComp();
|
||||
Long parentDept = targetJob.getParentDept();
|
||||
Long ecCompany = targetJob.getEcCompany();
|
||||
Long ecDepartment = targetJob.getEcDepartment();
|
||||
Integer parentComp = targetJob.getParentComp();
|
||||
Integer parentDept = targetJob.getParentDept();
|
||||
Integer ecCompany = targetJob.getEcCompany();
|
||||
Integer 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);
|
||||
}
|
||||
|
|
@ -177,12 +174,12 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|||
* @param uId
|
||||
* @return
|
||||
*/
|
||||
public static List<Long> getJclRoleLevels(Integer uId) {
|
||||
List<Long> ecRoleLevels = new ArrayList<>();
|
||||
public static List<Integer> getJclRoleLevels(Integer uId) {
|
||||
List<Integer> ecRoleLevels = new ArrayList<>();
|
||||
ManagerDetachMapper mangeDetachMapper = MapperProxyFactory.getProxy(ManagerDetachMapper.class);
|
||||
List<ManagerDetachPO> detachListById = mangeDetachMapper.getDetachListById(uId);
|
||||
for (ManagerDetachPO managerDetachPO : detachListById) {
|
||||
List<Long> ids = Stream.of(managerDetachPO.getJclRolelevel().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
List<Integer> ids = Stream.of(managerDetachPO.getJclRolelevel().split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
ecRoleLevels.addAll(ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,7 +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;
|
||||
|
|
@ -32,7 +30,6 @@ 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.excel.ExcelUtil;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.conn.RecordSet;
|
||||
|
|
@ -64,18 +61,14 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|||
return MapperProxyFactory.getProxy(StaffPlanMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
private JobMapper getJobMapper() {
|
||||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
||||
private DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
||||
private JobMapper getJobMapper() {
|
||||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
||||
// 判断编制导入模板是否存在,不存在则创建该文件
|
||||
static {
|
||||
try {
|
||||
|
|
@ -373,19 +366,19 @@ 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 + "'";
|
||||
}
|
||||
Long deptId = param.getDeptId();
|
||||
Integer deptId = param.getDeptId();
|
||||
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 + "'";
|
||||
}
|
||||
Long ecDepartment = param.getEcDepartment();
|
||||
Integer ecDepartment = param.getEcDepartment();
|
||||
if (null != ecDepartment) {
|
||||
sqlWhere += " AND t.ec_department = '" + ecDepartment + "'";
|
||||
}
|
||||
|
|
@ -440,18 +433,15 @@ 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(), "编制维度选择部门时,部门必填!");
|
||||
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(staffPO.getEcDepartment()));
|
||||
DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(staffPO.getEcDepartment());
|
||||
if (null != jclDepartmentId) {
|
||||
staffPO.setDeptId(jclDepartmentId.getId());
|
||||
staffPO.setCompId(jclDepartmentId.getParentComp());
|
||||
staffPO.setEcCompany(jclDepartmentId.getEcCompany());
|
||||
staffPO.setCompId(jclDepartmentId.getSubCompanyId1());
|
||||
staffPO.setEcCompany(jclDepartmentId.getSubCompanyId1());
|
||||
}
|
||||
break;
|
||||
case "3": // 岗位
|
||||
|
|
|
|||
|
|
@ -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,227 +1,203 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.logview.bo.FieldBaseEquator;
|
||||
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.department.DepartmentMapper;
|
||||
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.mapper.trigger.DepartmentTriggerMapper;
|
||||
import com.engine.organization.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/08/30
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class DepartmentTriggerRunnable implements Runnable {
|
||||
|
||||
private DepartmentPO oldDepartment;
|
||||
private final DepartmentPO newDepartment;
|
||||
private String oldFparentId;
|
||||
private String moveTarget;
|
||||
private Boolean forbiddenTag = false;
|
||||
|
||||
private CompTriggerMapper getCompTriggerMapper() {
|
||||
return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
||||
}
|
||||
|
||||
private DepartmentTriggerMapper getDepartmentTriggerMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentTriggerMapper.class);
|
||||
}
|
||||
|
||||
public DepartmentTriggerRunnable(DepartmentPO oldDepartment, DepartmentPO newDepartment) {
|
||||
this.oldDepartment = oldDepartment;
|
||||
this.newDepartment = newDepartment;
|
||||
}
|
||||
|
||||
public DepartmentTriggerRunnable(Boolean forbiddenTag,DepartmentPO oldDepartment, DepartmentPO newDepartment) {
|
||||
this.oldDepartment = oldDepartment;
|
||||
this.newDepartment = newDepartment;
|
||||
this.forbiddenTag = forbiddenTag;
|
||||
}
|
||||
|
||||
public DepartmentTriggerRunnable(Long departmentId) {
|
||||
this.oldDepartment = new DepartmentPO();
|
||||
this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
|
||||
}
|
||||
|
||||
public DepartmentTriggerRunnable(String moveTarget,DepartmentPO newDepartment) {
|
||||
this.oldDepartment = new DepartmentPO();
|
||||
this.newDepartment = newDepartment;
|
||||
this.moveTarget = moveTarget;
|
||||
}
|
||||
|
||||
public DepartmentTriggerRunnable(Integer oldFparentId, Long departmentId) {
|
||||
this.oldFparentId = null == oldFparentId ? null : oldFparentId.toString();
|
||||
this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
|
||||
}
|
||||
|
||||
public DepartmentTriggerRunnable(DepartmentPO newDepartment) {
|
||||
this.oldDepartment = new DepartmentPO();
|
||||
this.newDepartment = newDepartment;
|
||||
this.newDepartment.setDeleteType(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FieldBaseEquator fieldBaseEquator = new FieldBaseEquator();
|
||||
List<String> diffFields = fieldBaseEquator.getDiffFieldList(oldDepartment, newDepartment);
|
||||
if (CollectionUtils.isEmpty(diffFields)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断
|
||||
if (diffFields.contains("deptName") || diffFields.contains("deptPrincipal") || diffFields.contains("parentComp") || diffFields.contains("parentDept") || diffFields.contains("forbiddenTag") || diffFields.contains("deleteType")) {
|
||||
JclOrgMap jclMap = new JclOrgMap();
|
||||
jclMap.setFType(2);
|
||||
int st = 100000000;
|
||||
|
||||
// 更新逻辑
|
||||
jclMap.setFObjId(newDepartment.getId().intValue());
|
||||
jclMap.setId(newDepartment.getId().intValue() + st);
|
||||
jclMap.setUuid(newDepartment.getUuid());
|
||||
jclMap.setFNumber(newDepartment.getDeptNo());
|
||||
jclMap.setFName(newDepartment.getDeptName());
|
||||
jclMap.setFParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue() + st);
|
||||
jclMap.setFObjParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue());
|
||||
|
||||
jclMap.setFEcId(getDepartmentTriggerMapper().getEcDepartmentIdByUuid(jclMap.getUuid()));
|
||||
|
||||
jclMap.setFClass(0);
|
||||
jclMap.setFClassName("行政维度");
|
||||
Integer ecResourceId = null == newDepartment.getDeptPrincipal() ? null : newDepartment.getDeptPrincipal().intValue();
|
||||
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()));
|
||||
|
||||
// 获取当前生效的本部门map记录
|
||||
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
|
||||
StaffPO staffPO = new StaffPO();
|
||||
switch (jclMap.getFType()) {
|
||||
// 分部
|
||||
case 1:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,jclMap.getFObjId().toString(), null, null);
|
||||
break;
|
||||
// 部门
|
||||
case 2:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2,null, jclMap.getFObjId().toString(), null);
|
||||
break;
|
||||
}
|
||||
// 取出以该部门为上级部门的在编、在岗数,转移无需计算
|
||||
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
|
||||
if (null != moveTarget) {
|
||||
jclOrgMap = null;
|
||||
}
|
||||
if (null != jclOrgMapByObjID) {
|
||||
if (null != jclOrgMap) {
|
||||
jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
|
||||
jclMap.setFOnJob(jclOrgMap.getFOnJob());
|
||||
} else {
|
||||
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
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 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) {
|
||||
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
||||
}
|
||||
if(null != jclOrgMapByObjID) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
|
||||
}
|
||||
// 部门启用,刷新上级数据
|
||||
if(forbiddenTag){
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
|
||||
}
|
||||
if(null != moveTarget){
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget);
|
||||
}
|
||||
if (null != oldFparentId) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private 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 = new StaffPO();
|
||||
switch (parentJclOrgMap.getFType()) {
|
||||
case 1:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,Util.null2String(parentJclOrgMap.getFObjId()), null, null);
|
||||
break;
|
||||
// 部门
|
||||
case 2:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, Util.null2String(parentJclOrgMap.getFObjId()), null);
|
||||
break;
|
||||
}
|
||||
// 编制表jcl_org_staff中的编制数+下级编制数,工具类判断
|
||||
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 DepartmentTriggerRunnable implements Runnable {
|
||||
//
|
||||
// private DepartmentPO oldDepartment;
|
||||
// private final DepartmentPO newDepartment;
|
||||
// private String oldFparentId;
|
||||
// private String moveTarget;
|
||||
// private Boolean forbiddenTag = false;
|
||||
//
|
||||
// private CompTriggerMapper getCompTriggerMapper() {
|
||||
// return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
||||
// }
|
||||
//
|
||||
// private DepartmentTriggerMapper getDepartmentTriggerMapper() {
|
||||
// return MapperProxyFactory.getProxy(DepartmentTriggerMapper.class);
|
||||
// }
|
||||
//
|
||||
// public DepartmentTriggerRunnable(DepartmentPO oldDepartment, DepartmentPO newDepartment) {
|
||||
// this.oldDepartment = oldDepartment;
|
||||
// this.newDepartment = newDepartment;
|
||||
// }
|
||||
//
|
||||
// public DepartmentTriggerRunnable(Boolean forbiddenTag,DepartmentPO oldDepartment, DepartmentPO newDepartment) {
|
||||
// this.oldDepartment = oldDepartment;
|
||||
// this.newDepartment = newDepartment;
|
||||
// this.forbiddenTag = forbiddenTag;
|
||||
// }
|
||||
//
|
||||
// public DepartmentTriggerRunnable(Long departmentId) {
|
||||
// this.oldDepartment = new DepartmentPO();
|
||||
// this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
|
||||
// }
|
||||
//
|
||||
// public DepartmentTriggerRunnable(String moveTarget,DepartmentPO newDepartment) {
|
||||
// this.oldDepartment = new DepartmentPO();
|
||||
// this.newDepartment = newDepartment;
|
||||
// this.moveTarget = moveTarget;
|
||||
// }
|
||||
//
|
||||
// public DepartmentTriggerRunnable(Integer oldFparentId, Long departmentId) {
|
||||
// this.oldFparentId = null == oldFparentId ? null : oldFparentId.toString();
|
||||
// this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
|
||||
// }
|
||||
//
|
||||
// public DepartmentTriggerRunnable(DepartmentPO newDepartment) {
|
||||
// this.oldDepartment = new DepartmentPO();
|
||||
// this.newDepartment = newDepartment;
|
||||
// this.newDepartment.setDeleteType(1);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// FieldBaseEquator fieldBaseEquator = new FieldBaseEquator();
|
||||
// List<String> diffFields = fieldBaseEquator.getDiffFieldList(oldDepartment, newDepartment);
|
||||
// if (CollectionUtils.isEmpty(diffFields)) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // 判断
|
||||
// if (diffFields.contains("deptName") || diffFields.contains("deptPrincipal") || diffFields.contains("parentComp") || diffFields.contains("parentDept") || diffFields.contains("forbiddenTag") || diffFields.contains("deleteType")) {
|
||||
// JclOrgMap jclMap = new JclOrgMap();
|
||||
// jclMap.setFType(2);
|
||||
// int st = 100000000;
|
||||
//
|
||||
// // 更新逻辑
|
||||
// jclMap.setFObjId(newDepartment.getId().intValue());
|
||||
// jclMap.setId(newDepartment.getId().intValue() + st);
|
||||
// jclMap.setUuid(newDepartment.getUuid());
|
||||
// jclMap.setFNumber(newDepartment.getDeptNo());
|
||||
// jclMap.setFName(newDepartment.getDeptName());
|
||||
// jclMap.setFParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue() + st);
|
||||
// jclMap.setFObjParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue());
|
||||
//
|
||||
// jclMap.setFEcId(getDepartmentTriggerMapper().getEcDepartmentIdByUuid(jclMap.getUuid()));
|
||||
//
|
||||
// jclMap.setFClass(0);
|
||||
// jclMap.setFClassName("行政维度");
|
||||
// Integer ecResourceId = null == newDepartment.getDeptPrincipal() ? null : newDepartment.getDeptPrincipal().intValue();
|
||||
// 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()));
|
||||
//
|
||||
// // 获取当前生效的本部门map记录
|
||||
// JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
|
||||
// StaffPO staffPO = new StaffPO();
|
||||
// switch (jclMap.getFType()) {
|
||||
// // 分部
|
||||
// case 1:
|
||||
// staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,jclMap.getFObjId().toString(), null, null);
|
||||
// break;
|
||||
// // 部门
|
||||
// case 2:
|
||||
// staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2,null, jclMap.getFObjId().toString(), null);
|
||||
// break;
|
||||
// }
|
||||
// // 取出以该部门为上级部门的在编、在岗数,转移无需计算
|
||||
// JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
|
||||
// if (null != moveTarget) {
|
||||
// jclOrgMap = null;
|
||||
// }
|
||||
// if (null != jclOrgMapByObjID) {
|
||||
// if (null != jclOrgMap) {
|
||||
// jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
|
||||
// jclMap.setFOnJob(jclOrgMap.getFOnJob());
|
||||
// } else {
|
||||
// jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
// 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 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) {
|
||||
// MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
||||
// }
|
||||
// if(null != jclOrgMapByObjID) {
|
||||
// updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
|
||||
// }
|
||||
// // 部门启用,刷新上级数据
|
||||
// if(forbiddenTag){
|
||||
// updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
|
||||
// }
|
||||
// if(null != moveTarget){
|
||||
// updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget);
|
||||
// }
|
||||
// if (null != oldFparentId) {
|
||||
// updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private 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 = new StaffPO();
|
||||
// switch (parentJclOrgMap.getFType()) {
|
||||
// case 1:
|
||||
// staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,Util.null2String(parentJclOrgMap.getFObjId()), null, null);
|
||||
// break;
|
||||
// // 部门
|
||||
// case 2:
|
||||
// staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, Util.null2String(parentJclOrgMap.getFObjId()), null);
|
||||
// break;
|
||||
// }
|
||||
// // 编制表jcl_org_staff中的编制数+下级编制数,工具类判断
|
||||
// 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,13 +4,9 @@ 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;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
|
|
@ -18,12 +14,9 @@ import com.engine.organization.util.db.MapperProxyFactory;
|
|||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import com.engine.organization.util.relation.ResourceSyncUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -352,67 +345,20 @@ public class OrganizationSyncEc {
|
|||
* 新增部门
|
||||
*/
|
||||
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")));
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).addDepartment(map, user);
|
||||
// 更新jcl_org_dept表 uuid字段
|
||||
//if ("1".equals(Util.null2String(resultMap.get("status"))) && null != resultMap.get("id")) {
|
||||
// updateJclUUID(Util.null2String(resultMap.get("id")), HRM_DEPARTMENT, JCL_DEPARTMENT);
|
||||
//}
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).addDepartment(params, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 封存、解封部门
|
||||
*/
|
||||
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() + currentTimeMillis);
|
||||
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)) {
|
||||
// 解封
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doDepartmentISCanceled(map, user);
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doDepartmentISCanceled(params, user);
|
||||
} else {
|
||||
// 封存
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doDepartmentCancel(map, user);
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doDepartmentCancel(params, user);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -420,27 +366,7 @@ public class OrganizationSyncEc {
|
|||
* 更新部门
|
||||
*/
|
||||
private void updateDepartment() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
buildEcDepartmentData(map);
|
||||
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")));
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).editDepartment(map, user);
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).editDepartment(params, user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -454,94 +380,22 @@ public class OrganizationSyncEc {
|
|||
* 更新分部
|
||||
*/
|
||||
private void updateCompany() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 获取ec表ID
|
||||
buildEcCompanyData(map);
|
||||
map.putAll(params);
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).editSubCompany(map, user);
|
||||
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).editSubCompany(params, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 封存、解封分部
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private void buildEcCompanyData(Map<String, Object> map) {
|
||||
String ecCompanyId = Util.null2String(params.get("id"));
|
||||
|
||||
map.put("id", ecCompanyId);
|
||||
RecordSet rs = new RecordSet();
|
||||
// 先查拓展表
|
||||
rs.execute("select * from hrmsubcompanydefined where subcomid = '" + ecCompanyId + "'");
|
||||
int colcount = rs.getColCounts();
|
||||
if (rs.next()) {
|
||||
for (int i = 1; i <= colcount; i++) {
|
||||
map.put(rs.getColumnName(i).toLowerCase(), Util.null2String(rs.getString(i)));
|
||||
}
|
||||
}
|
||||
// 再查主表
|
||||
rs.execute("select * from hrmsubcompany where id = '" + ecCompanyId + "'");
|
||||
colcount = rs.getColCounts();
|
||||
if (rs.next()) {
|
||||
for (int i = 1; i <= colcount; i++) {
|
||||
map.put(rs.getColumnName(i).toLowerCase(), Util.null2String(rs.getString(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buildEcDepartmentData(Map<String, Object> map) {
|
||||
String ecDepartment = EcHrmRelationUtil.getEcDepartmentId(Util.null2String(params.get("id")));
|
||||
|
||||
map.put("id", ecDepartment);
|
||||
RecordSet rs = new RecordSet();
|
||||
// 先查拓展表
|
||||
rs.execute("select * from hrmdepartmentdefined where deptid = '" + ecDepartment + "'");
|
||||
int colcount = rs.getColCounts();
|
||||
if (rs.next()) {
|
||||
for (int i = 1; i <= colcount; i++) {
|
||||
map.put(rs.getColumnName(i).toLowerCase(), Util.null2String(rs.getString(i)));
|
||||
}
|
||||
}
|
||||
// 再查主表
|
||||
rs.execute("select id,departmentmark,departmentname,subcompanyid1,supdepid,allsupdepid,canceled,departmentcode,coadjutant,outkey,budgetatuomoveorder,ecology_pinyin_search,tlevel,created,creater,modified,modifier,uuid,showorder,showorderoftree,tenant_key from hrmdepartment where id = '" + ecDepartment + "'");
|
||||
colcount = rs.getColCounts();
|
||||
if (rs.next()) {
|
||||
for (int i = 1; i <= colcount; i++) {
|
||||
map.put(rs.getColumnName(i).toLowerCase(), Util.null2String(rs.getString(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
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();
|
||||
|
|
@ -120,15 +120,15 @@ public class StaffTriggerRunnable implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
private void refreshDepartmentStaff(Long departmentId) {
|
||||
private void refreshDepartmentStaff(Integer departmentId) {
|
||||
if (null == departmentId) {
|
||||
return;
|
||||
}
|
||||
DepartmentPO deptById = getDepartmentMapper().getDeptById(departmentId);
|
||||
if (null != deptById) {
|
||||
updateOrgMap(ModuleTypeEnum.departmentfielddefined.getValue().toString(), departmentId.toString());
|
||||
if (null != deptById.getParentDept() && 0 != deptById.getParentDept()) {
|
||||
refreshDepartmentStaff(deptById.getParentDept());
|
||||
if (null != deptById.getSupDepId() && 0 != deptById.getSupDepId()) {
|
||||
refreshDepartmentStaff(deptById.getSupDepId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package com.engine.organization.transmethod;
|
||||
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -18,8 +18,7 @@ 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;
|
||||
List<CompPO> maps = compMapper.getCompsByIds(DeleteParam.builder().ids(planId).build().getIds());
|
||||
return maps.stream().map(CompPO::getSubCompanyName).collect(Collectors.joining(","));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ import weaver.hrm.User;
|
|||
public class HrmResourceTransMethod {
|
||||
|
||||
public static String getDepartmentName(String departmentId) {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(Long.parseLong(departmentId));
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(Integer.parseInt(departmentId));
|
||||
}
|
||||
|
||||
public static String getCompanyName(String companyId) {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class).listById(Long.parseLong(companyId)).getCompName();
|
||||
return MapperProxyFactory.getProxy(CompMapper.class).listById(Integer.parseInt(companyId)).getSubCompanyName();
|
||||
}
|
||||
public static String getJobName(String jobTitle) {
|
||||
return MapperProxyFactory.getProxy(JobMapper.class).getJobById(Long.parseLong(jobTitle)).getJobName();
|
||||
|
|
|
|||
|
|
@ -13,10 +13,11 @@ import java.util.List;
|
|||
public class ConfigTrans {
|
||||
|
||||
public static String getCheckBoxPopedom(String status) {
|
||||
if ("0".equals(status))
|
||||
if ("0".equals(status)) {
|
||||
return "true";
|
||||
else
|
||||
} else {
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Object> formatSourceOperates(String id, String isDefault) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class PageInfoSortUtil {
|
|||
* @param sortParams
|
||||
* @return
|
||||
*/
|
||||
public static String getSortSql(String sortParams) {
|
||||
public static String getSortSql(String sortParams, String defaultOrder) {
|
||||
JSONArray jsonArray = JSONObject.parseArray(sortParams);
|
||||
if (CollectionUtils.isNotEmpty(jsonArray)) {
|
||||
JSONObject jsonObject = (JSONObject) jsonArray.get(0);
|
||||
|
|
@ -28,7 +28,7 @@ public class PageInfoSortUtil {
|
|||
String sortOrder = jsonObject.getString("sortOrder").replace("end", "");
|
||||
return "t." + orderKey + " " + sortOrder;
|
||||
}
|
||||
return " showOrder ";
|
||||
return defaultOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -39,7 +39,7 @@ public class PageInfoSortUtil {
|
|||
*/
|
||||
private static String upperCharToUnderLine(String param) {
|
||||
Pattern p = Pattern.compile("[A-Z]");
|
||||
if (param == null || param.equals("")) {
|
||||
if (param == null || "".equals(param)) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder builder = new StringBuilder(param);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class ResponseResult<T, R> {
|
|||
private void permission() {
|
||||
if (permission) {
|
||||
List<Object> roleInfo = hrmCommonService.getRoleInfo(user.getUID());
|
||||
roleInfo.stream().map(m -> (Map) m).filter(m -> m.get("roleid") != null && m.get("roleid").toString().equals("28")).findFirst().orElseThrow(() -> new OrganizationRunTimeException("无权限"));
|
||||
roleInfo.stream().map(m -> (Map) m).filter(m -> m.get("roleid") != null && "28".equals(m.get("roleid").toString())).findFirst().orElseThrow(() -> new OrganizationRunTimeException("无权限"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
public class DetachUtil {
|
||||
private boolean DETACH = "true".equals(new BaseBean().getPropValue("hrmOrganization", "detach"));
|
||||
|
||||
private final List<Long> jclRoleLevels;
|
||||
private final List<Integer> jclRoleLevels;
|
||||
|
||||
public DetachUtil(Integer uId) {
|
||||
if (1 == uId) {
|
||||
|
|
@ -47,7 +47,7 @@ public class DetachUtil {
|
|||
*/
|
||||
public void filterDepartmentList(List<DepartmentPO> departmentList) {
|
||||
if (DETACH && CollectionUtils.isNotEmpty(departmentList)) {
|
||||
departmentList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp()));
|
||||
departmentList.removeIf(item -> !jclRoleLevels.contains(item.getSubCompanyId1()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -221,7 +221,9 @@ public class FieldDefinedValueUtil {
|
|||
} else if (fieldType == 161 || fieldType == 162) { //自定义浏览按钮
|
||||
try {
|
||||
String fieldDbType = requestId;//用requestid传递数据 dmlurl
|
||||
if (Util.null2String(fieldDbType).length() == 0 || fieldDbType.equals("emptyVal")) return "";
|
||||
if (Util.null2String(fieldDbType).length() == 0 || "emptyVal".equals(fieldDbType)) {
|
||||
return "";
|
||||
}
|
||||
String sql = "select count(1) from mode_browser where showname = '" + fieldDbType + "'";
|
||||
rs.execute(sql);
|
||||
if (rs.next()) {//建模浏览框
|
||||
|
|
@ -239,7 +241,7 @@ public class FieldDefinedValueUtil {
|
|||
try {
|
||||
BrowserBean bb = browser.searchById(s);
|
||||
String name = Util.null2String(bb.getName());
|
||||
if (showName.toString().equals("")) {
|
||||
if ("".equals(showName.toString())) {
|
||||
showName.append(name);
|
||||
} else {
|
||||
showName.append(",").append(name);
|
||||
|
|
@ -254,12 +256,12 @@ public class FieldDefinedValueUtil {
|
|||
}
|
||||
|
||||
} else if (fieldType == 256 || fieldType == 257) {
|
||||
if (!fieldValue.equals("null")) {
|
||||
if (!"null".equals(fieldValue)) {
|
||||
CustomTreeUtil customTreeUtil = new CustomTreeUtil();
|
||||
for (String s : tempshowidlist) {
|
||||
String show_val = Util.null2String(s);
|
||||
String name = customTreeUtil.getTreeFieldShowName(show_val, requestId);
|
||||
if (showName.toString().equals("")) {
|
||||
if ("".equals(showName.toString())) {
|
||||
showName.append(name);
|
||||
} else {
|
||||
showName.append(",").append(name);
|
||||
|
|
@ -274,8 +276,8 @@ public class FieldDefinedValueUtil {
|
|||
+ fieldType);
|
||||
String keyColumName = new BrowserComInfo()
|
||||
.getBrowserkeycolumname("" + fieldType);
|
||||
if (columName.equals("") || tableName.equals("")
|
||||
|| keyColumName.equals("") || fieldValue.equals("")) {
|
||||
if ("".equals(columName) || "".equals(tableName)
|
||||
|| "".equals(keyColumName) || "".equals(fieldValue)) {
|
||||
new BaseBean().writeLog("GET FIELD ERR: fieldType=" + fieldType);
|
||||
} else {
|
||||
sql = "select " + columName + " from " + tableName
|
||||
|
|
@ -291,7 +293,7 @@ public class FieldDefinedValueUtil {
|
|||
showName = new StringBuilder(showName.substring(0, showName.length() - 1));
|
||||
}
|
||||
} else if (fieldHtmlType == 4) { // check框
|
||||
if (fieldValue.equals("1")) {
|
||||
if ("1".equals(fieldValue)) {
|
||||
showName.append("√");
|
||||
}
|
||||
} else if (fieldHtmlType == 5) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
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.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
|
|
@ -10,9 +8,7 @@ import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
|||
import com.engine.organization.mapper.job.JobMapper;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
@ -42,71 +38,6 @@ public class EcHrmRelationUtil {
|
|||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据jcl_org_comp.id获取HrmSubCompany.id
|
||||
*
|
||||
* @param companyId
|
||||
* @return
|
||||
*/
|
||||
public static String getEcCompanyId(String companyId) {
|
||||
CompPO compPO = getCompMapper().listById(Long.parseLong(companyId));
|
||||
RecordInfo supSubCompany = getSystemDataMapper().getHrmObjectByUUID(HRM_COMPANY, compPO.getUuid());
|
||||
if (null == supSubCompany) {
|
||||
return "0";
|
||||
}
|
||||
return supSubCompany.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据jcl_org_dept.id获取HrmDepartment.id
|
||||
*
|
||||
* @param departmentId
|
||||
* @return
|
||||
*/
|
||||
public static String getEcDepartmentId(String departmentId) {
|
||||
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(Long.parseLong(departmentId));
|
||||
RecordInfo supDepartment = getSystemDataMapper().getHrmObjectByUUID(HRM_DEPARTMENT, departmentPO.getUuid());
|
||||
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) {
|
||||
if (StringUtils.isBlank(ecDepartmentId)) {
|
||||
return null;
|
||||
}
|
||||
RecordInfo ecDepartment = getSystemDataMapper().getHrmObjectByID(HRM_DEPARTMENT, ecDepartmentId);
|
||||
if (null == ecDepartment) {
|
||||
return null;
|
||||
}
|
||||
String uuid = ecDepartment.getUuid();
|
||||
return getDepartmentMapper().getDepartmentByUUID(uuid);
|
||||
}
|
||||
|
||||
public static String getEcJobId(Long jclJobId) {
|
||||
JobPO jobById = getJobMapper().getJobById(jclJobId);
|
||||
if (null == jobById) {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,9 @@ public class ResourceSyncUtil {
|
|||
}
|
||||
String loginid = Util.null2String(params.get("loginid"));
|
||||
String accounttype = Util.null2s(Util.fromScreen3(Util.null2String(params.get(("accounttype"))), user.getLanguage()), "0");
|
||||
if (accounttype.equals("1")) loginid = "";//次账号没有loginid
|
||||
if ("1".equals(accounttype)) {
|
||||
loginid = "";//次账号没有loginid
|
||||
}
|
||||
boolean canSave = false;
|
||||
LN LN = new LN();
|
||||
int ckHrmnum = LN.CkHrmnum();
|
||||
|
|
@ -101,7 +103,7 @@ public class ResourceSyncUtil {
|
|||
}
|
||||
|
||||
|
||||
if (!loginid.equals("") && "0".equals(accounttype)) {
|
||||
if (!"".equals(loginid) && "0".equals(accounttype)) {
|
||||
sql = "select count(1) from hrmresourceallview where loginid='" + loginid + "' ";
|
||||
rs.execute(sql);
|
||||
if (rs.next()) {
|
||||
|
|
@ -115,7 +117,7 @@ public class ResourceSyncUtil {
|
|||
|
||||
String departmentid = Util.null2String(params.get("departmentid"));
|
||||
String subcompanyid = departmentComInfo.getSubcompanyid1(departmentid);
|
||||
if (!loginid.equals("") && !subcompanyid.equals("0") && new HrmResourceManager().noMore(subcompanyid)) {
|
||||
if (!"".equals(loginid) && !"0".equals(subcompanyid) && new HrmResourceManager().noMore(subcompanyid)) {
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", SystemEnv.getHtmlLabelName(81926, user.getLanguage()));
|
||||
return retmap;
|
||||
|
|
@ -148,14 +150,14 @@ public class ResourceSyncUtil {
|
|||
//【初始密码】
|
||||
String defaultPassword = Util.null2String(settings.getDefaultPassword());
|
||||
//如果管理员设置的密码为空。并且开启了【启用初始密码】,且初始密码不为空,则默认取初始密码作为密码
|
||||
if (password.equals("") && defaultPasswordEnable.equals("1") && !defaultPassword.equals("")) {
|
||||
if ("".equals(password) && "1".equals(defaultPasswordEnable) && !"".equals(defaultPassword)) {
|
||||
password = defaultPassword;
|
||||
}
|
||||
|
||||
//判断是否开启了【禁止弱密码保存】
|
||||
String weakPasswordDisable = Util.null2s(settings.getWeakPasswordDisable(), "0");
|
||||
if (weakPasswordDisable.equals("1")) {
|
||||
if (!password.equals("")) {//密码为空的情况
|
||||
if ("1".equals(weakPasswordDisable)) {
|
||||
if (!"".equals(password)) {//密码为空的情况
|
||||
//判断是否为弱密码
|
||||
HrmWeakPasswordUtil hrmWeakPasswordUtil = new HrmWeakPasswordUtil();
|
||||
if (hrmWeakPasswordUtil.isWeakPsd(password)) {
|
||||
|
|
@ -186,8 +188,10 @@ public class ResourceSyncUtil {
|
|||
String workstartdate = Util.null2String(params.get("workstartdate"));//参加工作日期
|
||||
String companystartdate = Util.null2String(params.get("companystartdate"));//入职日期
|
||||
String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
|
||||
if (dsporder.length() == 0) dsporder = "" + id;
|
||||
if (accounttype.equals("0")) {
|
||||
if (dsporder.length() == 0) {
|
||||
dsporder = "" + id;
|
||||
}
|
||||
if ("0".equals(accounttype)) {
|
||||
|
||||
String encrptPassword = "";
|
||||
String salt = "";
|
||||
|
|
@ -224,8 +228,8 @@ public class ResourceSyncUtil {
|
|||
//OA与第三方接口单条数据同步方法结束
|
||||
//BBS集成相关
|
||||
String bbsLingUrl = new weaver.general.BaseBean().getPropValue(GCONST.getConfigFile(), "ecologybbs.linkUrl");
|
||||
if (!password.equals("0")) {
|
||||
if (!bbsLingUrl.equals("")) {
|
||||
if (!"0".equals(password)) {
|
||||
if (!"".equals(bbsLingUrl)) {
|
||||
new Thread(new weaver.bbs.BBSRunnable(loginid, password)).start();
|
||||
}
|
||||
}
|
||||
|
|
@ -283,7 +287,9 @@ public class ResourceSyncUtil {
|
|||
String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
|
||||
String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage());
|
||||
String systemlanguage = Util.null2String(params.get("systemlanguage"));
|
||||
if (systemlanguage.equals("") || systemlanguage.equals("0")) systemlanguage = "7";
|
||||
if ("".equals(systemlanguage) || "0".equals(systemlanguage)) {
|
||||
systemlanguage = "7";
|
||||
}
|
||||
String belongto = Util.fromScreen3(Util.null2String(params.get("belongto")), user.getLanguage());
|
||||
//应聘人员id
|
||||
String rcid = Util.null2String(params.get("rcId"));
|
||||
|
|
@ -305,8 +311,10 @@ public class ResourceSyncUtil {
|
|||
}
|
||||
|
||||
|
||||
if (dsporder.length() == 0) dsporder = id;
|
||||
if (accounttype.equals("0")) {
|
||||
if (dsporder.length() == 0) {
|
||||
dsporder = id;
|
||||
}
|
||||
if ("0".equals(accounttype)) {
|
||||
belongto = "-1";
|
||||
}
|
||||
String departmentvirtualids = Util.null2String(params.get("departmentvirtualids"));//虚拟部门id;
|
||||
|
|
@ -314,12 +322,12 @@ public class ResourceSyncUtil {
|
|||
//Td9325,解决多账号次账号没有登陆Id在浏览框组织结构中无法显示的问题。
|
||||
boolean falg = false;
|
||||
String loginid = "";
|
||||
if (accounttype.equals("1")) {
|
||||
if ("1".equals(accounttype)) {
|
||||
rs.execute("select loginid from HrmResource where id =" + belongto);
|
||||
if (rs.next()) {
|
||||
loginid = rs.getString("loginid");
|
||||
}
|
||||
if (!loginid.equals("")) {
|
||||
if (!"".equals(loginid)) {
|
||||
String maxidsql = "select max(id) as id from HrmResource where loginid like '" + loginid + "%'";
|
||||
rs.execute(maxidsql);
|
||||
if (rs.next()) {
|
||||
|
|
@ -356,8 +364,12 @@ public class ResourceSyncUtil {
|
|||
while (rs.next()) {
|
||||
String tmp_managerstr = rs.getString("managerstr");
|
||||
//处理managerstr 不以逗号开始或者结束的情况 形如 managerstr:8 begin
|
||||
if (!tmp_managerstr.startsWith(",")) tmp_managerstr = "," + tmp_managerstr;
|
||||
if (!tmp_managerstr.endsWith(",")) tmp_managerstr = tmp_managerstr + ",";
|
||||
if (!tmp_managerstr.startsWith(",")) {
|
||||
tmp_managerstr = "," + tmp_managerstr;
|
||||
}
|
||||
if (!tmp_managerstr.endsWith(",")) {
|
||||
tmp_managerstr = tmp_managerstr + ",";
|
||||
}
|
||||
//处理managerstr 不以逗号开始或者结束的情况 形如 managerstr:8 end
|
||||
managerstr += tmp_managerstr;
|
||||
managerstr = "," + managerid + managerstr;
|
||||
|
|
@ -368,17 +380,37 @@ public class ResourceSyncUtil {
|
|||
RecordSetTrans rst = new RecordSetTrans();
|
||||
rst.setAutoCommit(false);
|
||||
try {
|
||||
if (resourceimageid.length() == 0) resourceimageid = "null";
|
||||
if (costcenterid.length() == 0) costcenterid = "null";
|
||||
if (managerid.length() == 0) managerid = "null";
|
||||
if (assistantid.length() == 0) assistantid = "null";
|
||||
if (accounttype.length() == 0) accounttype = "null";
|
||||
if (belongto.length() == 0) belongto = "null";
|
||||
if (jobcall.length() == 0) jobcall = "null";
|
||||
if (mobileshowtype.length() == 0) mobileshowtype = "null";
|
||||
if (rst.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
if (joblevel.length() == 0) joblevel = null;
|
||||
if (dsporder.length() == 0) dsporder = null;
|
||||
if (resourceimageid.length() == 0) {
|
||||
resourceimageid = "null";
|
||||
}
|
||||
if (costcenterid.length() == 0) {
|
||||
costcenterid = "null";
|
||||
}
|
||||
if (managerid.length() == 0) {
|
||||
managerid = "null";
|
||||
}
|
||||
if (assistantid.length() == 0) {
|
||||
assistantid = "null";
|
||||
}
|
||||
if (accounttype.length() == 0) {
|
||||
accounttype = "null";
|
||||
}
|
||||
if (belongto.length() == 0) {
|
||||
belongto = "null";
|
||||
}
|
||||
if (jobcall.length() == 0) {
|
||||
jobcall = "null";
|
||||
}
|
||||
if (mobileshowtype.length() == 0) {
|
||||
mobileshowtype = "null";
|
||||
}
|
||||
if ("postgresql".equalsIgnoreCase(rst.getDBType())) {
|
||||
if (joblevel.length() == 0) {
|
||||
joblevel = null;
|
||||
}
|
||||
if (dsporder.length() == 0) {
|
||||
dsporder = null;
|
||||
}
|
||||
}
|
||||
workcode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.USER, subcmpanyid1, departmentid, jobtitle, workcode);
|
||||
para = new StringBuilder("" + id + separator + workcode + separator + lastname + separator + sex + separator + resourceimageid + separator +
|
||||
|
|
@ -420,7 +452,9 @@ public class ResourceSyncUtil {
|
|||
para = new StringBuilder("" + id);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int idx = i;
|
||||
if (formdefined) idx++;
|
||||
if (formdefined) {
|
||||
idx++;
|
||||
}
|
||||
String datefield = Util.null2String(params.get("datefield" + idx));
|
||||
String numberfield = "" + Util.getDoubleValue(Util.null2String(params.get("numberfield" + idx)), 0);
|
||||
String textfield = Util.null2String(params.get("textfield" + idx));
|
||||
|
|
@ -443,7 +477,7 @@ public class ResourceSyncUtil {
|
|||
for (Map.Entry<String, String> me : mapShowSets.entrySet()) {
|
||||
String fieldName = me.getKey();
|
||||
String fieldVal = Util.null2String(mapShowSets.get(fieldName));
|
||||
if (fieldVal.equals("1")) {
|
||||
if ("1".equals(fieldVal)) {
|
||||
String tmpPK = id + "__" + fieldName;
|
||||
String tmpPvalue = Util.null2String(params.get(fieldName + "showtype"));
|
||||
insertSql = "insert into userprivacysetting (combinedid,userid,ptype,pvalue) values('" + tmpPK + "','" + id + "','" + fieldName + "','" + tmpPvalue + "')";
|
||||
|
|
@ -483,7 +517,7 @@ public class ResourceSyncUtil {
|
|||
Subject += ":" + lastname;
|
||||
|
||||
//modifier by lvyi 2013-12-31
|
||||
if (settings.getEntervalid().equals("1")) {//入职提醒
|
||||
if ("1".equals(settings.getEntervalid())) {//入职提醒
|
||||
String thesql = "select hrmids from HrmInfoMaintenance where id<4 or id = 10";
|
||||
rs.execute(thesql);
|
||||
StringBuilder members = new StringBuilder();
|
||||
|
|
@ -493,7 +527,7 @@ public class ResourceSyncUtil {
|
|||
members.append(",").append(rs.getString("hrmids"));
|
||||
}
|
||||
}
|
||||
if (!members.toString().equals("")) {
|
||||
if (!"".equals(members.toString())) {
|
||||
members = new StringBuilder(members.substring(1));
|
||||
members = new StringBuilder(new HrmResourceBaseService().duplicateRemoval(members.toString(), user.getUID() + ""));
|
||||
SWFAccepter = members.toString();
|
||||
|
|
@ -531,9 +565,13 @@ public class ResourceSyncUtil {
|
|||
String healthinfo = Util.null2String(rs.getString("healthinfo"));
|
||||
|
||||
String height = Util.null2String(rs.getString("height"));
|
||||
if (height.contains(".")) height = height.substring(0, height.indexOf("."));
|
||||
if (height.contains(".")) {
|
||||
height = height.substring(0, height.indexOf("."));
|
||||
}
|
||||
String weight = Util.null2String(rs.getString("weight"));
|
||||
if (weight.contains(".")) weight = weight.substring(0, weight.indexOf("."));
|
||||
if (weight.contains(".")) {
|
||||
weight = weight.substring(0, weight.indexOf("."));
|
||||
}
|
||||
|
||||
String residentplace = Util.null2String(rs.getString("residentplace"));
|
||||
String homeaddress = Util.null2String(rs.getString("homeaddress"));
|
||||
|
|
@ -555,7 +593,9 @@ public class ResourceSyncUtil {
|
|||
rs.execute(" select count(*) from HrmResourceVirtual where departmentid ='" + s + "' and resourceid = " + id);
|
||||
if (rs.next()) {
|
||||
//如果已存在 无需处理
|
||||
if (rs.getInt(1) > 0) continue;
|
||||
if (rs.getInt(1) > 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//写入
|
||||
|
|
@ -630,7 +670,9 @@ public class ResourceSyncUtil {
|
|||
resourceimageid = ServiceUtil.saveResourceImage(resourceimageBase64);
|
||||
}
|
||||
String oldresourceimageid = Util.null2String(params.get("oldresourceimage"));
|
||||
if (resourceimageid.equals("")) resourceimageid = oldresourceimageid;
|
||||
if ("".equals(resourceimageid)) {
|
||||
resourceimageid = oldresourceimageid;
|
||||
}
|
||||
String departmentid = Util.fromScreen3(Util.null2String(params.get("departmentid")), user.getLanguage());
|
||||
String costcenterid = Util.fromScreen3(Util.null2String(params.get("costcenterid")), user.getLanguage());
|
||||
String jobtitle = Util.fromScreen3(Util.null2String(params.get("jobtitle")), user.getLanguage());
|
||||
|
|
@ -650,13 +692,15 @@ public class ResourceSyncUtil {
|
|||
String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
|
||||
String jobcall = Util.fromScreen3(Util.null2String(params.get("jobcall")), user.getLanguage());
|
||||
String systemlanguage = Util.fromScreen3(Util.null2String(params.get("systemlanguage")), user.getLanguage());
|
||||
if (systemlanguage.equals("") || systemlanguage.equals("0")) {
|
||||
if ("".equals(systemlanguage) || "0".equals(systemlanguage)) {
|
||||
systemlanguage = "7";
|
||||
}
|
||||
String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage());
|
||||
String belongto = Util.fromScreen3(Util.null2String(params.get("belongto")), user.getLanguage());
|
||||
if (dsporder.length() == 0) dsporder = id;
|
||||
if (accounttype.equals("0")) {
|
||||
if (dsporder.length() == 0) {
|
||||
dsporder = id;
|
||||
}
|
||||
if ("0".equals(accounttype)) {
|
||||
belongto = "-1";
|
||||
}
|
||||
|
||||
|
|
@ -707,18 +751,18 @@ public class ResourceSyncUtil {
|
|||
}
|
||||
|
||||
String thisAccounttype = rs.getString("accounttype");
|
||||
if (thisAccounttype.equals("1") && accounttype.equals("0")) {
|
||||
if ("1".equals(thisAccounttype) && "0".equals(accounttype)) {
|
||||
oldbelongto = rs.getString("belongto");
|
||||
}
|
||||
}
|
||||
|
||||
if (accounttype.equals("1") && loginid.equalsIgnoreCase("")) {
|
||||
if ("1".equals(accounttype) && "".equalsIgnoreCase(loginid)) {
|
||||
rs.execute("select loginid from HrmResource where id =" + belongto);
|
||||
if (rs.next()) {
|
||||
loginid = rs.getString(1);
|
||||
}
|
||||
|
||||
if (!loginid.equals("")) {
|
||||
if (!"".equals(loginid)) {
|
||||
loginid = loginid + (id + 1);
|
||||
falg = true;
|
||||
}
|
||||
|
|
@ -731,19 +775,39 @@ public class ResourceSyncUtil {
|
|||
oldmanagerid = rs.getString("managerid");
|
||||
oldmanagerstr = rs.getString("managerstr");
|
||||
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr:8 begin
|
||||
if (!oldmanagerstr.startsWith(",")) oldmanagerstr = "," + oldmanagerstr;
|
||||
if (!oldmanagerstr.endsWith(",")) oldmanagerstr = oldmanagerstr + ",";
|
||||
if (!oldmanagerstr.startsWith(",")) {
|
||||
oldmanagerstr = "," + oldmanagerstr;
|
||||
}
|
||||
if (!oldmanagerstr.endsWith(",")) {
|
||||
oldmanagerstr = oldmanagerstr + ",";
|
||||
}
|
||||
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr:8 end
|
||||
}
|
||||
//mysql报错问题java.sql.SQLException: Incorrect integer value: '' for column 'COSTCENTERID' at row 1
|
||||
if(resourceimageid.length()==0)resourceimageid="null";
|
||||
if(costcenterid.length()==0)costcenterid="null";
|
||||
if(managerid.length()==0)managerid="null";
|
||||
if(assistantid.length()==0)assistantid="null";
|
||||
if(accounttype.length()==0)accounttype="null";
|
||||
if(belongto.length()==0)belongto="null";
|
||||
if(jobcall.length()==0)jobcall="null";
|
||||
if(mobileshowtype.length()==0)mobileshowtype="null";
|
||||
if(resourceimageid.length()==0) {
|
||||
resourceimageid="null";
|
||||
}
|
||||
if(costcenterid.length()==0) {
|
||||
costcenterid="null";
|
||||
}
|
||||
if(managerid.length()==0) {
|
||||
managerid="null";
|
||||
}
|
||||
if(assistantid.length()==0) {
|
||||
assistantid="null";
|
||||
}
|
||||
if(accounttype.length()==0) {
|
||||
accounttype="null";
|
||||
}
|
||||
if(belongto.length()==0) {
|
||||
belongto="null";
|
||||
}
|
||||
if(jobcall.length()==0) {
|
||||
jobcall="null";
|
||||
}
|
||||
if(mobileshowtype.length()==0) {
|
||||
mobileshowtype="null";
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(workcode)) {
|
||||
CodeRuleManager.getCodeRuleManager().checkReservedIfDel(RuleCodeType.USER.getValue(), workcode);
|
||||
|
|
@ -792,7 +856,7 @@ public class ResourceSyncUtil {
|
|||
for (Map.Entry<String, String> me : mapShowSets.entrySet()) {
|
||||
String fieldName = me.getKey();
|
||||
String fieldVal = Util.null2String(mapShowSets.get(fieldName));
|
||||
if (fieldVal.equals("1")) {
|
||||
if ("1".equals(fieldVal)) {
|
||||
String tmpPK = id + "__" + fieldName;
|
||||
String tmpPvalue = Util.null2String(params.get(fieldName + "showtype"));
|
||||
insertSql = "insert into userprivacysetting (combinedid,userid,ptype,pvalue) values('" + tmpPK + "','" + id + "','" + fieldName + "','" + tmpPvalue + "')";
|
||||
|
|
@ -814,8 +878,12 @@ public class ResourceSyncUtil {
|
|||
while (rs.next()) {
|
||||
managerstr = rs.getString("managerstr");
|
||||
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr:8 begin
|
||||
if (!managerstr.startsWith(",")) managerstr = "," + managerstr;
|
||||
if (!managerstr.endsWith(",")) managerstr = managerstr + ",";
|
||||
if (!managerstr.startsWith(",")) {
|
||||
managerstr = "," + managerstr;
|
||||
}
|
||||
if (!managerstr.endsWith(",")) {
|
||||
managerstr = managerstr + ",";
|
||||
}
|
||||
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr:8 end
|
||||
managerstr = "," + managerid + managerstr;
|
||||
managerstr = managerstr.endsWith(",") ? managerstr : (managerstr + ",");
|
||||
|
|
@ -845,13 +913,18 @@ public class ResourceSyncUtil {
|
|||
while (rs.next()) {
|
||||
String nowmanagerstr = Util.null2String(rs.getString("managerstr"));
|
||||
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr:8 begin
|
||||
if (!nowmanagerstr.startsWith(",")) nowmanagerstr = "," + nowmanagerstr;
|
||||
if (!nowmanagerstr.endsWith(",")) nowmanagerstr = nowmanagerstr + ",";
|
||||
if (!nowmanagerstr.startsWith(",")) {
|
||||
nowmanagerstr = "," + nowmanagerstr;
|
||||
}
|
||||
if (!nowmanagerstr.endsWith(",")) {
|
||||
nowmanagerstr = nowmanagerstr + ",";
|
||||
}
|
||||
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr:8 end
|
||||
String resourceid = rs.getString("id");
|
||||
//指定上级为自身的情况,不更新自身上级
|
||||
if (id.equals(resourceid))
|
||||
if (id.equals(resourceid)) {
|
||||
continue;
|
||||
}
|
||||
String nowmanagerstr2 = "";
|
||||
int index = nowmanagerstr.lastIndexOf(oldmanagerstr);
|
||||
if (index != -1) {
|
||||
|
|
@ -902,7 +975,9 @@ public class ResourceSyncUtil {
|
|||
para = new StringBuilder("" + id);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int idx = i;
|
||||
if (formdefined) idx++;
|
||||
if (formdefined) {
|
||||
idx++;
|
||||
}
|
||||
String datefield = Util.null2String(params.get("datefield" + idx));
|
||||
String numberfield = "" + Util.getDoubleValue(Util.null2String(params.get("numberfield" + idx)), 0);
|
||||
String textfield = Util.null2String(params.get("textfield" + idx));
|
||||
|
|
@ -926,10 +1001,10 @@ public class ResourceSyncUtil {
|
|||
|
||||
//处理次账号修改为主账号时,检查次账号所属 主账号的 其他设置是否需要修改 add by kzw QC159888
|
||||
try {
|
||||
if (!oldbelongto.equals("")) {
|
||||
if (!"".equals(oldbelongto)) {
|
||||
HrmUserSettingComInfo userSetting = new HrmUserSettingComInfo();
|
||||
String belongtoshow = userSetting.getBelongtoshowByUserId(oldbelongto);
|
||||
if (belongtoshow.equals("1")) {
|
||||
if ("1".equals(belongtoshow)) {
|
||||
rs.execute("select id from hrmresource where belongto = " + oldbelongto);
|
||||
if (!rs.next()) {
|
||||
String setId = userSetting.getId(oldbelongto);
|
||||
|
|
|
|||
|
|
@ -134,8 +134,9 @@ public class OrgImportUtil {
|
|||
*/
|
||||
public static String getCellValue(XSSFCell cell) {
|
||||
String cellValue = "";
|
||||
if (cell == null)
|
||||
if (cell == null) {
|
||||
return "";
|
||||
}
|
||||
switch (cell.getCellType()) {
|
||||
case BOOLEAN: // 得到Boolean对象的方法
|
||||
cellValue = String.valueOf(cell.getBooleanCellValue());
|
||||
|
|
@ -146,8 +147,9 @@ public class OrgImportUtil {
|
|||
cellValue = sft.format(cell.getDateCellValue()); // 读取日期格式
|
||||
} else {
|
||||
cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字
|
||||
if (cellValue.endsWith(".0"))
|
||||
if (cellValue.endsWith(".0")) {
|
||||
cellValue = cellValue.substring(0, cellValue.indexOf("."));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FORMULA: // 读取公式
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import com.engine.organization.mapper.staff.StaffMapper;
|
|||
import com.engine.organization.mapper.staff.StaffPlanMapper;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
|
|
@ -83,8 +82,8 @@ public class StaffInfoImportUtil {
|
|||
}
|
||||
// 组装待处理数据
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Long parentCompanyId = null;
|
||||
Long parentDepartmentId = null;
|
||||
Integer parentCompanyId = null;
|
||||
Integer parentDepartmentId = null;
|
||||
Long parentJobId = null;
|
||||
StaffPlanPO staffPlanPO = null;
|
||||
|
||||
|
|
@ -161,7 +160,7 @@ public class StaffInfoImportUtil {
|
|||
}
|
||||
}
|
||||
map.put("comp_id", parentCompanyId);
|
||||
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(parentCompanyId)));
|
||||
map.put("ec_company", parentCompanyId);
|
||||
}
|
||||
// 部门
|
||||
if ("dept_id".equals(infoPO.getFieldName())) {
|
||||
|
|
@ -185,9 +184,7 @@ public class StaffInfoImportUtil {
|
|||
}
|
||||
|
||||
map.put("dept_id", parentDepartmentId);
|
||||
if (null != parentDepartmentId) {
|
||||
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId)));
|
||||
}
|
||||
map.put("ec_department", parentDepartmentId);
|
||||
}
|
||||
|
||||
// 岗位
|
||||
|
|
@ -261,8 +258,8 @@ public class StaffInfoImportUtil {
|
|||
if (null == deptById) {
|
||||
checkMsg = "未找到对应部门!";
|
||||
} else {
|
||||
param.setCompId(deptById.getParentComp());
|
||||
param.setEcCompany(deptById.getEcCompany());
|
||||
param.setCompId(deptById.getSubCompanyId1());
|
||||
param.setEcCompany(deptById.getSubCompanyId1());
|
||||
}
|
||||
}
|
||||
// 取消岗位赋值
|
||||
|
|
|
|||
|
|
@ -262,13 +262,13 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
RemindSettings settings = reminder.getRemindSettings();
|
||||
//判断是否启用【启用初始密码】
|
||||
//是否启用初始密码:false-不启用初始密码、true-启用初始密码
|
||||
boolean defaultPasswordEnable = Util.null2String(settings.getDefaultPasswordEnable()).equals("1");
|
||||
boolean defaultPasswordEnable = "1".equals(Util.null2String(settings.getDefaultPasswordEnable()));
|
||||
//初始密码
|
||||
//初始密码
|
||||
String defaultPassword = Util.null2String(settings.getDefaultPassword());
|
||||
//判断是否启用【弱密码禁止保存】
|
||||
//弱密码禁止保存:false-允许保存弱密码、true-不允许保存弱密码
|
||||
boolean weakPasswordDisable = Util.null2String(settings.getWeakPasswordDisable()).equals("1");
|
||||
boolean weakPasswordDisable = "1".equals(Util.null2String(settings.getWeakPasswordDisable()));
|
||||
try {
|
||||
//判断是否为弱密码
|
||||
hrmWeakPasswordUtil = new HrmWeakPasswordUtil();
|
||||
|
|
@ -287,7 +287,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
//TimeUnit.SECONDS.sleep(1);
|
||||
try { // 异常处理
|
||||
|
||||
if (operateType.equals("add")) {
|
||||
if ("add".equals(operateType)) {
|
||||
|
||||
if (keyMap.get(key) != null) {
|
||||
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83520, userlanguage)));
|
||||
|
|
@ -398,7 +398,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
|
||||
int belongto = getBelongId(vo.getBelongto(), keyField);
|
||||
hrm.setBelongto(belongto);
|
||||
if (!vo.getBelongto().equals("") && belongto == 0) {
|
||||
if (!"".equals(vo.getBelongto()) && belongto == 0) {
|
||||
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
|
||||
continue;
|
||||
} else {
|
||||
|
|
@ -415,7 +415,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
} else if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
|
||||
int belongto = getBelongId(vo.getBelongto(), keyField);
|
||||
hrm.setBelongto(belongto);
|
||||
if (!vo.getBelongto().equals("") && belongto == 0) {
|
||||
if (!"".equals(vo.getBelongto()) && belongto == 0) {
|
||||
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
|
||||
continue;
|
||||
} else {
|
||||
|
|
@ -463,7 +463,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
hrm.setManagerstr(managerstr);
|
||||
|
||||
//如果vo.getManagerid()有值,但manageid未找到,说明填写有误
|
||||
if (!vo.getManagerid().equals("") && managerid == 0) {
|
||||
if (!"".equals(vo.getManagerid()) && managerid == 0) {
|
||||
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage)));
|
||||
continue;
|
||||
}
|
||||
|
|
@ -478,7 +478,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
int assistantid;
|
||||
assistantid = getAssistantid(vo.getAssistantid(), keyField);
|
||||
hrm.setAssistantid(assistantid);
|
||||
if (!vo.getAssistantid().equals("") && assistantid == 0) {
|
||||
if (!"".equals(vo.getAssistantid()) && assistantid == 0) {
|
||||
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage)));
|
||||
continue;
|
||||
}
|
||||
|
|
@ -513,10 +513,12 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
|
||||
//mobile-sunjsh
|
||||
if (vo.getMobile() != null) {
|
||||
if ("".equals(vo.getMobile().trim()) || (!"".equals(vo.getMobile().trim()) && vo.getMobile().contains("*")))
|
||||
if ("".equals(vo.getMobile().trim()) || (!"".equals(vo.getMobile().trim()) && vo.getMobile().contains("*"))) {
|
||||
vo.setMobile(null);
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
hrm.setMobile("");
|
||||
}
|
||||
|
||||
//工资银行-sunjsh
|
||||
if (vo.getBankid1() != null && !"".equals(vo.getBankid1())) {
|
||||
|
|
@ -621,7 +623,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
continue;
|
||||
}
|
||||
//安全级别必须是数字
|
||||
if (!Util.null2String(vo.getSeclevel()).equals("")) {
|
||||
if (!"".equals(Util.null2String(vo.getSeclevel()))) {
|
||||
if (Util.getIntValue(vo.getSeclevel(), -1000) == -1000) {
|
||||
resultList.add(createLog(vo, "创建", "失败", "安全级别必须是数字"));
|
||||
continue;
|
||||
|
|
@ -678,7 +680,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
password_tmp = "1";
|
||||
//人员导入文件中,将密码这一列删除或者密码这一列存在,但是不填写都默认为初始密码
|
||||
if (defaultPasswordEnable) {
|
||||
if (!defaultPassword.equals("")) {
|
||||
if (!"".equals(defaultPassword)) {
|
||||
if (weakPasswordDisable && this.hrmWeakPasswordUtil.isWeakPsd(defaultPassword)) {
|
||||
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(515436, userlanguage)));
|
||||
continue;
|
||||
|
|
@ -728,7 +730,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
} else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) {
|
||||
insertFields.append(s).append(",");
|
||||
String insertValueStr = Util.null2String(hrmField.get(hrm));
|
||||
if ("".equals(insertValueStr) && recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
if ("".equals(insertValueStr) && "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
|
||||
insertValues.append("null,");
|
||||
} else {
|
||||
insertValues.append(hrmField.get(hrm)).append(",");
|
||||
|
|
@ -736,8 +738,8 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
}
|
||||
} else if (voField.get(vo) != null) {
|
||||
if (voFieldType.endsWith("String")) {
|
||||
if (recordSet.getDBType().equalsIgnoreCase("mysql") || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
if (Util.null2String(voField.get(vo)).equals("")) {
|
||||
if ("mysql".equalsIgnoreCase(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
|
||||
if ("".equals(Util.null2String(voField.get(vo)))) {
|
||||
insertFields.append(s).append(",");
|
||||
insertValues.append("null,");
|
||||
} else {
|
||||
|
|
@ -751,7 +753,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
} else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) {
|
||||
insertFields.append(s).append(",");
|
||||
String insertValueStr = Util.null2String(voField.get(vo));
|
||||
if ("".equals(insertValueStr) && recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
if ("".equals(insertValueStr) && "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
|
||||
insertValues.append("null,");
|
||||
} else {
|
||||
insertValues.append(voField.get(vo)).append(",");
|
||||
|
|
@ -775,11 +777,17 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
PasswordUtil.updateResourceSalt(id + "", salt);
|
||||
|
||||
if (updateBaseData(vo.getBaseFields(), vo.getBaseFieldsValue(), id)) //添加基础字段信息
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
if (updatePersonData(vo.getPersonFields(), vo.getPersonFieldsValue(), id)) //添加个人字段信息
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
if (updateWorkData(vo.getWorkFields(), vo.getWorkFieldsValue(), id)) //添加工作字段信息
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*添加人员缓存,人员默认按id显示顺序,HrmResource_Trigger_Insert 人员共享 入职维护项目状态*/
|
||||
|
|
@ -942,7 +950,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
|
||||
int belongto = getBelongId(vo.getBelongto(), keyField);
|
||||
hrm.setBelongto(belongto);
|
||||
if (!vo.getBelongto().equals("") && belongto == 0) {
|
||||
if (!"".equals(vo.getBelongto()) && belongto == 0) {
|
||||
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
|
||||
continue;
|
||||
} else {
|
||||
|
|
@ -959,7 +967,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
} else if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
|
||||
int belongto = getBelongId(vo.getBelongto(), keyField);
|
||||
hrm.setBelongto(belongto);
|
||||
if (!vo.getBelongto().equals("") && belongto == 0) {
|
||||
if (!"".equals(vo.getBelongto()) && belongto == 0) {
|
||||
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
|
||||
continue;
|
||||
} else {
|
||||
|
|
@ -1007,7 +1015,9 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
//}
|
||||
|
||||
new BaseBean().writeLog("hrmId【" + hrmId + "】");
|
||||
if (Util.getIntValue(hrmId) < 0) continue;
|
||||
if (Util.getIntValue(hrmId) < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//上级id
|
||||
String managerstr = ""; //所有上级
|
||||
|
|
@ -1023,7 +1033,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
}
|
||||
|
||||
//如果vo.getManagerid()有值,但manageid未找到,说明填写有误
|
||||
if (vo.getManagerid() != null && !vo.getManagerid().equals("") && managerid == 0) {
|
||||
if (vo.getManagerid() != null && !"".equals(vo.getManagerid()) && managerid == 0) {
|
||||
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage)));
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1044,7 +1054,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (!"".equals(Util.null2String(vo.getAssistantid()))) {
|
||||
int assistantid;
|
||||
assistantid = getAssistantid(vo.getAssistantid(), keyField);
|
||||
if (vo.getAssistantid() != null && !vo.getAssistantid().equals("") && assistantid == 0) {
|
||||
if (vo.getAssistantid() != null && !"".equals(vo.getAssistantid()) && assistantid == 0) {
|
||||
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage)));
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1076,10 +1086,11 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
|
||||
//mobile-sunjsh
|
||||
if (vo.getMobile() != null) {
|
||||
if ("".equals(vo.getMobile().trim()))
|
||||
if ("".equals(vo.getMobile().trim())) {
|
||||
hrm.setMobile("");
|
||||
else if (!"".equals(vo.getMobile().trim()) && vo.getMobile().contains("*"))
|
||||
} else if (!"".equals(vo.getMobile().trim()) && vo.getMobile().contains("*")) {
|
||||
vo.setMobile(null);
|
||||
}
|
||||
}
|
||||
|
||||
//工资银行-sunjsh
|
||||
|
|
@ -1138,14 +1149,14 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
|
||||
// 性别,为空或其他情况统一为0(男)
|
||||
if (!"".equals(Util.null2String(vo.getSex()))) {
|
||||
String sex = vo.getSex().equals("女") ? "1" : "0";
|
||||
String sex = "女".equals(vo.getSex()) ? "1" : "0";
|
||||
hrm.setSex(sex);
|
||||
}
|
||||
|
||||
// 婚姻状况,如果不是以下选项,则默认为未婚
|
||||
if (!"".equals(Util.null2String(vo.getMaritalstatus()))) {
|
||||
String maritalstatus = vo.getMaritalstatus().equals("已婚") ? "1"
|
||||
: vo.getMaritalstatus().equals("离异") ? "2" : "0";
|
||||
String maritalstatus = "已婚".equals(vo.getMaritalstatus()) ? "1"
|
||||
: "离异".equals(vo.getMaritalstatus()) ? "2" : "0";
|
||||
hrm.setMaritalstatus(maritalstatus);
|
||||
}
|
||||
|
||||
|
|
@ -1170,7 +1181,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
|
||||
// 工会会员,默认为是
|
||||
if (!"".equals(Util.null2String(vo.getIslabouunion()))) {
|
||||
String islabouunion = vo.getIslabouunion().equals("是") ? "1"
|
||||
String islabouunion = "是".equals(vo.getIslabouunion()) ? "1"
|
||||
: "0";
|
||||
hrm.setIslabouunion(islabouunion);
|
||||
}
|
||||
|
|
@ -1192,7 +1203,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
continue;
|
||||
}
|
||||
//安全级别必须是数字
|
||||
if (!Util.null2String(vo.getSeclevel()).equals("")) {
|
||||
if (!"".equals(Util.null2String(vo.getSeclevel()))) {
|
||||
if (Util.getIntValue(vo.getSeclevel(), -1000) == -1000) {
|
||||
resultList.add(createLog(vo, "更新", "失败", "安全级别必须是数字"));
|
||||
continue;
|
||||
|
|
@ -1245,7 +1256,9 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (!"".equals(Util.null2String(vo.getPassword()))) {
|
||||
|
||||
String orgPwd = "1";
|
||||
if (!"".equals(vo.getPassword())) orgPwd = vo.getPassword();
|
||||
if (!"".equals(vo.getPassword())) {
|
||||
orgPwd = vo.getPassword();
|
||||
}
|
||||
String[] pwdArr = PasswordUtil.encrypt(orgPwd);
|
||||
String salt = pwdArr[1];
|
||||
hrm.setPassword(pwdArr[0]);
|
||||
|
|
@ -1274,19 +1287,19 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
voField.setAccessible(true);
|
||||
|
||||
if (Util.null2String(hrmField.get(hrm)).trim().length() > 0) {
|
||||
if (hrmFieldType.endsWith("String"))
|
||||
if (hrmFieldType.endsWith("String")) {
|
||||
updateStr.append(fields[k]).append("='").append(hrmField.get(hrm)).append("',");
|
||||
else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) {
|
||||
} else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) {
|
||||
updateStr.append(fields[k]).append("=").append(hrmField.get(hrm)).append(",");
|
||||
}
|
||||
|
||||
if (fields[k].equals("status")) {
|
||||
if ("status".equals(fields[k])) {
|
||||
tmpstatus = Util.null2String(hrmField.get(hrm));
|
||||
}
|
||||
} else if (Util.null2String(voField.get(vo)).trim().length() > 0) {
|
||||
if (voFieldType.endsWith("String")) {
|
||||
if (recordSet.getDBType().equalsIgnoreCase("mysql") || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
if (Util.null2String(voField.get(vo)).equals("")) {
|
||||
if ("mysql".equalsIgnoreCase(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
|
||||
if ("".equals(Util.null2String(voField.get(vo)))) {
|
||||
updateStr.append(fields[k]).append("=null,");
|
||||
} else {
|
||||
updateStr.append(fields[k]).append("='").append(voField.get(vo)).append("',");
|
||||
|
|
@ -1301,14 +1314,17 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
updateStr.append(fields[k]).append("=").append(voField.get(vo)).append(",");
|
||||
}
|
||||
}
|
||||
if (fields[k].equals("status")) tmpstatus = Util.null2String(voField.get(vo));
|
||||
if ("status".equals(fields[k])) {
|
||||
tmpstatus = Util.null2String(voField.get(vo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateStr.append(" lastmodid=").append(lastmodid).append(",lastmoddate='").append(lastmoddate).append("',managerstr='").append(hrm.getManagerstr()).append("',").append(DbFunctionUtil.getUpdateSetSql(new RecordSet().getDBType(), lastmodid)).append(" where id=").append(keyMap.get(key));
|
||||
|
||||
if (!execSql(updateStr.toString()))
|
||||
if (!execSql(updateStr.toString())) {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
//同步密码到AD
|
||||
if (flag && !"".equals(Util.null2String(vo.getPassword()))) {
|
||||
|
|
@ -1324,7 +1340,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
String optype = "4"; //1,强制修改密码操作。2,首次登录密码操作,3,忘记密码找回。其它,系统修改ad操作。
|
||||
map.put("optype", optype);
|
||||
Map<String, Object> retInfo = new OaSync("", "").modifyADPWDNew(map);
|
||||
if (Util.null2String(retInfo.get("code")).equals("0")) {
|
||||
if ("0".equals(Util.null2String(retInfo.get("code")))) {
|
||||
//更新修改密码时间
|
||||
String passwdchgdate = Util.null2String(TimeUtil.getCurrentDateString());
|
||||
flag = recordSet.executeUpdate("update hrmresource set passwdchgdate=?, haschangepwd='y' where id = ?", passwdchgdate, userid);
|
||||
|
|
@ -1383,14 +1399,17 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
//OA与第三方接口单条数据同步方法结束
|
||||
}
|
||||
|
||||
if (updateBaseData(vo.getBaseFields(), vo.getBaseFieldsValue().trim(), keyMap.get(key)))
|
||||
if (updateBaseData(vo.getBaseFields(), vo.getBaseFieldsValue().trim(), keyMap.get(key))) {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if (updatePersonData(vo.getPersonFields(), vo.getPersonFieldsValue().trim(), keyMap.get(key)))
|
||||
if (updatePersonData(vo.getPersonFields(), vo.getPersonFieldsValue().trim(), keyMap.get(key))) {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if (updateWorkData(vo.getWorkFields().trim(), vo.getWorkFieldsValue(), keyMap.get(key)))
|
||||
if (updateWorkData(vo.getWorkFields().trim(), vo.getWorkFieldsValue(), keyMap.get(key))) {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
/*update HrmResource_Trigger */
|
||||
if (flag) {
|
||||
|
|
@ -1421,8 +1440,9 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
String resourceid = recordSet.getString("id");
|
||||
//指定上级为自身的情况,不更新自身上级
|
||||
new BaseBean().writeLog("resourceid【" + resourceid + "】");
|
||||
if (hrmId.equals(resourceid))
|
||||
if (hrmId.equals(resourceid)) {
|
||||
continue;
|
||||
}
|
||||
String nowmanagerstr2 = "";
|
||||
int index = nowmanagerstr.lastIndexOf(oldmanagerstr);
|
||||
if (index != -1) {
|
||||
|
|
@ -1466,7 +1486,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (rst.next()) {
|
||||
loginid = rst.getString("loginid");
|
||||
}
|
||||
if (loginid != null && !loginid.equals("")) {
|
||||
if (loginid != null && !"".equals(loginid)) {
|
||||
if (!rtxService.checkUser(Integer.parseInt(hrmId))) {
|
||||
rtxService.addUser(Integer.parseInt(hrmId));//更新人员rtx
|
||||
}
|
||||
|
|
@ -1481,7 +1501,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (rst.next()) {
|
||||
loginid = rst.getString("loginid");
|
||||
}
|
||||
if (loginid != null && !loginid.equals("")) {
|
||||
if (loginid != null && !"".equals(loginid)) {
|
||||
if (!rtxService.checkUser(Integer.parseInt(hrmId))) {
|
||||
rtxService.addUser(Integer.parseInt(hrmId));//更新人员rtx
|
||||
}
|
||||
|
|
@ -1536,7 +1556,9 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
* @return
|
||||
*/
|
||||
public boolean addBaseData(String baseFild, String baseValue, int id) {
|
||||
if (baseFild == null || baseFild.equals("")) return true;
|
||||
if (baseFild == null || "".equals(baseFild)) {
|
||||
return true;
|
||||
}
|
||||
String[] baseValues = baseValue.split(";");
|
||||
String[] baseFields = baseFild.split(",");
|
||||
String fielddbType;
|
||||
|
|
@ -1587,15 +1609,16 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
}
|
||||
|
||||
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
|
||||
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) {
|
||||
if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
|
||||
//是否需要加密
|
||||
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
|
||||
}
|
||||
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text"))
|
||||
valueStr.append(",").append("'").append(!fieldvalue.equals("") ? fieldvalue : "").append("'");
|
||||
else
|
||||
valueStr.append(",").append(!fieldvalue.equals("") ? fieldvalue : "NULL");
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
|
||||
valueStr.append(",").append("'").append(!"".equals(fieldvalue) ? fieldvalue : "").append("'");
|
||||
} else {
|
||||
valueStr.append(",").append(!"".equals(fieldvalue) ? fieldvalue : "NULL");
|
||||
}
|
||||
}
|
||||
valueStr = new StringBuilder(valueStr.substring(1));
|
||||
sql += "(scope,scopeid,id," + baseFild + ") values('HrmCustomFieldByInfoType'," + -1 + "," + id + "," + valueStr + ")";
|
||||
|
|
@ -1616,7 +1639,9 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
* @return
|
||||
*/
|
||||
public boolean updateBaseData(String baseFild, String baseValue, int id) {
|
||||
if (baseFild == null || baseFild.equals("")) return false;
|
||||
if (baseFild == null || "".equals(baseFild)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//检查cus_fielddata表中是否存在,对应id人员的基础自定义信息,如果不存在则向数据库添加
|
||||
RecordSet recordSet = new RecordSet();
|
||||
|
|
@ -1676,18 +1701,23 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
}
|
||||
}
|
||||
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
|
||||
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) {
|
||||
if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
|
||||
//是否需要加密
|
||||
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
|
||||
}
|
||||
if (fieldvalue.startsWith(",")) fieldvalue = fieldvalue.substring(1);
|
||||
if (fieldvalue.endsWith(",")) fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
|
||||
if (!fieldvalue.equals("") || "field100002".equalsIgnoreCase(fieldname)) {
|
||||
if (fieldvalue.startsWith(",")) {
|
||||
fieldvalue = fieldvalue.substring(1);
|
||||
}
|
||||
if (fieldvalue.endsWith(",")) {
|
||||
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
|
||||
}
|
||||
if (!"".equals(fieldvalue) || "field100002".equalsIgnoreCase(fieldname)) {
|
||||
flag = true;
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text"))
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
|
||||
setStr.append(",").append(baseFields[i]).append("='").append(fieldvalue).append("'");
|
||||
else
|
||||
} else {
|
||||
setStr.append(",").append(baseFields[i]).append("=").append(fieldvalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=-1 and id=" + id;
|
||||
|
|
@ -1712,7 +1742,9 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
* @return
|
||||
*/
|
||||
public boolean addPersonData(String personFild, String personValue, int id) {
|
||||
if (personFild == null || personFild.equals("")) return true;
|
||||
if (personFild == null || "".equals(personFild)) {
|
||||
return true;
|
||||
}
|
||||
String[] personValues = personValue.split(";");
|
||||
String[] personFields = personFild.split(",");
|
||||
String fielddbType;
|
||||
|
|
@ -1751,14 +1783,15 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
jsonObject.put("fieldvalue", personValues[i]);
|
||||
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
|
||||
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
|
||||
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) {
|
||||
if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
|
||||
//是否需要加密
|
||||
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
|
||||
}
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text"))
|
||||
valueStr.append(",").append("'").append(!fieldvalue.equals("") ? fieldvalue : "").append("'");
|
||||
else
|
||||
valueStr.append(",").append(!fieldvalue.equals("") ? fieldvalue : "NULL");
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
|
||||
valueStr.append(",").append("'").append(!"".equals(fieldvalue) ? fieldvalue : "").append("'");
|
||||
} else {
|
||||
valueStr.append(",").append(!"".equals(fieldvalue) ? fieldvalue : "NULL");
|
||||
}
|
||||
}
|
||||
valueStr = new StringBuilder(valueStr.substring(1));
|
||||
sql += "(scope,scopeid,id," + personFild + ") values('HrmCustomFieldByInfoType'," + 1 + "," + id + "," + valueStr + ")";
|
||||
|
|
@ -1779,7 +1812,9 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
* @return
|
||||
*/
|
||||
public boolean updatePersonData(String personFild, String personValue, int id) {
|
||||
if (personFild == null || personFild.equals("")) return false;
|
||||
if (personFild == null || "".equals(personFild)) {
|
||||
return false;
|
||||
}
|
||||
//检查cus_fielddata表中是否存在,对应id人员的个人自定义信息,如果不存在则向数据库添加
|
||||
String checkWorkInfo = "select id from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=1 and id=" + id;
|
||||
RecordSet recordSet = new RecordSet();
|
||||
|
|
@ -1827,18 +1862,23 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
jsonObject.put("fieldvalue", personValues[i]);
|
||||
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
|
||||
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
|
||||
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) {
|
||||
if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
|
||||
//是否需要加密
|
||||
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
|
||||
}
|
||||
if (fieldvalue.startsWith(",")) fieldvalue = fieldvalue.substring(1);
|
||||
if (fieldvalue.endsWith(",")) fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
|
||||
if (!fieldvalue.equals("")) {
|
||||
if (fieldvalue.startsWith(",")) {
|
||||
fieldvalue = fieldvalue.substring(1);
|
||||
}
|
||||
if (fieldvalue.endsWith(",")) {
|
||||
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
|
||||
}
|
||||
if (!"".equals(fieldvalue)) {
|
||||
flag = true;
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text"))
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
|
||||
setStr.append(",").append(personFields[i]).append("='").append(fieldvalue).append("'");
|
||||
else
|
||||
} else {
|
||||
setStr.append(",").append(personFields[i]).append("=").append(fieldvalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=1 and id=" + id;
|
||||
|
|
@ -1859,7 +1899,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
* @return
|
||||
*/
|
||||
public boolean addWorkData(String workField, String workValue, int id) {
|
||||
if (workField == null || workField.equals("")) {
|
||||
if (workField == null || "".equals(workField)) {
|
||||
return true;
|
||||
}
|
||||
String[] workValues = workValue.split(";");
|
||||
|
|
@ -1899,14 +1939,15 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
jsonObject.put("fieldvalue", workValues[i]);
|
||||
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
|
||||
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
|
||||
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) {
|
||||
if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
|
||||
//是否需要加密
|
||||
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
|
||||
}
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text"))
|
||||
valueStr.append(",").append("'").append(!fieldvalue.equals("") ? fieldvalue : "").append("'");
|
||||
else
|
||||
valueStr.append(",").append(!fieldvalue.equals("") ? fieldvalue : "NULL");
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
|
||||
valueStr.append(",").append("'").append(!"".equals(fieldvalue) ? fieldvalue : "").append("'");
|
||||
} else {
|
||||
valueStr.append(",").append(!"".equals(fieldvalue) ? fieldvalue : "NULL");
|
||||
}
|
||||
}
|
||||
valueStr = new StringBuilder(valueStr.substring(1));
|
||||
sql += "(scope,scopeid,id," + workField + ") values('HrmCustomFieldByInfoType'," + 3 + "," + id + "," + valueStr + ")";
|
||||
|
|
@ -1927,7 +1968,9 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
* @return
|
||||
*/
|
||||
public boolean updateWorkData(String workField, String workValue, int id) {
|
||||
if (workField == null || workField.equals("")) return false;
|
||||
if (workField == null || "".equals(workField)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//检查cus_fielddata表中是否存在,对应id人员的工作自定义信息,如果不存在则向数据库添加
|
||||
String checkWorkInfo = "select id from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=" + id;
|
||||
|
|
@ -1975,18 +2018,23 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
jsonObject.put("fieldvalue", workValues[i]);
|
||||
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
|
||||
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
|
||||
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) {
|
||||
if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
|
||||
//是否需要加密
|
||||
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
|
||||
}
|
||||
if (fieldvalue.startsWith(",")) fieldvalue = fieldvalue.substring(1);
|
||||
if (fieldvalue.endsWith(",")) fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
|
||||
if (!fieldvalue.equals("")) {
|
||||
if (fieldvalue.startsWith(",")) {
|
||||
fieldvalue = fieldvalue.substring(1);
|
||||
}
|
||||
if (fieldvalue.endsWith(",")) {
|
||||
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
|
||||
}
|
||||
if (!"".equals(fieldvalue)) {
|
||||
flag = true;
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text"))
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
|
||||
setStr.append(",").append(workFields[i]).append("='").append(fieldvalue).append("'");
|
||||
else
|
||||
} else {
|
||||
setStr.append(",").append(workFields[i]).append("=").append(fieldvalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2022,11 +2070,13 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
String supsubcomidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supsubcomid", 0);
|
||||
|
||||
for (String companyName : subCompanyNames) {
|
||||
if (StringUtil.isNull(companyName)) continue;
|
||||
if (StringUtil.isNull(companyName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sql = "select id from HrmSubCompany where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(subcompanyname))," + userlanguage + ")))='"
|
||||
+ companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId;
|
||||
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
if ("oracle".equalsIgnoreCase(recordSet.getDBType()) || DialectUtil.isMySql(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
|
||||
sql = "select id from HrmSubCompany where ltrim(rtrim(convToMultiLang(ltrim(rtrim(subcompanyname))," + userlanguage + ")))='"
|
||||
+ companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId;
|
||||
}
|
||||
|
|
@ -2043,8 +2093,9 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
break;
|
||||
}
|
||||
parentId = currentId;
|
||||
if (currentId != -1)
|
||||
if (currentId != -1) {
|
||||
rtxService.addSubCompany(parentId); //同步RTX
|
||||
}
|
||||
}
|
||||
return currentId;
|
||||
}
|
||||
|
|
@ -2072,13 +2123,13 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
String supdepidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supdepid", 0);
|
||||
|
||||
for (String s : deptName) {
|
||||
if (s == null || s.equals("")) {
|
||||
if (s == null || "".equals(s)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(departmentname))," + userlanguage + ")))='"
|
||||
+ s.trim() + "' and " + supdepidConditon + "=" + parentId;
|
||||
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
if ("oracle".equalsIgnoreCase(recordSet.getDBType()) || DialectUtil.isMySql(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
|
||||
sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and ltrim(rtrim(convToMultiLang(ltrim(rtrim(departmentname))," + userlanguage + ")))='"
|
||||
+ s.trim() + "' and " + supdepidConditon + "=" + parentId;
|
||||
}
|
||||
|
|
@ -2209,10 +2260,10 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
String managerstr;
|
||||
RecordSet recordSet = new RecordSet();
|
||||
Map<String, Comparable> managerInfo = new HashMap<>();
|
||||
if (!keyFieldValue.equals("")) {
|
||||
if (!"".equals(keyFieldValue)) {
|
||||
// String selSql = "select id,managerstr from hrmResource where " + keyField + "='" + keyFieldValue + "'";
|
||||
String selSql = "select id,managerstr from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
|
||||
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
if ("oracle".equalsIgnoreCase(recordSet.getDBType()) || DialectUtil.isMySql(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
|
||||
selSql = "select id,managerstr from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
|
||||
}
|
||||
recordSet.execute(selSql);
|
||||
|
|
@ -2244,10 +2295,10 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
|
||||
int getAssistantid = 0;
|
||||
RecordSet recordSet = new RecordSet();
|
||||
if (!keyFieldValue.equals("")) {
|
||||
if (!"".equals(keyFieldValue)) {
|
||||
// String selSql = "select id from hrmResource where " + keyField + "='" + keyFieldValue + "'";
|
||||
String selSql = "select id from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
|
||||
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
if ("oracle".equalsIgnoreCase(recordSet.getDBType()) || DialectUtil.isMySql(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
|
||||
selSql = "select id from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
|
||||
}
|
||||
getAssistantid = getResultSetId(selSql);
|
||||
|
|
@ -2265,10 +2316,10 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
public int getBelongId(String keyFieldValue, String keyField) {
|
||||
int getAssistantid = -1;
|
||||
RecordSet recordSet = new RecordSet();
|
||||
if (!keyFieldValue.equals("")) {
|
||||
if (!"".equals(keyFieldValue)) {
|
||||
// String selSql = "select id from hrmResource where " + keyField + "='" + keyFieldValue + "'";
|
||||
String selSql = "select id from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
|
||||
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
if ("oracle".equalsIgnoreCase(recordSet.getDBType()) || DialectUtil.isMySql(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
|
||||
selSql = "select id from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
|
||||
}
|
||||
getAssistantid = getResultSetId(selSql);
|
||||
|
|
@ -2284,7 +2335,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
*/
|
||||
public int getLocationid(String locationname) {
|
||||
int locationid = 0;
|
||||
if (!locationname.equals("")) {
|
||||
if (!"".equals(locationname)) {
|
||||
locationid = locationMap.getOrDefault(locationname, 0);
|
||||
if (locationid == 0) {
|
||||
String insertSql = "insert into HrmLocations(locationname,locationdesc,countryid) values('" + locationname + "','" + locationname + "',1)";
|
||||
|
|
@ -2305,7 +2356,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
*/
|
||||
public int getUseKind(String usekindname) {
|
||||
int usekindid = 0;
|
||||
if (!usekindname.equals("")) {
|
||||
if (!"".equals(usekindname)) {
|
||||
usekindid = usekindMap.getOrDefault(usekindname, 0);
|
||||
if (usekindid == 0) {
|
||||
String insertSql = "insert into HrmUseKind(name,description) values('" + usekindname + "','" + usekindname + "')";
|
||||
|
|
@ -2327,7 +2378,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
public int getJobcall(String jobcall) {
|
||||
|
||||
int jobcalld = 0;
|
||||
if (!jobcall.equals("")) {
|
||||
if (!"".equals(jobcall)) {
|
||||
jobcalld = jobcallMap.getOrDefault(jobcall, 0);
|
||||
if (jobcalld == 0) {
|
||||
String insertSql = "insert into HrmJobCall(name) values('" + jobcall + "')";
|
||||
|
|
@ -2354,13 +2405,14 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
//return -1;
|
||||
|
||||
//如果系统不支持多语言,则返回0
|
||||
if ((language.equals("English") || language.equals("繁體中文")) && !multilanguage.equalsIgnoreCase("y"))
|
||||
if (("English".equals(language) || "繁體中文".equals(language)) && !"y".equalsIgnoreCase(multilanguage)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!language.equals("")) {
|
||||
if (language.equals("简体中文"))
|
||||
if (!"".equals(language)) {
|
||||
if ("简体中文".equals(language)) {
|
||||
systemlanguageid = cnLanguageId;
|
||||
else {
|
||||
} else {
|
||||
systemlanguageid = sysLanguage.getOrDefault(language, -1);
|
||||
}
|
||||
}
|
||||
|
|
@ -2375,7 +2427,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
*/
|
||||
public int getBankId(String bank1) {
|
||||
int id = 0;
|
||||
if (!bank1.equals("")) {
|
||||
if (!"".equals(bank1)) {
|
||||
String insertSql = "insert into hrmbank(bankname,bankdesc) values('" + bank1 + "','" + bank1 + "')";
|
||||
execSql(insertSql);
|
||||
String selSql = "select id from hrmbank where bankname='" + bank1 + "'";
|
||||
|
|
@ -2454,7 +2506,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
*/
|
||||
public int getEducationlevel(String educationlevel) {
|
||||
int educationlevelid = 0;
|
||||
if (!educationlevel.equals("")) {
|
||||
if (!"".equals(educationlevel)) {
|
||||
educationlevelid = educationlevelMap.getOrDefault(educationlevel, 0);
|
||||
if (educationlevelid == 0) {
|
||||
String insertSql = "insert into HrmEducationLevel(name,description) values('" + educationlevel + "','" + educationlevel + "')";
|
||||
|
|
@ -2504,7 +2556,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
RecordSet recordSet = new RecordSet();
|
||||
String sql;
|
||||
sql = "select id, accounttype,isADAccount,certificatenum,loginid,workcode, ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from hrmResource";
|
||||
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")) {
|
||||
if ("sqlserver".equalsIgnoreCase(recordSet.getDBType())) {
|
||||
sql = "select id, accounttype,isADAccount,certificatenum,loginid,workcode, ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from hrmResource";
|
||||
}
|
||||
recordSet.execute(sql);
|
||||
|
|
@ -2585,10 +2637,11 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
log.setLastname(vo.getLastname()); //用户名
|
||||
log.setLoginid(vo.getLoginid()); //登录名
|
||||
log.setOperation(operation); //操作类型
|
||||
if (vo.getSubcompanyid1() != null && vo.getDepartmentid() != null)
|
||||
if (vo.getSubcompanyid1() != null && vo.getDepartmentid() != null) {
|
||||
log.setDepartment(vo.getSubcompanyid1() + ">" + vo.getDepartmentid()); //分部部门
|
||||
else
|
||||
} else {
|
||||
log.setDepartment("");
|
||||
}
|
||||
log.setStatus(status); //状态,成功、失败
|
||||
log.setReason(reason); //原因
|
||||
|
||||
|
|
@ -2605,7 +2658,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
relatedName = log.getLastname();
|
||||
break;
|
||||
}
|
||||
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(JclImportHistoryDetailPO.builder().pid((long) this.pId).rowNums(this.rowNum + 1 + "").relatedName(relatedName).operateDetail(log.getStatus().equals("成功") ? relatedName + "导入成功!" : log.getReason()).status(log.getStatus().equals("成功") ? "1" : "0").build());
|
||||
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(JclImportHistoryDetailPO.builder().pid((long) this.pId).rowNums(this.rowNum + 1 + "").relatedName(relatedName).operateDetail("成功".equals(log.getStatus()) ? relatedName + "导入成功!" : log.getReason()).status("成功".equals(log.getStatus()) ? "1" : "0").build());
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
|
|
@ -2614,8 +2667,9 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
|
||||
//整数判断
|
||||
public static boolean isInteger(String str) {
|
||||
if (str == null)
|
||||
if (str == null) {
|
||||
return false;
|
||||
}
|
||||
Pattern pattern = Pattern.compile("[0-9]+");
|
||||
return pattern.matcher(str).matches();
|
||||
}
|
||||
|
|
@ -2650,7 +2704,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
}
|
||||
|
||||
if (reosurceid > 0 && val.length() > 0) {
|
||||
resultList.add(createLog(vo, this.operateType.equals("add") ? "创建" : "更新", "失败", errorMsg));
|
||||
resultList.add(createLog(vo, "add".equals(this.operateType) ? "创建" : "更新", "失败", errorMsg));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,4 +156,8 @@ public class SearchTreeUtil {
|
|||
public static boolean isTop(Long pid) {
|
||||
return null == pid;
|
||||
}
|
||||
|
||||
public static boolean isTop(Integer pid) {
|
||||
return null == pid;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.company.param.CompParam;
|
||||
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;
|
||||
|
||||
|
|
@ -45,7 +43,7 @@ public class CompController {
|
|||
@POST
|
||||
@Path("/listComp")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult listComp(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody CompanyParam params) {
|
||||
public ReturnResult listComp(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody CompParam params) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getCompWrapper(user).listPage(params));
|
||||
|
|
@ -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 CompParam 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);
|
||||
}
|
||||
|
|
@ -210,8 +206,6 @@ public class CompController {
|
|||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
params.put("addType", "normal");
|
||||
params.put("viewattr", 2);
|
||||
return ReturnResult.successed(getCompWrapper(user).getCompSaveForm(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class DepartmentController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String parentDept = (String) map.get("parentDept");
|
||||
return ReturnResult.successed(getDepartmentWrapper(user).getJobListByPid(QuerySingleDeptListParam.builder().parentDept(Long.parseLong(parentDept)).build()));
|
||||
return ReturnResult.successed(getDepartmentWrapper(user).getJobListByPid(QuerySingleDeptListParam.builder().parentDept(Integer.parseInt(parentDept)).build()));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
|
|
@ -105,15 +105,15 @@ public class DepartmentController {
|
|||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/saveBaseForm")
|
||||
@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);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getDepartmentWrapper(user).saveBaseForm(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
|
|
@ -253,9 +253,8 @@ public class DepartmentController {
|
|||
public ReturnResult getSaveForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
DeptSearchParam param = JSONObject.toJavaObject((JSON) JSONObject.toJSON(map), DeptSearchParam.class);
|
||||
return ReturnResult.successed(getDepartmentWrapper(user).getSaveForm(param));
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getDepartmentWrapper(user).getSaveForm(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
|
|
@ -292,9 +291,7 @@ public class DepartmentController {
|
|||
public ReturnResult getMergeForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String id = (String) map.get("id");
|
||||
return ReturnResult.successed(getDepartmentWrapper(user).getMergeForm(Long.parseLong(id)));
|
||||
return ReturnResult.successed(getDepartmentWrapper(user).getMergeForm());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ 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.param.CompParam;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.param.DepartmentMoveParam;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
|
|
@ -13,12 +12,13 @@ import com.engine.organization.enums.OperateTypeEnum;
|
|||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
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;
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ public class CompWrapper extends OrganizationWrapper {
|
|||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> listPage(CompanyParam params) {
|
||||
public Map<String, Object> listPage(CompParam params) {
|
||||
return getCompService(user).listPage(params);
|
||||
}
|
||||
|
||||
|
|
@ -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) {
|
||||
public int updateForbiddenTagById(CompParam params) {
|
||||
CompPO compPO = getCompMapper().listById(params.getId());
|
||||
int updateForbiddenTagById = getCompService(user).updateForbiddenTagById(params);
|
||||
CompPO newCompPO = getCompMapper().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());
|
||||
Integer id = Integer.parseInt(params.get("id").toString());
|
||||
CompPO compPO = getCompMapper().listById(id);
|
||||
Long companyId = getCompService(user).updateComp(params);
|
||||
CompPO newCompPO = getCompMapper().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<CompPO> compsByIds = getCompMapper().getCompsByIds(ids);
|
||||
Map<String, Object> map = getCompService(user).deleteByIds(params);
|
||||
for (CompPO 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());
|
||||
CompPO compPO = getCompMapper().listById(moveParam.getId().intValue());
|
||||
int moveCompany = getCompService(user).moveCompany(moveParam);
|
||||
CompPO newCompPO = getCompMapper().listById(moveParam.getId());
|
||||
CompPO newCompPO = getCompMapper().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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,15 +15,16 @@ import com.engine.organization.enums.OperateTypeEnum;
|
|||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.service.DepartmentService;
|
||||
import com.engine.organization.service.impl.DepartmentServiceImpl;
|
||||
import com.engine.organization.thread.DepartmentTriggerRunnable;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -83,8 +84,8 @@ public class DepartmentWrapper extends OrganizationWrapper {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getSaveForm(DeptSearchParam param) {
|
||||
return getDepartmentService(user).getSaveForm(param);
|
||||
public Map<String, Object> getSaveForm(Map<String, Object> params) {
|
||||
return getDepartmentService(user).getSaveForm(params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -97,8 +98,8 @@ public class DepartmentWrapper extends OrganizationWrapper {
|
|||
public Long saveBaseForm(Map<String, Object> params) {
|
||||
Long departmentId = getDepartmentService(user).saveBaseForm(params);
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), params.get("dept_name").toString(), JSON.toJSONString(params), "新增部门");
|
||||
new Thread(new DepartmentTriggerRunnable(departmentId)).start();
|
||||
}.getClass(), params.get("departmentname").toString(), JSON.toJSONString(params), "新增部门");
|
||||
// TODO new Thread(new DepartmentTriggerRunnable(departmentId)).start();
|
||||
return departmentId;
|
||||
}
|
||||
|
||||
|
|
@ -114,8 +115,8 @@ public class DepartmentWrapper extends OrganizationWrapper {
|
|||
int updateForbiddenTagById = getDepartmentService(user).updateForbiddenTagById(params);
|
||||
DepartmentPO newDeptById = getDepartmentMapper().getDeptById(params.getId());
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), deptById.getDeptName(), JSON.toJSONString(params), deptById, newDeptById);
|
||||
new Thread(new DepartmentTriggerRunnable(params.getForbiddenTag(),deptById, newDeptById)).start();
|
||||
}.getClass(), deptById.getDepartmentName(), JSON.toJSONString(params), deptById, newDeptById);
|
||||
// new Thread(new DepartmentTriggerRunnable(params.getForbiddenTag(),deptById, newDeptById)).start();
|
||||
return updateForbiddenTagById;
|
||||
}
|
||||
|
||||
|
|
@ -127,12 +128,12 @@ public class DepartmentWrapper extends OrganizationWrapper {
|
|||
*/
|
||||
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新部门", operateModule = LogModuleNameEnum.DEPARTMENT)
|
||||
public Long updateForm(Map<String, Object> params) {
|
||||
long id = Long.parseLong(params.get("id").toString());
|
||||
Integer id = Integer.parseInt(params.get("id").toString());
|
||||
DepartmentPO deptById = getDepartmentMapper().getDeptById(id);
|
||||
Long departmentId = getDepartmentService(user).updateForm(params);
|
||||
DepartmentPO newDeptById = getDepartmentMapper().getDeptById(id);
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), deptById.getDeptName(), JSON.toJSONString(params), deptById, newDeptById);
|
||||
}.getClass(), deptById.getDepartmentName(), JSON.toJSONString(params), deptById, newDeptById);
|
||||
return departmentId;
|
||||
}
|
||||
|
||||
|
|
@ -142,16 +143,18 @@ public class DepartmentWrapper extends OrganizationWrapper {
|
|||
* @param ids
|
||||
*/
|
||||
@Log(operateType = OperateTypeEnum.DELETE, operateDesc = "删除部门", operateModule = LogModuleNameEnum.DEPARTMENT)
|
||||
public int deleteByIds(Collection<Long> ids) {
|
||||
public Map<String, Object> deleteByIds(Collection<Long> ids) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", StringUtils.join(ids, ","));
|
||||
List<DepartmentPO> departmentPOS = getDepartmentMapper().getDeptsByIds(ids);
|
||||
int deleteByIds = getDepartmentService(user).deleteByIds(ids);
|
||||
Map<String, Object> map = getDepartmentService(user).deleteByIds(params);
|
||||
for (DepartmentPO departmentPO : departmentPOS) {
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), departmentPO.getDeptName(), JSON.toJSONString(ids), "删除部门");
|
||||
}.getClass(), departmentPO.getDepartmentName(), JSON.toJSONString(ids), "删除部门");
|
||||
// 更新组织架构图
|
||||
new DepartmentTriggerRunnable(departmentPO).run();
|
||||
// TODO new DepartmentTriggerRunnable(departmentPO).run();
|
||||
}
|
||||
return deleteByIds;
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -204,7 +207,7 @@ public class DepartmentWrapper extends OrganizationWrapper {
|
|||
int copyDepartment = getDepartmentService(user).copyDepartment(copyParam);
|
||||
for (DepartmentPO departmentPO : departmentPOS) {
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), departmentPO.getDeptName(), JSON.toJSONString(copyParam), "复制部门[" + departmentPO.getDeptName() + "]");
|
||||
}.getClass(), departmentPO.getDepartmentName(), JSON.toJSONString(copyParam), "复制部门[" + departmentPO.getDepartmentName() + "]");
|
||||
}
|
||||
return copyDepartment;
|
||||
}
|
||||
|
|
@ -212,11 +215,10 @@ public class DepartmentWrapper extends OrganizationWrapper {
|
|||
/**
|
||||
* 获取合并表单
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public List<SearchConditionGroup> getMergeForm(Long id) {
|
||||
return getDepartmentService(user).getMergeForm(id);
|
||||
public List<SearchConditionGroup> getMergeForm() {
|
||||
return getDepartmentService(user).getMergeForm();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -230,7 +232,7 @@ public class DepartmentWrapper extends OrganizationWrapper {
|
|||
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(mergeParam.getId());
|
||||
int mergeDepartment = getDepartmentService(user).mergeDepartment(mergeParam);
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), departmentPO.getDeptName(), JSON.toJSONString(mergeParam), departmentPO, getDepartmentMapper().getDeptById(departmentPO.getId()));
|
||||
}.getClass(), departmentPO.getDepartmentName(), JSON.toJSONString(mergeParam), departmentPO, getDepartmentMapper().getDeptById(departmentPO.getId()));
|
||||
return mergeDepartment;
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +256,7 @@ public class DepartmentWrapper extends OrganizationWrapper {
|
|||
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(moveParam.getId());
|
||||
int moveDepartment = getDepartmentService(user).moveDepartment(moveParam);
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), departmentPO.getDeptName(), JSON.toJSONString(moveParam), departmentPO, getDepartmentMapper().getDeptById(departmentPO.getId()));
|
||||
}.getClass(), departmentPO.getDepartmentName(), JSON.toJSONString(moveParam), departmentPO, getDepartmentMapper().getDeptById(departmentPO.getId()));
|
||||
return moveDepartment;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
|
|
@ -18,39 +15,40 @@ public class JclOrgWrapper extends OrganizationWrapper {
|
|||
if (StringUtils.isAnyBlank(jclId, type)) {
|
||||
return null;
|
||||
}
|
||||
switch (type) {
|
||||
case "1":
|
||||
return EcHrmRelationUtil.getEcCompanyId(jclId);
|
||||
case "2":
|
||||
return EcHrmRelationUtil.getEcDepartmentId(jclId);
|
||||
case "3":
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
//switch (type) {
|
||||
// case "1":
|
||||
// return EcHrmRelationUtil.getEcCompanyId(jclId);
|
||||
// case "2":
|
||||
// return EcHrmRelationUtil.getEcDepartmentId(jclId);
|
||||
// case "3":
|
||||
// default:
|
||||
// return "";
|
||||
//}
|
||||
return jclId;
|
||||
}
|
||||
|
||||
public String getJclOrgId(String ecId, String type) {
|
||||
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