!235 部门复制

Merge pull request !235 from dxfeng/feature/dxf
pull/236/MERGE
dxfeng 3 years ago committed by Gitee
commit 62e4b33c37
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -9,6 +9,7 @@ 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.crm.Maint.SectorInfoComInfo;
import weaver.general.StringUtil; import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.resource.ResourceComInfo; import weaver.hrm.resource.ResourceComInfo;
import java.util.*; import java.util.*;
@ -36,8 +37,8 @@ public class CompBO {
.parentCompany(e.getParentCompany()) .parentCompany(e.getParentCompany())
.parentCompName(null == poMaps.get(e.getParentCompany()) ? "" : poMaps.get(e.getParentCompany()).getCompName()) .parentCompName(null == poMaps.get(e.getParentCompany()) ? "" : poMaps.get(e.getParentCompany()).getCompName())
.orgCode(e.getOrgCode()) .orgCode(e.getOrgCode())
.industry(new SectorInfoComInfo().getSectorInfoname(e.getIndustry() + "")) .industry(new SectorInfoComInfo().getSectorInfoname(Util.null2String(e.getIndustry())))
.compPrincipal(getUserNameById(e.getCompPrincipal() + "")) .compPrincipal(getUserNameById( Util.null2String(e.getCompPrincipal())))
.showOrder(e.getShowOrder()) .showOrder(e.getShowOrder())
.forbiddenTag(e.getForbiddenTag()) .forbiddenTag(e.getForbiddenTag())
.build()).collect(Collectors.toList()); .build()).collect(Collectors.toList());
@ -53,7 +54,7 @@ public class CompBO {
e.setChildren(childList); e.setChildren(childList);
e.setIsUsed(1); e.setIsUsed(1);
} else { } else {
if (collect.contains(e.getId() + "")) { if (collect.contains(Util.null2String(e.getId()))) {
e.setIsUsed(1); e.setIsUsed(1);
} else { } else {
e.setIsUsed(0); e.setIsUsed(0);

@ -10,6 +10,7 @@ import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.employee.EmployeeMapper; import com.engine.organization.mapper.employee.EmployeeMapper;
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.general.Util;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -50,7 +51,7 @@ public class DepartmentBO {
e.setChildren(childList); e.setChildren(childList);
e.setIsUsed(1); e.setIsUsed(1);
} else { } else {
if (collect.contains(e.getId() + "")) { if (collect.contains(Util.null2String(e.getId()))) {
e.setIsUsed(1); e.setIsUsed(1);
} else { } else {
e.setIsUsed(0); e.setIsUsed(0);

@ -23,4 +23,13 @@ public class DeptCopyParam {
* *
*/ */
private String copyJob; private String copyJob;
/**
*
*/
private String copySubDept;
/**
*
*/
private String copySubJob;
} }

@ -188,7 +188,7 @@ public class ExtendInfoBO {
fieldItem.setLabel(""); fieldItem.setLabel("");
} }
fieldItem.setType(getFieldHtmlType(extendInfoPO.getControlType() + "")); fieldItem.setType(getFieldHtmlType(Util.null2String(extendInfoPO.getControlType())));
fieldItem.setKey(extendInfoPO.getFieldName()); fieldItem.setKey(extendInfoPO.getFieldName());
// 查看操作 全部设置为只读 // 查看操作 全部设置为只读
if (1 == viewAttr) { if (1 == viewAttr) {
@ -320,7 +320,7 @@ public class ExtendInfoBO {
} }
default: default:
if (detailtype.equals("161") || detailtype.equals("162") || detailtype.equals("256") || detailtype.equals("257")) { if (detailtype.equals("161") || detailtype.equals("162") || detailtype.equals("256") || detailtype.equals("257")) {
BrowserBean browserbean = new BrowserBean(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.")) {
@ -435,7 +435,7 @@ public class ExtendInfoBO {
detailtype = "1"; detailtype = "1";
} }
searchConditionItem.setKey(Util.null2String(fieldvalue)); searchConditionItem.setKey(Util.null2String(fieldvalue));
searchConditionItem.setValue(fieldvalue + ""); searchConditionItem.setValue(Util.null2String(fieldvalue));
searchConditionItem.setDetailtype(Util.getIntValue(detailtype, 3)); searchConditionItem.setDetailtype(Util.getIntValue(detailtype, 3));
break; break;
case "6": //附件 case "6": //附件

@ -110,7 +110,7 @@ public class JobBO {
e.setChildren(childList); e.setChildren(childList);
e.setIsUsed(1); e.setIsUsed(1);
} else { } else {
if (collect.contains(e.getId() + "")) { if (collect.contains(Util.null2String(e.getId()))) {
e.setIsUsed(1); e.setIsUsed(1);
} else { } else {
e.setIsUsed(0); e.setIsUsed(0);

@ -3,6 +3,7 @@ package com.engine.organization.entity.staff.bo;
import com.engine.organization.entity.staff.param.StaffSearchParam; import com.engine.organization.entity.staff.param.StaffSearchParam;
import com.engine.organization.entity.staff.po.StaffPO; import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.transmethod.StaffTransMethod; import com.engine.organization.transmethod.StaffTransMethod;
import weaver.general.Util;
import java.util.Date; import java.util.Date;
@ -45,7 +46,7 @@ public class StaffBO {
String sb = "编制数:" + parseNull(staffPO.getStaffNum()) + String sb = "编制数:" + parseNull(staffPO.getStaffNum()) +
",在编数:" + parseNull(staffPO.getPermanentNum()) + ",在编数:" + parseNull(staffPO.getPermanentNum()) +
",冻结数:" + parseNull(staffPO.getFreezeNum()) + ",冻结数:" + parseNull(staffPO.getFreezeNum()) +
",缺编状态:" + StaffTransMethod.getLackSpan(staffPO.getLackStatus() + ""); ",缺编状态:" + StaffTransMethod.getLackSpan(Util.null2String(staffPO.getLackStatus()));
staffPO.setStaffDesc(sb); staffPO.setStaffDesc(sb);
} }

@ -370,7 +370,7 @@ public class CompServiceImpl extends Service implements CompService {
OrganizationAssert.isFalse(disableIds.contains(targetCompanyId), "请勿选择当前分部本身及其子分部"); OrganizationAssert.isFalse(disableIds.contains(targetCompanyId), "请勿选择当前分部本身及其子分部");
CompPO compPO = getCompMapper().listById(companyId); CompPO compPO = getCompMapper().listById(companyId);
compPO.setEcCompany(targetCompanyId); compPO.setEcCompany(targetCompanyId);
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(targetCompanyId + ""); CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(Util.null2String(targetCompanyId));
if (null != jclCompanyId) { if (null != jclCompanyId) {
compPO.setParentCompany(jclCompanyId.getId()); compPO.setParentCompany(jclCompanyId.getId());
} else { } else {

@ -50,6 +50,7 @@ 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.relation.EcHrmRelationUtil;
import com.engine.organization.util.tree.SearchTreeUtil; import com.engine.organization.util.tree.SearchTreeUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
@ -238,7 +239,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
params.put("parent_dept", jclDepartmentId.getId()); params.put("parent_dept", jclDepartmentId.getId());
// 部门不为空,自动指定所属分部 // 部门不为空,自动指定所属分部
params.put("parent_comp", jclDepartmentId.getParentComp()); params.put("parent_comp", jclDepartmentId.getParentComp());
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(jclDepartmentId.getParentComp() + "")); params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartmentId.getParentComp())));
} }
} }
@ -293,7 +294,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
params.put("parent_dept", jclDepartmentId.getId()); params.put("parent_dept", jclDepartmentId.getId());
// 部门不为空,自动指定所属分部 // 部门不为空,自动指定所属分部
params.put("parent_comp", jclDepartmentId.getParentComp()); params.put("parent_comp", jclDepartmentId.getParentComp());
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(jclDepartmentId.getParentComp() + "")); params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartmentId.getParentComp())));
} }
} else { } else {
@ -473,13 +474,16 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
List<SearchConditionItem> condition = new ArrayList<>(); List<SearchConditionItem> condition = new ArrayList<>();
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "复制到", "164", "company", ""); SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "复制到", "164", "company", "");
compBrowserItem.setRules("required|string"); compBrowserItem.setRules("required|string");
List<SearchConditionOption> selectOptions = new ArrayList<>(); SearchConditionItem isCheckItem = OrganizationFormItemUtil.selectItem(user, Lists.newArrayList(new SearchConditionOption("1", "")), 2, 5, 10, false, "是否复制岗位信息", "copyJob");
SearchConditionOption Option = new SearchConditionOption("1", "");
selectOptions.add(Option);
SearchConditionItem isCheckItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 5, 10, false, "是否复制岗位信息", "copyJob");
isCheckItem.setDetailtype(2); isCheckItem.setDetailtype(2);
SearchConditionItem copySubDeptItem = OrganizationFormItemUtil.selectItem(user, Lists.newArrayList(new SearchConditionOption("1", "")), 2, 5, 10, false, "是否复制子部门信息", "copySubDept");
copySubDeptItem.setDetailtype(2);
SearchConditionItem copySubJob = OrganizationFormItemUtil.selectItem(user, Lists.newArrayList(new SearchConditionOption("1", "")), 2, 5, 10, false, "是否复制子部门岗位信息", "copySubJob");
copySubJob.setDetailtype(2);
condition.add(compBrowserItem); condition.add(compBrowserItem);
condition.add(isCheckItem); condition.add(isCheckItem);
condition.add(copySubDeptItem);
condition.add(copySubJob);
addGroups.add(new SearchConditionGroup("", true, condition)); addGroups.add(new SearchConditionGroup("", true, condition));
return addGroups; return addGroups;
} }
@ -492,50 +496,74 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
*/ */
@Override @Override
public int copyDepartment(DeptCopyParam copyParam) { public int copyDepartment(DeptCopyParam copyParam) {
// TODO 是否复制子部门信息,是否复制子部门岗位信息 // 批量复制,后续优化
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
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<Long> idList = Arrays.stream(copyParam.getIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
Integer maxShowOrder = getDepartmentMapper().getMaxShowOrder(); Integer maxShowOrder = getDepartmentMapper().getMaxShowOrder();
maxShowOrder = null == maxShowOrder ? 0 : maxShowOrder; maxShowOrder = null == maxShowOrder ? 0 : maxShowOrder;
for (int i = 0; i < idList.size(); i++) { for (Long departmentId : idList) {
DepartmentPO deptById = getDepartmentMapper().getDeptById(idList.get(i)); // 复制当前部门
long timeMillis = System.currentTimeMillis(); recursionCopyDept(departmentId, null, Long.parseLong(copyParam.getCompany()), maxShowOrder, copyParam.getCopyJob(), copyParam.getCopySubDept(), copyParam.getCopySubJob());
deptById.setDeptName(deptById.getDeptName() + "_" + timeMillis);
deptById.setDeptNameShort(deptById.getDeptNameShort());
// 处理自动编号
deptById.setDeptNo(CodeRuleUtil.generateCode(RuleCodeType.DEPARTMENT, deptById.getDeptNo(), timeMillis));
deptById.setParentComp(EcHrmRelationUtil.getJclCompanyId(copyParam.getCompany()).getId());
deptById.setEcCompany(Long.parseLong(copyParam.getCompany()));
deptById.setParentDept(null);
// 显示顺序字段
deptById.setShowOrder(maxShowOrder + i + 1);
deptById.setCreateTime(new Date());
// 新增EC表部门
Map<String, Object> syncMap = addEcDepartment(deptById);
String ecDepartmentID = Util.null2String(syncMap.get("id"));
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecDepartmentID), syncMap.get("message").toString());
// 查询UUID
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_DEPARTMENT, ecDepartmentID);
deptById.setUuid(recordInfo.getUuid());
insertCount += getDepartmentMapper().insertIgnoreNull(deptById);
// 更新组织架构图
new Thread(new DepartmentTriggerRunnable(deptById.getId())).start();
// 新增岗位信息
if ("1".equals(copyParam.getCopyJob())) {
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listJobsByDepartmentId(idList.get(i));
Integer maxJobOrder = MapperProxyFactory.getProxy(JobMapper.class).getMaxShowOrder();
if (maxJobOrder == null) {
maxJobOrder = 0;
}
recursionCopyJob((long) user.getUID(), jobPOS, deptById.getParentComp(), deptById.getId(), maxJobOrder, timeMillis);
}
} }
return insertCount; return insertCount;
} }
private void recursionCopyDept(Long originalDeptId, Long parentDepartmentId, Long companyId, Integer maxShowOrder, String copyJob, String copySubDept, String copySubJob) {
// 源部门
DepartmentPO deptById = getDepartmentMapper().getDeptById(originalDeptId);
long timeMillis = System.currentTimeMillis();
deptById.setDeptName(deptById.getDeptName() + "_" + timeMillis);
deptById.setDeptNameShort(deptById.getDeptNameShort() + "_" + timeMillis);
// 处理自动编号
deptById.setDeptNo(CodeRuleUtil.generateCode(RuleCodeType.DEPARTMENT, deptById.getDeptNo(), timeMillis));
// 设置上级分部
deptById.setParentComp(EcHrmRelationUtil.getJclCompanyId(Util.null2String(companyId)).getId());
deptById.setEcCompany(companyId);
deptById.setParentDept(parentDepartmentId);
if (null != parentDepartmentId) {
deptById.setEcDepartment(Long.parseLong(EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId))));
}
// 显示顺序字段
deptById.setShowOrder(++maxShowOrder);
deptById.setCreator((long) user.getUID());
deptById.setCreateTime(new Date());
// 新增EC表部门
Map<String, Object> syncMap = addEcDepartment(deptById);
String ecDepartmentID = Util.null2String(syncMap.get("id"));
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecDepartmentID), syncMap.get("message").toString());
// 查询UUID
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_DEPARTMENT, ecDepartmentID);
deptById.setUuid(recordInfo.getUuid());
getDepartmentMapper().insertIgnoreNull(deptById);
// 更新组织架构图
new Thread(new DepartmentTriggerRunnable(deptById.getId())).start();
// 复制当前部门岗位信息
if ("1".equals(copyJob)) {
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listJobsByDepartmentId(originalDeptId);
jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
Integer maxJobOrder = MapperProxyFactory.getProxy(JobMapper.class).getMaxShowOrder();
if (maxJobOrder == null) {
maxJobOrder = 0;
}
recursionCopyJob(jobPOS, companyId, deptById.getId(), null, maxJobOrder, timeMillis);
}
// 是否复制子部门信息
if ("1".equals(copySubDept)) {
// 查询当前部门的子部门
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(originalDeptId);
for (DepartmentPO departmentPO : deptListByPId) {
// 复制子部门信息、子部门岗位信息
recursionCopyDept(departmentPO.getId(), deptById.getId(), companyId, maxShowOrder, copySubJob, copySubDept, copySubJob);
}
}
}
@Override @Override
public List<SearchConditionGroup> getMergeForm(Long id) { public List<SearchConditionGroup> getMergeForm(Long id) {
List<SearchConditionGroup> addGroups = new ArrayList<>(); List<SearchConditionGroup> addGroups = new ArrayList<>();
@ -558,7 +586,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
// 被合并部门 // 被合并部门
Long ecParamDepartment = mergeParam.getDepartment(); Long ecParamDepartment = mergeParam.getDepartment();
DepartmentPO targetDepartment = EcHrmRelationUtil.getJclDepartmentId(ecParamDepartment + ""); DepartmentPO targetDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecParamDepartment));
// 断言判断 // 断言判断
OrganizationAssert.isFalse(null == targetDepartment, "被合并部门数据有误,暂时无法合并"); OrganizationAssert.isFalse(null == targetDepartment, "被合并部门数据有误,暂时无法合并");
@ -591,6 +619,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
} }
// 查询该部门一级岗位、更新岗位所属分部、所属部门 // 查询该部门一级岗位、更新岗位所属分部、所属部门
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());
// 批量更新部门、所属分部 // 批量更新部门、所属分部
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String targetEcDeptId = EcHrmRelationUtil.getEcDepartmentId(targetDepartment.getId().toString()); String targetEcDeptId = EcHrmRelationUtil.getEcDepartmentId(targetDepartment.getId().toString());
@ -668,11 +697,11 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
Long company = moveParam.getCompany(); Long company = moveParam.getCompany();
OrganizationAssert.notNull(company, "请选择要转移到的分部"); OrganizationAssert.notNull(company, "请选择要转移到的分部");
deptById.setEcCompany(company); deptById.setEcCompany(company);
deptById.setParentComp(Objects.requireNonNull(EcHrmRelationUtil.getJclCompanyId(company + "")).getId()); deptById.setParentComp(Objects.requireNonNull(EcHrmRelationUtil.getJclCompanyId(Util.null2String(company))).getId());
deptById.setParentDept(null); deptById.setParentDept(null);
} else if ("1".equals(moveParam.getMoveType())) { } else if ("1".equals(moveParam.getMoveType())) {
Long department = moveParam.getDepartment(); Long department = moveParam.getDepartment();
Long departmentId = Objects.requireNonNull(EcHrmRelationUtil.getJclDepartmentId(department + "")).getId(); 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<Long> disableIds = new HashSet<>();
@ -827,29 +856,42 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
/** /**
* *
* *
* @param creator
* @param jobPOS * @param jobPOS
* @param parentCompId * @param parentCompId
* @param parentDeptId * @param parentDeptId
* @param orderNum * @param orderNum
*/ */
private void recursionCopyJob(Long creator, List<JobPO> jobPOS, Long parentCompId, Long parentDeptId, int orderNum, long timeMillis) { private void recursionCopyJob(List<JobPO> jobPOS, Long parentCompId, Long parentDeptId, Long currentParentJobId, int orderNum, long timeMillis) {
for (JobPO jobPO : jobPOS) { for (JobPO jobPO : jobPOS) {
orderNum++; orderNum++;
// 查询源岗位的下级岗位
List<JobPO> jobsByPid = MapperProxyFactory.getProxy(JobMapper.class).getJobsByPid(jobPO.getId());
// 处理自动编号 // 处理自动编号
jobPO.setJobNo(CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, jobPO.getJobNo(), timeMillis)); jobPO.setJobNo(CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, jobPO.getJobNo(), timeMillis));
jobPO.setParentDept(parentDeptId); jobPO.setEcDepartment(parentDeptId);
jobPO.setCreator(creator); DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(parentDeptId));
if (null != jclDepartmentId) {
jobPO.setParentDept(jclDepartmentId.getId());
}
jobPO.setEcCompany(parentCompId);
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(Util.null2String(parentCompId));
if (null != jclCompanyId) {
jobPO.setParentComp(parentCompId);
}
// 指定上级岗位
jobPO.setParentJob(currentParentJobId);
jobPO.setCreator((long) user.getUID());
jobPO.setCreateTime(new Date()); jobPO.setCreateTime(new Date());
jobPO.setParentComp(parentCompId);
jobPO.setShowOrder(orderNum); jobPO.setShowOrder(orderNum);
MapperProxyFactory.getProxy(JobMapper.class).insertIgnoreNull(jobPO); MapperProxyFactory.getProxy(JobMapper.class).insertIgnoreNull(jobPO);
// 更新组织架构图 // 更新组织架构图
new Thread(new JobTriggerRunnable(jobPO.getId())).start(); new Thread(new JobTriggerRunnable(jobPO.getId())).start();
// 处理子级元素 // 处理子级元素
List<JobPO> jobsByPid = MapperProxyFactory.getProxy(JobMapper.class).getJobsByPid(jobPO.getId());
if (CollectionUtils.isNotEmpty(jobsByPid)) { if (CollectionUtils.isNotEmpty(jobsByPid)) {
recursionCopyJob(creator, jobsByPid, parentCompId, parentDeptId, orderNum, timeMillis); recursionCopyJob(jobsByPid, parentCompId, parentDeptId, jobPO.getId(), orderNum, timeMillis);
} }
} }
} }
@ -919,6 +961,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
*/ */
private void refreshJobComp(Long parentDepartment, Long parentComp) { private void refreshJobComp(Long parentDepartment, Long 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());
if (CollectionUtils.isNotEmpty(jobPOS)) { if (CollectionUtils.isNotEmpty(jobPOS)) {
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(parentComp.toString()); String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(parentComp.toString());
getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, ecCompanyId); getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, ecCompanyId);

@ -144,7 +144,7 @@ public class ExtServiceImpl extends Service implements ExtService {
for (Map.Entry<Long, List<ExtendInfoPO>> entry : groupMap.entrySet()) { for (Map.Entry<Long, List<ExtendInfoPO>> entry : groupMap.entrySet()) {
Map<String, Object> tableMap = new HashMap<>(); Map<String, Object> tableMap = new HashMap<>();
tableMap.put("hide", false); tableMap.put("hide", false);
tableMap.put("tabname", getExtendGroupMapper().getGroupNameById(entry.getKey() + "")); tableMap.put("tabname", getExtendGroupMapper().getGroupNameById(Util.null2String(entry.getKey())));
Map<String, Object> tabinfoMap = new HashMap<>(); Map<String, Object> tabinfoMap = new HashMap<>();
tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, entry.getValue(), viewAttr, showLabel)); tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, entry.getValue(), viewAttr, showLabel));
tabinfoMap.put("rownum", "rownum" + entry.getKey()); tabinfoMap.put("rownum", "rownum" + entry.getKey());

