分部、部门数据源调整;功能逻辑修改 #79

Merged
dxfeng merged 7 commits from feature/dxf into develop 3 years ago

@ -181,8 +181,8 @@ public class JobBrowserService extends BrowserService {
if (CollectionUtils.isNotEmpty(jclRoleLevelList)) { if (CollectionUtils.isNotEmpty(jclRoleLevelList)) {
compList = MapperProxyFactory.getProxy(CompMapper.class).getCompsByIds(jclRoleLevelList); compList = MapperProxyFactory.getProxy(CompMapper.class).getCompsByIds(jclRoleLevelList);
// 处理上下级关系 // 处理上下级关系
Set<Long> collectIds = compList.stream().map(CompPO::getId).collect(Collectors.toSet()); Set<Integer> collectIds = compList.stream().map(CompPO::getId).collect(Collectors.toSet());
compList.removeIf(item->collectIds.contains(item.getParentCompany())); compList.removeIf(item -> collectIds.contains(item.getSupSubComId()));
} else { } else {
compList = new ArrayList<>(); 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)); compList.stream().sorted(Comparator.comparing(CompPO::getShowOrder)).forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
} else if ("1".equals(params.getType())) { } else if ("1".equals(params.getType())) {
// 当前节点下的元素 // 当前节点下的元素
CompPO compBuild = CompPO.builder().parentCompany(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build(); CompPO compBuild = CompPO.builder().supSubComId(Integer.parseInt(params.getId())).canceled(0).build();
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listByFilter(compBuild, "show_order"); List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listByFilter(compBuild, "showorder");
if (detachUtil.isDETACH()) { if (detachUtil.isDETACH()) {
detachUtil.filterCompanyList(compList); detachUtil.filterCompanyList(compList);
} }
DepartmentPO departmentBuild = DepartmentPO.builder().parentComp(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build(); DepartmentPO departmentBuild = DepartmentPO.builder().subCompanyId1(Integer.parseInt(params.getId())).canceled(0).build();
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order"); List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "showorder");
compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item)); 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())) { } else if ("2".equals(params.getType())) {
DepartmentPO departmentBuild = DepartmentPO.builder().parentDept(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build(); DepartmentPO departmentBuild = DepartmentPO.builder().supDepId(Integer.parseInt(params.getId())).canceled(0).build();
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order"); List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "showorder");
departmentList.forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item)); departmentList.forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item));
} }
@ -226,7 +226,7 @@ public class JobBrowserService extends BrowserService {
SearchTree searchTree = new SearchTree(); SearchTree searchTree = new SearchTree();
searchTree.setId(company.getId().toString()); searchTree.setId(company.getId().toString());
searchTree.setType(TreeNodeTypeEnum.TYPE_COMP.getValue()); searchTree.setType(TreeNodeTypeEnum.TYPE_COMP.getValue());
searchTree.setName(company.getCompName()); searchTree.setName(company.getSubCompanyName());
searchTree.setIsParent(compHasSubs.contains(company.getId().toString())); searchTree.setIsParent(compHasSubs.contains(company.getId().toString()));
treeNodes.add(searchTree); treeNodes.add(searchTree);
} }
@ -241,7 +241,7 @@ public class JobBrowserService extends BrowserService {
private void buildDeptNodes(List<TreeNode> treeNodes, List<String> hasSubDepartment, DepartmentPO department) { private void buildDeptNodes(List<TreeNode> treeNodes, List<String> hasSubDepartment, DepartmentPO department) {
SearchTree searchTree = new SearchTree(); SearchTree searchTree = new SearchTree();
searchTree.setId(department.getId().toString()); searchTree.setId(department.getId().toString());
searchTree.setName(department.getDeptName()); searchTree.setName(department.getDepartmentName());
searchTree.setType(TreeNodeTypeEnum.TYPE_DEPT.getValue()); searchTree.setType(TreeNodeTypeEnum.TYPE_DEPT.getValue());
searchTree.setIsParent(hasSubDepartment.contains(department.getId().toString())); searchTree.setIsParent(hasSubDepartment.contains(department.getId().toString()));
treeNodes.add(searchTree); treeNodes.add(searchTree);

@ -8,7 +8,7 @@ import weaver.general.StringUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -24,7 +24,7 @@ import java.util.stream.Collectors;
public class DeleteParam { public class DeleteParam {
private String ids; private String ids;
public Collection<Long> getIds() { public List<Long> getIds() {
if(StringUtil.isEmpty(ids)){ if(StringUtil.isEmpty(ids)){
return new ArrayList<>(); return new ArrayList<>();
} }

@ -73,7 +73,7 @@ public class CodeSettingBO {
if(Objects.nonNull(param)) { if(Objects.nonNull(param)) {
String enable = Util.null2String(param.getEnable(),"0"); String enable = Util.null2String(param.getEnable(),"0");
String key = param.getKey(); String key = param.getKey();
if (enable.equals("1") && StringUtils.isNotEmpty(key)) { if ("1".equals(enable) && StringUtils.isNotEmpty(key)) {
sb.append(key); sb.append(key);
sb.append(","); sb.append(",");
} }

@ -96,8 +96,12 @@ public class FieldInfo {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FieldInfo fieldInfo = (FieldInfo) o; FieldInfo fieldInfo = (FieldInfo) o;
return Objects.equals(fieldName, fieldInfo.fieldName) && return Objects.equals(fieldName, fieldInfo.fieldName) &&
Objects.equals(firstFieldType, fieldInfo.firstFieldType) && Objects.equals(firstFieldType, fieldInfo.firstFieldType) &&

@ -1,54 +1,118 @@
package com.engine.organization.entity.company.bo; package com.engine.organization.entity.company.bo;
import com.engine.organization.entity.company.dto.CompListDTO; 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.company.po.CompPO;
import com.engine.organization.entity.searchtree.SearchTree; import com.engine.organization.entity.searchtree.SearchTree;
import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import weaver.crm.Maint.SectorInfoComInfo;
import weaver.general.StringUtil;
import weaver.general.Util; import weaver.general.Util;
import weaver.hrm.resource.ResourceComInfo;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @description:
* @author:dxfeng * @author:dxfeng
* @createTime: 2022/05/16 * @createTime: 2022/11/24
* @version: 1.0 * @version: 1.0
*/ */
public class CompBO { public class CompBO {
public static List<CompListDTO> buildCompDTOList(Collection<CompPO> list) { private static CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class);
}
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<Long, CompPO> poMaps = list.stream().collect(Collectors.toMap(CompPO::getId, item -> item)); Map<Integer, CompPO> poMaps = list.stream().collect(Collectors.toMap(CompPO::getId, item -> item));
List<CompListDTO> dtoList = list.stream().map(e -> List<CompListDTO> dtoList = list.stream().map(e ->
CompListDTO CompListDTO
.builder() .builder()
.id(e.getId()) .id(e.getId())
.compNo(e.getCompNo()) .subCompanyCode(e.getSubCompanyCode())
.compName(e.getCompName()) .subCompanyDesc(e.getSubCompanyDesc())
.compNameShort(e.getCompNameShort()) .subCompanyName(e.getSubCompanyName())
.parentCompany(e.getParentCompany()) .supSubComId(e.getSupSubComId())
.parentCompName(null == poMaps.get(e.getParentCompany()) ? "" : poMaps.get(e.getParentCompany()).getCompName()) .supSubComName(null == poMaps.get(e.getSupSubComId()) ? "" : poMaps.get(e.getSupSubComId()).getSubCompanyName())
.orgCode(e.getOrgCode())
.industry(new SectorInfoComInfo().getSectorInfoname(Util.null2String(e.getIndustry())))
.compPrincipal(getUserNameById( Util.null2String(e.getCompPrincipal())))
.showOrder(e.getShowOrder()) .showOrder(e.getShowOrder())
.forbiddenTag(e.getForbiddenTag()) .canceled(null == e.getCanceled() ? 0 : e.getCanceled())
.build()).collect(Collectors.toList()); .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 // 兼容MySQL
usedIds.addAll(MapperProxyFactory.getProxy(CompMapper.class).listUsedIds()); usedIds.addAll(getCompMapper().listUsedIds());
List<String> collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList()); 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> collectTree = dtoList.stream().peek(e -> {
List<CompListDTO> childList = collects.get(e.getId()); List<CompListDTO> childList = collects.get(e.getId());
leafs.add(e.getId()); leafs.add(e.getId());
@ -63,65 +127,7 @@ public class CompBO {
} }
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return collectTree.stream().filter(item->!leafs.contains(item.getParentCompany())).collect(Collectors.toList()); return collectTree.stream().filter(item -> !leafs.contains(item.getSupSubComId())).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());
} }
/** /**
@ -131,24 +137,13 @@ public class CompBO {
* @param po * @param po
* @param poMaps * @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)) { if (!addedList.contains(po)) {
addedList.add(po); addedList.add(po);
} }
CompPO parentCompPO = poMaps.get(po.getParentCompany()); CompPO parentCompPO = poMaps.get(po.getSupSubComId());
if (null != parentCompPO) { if (null != parentCompPO) {
dealParentData(addedList, parentCompPO, poMaps); 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; import java.util.List;
/** /**
* @description:
* @author:dxfeng * @author:dxfeng
* @createTime: 2022/05/16 * @createTime: 2022/11/24
* @version: 1.0 * @version: 1.0
*/ */
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@OrganizationTable(pageId = "2c66b3a4-d4f8-11ec-9774-00ffcbed7508") @OrganizationTable(pageId = "dcfd9d27-6ba2-11ed-996a-00ffcbed7508")
public class CompListDTO { public class CompListDTO {
/** /**
* id * id
*/ */
private Long id; private Integer id;
/** /**
* *
*/ */
@ -32,46 +31,29 @@ public class CompListDTO {
/** /**
* *
*/ */
@TableTitle(title = "名称", dataIndex = "compName", key = "compName") @TableTitle(title = "名称", dataIndex = "subCompanyDesc", key = "subCompanyDesc")
private String compName; private String subCompanyDesc;
/** /**
* *
*/ */
@TableTitle(title = "编号", dataIndex = "compNo", key = "compNo") @TableTitle(title = "编号", dataIndex = "subCompanyCode", key = "subCompanyCode")
private String compNo; private String subCompanyCode;
/** /**
* *
*/ */
@TableTitle(title = "简称", dataIndex = "compNameShort", key = "compNameShort") @TableTitle(title = "简称", dataIndex = "subCompanyName", key = "subCompanyName")
private String compNameShort; private String subCompanyName;
/** /**
* *
*/ */
@TableTitle(title = "上级分部", dataIndex = "parentCompName", key = "parentCompName") @TableTitle(title = "上级分部", dataIndex = "supSubComName", key = "supSubComName")
private String parentCompName; 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) @TableTitle(title = "显示顺序", dataIndex = "showOrder", key = "showOrder", sorter = true)
private Integer showOrder; private Integer showOrder;
@ -79,8 +61,8 @@ public class CompListDTO {
/** /**
* *
*/ */
@TableTitle(title = "是否启用", dataIndex = "forbiddenTag", key = "forbiddenTag") @TableTitle(title = "是否启用", dataIndex = "canceled", key = "canceled")
private int forbiddenTag; 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 @Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class CompanyParam extends BaseQueryParam { public class CompParam extends BaseQueryParam {
private Integer Id; private Integer Id;
private String subCompanyName; private String subCompanyName;
private String subCompanyDesc; 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; import java.util.Date;
/** /**
* @description:
* @author:dxfeng * @author:dxfeng
* @createTime: 2022/05/16 * @createTime: 2022/11/24
* @version: 1.0 * @version: 1.0
*/ */
@Data @Data
@ -18,68 +17,21 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class CompPO { public class CompPO {
private Integer id;
/** private String subCompanyName;
* private String subCompanyDesc;
*/ private Integer companyId;
private Long id; private Integer supSubComId;
private String url;
/** private Integer canceled;
* private String subCompanyCode;
*/ private String outKey;
private String compNo; private Integer limitUsers;
private Date created;
/** private Integer creater;
* private Date modified;
*/ private Integer modifier;
private String compName;
/**
*
*/
private String compNameShort;
/**
*
*/
private Long parentCompany;
private Long ecCompany;
/**
*
*/
private String orgCode;
/**
*
*/
private Integer industry;
/**
*
*/
private Integer compPrincipal;
/**
*
*/
private String description;
/**
*
*/
private Integer forbiddenTag;
/**
*
*/
private Integer showOrder;
private String uuid; private String uuid;
private Integer showOrder;
private Long creator; private Integer showOrderOfTree;
private int deleteType;
private Date createTime;
private Date updateTime;
} }

@ -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) { 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 -> List<DepartmentListDTO> dtoList = list.stream().map(e ->
DepartmentListDTO DepartmentListDTO
.builder() .builder()
.id(e.getId()) .id(e.getId())
.deptNo(e.getDeptNo()) .departmentMark(e.getDepartmentMark())
.deptName(e.getDeptName()) .departmentName(e.getDepartmentName())
.deptNameShort(e.getDeptNameShort()) .departmentCode(e.getDepartmentCode())
.parentComp(null == e.getParentComp() ? "" : MapperProxyFactory.getProxy(CompMapper.class).listById(e.getParentComp()).getCompName()) .subCompanyId1(e.getSubCompanyId1())
.parentDept(e.getParentDept()) .subCompanyName(0 == e.getSubCompanyId1() ? "" : MapperProxyFactory.getProxy(CompMapper.class).listById(e.getSubCompanyId1()).getSubCompanyName())
.parentDeptName(null == poMaps.get(e.getParentDept()) ? "" : poMaps.get(e.getParentDept()).getDeptName()) .supDepId(e.getSupDepId())
.deptPrincipal(getEmployeeNameById(e.getDeptPrincipal())) .supDepName(null == poMaps.get(e.getSupDepId()) ? "" : poMaps.get(e.getSupDepId()).getDepartmentName())
// .deptPrincipal(getEmployeeNameById(e.getDeptPrincipal()))
.showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder()) .showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder())
.forbiddenTag(e.getForbiddenTag()) .canceled(null == e.getCanceled() ? 0 : e.getCanceled())
.build()).collect(Collectors.toList()); .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> usedIds = MapperProxyFactory.getProxy(DepartmentMapper.class).listUsedId();
List<String> collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList()); List<String> collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList());
@ -57,7 +58,7 @@ public class DepartmentBO {
e.setIsUsed(0); 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) { public static List<DepartmentListDTO> buildDeptDTOList(Collection<DepartmentPO> list, List<DepartmentPO> filterList) {
@ -66,7 +67,7 @@ public class DepartmentBO {
return Collections.emptyList(); 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<>(); List<DepartmentPO> addedList = new ArrayList<>();
for (DepartmentPO po : filterList) { for (DepartmentPO po : filterList) {
dealParentData(addedList, po, poMaps); dealParentData(addedList, po, poMaps);
@ -74,32 +75,32 @@ public class DepartmentBO {
return buildDeptDTOList(addedList); return buildDeptDTOList(addedList);
} }
public static DepartmentPO convertParamsToPO(DeptSearchParam param, long employeeId) { public static DepartmentPO convertParamsToPO(DeptSearchParam param, Integer employeeId) {
if (null == param) { if (null == param) {
return null; return null;
} }
return DepartmentPO return DepartmentPO
.builder() .builder()
.id(param.getId() == null ? 0 : param.getId()) .id(param.getId() == null ? 0 : param.getId())
.deptNo(param.getDeptNo()) .departmentMark(param.getDepartmentMark())
.deptName(param.getDepartmentName()) .departmentName(param.getDepartmentName())
.deptNameShort(param.getDeptNameShort()) .subCompanyId1(param.getSubCompanyId1())
.parentComp(null == param.getParentComp() ? param.getSubcompanyid1() : param.getParentComp()) .supDepId(param.getSupDepId())
.ecCompany(param.getEcCompany()) .allSupDepId(param.getAllSupDepId())
.parentDept(null == param.getParentDept() ? param.getDepartmentid() : param.getParentDept()) .canceled(param.getCanceled() == null ? null : param.getCanceled() ? 0 : 1)
.ecDepartment(param.getEcDepartment()) .departmentCode(param.getDepartmentCode())
.deptPrincipal(param.getDeptPrincipal()) .coadjutant(param.getCoadjutant())
.uuid(param.getUuid())
.showOrder(param.getShowOrder()) .showOrder(param.getShowOrder())
.forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1) .showOrderOfTree(param.getShowOrderOfTree())
.description(param.getDescription()) .created(new Date())
.deleteType(0) .modified(new Date())
.createTime(new Date()) .creater(employeeId)
.updateTime(new Date()) .modifier(employeeId)
.creator(employeeId)
.build(); .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)) { if (CollectionUtils.isEmpty(departmentPOs)) {
return Collections.emptyList(); return Collections.emptyList();
@ -109,17 +110,17 @@ public class DepartmentBO {
SingleDeptTreeVO SingleDeptTreeVO
.builder() .builder()
.id(e.getId()) .id(e.getId())
.deptNo(e.getDeptNo()) .departmentCode(e.getDepartmentCode())
.deptName(e.getDeptName()) .departmentMark(e.getDepartmentMark())
.parentComp(e.getParentComp()) .subCompanyId1(e.getSubCompanyId1())
.parentDept(e.getParentDept()) .supDepId(e.getSupDepId())
.parentDeptName(e.getParentDept() == null ? "" : getDeptNameById(e.getParentDept())) .supDepName(e.getSupDepId() == 0 ? "" : getDeptNameById(e.getSupDepId()))
.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal())) //.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal()))
.build()).collect(Collectors.toList()); .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) { public static List<SearchTree> buildSetToSearchTree(Set<DepartmentPO> departmentPOS) {
@ -131,23 +132,23 @@ public class DepartmentBO {
return departmentPOS.stream().map(item -> { return departmentPOS.stream().map(item -> {
SearchTree tree = new SearchTree(); SearchTree tree = new SearchTree();
tree.setCanClick(true); 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.setIcon(isLeaf ? "icon-coms-Branch" : "icon-coms-LargeArea");
tree.setId(item.getId().toString()); tree.setId(item.getId().toString());
tree.setIsParent(false); tree.setIsParent(false);
tree.setIsVirtual("0"); tree.setIsVirtual("0");
tree.setName(item.getDeptName()); tree.setName(item.getDepartmentName());
tree.setPid(null == item.getParentDept() ? "0" : item.getParentDept().toString()); tree.setPid(item.getSupDepId().toString());
tree.setSelected(false); tree.setSelected(false);
tree.setType("2"); tree.setType("2");
tree.setParentComp(null == item.getParentComp() ? "0" : item.getParentComp().toString()); tree.setParentComp(item.getSubCompanyId1().toString());
tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder()); tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder().intValue());
return tree; return tree;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
public static String getDeptNameById(Long id) { public static String getDeptNameById(Integer id) {
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(id); return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(id);
} }
@ -163,11 +164,11 @@ public class DepartmentBO {
* @param po * @param po
* @param poMaps * @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)) { if (!addedList.contains(po)) {
addedList.add(po); addedList.add(po);
} }
DepartmentPO parentPO = poMaps.get(po.getParentDept()); DepartmentPO parentPO = poMaps.get(po.getSupDepId());
if (null != parentPO) { if (null != parentPO) {
dealParentData(addedList, parentPO, poMaps); dealParentData(addedList, parentPO, poMaps);
} }

@ -24,7 +24,7 @@ import java.util.List;
tableType = WeaTableType.NONE) tableType = WeaTableType.NONE)
public class DepartmentListDTO { public class DepartmentListDTO {
private Long id; private Integer id;
/** /**
* *
*/ */
@ -33,58 +33,54 @@ public class DepartmentListDTO {
/** /**
* *
*/ */
@TableTitle(title = "名称", dataIndex = "deptName", key = "deptName",width = "200") @TableTitle(title = "名称", dataIndex = "departmentMark", key = "departmentMark", width = "200")
private String deptName; private String departmentMark;
/** /**
* *
*/ */
@TableTitle(title = "编号", dataIndex = "deptNo", key = "deptNo") @TableTitle(title = "编号", dataIndex = "departmentCode", key = "departmentCode")
private String deptNo; private String departmentCode;
/** /**
* *
*/ */
@TableTitle(title = "简称", dataIndex = "deptNameShort", key = "deptNameShort") @TableTitle(title = "简称", dataIndex = "departmentName", key = "departmentName")
private String deptNameShort; private String departmentName;
/** /**
* *
*/ */
@TableTitle(title = "所属分部", dataIndex = "parentComp", key = "parentComp") @TableTitle(title = "所属分部", dataIndex = "subCompanyName", key = "subCompanyName")
private String parentComp; private String subCompanyName;
private Integer subCompanyId1;
/** /**
* *
*/ */
@TableTitle(title = "上级部门", dataIndex = "parentDeptName", key = "parentDeptName") @TableTitle(title = "上级部门", dataIndex = "supDepName", key = "supDepName")
private String parentDeptName; private String supDepName;
private Long parentDept; private Integer supDepId;
/** ///**
* // * 部门负责人
*/ // */
@TableTitle(title = "部门负责人", dataIndex = "deptPrincipal", key = "deptPrincipal") //@TableTitle(title = "部门负责人", dataIndex = "deptPrincipal", key = "deptPrincipal")
private String deptPrincipal; //private String deptPrincipal;
/** /**
* *
*/ */
@TableTitle(title = "显示顺序", dataIndex = "showOrder", key = "showOrder", sorter = true) @TableTitle(title = "显示顺序", dataIndex = "showOrder", key = "showOrder", sorter = true)
private int showOrder; private Double showOrder;
///**
// * 说明
// */
//@TableTitle(title = "说明", dataIndex = "description", key = "description")
//private String description;
/** /**
* *
*/ */
@TableTitle(title = "是否启用", dataIndex = "forbiddenTag", key = "forbiddenTag") @TableTitle(title = "是否启用", dataIndex = "canceled", key = "canceled")
private int forbiddenTag; 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 @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class DepartmentMoveParam { public class DepartmentMoveParam {
private Long id; private Integer id;
private String moveType; private String moveType;
private Long company; private Integer company;
private Long department; private Integer department;
} }

@ -17,29 +17,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class DeptSearchParam extends BaseQueryParam { public class DeptSearchParam extends BaseQueryParam {
private Long id; private Integer id;
private String departmentMark;
private String deptNo;
private String departmentName; private String departmentName;
private Integer subCompanyId1;
private String deptNameShort; private Integer supDepId;
private String allSupDepId;
private Long parentComp; private Boolean canceled;
private Long ecCompany; private String departmentCode;
private Integer coadjutant;
private Long parentDept;
private Long ecDepartment; private String uuid;
private Double showOrder;
private Long deptPrincipal; private Integer showOrderOfTree;
private Integer showOrder;
private String description;
private Boolean forbiddenTag;
private Long subcompanyid1;
private Long departmentid;
} }

@ -18,8 +18,8 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
public class QuerySingleDeptListParam extends BaseQueryParam { 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 @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class DepartmentPO { public class DepartmentPO {
private Integer id;
private Long id; private String departmentMark;
private String departmentName;
private String deptNo; private Integer subCompanyId1;
private Integer supDepId;
private String deptName; private String allSupDepId;
private Integer canceled;
private String deptNameShort; private String departmentCode;
private Integer coadjutant;
private Long parentComp;
private Long ecCompany; private Date created;
private Integer creater;
private Long parentDept; private Date modified;
private Long ecDepartment; private Integer modifier;
private Long deptPrincipal; //部门负责人
private Integer showOrder;
private String description;
private Integer forbiddenTag;
private String uuid; 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) tableType = WeaTableType.NONE)
public class SingleDeptTreeVO { public class SingleDeptTreeVO {
private Long id; private Integer id;
@TableTitle(title = "编号", dataIndex = "deptNo", key = "deptNo") @TableTitle(title = "编号", dataIndex = "departmentCode", key = "departmentCode")
private String deptNo; private String departmentCode;
@TableTitle(title = "部门名称", dataIndex = "deptName", key = "deptName") @TableTitle(title = "部门名称", dataIndex = "departmentMark", key = "departmentMark")
private String deptName; private String departmentMark;
private Long parentComp; //上级分部 private Integer subCompanyId1; //上级分部
private Long parentDept; //上级部门id private Integer supDepId; //上级部门id
@TableTitle(title = "上级部门", dataIndex = "parentDeptName", key = "parentDeptName") @TableTitle(title = "上级部门", dataIndex = "supDepName", key = "supDepName")
private String parentDeptName; //上级部门 private String supDepName; //上级部门
@TableTitle(title = "部门负责人", dataIndex = "deptPrincipalName", key = "deptPrincipalName") //@TableTitle(title = "部门负责人", dataIndex = "deptPrincipalName", key = "deptPrincipalName")
private String deptPrincipalName; //部门负责人 //private String deptPrincipalName; //部门负责人
//子节点 //子节点
private List<SingleDeptTreeVO> children; private List<SingleDeptTreeVO> children;

@ -296,7 +296,7 @@ public class ExtendInfoBO {
switch (fieldhtmltype) { switch (fieldhtmltype) {
case "1": //单行文本框 case "1": //单行文本框
if (detailtype.equals("2")) {//数字 if ("2".equals(detailtype)) {//数字
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUTNUMBER, fieldlabel, fieldname, isQuickSearch); searchConditionItem = conditionFactory.createCondition(ConditionType.INPUTNUMBER, fieldlabel, fieldname, isQuickSearch);
} else { } else {
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, "25034", fieldname, isQuickSearch); searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, "25034", fieldname, isQuickSearch);
@ -347,14 +347,14 @@ public class ExtendInfoBO {
break; break;
} }
default: 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)); BrowserBean browserbean = new BrowserBean(Util.null2String(detailtype));
BrowserInitUtil browserInitUtil = new BrowserInitUtil(); BrowserInitUtil browserInitUtil = new BrowserInitUtil();
String fielddbtype = customValue; String fielddbtype = customValue;
if (!customValue.startsWith("browser.")) { if (!customValue.startsWith("browser.")) {
fielddbtype = "browser." + customValue; 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()); browserInitUtil.initCustomizeBrow(browserbean, fielddbtype, Util.getIntValue(detailtype), user.getUID());
} else { } else {
browserbean.getDataParams().put("cube_treeid", customValue); browserbean.getDataParams().put("cube_treeid", customValue);
@ -382,7 +382,9 @@ public class ExtendInfoBO {
String[] fieldvalues = Util.splitString(tmpFieldValue, ","); String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) { for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) {
String fieldshowname = Util.null2String(shiftManagementToolKit.getShiftOnOffWorkSections(fieldvalues[i], user.getLanguage())); 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<>(); Map<String, Object> replaceData = new HashMap<>();
replaceData.put("id", fieldvalues[i]); replaceData.put("id", fieldvalues[i]);
replaceData.put("name", fieldshowname); replaceData.put("name", fieldshowname);
@ -395,7 +397,9 @@ public class ExtendInfoBO {
String[] fieldvalues = Util.splitString(tmpFieldValue, ","); String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) { for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) {
String fieldshowname = Util.null2String(sensitiveWordTypeComInfo.getName(fieldvalues[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<>(); Map<String, Object> replaceData = new HashMap<>();
replaceData.put("id", fieldvalues[i]); replaceData.put("id", fieldvalues[i]);
replaceData.put("name", fieldshowname); 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 fieldshowname = hrmFieldManager.getFieldvalue(user, customValue, Util.getIntValue(fieldid), Util.getIntValue(fieldhtmltype), Util.getIntValue(detailtype), tmpFieldValue, 0);
String[] fieldvalues = Util.splitString(tmpFieldValue, ","); String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
String[] fieldshownames = Util.splitString(fieldshowname, ","); String[] fieldshownames = Util.splitString(fieldshowname, ",");
if (detailtype.equals("257")) { if ("257".equals(detailtype)) {
if (fieldshowname.endsWith("&nbsp")) { if (fieldshowname.endsWith("&nbsp")) {
fieldshowname = fieldshowname.substring(0, fieldshowname.length() - 5); fieldshowname = fieldshowname.substring(0, fieldshowname.length() - 5);
} }
@ -450,7 +454,7 @@ public class ExtendInfoBO {
break; break;
case "4": //Check框 case "4": //Check框
searchConditionItem = conditionFactory.createCondition(ConditionType.CHECKBOX, fieldlabel, fieldname); searchConditionItem = conditionFactory.createCondition(ConditionType.CHECKBOX, fieldlabel, fieldname);
if (detailtype.equals("2")) { if ("2".equals(detailtype)) {
searchConditionItem.setConditionType(ConditionType.SWITCH); searchConditionItem.setConditionType(ConditionType.SWITCH);
} }
@ -459,7 +463,7 @@ public class ExtendInfoBO {
List<SearchConditionOption> searchConditionOptions = SelectOptionParam.convertJsonToListOption(customValue); List<SearchConditionOption> searchConditionOptions = SelectOptionParam.convertJsonToListOption(customValue);
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname, searchConditionOptions); searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname, searchConditionOptions);
if (detailtype.equals("") || detailtype.equals("0")) { if ("".equals(detailtype) || "0".equals(detailtype)) {
detailtype = "1"; detailtype = "1";
} }
searchConditionItem.setKey(Util.null2String(fieldvalue)); searchConditionItem.setKey(Util.null2String(fieldvalue));
@ -467,7 +471,7 @@ public class ExtendInfoBO {
searchConditionItem.setDetailtype(Util.getIntValue(detailtype, 3)); searchConditionItem.setDetailtype(Util.getIntValue(detailtype, 3));
break; break;
case "6": //附件 case "6": //附件
if (fieldname.equals("resourceimageid")) { if ("resourceimageid".equals(fieldname)) {
searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, fieldlabel, fieldname, isQuickSearch); searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, fieldlabel, fieldname, isQuickSearch);
} else { } else {
searchConditionItem = conditionFactory.createCondition(ConditionType.UPLOAD, fieldlabel, fieldname, isQuickSearch); searchConditionItem = conditionFactory.createCondition(ConditionType.UPLOAD, fieldlabel, fieldname, isQuickSearch);

@ -38,17 +38,17 @@ public class ExtendInfoFieldParam {
public String getControlType() { public String getControlType() {
JSONArray fieldType = (JSONArray) this.getFieldType(); JSONArray fieldType = (JSONArray) this.getFieldType();
String fieldHtmlType = Util.null2String(fieldType.get(0)); String fieldHtmlType = Util.null2String(fieldType.get(0));
if (fieldHtmlType.equals("input")) { if ("input".equals(fieldHtmlType)) {
fieldHtmlType = "1"; fieldHtmlType = "1";
} else if (fieldHtmlType.equals("textarea")) { } else if ("textarea".equals(fieldHtmlType)) {
fieldHtmlType = "2"; fieldHtmlType = "2";
} else if (fieldHtmlType.equals("browser")) { } else if ("browser".equals(fieldHtmlType)) {
fieldHtmlType = "3"; fieldHtmlType = "3";
} else if (fieldHtmlType.equals("check")) { } else if ("check".equals(fieldHtmlType)) {
fieldHtmlType = "4"; fieldHtmlType = "4";
} else if (fieldHtmlType.equals("select")) { } else if ("select".equals(fieldHtmlType)) {
fieldHtmlType = "5"; fieldHtmlType = "5";
} else if (fieldHtmlType.equals("upload")) { } else if ("upload".equals(fieldHtmlType)) {
fieldHtmlType = "6"; fieldHtmlType = "6";
} }
return fieldHtmlType; return fieldHtmlType;
@ -60,27 +60,27 @@ public class ExtendInfoFieldParam {
if (fieldType.size() > 1) { if (fieldType.size() > 1) {
browserType = Util.null2String(fieldType.get(1)); browserType = Util.null2String(fieldType.get(1));
} }
if (controlType.equals("1")) { if ("1".equals(controlType)) {
if (browserType.equals("text")) { if ("text".equals(browserType)) {
browserType = "1"; browserType = "1";
} else if (browserType.equals("int")) { } else if ("int".equals(browserType)) {
browserType = "2"; browserType = "2";
} else if (browserType.equals("float")) { } else if ("float".equals(browserType)) {
browserType = "3"; browserType = "3";
} else if (browserType.equals("file")) { } else if ("file".equals(browserType)) {
browserType = "1"; browserType = "1";
} }
} }
if (controlType.equals("2")) { if ("2".equals(controlType)) {
browserType = "1"; browserType = "1";
} else if (controlType.equals("3")) { } else if ("3".equals(controlType)) {
browserType = Util.null2String(((JSONObject) fieldType.get(1)).get("value")); browserType = Util.null2String(((JSONObject) fieldType.get(1)).get("value"));
} else if (controlType.equals("4")) { } else if ("4".equals(controlType)) {
browserType = "1"; browserType = "1";
} else if (controlType.equals("5")) { } else if ("5".equals(controlType)) {
browserType = "1"; browserType = "1";
} else if (controlType.equals("6")) { } else if ("6".equals(controlType)) {
if (browserType.equals("file")) { if ("file".equals(browserType)) {
browserType = "1"; browserType = "1";
} }
} }
@ -89,7 +89,7 @@ public class ExtendInfoFieldParam {
public String getDbType(String controlType, String browserType) { public String getDbType(String controlType, String browserType) {
FieldParam fp = new FieldParam(); FieldParam fp = new FieldParam();
if (controlType.equals("1")) { if ("1".equals(controlType)) {
JSONArray fieldType = (JSONArray) this.getFieldType(); JSONArray fieldType = (JSONArray) this.getFieldType();
String dbLength = "100"; String dbLength = "100";
if (fieldType.size() > 2) { if (fieldType.size() > 2) {
@ -101,15 +101,15 @@ public class ExtendInfoFieldParam {
} }
fp.setSimpleText(Util.getIntValue(browserType, -1), dbLength); fp.setSimpleText(Util.getIntValue(browserType, -1), dbLength);
} else if (controlType.equals("2")) { } else if ("2".equals(controlType)) {
fp.setText(); fp.setText();
} else if (controlType.equals("3")) { } else if ("3".equals(controlType)) {
fp.setBrowser(Util.getIntValue(browserType, -1)); fp.setBrowser(Util.getIntValue(browserType, -1));
} else if (controlType.equals("4")) { } else if ("4".equals(controlType)) {
fp.setCheck(); fp.setCheck();
} else if (controlType.equals("5")) { } else if ("5".equals(controlType)) {
fp.setSelect(); fp.setSelect();
} else if (controlType.equals("6")) { } else if ("6".equals(controlType)) {
fp.setAttach(); fp.setAttach();
} }
return fp.getFielddbtype(); return fp.getFielddbtype();

@ -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)) { if (CollectionUtils.isEmpty(jobPOS)) {
return Collections.emptyList(); return Collections.emptyList();
} }
@ -78,15 +78,13 @@ public class JobBO {
public static List<JobListDTO> buildDTOList(Collection<JobListDTO> list) { 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 -> List<JobListDTO> dtoList = list.stream().map(e ->
JobListDTO.builder() JobListDTO.builder()
.id(e.getId()) .id(e.getId())
.jobNo(e.getJobNo()) .jobNo(e.getJobNo())
.jobName(e.getJobName()) .jobName(e.getJobName())
.compName(e.getCompName()) .subCompanyName(e.getSubCompanyName())
.deptName(e.getDeptName()) .departmentName(e.getDepartmentName())
.sequenceName(e.getSequenceName()) .sequenceName(e.getSequenceName())
.schemeName(e.getSchemeName()) .schemeName(e.getSchemeName())
//.parentJob(e.getParentJob()) //.parentJob(e.getParentJob())

@ -44,13 +44,13 @@ public class JobListDTO {
/** /**
* *
*/ */
@TableTitle(title = "所属分部", dataIndex = "compName", key = "compName") @TableTitle(title = "所属分部", dataIndex = "subCompanyName", key = "subCompanyName")
private String compName; private String subCompanyName;
/** /**
* *
*/ */
@TableTitle(title = "所属部门", dataIndex = "deptName", key = "deptName") @TableTitle(title = "所属部门", dataIndex = "departmentName", key = "departmentName")
private String deptName; private String departmentName;
/** /**
* *
*/ */
@ -68,7 +68,7 @@ public class JobListDTO {
//@TableTitle(title = "上级岗位", dataIndex = "parentJobName", key = "parentJobName") //@TableTitle(title = "上级岗位", dataIndex = "parentJobName", key = "parentJobName")
private String parentJobName; private String parentJobName;
private Long parentJob; private Long parentJob;
private Long parentComp; private Integer parentComp;
/** /**
* *
*/ */

@ -32,11 +32,11 @@ public class JobSearchParam extends BaseQueryParam {
/** /**
* ec * ec
*/ */
private Long ecCompany; private Integer ecCompany;
/** /**
* ec * ec
*/ */
private Long ecDepartment; private Integer ecDepartment;
/** /**
* *
*/ */
@ -79,7 +79,7 @@ public class JobSearchParam extends BaseQueryParam {
*/ */
private Integer showOrder; 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 * ec
*/ */
private Long ecCompany; private Integer ecCompany;
/** /**
* *
*/ */
private Long parentDept; private Integer parentDept;
/** /**
* ec * ec
*/ */
private Long ecDepartment; private Integer ecDepartment;
/** /**
* *

@ -37,7 +37,7 @@ public class SingleJobTreeVO {
private Long parentJob; private Long parentJob;
private Long parentDept; private Integer parentDept;
private List<SingleJobTreeVO> children; private List<SingleJobTreeVO> children;

@ -98,8 +98,12 @@ public class FieldInfo {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FieldInfo fieldInfo = (FieldInfo) o; FieldInfo fieldInfo = (FieldInfo) o;
return Objects.equals(fieldName, fieldInfo.fieldName) && return Objects.equals(fieldName, fieldInfo.fieldName) &&
Objects.equals(firstFieldType, fieldInfo.firstFieldType) && Objects.equals(firstFieldType, fieldInfo.firstFieldType) &&

@ -24,8 +24,12 @@ public class SearchTree extends TreeNode {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SearchTree that = (SearchTree) o; 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); 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 Integer compId;
private Long ecCompany; private Integer ecCompany;
/** /**
* *
*/ */
private Long deptId; private Integer deptId;
private Long ecDepartment; private Integer ecDepartment;
/** /**
* *
*/ */

@ -29,13 +29,13 @@ public class StaffPO {
/** /**
* *
*/ */
private Long compId; private Integer compId;
private Long ecCompany; private Integer ecCompany;
/** /**
* *
*/ */
private Long deptId; private Integer deptId;
private Long ecDepartment; private Integer ecDepartment;
/** /**
* *
*/ */

@ -5,7 +5,6 @@ import org.apache.ibatis.annotations.Param;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @description: * @description:
@ -19,7 +18,9 @@ public interface CompMapper {
* *
* @return * @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 * ID
@ -30,48 +31,13 @@ public interface CompMapper {
List<String> listUsedIds(); 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 * @param ids
* @return * @return
*/ */
List<CompPO> listChild(@Param("ids") Collection ids); List<CompPO> listChild(@Param("ids") Collection<Long> ids);
/**
* ID
*
* @param pid
* @return
*/
List<CompPO> listChildByPID(@Param("pid") String pid);
/**
* ID
*
* @param pid
* @return
*/
int countChildByPID(@Param("pid") long pid);
/** /**
* ID * ID
@ -79,33 +45,7 @@ public interface CompMapper {
* @param id * @param id
* @return * @return
*/ */
CompPO listById(@Param("id") Long id); CompPO listById(@Param("id") Integer id);
/**
* UUID
*
* @param uuid
* @return
*/
CompPO getCompanyByUUID(@Param("uuid") String uuid);
/**
* No
*
* @param compNo
* @return
*/
List<CompPO> listByNo(@Param("compNo") String compNo);
/**
*
*
* @param ids
* @return
*/
List<Map<String, Object>> listCompsByIds(@Param("ids") Collection<Long> ids);
/** /**
* ID * ID
@ -115,38 +55,25 @@ public interface CompMapper {
*/ */
List<CompPO> getCompsByIds(@Param("ids") Collection<Long> ids); List<CompPO> getCompsByIds(@Param("ids") Collection<Long> ids);
/** /**
* / *
* *
* @param compPO
* @return * @return
*/ */
int insertIgnoreNull(CompPO compPO); List<CompPO> listParent();
List<String> hasSubs();
/** List<String> hasDetachSubs(@Param("companyIds") Collection<Long> companyIds);
*
*
* @param compPO
* @return
*/
int updateBaseComp(CompPO compPO);
/** /**
* * ID
* *
* @param compPO * @param subCompanyName
* @param supSubComId
* @return * @return
*/ */
int updateForbiddenTagById(CompPO compPO); Integer getIdByNameAndPid(@Param("subCompanyName") String subCompanyName, @Param("supSubComId") Integer supSubComId);
/**
*
*
* @param ids
*/
int deleteByIds(@Param("ids") Collection<Long> ids);
/** /**
* *
@ -154,28 +81,4 @@ public interface CompMapper {
* @return * @return
*/ */
Integer getMaxShowOrder(); 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"> <mapper namespace="com.engine.organization.mapper.comp.CompMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.company.po.CompPO"> <resultMap id="BaseResultMap" type="com.engine.organization.entity.company.po.CompPO">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="comp_no" property="compNo"/> <result column="subCompanyName" property="subCompanyName"/>
<result column="comp_name" property="compName"/> <result column="subCompanyDesc" property="subCompanyDesc"/>
<result column="comp_name_short" property="compNameShort"/> <result column="companyId" property="companyId"/>
<result column="parent_company" property="parentCompany"/> <result column="supSubComId" property="supSubComId"/>
<result column="ec_company" property="ecCompany"/> <result column="url" property="url"/>
<result column="org_code" property="orgCode"/> <result column="canceled" property="canceled"/>
<result column="industry" property="industry"/> <result column="subCompanyCode" property="subCompanyCode"/>
<result column="comp_principal" property="compPrincipal"/> <result column="outKey" property="outKey"/>
<result column="description" property="description"/> <result column="limitUsers" property="limitUsers"/>
<result column="forbidden_tag" property="forbiddenTag"/>
<result column="show_order" property="showOrder"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="uuid" property="uuid"/> <result column="uuid" property="uuid"/>
<result column="showOrder" property="showOrder"/>
<result column="showOrderOfTree" property="showOrderOfTree"/>
</resultMap> </resultMap>
<!-- 表字段 --> <!-- 表字段 -->
@ -27,524 +22,190 @@
t t
. .
id id
, t.comp_no , t.subCompanyName
, t.comp_name , t.subCompanyDesc
, t.comp_name_short , t.companyId
, t.parent_company , t.supSubComId
, t.ec_company , t.url
, t.org_code , t.canceled
, t.industry , t.subCompanyCode
, t.comp_principal , t.outKey
, t.description , t.limitUsers
, t.forbidden_tag
, t.show_order
, t.creator
, t.delete_type
, t.create_time
, t.update_time
, t.uuid , t.uuid
, t.showOrder
, t.showOrderOfTree
</sql> </sql>
<sql id="nullSql"> <select id="listAll" resultMap="BaseResultMap">
and ifnull(parent_company,'0')='0'
</sql>
<sql id="nullSql" databaseId="sqlserver">
and isnull(parent_company,'0')='0'
</sql>
<sql id="nullSql" databaseId="oracle">
and NVL(parent_company,'0')='0'
</sql>
<sql id="nullParentCompany">
and ifnull(parent_company,0) =
#{parentCompany}
</sql>
<sql id="nullParentCompany" databaseId="sqlserver">
and isnull(parent_company,0) =
#{parentCompany}
</sql>
<sql id="nullParentCompany" databaseId="oracle">
and NVL(parent_company,0) =
#{parentCompany}
</sql>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.company.po.CompPO" keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
INSERT INTO jcl_org_comp
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="compNo != null ">
comp_no,
</if>
<if test="compName != null ">
comp_name,
</if>
<if test="compNameShort != null ">
comp_name_short,
</if>
<if test="parentCompany != null ">
parent_company,
</if>
<if test="ecCompany != null ">
ec_company,
</if>
<if test="orgCode != null ">
org_code,
</if>
<if test="industry != null ">
industry,
</if>
<if test="compPrincipal != null ">
comp_principal,
</if>
<if test="description != null ">
description,
</if>
forbidden_tag,
<if test="showOrder != null ">
show_order,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="compNo != null ">
#{compNo},
</if>
<if test="compName != null ">
#{compName},
</if>
<if test="compNameShort != null ">
#{compNameShort},
</if>
<if test="parentCompany != null ">
#{parentCompany},
</if>
<if test="ecCompany != null ">
#{ecCompany},
</if>
<if test="orgCode != null ">
#{orgCode},
</if>
<if test="industry != null ">
#{industry},
</if>
<if test="compPrincipal != null ">
#{compPrincipal},
</if>
<if test="description != null ">
#{description},
</if>
0,
<if test="showOrder != null ">
#{showOrder},
</if>
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.company.po.CompPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_COMP_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_comp
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="compNo != null ">
comp_no,
</if>
<if test="compName != null ">
comp_name,
</if>
<if test="compNameShort != null ">
comp_name_short,
</if>
<if test="parentCompany != null ">
parent_company,
</if>
<if test="ecCompany != null ">
ec_company,
</if>
<if test="orgCode != null ">
org_code,
</if>
<if test="industry != null ">
industry,
</if>
<if test="compPrincipal != null ">
comp_principal,
</if>
<if test="description != null ">
description,
</if>
forbidden_tag,
<if test="showOrder != null ">
show_order,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="compNo != null ">
#{compNo},
</if>
<if test="compName != null ">
#{compName},
</if>
<if test="compNameShort != null ">
#{compNameShort},
</if>
<if test="parentCompany != null ">
#{parentCompany},
</if>
<if test="ec_company != null ">
#{ecCompany},
</if>
<if test="orgCode != null ">
#{orgCode},
</if>
<if test="industry != null ">
#{industry},
</if>
<if test="compPrincipal != null ">
#{compPrincipal},
</if>
<if test="description != null ">
#{description},
</if>
0,
<if test="showOrder != null ">
#{showOrder},
</if>
</trim>
</insert>
<select id="list" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_org_comp t
WHERE t.delete_type = 0 order by ${orderSql}
</select>
<select id="listParent" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_org_comp t
WHERE t.delete_type = 0
<include refid="nullSql"/>
</select>
<select id="listChild" resultMap="BaseResultMap">
SELECT SELECT
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM FROM
jcl_org_comp t hrmsubcompany t
WHERE t.delete_type = 0 order by ${orderSql}
AND parent_company IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<select id="listById" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_org_comp t
WHERE t.delete_type = 0
and id = #{id}
</select> </select>
<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 id="listByFilter" resultMap="BaseResultMap">
SELECT SELECT
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM FROM
jcl_org_comp t hrmsubcompany t
WHERE t.delete_type = 0 WHERE 1=1
<include refid="likeSQL"/> <include refid="likeSQL"/>
<if test=" compPO.parentCompany != null "> <if test=" CompanyPO.supSubComId != null ">
and t.parent_company = #{compPO.parentCompany} and t.supSubComId = #{CompanyPO.supSubComId}
</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> </if>
order by ${orderSql} order by ${orderSql}
</select> </select>
<select id="listCompsByIds" resultType="java.util.Map">
select
id as "id",
comp_name as "name"
from jcl_org_comp t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<select id="listChildByPID" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_org_comp t
WHERE t.delete_type = 0
and parent_company = #{pid}
</select>
<select id="countChildByPID" resultType="java.lang.Integer">
SELECT count(1)
FROM jcl_org_comp t
WHERE t.delete_type = 0
and parent_company = #{pid}
</select>
<select id="getCompsByIds" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_comp t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<select id="listUsedId" resultType="java.lang.String"> <select id="listUsedId" resultType="java.lang.String">
select parent_comp select SUBCOMPANYID1
from JCL_ORG_DEPT from hrmdepartment
where delete_type = 0
union union
select parent_comp select ec_company
from JCL_ORG_JOB from JCL_ORG_JOB
where delete_type = 0 where delete_type = 0
union union
select comp_id select ec_company
from JCL_ORG_STAFF from JCL_ORG_STAFF
where delete_type = 0 where delete_type = 0
</select> </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 id="listUsedIds" resultType="java.lang.String">
select company_id select ec_company
from JCL_ORG_STAFFPLAN from JCL_ORG_STAFFPLAN
where delete_type = 0 where delete_type = 0
union union
select jcl_rolelevel select ec_rolelevel
from jcl_org_detach from jcl_org_detach
where delete_type = 0 where delete_type = 0
</select> </select>
<select id="getCompanyByUUID" resultMap="BaseResultMap">
<select id="listChild" resultMap="BaseResultMap">
SELECT SELECT
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM FROM
jcl_org_comp t hrmsubcompany t
WHERE t.delete_type = 0 WHERE supsubcomid IN
and uuid = #{uuid} <foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select> </select>
<select id="checkRepeatNo" resultType="java.lang.Integer">
select count(1) <select id="listById" resultMap="BaseResultMap">
from jcl_org_comp t SELECT
where t.delete_type = 0 <include refid="baseColumns"/>
AND comp_no = #{companyNo} FROM
<if test=" id != null "> hrmsubcompany t
and t.id != #{id} WHERE id = #{id}
</if>
</select> </select>
<select id="getCompanyByNo" resultMap="BaseResultMap">
<select id="getCompsByIds" resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from from jcl_org_comp t from hrmsubcompany t
where t.delete_type = 0 WHERE id IN
AND comp_no = #{companyNo} <foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select> </select>
<select id="listParent" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
hrmsubcompany t
WHERE t.SUPSUBCOMID = 0
</select>
<select id="hasSubs" resultType="java.lang.String"> <select id="hasSubs" resultType="java.lang.String">
select parent_company select supsubcomid
from jcl_org_comp from hrmsubcompany
where forbidden_tag = 0 where 1=1
and delete_type = 0 <include refid="subsWhere"/>
union union
select parent_comp select subcompanyid1
from jcl_org_dept from hrmdepartment
where forbidden_tag = 0 where 1=1
and delete_type = 0 <include refid="subsWhere"/>
</select>
<select id="getCompanyIdsByUuid" resultType="java.lang.Long">
select id from jcl_org_comp
where delete_type = 0 and uuid in
<foreach collection="uuids" open="(" item="uuid" separator="," close=")">
#{uuid}
</foreach>
</select> </select>
<select id="hasDetachSubs" resultType="java.lang.String"> <select id="hasDetachSubs" resultType="java.lang.String">
select parent_company select supsubcomid
from jcl_org_comp from hrmsubcompany
where forbidden_tag = 0 where 1=1
and delete_type = 0 <include refid="subsWhere"/>
and id in and id in
<foreach collection="companyIds" open="(" item="id" separator="," close=")"> <foreach collection="companyIds" open="(" item="id" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
union union
select parent_comp select subcompanyid1
from jcl_org_dept from hrmdepartment
where forbidden_tag = 0 where 1=1
and delete_type = 0 <include refid="subsWhere"/>
and parent_comp in and subcompanyid1 in
<foreach collection="companyIds" open="(" item="id" separator="," close=")"> <foreach collection="companyIds" open="(" item="id" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</select> </select>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.sequence.po.SequencePO"> <select id="getIdByNameAndPid" resultType="java.lang.Integer">
update jcl_org_comp select id
<set> from hrmsubcompany
forbidden_tag=#{forbiddenTag}, where subcompanyname = #{subCompanyName}
</set> and supsubcomid = #{supSubComId}
WHERE id = #{id} AND delete_type = 0 </select>
</update>
<update id="deleteByIds"> <select id="getMaxShowOrder" resultType="java.lang.Integer">
UPDATE jcl_org_comp select max(showorder)
SET delete_type = 1 from hrmsubcompany
WHERE delete_type = 0 </select>
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<update id="updateBaseComp" parameterType="com.engine.organization.entity.company.po.CompPO">
update jcl_org_comp
<set>
creator=#{creator},
update_time=#{updateTime},
comp_name=#{compName},
comp_name_short=#{compNameShort},
parent_company=#{parentCompany},
ec_company=#{ecCompany},
org_code=#{orgCode},
industry=#{industry},
comp_principal=#{compPrincipal},
description=#{description},
show_order=#{showOrder},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<sql id="likeSQL"> <sql id="likeSQL">
<if test=" compPO.compNo != null and compPO.compNo != '' "> <if test=" CompanyPO.subCompanyCode != null and CompanyPO.subCompanyCode != '' ">
and t.comp_no like CONCAT('%',#{compPO.compNo},'%') and t.subCompanyCode like CONCAT('%',#{CompanyPO.subCompanyCode},'%')
</if> </if>
<if test=" compPO.compName != null and compPO.compName != '' "> <if test=" CompanyPO.subCompanyDesc != null and CompanyPO.subCompanyDesc != '' ">
and t.comp_name like CONCAT('%',#{compPO.compName},'%') and t.subCompanyDesc like CONCAT('%',#{CompanyPO.subCompanyDesc},'%')
</if> </if>
<if test=" compPO.compNameShort != null and compPO.compNameShort != '' "> <if test=" CompanyPO.subCompanyName != null and CompanyPO.subCompanyName != '' ">
and t.comp_name_short like CONCAT('%',#{compPO.compNameShort},'%') and t.subCompanyName like CONCAT('%',#{CompanyPO.subCompanyName},'%')
</if>
<if test=" compPO.orgCode != null and compPO.orgCode != '' ">
and t.org_code like CONCAT('%',#{compPO.orgCode},'%')
</if> </if>
</sql> </sql>
<sql id="likeSQL" databaseId="oracle"> <sql id="likeSQL" databaseId="oracle">
<if test=" compPO.compNo != null and compPO.compNo != '' "> <if test=" CompanyPO.subCompanyCode != null and CompanyPO.subCompanyCode != '' ">
and t.comp_no like '%'||#{compPO.compNo}||'%' and t.subCompanyCode like '%'||#{CompanyPO.subCompanyCode}||'%'
</if>
<if test=" compPO.compName != null and compPO.compName != '' ">
and t.comp_name like '%'||#{compPO.compName}||'%'
</if> </if>
<if test=" compPO.compNameShort != null and compPO.compNameShort != '' "> <if test=" CompanyPO.subCompanyDesc != null and CompanyPO.subCompanyDesc != '' ">
and t.comp_name_short like '%'||#{compPO.compNameShort}||'%' and t.subCompanyDesc like '%'||#{CompanyPO.subCompanyDesc}||'%'
</if> </if>
<if test=" compPO.orgCode != null and compPO.orgCode != '' "> <if test=" CompanyPO.subCompanyName != null and CompanyPO.subCompanyName != '' ">
and t.org_code like '%'||#{compPO.orgCode}||'%' and t.subCompanyName like '%'||#{CompanyPO.subCompanyName}||'%'
</if> </if>
</sql> </sql>
<sql id="likeSQL" databaseId="sqlserver"> <sql id="likeSQL" databaseId="sqlserver">
<if test=" compPO.compNo != null and compPO.compNo != '' "> <if test=" CompanyPO.subCompanyCode != null and CompanyPO.subCompanyCode != '' ">
and t.comp_no like '%'+#{compPO.compNo}+'%' and t.subCompanyCode like '%'+#{CompanyPO.subCompanyCode}+'%'
</if> </if>
<if test=" compPO.compName != null and compPO.compName != '' "> <if test=" CompanyPO.subCompanyDesc != null and CompanyPO.subCompanyDesc != '' ">
and t.comp_name like '%'+#{compPO.compName}+'%' and t.subCompanyDesc like '%'+#{CompanyPO.subCompanyDesc}+'%'
</if> </if>
<if test=" compPO.compNameShort != null and compPO.compNameShort != '' "> <if test=" CompanyPO.subCompanyName != null and CompanyPO.subCompanyName != '' ">
and t.comp_name_short like '%'+#{compPO.compNameShort}+'%' and t.subCompanyName like '%'+#{CompanyPO.subCompanyName}+'%'
</if>
<if test=" compPO.orgCode != null and compPO.orgCode != '' ">
and t.org_code like '%'+#{compPO.orgCode}+'%'
</if> </if>
</sql> </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> </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 * @Version V1.0
**/ **/
public interface DepartmentMapper { public interface DepartmentMapper {
List<DepartmentPO> getDeptListByPId(@Param("PId") Integer PId);
List<DepartmentPO> getDeptListByCompId(@Param("parentComp") Integer parentComp);
List<DepartmentPO> getDeptListByPId(@Param("PId") Long PId);
int countChildByPID(@Param("pid") Long pid);
/** /**
* *
* *
* @return * @return
*/ */
List<DepartmentPO> list(@Param("orderSql") String orderSql); List<DepartmentPO> listAll(@Param("orderSql") String orderSql);
/** /**
* No * No
* *
* @param deptNo * @param departmentCode
* @return * @return
*/ */
List<DepartmentPO> listByNo(@Param("deptNo") String deptNo); List<DepartmentPO> listByNo(@Param("departmentCode") String departmentCode);
/** /**
* *
@ -60,15 +54,7 @@ public interface DepartmentMapper {
* @param id * @param id
* @return * @return
*/ */
DepartmentPO getDeptById(@Param("id") Long id); DepartmentPO getDeptById(@Param("id") Integer id);
/**
* UUID
*
* @param uuid
* @return
*/
DepartmentPO getDepartmentByUUID(@Param("uuid") String uuid);
/** /**
* ID * ID
@ -76,38 +62,7 @@ public interface DepartmentMapper {
* @param id * @param id
* @return * @return
*/ */
String getDeptNameById(@Param("id") Long id); String getDeptNameById(@Param("id") Integer 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);
/** /**
* ID * ID
@ -121,21 +76,22 @@ public interface DepartmentMapper {
* *
* @return * @return
*/ */
Integer getMaxShowOrder(); Double getMaxShowOrder();
/** /**
* *
* *
* @param departmentName * @param departmentName
* @param parentCompany * @param subCompanyId1
* @param parentDepartment * @param supDepId
* @return * @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(); 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"> <mapper namespace="com.engine.organization.mapper.department.DepartmentMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.department.po.DepartmentPO"> <resultMap id="BaseResultMap" type="com.engine.organization.entity.department.po.DepartmentPO">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="dept_no" property="deptNo"/> <result column="departmentMark" property="departmentMark"/>
<result column="dept_name" property="deptName"/> <result column="departmentName" property="departmentName"/>
<result column="dept_name_short" property="deptNameShort"/> <result column="subCompanyId1" property="subCompanyId1"/>
<result column="parent_comp" property="parentComp"/> <result column="supDepId" property="supDepId"/>
<result column="ec_company" property="ecCompany"/> <result column="allSupDepId" property="allSupDepId"/>
<result column="parent_dept" property="parentDept"/> <result column="canceled" property="canceled"/>
<result column="ec_department" property="ecDepartment"/> <result column="departmentCode" property="departmentCode"/>
<result column="dept_principal" property="deptPrincipal"/> <result column="coadjutant" property="coadjutant"/>
<result column="show_order" property="showOrder"/> <result column="showOrder" 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="uuid" property="uuid"/> <result column="uuid" property="uuid"/>
</resultMap> </resultMap>
@ -28,39 +21,28 @@
. .
id id
, ,
t.dept_no, t.departmentMark,
t.dept_name, t.departmentName,
t.dept_name_short, t.subCompanyId1,
t.parent_comp, t.supDepId,
t.ec_company, t.allSupDepId,
t.parent_dept, t.canceled,
t.ec_department, t.departmentCode,
t.dept_principal, t.coadjutant,
t.show_order, t.showOrder,
t.description,
t.forbidden_tag,
t.uuid t.uuid
</sql> </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 id="getDeptListByPId" resultType="com.engine.organization.entity.department.po.DepartmentPO">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_dept t from hrmdepartment t
where delete_type = 0 where supDepId = #{PId}
and parent_dept = #{PId}
</select> </select>
<select id="getDeptNameById" resultType="string"> <select id="getDeptNameById" resultType="string">
select t.dept_name select t.departmentName
from jcl_org_dept t from hrmdepartment t
where id = #{id} where id = #{id}
</select> </select>
@ -68,69 +50,45 @@
resultMap="BaseResultMap"> resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_dept t from hrmdepartment t
where delete_type = 0 where 1=1
<include refid="likeSQL"/> <include refid="likeSQL"/>
<if test=" departmentPO.ecCompany != null "> <if test=" departmentPO.subCompanyId1 != null ">
and t.ec_company = #{departmentPO.ecCompany} 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>
<if test=" departmentPO.deptPrincipal != null "> <if test=" departmentPO.supDepId != null ">
and t.dept_principal = #{departmentPO.deptPrincipal} and t.supDepId = #{departmentPO.supDepId}
</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> </if>
order by ${orderSql} order by ${orderSql}
</select> </select>
<select id="getDeptById" resultType="com.engine.organization.entity.department.po.DepartmentPO"> <select id="getDeptById" resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_dept t from hrmdepartment t
where delete_type = 0 where id = #{id}
and id = #{id}
</select> </select>
<select id="listDeptsByIds" resultType="java.util.Map"> <select id="listDeptsByIds" resultType="java.util.Map">
select select
id as "id", id as "id",
dept_name as "name" departmentName as "name"
from jcl_org_dept t from hrmdepartment t
WHERE delete_type = 0 WHERE id IN
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")"> <foreach collection="ids" open="(" item="id" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="list" resultType="com.engine.organization.entity.department.po.DepartmentPO"> <select id="listAll" resultType="com.engine.organization.entity.department.po.DepartmentPO">
SELECT SELECT
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM jcl_org_dept t FROM hrmdepartment t order by ${orderSql}
WHERE t.delete_type = 0 order by ${orderSql}
</select> </select>
<select id="listByNo" resultType="com.engine.organization.entity.department.po.DepartmentPO"> <select id="listByNo" resultType="com.engine.organization.entity.department.po.DepartmentPO">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_dept t where dept_no = #{deptNo} AND delete_type = 0 from hrmdepartment t where departmentCode = #{departmentCode}
</select>
<select id="countChildByPID" resultType="java.lang.Integer">
select count(1)
from jcl_org_dept t
where delete_type = 0
and parent_dept = #{pid}
</select> </select>
<select id="listUsedId" resultType="java.lang.String"> <select id="listUsedId" resultType="java.lang.String">
select parent_dept select parent_dept
@ -144,361 +102,69 @@
<select id="getDeptsByIds" resultMap="BaseResultMap"> <select id="getDeptsByIds" resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_dept t from hrmdepartment t
where delete_type = 0 where id IN
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")"> <foreach collection="ids" open="(" item="id" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="getMaxShowOrder" resultType="java.lang.Integer"> <select id="getMaxShowOrder" resultType="java.lang.Double">
select max(show_order) select max(showOrder)
from jcl_org_dept from hrmdepartment
</select> </select>
<select id="getIdByNameAndPid" resultType="java.lang.Long"> <select id="getIdByNameAndPid" resultType="java.lang.Integer">
select id select id
from jcl_org_dept from hrmdepartment
where delete_type = 0 and dept_name = #{departmentName} where departmentName = #{departmentName}
and parent_comp = #{parentCompany} and subCompanyId1 = #{subCompanyId1}
<include refid="nullParentDepartment"/> and supDepId = #{supDepId}
</select>
<select id="getDepartmentByUUID" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_dept t
where delete_type = 0
and uuid = #{uuid}
</select> </select>
<select id="checkRepeatNo" resultType="java.lang.Integer"> <select id="checkRepeatNo" resultType="java.lang.Integer">
select count(1) select count(1)
from jcl_org_dept t from hrmdepartment t
where t.delete_type = 0 where departmentCode = #{departmentCode}
AND dept_no = #{departmentNo}
<if test=" id != null "> <if test=" id != null ">
and t.id != #{id} and t.id != #{id}
</if> </if>
</select> </select>
<select id="hasSubs" resultType="java.lang.String"> <select id="hasSubs" resultType="java.lang.String">
select distinct parent_dept select distinct supDepId
from jcl_org_dept from hrmdepartment
where forbidden_tag = 0 where canceled = 0
and delete_type = 0
</select> </select>
<select id="countUsedInJob" resultType="java.lang.Integer"> <select id="countUsedInJob" resultType="java.lang.Integer">
select count(1) select count(1)
from jcl_org_job from jcl_org_job
where forbidden_tag = 0 where forbidden_tag = 0
and delete_type = 0 and delete_type = 0
and parent_dept = #{departmentId} and parent_dept = = #{supDepId}
</select> </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"> <sql id="likeSQL">
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' "> <if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
and t.dept_no like CONCAT('%',#{departmentPO.deptNo},'%') and t.departmentCode like CONCAT('%',#{departmentPO.departmentCode},'%')
</if> </if>
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' "> <if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
and t.dept_name like CONCAT('%',#{departmentPO.deptName},'%') and t.departmentName like CONCAT('%',#{departmentPO.departmentName},'%')
</if>
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' ">
and t.dept_name_short like CONCAT('%',#{departmentPO.deptNameShort},'%')
</if> </if>
</sql> </sql>
<sql id="likeSQL" databaseId="oracle"> <sql id="likeSQL" databaseId="oracle">
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' "> <if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
and t.dept_no like '%'||#{departmentPO.deptNo}||'%' and t.departmentCode like '%'||#{departmentPO.departmentCode}||'%'
</if>
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
and t.dept_name like '%'||#{departmentPO.deptName}||'%'
</if> </if>
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' "> <if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
and t.dept_name_short like '%'||#{departmentPO.deptNameShort}||'%' and t.departmentName like '%'||#{departmentPO.departmentName}||'%'
</if> </if>
</sql> </sql>
<sql id="likeSQL" databaseId="sqlserver"> <sql id="likeSQL" databaseId="sqlserver">
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' "> <if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
and t.dept_no like '%'+#{departmentPO.deptNo}+'%' and t.departmentCode like '%'+#{departmentPO.departmentCode}+'%'
</if>
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
and t.dept_name like '%'+#{departmentPO.deptName}+'%'
</if> </if>
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' "> <if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
and t.dept_name_short like '%'+#{departmentPO.deptNameShort}+'%' and t.departmentName like '%'+#{departmentPO.departmentName}+'%'
</if> </if>
</sql> </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> </mapper>

@ -31,7 +31,7 @@ public interface SystemDataMapper {
RecordInfo getHrmJobTitleByName(@Param("name") String name); 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); List<Long> getHrmResourceIdsByDept(@Param("departmentId") String departmentId);

@ -96,7 +96,7 @@ public interface JobMapper {
* @param ecDepartment * @param ecDepartment
* @return * @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 * @param parentJob
* @return * @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); Long getIdByNameAndEcId(@Param("jobName") String jobName, @Param("ecCompany") String ecCompany, @Param("ecDepartment") String ecDepartment);
@ -176,7 +176,7 @@ public interface JobMapper {
* @param parentCompany * @param parentCompany
* @return * @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); int isHasResource(@Param("jobId") Long jobId);
} }

@ -367,16 +367,16 @@
<select id="listByFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO" <select id="listByFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO"
parameterType="com.engine.organization.entity.job.po.JobPO"> parameterType="com.engine.organization.entity.job.po.JobPO">
SELECT SELECT
a.comp_name , a.subcompanyname ,
b.dept_name , b.departmentname ,
c.sequence_name, c.sequence_name,
d.scheme_name, d.scheme_name,
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM jcl_org_job t FROM jcl_org_job t
left join jcl_org_comp a on left join hrmsubcompany a on
t.parent_comp = a.id t.ec_company = a.id
left join jcl_org_dept b on left join hrmdepartment b on
t.parent_dept = b.id t.ec_department = b.id
left join jcl_org_sequence c on left join jcl_org_sequence c on
t.sequence_id = c.id t.sequence_id = c.id
left join jcl_org_scheme d on left join jcl_org_scheme d on
@ -415,16 +415,16 @@
<select id="listNoFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO"> <select id="listNoFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO">
SELECT SELECT
a.comp_name , a.subcompanyname ,
b.dept_name , b.departmentname ,
c.sequence_name, c.sequence_name,
d.scheme_name, d.scheme_name,
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM jcl_org_job t FROM jcl_org_job t
left join jcl_org_comp a on left join hrmsubcompany a on
t.parent_comp = a.id t.ec_company = a.id
left join jcl_org_dept b on left join hrmdepartment b on
t.parent_dept = b.id t.ec_department = b.id
left join jcl_org_sequence c on left join jcl_org_sequence c on
t.sequence_id = c.id t.sequence_id = c.id
left join jcl_org_scheme d on left join jcl_org_scheme d on

@ -21,7 +21,7 @@ public interface ResourceMapper {
List<HrmResourcePO> getResourceListByJobId(@Param("jobId") Long jobId); 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); HrmResourcePO getResourceById(@Param("id") String id);

@ -33,7 +33,10 @@
<!-- 表字段 --> <!-- 表字段 -->
<sql id="baseColumns"> <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. 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, 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, t.job_activity,t.location_id,t.show_order,t.company_start_date,
@ -53,11 +56,11 @@
</update> </update>
<select id="listAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO"> <select id="listAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
SELECT t.last_name as lastName,d.dept_name as departmentName, SELECT t.last_name as lastName,d.departmentname as departmentName,
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName c.subcompanyname as companyName,t.mobile,t.telephone,t1.last_name as managerName
from jcl_org_hrmresource t from jcl_org_hrmresource t
left join JCL_ORG_DEPT d on t.department_id = d.id left join hrmdepartment d on t.ec_department = d.id
left join jcl_org_comp c on t.company_id = c.id left join hrmsubcompany c on t.ec_eompany = c.id
left join jcl_org_hrmresource t1 on t.manager_id = t1.id left join jcl_org_hrmresource t1 on t.manager_id = t1.id
where 1 = 1 where 1 = 1
<if test="ids != null and ids.size > 0"> <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} from jcl_org_hrmresource t where delete_type = 0 and work_code = #{workCode}
</select> </select>
<select id="listDetachAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO"> <select id="listDetachAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
SELECT t.last_name as lastName,d.dept_name as departmentName, SELECT t.last_name as lastName,d.departmentname as departmentName,
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName c.subcompanyname as companyName,t.mobile,t.telephone,t1.last_name as managerName
from jcl_org_hrmresource t from jcl_org_hrmresource t
left join JCL_ORG_DEPT d on t.department_id = d.id left join hrmdepartment d on t.ec_department = d.id
left join jcl_org_comp c on t.company_id = c.id left join hrmsubcompany c on t.ec_company = c.id
left join jcl_org_hrmresource t1 on t.manager_id = t1.id left join jcl_org_hrmresource t1 on t.manager_id = t1.id
where 1 = 1 where 1 = 1
<if test="ids != null and ids.size > 0"> <if test="ids != null and ids.size > 0">

@ -12,6 +12,4 @@ import java.sql.Date;
**/ **/
public interface JobTriggerMapper { public interface JobTriggerMapper {
Integer sumStaffNum(@Param("fdatebegin") Date fdatebegin, @Param("jobId") Integer jobId); 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 &gt;= #{fdatebegin}) and time_end &gt;= #{fdatebegin})
and job_id = #{jobId} and job_id = #{jobId}
</select> </select>
<select id="countHrmResource" resultType="java.lang.Integer">
select count(1)
from hrmresource
where status &lt;= 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> </mapper>

@ -1,8 +1,7 @@
package com.engine.organization.service; package com.engine.organization.service;
import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionGroup;
import com.engine.organization.entity.company.param.CompSearchParam; import com.engine.organization.entity.company.param.CompParam;
import com.engine.organization.entity.company.param.CompanyParam;
import com.engine.organization.entity.department.param.DepartmentMoveParam; import com.engine.organization.entity.department.param.DepartmentMoveParam;
import com.engine.organization.util.MenuBtn; import com.engine.organization.util.MenuBtn;
@ -23,7 +22,7 @@ public interface CompService {
* @param params * @param params
* @return * @return
*/ */
Map<String, Object> listPage(CompanyParam params); Map<String, Object> listPage(CompParam params);
/** /**
* / * /
@ -38,7 +37,7 @@ public interface CompService {
* *
* @param params * @param params
*/ */
int updateForbiddenTagById(CompSearchParam params); int updateForbiddenTagById(CompParam params);
/** /**
@ -72,7 +71,7 @@ public interface CompService {
Map<String, List<MenuBtn>> getHasRight(); Map<String, List<MenuBtn>> getHasRight();
/** /**
* *
* *
* @param params * @param params
* @return * @return

@ -8,7 +8,6 @@ import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.util.MenuBtn; import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.page.PageInfo; import com.engine.organization.util.page.PageInfo;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -81,9 +80,9 @@ public interface DepartmentService {
/** /**
* ID * 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 * @return
*/ */
Map<String, Object> getSaveForm(DeptSearchParam param); Map<String, Object> getSaveForm(Map<String, Object> params);
/** /**
* *
@ -136,7 +135,7 @@ public interface DepartmentService {
* *
* @return * @return
*/ */
List<SearchConditionGroup> getMergeForm(Long id); List<SearchConditionGroup> getMergeForm();
/** /**
* *

@ -1,7 +1,6 @@
package com.engine.organization.service.impl; package com.engine.organization.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem; import com.api.browser.bean.SearchConditionItem;
import com.api.hrm.bean.HrmFieldBean; 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.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.hrm.entity.RuleCodeType;
import com.engine.hrm.service.impl.OrganizationServiceImpl; import com.engine.hrm.service.impl.OrganizationServiceImpl;
import com.engine.organization.component.OrganizationWeaTable; import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.DeleteParam; import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.codesetting.po.CodeRulePO; import com.engine.organization.entity.company.bo.CompBO;
import com.engine.organization.entity.company.bo.CompanyBO;
import com.engine.organization.entity.company.dto.CompListDTO; import com.engine.organization.entity.company.dto.CompListDTO;
import com.engine.organization.entity.company.dto.CompanyListDTO; import com.engine.organization.entity.company.param.CompParam;
import com.engine.organization.entity.company.param.CompSearchParam;
import com.engine.organization.entity.company.param.CompanyParam;
import com.engine.organization.entity.company.po.CompPO; import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.company.po.CompanyPO;
import com.engine.organization.entity.department.param.DepartmentMoveParam; import com.engine.organization.entity.department.param.DepartmentMoveParam;
import com.engine.organization.entity.extend.po.ExtendTitlePO; import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.enums.LogModuleNameEnum; import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum; 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.CompMapper;
import com.engine.organization.mapper.comp.CompanyMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper; 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.CompService;
import com.engine.organization.service.ExtService; import com.engine.organization.service.ExtService;
import com.engine.organization.thread.OrganizationSyncEc; import com.engine.organization.thread.OrganizationSyncEc;
import com.engine.organization.util.*; import com.engine.organization.util.*;
import com.engine.organization.util.coderule.CodeRuleUtil;
import com.engine.organization.util.db.MapperProxyFactory; 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.Column;
import com.engine.organization.util.page.PageInfo; import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil; import com.engine.organization.util.page.PageUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import weaver.general.Util; import weaver.general.Util;
@ -90,10 +81,6 @@ public class CompServiceImpl extends Service implements CompService {
*/ */
private static final Long GROUP_ID = 1L; private static final Long GROUP_ID = 1L;
private static CompanyMapper getCompanyMapper() {
return MapperProxyFactory.getProxy(CompanyMapper.class);
}
private static CompMapper getCompMapper() { private static CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class); return MapperProxyFactory.getProxy(CompMapper.class);
} }
@ -102,47 +89,43 @@ public class CompServiceImpl extends Service implements CompService {
return MapperProxyFactory.getProxy(ExtendTitleMapper.class); return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
} }
private SystemDataMapper getSystemDataMapper() {
return MapperProxyFactory.getProxy(SystemDataMapper.class);
}
private ExtService getExtService(User user) { private ExtService getExtService(User user) {
return ServiceUtil.getService(ExtServiceImpl.class, user); return ServiceUtil.getService(ExtServiceImpl.class, user);
} }
@Override @Override
public Map<String, Object> listPage(CompanyParam params) { public Map<String, Object> listPage(CompParam params) {
Map<String, Object> datas = new HashMap<>(); Map<String, Object> datas = new HashMap<>();
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
datas.put("hasRight", hasRight); datas.put("hasRight", hasRight);
if (!hasRight) { if (!hasRight) {
return datas; return datas;
} }
CompanyPO companyPO = CompanyBO.convertParamToPO(params, user.getUID()); CompPO companyPO = CompBO.convertParamToPO(params, user.getUID());
boolean filter = isFilter(companyPO); boolean filter = isFilter(companyPO);
PageInfo<CompanyListDTO> pageInfos; PageInfo<CompListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams()); String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams()," showorder ");
List<CompanyPO> allList = getCompanyMapper().listAll(orderSql); List<CompPO> allList = getCompMapper().listAll(orderSql);
//TODO new DetachUtil(user.getUID()).filterCompanyList(allList); new DetachUtil(user.getUID()).filterCompanyList(allList);
// 通过子级遍历父级元素 // 通过子级遍历父级元素
if (filter) { if (filter) {
// 根据条件获取元素 // 根据条件获取元素
List<CompanyPO> filterCompPOs = getCompanyMapper().listByFilter(companyPO, orderSql); List<CompPO> filterCompPOs = getCompMapper().listByFilter(companyPO, orderSql);
//TODO new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs); new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs);
// 添加父级元素 // 添加父级元素
List<CompanyListDTO> compListDTOS = CompanyBO.buildCompDTOList(allList, filterCompPOs); List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(allList, filterCompPOs);
List<CompanyListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS); List<CompListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
pageInfos = new PageInfo<>(subList, CompanyListDTO.class); pageInfos = new PageInfo<>(subList, CompListDTO.class);
pageInfos.setTotal(compListDTOS.size()); pageInfos.setTotal(compListDTOS.size());
} else { } else {
// 组合list // 组合list
List<CompanyListDTO> compListDTOS = CompanyBO.buildCompDTOList(allList); List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(allList);
List<CompanyListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS); List<CompListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
pageInfos = new PageInfo<>(subList, CompanyListDTO.class); pageInfos = new PageInfo<>(subList, CompListDTO.class);
pageInfos.setTotal(compListDTOS.size()); pageInfos.setTotal(compListDTOS.size());
} }
@ -173,49 +156,22 @@ public class CompServiceImpl extends Service implements CompService {
} }
@Override @Override
public int updateForbiddenTagById(CompSearchParam params) { public int updateForbiddenTagById(CompParam params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); 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<String, Object> map = new HashMap<>();
map.put("id", compPO.getId()); map.put("id", compPO.getId().toString());
map.put("forbiddenTag", compPO.getForbiddenTag()); map.put("forbiddenTag", compPO.getCanceled());
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.CANCELED, map).sync(); new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.CANCELED, map).sync();
return getCompMapper().updateForbiddenTagById(compPO); return 1;
} }
@Override @Override
public Long updateComp(Map<String, Object> params) { public Long updateComp(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
CompSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), CompSearchParam.class); String ecCompanyId = Util.null2String(params.get("id"));
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(); new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, params).sync();
// 更新主表数据 return Long.parseLong(ecCompanyId);
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();
} }
@Override @Override
@ -308,9 +264,9 @@ public class CompServiceImpl extends Service implements CompService {
String addType = Util.null2String(params.get("addType")); String addType = Util.null2String(params.get("addType"));
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo(); SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
String supsubcomid = ""; String supsubcomid = "";
if (addType.equals("sibling")) { if ("sibling".equals(addType)) {
supsubcomid = subCompanyComInfo.getSupsubcomid(id); supsubcomid = subCompanyComInfo.getSupsubcomid(id);
} else if (addType.equals("child")) { } else if ("child".equals(addType)) {
supsubcomid = id; supsubcomid = id;
} }
if (StringUtils.isNotBlank(addType)) { if (StringUtils.isNotBlank(addType)) {
@ -326,7 +282,7 @@ public class CompServiceImpl extends Service implements CompService {
try { try {
hfm = new HrmDeptFieldManagerE9(4); hfm = new HrmDeptFieldManagerE9(4);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(""); throw new OrganizationRunTimeException("");
} }
hfm.isReturnDecryptData(true); hfm.isReturnDecryptData(true);
hfm.getCustomData(Util.getIntValue(id)); hfm.getCustomData(Util.getIntValue(id));
@ -335,7 +291,7 @@ public class CompServiceImpl extends Service implements CompService {
String groupId = (String) lsGroup.get(tmp); String groupId = (String) lsGroup.get(tmp);
List lsField = hfm.getLsField(groupId); 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); String groupLabel = HrmFieldGroupComInfo.getLabel(groupId);
List<Object> itemList = new ArrayList<>(); List<Object> itemList = new ArrayList<>();
Map<String, Object> groupItem = new HashMap<>(); Map<String, Object> groupItem = new HashMap<>();
@ -346,7 +302,7 @@ public class CompServiceImpl extends Service implements CompService {
String fieldId = (String) lsField.get(j); String fieldId = (String) lsField.get(j);
String fieldName = HrmFieldComInfo.getFieldname(fieldId); String fieldName = HrmFieldComInfo.getFieldname(fieldId);
String isUse = HrmFieldComInfo.getIsused(fieldId); String isUse = HrmFieldComInfo.getIsused(fieldId);
if (!isUse.equals("1")) { if (!"1".equals(isUse)) {
continue; continue;
} }
int tmpViewAttr = viewAttr; int tmpViewAttr = viewAttr;
@ -358,14 +314,14 @@ public class CompServiceImpl extends Service implements CompService {
String fieldValue = ""; String fieldValue = "";
if (StringUtils.isNotBlank(addType)) { if (StringUtils.isNotBlank(addType)) {
} else { } else {
if (HrmFieldComInfo.getIssystem(fieldId).equals("1")) { if ("1".equals(HrmFieldComInfo.getIssystem(fieldId))) {
fieldValue = hfm.getData(fieldName); fieldValue = hfm.getData(fieldName);
} else { } else {
fieldValue = hfm.getData("hrmsubcompanydefined", fieldName); 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; tmpViewAttr = 3;
if ("1".equals(fieldHtmlType) && "2".equals(type)) { if ("1".equals(fieldHtmlType) && "2".equals(type)) {
rules = "required|integer"; rules = "required|integer";
@ -375,15 +331,16 @@ public class CompServiceImpl extends Service implements CompService {
} }
if ("84".equals(fieldId)) { if ("84".equals(fieldId)) {
if (user.getUID() != 1) if (user.getUID() != 1) {
continue; continue;
fieldValue = fieldValue.equals("0") ? "" : fieldValue;
} }
if (supsubcomid.length() > 0 && fieldName.equals("supsubcomid")) { fieldValue = "0".equals(fieldValue) ? "" : fieldValue;
}
if (supsubcomid.length() > 0 && "supsubcomid".equals(fieldName)) {
fieldValue = supsubcomid; fieldValue = supsubcomid;
} }
if (fieldName.equals("subshowid")) { if ("subshowid".equals(fieldName)) {
if (StringUtils.isNotBlank(addType)) { if (StringUtils.isNotBlank(addType)) {
continue; continue;
} else { } else {
@ -404,20 +361,20 @@ public class CompServiceImpl extends Service implements CompService {
hrmFieldBean.setViewAttr(tmpViewAttr); hrmFieldBean.setViewAttr(tmpViewAttr);
hrmFieldBean.setRules(rules); hrmFieldBean.setRules(rules);
hrmFieldBean.setIssystem("1"); hrmFieldBean.setIssystem("1");
if (hrmFieldBean.getFieldname().equals("supsubcomid")) { if ("supsubcomid".equals(hrmFieldBean.getFieldname())) {
hrmFieldBean.setHideVirtualOrg(true); hrmFieldBean.setHideVirtualOrg(true);
} }
if (hrmFieldBean.getFieldname().equals("subcompanycode")) { if ("subcompanycode".equals(hrmFieldBean.getFieldname())) {
hrmFieldBean.setMultilang(false); hrmFieldBean.setMultilang(false);
} }
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user); SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if (searchConditionItem != null) { if (searchConditionItem != null) {
searchConditionItem.setLabelcol(8); searchConditionItem.setLabelcol(8);
searchConditionItem.setFieldcol(16); searchConditionItem.setFieldcol(16);
if (hrmFieldBean.getFieldname().equals("showorder")) { if ("showorder".equals(hrmFieldBean.getFieldname())) {
searchConditionItem.setPrecision(2); searchConditionItem.setPrecision(2);
} }
if (fieldName.equals("subshowid")) { if ("subshowid".equals(fieldName)) {
Map<String, Object> otherParams = new HashMap<>(); Map<String, Object> otherParams = new HashMap<>();
otherParams.put("hasBorder", true); otherParams.put("hasBorder", true);
searchConditionItem.setOtherParams(otherParams); searchConditionItem.setOtherParams(otherParams);
@ -453,12 +410,12 @@ public class CompServiceImpl extends Service implements CompService {
@Override @Override
public int moveCompany(DepartmentMoveParam moveParam) { public int moveCompany(DepartmentMoveParam moveParam) {
Integer companyId = moveParam.getId().intValue(); Integer companyId = moveParam.getId();
Integer targetCompanyId = moveParam.getCompany().intValue(); Integer targetCompanyId = moveParam.getCompany();
// 判断目标分部是否为它本身以及子元素 // 判断目标分部是否为它本身以及子元素
Set<Integer> disableIds = new HashSet<>(); Set<Integer> disableIds = new HashSet<>();
disableIds.add(companyId); 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)) { if (CollectionUtils.isNotEmpty(compPOS)) {
addDisableIds(disableIds, compPOS); addDisableIds(disableIds, compPOS);
} }
@ -478,7 +435,7 @@ public class CompServiceImpl extends Service implements CompService {
* @param companyPO * @param companyPO
* @return * @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(); 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 * @return
*/ */
public static String repeatDetermine(String compNo) { public static String repeatDetermine(String compNo) {
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.SUBCOMPANY.getValue()); //CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.SUBCOMPANY.getValue());
if (StringUtils.isNotBlank(compNo)) { //if (StringUtils.isNotBlank(compNo)) {
compNo = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, compNo); // compNo = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, compNo);
List<CompPO> list = getCompMapper().listByNo(Util.null2String(compNo)); // List<CompPO> list = getCompMapper().listByNo(Util.null2String(compNo));
OrganizationAssert.isEmpty(list, "编号不允许重复"); // OrganizationAssert.isEmpty(list, "编号不允许重复");
} else { //} else {
OrganizationAssert.isTrue(null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable()), "编号不允许为空"); // OrganizationAssert.isTrue(null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable()), "编号不允许为空");
compNo = autoCreateCompanyNo(); // compNo = autoCreateCompanyNo();
} //}
return compNo; //return compNo;
} return "";
}
/**
* ///**
* // * 自动编号处理
* @return // *
*/ // * @return
private static String autoCreateCompanyNo() { // */
String generateCode = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, ""); //private static String autoCreateCompanyNo() {
List<CompPO> list = getCompMapper().listByNo(Util.null2String(generateCode)); // String generateCode = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, "");
if (CollectionUtils.isNotEmpty(list)) { // List<CompPO> list = getCompMapper().listByNo(Util.null2String(generateCode));
generateCode = autoCreateCompanyNo(); // if (CollectionUtils.isNotEmpty(list)) {
} // generateCode = autoCreateCompanyNo();
return generateCode; // }
} // return generateCode;
//}
/** /**
* ID * ID
@ -521,10 +479,10 @@ public class CompServiceImpl extends Service implements CompService {
* @param disableIds * @param disableIds
* @param compPOS * @param compPOS
*/ */
private void addDisableIds(Set<Integer> disableIds, List<CompanyPO> compPOS) { private void addDisableIds(Set<Integer> disableIds, List<CompPO> compPOS) {
for (CompanyPO compPO : compPOS) { for (CompPO compPO : compPOS) {
disableIds.add(compPO.getId()); 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); addDisableIds(disableIds, childCompPOS);
} }
} }

@ -1,18 +1,18 @@
package com.engine.organization.service.impl; package com.engine.organization.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem; import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption; 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.pc.table.WeaTableColumn;
import com.cloudstore.eccom.result.WeaResultMsg; import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.hrm.entity.RuleCodeType; import com.engine.hrm.entity.RuleCodeType;
import com.engine.hrm.service.impl.OrganizationServiceImpl;
import com.engine.organization.component.OrganizationWeaTable; 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.codesetting.po.CodeRulePO;
import com.engine.organization.entity.commom.RecordInfo;
import com.engine.organization.entity.company.bo.CompBO; import com.engine.organization.entity.company.bo.CompBO;
import com.engine.organization.entity.company.po.CompPO; import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.bo.DepartmentBO; 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.bo.JobBO;
import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.job.vo.SingleJobTreeVO; 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.SearchTree;
import com.engine.organization.entity.searchtree.SearchTreeParams; import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.enums.LogModuleNameEnum; import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.enums.OperateTypeEnum; import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.mapper.codesetting.CodeRuleMapper; import com.engine.organization.mapper.codesetting.CodeRuleMapper;
import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper; 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.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.mapper.job.JobMapper;
import com.engine.organization.service.DepartmentService; import com.engine.organization.service.DepartmentService;
import com.engine.organization.service.ExtService; 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.JobTriggerRunnable;
import com.engine.organization.thread.OrganizationSyncEc; import com.engine.organization.thread.OrganizationSyncEc;
import com.engine.organization.util.*; 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.Column;
import com.engine.organization.util.page.PageInfo; import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil; import com.engine.organization.util.page.PageUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.tree.SearchTreeUtil; import com.engine.organization.util.tree.SearchTreeUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
@ -61,6 +53,11 @@ import weaver.conn.RecordSet;
import weaver.general.StringUtil; import weaver.general.StringUtil;
import weaver.general.Util; import weaver.general.Util;
import weaver.hrm.User; 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.*;
import java.util.stream.Collectors; 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 Long GROUP_ID = 2L;
private static final String HRM_DEPARTMENT = "hrmdepartment";
private static DepartmentMapper getDepartmentMapper() { private static DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class); return MapperProxyFactory.getProxy(DepartmentMapper.class);
@ -119,10 +114,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
return MapperProxyFactory.getProxy(ExtendTitleMapper.class); return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
} }
private SystemDataMapper getSystemDataMapper() {
return MapperProxyFactory.getProxy(SystemDataMapper.class);
}
private ExtService getExtService(User user) { private ExtService getExtService(User user) {
return ServiceUtil.getService(ExtServiceImpl.class, user); return ServiceUtil.getService(ExtServiceImpl.class, user);
} }
@ -132,7 +123,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) { public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
//1.查询分部下所有部门 //1.查询分部下所有部门
//PageUtil.start(param.getCurrent(), param.getPageSize()); //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); PageInfo<DepartmentPO> pageInfo = new PageInfo<>(departmentPOS);
List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS, param.getParentComp()); List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS, param.getParentComp());
PageInfo<SingleDeptTreeVO> pageInfos = new PageInfo<>(singleDeptTreeVOS, SingleDeptTreeVO.class); 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()); DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(param, user.getUID());
boolean filter = isFilter(departmentPO); boolean filter = isFilter(departmentPO);
PageInfo<DepartmentListDTO> pageInfos; PageInfo<DepartmentListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams()); String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams()," showorder ");
List<DepartmentPO> allList = getDepartmentMapper().list(orderSql); List<DepartmentPO> allList = getDepartmentMapper().listAll(orderSql);
new DetachUtil(user.getUID()).filterDepartmentList(allList); new DetachUtil(user.getUID()).filterDepartmentList(allList);
// 通过子级遍历父级元素 // 通过子级遍历父级元素
if (filter) { if (filter) {
@ -218,137 +209,35 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
@Override @Override
public Long saveBaseForm(Map<String, Object> params) { public Long saveBaseForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); 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(); Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, params).sync();
String ecCompanyID = Util.null2String(syncMap.get("id")); String ecCompanyID = Util.null2String(syncMap.get("id"));
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecCompanyID), syncMap.get("message").toString()); OrganizationAssert.isTrue(StringUtils.isNotBlank(ecCompanyID), syncMap.get("message").toString());
// 查询UUID return Long.parseLong(ecCompanyID);
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_DEPARTMENT, ecCompanyID);
params.put("uuid", recordInfo.getUuid());
return getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPT, params, "", null);
} }
@Override @Override
public int updateForbiddenTagById(DeptSearchParam params) { public int updateForbiddenTagById(DeptSearchParam params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
DepartmentPO departmentPO = DepartmentPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); DepartmentPO departmentPO = DepartmentPO.builder().id(params.getId()).canceled(params.getCanceled() ? 0 : 1).build();
if (!params.getForbiddenTag()) {
// 判断当前岗位下是否有启用岗位,如有启用岗位,部门无法禁用
int countUsedInJob = getDepartmentMapper().countUsedInJob(params.getId());
OrganizationAssert.isTrue(countUsedInJob == 0, "部门存在下级岗位,不能封存");
}
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id", departmentPO.getId()); map.put("id", departmentPO.getId());
map.put("forbiddenTag", departmentPO.getForbiddenTag()); map.put("forbiddenTag", departmentPO.getCanceled());
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync(); new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync();
return getDepartmentMapper().updateForbiddenTagById(departmentPO); return 1;
} }
@Override @Override
public Long updateForm(Map<String, Object> params) { public Long updateForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
DeptSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), DeptSearchParam.class); String ecCompanyId = Util.null2String(params.get("id"));
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(); new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, params).sync();
// 更新主表数据 return Long.parseLong(ecCompanyId);
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();
} }
@Override @Override
public int deleteByIds(Collection<Long> ids) { public Map<String, Object> deleteByIds(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); return ServiceUtil.getService(OrganizationServiceImpl.class, user).delDepartment(params, user);
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);
} }
@Override @Override
@ -357,35 +246,18 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
List<SearchConditionGroup> addGroups = new ArrayList<>(); List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> conditionItems = 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 departmentNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "departmentName");
// 简称
SearchConditionItem deptNameShortItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "简称", "deptNameShort");
// 所属分部 // 所属分部
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 supDepIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级部门", "4", "supDepId", "");
// 部门负责人
SearchConditionItem deptPrincipalBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门负责人", "1", "deptPrincipal", ""); conditionItems.add(departmentCodeItem);
// 显示顺序 conditionItems.add(departmentNameItem);
SearchConditionItem showOrderItem = OrganizationFormItemUtil.inputNumberItem(user, 2, 16, 2, "显示顺序", "showOrder"); conditionItems.add(subCompanyId1Item);
// 禁用标记 conditionItems.add(supDepIdItem);
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");
conditionItems.add(deptNoItem);
conditionItems.add(deptNameItem);
conditionItems.add(deptNameShortItem);
conditionItems.add(parentCompBrowserItem);
conditionItems.add(parentDeptBrowserItem);
conditionItems.add(deptPrincipalBrowserItem);
conditionItems.add(showOrderItem);
conditionItems.add(forbiddenTagItem);
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems)); addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
apiDatas.put("conditions", addGroups); apiDatas.put("conditions", addGroups);
@ -442,39 +314,152 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
} }
@Override @Override
public Map<String, Object> getSaveForm(DeptSearchParam param) { public Map<String, Object> getSaveForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
Map<String, Object> apiDatas = new HashMap<>(); Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionGroup> addGroups = new ArrayList<>(); List<Map<String, Object>> groupList = new ArrayList<>();
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID, "1"); Map<String, Object> groupItem;
if (CollectionUtils.isNotEmpty(extendTitles)) { List<Object> itemList;
Map<String, Object> params = new HashMap<>();
// 分部 String id = Util.null2String(params.get("id"));
if (StringUtils.isNotBlank(Util.null2String(param.getSubcompanyid1()))) { int viewAttr = Util.getIntValue(Util.null2String(params.get("viewattr")), 1);
CompPO compPO = getCompMapper().listById(param.getSubcompanyid1()); String nodeType = Util.null2String(params.get("type"));
if (null != compPO) { String addType = Util.null2String(params.get("addType"));
params.put("parent_comp", compPO.getId()); DepartmentComInfo departmentComInfo = new DepartmentComInfo();
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(compPO.getId().toString())); String subcompanyid1 = "";
String supDepId = "";
switch (addType) {
case "normal":
if (nodeType.equals("subcompany")) {
subcompanyid1 = id;
} else {
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
}
break;
case "sibling":
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supDepId = departmentComInfo.getDepartmentsupdepid(id);
break;
case "child":
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supDepId = id;
break;
}
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 (StringUtils.isNotBlank(Util.null2String(param.getDepartmentid()))) { if (!groupHide && tmpViewAttr == 2 && HrmFieldComInfo.getIsmand(fieldId).equals("1")) {
DepartmentPO deptById = getDepartmentMapper().getDeptById(param.getDepartmentid()); tmpViewAttr = 3;
if (null != deptById) { if ("1".equals(fieldHtmlType) && "2".equals(type)) {
params.put("parent_dept", deptById.getId()); rules = "required|integer";
params.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString())); } else {
params.put("parent_comp", deptById.getParentComp()); rules = "required|string";
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 (subcompanyid1.length() > 0 && fieldName.equals("subcompanyid1")) {
if (CollectionUtils.isNotEmpty(items)) { fieldValue = subcompanyid1;
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items)); }
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);
} }
apiDatas.put("condition", addGroups); 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; return apiDatas;
} }
@ -516,45 +501,35 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
OrganizationAssert.notBlank(copyParam.getCompany(), "请指定需要复制的公司/分部"); OrganizationAssert.notBlank(copyParam.getCompany(), "请指定需要复制的公司/分部");
int insertCount = 0; int insertCount = 0;
// 需复制的部门 // 需复制的部门
List<Long> idList = Arrays.stream(copyParam.getIds().split(",")).map(Long::parseLong).collect(Collectors.toList()); List<Integer> idList = Arrays.stream(copyParam.getIds().split(",")).map(Integer::parseInt).collect(Collectors.toList());
Integer maxShowOrder = getDepartmentMapper().getMaxShowOrder(); Double maxShowOrder = getDepartmentMapper().getMaxShowOrder();
maxShowOrder = null == maxShowOrder ? 0 : maxShowOrder; 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; 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); DepartmentPO deptById = getDepartmentMapper().getDeptById(originalDeptId);
long timeMillis = System.currentTimeMillis(); 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.setSubCompanyId1(companyId);
deptById.setEcCompany(companyId); deptById.setSupDepId(parentDepartmentId);
deptById.setParentDept(parentDepartmentId);
if (null != parentDepartmentId) {
deptById.setEcDepartment(Long.parseLong(EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId))));
}
// 显示顺序字段 // 显示顺序字段
deptById.setShowOrder(++maxShowOrder); deptById.setShowOrder(++maxShowOrder);
deptById.setCreator((long) user.getUID()); deptById.setUuid(null);
deptById.setCreateTime(new Date());
deptById.setDeptPrincipal(null);
// 新增EC表部门 // 新增EC表部门
Map<String, Object> syncMap = addEcDepartment(deptById); Map<String, Object> syncMap = addEcDepartment(deptById);
String ecDepartmentID = Util.null2String(syncMap.get("id")); String ecDepartmentID = Util.null2String(syncMap.get("id"));
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecDepartmentID), syncMap.get("message").toString()); 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)) { if ("1".equals(copyJob)) {
@ -564,7 +539,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
if (maxJobOrder == null) { if (maxJobOrder == null) {
maxJobOrder = 0; 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); List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(originalDeptId);
for (DepartmentPO departmentPO : deptListByPId) { 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 @Override
public List<SearchConditionGroup> getMergeForm(Long id) { public List<SearchConditionGroup> getMergeForm() {
List<SearchConditionGroup> addGroups = new ArrayList<>(); List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> condition = new ArrayList<>(); List<SearchConditionItem> condition = new ArrayList<>();
SearchConditionItem deptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "合并到部门", "4", "department", ""); 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) { public int mergeDepartment(DepartmentMergeParam mergeParam) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
// 被合并部门 // 被合并部门
Long ecParamDepartment = mergeParam.getDepartment(); Integer ecParamDepartment = mergeParam.getDepartment();
DepartmentPO targetDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecParamDepartment)); DepartmentPO targetDepartment = getDepartmentMapper().getDeptById(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();
}
}
// 断言判断 // 断言判断
OrganizationAssert.isFalse(null == targetDepartment, "被合并部门数据有误,暂时无法合并"); OrganizationAssert.isFalse(null == targetDepartment, "被合并部门数据有误,暂时无法合并");
@ -618,7 +583,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
OrganizationAssert.notBlank(mergeParam.getMergeName(), "请输入合并后的名称"); OrganizationAssert.notBlank(mergeParam.getMergeName(), "请输入合并后的名称");
// 不可选择合并的数据,本身及子部门 // 不可选择合并的数据,本身及子部门
Set<Long> disableIds = new HashSet<>(); Set<Integer> disableIds = new HashSet<>();
// 添加选择部门本身 // 添加选择部门本身
disableIds.add(mergeParam.getId()); disableIds.add(mergeParam.getId());
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(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()); List<DepartmentPO> firstChildDeptList = getDepartmentMapper().getDeptListByPId(mergeParam.getId());
// 更新所属部门、所属分部 // 更新所属部门、所属分部
for (DepartmentPO departmentPO : firstChildDeptList) { for (DepartmentPO departmentPO : firstChildDeptList) {
departmentPO.setParentDept(targetDepartment.getId()); departmentPO.setSupDepId(targetDepartment.getId());
departmentPO.setEcDepartment(ecParamDepartment); departmentPO.setSubCompanyId1(targetDepartment.getSubCompanyId1());
departmentPO.setParentComp(targetDepartment.getParentComp());
departmentPO.setEcCompany(targetDepartment.getEcCompany());
updateEcDepartment(departmentPO); updateEcDepartment(departmentPO);
getDepartmentMapper().updateBaseDept(departmentPO);
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(departmentPO.getId()).run(); //TODO new DepartmentTriggerRunnable(departmentPO.getId()).run();
} }
// 查询该部门一级岗位、更新岗位所属分部、所属部门 // 查询该部门一级岗位、更新岗位所属分部、所属部门
List<JobPO> firstChildJobList = getJobMapper().listJobsByDepartmentId(mergeParam.getId()); List<JobPO> firstChildJobList = getJobMapper().listJobsByDepartmentId(mergeParam.getId());
firstChildJobList = firstChildJobList.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList()); firstChildJobList = firstChildJobList.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
// 批量更新部门、所属分部 // 批量更新部门、所属分部
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String targetEcDeptId = EcHrmRelationUtil.getEcDepartmentId(targetDepartment.getId().toString()); String targetEcDeptId = targetDepartment.getId().toString();
String mergeEcDeptId = EcHrmRelationUtil.getEcDepartmentId(mergeParam.getId().toString()); String mergeEcDeptId = 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()); 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) { for (JobPO jobPO : firstChildJobList) {
// 刷新组织架构图 // 刷新组织架构图
new JobTriggerRunnable(jobPO.getId()).run(); new JobTriggerRunnable(jobPO.getId()).run();
} }
// 更新当前部门下的人员 // 更新当前部门下的人员
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(mergeParam.getId().toString()); rs.executeUpdate("update hrmresource set SUBCOMPANYID1 =?,DEPARTMENTID =? where DEPARTMENTID =?", targetDepartment.getSubCompanyId1(), targetEcDeptId, mergeEcDeptId);
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());
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) { //for (Long hrmResourceId : hrmResourceIds) {
new HrmResourceTriggerRunnable(hrmResourceId).run(); //TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
} //}
// 更新子部门下岗位的所属分部 // 更新子部门下岗位的所属分部
for (DepartmentPO departmentPO : firstChildDeptList) { for (DepartmentPO departmentPO : firstChildDeptList) {
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(departmentPO.getId()); 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<String, Object> map = new HashMap<>();
map.put("id", mergeParam.getId()); map.put("id", Util.null2String(mergeParam.getId()));
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync(); // 删除部门
// 删除拓展表、明细表 ServiceUtil.getService(OrganizationServiceImpl.class, user).delDepartment(map, user);
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());
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(mergeDepartment).run(); // TODO new DepartmentTriggerRunnable(mergeDepartment).run();
// 更新部门合并后名称 // 更新部门合并后名称
targetDepartment.setDeptName(mergeParam.getMergeName()); targetDepartment.setDepartmentName(mergeParam.getMergeName());
targetDepartment.setDeptNameShort(mergeParam.getMergeName()); targetDepartment.setDepartmentMark(mergeParam.getMergeName());
updateEcDepartment(targetDepartment); updateEcDepartment(targetDepartment);
getDepartmentMapper().updateBaseDept(targetDepartment);
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(oldFParentId, targetDepartment.getId()).run(); // TODO new DepartmentTriggerRunnable(oldFParentId, targetDepartment.getId()).run();
return 0; return 0;
} }
@ -718,55 +676,46 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
DepartmentPO deptById = getDepartmentMapper().getDeptById(moveParam.getId()); DepartmentPO deptById = getDepartmentMapper().getDeptById(moveParam.getId());
// 0公司/分部 1部门 // 0公司/分部 1部门
if ("0".equals(moveParam.getMoveType())) { if ("0".equals(moveParam.getMoveType())) {
Long company = moveParam.getCompany(); Integer company = moveParam.getCompany();
OrganizationAssert.notNull(company, "请选择要转移到的分部"); OrganizationAssert.notNull(company, "请选择要转移到的分部");
deptById.setEcCompany(company); deptById.setSubCompanyId1(company);
deptById.setParentComp(Objects.requireNonNull(EcHrmRelationUtil.getJclCompanyId(Util.null2String(company))).getId()); deptById.setSupDepId(null);
deptById.setParentDept(null);
deptById.setEcDepartment(null);
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(company.toString(), deptById).run(); //TODO new DepartmentTriggerRunnable(company.toString(), deptById).run();
} else if ("1".equals(moveParam.getMoveType())) { } else if ("1".equals(moveParam.getMoveType())) {
Long department = moveParam.getDepartment(); Integer departmentId = moveParam.getDepartment();
Long departmentId = Objects.requireNonNull(EcHrmRelationUtil.getJclDepartmentId(Util.null2String(department))).getId();
OrganizationAssert.notNull(departmentId, "请选择要转移到的部门"); OrganizationAssert.notNull(departmentId, "请选择要转移到的部门");
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(moveParam.getId()); List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(moveParam.getId());
Set<Long> disableIds = new HashSet<>(); Set<Integer> disableIds = new HashSet<>();
disableIds.add(moveParam.getId()); disableIds.add(moveParam.getId());
if (CollectionUtils.isNotEmpty(deptListByPId)) { if (CollectionUtils.isNotEmpty(deptListByPId)) {
addDisableIds(disableIds, deptListByPId); addDisableIds(disableIds, deptListByPId);
} }
OrganizationAssert.isFalse(disableIds.contains(departmentId), "请勿选择当前部门本身及其子部门"); OrganizationAssert.isFalse(disableIds.contains(departmentId), "请勿选择当前部门本身及其子部门");
deptById.setParentDept(departmentId); deptById.setSupDepId(departmentId);
deptById.setEcDepartment(department);
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(departmentId); DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(departmentId);
deptById.setParentComp(parentDepartment.getParentComp()); deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1());
deptById.setEcCompany(parentDepartment.getEcCompany());
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(Integer.toString(100000000 + department.intValue()), deptById).run(); // TODO new DepartmentTriggerRunnable(Integer.toString(100000000 + department.intValue()), deptById).run();
} }
// 更新EC部门 // 更新EC部门
updateEcDepartment(deptById); updateEcDepartment(deptById);
int updateBaseDept = getDepartmentMapper().updateBaseDept(deptById);
// 刷新岗位分部 // 刷新岗位分部
refreshJobComp(deptById.getId(), deptById.getParentComp()); refreshJobComp(deptById.getId(), deptById.getSubCompanyId1());
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(deptById.getId()); List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(deptById.getId());
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(Util.null2String(deptById.getParentComp()));
// 更新当前部门下的人员 // 更新当前部门下的人员
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(deptById.getId().toString()); // new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", deptById.getSubCompanyId1(), deptById.getId());
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString()); //// 更新人员组织架构图
new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId); //List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(deptById.getId().toString());
new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", deptById.getParentComp(), ecCompanyId, deptById.getId()); //for (Long hrmResourceId : hrmResourceIds) {
// 更新人员组织架构图 //TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
for (Long hrmResourceId : hrmResourceIds) { //}
new HrmResourceTriggerRunnable(hrmResourceId).run(); forbiddenChildTag(deptById.getSubCompanyId1(), Util.null2String(deptById.getSubCompanyId1()), deptList);
}
forbiddenChildTag(deptById.getParentComp(), ecCompanyId, deptList);
// 递归更新下级部门、岗位 // 递归更新下级部门、岗位
return updateBaseDept; return 1;
} }
/** /**
@ -775,28 +724,26 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
* @param parentComp * @param parentComp
* @param deptList * @param deptList
*/ */
void forbiddenChildTag(Long parentComp, String ecCompanyId, List<DepartmentPO> deptList) { void forbiddenChildTag(Integer parentComp, String ecCompanyId, List<DepartmentPO> deptList) {
if (CollectionUtils.isNotEmpty(deptList)) { if (CollectionUtils.isNotEmpty(deptList)) {
for (DepartmentPO departmentPO : deptList) { for (DepartmentPO departmentPO : deptList) {
departmentPO.setParentComp(parentComp); departmentPO.setSubCompanyId1(parentComp);
departmentPO.setEcCompany(Long.parseLong(ecCompanyId));
// 更新EC表部门 // 更新EC表部门
updateEcDepartment(departmentPO); updateEcDepartment(departmentPO);
getDepartmentMapper().updateBaseDept(departmentPO);
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(departmentPO.getId()).run(); // TODO new DepartmentTriggerRunnable(departmentPO.getId()).run();
// 刷新岗位所属分部 // 刷新岗位所属分部
refreshJobComp(departmentPO.getId(), parentComp); refreshJobComp(departmentPO.getId(), parentComp);
// 更新当前部门下的人员 // 更新当前部门下的人员
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(departmentPO.getId().toString()); // String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(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 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());
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) { //for (Long hrmResourceId : hrmResourceIds) {
new HrmResourceTriggerRunnable(hrmResourceId).run(); //TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
} //}
List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(departmentPO.getId()); List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
forbiddenChildTag(parentComp, ecCompanyId, childList); forbiddenChildTag(parentComp, ecCompanyId, childList);
} }
@ -810,16 +757,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
* @return * @return
*/ */
private boolean isFilter(DepartmentPO departmentPO) { private boolean isFilter(DepartmentPO departmentPO) {
return !(StringUtil.isEmpty(departmentPO.getDeptNo()) return !(StringUtil.isEmpty(departmentPO.getDepartmentCode())
&& StringUtil.isEmpty(departmentPO.getDeptName()) && StringUtil.isEmpty(departmentPO.getDepartmentName())
&& StringUtil.isEmpty(departmentPO.getDeptNameShort()) && null == departmentPO.getSubCompanyId1()
&& null == departmentPO.getEcCompany() && null == departmentPO.getSupDepId());
&& null == departmentPO.getEcDepartment()
&& null == departmentPO.getParentComp()
&& null == departmentPO.getParentDept()
&& null == departmentPO.getDeptPrincipal()
&& null == departmentPO.getShowOrder()
&& null == departmentPO.getForbiddenTag());
} }
@ -832,18 +773,18 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
*/ */
private List<SearchTree> getFilterCompany(String id, String keyword) { private List<SearchTree> getFilterCompany(String id, String keyword) {
// 查询部门信息 // 查询部门信息
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id); Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).forbiddenTag(0).build(); CompPO compBuild = CompPO.builder().subCompanyName(keyword).supSubComId(parentCompId).canceled(0).build();
List<CompPO> allCompanys = getCompMapper().list("show_order"); List<CompPO> allCompanys = getCompMapper().listAll("showOrder");
new DetachUtil(user.getUID()).filterCompanyList(allCompanys); 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); 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<>(); Set<CompPO> builderComps = new HashSet<>();
for (CompPO compPO : filterComps) { for (CompPO companyPO : filterComps) {
buildParentComps(compPO, builderComps, allMaps); buildParentComps(companyPO, builderComps, allMaps);
} }
return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps)); return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps));
@ -855,10 +796,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
* @param compPO * @param compPO
* @param builderComps * @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); builderComps.add(compPO);
CompPO parentComp = allMaps.get(compPO.getParentCompany()); CompPO parentComp = allMaps.get(compPO.getSupSubComId());
if (null != parentComp && 0 == parentComp.getForbiddenTag()) { if (null != parentComp && (null == parentComp.getCanceled() || 0 == parentComp.getCanceled())) {
buildParentComps(parentComp, builderComps, allMaps); buildParentComps(parentComp, builderComps, allMaps);
} }
} }
@ -903,7 +844,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
* @param parentDeptId * @param parentDeptId
* @param orderNum * @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) { for (JobPO jobPO : jobPOS) {
orderNum++; orderNum++;
@ -915,16 +856,12 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
// 所属部门赋值 // 所属部门赋值
jobPO.setParentDept(parentDeptId); jobPO.setParentDept(parentDeptId);
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(parentDeptId.toString()); jobPO.setEcDepartment(parentDeptId);
if (StringUtils.isNotBlank(ecDepartmentId)) {
jobPO.setEcDepartment(Long.parseLong(ecDepartmentId));
}
// 所属分部赋值 // 所属分部赋值
jobPO.setEcCompany(parentCompId); jobPO.setEcCompany(parentCompId);
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(Util.null2String(parentCompId)); jobPO.setParentComp(parentCompId);
if (null != jclCompanyId) {
jobPO.setParentComp(jclCompanyId.getId());
}
// 指定上级岗位 // 指定上级岗位
jobPO.setParentJob(currentParentJobId); jobPO.setParentJob(currentParentJobId);
jobPO.setCreator((long) user.getUID()); jobPO.setCreator((long) user.getUID());
@ -948,14 +885,14 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
*/ */
private void updateEcDepartment(DepartmentPO departmentPO) { private void updateEcDepartment(DepartmentPO departmentPO) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("dept_name_short", departmentPO.getDeptNameShort()); map.put("departmentmark", departmentPO.getDepartmentMark());
map.put("dept_name", departmentPO.getDeptName()); map.put("departmentname", departmentPO.getDepartmentName());
map.put("parent_comp", departmentPO.getParentComp()); map.put("subcompanyid1", Util.null2String(departmentPO.getSubCompanyId1()));
map.put("parent_dept", departmentPO.getParentDept()); map.put("supdepid", Util.null2String(departmentPO.getSupDepId()));
map.put("show_order", departmentPO.getShowOrder()); map.put("showorder", Util.null2String(departmentPO.getShowOrder()));
map.put("dept_no", departmentPO.getDeptNo()); map.put("departmentcode", departmentPO.getDepartmentCode());
map.put("dept_principal", departmentPO.getDeptPrincipal()); map.put("coadjutant", Util.null2String(departmentPO.getCoadjutant()));
map.put("id", departmentPO.getId()); map.put("id", Util.null2String(departmentPO.getId()));
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map).sync(); 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) { private Map<String, Object> addEcDepartment(DepartmentPO departmentPO) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("dept_name_short", departmentPO.getDeptNameShort()); map.put("departmentmark", departmentPO.getDepartmentMark());
map.put("dept_name", departmentPO.getDeptName()); map.put("departmentname", departmentPO.getDepartmentName());
map.put("parent_comp", departmentPO.getParentComp()); map.put("subcompanyid1", Util.null2String(departmentPO.getSubCompanyId1()));
map.put("parent_dept", departmentPO.getParentDept()); map.put("supdepid", Util.null2String(departmentPO.getSupDepId()));
map.put("show_order", departmentPO.getShowOrder()); map.put("showorder", Util.null2String(departmentPO.getShowOrder()));
map.put("dept_no", departmentPO.getDeptNo()); map.put("departmentcode", departmentPO.getDepartmentCode());
map.put("dept_principal", departmentPO.getDeptPrincipal());
map.put("id", departmentPO.getId());
return new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, map).sync(); 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(); 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) { for (DepartmentPO departmentPO : deptListByPId) {
disableIds.add(departmentPO.getId()); disableIds.add(departmentPO.getId());
List<DepartmentPO> childDeptPOS = getDepartmentMapper().getDeptListByPId(departmentPO.getId()); List<DepartmentPO> childDeptPOS = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
@ -1004,12 +939,11 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
* @param parentDepartment * @param parentDepartment
* @param parentComp * @param parentComp
*/ */
private void refreshJobComp(Long parentDepartment, Long parentComp) { private void refreshJobComp(Integer parentDepartment, Integer parentComp) {
List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment); List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment);
jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList()); jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(jobPOS)) { if (CollectionUtils.isNotEmpty(jobPOS)) {
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(parentComp.toString()); getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, parentComp);
getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, ecCompanyId);
for (JobPO jobPO : jobPOS) { for (JobPO jobPO : jobPOS) {
// 刷新组织架构图 // 刷新组织架构图
new JobTriggerRunnable(jobPO.getId()).run(); new JobTriggerRunnable(jobPO.getId()).run();

@ -337,7 +337,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
fieldTypeObj.add(tmp); fieldTypeObj.add(tmp);
fieldType = SystemEnv.getHtmlLabelName(695, user.getLanguage()); fieldType = SystemEnv.getHtmlLabelName(695, user.getLanguage());
fieldType += " " + SystemEnv.getHtmlLabelName(Util.getIntValue(BrowserComInfo.getBrowserlabelid(browserType), 0), 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 = new HashMap<>();
tmp.put("value", SelectOptionParam.getCustomBrowserId(customValue)); tmp.put("value", SelectOptionParam.getCustomBrowserId(customValue));
tmp.put("valueSpan", SelectOptionParam.getCustomBrowserValueSpan(customValue)); tmp.put("valueSpan", SelectOptionParam.getCustomBrowserValueSpan(customValue));
@ -448,7 +448,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
lsComDetialInfo = new ArrayList<>(); lsComDetialInfo = new ArrayList<>();
comDetialInfo = new HashMap<>(); comDetialInfo = new HashMap<>();
comDetialInfo.put("label", ""); 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("width", "60%");
comDetialInfo.put("key", "fieldType"); comDetialInfo.put("key", "fieldType");
lsComDetialInfo.add(comDetialInfo); lsComDetialInfo.add(comDetialInfo);
@ -462,7 +462,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
fieldTypeInfo.add("select"); fieldTypeInfo.add("select");
Map<String, Object> fieldTypeParamInfo = new HashMap<>(); Map<String, Object> fieldTypeParamInfo = new HashMap<>();
if (fieldHtmlType.equals("5")) { if ("5".equals(fieldHtmlType)) {
fieldTypeParamInfo.put("datas", SelectOptionParam.getSelectFields(customValue)); fieldTypeParamInfo.put("datas", SelectOptionParam.getSelectFields(customValue));
fieldTypeParamInfo.put("sort", "horizontal"); fieldTypeParamInfo.put("sort", "horizontal");

@ -541,15 +541,15 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
List<SearchTree> searchTree = new ArrayList<>(); List<SearchTree> searchTree = new ArrayList<>();
// 通过分部、公司 组装数据 // 通过分部、公司 组装数据
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) { if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id); Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentComp(parentCompId).build(); DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).subCompanyId1(parentCompId).build();
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).build(); CompPO compBuild = CompPO.builder().subCompanyName(keyword).supSubComId(parentCompId).build();
// 所属分部下的岗位 // 所属分部下的岗位
JobPO jobBuild = JobPO.builder().jobName(keyword).parentComp(parentCompId).build(); JobPO jobBuild = JobPO.builder().jobName(keyword).parentComp(parentCompId).build();
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild, jobBuild); searchTree = buildTreeByCompAndDept(departmentBuild, compBuild, jobBuild);
} else if (TYPE_DEPT.equals(type)) { } else if (TYPE_DEPT.equals(type)) {
Long parentDeptId = Long.parseLong(id); Integer parentDeptId = Integer.parseInt(id);
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentDept(parentDeptId).build(); DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).supDepId(parentDeptId).build();
// 所属分部下的岗位 // 所属分部下的岗位
JobPO jobBuild = JobPO.builder().jobName(keyword).parentDept(parentDeptId).build(); JobPO jobBuild = JobPO.builder().jobName(keyword).parentDept(parentDeptId).build();
searchTree = buildTreeByDeptAndJob(departmentBuild, jobBuild); 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) { private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild, JobPO jobBuild) {
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild); List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
new DetachUtil(user.getUID()).filterJobList(jobPOS); 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); new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
// 添加父级岗位 // 添加父级岗位
Set<JobPO> builderJobs = new HashSet<>(); 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); new DetachUtil(user.getUID()).filterCompanyList(filterComps);
Set<DepartmentPO> builderDeparts = new HashSet<>(); Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) { for (DepartmentPO departmentPO : filterDeparts) {
@ -624,9 +624,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
filterComps.addAll(compsByIds); filterComps.addAll(compsByIds);
} }
} }
List<CompPO> allCompanys = getCompMapper().list("show_order"); List<CompPO> allCompanys = getCompMapper().listAll("showorder");
new DetachUtil(user.getUID()).filterCompanyList(allCompanys); 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<>(); Set<CompPO> builderComps = new HashSet<>();
for (CompPO compPO : filterComps) { for (CompPO compPO : filterComps) {
buildParentComps(compPO, builderComps, allMaps); buildParentComps(compPO, builderComps, allMaps);
@ -636,7 +636,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild) { private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild) {
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(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<>(); Set<JobPO> builderJobs = new HashSet<>();
for (JobPO jobPO : jobPOS) { for (JobPO jobPO : jobPOS) {
@ -689,10 +689,10 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
*/ */
private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) { private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) {
builderDeparts.add(departmentPO); builderDeparts.add(departmentPO);
if (SearchTreeUtil.isTop(departmentPO.getParentDept())) { if (SearchTreeUtil.isTop(departmentPO.getSupDepId())) {
return; return;
} }
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getParentDept()); DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getSupDepId());
if (null != parentDept) { if (null != parentDept) {
buildParentDepts(parentDept, builderDeparts); buildParentDepts(parentDept, builderDeparts);
} }
@ -704,9 +704,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
* @param compPO * @param compPO
* @param builderComps * @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); builderComps.add(compPO);
CompPO parentComp = allMaps.get(compPO.getParentCompany()); CompPO parentComp = allMaps.get(compPO.getSupSubComId());
if (null != parentComp) { if (null != parentComp) {
buildParentComps(parentComp, builderComps, allMaps); 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.LevelMapper;
import com.engine.organization.mapper.scheme.SchemeMapper; import com.engine.organization.mapper.scheme.SchemeMapper;
import com.engine.organization.service.ImportCommonService; 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.HasRightUtil;
import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.excel.ExcelUtil; import com.engine.organization.util.excel.ExcelUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.saveimport.OrgImportUtil; import com.engine.organization.util.saveimport.OrgImportUtil;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -662,7 +663,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null; Integer parentCompanyId = null;
String companyName = ""; String companyName = "";
historyDetailPO.setRowNums(String.valueOf(i + 1)); historyDetailPO.setRowNums(String.valueOf(i + 1));
@ -725,9 +726,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
} }
map.put("parent_company", parentCompanyId); map.put("parent_company", parentCompanyId);
if (null != parentCompanyId) { map.put("ec_company", parentCompanyId);
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(parentCompanyId.toString()));
}
companyName = split[split.length - 1]; companyName = split[split.length - 1];
map.put("comp_name", companyName); map.put("comp_name", companyName);
} }
@ -745,7 +745,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
continue; continue;
} }
String compNo = (String) map.get("comp_no"); 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 ("add".equals(operateType)) {
if (companyId != null) { if (companyId != null) {
historyDetailPO.setOperateDetail("数据已存在"); historyDetailPO.setOperateDetail("数据已存在");
@ -788,7 +788,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("JCL_ORG_COMP").params(map).build(); ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("JCL_ORG_COMP").params(map).build();
MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams); MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams);
// 刷新组织架构图 // 刷新组织架构图
new CompanyTriggerRunnable(infoParams.getId()).run(); //TODO new CompanyTriggerRunnable(infoParams.getId()).run();
historyDetailPO.setOperateDetail("添加成功"); historyDetailPO.setOperateDetail("添加成功");
historyDetailPO.setStatus("1"); historyDetailPO.setStatus("1");
} else { } else {
@ -805,15 +805,15 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue; continue;
} }
if (checkRepeatNo(compNo, COMPANY_TYPE, companyId)) { if (checkRepeatNo(compNo, COMPANY_TYPE, Long.valueOf(companyId))) {
map.put("update_time", new Date()); map.put("update_time", new Date());
map.put("id", companyId); map.put("id", companyId);
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, map, false).sync(); Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, map, false).sync();
if (isThrowError(syncMap)) { if (isThrowError(syncMap)) {
map.remove("id"); 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.setOperateDetail("更新成功");
historyDetailPO.setStatus("1"); historyDetailPO.setStatus("1");
} else { } else {
@ -870,8 +870,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null; Integer parentCompanyId = null;
Long parentDepartmentId = null; Integer parentDepartmentId = null;
String departmentName = ""; String departmentName = "";
historyDetailPO.setRowNums(String.valueOf(i + 1)); historyDetailPO.setRowNums(String.valueOf(i + 1));
@ -962,11 +962,10 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
} }
map.put("parent_comp", parentCompanyId); map.put("parent_comp", parentCompanyId);
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(parentCompanyId.toString())); map.put("ec_company", parentCompanyId);
map.put("parent_dept", parentDepartmentId); map.put("parent_dept", parentDepartmentId);
if (null != parentDepartmentId) { map.put("ec_department", parentDepartmentId);
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(parentDepartmentId.toString()));
}
departmentName = split[split.length - 1]; departmentName = split[split.length - 1];
map.put("dept_name", departmentName); map.put("dept_name", departmentName);
} }
@ -983,7 +982,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
continue; continue;
} }
String deptNo = (String) map.get("dept_no"); 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 ("add".equals(operateType)) {
if (departmentId != null) { if (departmentId != null) {
historyDetailPO.setOperateDetail("数据已存在"); historyDetailPO.setOperateDetail("数据已存在");
@ -1010,9 +1009,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
String showOrder = Util.null2String(map.get("show_order")); String showOrder = Util.null2String(map.get("show_order"));
if (StringUtils.isBlank(showOrder)) { if (StringUtils.isBlank(showOrder)) {
Integer maxShowOrder = MapperProxyFactory.getProxy(DepartmentMapper.class).getMaxShowOrder(); Double maxShowOrder = MapperProxyFactory.getProxy(DepartmentMapper.class).getMaxShowOrder();
if (null == maxShowOrder) { if (null == maxShowOrder) {
maxShowOrder = 0; maxShowOrder = 0D;
} }
map.put("show_order", maxShowOrder + 1); 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(); ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("JCL_ORG_DEPT").params(map).build();
MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams); MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams);
// 刷新组织架构图 // 刷新组织架构图
new DepartmentTriggerRunnable(infoParams.getId()).run(); //TODO new DepartmentTriggerRunnable(infoParams.getId()).run();
map.put("id", infoParams.getId()); map.put("id", infoParams.getId());
historyDetailPO.setOperateDetail("添加成功"); historyDetailPO.setOperateDetail("添加成功");
historyDetailPO.setStatus("1"); historyDetailPO.setStatus("1");
@ -1043,15 +1042,15 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue; continue;
} }
if (checkRepeatNo(deptNo, DEPARTMENT_TYPE, departmentId)) { if (checkRepeatNo(deptNo, DEPARTMENT_TYPE, Long.valueOf(departmentId))) {
map.put("update_time", new Date()); map.put("update_time", new Date());
map.put("id", departmentId); map.put("id", departmentId);
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map, false).sync(); Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map, false).sync();
if (isThrowError(syncMap)) { if (isThrowError(syncMap)) {
map.remove("id"); 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.setOperateDetail("更新成功");
historyDetailPO.setStatus("1"); historyDetailPO.setStatus("1");
} else { } else {
@ -1107,8 +1106,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null; Integer parentCompanyId = null;
Long parentDepartmentId = null; Integer parentDepartmentId = null;
Long parentJobId = null; Long parentJobId = null;
String jobName = ""; String jobName = "";
@ -1223,10 +1222,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
map.put("parent_comp", parentCompanyId); map.put("parent_comp", parentCompanyId);
map.put("parent_dept", parentDepartmentId); map.put("parent_dept", parentDepartmentId);
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(parentCompanyId))); map.put("ec_company", parentCompanyId);
if (null != parentDepartmentId) { map.put("ec_department", parentDepartmentId);
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId)));
}
map.put("parent_job", parentJobId); map.put("parent_job", parentJobId);
jobName = split[split.length - 1]; jobName = split[split.length - 1];
map.put("job_name", jobName); map.put("job_name", jobName);
@ -1372,8 +1369,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null; Integer parentCompanyId = null;
Long parentDepartmentId = null; Integer parentDepartmentId = null;
Long parentJobId = null; Long parentJobId = null;
historyDetailPO.setRowNums(String.valueOf(i + 1)); historyDetailPO.setRowNums(String.valueOf(i + 1));
@ -1486,10 +1483,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
map.put("company_id", parentCompanyId); map.put("company_id", parentCompanyId);
map.put("department_id", parentDepartmentId); map.put("department_id", parentDepartmentId);
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(parentCompanyId))); map.put("ec_company", parentCompanyId);
if (null != parentDepartmentId) { map.put("ec_department", parentDepartmentId);
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId)));
}
map.put("job_title", parentJobId); map.put("job_title", parentJobId);
} }
} }
@ -1517,7 +1513,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(keyFieldValue); historyDetailPO.setRelatedName(keyFieldValue);
// 判断当前人员是否存在 // 判断当前人员是否存在
boolean hasSameKeyFieldValue = hasSameKeyFieldValue(historyDetailPO, keyField, keyFieldValue); boolean hasSameKeyFieldValue = hasSameKeyFieldValue(historyDetailPO, keyField, keyFieldValue);
;
if (hasSameKeyFieldValue) { if (hasSameKeyFieldValue) {
continue; continue;
} }
@ -1630,7 +1625,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
XSSFSheet sheetAt = workbook.getSheetAt(s); XSSFSheet sheetAt = workbook.getSheetAt(s);
int lastRow = sheetAt.getLastRowNum(); int lastRow = sheetAt.getLastRowNum();
allRow = allRow + lastRow; allRow = allRow + lastRow;
String relatedName = ""; String relatedName;
switch (s) { switch (s) {
case 0: case 0:
relatedName = "方案页"; relatedName = "方案页";
@ -1658,11 +1653,11 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
SchemePO schemePO = new SchemePO(); SchemePO schemePO = new SchemePO();
SchemePO schemeNew = new SchemePO(); SchemePO schemeNew;
GradePO gradePO = new GradePO(); GradePO gradePO = new GradePO();
GradePO gradeNew = new GradePO(); GradePO gradeNew = new GradePO();
LevelPO levelPO = new LevelPO(); LevelPO levelPO = new LevelPO();
LevelPO levelNew = new LevelPO(); LevelPO levelNew;
historyDetailPO.setRowNums(String.valueOf(i + 1)); historyDetailPO.setRowNums(String.valueOf(i + 1));
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) { 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) { if ("level_no".equals(infoPO.getFieldName()) && s == 2) {
String[] split = Util.null2String(reallyValue).split(","); String[] split = Util.null2String(reallyValue).split(",");
if (split.length > 0) { if (split.length > 0) {
for (int index = 0; index < split.length; index++) { for (String value : split) {
List<LevelPO> levelPOS = MapperProxyFactory.getProxy(LevelMapper.class).listByNo(split[index]); List<LevelPO> levelPOS = MapperProxyFactory.getProxy(LevelMapper.class).listByNo(value);
if (levelPOS.size() == 0) { if (levelPOS.size() == 0) {
historyDetailPO.setRelatedName(relatedName); historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等"); historyDetailPO.setOperateDetail("未找到编号为[" + value + "]的职等");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue nextRow;
@ -1790,7 +1785,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("职等页导入:同一方案" + schemeNo + "下,职等编号不可重复"); historyDetailPO.setOperateDetail("职等页导入:同一方案" + schemeNo + "下,职等编号不可重复");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} else { } else {
levelPO.setLevelNo(levelNo); levelPO.setLevelNo(levelNo);
levelPO.setLevelName((String) map.get("level_name")); levelPO.setLevelName((String) map.get("level_name"));
@ -1810,7 +1805,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案"); historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
break; break;
case 2: case 2:
@ -1824,7 +1819,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案"); historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
gradePO.setGradeNo(gradeNo2); gradePO.setGradeNo(gradeNo2);
@ -1839,21 +1834,21 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
gradePO.setCreateTime((Date) map.get("create_time")); gradePO.setCreateTime((Date) map.get("create_time"));
gradePO.setUpdateTime((Date) map.get("update_time")); gradePO.setUpdateTime((Date) map.get("update_time"));
String[] split = levelNo2.split(","); String[] split = levelNo2.split(",");
String levelIds = null; StringBuilder levelIds = null;
if (split.length > 0) { if (split.length > 0) {
for (int index = 0; index < split.length; index++) { for (String value : split) {
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(split[index], schemeNew.getId()); levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(value, schemeNew.getId());
if (levelNew == null) { if (levelNew == null) {
historyDetailPO.setRelatedName(relatedName); historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等"); historyDetailPO.setOperateDetail("未找到编号为[" + value + "]的职等");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue nextRow;
} }
if (levelIds != null) { if (levelIds != null) {
levelIds = levelIds + "," + levelNew.getId(); levelIds.append(",").append(levelNew.getId());
} else { } 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.setOperateDetail("同一方案[" + schemeNo2 + "]下,职级编号不可重复");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} else { } else {
// 关联职等id // 关联职等id
gradePO.setLevelId(levelIds); gradePO.setLevelId(levelIds.toString());
MapperProxyFactory.getProxy(GradeMapper.class).insertIgnoreNull(gradePO); MapperProxyFactory.getProxy(GradeMapper.class).insertIgnoreNull(gradePO);
} }
break; break;
@ -1890,7 +1885,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号为[" + map.get("scheme_no") + "]的方案"); historyDetailPO.setOperateDetail("未找到编号为[" + map.get("scheme_no") + "]的方案");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
break; break;
case 1: case 1:
@ -1911,14 +1906,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案"); historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
} else { } else {
historyDetailPO.setRelatedName(relatedName); historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案,无法更新"); historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案,无法更新");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
break; break;
case 2: case 2:
@ -1930,25 +1925,25 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案"); historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
// 处理职级编号 // 处理职级编号
String[] split = levelNo2.split(","); String[] split = levelNo2.split(",");
String levelIds = null; StringBuilder levelIds = null;
if (split.length > 0) { if (split.length > 0) {
for (int index = 0; index < split.length; index++) { for (String value : split) {
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(split[index], schemeNew.getId()); levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(value, schemeNew.getId());
if (levelNew == null) { if (levelNew == null) {
historyDetailPO.setRelatedName(relatedName); historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等"); historyDetailPO.setOperateDetail("未找到编号为[" + value + "]的职等");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue nextRow;
} }
if (levelIds != null) { if (levelIds != null) {
levelIds = levelIds + "," + levelNew.getId(); levelIds.append(",").append(levelNew.getId());
} else { } 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.setGradeName((String) map.get("grade_name"));
gradeNew.setDescription((String) map.get("grade_description")); gradeNew.setDescription((String) map.get("grade_description"));
// 关联职等id // 关联职等id
gradeNew.setLevelId(levelIds); gradeNew.setLevelId(levelIds.toString());
gradeNew.setUpdateTime((Date) map.get("update_time")); gradeNew.setUpdateTime((Date) map.get("update_time"));
MapperProxyFactory.getProxy(GradeMapper.class).updateGrade(gradeNew); MapperProxyFactory.getProxy(GradeMapper.class).updateGrade(gradeNew);
} else { } else {
@ -1966,7 +1961,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号[" + schemeNo2 + "]的职级,无法更新"); historyDetailPO.setOperateDetail("未找到编号[" + schemeNo2 + "]的职级,无法更新");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
break; break;
@ -1988,8 +1983,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
*/ */
private String getCellValue(XSSFCell cell) { private String getCellValue(XSSFCell cell) {
String cellValue = ""; String cellValue = "";
if (cell == null) if (cell == null) {
return ""; return "";
}
switch (cell.getCellType()) { switch (cell.getCellType()) {
case BOOLEAN: // 得到Boolean对象的方法 case BOOLEAN: // 得到Boolean对象的方法
cellValue = String.valueOf(cell.getBooleanCellValue()); cellValue = String.valueOf(cell.getBooleanCellValue());
@ -2000,9 +1996,10 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
cellValue = sft.format(cell.getDateCellValue()); // 读取日期格式 cellValue = sft.format(cell.getDateCellValue()); // 读取日期格式
} else { } else {
cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字 cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字
if (cellValue.endsWith(".0")) if (cellValue.endsWith(".0")) {
cellValue = cellValue.substring(0, cellValue.indexOf(".")); cellValue = cellValue.substring(0, cellValue.indexOf("."));
} }
}
break; break;
case FORMULA: // 读取公式 case FORMULA: // 读取公式
cellValue = cell.getCellFormula(); cellValue = cell.getCellFormula();
@ -2026,7 +2023,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null != extendType) { if (null != extendType) {
switch (extendType.toString()) { switch (extendType.toString()) {
case "1": case "1":
return 0 == MapperProxyFactory.getProxy(CompMapper.class).checkRepeatNo(no, id); // return 0 == MapperProxyFactory.getProxy(CompMapper.class).checkRepeatNo(no, id);
case "2": case "2":
return 0 == MapperProxyFactory.getProxy(DepartmentMapper.class).checkRepeatNo(no, id); return 0 == MapperProxyFactory.getProxy(DepartmentMapper.class).checkRepeatNo(no, id);
case "3": 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.Column;
import com.engine.organization.util.page.PageInfo; import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil; import com.engine.organization.util.page.PageUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.tree.SearchTreeUtil; import com.engine.organization.util.tree.SearchTreeUtil;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@ -163,7 +162,7 @@ public class JobServiceImpl extends Service implements JobService {
JobPO jobPO = JobBO.convertParamsToPO(param, user.getUID()); JobPO jobPO = JobBO.convertParamsToPO(param, user.getUID());
boolean filter = isFilter(jobPO); boolean filter = isFilter(jobPO);
PageInfo<JobListDTO> pageInfos; PageInfo<JobListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams()); String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams(), " show_order ");
List<JobListDTO> allList = getJobMapper().listNoFilter(orderSql); List<JobListDTO> allList = getJobMapper().listNoFilter(orderSql);
new DetachUtil(user.getUID()).filterJobDTOList(allList); new DetachUtil(user.getUID()).filterJobDTOList(allList);
// 通过子级遍历父级元素 // 通过子级遍历父级元素
@ -278,7 +277,7 @@ public class JobServiceImpl extends Service implements JobService {
CompPO compPO = getCompMapper().listById(param.getSubcompanyid1()); CompPO compPO = getCompMapper().listById(param.getSubcompanyid1());
if (null != compPO) { if (null != compPO) {
params.put("parent_comp", compPO.getId()); 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()); DepartmentPO deptById = getDepartmentMapper().getDeptById(param.getDepartmentid());
if (null != deptById) { if (null != deptById) {
params.put("parent_dept", deptById.getId()); params.put("parent_dept", deptById.getId());
params.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString())); params.put("ec_department", deptById.getId());
params.put("parent_comp", deptById.getParentComp()); params.put("parent_comp", deptById.getSubCompanyId1());
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(deptById.getParentComp().toString())); params.put("ec_company", deptById.getSubCompanyId1());
} }
} }
for (ExtendTitlePO extendTitle : extendTitles) { for (ExtendTitlePO extendTitle : extendTitles) {
@ -371,12 +370,12 @@ public class JobServiceImpl extends Service implements JobService {
params.put("ec_company", parentJob.getEcCompany()); params.put("ec_company", parentJob.getEcCompany());
params.put("ec_department", parentJob.getEcDepartment()); params.put("ec_department", parentJob.getEcDepartment());
} else { } else {
Long ecDepartment = searchParam.getEcDepartment(); Integer ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecDepartment)); DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
params.put("parent_dept", jclDepartment.getId()); params.put("parent_dept", jclDepartment.getId());
params.put("parent_comp", jclDepartment.getParentComp()); params.put("parent_comp", jclDepartment.getSubCompanyId1());
if (null != jclDepartment.getParentComp()) { if (null != jclDepartment.getSubCompanyId1()) {
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartment.getParentComp()))); 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_company", parentJob.getEcCompany());
params.put("ec_department", parentJob.getEcDepartment()); params.put("ec_department", parentJob.getEcDepartment());
} else { } else {
Long ecDepartment = searchParam.getEcDepartment(); Integer ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecDepartment)); DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
params.put("parent_dept", jclDepartment.getId()); params.put("parent_dept", jclDepartment.getId());
params.put("parent_comp", jclDepartment.getParentComp()); params.put("parent_comp", jclDepartment.getSubCompanyId1());
if (null != jclDepartment.getParentComp()) { if (null != jclDepartment.getSubCompanyId1()) {
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartment.getParentComp()))); params.put("ec_company", jclDepartment.getSubCompanyId1());
} }
} }
params.put("jobactivityid", JOB_ACTIVITY_ID); 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.setJobNo(CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, jobById.getJobNo(), System.currentTimeMillis()));
// 部门赋值 // 部门赋值
jobById.setEcDepartment(Long.parseLong(department)); jobById.setEcDepartment(Integer.parseInt(department));
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(department); DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(jobById.getEcDepartment());
if (null != jclDepartmentId) { if (null != jclDepartmentId) {
jobById.setParentDept(jclDepartmentId.getId()); jobById.setParentDept(jclDepartmentId.getId());
//分部赋值 //分部赋值
jobById.setEcCompany(jclDepartmentId.getEcCompany()); jobById.setEcCompany(jclDepartmentId.getSubCompanyId1());
jobById.setParentComp(jclDepartmentId.getParentComp()); jobById.setParentComp(jclDepartmentId.getSubCompanyId1());
} }
// 清空上级岗位 // 清空上级岗位
jobById.setParentJob(null); jobById.setParentJob(null);
@ -489,7 +488,7 @@ public class JobServiceImpl extends Service implements JobService {
if (params.getForbiddenTag()) { if (params.getForbiddenTag()) {
// 启用:判断上级部门是否启用,上级部门启用,岗位才可启用 // 启用:判断上级部门是否启用,上级部门启用,岗位才可启用
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(jobById.getParentDept()); DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(jobById.getParentDept());
OrganizationAssert.isTrue(0 == parentDepartment.getForbiddenTag(), "该岗位不能解封,请先解封上级部门"); OrganizationAssert.isTrue(0 == parentDepartment.getCanceled(), "该岗位不能解封,请先解封上级部门");
// 启用:判断上级岗位是否启用,上级岗位启用,岗位才可启用 // 启用:判断上级岗位是否启用,上级岗位启用,岗位才可启用
if (null != jobById.getParentJob()) { 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) { for (JobPO job : jobs) {
job.setParentComp(parentCompany); job.setParentComp(parentCompany);
job.setEcCompany(ecCompany); job.setEcCompany(ecCompany);
@ -627,11 +626,11 @@ public class JobServiceImpl extends Service implements JobService {
*/ */
private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) { private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) {
builderDeparts.add(departmentPO); builderDeparts.add(departmentPO);
if (SearchTreeUtil.isTop(departmentPO.getParentDept())) { if (SearchTreeUtil.isTop(departmentPO.getSupDepId())) {
return; return;
} }
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getParentDept()); DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getSupDepId());
if (null != parentDept && 0 == parentDept.getForbiddenTag()) { if (null != parentDept && (null == parentDept.getCanceled() || 0 == parentDept.getCanceled())) {
buildParentDepts(parentDept, builderDeparts); buildParentDepts(parentDept, builderDeparts);
} }
} }
@ -642,10 +641,10 @@ public class JobServiceImpl extends Service implements JobService {
* @param compPO * @param compPO
* @param builderComps * @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); builderComps.add(compPO);
CompPO parentComp = allMaps.get(compPO.getParentCompany()); CompPO parentComp = allMaps.get(compPO.getSupSubComId());
if (null != parentComp && 0 == parentComp.getForbiddenTag()) { if (null != parentComp && (null == parentComp.getCanceled() || 0 == parentComp.getCanceled())) {
buildParentComps(parentComp, builderComps, allMaps); buildParentComps(parentComp, builderComps, allMaps);
} }
} }
@ -662,14 +661,14 @@ public class JobServiceImpl extends Service implements JobService {
List<SearchTree> searchTree = new ArrayList<>(); List<SearchTree> searchTree = new ArrayList<>();
// 通过分部、公司 组装数据 // 通过分部、公司 组装数据
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) { if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id); Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentComp(parentCompId).forbiddenTag(0).build(); DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).subCompanyId1(parentCompId).canceled(0).build();
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).forbiddenTag(0).build(); CompPO compBuild = CompPO.builder().subCompanyName(keyword).supSubComId(parentCompId).canceled(0).build();
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild); searchTree = buildTreeByCompAndDept(departmentBuild, compBuild);
} else if (TYPE_DEPT.equals(type)) { } 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<>(); Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) { for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts); buildParentDepts(departmentPO, builderDeparts);
@ -688,10 +687,10 @@ public class JobServiceImpl extends Service implements JobService {
* @return * @return
*/ */
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild) { 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); 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); new DetachUtil(user.getUID()).filterCompanyList(filterComps);
Set<DepartmentPO> builderDeparts = new HashSet<>(); Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) { for (DepartmentPO departmentPO : filterDeparts) {
@ -706,9 +705,9 @@ public class JobServiceImpl extends Service implements JobService {
filterComps.addAll(compsByIds); filterComps.addAll(compsByIds);
} }
} }
List<CompPO> allCompanys = getCompMapper().list("show_order"); List<CompPO> allCompanys = getCompMapper().listAll("showorder");
new DetachUtil(user.getUID()).filterCompanyList(allCompanys); 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<>(); Set<CompPO> builderComps = new HashSet<>();
for (CompPO compPO : filterComps) { for (CompPO compPO : filterComps) {
buildParentComps(compPO, builderComps, allMaps); buildParentComps(compPO, builderComps, allMaps);
@ -774,30 +773,6 @@ public class JobServiceImpl extends Service implements JobService {
return generateCode; 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 * 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); 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) { 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 * @param throwException
* @return * @return
*/ */
public static boolean assertNameRepeat(Long jobId, Long departmentId, Long parentJobId, String jobName, boolean throwException) { public static boolean assertNameRepeat(Long jobId, Integer departmentId, Long parentJobId, String jobName, boolean throwException) {
int count = 0; int count;
// 有上级岗位、判断相同层级下有无相同名称岗位 // 有上级岗位、判断相同层级下有无相同名称岗位
if (null != jobId) { if (null != jobId) {
count = getJobMapper().countRepeatNameByPid(jobName, jobId, parentJobId, departmentId); count = getJobMapper().countRepeatNameByPid(jobName, jobId, parentJobId, departmentId);
@ -879,10 +854,10 @@ public class JobServiceImpl extends Service implements JobService {
// 更新岗位下的人员 // 更新岗位下的人员
Long originalJobId = originalJob.getId(); Long originalJobId = originalJob.getId();
Long targetJobId = targetJob.getId(); Long targetJobId = targetJob.getId();
Long parentComp = targetJob.getParentComp(); Integer parentComp = targetJob.getParentComp();
Long parentDept = targetJob.getParentDept(); Integer parentDept = targetJob.getParentDept();
Long ecCompany = targetJob.getEcCompany(); Integer ecCompany = targetJob.getEcCompany();
Long ecDepartment = targetJob.getEcDepartment(); Integer ecDepartment = targetJob.getEcDepartment();
List<HrmResourcePO> resourceList = getResourceMapper().getResourceListByJobId(originalJobId); List<HrmResourcePO> resourceList = getResourceMapper().getResourceListByJobId(originalJobId);
getResourceMapper().updateResourceJob(originalJobId, targetJobId, parentComp, parentDept, ecCompany, ecDepartment); 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.OrganizationFormItemUtil;
import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.weaver.file.ConfigOperator; import com.weaver.file.ConfigOperator;
import com.weaver.general.BaseBean; import com.weaver.general.BaseBean;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
@ -125,7 +124,6 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
.ecManager(param.getEcManager()) .ecManager(param.getEcManager())
.jclManager(getResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue()) .jclManager(getResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.ecRolelevel(param.getEcRolelevel()) .ecRolelevel(param.getEcRolelevel())
.jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
.manageModule("组织管理") .manageModule("组织管理")
.creator((long)user.getUID()) .creator((long)user.getUID())
.deleteType(0) .deleteType(0)
@ -143,7 +141,6 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
.ecManager(param.getEcManager()) .ecManager(param.getEcManager())
.jclManager(getResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue()) .jclManager(getResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.ecRolelevel(param.getEcRolelevel()) .ecRolelevel(param.getEcRolelevel())
.jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
.build(); .build();
return getMangeDetachMapper().updateDetach(managerDetachPO); return getMangeDetachMapper().updateDetach(managerDetachPO);
} }
@ -177,12 +174,12 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
* @param uId * @param uId
* @return * @return
*/ */
public static List<Long> getJclRoleLevels(Integer uId) { public static List<Integer> getJclRoleLevels(Integer uId) {
List<Long> ecRoleLevels = new ArrayList<>(); List<Integer> ecRoleLevels = new ArrayList<>();
ManagerDetachMapper mangeDetachMapper = MapperProxyFactory.getProxy(ManagerDetachMapper.class); ManagerDetachMapper mangeDetachMapper = MapperProxyFactory.getProxy(ManagerDetachMapper.class);
List<ManagerDetachPO> detachListById = mangeDetachMapper.getDetachListById(uId); List<ManagerDetachPO> detachListById = mangeDetachMapper.getDetachListById(uId);
for (ManagerDetachPO managerDetachPO : detachListById) { 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)) { if (CollectionUtils.isNotEmpty(ids)) {
ecRoleLevels.addAll(ids); ecRoleLevels.addAll(ids);
} }

@ -6,19 +6,16 @@ import com.api.browser.bean.SearchConditionOption;
import com.cloudstore.eccom.result.WeaResultMsg; import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.organization.component.OrganizationWeaTable; 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.bo.StaffPlanBO;
import com.engine.organization.entity.staff.param.StaffPlanSearchParam; import com.engine.organization.entity.staff.param.StaffPlanSearchParam;
import com.engine.organization.entity.staff.po.StaffPlanPO; import com.engine.organization.entity.staff.po.StaffPlanPO;
import com.engine.organization.entity.staff.vo.StaffPlanTableVO; 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.mapper.staff.StaffPlanMapper;
import com.engine.organization.service.StaffPlanService; import com.engine.organization.service.StaffPlanService;
import com.engine.organization.util.*; import com.engine.organization.util.*;
import com.engine.organization.util.browser.OrganizationBrowserUtil; import com.engine.organization.util.browser.OrganizationBrowserUtil;
import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil; import weaver.common.DateUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
@ -41,10 +38,6 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
return MapperProxyFactory.getProxy(StaffPlanMapper.class); return MapperProxyFactory.getProxy(StaffPlanMapper.class);
} }
private CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class);
}
@Override @Override
public Map<String, Object> listPage(StaffPlanSearchParam params) { public Map<String, Object> listPage(StaffPlanSearchParam params) {
Map<String, Object> resultMap = new HashMap<>(); 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 staffPlanPO = StaffPlanBO.convertParamToPO(param, (long) user.getUID());
// 多选赋值 // 多选赋值
staffPlanPO.setCompanyId(getJclCompanyIdsByEcIds(staffPlanPO.getEcCompany())); staffPlanPO.setCompanyId(staffPlanPO.getEcCompany());
String timeStart = param.getTimeStart(); String timeStart = param.getTimeStart();
String timeEnd = param.getTimeEnd(); String timeEnd = param.getTimeEnd();
Date startDate = DateUtil.parseToDate(timeStart); Date startDate = DateUtil.parseToDate(timeStart);
@ -100,7 +93,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
Date endDate = DateUtil.parseToDate(timeEnd); Date endDate = DateUtil.parseToDate(timeEnd);
OrganizationAssert.isFalse(startDate.after(endDate), "开始时间不允许在结束时间之后"); OrganizationAssert.isFalse(startDate.after(endDate), "开始时间不允许在结束时间之后");
// 多选赋值 // 多选赋值
staffPlanPO.setCompanyId(getJclCompanyIdsByEcIds(staffPlanPO.getEcCompany())); staffPlanPO.setCompanyId(staffPlanPO.getEcCompany());
return getStaffPlanMapper().updateStaffPlan(staffPlanPO); return getStaffPlanMapper().updateStaffPlan(staffPlanPO);
} }
@ -285,18 +278,4 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
} }
return sqlWhere; 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.component.OrganizationWeaTable;
import com.engine.organization.entity.DeleteParam; import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.browser.po.CustomBrowserBean; 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.department.po.DepartmentPO;
import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.staff.bo.StaffBO; 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.StaffPlanPO;
import com.engine.organization.entity.staff.po.StaffsPO; import com.engine.organization.entity.staff.po.StaffsPO;
import com.engine.organization.entity.staff.vo.StaffTableVO; 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.department.DepartmentMapper;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.staff.StaffMapper; 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.DBType;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.excel.ExcelUtil; import com.engine.organization.util.excel.ExcelUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
@ -64,18 +61,14 @@ public class StaffServiceImpl extends Service implements StaffService {
return MapperProxyFactory.getProxy(StaffPlanMapper.class); return MapperProxyFactory.getProxy(StaffPlanMapper.class);
} }
private CompMapper getCompMapper() { private JobMapper getJobMapper() {
return MapperProxyFactory.getProxy(CompMapper.class); return MapperProxyFactory.getProxy(JobMapper.class);
} }
private DepartmentMapper getDepartmentMapper() { private DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class); return MapperProxyFactory.getProxy(DepartmentMapper.class);
} }
private JobMapper getJobMapper() {
return MapperProxyFactory.getProxy(JobMapper.class);
}
// 判断编制导入模板是否存在,不存在则创建该文件 // 判断编制导入模板是否存在,不存在则创建该文件
static { static {
try { try {
@ -373,19 +366,19 @@ public class StaffServiceImpl extends Service implements StaffService {
} else { } else {
sqlWhere = " where 1 = 2 "; sqlWhere = " where 1 = 2 ";
} }
Long compId = param.getCompId(); Integer compId = param.getCompId();
if (null != compId) { if (null != compId) {
sqlWhere += " AND t.comp_id = '" + compId + "'"; sqlWhere += " AND t.comp_id = '" + compId + "'";
} }
Long deptId = param.getDeptId(); Integer deptId = param.getDeptId();
if (null != deptId) { if (null != deptId) {
sqlWhere += " AND t.dept_id = '" + deptId + "'"; sqlWhere += " AND t.dept_id = '" + deptId + "'";
} }
Long ecCompany = param.getEcCompany(); Integer ecCompany = param.getEcCompany();
if (null != ecCompany) { if (null != ecCompany) {
sqlWhere += " AND t.ec_company = '" + ecCompany + "'"; sqlWhere += " AND t.ec_company = '" + ecCompany + "'";
} }
Long ecDepartment = param.getEcDepartment(); Integer ecDepartment = param.getEcDepartment();
if (null != ecDepartment) { if (null != ecDepartment) {
sqlWhere += " AND t.ec_department = '" + ecDepartment + "'"; sqlWhere += " AND t.ec_department = '" + ecDepartment + "'";
} }
@ -440,18 +433,15 @@ public class StaffServiceImpl extends Service implements StaffService {
switch (staffPlanByID.getControlDimension()) { switch (staffPlanByID.getControlDimension()) {
case "1":// 分部 case "1":// 分部
OrganizationAssert.notNull(staffPO.getEcCompany(), "编制维度选择分部时,分部必填!"); OrganizationAssert.notNull(staffPO.getEcCompany(), "编制维度选择分部时,分部必填!");
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(Util.null2String(staffPO.getEcCompany())); staffPO.setCompId(staffPO.getEcCompany());
if (null != jclCompanyId) {
staffPO.setCompId(jclCompanyId.getId());
}
break; break;
case "2":// 部门 case "2":// 部门
OrganizationAssert.notNull(staffPO.getEcDepartment(), "编制维度选择部门时,部门必填!"); OrganizationAssert.notNull(staffPO.getEcDepartment(), "编制维度选择部门时,部门必填!");
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(staffPO.getEcDepartment())); DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(staffPO.getEcDepartment());
if (null != jclDepartmentId) { if (null != jclDepartmentId) {
staffPO.setDeptId(jclDepartmentId.getId()); staffPO.setDeptId(jclDepartmentId.getId());
staffPO.setCompId(jclDepartmentId.getParentComp()); staffPO.setCompId(jclDepartmentId.getSubCompanyId1());
staffPO.setEcCompany(jclDepartmentId.getEcCompany()); staffPO.setEcCompany(jclDepartmentId.getSubCompanyId1());
} }
break; break;
case "3": // 岗位 case "3": // 岗位

@ -1,159 +1,140 @@
package com.engine.organization.thread; 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 * @author:dxfeng
* @createTime: 2022/08/30 * @createTime: 2022/08/30
* @version: 1.0 * @version: 1.0
*/ */
public class CompanyTriggerRunnable implements Runnable { //public class CompanyTriggerRunnable implements Runnable {
//
private final CompPO oldCompany; // private final CompPO oldCompany;
private final CompPO newCompany; // private final CompPO newCompany;
//
private CompTriggerMapper getCompTriggerMapper() { // private CompTriggerMapper getCompTriggerMapper() {
return MapperProxyFactory.getProxy(CompTriggerMapper.class); // return MapperProxyFactory.getProxy(CompTriggerMapper.class);
} // }
//
public CompanyTriggerRunnable(CompPO oldCompany, CompPO newCompany) { // public CompanyTriggerRunnable(CompPO oldCompany, CompPO newCompany) {
this.oldCompany = oldCompany; // this.oldCompany = oldCompany;
this.newCompany = newCompany; // this.newCompany = newCompany;
} // }
//
public CompanyTriggerRunnable(Long companyId) { // public CompanyTriggerRunnable(Long companyId) {
this.oldCompany = new CompPO(); // this.oldCompany = new CompPO();
this.newCompany = MapperProxyFactory.getProxy(CompMapper.class).listById(companyId); // this.newCompany = MapperProxyFactory.getProxy(CompMapper.class).listById(companyId);
} // }
//
public CompanyTriggerRunnable(CompPO newCompany) { // public CompanyTriggerRunnable(CompPO newCompany) {
this.oldCompany = new CompPO(); // this.oldCompany = new CompPO();
this.newCompany = newCompany; // this.newCompany = newCompany;
this.newCompany.setDeleteType(1); // this.newCompany.setDeleteType(1);
} // }
//
@Override // @Override
public void run() { // public void run() {
// 判断 // // 判断
JclOrgMap jclMap = new JclOrgMap(); // JclOrgMap jclMap = new JclOrgMap();
//
jclMap.setFType(1); // jclMap.setFType(1);
// 更新逻辑 // // 更新逻辑
jclMap.setFObjId(newCompany.getId().intValue()); // jclMap.setFObjId(newCompany.getId().intValue());
jclMap.setId(newCompany.getId().intValue()); // jclMap.setId(newCompany.getId().intValue());
jclMap.setUuid(newCompany.getUuid()); // jclMap.setUuid(newCompany.getUuid());
jclMap.setFNumber(newCompany.getCompNo()); // jclMap.setFNumber(newCompany.getCompNo());
jclMap.setFName(newCompany.getCompName()); // jclMap.setFName(newCompany.getCompName());
jclMap.setFParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue()); // jclMap.setFParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
jclMap.setFObjParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue()); // jclMap.setFObjParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
jclMap.setFEcId(getCompTriggerMapper().getEcCompanyIdByUuid(jclMap.getUuid())); // jclMap.setFEcId(getCompTriggerMapper().getEcCompanyIdByUuid(jclMap.getUuid()));
//
//
jclMap.setFClass(0); // jclMap.setFClass(0);
jclMap.setFClassName("行政维度"); // jclMap.setFClassName("行政维度");
//
Integer ecResourceId = newCompany.getCompPrincipal(); // Integer ecResourceId = newCompany.getCompPrincipal();
HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId); // HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId);
if (null != hrmResourcePO) { // if (null != hrmResourcePO) {
jclMap.setFLeader(hrmResourcePO.getId().intValue()); // jclMap.setFLeader(hrmResourcePO.getId().intValue());
jclMap.setFLeaderName(hrmResourcePO.getLastName()); // jclMap.setFLeaderName(hrmResourcePO.getLastName());
jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue()); // jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
jclMap.setFLeaderSt(hrmResourcePO.getJobGrade()); // jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
jclMap.setFLeaderLv(hrmResourcePO.getJobLevel()); // jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
String image = UserCard.builder().image(hrmResourcePO.getResourceImageId()).build().getImage(); // String image = UserCard.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
jclMap.setFLeaderImg(image); // jclMap.setFLeaderImg(image);
if (null != hrmResourcePO.getJobTitle()) { // if (null != hrmResourcePO.getJobTitle()) {
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle()); // JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());
if (null != jobById) { // if (null != jobById) {
jclMap.setFLeaderJob(jobById.getJobName()); // jclMap.setFLeaderJob(jobById.getJobName());
} // }
} // }
} // }
//
//
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date()); // String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime())); // jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").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); // 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()); // JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.subcompanyfielddefined.getValue().toString(), jclMap.getFObjId().toString());
if (null != jclOrgMapByObjID) { // if (null != jclOrgMapByObjID) {
jclMap.setFPlan(jclOrgMapByObjID.getFPlan()); // jclMap.setFPlan(jclOrgMapByObjID.getFPlan());
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob()); // jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
} else { // } else {
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0); // jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
jclMap.setFOnJob(0); // jclMap.setFOnJob(0);
} // }
jclMap.setFIsVitual(0); // jclMap.setFIsVitual(0);
//
Calendar cal = Calendar.getInstance(); // Calendar cal = Calendar.getInstance();
cal.setTime(jclMap.getFDateBegin()); // cal.setTime(jclMap.getFDateBegin());
Calendar calendar = DateUtil.addDay(cal, -1); // Calendar calendar = DateUtil.addDay(cal, -1);
Date time = new Date(calendar.getTime().getTime()); // Date time = new Date(calendar.getTime().getTime());
getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin()); // getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time); // getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
//
if (1 != newCompany.getDeleteType() && 1 != newCompany.getForbiddenTag()) { // if (1 != newCompany.getDeleteType() && 1 != newCompany.getForbiddenTag()) {
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap); // MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
} // }
if (null != jclOrgMapByObjID) { // if (null != jclOrgMapByObjID) {
if (null != jclOrgMapByObjID.getFParentId()) { // if (null != jclOrgMapByObjID.getFParentId()) {
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString()); // updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
} // }
} // }
if (null != oldCompany) { // if (null != oldCompany) {
if (null != oldCompany.getId()) { // if (null != oldCompany.getId()) {
updateParentPlanAndJob(jclMap.getFDateBegin(), oldCompany.getId().toString()); // updateParentPlanAndJob(jclMap.getFDateBegin(), oldCompany.getId().toString());
} // }
} // }
} // }
//
/** // /**
* // * 更新上级部门在编、在岗数
*/ // */
void updateParentPlanAndJob(Date currentDate, String parentId) { // void updateParentPlanAndJob(Date currentDate, String parentId) {
JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId); // JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId);
if (null != parentJclOrgMap) { // if (null != parentJclOrgMap) {
// 上级部门当前在编、在岗数 // // 上级部门当前在编、在岗数
JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString()); // JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(parentJclOrgMap.getFType(), parentId, null, null); // StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(parentJclOrgMap.getFType(), parentId, null, null);
if (null != jclOrgMapSum) { // if (null != jclOrgMapSum) {
parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan()); // parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob()); // parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
} else { // } else {
parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0); // parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
parentJclOrgMap.setFOnJob(0); // parentJclOrgMap.setFOnJob(0);
} // }
parentJclOrgMap.setFDateBegin(currentDate); // parentJclOrgMap.setFDateBegin(currentDate);
parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); // parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
//
Calendar cal = Calendar.getInstance(); // Calendar cal = Calendar.getInstance();
cal.setTime(parentJclOrgMap.getFDateBegin()); // cal.setTime(parentJclOrgMap.getFDateBegin());
Calendar calendar = DateUtil.addDay(cal, -1); // Calendar calendar = DateUtil.addDay(cal, -1);
Date time = new Date(calendar.getTime().getTime()); // Date time = new Date(calendar.getTime().getTime());
getCompTriggerMapper().deleteMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin()); // getCompTriggerMapper().deleteMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin());
getCompTriggerMapper().updateMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin(), time); // getCompTriggerMapper().updateMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin(), time);
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(parentJclOrgMap); // MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(parentJclOrgMap);
if (null != parentJclOrgMap.getFParentId() && -1 != parentJclOrgMap.getFParentId()) { // if (null != parentJclOrgMap.getFParentId() && -1 != parentJclOrgMap.getFParentId()) {
updateParentPlanAndJob(currentDate, parentJclOrgMap.getFParentId().toString()); // updateParentPlanAndJob(currentDate, parentJclOrgMap.getFParentId().toString());
} // }
} // }
} // }
} //}

