From b7d7912fffbd4571a670d1c2ae414eb9296a3bda Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Fri, 8 Sep 2023 10:53:46 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=88=B6=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../engine/organization/mapper/staff/StaffMapper.xml | 2 +-
.../service/impl/FunctionOutStaffServiceImpl.java | 12 ++++++++----
.../organization/service/impl/StaffServiceImpl.java | 5 +++++
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/com/engine/organization/mapper/staff/StaffMapper.xml b/src/com/engine/organization/mapper/staff/StaffMapper.xml
index 231efccf..aedb348f 100644
--- a/src/com/engine/organization/mapper/staff/StaffMapper.xml
+++ b/src/com/engine/organization/mapper/staff/StaffMapper.xml
@@ -389,7 +389,7 @@
where t.delete_type = 0
AND t.ec_department IN
- #{departmentId}
+ #{departmentId}
AND t.plan_id IN (SELECT id from jcl_org_staffplan s where s.control_dimension = 2)
diff --git a/src/com/engine/organization/service/impl/FunctionOutStaffServiceImpl.java b/src/com/engine/organization/service/impl/FunctionOutStaffServiceImpl.java
index d78e9fef..a5cd07c5 100644
--- a/src/com/engine/organization/service/impl/FunctionOutStaffServiceImpl.java
+++ b/src/com/engine/organization/service/impl/FunctionOutStaffServiceImpl.java
@@ -164,8 +164,10 @@ public class FunctionOutStaffServiceImpl {
.collect(Collectors.toList());
subCompanys.addAll(sub);
}
-
- List staffPOS = staffMapper().selectByEcCompany(subCompanys);
+ List staffPOS = new ArrayList<>();
+ if (CollectionUtils.isNotEmpty(subCompanys)) {
+ staffPOS = staffMapper().selectByEcCompany(subCompanys);
+ }
if (!CollectionUtils.isEmpty(staffPOS)) {
staffPOS.forEach(item -> {
if (param.getType().getValue() == 3){
@@ -193,8 +195,10 @@ public class FunctionOutStaffServiceImpl {
.collect(Collectors.toList());
subDepartments.addAll(sub);
}
-
- List staffPOS = staffMapper().selectByEcDepartment(subDepartments);
+ List staffPOS = new ArrayList<>();
+ if (CollectionUtils.isNotEmpty(subDepartments)) {
+ staffPOS = staffMapper().selectByEcDepartment(subDepartments);
+ }
if (!CollectionUtils.isEmpty(staffPOS)) {
staffPOS.forEach(item -> {
if (param.getType().getValue() == 3){
diff --git a/src/com/engine/organization/service/impl/StaffServiceImpl.java b/src/com/engine/organization/service/impl/StaffServiceImpl.java
index decbe101..a62e4a49 100644
--- a/src/com/engine/organization/service/impl/StaffServiceImpl.java
+++ b/src/com/engine/organization/service/impl/StaffServiceImpl.java
@@ -56,6 +56,8 @@ public class StaffServiceImpl extends Service implements StaffService {
private static final String RIGHT_NAME = "Staff:All";
+ private static final Integer HARDCONTROLLER = 2;
+
private StaffMapper getStaffMapper() {
return MapperProxyFactory.getProxy(StaffMapper.class);
}
@@ -171,6 +173,9 @@ public class StaffServiceImpl extends Service implements StaffService {
}
OrganizationAssert.isFalse(staffPO.getStaffNum() < 0, "调整后编制数小于0,请更正");
StaffBO.buildStaffDesc(staffPO);
+ if (staffPO.getControlPolicy().equals(HARDCONTROLLER) && staffPO.getStaffNum() < (staffPO.getPermanentNum() + staffPO.getFreezeNum())){
+ throw new OrganizationRunTimeException("存在编制超编风险,请先修改控制策略");
+ }
// 更新主表
int updateStaff = getStaffMapper().updateStaff(staffPO);
// 同步组织架构图编制信息