@ -367,9 +367,9 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
recordInfo.put("fieldname", fieldName); recordInfo.put("fieldname", fieldName);
recordInfo.put("fieldType", fieldType); recordInfo.put("fieldType", fieldType);
recordInfo.put("fieldTypeObj", fieldTypeObj); recordInfo.put("fieldTypeObj", fieldTypeObj);
recordInfo.put("enable", extendInfoPO.getIsenable() + ""); recordInfo.put("enable", Util.null2String(extendInfoPO.getIsenable()));
recordInfo.put("required", extendInfoPO.getIsrequired() + ""); recordInfo.put("required", Util.null2String(extendInfoPO.getIsrequired()));
recordInfo.put("isModify", extendInfoPO.getEditShow() + ""); recordInfo.put("isModify", Util.null2String(extendInfoPO.getEditShow()));
recordInfo.put("viewAttr", isUsed || isSysField ? 1 : 2); recordInfo.put("viewAttr", isUsed || isSysField ? 1 : 2);
recordInfo.put("key", "" + showOrder); recordInfo.put("key", "" + showOrder);
recordInfo.put("fieldidrowKey", fieldIdRowKey); recordInfo.put("fieldidrowKey", fieldIdRowKey);

@ -1085,9 +1085,9 @@ 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(parentCompanyId + "")); map.put("ec_company", EcHrmRelationUtil.getEcCompanyId( Util.null2String(parentCompanyId)));
if (null != parentDepartmentId) { if (null != parentDepartmentId) {
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(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];

@ -347,11 +347,11 @@ public class JobServiceImpl extends Service implements JobService {
params.put("is_key", null == searchParam.getIsKey() ? 0 : searchParam.getIsKey()); params.put("is_key", null == searchParam.getIsKey() ? 0 : searchParam.getIsKey());
Long ecDepartment = searchParam.getEcDepartment(); Long ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(ecDepartment + ""); DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecDepartment));
params.put("parent_dept", jclDepartment.getId()); params.put("parent_dept", jclDepartment.getId());
params.put("parent_comp", jclDepartment.getParentComp()); params.put("parent_comp", jclDepartment.getParentComp());
if (null != jclDepartment.getParentComp()) { if (null != jclDepartment.getParentComp()) {
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(jclDepartment.getParentComp() + "")); params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartment.getParentComp())));
} }
if (StringUtils.isBlank(params.get("show_order").toString())) { if (StringUtils.isBlank(params.get("show_order").toString())) {
@ -386,11 +386,11 @@ public class JobServiceImpl extends Service implements JobService {
// 更新主表数据 // 更新主表数据
params.put("is_key", searchParam.getIsKey()); params.put("is_key", searchParam.getIsKey());
Long ecDepartment = searchParam.getEcDepartment(); Long ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(ecDepartment + ""); DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecDepartment));
params.put("parent_dept", jclDepartment.getId()); params.put("parent_dept", jclDepartment.getId());
params.put("parent_comp", jclDepartment.getParentComp()); params.put("parent_comp", jclDepartment.getParentComp());
if (null != jclDepartment.getParentComp()) { if (null != jclDepartment.getParentComp()) {
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(jclDepartment.getParentComp() + "")); params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartment.getParentComp())));
} }
params.put("jobactivityid", JOB_ACTIVITY_ID); params.put("jobactivityid", JOB_ACTIVITY_ID);
new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, params, oldJobPO).sync(); new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, params, oldJobPO).sync();