@ -1,227 +1,203 @@
package com.engine.organization.thread; 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 * @author:dxfeng
* @createTime: 2022/08/30 * @createTime: 2022/08/30
* @version: 1.0 * @version: 1.0
*/ */
public class DepartmentTriggerRunnable implements Runnable { //public class DepartmentTriggerRunnable implements Runnable {
//
private DepartmentPO oldDepartment; // private DepartmentPO oldDepartment;
private final DepartmentPO newDepartment; // private final DepartmentPO newDepartment;
private String oldFparentId; // private String oldFparentId;
private String moveTarget; // private String moveTarget;
private Boolean forbiddenTag = false; // private Boolean forbiddenTag = false;
//
private CompTriggerMapper getCompTriggerMapper() { // private CompTriggerMapper getCompTriggerMapper() {
return MapperProxyFactory.getProxy(CompTriggerMapper.class); // return MapperProxyFactory.getProxy(CompTriggerMapper.class);
} // }
//
private DepartmentTriggerMapper getDepartmentTriggerMapper() { // private DepartmentTriggerMapper getDepartmentTriggerMapper() {
return MapperProxyFactory.getProxy(DepartmentTriggerMapper.class); // return MapperProxyFactory.getProxy(DepartmentTriggerMapper.class);
} // }
//
public DepartmentTriggerRunnable(DepartmentPO oldDepartment, DepartmentPO newDepartment) { // public DepartmentTriggerRunnable(DepartmentPO oldDepartment, DepartmentPO newDepartment) {
this.oldDepartment = oldDepartment; // this.oldDepartment = oldDepartment;
this.newDepartment = newDepartment; // this.newDepartment = newDepartment;
} // }
//
public DepartmentTriggerRunnable(Boolean forbiddenTag,DepartmentPO oldDepartment, DepartmentPO newDepartment) { // public DepartmentTriggerRunnable(Boolean forbiddenTag,DepartmentPO oldDepartment, DepartmentPO newDepartment) {
this.oldDepartment = oldDepartment; // this.oldDepartment = oldDepartment;
this.newDepartment = newDepartment; // this.newDepartment = newDepartment;
this.forbiddenTag = forbiddenTag; // this.forbiddenTag = forbiddenTag;
} // }
//
public DepartmentTriggerRunnable(Long departmentId) { // public DepartmentTriggerRunnable(Long departmentId) {
this.oldDepartment = new DepartmentPO(); // this.oldDepartment = new DepartmentPO();
this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId); // this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
} // }
//
public DepartmentTriggerRunnable(String moveTarget,DepartmentPO newDepartment) { // public DepartmentTriggerRunnable(String moveTarget,DepartmentPO newDepartment) {
this.oldDepartment = new DepartmentPO(); // this.oldDepartment = new DepartmentPO();
this.newDepartment = newDepartment; // this.newDepartment = newDepartment;
this.moveTarget = moveTarget; // this.moveTarget = moveTarget;
} // }
//
public DepartmentTriggerRunnable(Integer oldFparentId, Long departmentId) { // public DepartmentTriggerRunnable(Integer oldFparentId, Long departmentId) {
this.oldFparentId = null == oldFparentId ? null : oldFparentId.toString(); // this.oldFparentId = null == oldFparentId ? null : oldFparentId.toString();
this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId); // this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
} // }
//
public DepartmentTriggerRunnable(DepartmentPO newDepartment) { // public DepartmentTriggerRunnable(DepartmentPO newDepartment) {
this.oldDepartment = new DepartmentPO(); // this.oldDepartment = new DepartmentPO();
this.newDepartment = newDepartment; // this.newDepartment = newDepartment;
this.newDepartment.setDeleteType(1); // this.newDepartment.setDeleteType(1);
} // }
//
@Override // @Override
public void run() { // public void run() {
FieldBaseEquator fieldBaseEquator = new FieldBaseEquator(); // FieldBaseEquator fieldBaseEquator = new FieldBaseEquator();
List<String> diffFields = fieldBaseEquator.getDiffFieldList(oldDepartment, newDepartment); // List<String> diffFields = fieldBaseEquator.getDiffFieldList(oldDepartment, newDepartment);
if (CollectionUtils.isEmpty(diffFields)) { // if (CollectionUtils.isEmpty(diffFields)) {
return; // return;
} // }
//
// 判断 // // 判断
if (diffFields.contains("deptName") || diffFields.contains("deptPrincipal") || diffFields.contains("parentComp") || diffFields.contains("parentDept") || diffFields.contains("forbiddenTag") || diffFields.contains("deleteType")) { // if (diffFields.contains("deptName") || diffFields.contains("deptPrincipal") || diffFields.contains("parentComp") || diffFields.contains("parentDept") || diffFields.contains("forbiddenTag") || diffFields.contains("deleteType")) {
JclOrgMap jclMap = new JclOrgMap(); // JclOrgMap jclMap = new JclOrgMap();
jclMap.setFType(2); // jclMap.setFType(2);
int st = 100000000; // int st = 100000000;
//
// 更新逻辑 // // 更新逻辑
jclMap.setFObjId(newDepartment.getId().intValue()); // jclMap.setFObjId(newDepartment.getId().intValue());
jclMap.setId(newDepartment.getId().intValue() + st); // jclMap.setId(newDepartment.getId().intValue() + st);
jclMap.setUuid(newDepartment.getUuid()); // jclMap.setUuid(newDepartment.getUuid());
jclMap.setFNumber(newDepartment.getDeptNo()); // jclMap.setFNumber(newDepartment.getDeptNo());
jclMap.setFName(newDepartment.getDeptName()); // jclMap.setFName(newDepartment.getDeptName());
jclMap.setFParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue() + st); // jclMap.setFParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue() + st);
jclMap.setFObjParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue()); // jclMap.setFObjParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue());
//
jclMap.setFEcId(getDepartmentTriggerMapper().getEcDepartmentIdByUuid(jclMap.getUuid())); // jclMap.setFEcId(getDepartmentTriggerMapper().getEcDepartmentIdByUuid(jclMap.getUuid()));
//
jclMap.setFClass(0); // jclMap.setFClass(0);
jclMap.setFClassName("行政维度"); // jclMap.setFClassName("行政维度");
Integer ecResourceId = null == newDepartment.getDeptPrincipal() ? null : newDepartment.getDeptPrincipal().intValue(); // Integer ecResourceId = null == newDepartment.getDeptPrincipal() ? null : newDepartment.getDeptPrincipal().intValue();
HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId); // HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId);
if (null != hrmResourcePO) { // if (null != hrmResourcePO) {
jclMap.setFLeader(hrmResourcePO.getId().intValue()); // jclMap.setFLeader(hrmResourcePO.getId().intValue());
jclMap.setFLeaderName(hrmResourcePO.getLastName()); // jclMap.setFLeaderName(hrmResourcePO.getLastName());
jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue()); // jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
jclMap.setFLeaderSt(hrmResourcePO.getJobGrade()); // jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
jclMap.setFLeaderLv(hrmResourcePO.getJobLevel()); // jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
String image = UserCard.builder().image(hrmResourcePO.getResourceImageId()).build().getImage(); // String image = UserCard.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
jclMap.setFLeaderImg(image); // jclMap.setFLeaderImg(image);
if (null != hrmResourcePO.getJobTitle()) { // if (null != hrmResourcePO.getJobTitle()) {
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle()); // JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());
if (null != jobById) { // if (null != jobById) {
jclMap.setFLeaderJob(jobById.getJobName()); // jclMap.setFLeaderJob(jobById.getJobName());
} // }
} // }
} // }
//
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date()); // String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime())); // jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); // jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
//
// 获取当前生效的本部门map记录 // // 获取当前生效的本部门map记录
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId())); // JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
StaffPO staffPO = new StaffPO(); // StaffPO staffPO = new StaffPO();
switch (jclMap.getFType()) { // switch (jclMap.getFType()) {
// 分部 // // 分部
case 1: // case 1:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,jclMap.getFObjId().toString(), null, null); // staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,jclMap.getFObjId().toString(), null, null);
break; // break;
// 部门 // // 部门
case 2: // case 2:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2,null, jclMap.getFObjId().toString(), null); // staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2,null, jclMap.getFObjId().toString(), null);
break; // break;
} // }
// 取出以该部门为上级部门的在编、在岗数,转移无需计算 // // 取出以该部门为上级部门的在编、在岗数,转移无需计算
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString()); // JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
if (null != moveTarget) { // if (null != moveTarget) {
jclOrgMap = null; // jclOrgMap = null;
} // }
if (null != jclOrgMapByObjID) { // if (null != jclOrgMapByObjID) {
if (null != jclOrgMap) { // if (null != jclOrgMap) {
jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan()); // jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
jclMap.setFOnJob(jclOrgMap.getFOnJob()); // jclMap.setFOnJob(jclOrgMap.getFOnJob());
} else { // } else {
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0); // jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob()); // jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
} // }
} else { // } else {
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0); // jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
jclMap.setFOnJob(0); // jclMap.setFOnJob(0);
} // }
jclMap.setFIsVitual(0); // jclMap.setFIsVitual(0);
//
Calendar cal = Calendar.getInstance(); // Calendar cal = Calendar.getInstance();
cal.setTime(jclMap.getFDateBegin()); // cal.setTime(jclMap.getFDateBegin());
Calendar calendar = DateUtil.addDay(cal, -1); // Calendar calendar = DateUtil.addDay(cal, -1);
Date time = new Date(calendar.getTime().getTime()); // Date time = new Date(calendar.getTime().getTime());
getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin()); // getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time); // getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
//
if (1 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) { // if (1 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) {
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap); // MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
} // }
if(null != jclOrgMapByObjID) { // if(null != jclOrgMapByObjID) {
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString()); // updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
} // }
// 部门启用,刷新上级数据 // // 部门启用,刷新上级数据
if(forbiddenTag){ // if(forbiddenTag){
updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString()); // updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
} // }
if(null != moveTarget){ // if(null != moveTarget){
updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget); // updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget);
} // }
if (null != oldFparentId) { // if (null != oldFparentId) {
updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId); // updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId);
} // }
} // }
} // }
//
private void updateParentPlanAndJob(Date currentDate, String parentId) { // private void updateParentPlanAndJob(Date currentDate, String parentId) {
// 获取上级部门 // // 获取上级部门
JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId); // JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId);
if (null != parentJclOrgMap) { // if (null != parentJclOrgMap) {
// 上级部门当前在编、在岗数 // // 上级部门当前在编、在岗数
JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString()); // JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
StaffPO staffPO = new StaffPO(); // StaffPO staffPO = new StaffPO();
switch (parentJclOrgMap.getFType()) { // switch (parentJclOrgMap.getFType()) {
case 1: // case 1:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,Util.null2String(parentJclOrgMap.getFObjId()), null, null); // staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,Util.null2String(parentJclOrgMap.getFObjId()), null, null);
break; // break;
// 部门 // // 部门
case 2: // case 2:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, Util.null2String(parentJclOrgMap.getFObjId()), null); // staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, Util.null2String(parentJclOrgMap.getFObjId()), null);
break; // break;
} // }
// 编制表jcl_org_staff中的编制数+下级编制数,工具类判断 // // 编制表jcl_org_staff中的编制数+下级编制数,工具类判断
if(null != jclOrgMapSum){ // if(null != jclOrgMapSum){
parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan()); // parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob()); // parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
}else{ // }else{
parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0); // parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
parentJclOrgMap.setFOnJob(0); // parentJclOrgMap.setFOnJob(0);
} // }
parentJclOrgMap.setFDateBegin(currentDate); // parentJclOrgMap.setFDateBegin(currentDate);
parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); // parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
//
Calendar cal = Calendar.getInstance(); // Calendar cal = Calendar.getInstance();
cal.setTime(parentJclOrgMap.getFDateBegin()); // cal.setTime(parentJclOrgMap.getFDateBegin());
Calendar calendar = DateUtil.addDay(cal, -1); // Calendar calendar = DateUtil.addDay(cal, -1);
Date time = new Date(calendar.getTime().getTime()); // Date time = new Date(calendar.getTime().getTime());
getCompTriggerMapper().deleteMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin()); // getCompTriggerMapper().deleteMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin());
getCompTriggerMapper().updateMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin(), time); // getCompTriggerMapper().updateMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin(), time);
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(parentJclOrgMap); // MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(parentJclOrgMap);
if (null != parentJclOrgMap.getFParentId() && -1 != parentJclOrgMap.getFParentId()) { // if (null != parentJclOrgMap.getFParentId() && -1 != parentJclOrgMap.getFParentId()) {
updateParentPlanAndJob(currentDate, parentJclOrgMap.getFParentId().toString()); // 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>
* 1ECHrmJobTitles
* <p>
* 2sql
* <p>
* 3jobtitlename
* <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.HrmJobServiceImpl;
import com.engine.hrm.service.impl.OrganizationServiceImpl; import com.engine.hrm.service.impl.OrganizationServiceImpl;
import com.engine.organization.entity.commom.RecordInfo; 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.entity.job.po.JobPO;
import com.engine.organization.enums.LogModuleNameEnum; import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum; 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.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.util.OrganizationAssert; 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.EcHrmRelationUtil;
import com.engine.organization.util.relation.ResourceSyncUtil; import com.engine.organization.util.relation.ResourceSyncUtil;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util; import weaver.general.Util;
import weaver.hrm.User; import weaver.hrm.User;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -352,67 +345,20 @@ public class OrganizationSyncEc {
* *
*/ */
private void addDepartment() { private void addDepartment() {
Map<String, Object> map = new HashMap<>(); this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).addDepartment(params, user);
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);
//}
} }
/** /**
* *
*/ */
private void cancelDepartment() { private void cancelDepartment() {
String departmentIds = Util.null2String(params.get("id"));
String forbiddenTag = Util.null2String(params.get("forbiddenTag")); 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)) { 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 { } 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() { private void updateDepartment() {
Map<String, Object> map = new HashMap<>(); this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).editDepartment(params, user);
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);
} }
/** /**
@ -454,94 +380,22 @@ public class OrganizationSyncEc {
* *
*/ */
private void updateCompany() { private void updateCompany() {
Map<String, Object> map = new HashMap<>(); this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).editSubCompany(params, user);
// 获取ec表ID
buildEcCompanyData(map);
map.putAll(params);
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).editSubCompany(map, user);
} }
/** /**
* *
*/ */
private void cancelCompany() { private void cancelCompany() {
String companyIds = Util.null2String(params.get("id")); // TODO
String forbiddenTag = Util.null2String(params.get("forbiddenTag")); 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)) { 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 { } 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) { switch (fType) {
case "1": case "1":
// 更新分部编制 // 更新分部编制
refreshCompanyStaff(staffPO.getCompId()); refreshCompanyStaff(staffPO.getCompId().intValue());
break; break;
case "2": case "2":
// 更新部门编制 // 更新部门编制
refreshDepartmentStaff(staffPO.getDeptId()); refreshDepartmentStaff(staffPO.getDeptId());
refreshCompanyStaff(staffPO.getCompId()); refreshCompanyStaff(staffPO.getCompId().intValue());
break; break;
case "3": case "3":
// 更新岗位编制 // 更新岗位编制
refreshJobStaff(staffPO.getJobId()); refreshJobStaff(staffPO.getJobId());
refreshDepartmentStaff(staffPO.getDeptId()); refreshDepartmentStaff(staffPO.getDeptId());
refreshCompanyStaff(staffPO.getCompId()); refreshCompanyStaff(staffPO.getCompId().intValue());
break; break;
default: default:
break; break;
@ -104,15 +104,15 @@ public class StaffTriggerRunnable implements Runnable {
} }
} }
private void refreshCompanyStaff(Long companyId) { private void refreshCompanyStaff(Integer companyId) {
if (null == companyId) { if (null == companyId) {
return; return;
} }
CompPO compPO = getCompMapper().listById(companyId); CompPO compPO = getCompMapper().listById(companyId);
if (null != compPO) { if (null != compPO) {
updateOrgMap(ModuleTypeEnum.subcompanyfielddefined.getValue().toString(), companyId.toString()); updateOrgMap(ModuleTypeEnum.subcompanyfielddefined.getValue().toString(), companyId.toString());
if (null != compPO.getParentCompany() && 0 != compPO.getParentCompany()) { if (null != compPO.getSupSubComId() && 0 != compPO.getSupSubComId()) {
refreshCompanyStaff(compPO.getParentCompany()); refreshCompanyStaff(compPO.getSupSubComId());
} else { } else {
// 刷新集团数据 // 刷新集团数据
refreshGroupStaff(); refreshGroupStaff();
@ -120,15 +120,15 @@ public class StaffTriggerRunnable implements Runnable {
} }
} }
private void refreshDepartmentStaff(Long departmentId) { private void refreshDepartmentStaff(Integer departmentId) {
if (null == departmentId) { if (null == departmentId) {
return; return;
} }
DepartmentPO deptById = getDepartmentMapper().getDeptById(departmentId); DepartmentPO deptById = getDepartmentMapper().getDeptById(departmentId);
if (null != deptById) { if (null != deptById) {
updateOrgMap(ModuleTypeEnum.departmentfielddefined.getValue().toString(), departmentId.toString()); updateOrgMap(ModuleTypeEnum.departmentfielddefined.getValue().toString(), departmentId.toString());
if (null != deptById.getParentDept() && 0 != deptById.getParentDept()) { if (null != deptById.getSupDepId() && 0 != deptById.getSupDepId()) {
refreshDepartmentStaff(deptById.getParentDept()); refreshDepartmentStaff(deptById.getSupDepId());
} }
} }
} }

@ -1,11 +1,11 @@
package com.engine.organization.transmethod; package com.engine.organization.transmethod;
import com.engine.organization.entity.DeleteParam; 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.mapper.comp.CompMapper;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -18,8 +18,7 @@ public class CompTransMethod {
public static String getSpanById(String planId) { public static String getSpanById(String planId) {
CompMapper compMapper = MapperProxyFactory.getProxy(CompMapper.class); CompMapper compMapper = MapperProxyFactory.getProxy(CompMapper.class);
List<Map<String, Object>> maps = compMapper.listCompsByIds(DeleteParam.builder().ids(planId).build().getIds()); List<CompPO> maps = compMapper.getCompsByIds(DeleteParam.builder().ids(planId).build().getIds());
String names = maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(",")); return maps.stream().map(CompPO::getSubCompanyName).collect(Collectors.joining(","));
return names;
} }
} }

@ -15,11 +15,11 @@ import weaver.hrm.User;
public class HrmResourceTransMethod { public class HrmResourceTransMethod {
public static String getDepartmentName(String departmentId) { 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) { 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) { public static String getJobName(String jobTitle) {
return MapperProxyFactory.getProxy(JobMapper.class).getJobById(Long.parseLong(jobTitle)).getJobName(); return MapperProxyFactory.getProxy(JobMapper.class).getJobById(Long.parseLong(jobTitle)).getJobName();

@ -13,11 +13,12 @@ import java.util.List;
public class ConfigTrans { public class ConfigTrans {
public static String getCheckBoxPopedom(String status) { public static String getCheckBoxPopedom(String status) {
if ("0".equals(status)) if ("0".equals(status)) {
return "true"; return "true";
else } else {
return "false"; return "false";
} }
}
public static List<Object> formatSourceOperates(String id, String isDefault) { public static List<Object> formatSourceOperates(String id, String isDefault) {
List list = Lists.newArrayList(); List list = Lists.newArrayList();

@ -20,7 +20,7 @@ public class PageInfoSortUtil {
* @param sortParams * @param sortParams
* @return * @return
*/ */
public static String getSortSql(String sortParams) { public static String getSortSql(String sortParams, String defaultOrder) {
JSONArray jsonArray = JSONObject.parseArray(sortParams); JSONArray jsonArray = JSONObject.parseArray(sortParams);
if (CollectionUtils.isNotEmpty(jsonArray)) { if (CollectionUtils.isNotEmpty(jsonArray)) {
JSONObject jsonObject = (JSONObject) jsonArray.get(0); JSONObject jsonObject = (JSONObject) jsonArray.get(0);
@ -28,7 +28,7 @@ public class PageInfoSortUtil {
String sortOrder = jsonObject.getString("sortOrder").replace("end", ""); String sortOrder = jsonObject.getString("sortOrder").replace("end", "");
return "t." + orderKey + " " + sortOrder; return "t." + orderKey + " " + sortOrder;
} }
return " showOrder "; return defaultOrder;
} }
/** /**
@ -39,7 +39,7 @@ public class PageInfoSortUtil {
*/ */
private static String upperCharToUnderLine(String param) { private static String upperCharToUnderLine(String param) {
Pattern p = Pattern.compile("[A-Z]"); Pattern p = Pattern.compile("[A-Z]");
if (param == null || param.equals("")) { if (param == null || "".equals(param)) {
return ""; return "";
} }
StringBuilder builder = new StringBuilder(param); StringBuilder builder = new StringBuilder(param);

@ -37,7 +37,7 @@ public class ResponseResult<T, R> {
private void permission() { private void permission() {
if (permission) { if (permission) {
List<Object> roleInfo = hrmCommonService.getRoleInfo(user.getUID()); 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 { public class DetachUtil {
private boolean DETACH = "true".equals(new BaseBean().getPropValue("hrmOrganization", "detach")); private boolean DETACH = "true".equals(new BaseBean().getPropValue("hrmOrganization", "detach"));
private final List<Long> jclRoleLevels; private final List<Integer> jclRoleLevels;
public DetachUtil(Integer uId) { public DetachUtil(Integer uId) {
if (1 == uId) { if (1 == uId) {
@ -47,7 +47,7 @@ public class DetachUtil {
*/ */
public void filterDepartmentList(List<DepartmentPO> departmentList) { public void filterDepartmentList(List<DepartmentPO> departmentList) {
if (DETACH && CollectionUtils.isNotEmpty(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) { //自定义浏览按钮 } else if (fieldType == 161 || fieldType == 162) { //自定义浏览按钮
try { try {
String fieldDbType = requestId;//用requestid传递数据 dmlurl 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 + "'"; String sql = "select count(1) from mode_browser where showname = '" + fieldDbType + "'";
rs.execute(sql); rs.execute(sql);
if (rs.next()) {//建模浏览框 if (rs.next()) {//建模浏览框
@ -239,7 +241,7 @@ public class FieldDefinedValueUtil {
try { try {
BrowserBean bb = browser.searchById(s); BrowserBean bb = browser.searchById(s);
String name = Util.null2String(bb.getName()); String name = Util.null2String(bb.getName());
if (showName.toString().equals("")) { if ("".equals(showName.toString())) {
showName.append(name); showName.append(name);
} else { } else {
showName.append(",").append(name); showName.append(",").append(name);
@ -254,12 +256,12 @@ public class FieldDefinedValueUtil {
} }
} else if (fieldType == 256 || fieldType == 257) { } else if (fieldType == 256 || fieldType == 257) {
if (!fieldValue.equals("null")) { if (!"null".equals(fieldValue)) {
CustomTreeUtil customTreeUtil = new CustomTreeUtil(); CustomTreeUtil customTreeUtil = new CustomTreeUtil();
for (String s : tempshowidlist) { for (String s : tempshowidlist) {
String show_val = Util.null2String(s); String show_val = Util.null2String(s);
String name = customTreeUtil.getTreeFieldShowName(show_val, requestId); String name = customTreeUtil.getTreeFieldShowName(show_val, requestId);
if (showName.toString().equals("")) { if ("".equals(showName.toString())) {
showName.append(name); showName.append(name);
} else { } else {
showName.append(",").append(name); showName.append(",").append(name);
@ -274,8 +276,8 @@ public class FieldDefinedValueUtil {
+ fieldType); + fieldType);
String keyColumName = new BrowserComInfo() String keyColumName = new BrowserComInfo()
.getBrowserkeycolumname("" + fieldType); .getBrowserkeycolumname("" + fieldType);
if (columName.equals("") || tableName.equals("") if ("".equals(columName) || "".equals(tableName)
|| keyColumName.equals("") || fieldValue.equals("")) { || "".equals(keyColumName) || "".equals(fieldValue)) {
new BaseBean().writeLog("GET FIELD ERR: fieldType=" + fieldType); new BaseBean().writeLog("GET FIELD ERR: fieldType=" + fieldType);
} else { } else {
sql = "select " + columName + " from " + tableName sql = "select " + columName + " from " + tableName
@ -291,7 +293,7 @@ public class FieldDefinedValueUtil {
showName = new StringBuilder(showName.substring(0, showName.length() - 1)); showName = new StringBuilder(showName.substring(0, showName.length() - 1));
} }
} else if (fieldHtmlType == 4) { // check框 } else if (fieldHtmlType == 4) { // check框
if (fieldValue.equals("1")) { if ("1".equals(fieldValue)) {
showName.append("√"); showName.append("√");
} }
} else if (fieldHtmlType == 5) { } else if (fieldHtmlType == 5) {

@ -1,8 +1,6 @@
package com.engine.organization.util.relation; package com.engine.organization.util.relation;
import com.engine.organization.entity.commom.RecordInfo; 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.entity.job.po.JobPO;
import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper; 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.mapper.job.JobMapper;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
@ -42,71 +38,6 @@ public class EcHrmRelationUtil {
return MapperProxyFactory.getProxy(JobMapper.class); return MapperProxyFactory.getProxy(JobMapper.class);
} }
/**
* jcl_org_comp.idHrmSubCompany.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.idHrmDepartment.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) { public static String getEcJobId(Long jclJobId) {
JobPO jobById = getJobMapper().getJobById(jclJobId); JobPO jobById = getJobMapper().getJobById(jclJobId);
if (null == jobById) { if (null == jobById) {

@ -83,7 +83,9 @@ public class ResourceSyncUtil {
} }
String loginid = Util.null2String(params.get("loginid")); String loginid = Util.null2String(params.get("loginid"));
String accounttype = Util.null2s(Util.fromScreen3(Util.null2String(params.get(("accounttype"))), user.getLanguage()), "0"); 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; boolean canSave = false;
LN LN = new LN(); LN LN = new LN();
int ckHrmnum = LN.CkHrmnum(); 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 + "' "; sql = "select count(1) from hrmresourceallview where loginid='" + loginid + "' ";
rs.execute(sql); rs.execute(sql);
if (rs.next()) { if (rs.next()) {
@ -115,7 +117,7 @@ public class ResourceSyncUtil {
String departmentid = Util.null2String(params.get("departmentid")); String departmentid = Util.null2String(params.get("departmentid"));
String subcompanyid = departmentComInfo.getSubcompanyid1(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("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(81926, user.getLanguage())); retmap.put("message", SystemEnv.getHtmlLabelName(81926, user.getLanguage()));
return retmap; return retmap;
@ -148,14 +150,14 @@ public class ResourceSyncUtil {
//【初始密码】 //【初始密码】
String defaultPassword = Util.null2String(settings.getDefaultPassword()); String defaultPassword = Util.null2String(settings.getDefaultPassword());
//如果管理员设置的密码为空。并且开启了【启用初始密码】,且初始密码不为空,则默认取初始密码作为密码 //如果管理员设置的密码为空。并且开启了【启用初始密码】,且初始密码不为空,则默认取初始密码作为密码
if (password.equals("") && defaultPasswordEnable.equals("1") && !defaultPassword.equals("")) { if ("".equals(password) && "1".equals(defaultPasswordEnable) && !"".equals(defaultPassword)) {
password = defaultPassword; password = defaultPassword;
} }
//判断是否开启了【禁止弱密码保存】 //判断是否开启了【禁止弱密码保存】
String weakPasswordDisable = Util.null2s(settings.getWeakPasswordDisable(), "0"); String weakPasswordDisable = Util.null2s(settings.getWeakPasswordDisable(), "0");
if (weakPasswordDisable.equals("1")) { if ("1".equals(weakPasswordDisable)) {
if (!password.equals("")) {//密码为空的情况 if (!"".equals(password)) {//密码为空的情况
//判断是否为弱密码 //判断是否为弱密码
HrmWeakPasswordUtil hrmWeakPasswordUtil = new HrmWeakPasswordUtil(); HrmWeakPasswordUtil hrmWeakPasswordUtil = new HrmWeakPasswordUtil();
if (hrmWeakPasswordUtil.isWeakPsd(password)) { if (hrmWeakPasswordUtil.isWeakPsd(password)) {
@ -186,8 +188,10 @@ public class ResourceSyncUtil {
String workstartdate = Util.null2String(params.get("workstartdate"));//参加工作日期 String workstartdate = Util.null2String(params.get("workstartdate"));//参加工作日期
String companystartdate = Util.null2String(params.get("companystartdate"));//入职日期 String companystartdate = Util.null2String(params.get("companystartdate"));//入职日期
String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage()); String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
if (dsporder.length() == 0) dsporder = "" + id; if (dsporder.length() == 0) {
if (accounttype.equals("0")) { dsporder = "" + id;
}
if ("0".equals(accounttype)) {
String encrptPassword = ""; String encrptPassword = "";
String salt = ""; String salt = "";
@ -224,8 +228,8 @@ public class ResourceSyncUtil {
//OA与第三方接口单条数据同步方法结束 //OA与第三方接口单条数据同步方法结束
//BBS集成相关 //BBS集成相关
String bbsLingUrl = new weaver.general.BaseBean().getPropValue(GCONST.getConfigFile(), "ecologybbs.linkUrl"); String bbsLingUrl = new weaver.general.BaseBean().getPropValue(GCONST.getConfigFile(), "ecologybbs.linkUrl");
if (!password.equals("0")) { if (!"0".equals(password)) {
if (!bbsLingUrl.equals("")) { if (!"".equals(bbsLingUrl)) {
new Thread(new weaver.bbs.BBSRunnable(loginid, password)).start(); 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 dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage()); String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage());
String systemlanguage = Util.null2String(params.get("systemlanguage")); 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()); String belongto = Util.fromScreen3(Util.null2String(params.get("belongto")), user.getLanguage());
//应聘人员id //应聘人员id
String rcid = Util.null2String(params.get("rcId")); String rcid = Util.null2String(params.get("rcId"));
@ -305,8 +311,10 @@ public class ResourceSyncUtil {
} }
if (dsporder.length() == 0) dsporder = id; if (dsporder.length() == 0) {
if (accounttype.equals("0")) { dsporder = id;
}
if ("0".equals(accounttype)) {
belongto = "-1"; belongto = "-1";
} }
String departmentvirtualids = Util.null2String(params.get("departmentvirtualids"));//虚拟部门id; String departmentvirtualids = Util.null2String(params.get("departmentvirtualids"));//虚拟部门id;
@ -314,12 +322,12 @@ public class ResourceSyncUtil {
//Td9325,解决多账号次账号没有登陆Id在浏览框组织结构中无法显示的问题。 //Td9325,解决多账号次账号没有登陆Id在浏览框组织结构中无法显示的问题。
boolean falg = false; boolean falg = false;
String loginid = ""; String loginid = "";
if (accounttype.equals("1")) { if ("1".equals(accounttype)) {
rs.execute("select loginid from HrmResource where id =" + belongto); rs.execute("select loginid from HrmResource where id =" + belongto);
if (rs.next()) { if (rs.next()) {
loginid = rs.getString("loginid"); loginid = rs.getString("loginid");
} }
if (!loginid.equals("")) { if (!"".equals(loginid)) {
String maxidsql = "select max(id) as id from HrmResource where loginid like '" + loginid + "%'"; String maxidsql = "select max(id) as id from HrmResource where loginid like '" + loginid + "%'";
rs.execute(maxidsql); rs.execute(maxidsql);
if (rs.next()) { if (rs.next()) {
@ -356,8 +364,12 @@ public class ResourceSyncUtil {
while (rs.next()) { while (rs.next()) {
String tmp_managerstr = rs.getString("managerstr"); String tmp_managerstr = rs.getString("managerstr");
//处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin //处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!tmp_managerstr.startsWith(",")) tmp_managerstr = "," + tmp_managerstr; if (!tmp_managerstr.startsWith(",")) {
if (!tmp_managerstr.endsWith(",")) tmp_managerstr = tmp_managerstr + ","; tmp_managerstr = "," + tmp_managerstr;
}
if (!tmp_managerstr.endsWith(",")) {
tmp_managerstr = tmp_managerstr + ",";
}
//处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end //处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
managerstr += tmp_managerstr; managerstr += tmp_managerstr;
managerstr = "," + managerid + managerstr; managerstr = "," + managerid + managerstr;
@ -368,17 +380,37 @@ public class ResourceSyncUtil {
RecordSetTrans rst = new RecordSetTrans(); RecordSetTrans rst = new RecordSetTrans();
rst.setAutoCommit(false); rst.setAutoCommit(false);
try { try {
if (resourceimageid.length() == 0) resourceimageid = "null"; if (resourceimageid.length() == 0) {
if (costcenterid.length() == 0) costcenterid = "null"; resourceimageid = "null";
if (managerid.length() == 0) managerid = "null"; }
if (assistantid.length() == 0) assistantid = "null"; if (costcenterid.length() == 0) {
if (accounttype.length() == 0) accounttype = "null"; costcenterid = "null";
if (belongto.length() == 0) belongto = "null"; }
if (jobcall.length() == 0) jobcall = "null"; if (managerid.length() == 0) {
if (mobileshowtype.length() == 0) mobileshowtype = "null"; managerid = "null";
if (rst.getDBType().equalsIgnoreCase("postgresql")) { }
if (joblevel.length() == 0) joblevel = null; if (assistantid.length() == 0) {
if (dsporder.length() == 0) dsporder = null; 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); workcode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.USER, subcmpanyid1, departmentid, jobtitle, workcode);
para = new StringBuilder("" + id + separator + workcode + separator + lastname + separator + sex + separator + resourceimageid + separator + para = new StringBuilder("" + id + separator + workcode + separator + lastname + separator + sex + separator + resourceimageid + separator +
@ -420,7 +452,9 @@ public class ResourceSyncUtil {
para = new StringBuilder("" + id); para = new StringBuilder("" + id);
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
int idx = i; int idx = i;
if (formdefined) idx++; if (formdefined) {
idx++;
}
String datefield = Util.null2String(params.get("datefield" + idx)); String datefield = Util.null2String(params.get("datefield" + idx));
String numberfield = "" + Util.getDoubleValue(Util.null2String(params.get("numberfield" + idx)), 0); String numberfield = "" + Util.getDoubleValue(Util.null2String(params.get("numberfield" + idx)), 0);
String textfield = Util.null2String(params.get("textfield" + idx)); String textfield = Util.null2String(params.get("textfield" + idx));
@ -443,7 +477,7 @@ public class ResourceSyncUtil {
for (Map.Entry<String, String> me : mapShowSets.entrySet()) { for (Map.Entry<String, String> me : mapShowSets.entrySet()) {
String fieldName = me.getKey(); String fieldName = me.getKey();
String fieldVal = Util.null2String(mapShowSets.get(fieldName)); String fieldVal = Util.null2String(mapShowSets.get(fieldName));
if (fieldVal.equals("1")) { if ("1".equals(fieldVal)) {
String tmpPK = id + "__" + fieldName; String tmpPK = id + "__" + fieldName;
String tmpPvalue = Util.null2String(params.get(fieldName + "showtype")); String tmpPvalue = Util.null2String(params.get(fieldName + "showtype"));
insertSql = "insert into userprivacysetting (combinedid,userid,ptype,pvalue) values('" + tmpPK + "','" + id + "','" + fieldName + "','" + tmpPvalue + "')"; insertSql = "insert into userprivacysetting (combinedid,userid,ptype,pvalue) values('" + tmpPK + "','" + id + "','" + fieldName + "','" + tmpPvalue + "')";
@ -483,7 +517,7 @@ public class ResourceSyncUtil {
Subject += ":" + lastname; Subject += ":" + lastname;
//modifier by lvyi 2013-12-31 //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"; String thesql = "select hrmids from HrmInfoMaintenance where id<4 or id = 10";
rs.execute(thesql); rs.execute(thesql);
StringBuilder members = new StringBuilder(); StringBuilder members = new StringBuilder();
@ -493,7 +527,7 @@ public class ResourceSyncUtil {
members.append(",").append(rs.getString("hrmids")); members.append(",").append(rs.getString("hrmids"));
} }
} }
if (!members.toString().equals("")) { if (!"".equals(members.toString())) {
members = new StringBuilder(members.substring(1)); members = new StringBuilder(members.substring(1));
members = new StringBuilder(new HrmResourceBaseService().duplicateRemoval(members.toString(), user.getUID() + "")); members = new StringBuilder(new HrmResourceBaseService().duplicateRemoval(members.toString(), user.getUID() + ""));
SWFAccepter = members.toString(); SWFAccepter = members.toString();
@ -531,9 +565,13 @@ public class ResourceSyncUtil {
String healthinfo = Util.null2String(rs.getString("healthinfo")); String healthinfo = Util.null2String(rs.getString("healthinfo"));
String height = Util.null2String(rs.getString("height")); 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")); 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 residentplace = Util.null2String(rs.getString("residentplace"));
String homeaddress = Util.null2String(rs.getString("homeaddress")); 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); rs.execute(" select count(*) from HrmResourceVirtual where departmentid ='" + s + "' and resourceid = " + id);
if (rs.next()) { 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); resourceimageid = ServiceUtil.saveResourceImage(resourceimageBase64);
} }
String oldresourceimageid = Util.null2String(params.get("oldresourceimage")); 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 departmentid = Util.fromScreen3(Util.null2String(params.get("departmentid")), user.getLanguage());
String costcenterid = Util.fromScreen3(Util.null2String(params.get("costcenterid")), user.getLanguage()); String costcenterid = Util.fromScreen3(Util.null2String(params.get("costcenterid")), user.getLanguage());
String jobtitle = Util.fromScreen3(Util.null2String(params.get("jobtitle")), 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 dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
String jobcall = Util.fromScreen3(Util.null2String(params.get("jobcall")), user.getLanguage()); String jobcall = Util.fromScreen3(Util.null2String(params.get("jobcall")), user.getLanguage());
String systemlanguage = Util.fromScreen3(Util.null2String(params.get("systemlanguage")), 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"; systemlanguage = "7";
} }
String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage()); String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage());
String belongto = Util.fromScreen3(Util.null2String(params.get("belongto")), user.getLanguage()); String belongto = Util.fromScreen3(Util.null2String(params.get("belongto")), user.getLanguage());
if (dsporder.length() == 0) dsporder = id; if (dsporder.length() == 0) {
if (accounttype.equals("0")) { dsporder = id;
}
if ("0".equals(accounttype)) {
belongto = "-1"; belongto = "-1";
} }
@ -707,18 +751,18 @@ public class ResourceSyncUtil {
} }
String thisAccounttype = rs.getString("accounttype"); String thisAccounttype = rs.getString("accounttype");
if (thisAccounttype.equals("1") && accounttype.equals("0")) { if ("1".equals(thisAccounttype) && "0".equals(accounttype)) {
oldbelongto = rs.getString("belongto"); 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); rs.execute("select loginid from HrmResource where id =" + belongto);
if (rs.next()) { if (rs.next()) {
loginid = rs.getString(1); loginid = rs.getString(1);
} }
if (!loginid.equals("")) { if (!"".equals(loginid)) {
loginid = loginid + (id + 1); loginid = loginid + (id + 1);
falg = true; falg = true;
} }
@ -731,19 +775,39 @@ public class ResourceSyncUtil {
oldmanagerid = rs.getString("managerid"); oldmanagerid = rs.getString("managerid");
oldmanagerstr = rs.getString("managerstr"); oldmanagerstr = rs.getString("managerstr");
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!oldmanagerstr.startsWith(",")) oldmanagerstr = "," + oldmanagerstr; if (!oldmanagerstr.startsWith(",")) {
if (!oldmanagerstr.endsWith(",")) oldmanagerstr = oldmanagerstr + ","; oldmanagerstr = "," + oldmanagerstr;
}
if (!oldmanagerstr.endsWith(",")) {
oldmanagerstr = oldmanagerstr + ",";
}
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
} }
//mysql报错问题java.sql.SQLException: Incorrect integer value: '' for column 'COSTCENTERID' at row 1 //mysql报错问题java.sql.SQLException: Incorrect integer value: '' for column 'COSTCENTERID' at row 1
if(resourceimageid.length()==0)resourceimageid="null"; if(resourceimageid.length()==0) {
if(costcenterid.length()==0)costcenterid="null"; resourceimageid="null";
if(managerid.length()==0)managerid="null"; }
if(assistantid.length()==0)assistantid="null"; if(costcenterid.length()==0) {
if(accounttype.length()==0)accounttype="null"; costcenterid="null";
if(belongto.length()==0)belongto="null"; }
if(jobcall.length()==0)jobcall="null"; if(managerid.length()==0) {
if(mobileshowtype.length()==0)mobileshowtype="null"; 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)) { if (StringUtils.isNotEmpty(workcode)) {
CodeRuleManager.getCodeRuleManager().checkReservedIfDel(RuleCodeType.USER.getValue(), workcode); CodeRuleManager.getCodeRuleManager().checkReservedIfDel(RuleCodeType.USER.getValue(), workcode);
@ -792,7 +856,7 @@ public class ResourceSyncUtil {
for (Map.Entry<String, String> me : mapShowSets.entrySet()) { for (Map.Entry<String, String> me : mapShowSets.entrySet()) {
String fieldName = me.getKey(); String fieldName = me.getKey();
String fieldVal = Util.null2String(mapShowSets.get(fieldName)); String fieldVal = Util.null2String(mapShowSets.get(fieldName));
if (fieldVal.equals("1")) { if ("1".equals(fieldVal)) {
String tmpPK = id + "__" + fieldName; String tmpPK = id + "__" + fieldName;
String tmpPvalue = Util.null2String(params.get(fieldName + "showtype")); String tmpPvalue = Util.null2String(params.get(fieldName + "showtype"));
insertSql = "insert into userprivacysetting (combinedid,userid,ptype,pvalue) values('" + tmpPK + "','" + id + "','" + fieldName + "','" + tmpPvalue + "')"; insertSql = "insert into userprivacysetting (combinedid,userid,ptype,pvalue) values('" + tmpPK + "','" + id + "','" + fieldName + "','" + tmpPvalue + "')";
@ -814,8 +878,12 @@ public class ResourceSyncUtil {
while (rs.next()) { while (rs.next()) {
managerstr = rs.getString("managerstr"); managerstr = rs.getString("managerstr");
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!managerstr.startsWith(",")) managerstr = "," + managerstr; if (!managerstr.startsWith(",")) {
if (!managerstr.endsWith(",")) managerstr = managerstr + ","; managerstr = "," + managerstr;
}
if (!managerstr.endsWith(",")) {
managerstr = managerstr + ",";
}
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
managerstr = "," + managerid + managerstr; managerstr = "," + managerid + managerstr;
managerstr = managerstr.endsWith(",") ? managerstr : (managerstr + ","); managerstr = managerstr.endsWith(",") ? managerstr : (managerstr + ",");
@ -845,13 +913,18 @@ public class ResourceSyncUtil {
while (rs.next()) { while (rs.next()) {
String nowmanagerstr = Util.null2String(rs.getString("managerstr")); String nowmanagerstr = Util.null2String(rs.getString("managerstr"));
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!nowmanagerstr.startsWith(",")) nowmanagerstr = "," + nowmanagerstr; if (!nowmanagerstr.startsWith(",")) {
if (!nowmanagerstr.endsWith(",")) nowmanagerstr = nowmanagerstr + ","; nowmanagerstr = "," + nowmanagerstr;
}
if (!nowmanagerstr.endsWith(",")) {
nowmanagerstr = nowmanagerstr + ",";
}
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
String resourceid = rs.getString("id"); String resourceid = rs.getString("id");
//指定上级为自身的情况,不更新自身上级 //指定上级为自身的情况,不更新自身上级
if (id.equals(resourceid)) if (id.equals(resourceid)) {
continue; continue;
}
String nowmanagerstr2 = ""; String nowmanagerstr2 = "";
int index = nowmanagerstr.lastIndexOf(oldmanagerstr); int index = nowmanagerstr.lastIndexOf(oldmanagerstr);
if (index != -1) { if (index != -1) {
@ -902,7 +975,9 @@ public class ResourceSyncUtil {
para = new StringBuilder("" + id); para = new StringBuilder("" + id);
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
int idx = i; int idx = i;
if (formdefined) idx++; if (formdefined) {
idx++;
}
String datefield = Util.null2String(params.get("datefield" + idx)); String datefield = Util.null2String(params.get("datefield" + idx));
String numberfield = "" + Util.getDoubleValue(Util.null2String(params.get("numberfield" + idx)), 0); String numberfield = "" + Util.getDoubleValue(Util.null2String(params.get("numberfield" + idx)), 0);
String textfield = Util.null2String(params.get("textfield" + idx)); String textfield = Util.null2String(params.get("textfield" + idx));
@ -926,10 +1001,10 @@ public class ResourceSyncUtil {
//处理次账号修改为主账号时,检查次账号所属 主账号的 其他设置是否需要修改 add by kzw QC159888 //处理次账号修改为主账号时,检查次账号所属 主账号的 其他设置是否需要修改 add by kzw QC159888
try { try {
if (!oldbelongto.equals("")) { if (!"".equals(oldbelongto)) {
HrmUserSettingComInfo userSetting = new HrmUserSettingComInfo(); HrmUserSettingComInfo userSetting = new HrmUserSettingComInfo();
String belongtoshow = userSetting.getBelongtoshowByUserId(oldbelongto); String belongtoshow = userSetting.getBelongtoshowByUserId(oldbelongto);
if (belongtoshow.equals("1")) { if ("1".equals(belongtoshow)) {
rs.execute("select id from hrmresource where belongto = " + oldbelongto); rs.execute("select id from hrmresource where belongto = " + oldbelongto);
if (!rs.next()) { if (!rs.next()) {
String setId = userSetting.getId(oldbelongto); String setId = userSetting.getId(oldbelongto);

@ -134,8 +134,9 @@ public class OrgImportUtil {
*/ */
public static String getCellValue(XSSFCell cell) { public static String getCellValue(XSSFCell cell) {
String cellValue = ""; String cellValue = "";
if (cell == null) if (cell == null) {
return ""; return "";
}
switch (cell.getCellType()) { switch (cell.getCellType()) {
case BOOLEAN: // 得到Boolean对象的方法 case BOOLEAN: // 得到Boolean对象的方法
cellValue = String.valueOf(cell.getBooleanCellValue()); cellValue = String.valueOf(cell.getBooleanCellValue());
@ -146,9 +147,10 @@ public class OrgImportUtil {
cellValue = sft.format(cell.getDateCellValue()); // 读取日期格式 cellValue = sft.format(cell.getDateCellValue()); // 读取日期格式
} else { } else {
cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字 cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字
if (cellValue.endsWith(".0")) if (cellValue.endsWith(".0")) {
cellValue = cellValue.substring(0, cellValue.indexOf(".")); cellValue = cellValue.substring(0, cellValue.indexOf("."));
} }
}
break; break;
case FORMULA: // 读取公式 case FORMULA: // 读取公式
cellValue = cell.getCellFormula(); cellValue = cell.getCellFormula();

@ -17,7 +17,6 @@ import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.mapper.staff.StaffPlanMapper; import com.engine.organization.mapper.staff.StaffPlanMapper;
import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCell;
@ -83,8 +82,8 @@ public class StaffInfoImportUtil {
} }
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null; Integer parentCompanyId = null;
Long parentDepartmentId = null; Integer parentDepartmentId = null;
Long parentJobId = null; Long parentJobId = null;
StaffPlanPO staffPlanPO = null; StaffPlanPO staffPlanPO = null;
@ -161,7 +160,7 @@ public class StaffInfoImportUtil {
} }
} }
map.put("comp_id", parentCompanyId); 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())) { if ("dept_id".equals(infoPO.getFieldName())) {
@ -185,9 +184,7 @@ public class StaffInfoImportUtil {
} }
map.put("dept_id", parentDepartmentId); map.put("dept_id", parentDepartmentId);
if (null != parentDepartmentId) { map.put("ec_department", parentDepartmentId);
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId)));
}
} }
// 岗位 // 岗位
@ -261,8 +258,8 @@ public class StaffInfoImportUtil {
if (null == deptById) { if (null == deptById) {
checkMsg = "未找到对应部门!"; checkMsg = "未找到对应部门!";
} else { } else {
param.setCompId(deptById.getParentComp()); param.setCompId(deptById.getSubCompanyId1());
param.setEcCompany(deptById.getEcCompany()); param.setEcCompany(deptById.getSubCompanyId1());
} }
} }
// 取消岗位赋值 // 取消岗位赋值

@ -262,13 +262,13 @@ public class HrmImportProcessE9 extends BaseBean {
RemindSettings settings = reminder.getRemindSettings(); RemindSettings settings = reminder.getRemindSettings();
//判断是否启用【启用初始密码】 //判断是否启用【启用初始密码】
//是否启用初始密码false-不启用初始密码、true-启用初始密码 //是否启用初始密码false-不启用初始密码、true-启用初始密码
boolean defaultPasswordEnable = Util.null2String(settings.getDefaultPasswordEnable()).equals("1"); boolean defaultPasswordEnable = "1".equals(Util.null2String(settings.getDefaultPasswordEnable()));
//初始密码 //初始密码
//初始密码 //初始密码
String defaultPassword = Util.null2String(settings.getDefaultPassword()); String defaultPassword = Util.null2String(settings.getDefaultPassword());
//判断是否启用【弱密码禁止保存】 //判断是否启用【弱密码禁止保存】
//弱密码禁止保存false-允许保存弱密码、true-不允许保存弱密码 //弱密码禁止保存false-允许保存弱密码、true-不允许保存弱密码
boolean weakPasswordDisable = Util.null2String(settings.getWeakPasswordDisable()).equals("1"); boolean weakPasswordDisable = "1".equals(Util.null2String(settings.getWeakPasswordDisable()));
try { try {
//判断是否为弱密码 //判断是否为弱密码
hrmWeakPasswordUtil = new HrmWeakPasswordUtil(); hrmWeakPasswordUtil = new HrmWeakPasswordUtil();
@ -287,7 +287,7 @@ public class HrmImportProcessE9 extends BaseBean {
//TimeUnit.SECONDS.sleep(1); //TimeUnit.SECONDS.sleep(1);
try { // 异常处理 try { // 异常处理
if (operateType.equals("add")) { if ("add".equals(operateType)) {
if (keyMap.get(key) != null) { if (keyMap.get(key) != null) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83520, userlanguage))); 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())) { if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
int belongto = getBelongId(vo.getBelongto(), keyField); int belongto = getBelongId(vo.getBelongto(), keyField);
hrm.setBelongto(belongto); hrm.setBelongto(belongto);
if (!vo.getBelongto().equals("") && belongto == 0) { if (!"".equals(vo.getBelongto()) && belongto == 0) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
continue; continue;
} else { } else {
@ -415,7 +415,7 @@ public class HrmImportProcessE9 extends BaseBean {
} else if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) { } else if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
int belongto = getBelongId(vo.getBelongto(), keyField); int belongto = getBelongId(vo.getBelongto(), keyField);
hrm.setBelongto(belongto); hrm.setBelongto(belongto);
if (!vo.getBelongto().equals("") && belongto == 0) { if (!"".equals(vo.getBelongto()) && belongto == 0) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
continue; continue;
} else { } else {
@ -463,7 +463,7 @@ public class HrmImportProcessE9 extends BaseBean {
hrm.setManagerstr(managerstr); hrm.setManagerstr(managerstr);
//如果vo.getManagerid()有值但manageid未找到说明填写有误 //如果vo.getManagerid()有值但manageid未找到说明填写有误
if (!vo.getManagerid().equals("") && managerid == 0) { if (!"".equals(vo.getManagerid()) && managerid == 0) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage))); resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage)));
continue; continue;
} }
@ -478,7 +478,7 @@ public class HrmImportProcessE9 extends BaseBean {
int assistantid; int assistantid;
assistantid = getAssistantid(vo.getAssistantid(), keyField); assistantid = getAssistantid(vo.getAssistantid(), keyField);
hrm.setAssistantid(assistantid); hrm.setAssistantid(assistantid);
if (!vo.getAssistantid().equals("") && assistantid == 0) { if (!"".equals(vo.getAssistantid()) && assistantid == 0) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage))); resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage)));
continue; continue;
} }
@ -513,10 +513,12 @@ public class HrmImportProcessE9 extends BaseBean {
//mobile-sunjsh //mobile-sunjsh
if (vo.getMobile() != null) { 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); vo.setMobile(null);
} else }
} else {
hrm.setMobile(""); hrm.setMobile("");
}
//工资银行-sunjsh //工资银行-sunjsh
if (vo.getBankid1() != null && !"".equals(vo.getBankid1())) { if (vo.getBankid1() != null && !"".equals(vo.getBankid1())) {
@ -621,7 +623,7 @@ public class HrmImportProcessE9 extends BaseBean {
continue; continue;
} }
//安全级别必须是数字 //安全级别必须是数字
if (!Util.null2String(vo.getSeclevel()).equals("")) { if (!"".equals(Util.null2String(vo.getSeclevel()))) {
if (Util.getIntValue(vo.getSeclevel(), -1000) == -1000) { if (Util.getIntValue(vo.getSeclevel(), -1000) == -1000) {
resultList.add(createLog(vo, "创建", "失败", "安全级别必须是数字")); resultList.add(createLog(vo, "创建", "失败", "安全级别必须是数字"));
continue; continue;
@ -678,7 +680,7 @@ public class HrmImportProcessE9 extends BaseBean {
password_tmp = "1"; password_tmp = "1";
//人员导入文件中,将密码这一列删除或者密码这一列存在,但是不填写都默认为初始密码 //人员导入文件中,将密码这一列删除或者密码这一列存在,但是不填写都默认为初始密码
if (defaultPasswordEnable) { if (defaultPasswordEnable) {
if (!defaultPassword.equals("")) { if (!"".equals(defaultPassword)) {
if (weakPasswordDisable && this.hrmWeakPasswordUtil.isWeakPsd(defaultPassword)) { if (weakPasswordDisable && this.hrmWeakPasswordUtil.isWeakPsd(defaultPassword)) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(515436, userlanguage))); resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(515436, userlanguage)));
continue; continue;
@ -728,7 +730,7 @@ public class HrmImportProcessE9 extends BaseBean {
} else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) { } else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) {
insertFields.append(s).append(","); insertFields.append(s).append(",");
String insertValueStr = Util.null2String(hrmField.get(hrm)); String insertValueStr = Util.null2String(hrmField.get(hrm));
if ("".equals(insertValueStr) && recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("".equals(insertValueStr) && "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
insertValues.append("null,"); insertValues.append("null,");
} else { } else {
insertValues.append(hrmField.get(hrm)).append(","); insertValues.append(hrmField.get(hrm)).append(",");
@ -736,8 +738,8 @@ public class HrmImportProcessE9 extends BaseBean {
} }
} else if (voField.get(vo) != null) { } else if (voField.get(vo) != null) {
if (voFieldType.endsWith("String")) { if (voFieldType.endsWith("String")) {
if (recordSet.getDBType().equalsIgnoreCase("mysql") || recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("mysql".equalsIgnoreCase(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
if (Util.null2String(voField.get(vo)).equals("")) { if ("".equals(Util.null2String(voField.get(vo)))) {
insertFields.append(s).append(","); insertFields.append(s).append(",");
insertValues.append("null,"); insertValues.append("null,");
} else { } else {
@ -751,7 +753,7 @@ public class HrmImportProcessE9 extends BaseBean {
} else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) { } else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) {
insertFields.append(s).append(","); insertFields.append(s).append(",");
String insertValueStr = Util.null2String(voField.get(vo)); String insertValueStr = Util.null2String(voField.get(vo));
if ("".equals(insertValueStr) && recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("".equals(insertValueStr) && "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
insertValues.append("null,"); insertValues.append("null,");
} else { } else {
insertValues.append(voField.get(vo)).append(","); insertValues.append(voField.get(vo)).append(",");
@ -775,12 +777,18 @@ public class HrmImportProcessE9 extends BaseBean {
PasswordUtil.updateResourceSalt(id + "", salt); PasswordUtil.updateResourceSalt(id + "", salt);
if (updateBaseData(vo.getBaseFields(), vo.getBaseFieldsValue(), id)) //添加基础字段信息 if (updateBaseData(vo.getBaseFields(), vo.getBaseFieldsValue(), id)) //添加基础字段信息
{
flag = false; flag = false;
}
if (updatePersonData(vo.getPersonFields(), vo.getPersonFieldsValue(), id)) //添加个人字段信息 if (updatePersonData(vo.getPersonFields(), vo.getPersonFieldsValue(), id)) //添加个人字段信息
{
flag = false; flag = false;
}
if (updateWorkData(vo.getWorkFields(), vo.getWorkFieldsValue(), id)) //添加工作字段信息 if (updateWorkData(vo.getWorkFields(), vo.getWorkFieldsValue(), id)) //添加工作字段信息
{
flag = false; flag = false;
} }
}
/*添加人员缓存人员默认按id显示顺序,HrmResource_Trigger_Insert 人员共享 入职维护项目状态*/ /*添加人员缓存人员默认按id显示顺序,HrmResource_Trigger_Insert 人员共享 入职维护项目状态*/
if (flag) { if (flag) {
@ -942,7 +950,7 @@ public class HrmImportProcessE9 extends BaseBean {
if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) { if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
int belongto = getBelongId(vo.getBelongto(), keyField); int belongto = getBelongId(vo.getBelongto(), keyField);
hrm.setBelongto(belongto); hrm.setBelongto(belongto);
if (!vo.getBelongto().equals("") && belongto == 0) { if (!"".equals(vo.getBelongto()) && belongto == 0) {
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
continue; continue;
} else { } else {
@ -959,7 +967,7 @@ public class HrmImportProcessE9 extends BaseBean {
} else if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) { } else if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
int belongto = getBelongId(vo.getBelongto(), keyField); int belongto = getBelongId(vo.getBelongto(), keyField);
hrm.setBelongto(belongto); hrm.setBelongto(belongto);
if (!vo.getBelongto().equals("") && belongto == 0) { if (!"".equals(vo.getBelongto()) && belongto == 0) {
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
continue; continue;
} else { } else {
@ -1007,7 +1015,9 @@ public class HrmImportProcessE9 extends BaseBean {
//} //}
new BaseBean().writeLog("hrmId【" + hrmId + "】"); new BaseBean().writeLog("hrmId【" + hrmId + "】");
if (Util.getIntValue(hrmId) < 0) continue; if (Util.getIntValue(hrmId) < 0) {
continue;
}
//上级id //上级id
String managerstr = ""; //所有上级 String managerstr = ""; //所有上级
@ -1023,7 +1033,7 @@ public class HrmImportProcessE9 extends BaseBean {
} }
//如果vo.getManagerid()有值但manageid未找到说明填写有误 //如果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))); resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage)));
continue; continue;
} }
@ -1044,7 +1054,7 @@ public class HrmImportProcessE9 extends BaseBean {
if (!"".equals(Util.null2String(vo.getAssistantid()))) { if (!"".equals(Util.null2String(vo.getAssistantid()))) {
int assistantid; int assistantid;
assistantid = getAssistantid(vo.getAssistantid(), keyField); 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))); resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage)));
continue; continue;
} }
@ -1076,11 +1086,12 @@ public class HrmImportProcessE9 extends BaseBean {
//mobile-sunjsh //mobile-sunjsh
if (vo.getMobile() != null) { if (vo.getMobile() != null) {
if ("".equals(vo.getMobile().trim())) if ("".equals(vo.getMobile().trim())) {
hrm.setMobile(""); hrm.setMobile("");
else if (!"".equals(vo.getMobile().trim()) && vo.getMobile().contains("*")) } else if (!"".equals(vo.getMobile().trim()) && vo.getMobile().contains("*")) {
vo.setMobile(null); vo.setMobile(null);
} }
}
//工资银行-sunjsh //工资银行-sunjsh
if (vo.getBankid1() != null && !"".equals(vo.getBankid1())) { if (vo.getBankid1() != null && !"".equals(vo.getBankid1())) {
@ -1138,14 +1149,14 @@ public class HrmImportProcessE9 extends BaseBean {
// 性别为空或其他情况统一为0(男) // 性别为空或其他情况统一为0(男)
if (!"".equals(Util.null2String(vo.getSex()))) { if (!"".equals(Util.null2String(vo.getSex()))) {
String sex = vo.getSex().equals("女") ? "1" : "0"; String sex = "女".equals(vo.getSex()) ? "1" : "0";
hrm.setSex(sex); hrm.setSex(sex);
} }
// 婚姻状况,如果不是以下选项,则默认为未婚 // 婚姻状况,如果不是以下选项,则默认为未婚
if (!"".equals(Util.null2String(vo.getMaritalstatus()))) { if (!"".equals(Util.null2String(vo.getMaritalstatus()))) {
String maritalstatus = vo.getMaritalstatus().equals("已婚") ? "1" String maritalstatus = "已婚".equals(vo.getMaritalstatus()) ? "1"
: vo.getMaritalstatus().equals("离异") ? "2" : "0"; : "离异".equals(vo.getMaritalstatus()) ? "2" : "0";
hrm.setMaritalstatus(maritalstatus); hrm.setMaritalstatus(maritalstatus);
} }
@ -1170,7 +1181,7 @@ public class HrmImportProcessE9 extends BaseBean {
// 工会会员,默认为是 // 工会会员,默认为是
if (!"".equals(Util.null2String(vo.getIslabouunion()))) { if (!"".equals(Util.null2String(vo.getIslabouunion()))) {
String islabouunion = vo.getIslabouunion().equals("是") ? "1" String islabouunion = "是".equals(vo.getIslabouunion()) ? "1"
: "0"; : "0";
hrm.setIslabouunion(islabouunion); hrm.setIslabouunion(islabouunion);
} }
@ -1192,7 +1203,7 @@ public class HrmImportProcessE9 extends BaseBean {
continue; continue;
} }
//安全级别必须是数字 //安全级别必须是数字
if (!Util.null2String(vo.getSeclevel()).equals("")) { if (!"".equals(Util.null2String(vo.getSeclevel()))) {
if (Util.getIntValue(vo.getSeclevel(), -1000) == -1000) { if (Util.getIntValue(vo.getSeclevel(), -1000) == -1000) {
resultList.add(createLog(vo, "更新", "失败", "安全级别必须是数字")); resultList.add(createLog(vo, "更新", "失败", "安全级别必须是数字"));
continue; continue;
@ -1245,7 +1256,9 @@ public class HrmImportProcessE9 extends BaseBean {
if (!"".equals(Util.null2String(vo.getPassword()))) { if (!"".equals(Util.null2String(vo.getPassword()))) {
String orgPwd = "1"; String orgPwd = "1";
if (!"".equals(vo.getPassword())) orgPwd = vo.getPassword(); if (!"".equals(vo.getPassword())) {
orgPwd = vo.getPassword();
}
String[] pwdArr = PasswordUtil.encrypt(orgPwd); String[] pwdArr = PasswordUtil.encrypt(orgPwd);
String salt = pwdArr[1]; String salt = pwdArr[1];
hrm.setPassword(pwdArr[0]); hrm.setPassword(pwdArr[0]);
@ -1274,19 +1287,19 @@ public class HrmImportProcessE9 extends BaseBean {
voField.setAccessible(true); voField.setAccessible(true);
if (Util.null2String(hrmField.get(hrm)).trim().length() > 0) { 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("',"); 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(","); 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)); tmpstatus = Util.null2String(hrmField.get(hrm));
} }
} else if (Util.null2String(voField.get(vo)).trim().length() > 0) { } else if (Util.null2String(voField.get(vo)).trim().length() > 0) {
if (voFieldType.endsWith("String")) { if (voFieldType.endsWith("String")) {
if (recordSet.getDBType().equalsIgnoreCase("mysql") || recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("mysql".equalsIgnoreCase(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
if (Util.null2String(voField.get(vo)).equals("")) { if ("".equals(Util.null2String(voField.get(vo)))) {
updateStr.append(fields[k]).append("=null,"); updateStr.append(fields[k]).append("=null,");
} else { } else {
updateStr.append(fields[k]).append("='").append(voField.get(vo)).append("',"); 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(","); 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)); 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; flag = false;
}
//同步密码到AD //同步密码到AD
if (flag && !"".equals(Util.null2String(vo.getPassword()))) { if (flag && !"".equals(Util.null2String(vo.getPassword()))) {
@ -1324,7 +1340,7 @@ public class HrmImportProcessE9 extends BaseBean {
String optype = "4"; //1强制修改密码操作。2首次登录密码操作3忘记密码找回。其它系统修改ad操作。 String optype = "4"; //1强制修改密码操作。2首次登录密码操作3忘记密码找回。其它系统修改ad操作。
map.put("optype", optype); map.put("optype", optype);
Map<String, Object> retInfo = new OaSync("", "").modifyADPWDNew(map); 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()); String passwdchgdate = Util.null2String(TimeUtil.getCurrentDateString());
flag = recordSet.executeUpdate("update hrmresource set passwdchgdate=?, haschangepwd='y' where id = ?", passwdchgdate, userid); flag = recordSet.executeUpdate("update hrmresource set passwdchgdate=?, haschangepwd='y' where id = ?", passwdchgdate, userid);
@ -1383,14 +1399,17 @@ public class HrmImportProcessE9 extends BaseBean {
//OA与第三方接口单条数据同步方法结束 //OA与第三方接口单条数据同步方法结束
} }
if (updateBaseData(vo.getBaseFields(), vo.getBaseFieldsValue().trim(), keyMap.get(key))) if (updateBaseData(vo.getBaseFields(), vo.getBaseFieldsValue().trim(), keyMap.get(key))) {
flag = false; flag = false;
}
if (updatePersonData(vo.getPersonFields(), vo.getPersonFieldsValue().trim(), keyMap.get(key))) if (updatePersonData(vo.getPersonFields(), vo.getPersonFieldsValue().trim(), keyMap.get(key))) {
flag = false; flag = false;
}
if (updateWorkData(vo.getWorkFields().trim(), vo.getWorkFieldsValue(), keyMap.get(key))) if (updateWorkData(vo.getWorkFields().trim(), vo.getWorkFieldsValue(), keyMap.get(key))) {
flag = false; flag = false;
}
/*update HrmResource_Trigger */ /*update HrmResource_Trigger */
if (flag) { if (flag) {
@ -1421,8 +1440,9 @@ public class HrmImportProcessE9 extends BaseBean {
String resourceid = recordSet.getString("id"); String resourceid = recordSet.getString("id");
//指定上级为自身的情况,不更新自身上级 //指定上级为自身的情况,不更新自身上级
new BaseBean().writeLog("resourceid【" + resourceid + "】"); new BaseBean().writeLog("resourceid【" + resourceid + "】");
if (hrmId.equals(resourceid)) if (hrmId.equals(resourceid)) {
continue; continue;
}
String nowmanagerstr2 = ""; String nowmanagerstr2 = "";
int index = nowmanagerstr.lastIndexOf(oldmanagerstr); int index = nowmanagerstr.lastIndexOf(oldmanagerstr);
if (index != -1) { if (index != -1) {
@ -1466,7 +1486,7 @@ public class HrmImportProcessE9 extends BaseBean {
if (rst.next()) { if (rst.next()) {
loginid = rst.getString("loginid"); loginid = rst.getString("loginid");
} }
if (loginid != null && !loginid.equals("")) { if (loginid != null && !"".equals(loginid)) {
if (!rtxService.checkUser(Integer.parseInt(hrmId))) { if (!rtxService.checkUser(Integer.parseInt(hrmId))) {
rtxService.addUser(Integer.parseInt(hrmId));//更新人员rtx rtxService.addUser(Integer.parseInt(hrmId));//更新人员rtx
} }
@ -1481,7 +1501,7 @@ public class HrmImportProcessE9 extends BaseBean {
if (rst.next()) { if (rst.next()) {
loginid = rst.getString("loginid"); loginid = rst.getString("loginid");
} }
if (loginid != null && !loginid.equals("")) { if (loginid != null && !"".equals(loginid)) {
if (!rtxService.checkUser(Integer.parseInt(hrmId))) { if (!rtxService.checkUser(Integer.parseInt(hrmId))) {
rtxService.addUser(Integer.parseInt(hrmId));//更新人员rtx rtxService.addUser(Integer.parseInt(hrmId));//更新人员rtx
} }
@ -1536,7 +1556,9 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean addBaseData(String baseFild, String baseValue, int id) { 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[] baseValues = baseValue.split(";");
String[] baseFields = baseFild.split(","); String[] baseFields = baseFild.split(",");
String fielddbType; String fielddbType;
@ -1587,15 +1609,16 @@ public class HrmImportProcessE9 extends BaseBean {
} }
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); 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)); 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")) if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
valueStr.append(",").append("'").append(!fieldvalue.equals("") ? fieldvalue : "").append("'"); valueStr.append(",").append("'").append(!"".equals(fieldvalue) ? fieldvalue : "").append("'");
else } else {
valueStr.append(",").append(!fieldvalue.equals("") ? fieldvalue : "NULL"); valueStr.append(",").append(!"".equals(fieldvalue) ? fieldvalue : "NULL");
}
} }
valueStr = new StringBuilder(valueStr.substring(1)); valueStr = new StringBuilder(valueStr.substring(1));
sql += "(scope,scopeid,id," + baseFild + ") values('HrmCustomFieldByInfoType'," + -1 + "," + id + "," + valueStr + ")"; sql += "(scope,scopeid,id," + baseFild + ") values('HrmCustomFieldByInfoType'," + -1 + "," + id + "," + valueStr + ")";
@ -1616,7 +1639,9 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean updateBaseData(String baseFild, String baseValue, int id) { 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人员的基础自定义信息如果不存在则向数据库添加 //检查cus_fielddata表中是否存在对应id人员的基础自定义信息如果不存在则向数据库添加
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
@ -1676,20 +1701,25 @@ public class HrmImportProcessE9 extends BaseBean {
} }
} }
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); 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)); fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
} }
if (fieldvalue.startsWith(",")) fieldvalue = fieldvalue.substring(1); if (fieldvalue.startsWith(",")) {
if (fieldvalue.endsWith(",")) fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1); fieldvalue = fieldvalue.substring(1);
if (!fieldvalue.equals("") || "field100002".equalsIgnoreCase(fieldname)) { }
if (fieldvalue.endsWith(",")) {
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
}
if (!"".equals(fieldvalue) || "field100002".equalsIgnoreCase(fieldname)) {
flag = true; 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("'"); setStr.append(",").append(baseFields[i]).append("='").append(fieldvalue).append("'");
else } else {
setStr.append(",").append(baseFields[i]).append("=").append(fieldvalue); setStr.append(",").append(baseFields[i]).append("=").append(fieldvalue);
} }
} }
}
sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=-1 and id=" + id; sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=-1 and id=" + id;
} catch (Exception e) { } catch (Exception e) {
writeLog(e); writeLog(e);
@ -1712,7 +1742,9 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean addPersonData(String personFild, String personValue, int id) { 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[] personValues = personValue.split(";");
String[] personFields = personFild.split(","); String[] personFields = personFild.split(",");
String fielddbType; String fielddbType;
@ -1751,14 +1783,15 @@ public class HrmImportProcessE9 extends BaseBean {
jsonObject.put("fieldvalue", personValues[i]); jsonObject.put("fieldvalue", personValues[i]);
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); 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)); 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")) if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
valueStr.append(",").append("'").append(!fieldvalue.equals("") ? fieldvalue : "").append("'"); valueStr.append(",").append("'").append(!"".equals(fieldvalue) ? fieldvalue : "").append("'");
else } else {
valueStr.append(",").append(!fieldvalue.equals("") ? fieldvalue : "NULL"); valueStr.append(",").append(!"".equals(fieldvalue) ? fieldvalue : "NULL");
}
} }
valueStr = new StringBuilder(valueStr.substring(1)); valueStr = new StringBuilder(valueStr.substring(1));
sql += "(scope,scopeid,id," + personFild + ") values('HrmCustomFieldByInfoType'," + 1 + "," + id + "," + valueStr + ")"; sql += "(scope,scopeid,id," + personFild + ") values('HrmCustomFieldByInfoType'," + 1 + "," + id + "," + valueStr + ")";
@ -1779,7 +1812,9 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean updatePersonData(String personFild, String personValue, int id) { 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人员的个人自定义信息如果不存在则向数据库添加 //检查cus_fielddata表中是否存在对应id人员的个人自定义信息如果不存在则向数据库添加
String checkWorkInfo = "select id from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=1 and id=" + id; String checkWorkInfo = "select id from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=1 and id=" + id;
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
@ -1827,20 +1862,25 @@ public class HrmImportProcessE9 extends BaseBean {
jsonObject.put("fieldvalue", personValues[i]); jsonObject.put("fieldvalue", personValues[i]);
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); 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)); fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
} }
if (fieldvalue.startsWith(",")) fieldvalue = fieldvalue.substring(1); if (fieldvalue.startsWith(",")) {
if (fieldvalue.endsWith(",")) fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1); fieldvalue = fieldvalue.substring(1);
if (!fieldvalue.equals("")) { }
if (fieldvalue.endsWith(",")) {
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
}
if (!"".equals(fieldvalue)) {
flag = true; 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("'"); setStr.append(",").append(personFields[i]).append("='").append(fieldvalue).append("'");
else } else {
setStr.append(",").append(personFields[i]).append("=").append(fieldvalue); setStr.append(",").append(personFields[i]).append("=").append(fieldvalue);
} }
} }
}
sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=1 and id=" + id; sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=1 and id=" + id;
} catch (Exception e) { } catch (Exception e) {
writeLog(e); writeLog(e);
@ -1859,7 +1899,7 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean addWorkData(String workField, String workValue, int id) { public boolean addWorkData(String workField, String workValue, int id) {
if (workField == null || workField.equals("")) { if (workField == null || "".equals(workField)) {
return true; return true;
} }
String[] workValues = workValue.split(";"); String[] workValues = workValue.split(";");
@ -1899,14 +1939,15 @@ public class HrmImportProcessE9 extends BaseBean {
jsonObject.put("fieldvalue", workValues[i]); jsonObject.put("fieldvalue", workValues[i]);
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); 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)); 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")) if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
valueStr.append(",").append("'").append(!fieldvalue.equals("") ? fieldvalue : "").append("'"); valueStr.append(",").append("'").append(!"".equals(fieldvalue) ? fieldvalue : "").append("'");
else } else {
valueStr.append(",").append(!fieldvalue.equals("") ? fieldvalue : "NULL"); valueStr.append(",").append(!"".equals(fieldvalue) ? fieldvalue : "NULL");
}
} }
valueStr = new StringBuilder(valueStr.substring(1)); valueStr = new StringBuilder(valueStr.substring(1));
sql += "(scope,scopeid,id," + workField + ") values('HrmCustomFieldByInfoType'," + 3 + "," + id + "," + valueStr + ")"; sql += "(scope,scopeid,id," + workField + ") values('HrmCustomFieldByInfoType'," + 3 + "," + id + "," + valueStr + ")";
@ -1927,7 +1968,9 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean updateWorkData(String workField, String workValue, int id) { 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人员的工作自定义信息如果不存在则向数据库添加 //检查cus_fielddata表中是否存在对应id人员的工作自定义信息如果不存在则向数据库添加
String checkWorkInfo = "select id from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=" + id; String checkWorkInfo = "select id from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=" + id;
@ -1975,20 +2018,25 @@ public class HrmImportProcessE9 extends BaseBean {
jsonObject.put("fieldvalue", workValues[i]); jsonObject.put("fieldvalue", workValues[i]);
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); 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)); fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
} }
if (fieldvalue.startsWith(",")) fieldvalue = fieldvalue.substring(1); if (fieldvalue.startsWith(",")) {
if (fieldvalue.endsWith(",")) fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1); fieldvalue = fieldvalue.substring(1);
if (!fieldvalue.equals("")) { }
if (fieldvalue.endsWith(",")) {
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
}
if (!"".equals(fieldvalue)) {
flag = true; 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("'"); setStr.append(",").append(workFields[i]).append("='").append(fieldvalue).append("'");
else } else {
setStr.append(",").append(workFields[i]).append("=").append(fieldvalue); setStr.append(",").append(workFields[i]).append("=").append(fieldvalue);
} }
} }
}
sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=" + id; sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=" + id;
} catch (Exception e) { } catch (Exception e) {
@ -2022,11 +2070,13 @@ public class HrmImportProcessE9 extends BaseBean {
String supsubcomidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supsubcomid", 0); String supsubcomidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supsubcomid", 0);
for (String companyName : subCompanyNames) { 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 + ")))='" sql = "select id from HrmSubCompany where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(subcompanyname))," + userlanguage + ")))='"
+ companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId; + 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 + ")))='" sql = "select id from HrmSubCompany where ltrim(rtrim(convToMultiLang(ltrim(rtrim(subcompanyname))," + userlanguage + ")))='"
+ companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId; + companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId;
} }
@ -2043,9 +2093,10 @@ public class HrmImportProcessE9 extends BaseBean {
break; break;
} }
parentId = currentId; parentId = currentId;
if (currentId != -1) if (currentId != -1) {
rtxService.addSubCompany(parentId); //同步RTX rtxService.addSubCompany(parentId); //同步RTX
} }
}
return currentId; return currentId;
} }
@ -2072,13 +2123,13 @@ public class HrmImportProcessE9 extends BaseBean {
String supdepidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supdepid", 0); String supdepidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supdepid", 0);
for (String s : deptName) { for (String s : deptName) {
if (s == null || s.equals("")) { if (s == null || "".equals(s)) {
continue; continue;
} }
sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(departmentname))," + userlanguage + ")))='" sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(departmentname))," + userlanguage + ")))='"
+ s.trim() + "' and " + supdepidConditon + "=" + parentId; + 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 + ")))='" sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and ltrim(rtrim(convToMultiLang(ltrim(rtrim(departmentname))," + userlanguage + ")))='"
+ s.trim() + "' and " + supdepidConditon + "=" + parentId; + s.trim() + "' and " + supdepidConditon + "=" + parentId;
} }
@ -2209,10 +2260,10 @@ public class HrmImportProcessE9 extends BaseBean {
String managerstr; String managerstr;
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
Map<String, Comparable> managerInfo = new HashMap<>(); 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 " + keyField + "='" + keyFieldValue + "'";
String selSql = "select id,managerstr from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + 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 + "'"; selSql = "select id,managerstr from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
} }
recordSet.execute(selSql); recordSet.execute(selSql);
@ -2244,10 +2295,10 @@ public class HrmImportProcessE9 extends BaseBean {
int getAssistantid = 0; int getAssistantid = 0;
RecordSet recordSet = new RecordSet(); 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 " + keyField + "='" + keyFieldValue + "'";
String selSql = "select id from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + 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 + "'"; selSql = "select id from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
} }
getAssistantid = getResultSetId(selSql); getAssistantid = getResultSetId(selSql);
@ -2265,10 +2316,10 @@ public class HrmImportProcessE9 extends BaseBean {
public int getBelongId(String keyFieldValue, String keyField) { public int getBelongId(String keyFieldValue, String keyField) {
int getAssistantid = -1; int getAssistantid = -1;
RecordSet recordSet = new RecordSet(); 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 " + keyField + "='" + keyFieldValue + "'";
String selSql = "select id from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + 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 + "'"; selSql = "select id from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
} }
getAssistantid = getResultSetId(selSql); getAssistantid = getResultSetId(selSql);
@ -2284,7 +2335,7 @@ public class HrmImportProcessE9 extends BaseBean {
*/ */
public int getLocationid(String locationname) { public int getLocationid(String locationname) {
int locationid = 0; int locationid = 0;
if (!locationname.equals("")) { if (!"".equals(locationname)) {
locationid = locationMap.getOrDefault(locationname, 0); locationid = locationMap.getOrDefault(locationname, 0);
if (locationid == 0) { if (locationid == 0) {
String insertSql = "insert into HrmLocations(locationname,locationdesc,countryid) values('" + locationname + "','" + locationname + "',1)"; 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) { public int getUseKind(String usekindname) {
int usekindid = 0; int usekindid = 0;
if (!usekindname.equals("")) { if (!"".equals(usekindname)) {
usekindid = usekindMap.getOrDefault(usekindname, 0); usekindid = usekindMap.getOrDefault(usekindname, 0);
if (usekindid == 0) { if (usekindid == 0) {
String insertSql = "insert into HrmUseKind(name,description) values('" + usekindname + "','" + usekindname + "')"; String insertSql = "insert into HrmUseKind(name,description) values('" + usekindname + "','" + usekindname + "')";
@ -2327,7 +2378,7 @@ public class HrmImportProcessE9 extends BaseBean {
public int getJobcall(String jobcall) { public int getJobcall(String jobcall) {
int jobcalld = 0; int jobcalld = 0;
if (!jobcall.equals("")) { if (!"".equals(jobcall)) {
jobcalld = jobcallMap.getOrDefault(jobcall, 0); jobcalld = jobcallMap.getOrDefault(jobcall, 0);
if (jobcalld == 0) { if (jobcalld == 0) {
String insertSql = "insert into HrmJobCall(name) values('" + jobcall + "')"; String insertSql = "insert into HrmJobCall(name) values('" + jobcall + "')";
@ -2354,13 +2405,14 @@ public class HrmImportProcessE9 extends BaseBean {
//return -1; //return -1;
//如果系统不支持多语言则返回0 //如果系统不支持多语言则返回0
if ((language.equals("English") || language.equals("繁體中文")) && !multilanguage.equalsIgnoreCase("y")) if (("English".equals(language) || "繁體中文".equals(language)) && !"y".equalsIgnoreCase(multilanguage)) {
return 0; return 0;
}
if (!language.equals("")) { if (!"".equals(language)) {
if (language.equals("简体中文")) if ("简体中文".equals(language)) {
systemlanguageid = cnLanguageId; systemlanguageid = cnLanguageId;
else { } else {
systemlanguageid = sysLanguage.getOrDefault(language, -1); systemlanguageid = sysLanguage.getOrDefault(language, -1);
} }
} }
@ -2375,7 +2427,7 @@ public class HrmImportProcessE9 extends BaseBean {
*/ */
public int getBankId(String bank1) { public int getBankId(String bank1) {
int id = 0; int id = 0;
if (!bank1.equals("")) { if (!"".equals(bank1)) {
String insertSql = "insert into hrmbank(bankname,bankdesc) values('" + bank1 + "','" + bank1 + "')"; String insertSql = "insert into hrmbank(bankname,bankdesc) values('" + bank1 + "','" + bank1 + "')";
execSql(insertSql); execSql(insertSql);
String selSql = "select id from hrmbank where bankname='" + bank1 + "'"; String selSql = "select id from hrmbank where bankname='" + bank1 + "'";
@ -2454,7 +2506,7 @@ public class HrmImportProcessE9 extends BaseBean {
*/ */
public int getEducationlevel(String educationlevel) { public int getEducationlevel(String educationlevel) {
int educationlevelid = 0; int educationlevelid = 0;
if (!educationlevel.equals("")) { if (!"".equals(educationlevel)) {
educationlevelid = educationlevelMap.getOrDefault(educationlevel, 0); educationlevelid = educationlevelMap.getOrDefault(educationlevel, 0);
if (educationlevelid == 0) { if (educationlevelid == 0) {
String insertSql = "insert into HrmEducationLevel(name,description) values('" + educationlevel + "','" + educationlevel + "')"; String insertSql = "insert into HrmEducationLevel(name,description) values('" + educationlevel + "','" + educationlevel + "')";
@ -2504,7 +2556,7 @@ public class HrmImportProcessE9 extends BaseBean {
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
String sql; String sql;
sql = "select id, accounttype,isADAccount,certificatenum,loginid,workcode, ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from hrmResource"; 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"; sql = "select id, accounttype,isADAccount,certificatenum,loginid,workcode, ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from hrmResource";
} }
recordSet.execute(sql); recordSet.execute(sql);
@ -2585,10 +2637,11 @@ public class HrmImportProcessE9 extends BaseBean {
log.setLastname(vo.getLastname()); //用户名 log.setLastname(vo.getLastname()); //用户名
log.setLoginid(vo.getLoginid()); //登录名 log.setLoginid(vo.getLoginid()); //登录名
log.setOperation(operation); //操作类型 log.setOperation(operation); //操作类型
if (vo.getSubcompanyid1() != null && vo.getDepartmentid() != null) if (vo.getSubcompanyid1() != null && vo.getDepartmentid() != null) {
log.setDepartment(vo.getSubcompanyid1() + ">" + vo.getDepartmentid()); //分部部门 log.setDepartment(vo.getSubcompanyid1() + ">" + vo.getDepartmentid()); //分部部门
else } else {
log.setDepartment(""); log.setDepartment("");
}
log.setStatus(status); //状态,成功、失败 log.setStatus(status); //状态,成功、失败
log.setReason(reason); //原因 log.setReason(reason); //原因
@ -2605,7 +2658,7 @@ public class HrmImportProcessE9 extends BaseBean {
relatedName = log.getLastname(); relatedName = log.getLastname();
break; 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) { } catch (Exception e) {
writeLog(e); writeLog(e);
} }
@ -2614,8 +2667,9 @@ public class HrmImportProcessE9 extends BaseBean {
//整数判断 //整数判断
public static boolean isInteger(String str) { public static boolean isInteger(String str) {
if (str == null) if (str == null) {
return false; return false;
}
Pattern pattern = Pattern.compile("[0-9]+"); Pattern pattern = Pattern.compile("[0-9]+");
return pattern.matcher(str).matches(); return pattern.matcher(str).matches();
} }
@ -2650,7 +2704,7 @@ public class HrmImportProcessE9 extends BaseBean {
} }
if (reosurceid > 0 && val.length() > 0) { 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; return true;
} }
} }

@ -156,4 +156,8 @@ public class SearchTreeUtil {
public static boolean isTop(Long pid) { public static boolean isTop(Long pid) {
return null == 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.ParamUtil;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.organization.entity.DeleteParam; import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.company.param.CompSearchParam; import com.engine.organization.entity.company.param.CompParam;
import com.engine.organization.entity.company.param.CompanyParam;
import com.engine.organization.entity.department.param.DepartmentMoveParam; import com.engine.organization.entity.department.param.DepartmentMoveParam;
import com.engine.organization.util.response.ReturnResult; import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.CompWrapper; import com.engine.organization.wrapper.CompWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.commons.lang.StringUtils;
import weaver.hrm.HrmUserVarify; import weaver.hrm.HrmUserVarify;
import weaver.hrm.User; import weaver.hrm.User;
@ -45,7 +43,7 @@ public class CompController {
@POST @POST
@Path("/listComp") @Path("/listComp")
@Produces(MediaType.APPLICATION_JSON) @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 { try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getCompWrapper(user).listPage(params)); return ReturnResult.successed(getCompWrapper(user).listPage(params));
@ -65,10 +63,10 @@ public class CompController {
@POST @POST
@Path("/saveBaseComp") @Path("/saveBaseComp")
@Produces(MediaType.APPLICATION_JSON) @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 { try {
User user = HrmUserVarify.getUser(request, response); 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) { } catch (Exception e) {
return ReturnResult.exceptionHandle(e); return ReturnResult.exceptionHandle(e);
} }
@ -85,7 +83,7 @@ public class CompController {
@POST @POST
@Path("/updateForbiddenTagById") @Path("/updateForbiddenTagById")
@Produces(MediaType.APPLICATION_JSON) @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 { try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getCompWrapper(user).updateForbiddenTagById(param)); 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) { public ReturnResult deleteByIds(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeleteParam param) {
try { try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
Map<String, Object> params = ParamUtil.request2Map(request); return ReturnResult.successed(getCompWrapper(user).deleteByIds(param.getIds()));
params.put("id", StringUtils.join(param.getIds(), ","));
return ReturnResult.successed(getCompWrapper(user).deleteByIds(params));
} catch (Exception e) { } catch (Exception e) {
return ReturnResult.exceptionHandle(e); return ReturnResult.exceptionHandle(e);
} }
@ -210,8 +206,6 @@ public class CompController {
try { try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
Map<String, Object> params = ParamUtil.request2Map(request); Map<String, Object> params = ParamUtil.request2Map(request);
params.put("addType", "normal");
params.put("viewattr", 2);
return ReturnResult.successed(getCompWrapper(user).getCompSaveForm(params)); return ReturnResult.successed(getCompWrapper(user).getCompSaveForm(params));
} catch (Exception e) { } catch (Exception e) {
return ReturnResult.exceptionHandle(e); return ReturnResult.exceptionHandle(e);

@ -56,7 +56,7 @@ public class DepartmentController {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request); Map<String, Object> map = ParamUtil.request2Map(request);
String parentDept = (String) map.get("parentDept"); 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) { } catch (Exception e) {
return ReturnResult.exceptionHandle(e); return ReturnResult.exceptionHandle(e);
} }
@ -105,15 +105,15 @@ public class DepartmentController {
* *
* @param request * @param request
* @param response * @param response
* @param params
* @return * @return
*/ */
@POST @POST
@Path("/saveBaseForm") @Path("/saveBaseForm")
@Produces(MediaType.APPLICATION_JSON) @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 { try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
Map<String, Object> params = ParamUtil.request2Map(request);
return ReturnResult.successed(getDepartmentWrapper(user).saveBaseForm(params)); return ReturnResult.successed(getDepartmentWrapper(user).saveBaseForm(params));
} catch (Exception e) { } catch (Exception e) {
return ReturnResult.exceptionHandle(e); return ReturnResult.exceptionHandle(e);
@ -253,9 +253,8 @@ public class DepartmentController {
public ReturnResult getSaveForm(@Context HttpServletRequest request, @Context HttpServletResponse response) { public ReturnResult getSaveForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try { try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request); Map<String, Object> params = ParamUtil.request2Map(request);
DeptSearchParam param = JSONObject.toJavaObject((JSON) JSONObject.toJSON(map), DeptSearchParam.class); return ReturnResult.successed(getDepartmentWrapper(user).getSaveForm(params));
return ReturnResult.successed(getDepartmentWrapper(user).getSaveForm(param));
} catch (Exception e) { } catch (Exception e) {
return ReturnResult.exceptionHandle(e); return ReturnResult.exceptionHandle(e);
} }
@ -292,9 +291,7 @@ public class DepartmentController {
public ReturnResult getMergeForm(@Context HttpServletRequest request, @Context HttpServletResponse response) { public ReturnResult getMergeForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try { try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request); return ReturnResult.successed(getDepartmentWrapper(user).getMergeForm());
String id = (String) map.get("id");
return ReturnResult.successed(getDepartmentWrapper(user).getMergeForm(Long.parseLong(id)));
} catch (Exception e) { } catch (Exception e) {
return ReturnResult.exceptionHandle(e); return ReturnResult.exceptionHandle(e);
} }

@ -4,8 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionGroup;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.organization.annotation.Log; import com.engine.organization.annotation.Log;
import com.engine.organization.entity.company.param.CompSearchParam; import com.engine.organization.entity.company.param.CompParam;
import com.engine.organization.entity.company.param.CompanyParam;
import com.engine.organization.entity.company.po.CompPO; import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.param.DepartmentMoveParam; import com.engine.organization.entity.department.param.DepartmentMoveParam;
import com.engine.organization.enums.LogModuleNameEnum; 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.mapper.comp.CompMapper;
import com.engine.organization.service.CompService; import com.engine.organization.service.CompService;
import com.engine.organization.service.impl.CompServiceImpl; import com.engine.organization.service.impl.CompServiceImpl;
import com.engine.organization.thread.CompanyTriggerRunnable;
import com.engine.organization.util.MenuBtn; import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationWrapper; import com.engine.organization.util.OrganizationWrapper;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.lang.StringUtils;
import weaver.hrm.User; import weaver.hrm.User;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -43,7 +43,7 @@ public class CompWrapper extends OrganizationWrapper {
* @param params * @param params
* @return * @return
*/ */
public Map<String, Object> listPage(CompanyParam params) { public Map<String, Object> listPage(CompParam params) {
return getCompService(user).listPage(params); return getCompService(user).listPage(params);
} }
@ -57,10 +57,9 @@ public class CompWrapper extends OrganizationWrapper {
@Log(operateType = OperateTypeEnum.ADD, operateDesc = "新增分部", operateModule = LogModuleNameEnum.COMPANY) @Log(operateType = OperateTypeEnum.ADD, operateDesc = "新增分部", operateModule = LogModuleNameEnum.COMPANY)
public Long saveBaseComp(Map<String, Object> params) { public Long saveBaseComp(Map<String, Object> params) {
Long companyId = getCompService(user).saveBaseComp(params); Long companyId = getCompService(user).saveBaseComp(params);
// TODO writeOperateLog(new Object() {
//writeOperateLog(new Object() { }.getClass(), params.get("subcompanyname").toString(), JSON.toJSONString(params), "新增分部");
//}.getClass(), params.get("comp_name").toString(), JSON.toJSONString(params), "新增分部"); //TODO new Thread(new CompanyTriggerRunnable(companyId)).start();
//new Thread(new CompanyTriggerRunnable(companyId)).start();
return companyId; return companyId;
} }
@ -70,13 +69,13 @@ public class CompWrapper extends OrganizationWrapper {
* @param params * @param params
*/ */
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部禁用标识", operateModule = LogModuleNameEnum.COMPANY) @Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部禁用标识", operateModule = LogModuleNameEnum.COMPANY)
public int updateForbiddenTagById(CompSearchParam params) { public int updateForbiddenTagById(CompParam params) {
CompPO compPO = getCompMapper().listById(params.getId()); CompPO compPO = getCompMapper().listById(params.getId());
int updateForbiddenTagById = getCompService(user).updateForbiddenTagById(params); int updateForbiddenTagById = getCompService(user).updateForbiddenTagById(params);
CompPO newCompPO = getCompMapper().listById(params.getId()); CompPO newCompPO = getCompMapper().listById(params.getId());
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), compPO.getCompName(), JSON.toJSONString(params), compPO, newCompPO); }.getClass(), compPO.getSubCompanyName(), JSON.toJSONString(params), compPO, newCompPO);
new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start(); //TODO new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
return updateForbiddenTagById; return updateForbiddenTagById;
} }
@ -88,31 +87,33 @@ public class CompWrapper extends OrganizationWrapper {
*/ */
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部信息", operateModule = LogModuleNameEnum.COMPANY) @Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部信息", operateModule = LogModuleNameEnum.COMPANY)
public Long updateComp(Map<String, Object> params) { 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); CompPO compPO = getCompMapper().listById(id);
Long companyId = getCompService(user).updateComp(params); Long companyId = getCompService(user).updateComp(params);
CompPO newCompPO = getCompMapper().listById(id); CompPO newCompPO = getCompMapper().listById(id);
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), compPO.getCompName(), JSON.toJSONString(params), compPO, newCompPO); }.getClass(), compPO.getSubCompanyName(), JSON.toJSONString(params), compPO, newCompPO);
new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start(); //TODO new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
return companyId; return companyId;
} }
/** /**
* ID * ID
* *
* @param params * @param ids
*/ */
@Log(operateType = OperateTypeEnum.DELETE, operateDesc = "删除分部信息", operateModule = LogModuleNameEnum.COMPANY) @Log(operateType = OperateTypeEnum.DELETE, operateDesc = "删除分部信息", operateModule = LogModuleNameEnum.COMPANY)
public Map<String, Object> deleteByIds(Map<String, Object> params) { public Map<String, Object> deleteByIds(List<Long> ids) {
//List<CompPO> compsByIds = getCompMapper().getCompsByIds(ids); Map<String, Object> params = new HashMap<>();
return getCompService(user).deleteByIds(params); params.put("id", StringUtils.join(ids, ","));
//for (CompPO compsById : compsByIds) { List<CompPO> compsByIds = getCompMapper().getCompsByIds(ids);
// writeOperateLog(new Object() { Map<String, Object> map = getCompService(user).deleteByIds(params);
// }.getClass(), compsById.getCompName(), JSON.toJSONString(ids), "删除分部信息"); for (CompPO compsById : compsByIds) {
// new CompanyTriggerRunnable(compsById).run(); writeOperateLog(new Object() {
//} }.getClass(), compsById.getSubCompanyName(), JSON.toJSONString(ids), "删除分部信息");
//return deleteByIds; //TODO new CompanyTriggerRunnable(compsById).run();
}
return map;
} }
/** /**
@ -123,12 +124,12 @@ public class CompWrapper extends OrganizationWrapper {
*/ */
@Log(operateType = OperateTypeEnum.MOVE, operateDesc = "转移分部", operateModule = LogModuleNameEnum.COMPANY) @Log(operateType = OperateTypeEnum.MOVE, operateDesc = "转移分部", operateModule = LogModuleNameEnum.COMPANY)
public int moveCompany(DepartmentMoveParam moveParam) { public int moveCompany(DepartmentMoveParam moveParam) {
CompPO compPO = getCompMapper().listById(moveParam.getId()); CompPO compPO = getCompMapper().listById(moveParam.getId().intValue());
int moveCompany = getCompService(user).moveCompany(moveParam); int moveCompany = getCompService(user).moveCompany(moveParam);
CompPO newCompPO = getCompMapper().listById(moveParam.getId()); CompPO newCompPO = getCompMapper().listById(moveParam.getId().intValue());
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), compPO.getCompName(), JSON.toJSONString(moveParam), compPO, newCompPO); }.getClass(), compPO.getSubCompanyName(), JSON.toJSONString(moveParam), compPO, newCompPO);
new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start(); //TODO new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
return moveCompany; return moveCompany;
} }

@ -15,15 +15,16 @@ import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.mapper.department.DepartmentMapper; import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.service.DepartmentService; import com.engine.organization.service.DepartmentService;
import com.engine.organization.service.impl.DepartmentServiceImpl; import com.engine.organization.service.impl.DepartmentServiceImpl;
import com.engine.organization.thread.DepartmentTriggerRunnable;
import com.engine.organization.util.MenuBtn; import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationWrapper; import com.engine.organization.util.OrganizationWrapper;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.PageInfo; import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.response.ReturnResult; import com.engine.organization.util.response.ReturnResult;
import org.apache.commons.lang.StringUtils;
import weaver.hrm.User; import weaver.hrm.User;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -83,8 +84,8 @@ public class DepartmentWrapper extends OrganizationWrapper {
* *
* @return * @return
*/ */
public Map<String, Object> getSaveForm(DeptSearchParam param) { public Map<String, Object> getSaveForm(Map<String, Object> params) {
return getDepartmentService(user).getSaveForm(param); return getDepartmentService(user).getSaveForm(params);
} }
/** /**
@ -97,8 +98,8 @@ public class DepartmentWrapper extends OrganizationWrapper {
public Long saveBaseForm(Map<String, Object> params) { public Long saveBaseForm(Map<String, Object> params) {
Long departmentId = getDepartmentService(user).saveBaseForm(params); Long departmentId = getDepartmentService(user).saveBaseForm(params);
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), params.get("dept_name").toString(), JSON.toJSONString(params), "新增部门"); }.getClass(), params.get("departmentname").toString(), JSON.toJSONString(params), "新增部门");
new Thread(new DepartmentTriggerRunnable(departmentId)).start(); // TODO new Thread(new DepartmentTriggerRunnable(departmentId)).start();
return departmentId; return departmentId;
} }
@ -114,8 +115,8 @@ public class DepartmentWrapper extends OrganizationWrapper {
int updateForbiddenTagById = getDepartmentService(user).updateForbiddenTagById(params); int updateForbiddenTagById = getDepartmentService(user).updateForbiddenTagById(params);
DepartmentPO newDeptById = getDepartmentMapper().getDeptById(params.getId()); DepartmentPO newDeptById = getDepartmentMapper().getDeptById(params.getId());
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), deptById.getDeptName(), JSON.toJSONString(params), deptById, newDeptById); }.getClass(), deptById.getDepartmentName(), JSON.toJSONString(params), deptById, newDeptById);
new Thread(new DepartmentTriggerRunnable(params.getForbiddenTag(),deptById, newDeptById)).start(); // new Thread(new DepartmentTriggerRunnable(params.getForbiddenTag(),deptById, newDeptById)).start();
return updateForbiddenTagById; return updateForbiddenTagById;
} }
@ -127,12 +128,12 @@ public class DepartmentWrapper extends OrganizationWrapper {
*/ */
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新部门", operateModule = LogModuleNameEnum.DEPARTMENT) @Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新部门", operateModule = LogModuleNameEnum.DEPARTMENT)
public Long updateForm(Map<String, Object> params) { 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); DepartmentPO deptById = getDepartmentMapper().getDeptById(id);
Long departmentId = getDepartmentService(user).updateForm(params); Long departmentId = getDepartmentService(user).updateForm(params);
DepartmentPO newDeptById = getDepartmentMapper().getDeptById(id); DepartmentPO newDeptById = getDepartmentMapper().getDeptById(id);
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), deptById.getDeptName(), JSON.toJSONString(params), deptById, newDeptById); }.getClass(), deptById.getDepartmentName(), JSON.toJSONString(params), deptById, newDeptById);
return departmentId; return departmentId;
} }
@ -142,16 +143,18 @@ public class DepartmentWrapper extends OrganizationWrapper {
* @param ids * @param ids
*/ */
@Log(operateType = OperateTypeEnum.DELETE, operateDesc = "删除部门", operateModule = LogModuleNameEnum.DEPARTMENT) @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); List<DepartmentPO> departmentPOS = getDepartmentMapper().getDeptsByIds(ids);
int deleteByIds = getDepartmentService(user).deleteByIds(ids); Map<String, Object> map = getDepartmentService(user).deleteByIds(params);
for (DepartmentPO departmentPO : departmentPOS) { for (DepartmentPO departmentPO : departmentPOS) {
writeOperateLog(new Object() { 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); int copyDepartment = getDepartmentService(user).copyDepartment(copyParam);
for (DepartmentPO departmentPO : departmentPOS) { for (DepartmentPO departmentPO : departmentPOS) {
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), departmentPO.getDeptName(), JSON.toJSONString(copyParam), "复制部门[" + departmentPO.getDeptName() + "]"); }.getClass(), departmentPO.getDepartmentName(), JSON.toJSONString(copyParam), "复制部门[" + departmentPO.getDepartmentName() + "]");
} }
return copyDepartment; return copyDepartment;
} }
@ -212,11 +215,10 @@ public class DepartmentWrapper extends OrganizationWrapper {
/** /**
* *
* *
* @param id
* @return * @return
*/ */
public List<SearchConditionGroup> getMergeForm(Long id) { public List<SearchConditionGroup> getMergeForm() {
return getDepartmentService(user).getMergeForm(id); return getDepartmentService(user).getMergeForm();
} }
/** /**
@ -230,7 +232,7 @@ public class DepartmentWrapper extends OrganizationWrapper {
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(mergeParam.getId()); DepartmentPO departmentPO = getDepartmentMapper().getDeptById(mergeParam.getId());
int mergeDepartment = getDepartmentService(user).mergeDepartment(mergeParam); int mergeDepartment = getDepartmentService(user).mergeDepartment(mergeParam);
writeOperateLog(new Object() { 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; return mergeDepartment;
} }
@ -254,7 +256,7 @@ public class DepartmentWrapper extends OrganizationWrapper {
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(moveParam.getId()); DepartmentPO departmentPO = getDepartmentMapper().getDeptById(moveParam.getId());
int moveDepartment = getDepartmentService(user).moveDepartment(moveParam); int moveDepartment = getDepartmentService(user).moveDepartment(moveParam);
writeOperateLog(new Object() { 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; return moveDepartment;
} }
} }

@ -1,9 +1,6 @@
package com.engine.organization.wrapper; 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.OrganizationWrapper;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
/** /**
@ -18,39 +15,40 @@ public class JclOrgWrapper extends OrganizationWrapper {
if (StringUtils.isAnyBlank(jclId, type)) { if (StringUtils.isAnyBlank(jclId, type)) {
return null; return null;
} }
switch (type) { //switch (type) {
case "1": // case "1":
return EcHrmRelationUtil.getEcCompanyId(jclId); // return EcHrmRelationUtil.getEcCompanyId(jclId);
case "2": // case "2":
return EcHrmRelationUtil.getEcDepartmentId(jclId); // return EcHrmRelationUtil.getEcDepartmentId(jclId);
case "3": // case "3":
default: // default:
return ""; // return "";
} //}
return jclId;
} }
public String getJclOrgId(String ecId, String type) { public String getJclOrgId(String ecId, String type) {
if (StringUtils.isAnyBlank(ecId, type)) { if (StringUtils.isAnyBlank(ecId, type)) {
return null; return null;
} }
String jclOrgId = ""; //String jclOrgId = "";
switch (type) { //switch (type) {
case "1": // case "1":
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(ecId); // CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(ecId);
if (null != jclCompanyId) { // if (null != jclCompanyId) {
jclOrgId = jclCompanyId.getId().toString(); // jclOrgId = jclCompanyId.getId().toString();
} // }
break; // break;
case "2": // case "2":
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(ecId); // DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(ecId);
if (null != jclDepartmentId) { // if (null != jclDepartmentId) {
jclOrgId = jclDepartmentId.getId().toString(); // jclOrgId = jclDepartmentId.getId().toString();
} // }
case "3": // case "3":
default: // default:
break; // break;
} //}
return jclOrgId; return ecId;
} }
public void syncCusFieldData(String id) { public void syncCusFieldData(String id) {

Loading…
Cancel
Save