diff --git a/src/com/engine/organization/mapper/resource/ResourceMapper.xml b/src/com/engine/organization/mapper/resource/ResourceMapper.xml
index d6410eba..a212a80e 100644
--- a/src/com/engine/organization/mapper/resource/ResourceMapper.xml
+++ b/src/com/engine/organization/mapper/resource/ResourceMapper.xml
@@ -89,7 +89,7 @@
- order by t.id asc;
+ order by t.show_order asc
diff --git a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java
index 63036f15..f7e8ceaa 100644
--- a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java
+++ b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java
@@ -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));
// 设置上级分部
diff --git a/src/com/engine/organization/service/impl/StaffServiceImpl.java b/src/com/engine/organization/service/impl/StaffServiceImpl.java
index 408ab7e1..11fb24c3 100644
--- a/src/com/engine/organization/service/impl/StaffServiceImpl.java
+++ b/src/com/engine/organization/service/impl/StaffServiceImpl.java
@@ -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;
diff --git a/src/com/engine/organization/util/tree/SearchTreeUtil.java b/src/com/engine/organization/util/tree/SearchTreeUtil.java
index 3bc9891a..7d235349 100644
--- a/src/com/engine/organization/util/tree/SearchTreeUtil.java
+++ b/src/com/engine/organization/util/tree/SearchTreeUtil.java
@@ -35,7 +35,7 @@ public class SearchTreeUtil {
// 排序,设置是否为叶子节点
List 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);
}