编制、分部树排序

pull/68/head
dxfeng 3 years ago
parent 197007ceb5
commit 81943df058

@ -89,7 +89,7 @@
<!--<if test="param.jobTitle != null and param.jobTitle != ''">-->
<!--and t.job_title = #{param.jobTitle}-->
<!--</if>-->
order by t.id asc;
order by t.show_order asc
</select>
<select id="getResourceListByJobId"
resultMap="HrmResourceMap">
@ -125,6 +125,7 @@
<foreach collection="companyIds" open="(" item="companyId" separator="," close=")">
#{companyId}
</foreach>
order by t.show_order asc;
</select>
<sql id="likeSql">

@ -530,8 +530,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
// 源部门
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));
// 设置上级分部

@ -12,6 +12,7 @@ import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.browser.po.CustomBrowserBean;
import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.staff.bo.StaffBO;
import com.engine.organization.entity.staff.param.StaffSearchParam;
import com.engine.organization.entity.staff.po.StaffPO;
@ -135,16 +136,9 @@ public class StaffServiceImpl extends Service implements StaffService {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
OrganizationAssert.isFalse(staffPO.getStaffNum() < 0, "编制数不可小于0请更正");
checkRequired(staffPO);
// 赋值
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(Util.null2String(staffPO.getEcCompany()));
if (null != jclCompanyId) {
staffPO.setCompId(jclCompanyId.getId());
}
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(staffPO.getEcDepartment()));
if (null != jclDepartmentId) {
staffPO.setDeptId(jclDepartmentId.getId());
}
int ignoreNull = getStaffMapper().insertIgnoreNull(staffPO);
// 同步组织架构图编制信息
new StaffTriggerRunnable(staffPO).run();
@ -158,16 +152,9 @@ public class StaffServiceImpl extends Service implements StaffService {
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
staffPO.setPermanentNum(staffByID.getPermanentNum());
staffPO.setFreezeNum(staffByID.getFreezeNum());
checkRequired(staffPO);
// 赋值
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(Util.null2String(staffPO.getEcCompany()));
if (null != jclCompanyId) {
staffPO.setCompId(jclCompanyId.getId());
}
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(staffPO.getEcDepartment()));
if (null != jclDepartmentId) {
staffPO.setDeptId(jclDepartmentId.getId());
}
Integer changeNum = param.getChangeNum();
if (null == changeNum) {
// 插入明细表数据
@ -453,15 +440,29 @@ public class StaffServiceImpl extends Service implements StaffService {
switch (staffPlanByID.getControlDimension()) {
case "1":// 分部
OrganizationAssert.notNull(staffPO.getEcCompany(), "编制维度选择分部时,分部必填!");
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(Util.null2String(staffPO.getEcCompany()));
if (null != jclCompanyId) {
staffPO.setCompId(jclCompanyId.getId());
}
break;
case "2":// 部门
OrganizationAssert.notNull(staffPO.getEcCompany(), "编制维度选择部门时,分部必填!");
OrganizationAssert.notNull(staffPO.getEcDepartment(), "编制维度选择部门时,部门必填!");
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(staffPO.getEcDepartment()));
if (null != jclDepartmentId) {
staffPO.setDeptId(jclDepartmentId.getId());
staffPO.setCompId(jclDepartmentId.getParentComp());
staffPO.setEcCompany(jclDepartmentId.getEcCompany());
}
break;
case "3": // 岗位
OrganizationAssert.notNull(staffPO.getEcCompany(), "编制维度选择岗位时,分部必填!");
OrganizationAssert.notNull(staffPO.getEcDepartment(), "编制维度选择岗位时,部门必填!");
OrganizationAssert.notNull(staffPO.getJobId(), "编制维度选择岗位时,岗位必填!");
JobPO jobById = getJobMapper().getJobById(staffPO.getJobId());
if (null != jobById) {
staffPO.setDeptId(jobById.getParentDept());
staffPO.setEcDepartment(jobById.getEcDepartment());
staffPO.setCompId(jobById.getParentComp());
staffPO.setEcCompany(jobById.getEcCompany());
}
break;
default:
break;

@ -35,7 +35,7 @@ public class SearchTreeUtil {
// 排序,设置是否为叶子节点
List<TreeNode> collect = treeList.stream().peek(item ->
item.setIsParent(CollectionUtils.isNotEmpty(item.getSubs()))
).sorted(Comparator.comparing(item -> Integer.parseInt(item.getId()))).collect(Collectors.toList());
).sorted(Comparator.comparing(SearchTree::getOrderNum)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
treeDatas.addAll(collect);
}

Loading…
Cancel
Save