@ -206,7 +206,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
OrganizationAssert.notNull(staffPlanPO, "选择的数据不存在,或数据已删除"); OrganizationAssert.notNull(staffPlanPO, "选择的数据不存在,或数据已删除");
planNoItem.setValue(staffPlanPO.getPlanNo()); planNoItem.setValue(staffPlanPO.getPlanNo());
planNameItem.setValue(staffPlanPO.getPlanName()); planNameItem.setValue(staffPlanPO.getPlanName());
planYearItem.setValue(staffPlanPO.getPlanYear() + ""); planYearItem.setValue(Util.null2String(staffPlanPO.getPlanYear()));
timeStartItem.setValue(DateUtil.getDate(staffPlanPO.getTimeStart(), "yyyy-MM-dd")); timeStartItem.setValue(DateUtil.getDate(staffPlanPO.getTimeStart(), "yyyy-MM-dd"));
timeEndItem.setValue(DateUtil.getDate(staffPlanPO.getTimeEnd(), "yyyy-MM-dd")); timeEndItem.setValue(DateUtil.getDate(staffPlanPO.getTimeEnd(), "yyyy-MM-dd"));

@ -113,11 +113,11 @@ public class StaffServiceImpl extends Service implements StaffService {
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID()); StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
checkRequired(staffPO); checkRequired(staffPO);
// 赋值 // 赋值
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(staffPO.getEcCompany() + ""); CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(Util.null2String(staffPO.getEcCompany()));
if (null != jclCompanyId) { if (null != jclCompanyId) {
staffPO.setCompId(jclCompanyId.getId()); staffPO.setCompId(jclCompanyId.getId());
} }
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(staffPO.getEcDepartment() + ""); DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(staffPO.getEcDepartment()));
if (null != jclDepartmentId) { if (null != jclDepartmentId) {
staffPO.setDeptId(jclDepartmentId.getId()); staffPO.setDeptId(jclDepartmentId.getId());
} }
@ -264,7 +264,7 @@ public class StaffServiceImpl extends Service implements StaffService {
} }
staffNumItem.setValue(staffPO.getStaffNum()); staffNumItem.setValue(staffPO.getStaffNum());
controlPolicyItem.setValue(staffPO.getControlPolicy() + ""); controlPolicyItem.setValue(Util.null2String(staffPO.getControlPolicy()));
descriptionItem.setValue(staffPO.getDescription()); descriptionItem.setValue(staffPO.getDescription());
} }
selectItems.add(planIdItem); selectItems.add(planIdItem);

Loading…
Cancel
Save