|
|
|
@ -4,9 +4,11 @@ import com.engine.organization.entity.department.po.DepartmentPO;
|
|
|
|
|
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
|
|
|
|
import com.engine.organization.entity.logview.bo.FieldBaseEquator;
|
|
|
|
|
import com.engine.organization.entity.map.JclOrgMap;
|
|
|
|
|
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.staff.StaffMapper;
|
|
|
|
|
import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
|
|
|
|
import com.engine.organization.mapper.trigger.DepartmentTriggerMapper;
|
|
|
|
|
import com.engine.organization.util.OrganizationDateUtil;
|
|
|
|
@ -116,6 +118,8 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|
|
|
|
|
|
|
|
|
// 获取当前生效的本部门map记录
|
|
|
|
|
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
|
|
|
|
|
StaffPO staffPO = new StaffPO();
|
|
|
|
|
// StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(null,jclMap.getFObjId().toString(), null);
|
|
|
|
|
|
|
|
|
|
// 取出以该部门为上级部门的在编、在岗数,转移无需计算
|
|
|
|
|
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, jclMap.getId().toString());
|
|
|
|
@ -123,15 +127,25 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|
|
|
|
jclOrgMap = null;
|
|
|
|
|
}
|
|
|
|
|
if (null != jclOrgMapByObjID) {
|
|
|
|
|
switch (jclOrgMapByObjID.getFType()) {
|
|
|
|
|
// 分部
|
|
|
|
|
case 1:
|
|
|
|
|
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,jclMap.getFObjId().toString(), null, null);
|
|
|
|
|
break;
|
|
|
|
|
// 部门
|
|
|
|
|
case 2:
|
|
|
|
|
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2,null, jclMap.getFObjId().toString(), null);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (null != jclOrgMap) {
|
|
|
|
|
jclMap.setFPlan(jclOrgMapByObjID.getFPlan() + jclOrgMap.getFPlan());
|
|
|
|
|
jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
|
|
|
|
|
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob() + jclOrgMap.getFOnJob());
|
|
|
|
|
} else {
|
|
|
|
|
jclMap.setFPlan(jclOrgMapByObjID.getFPlan());
|
|
|
|
|
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
|
|
|
|
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
jclMap.setFPlan(0);
|
|
|
|
|
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
|
|
|
|
jclMap.setFOnJob(0);
|
|
|
|
|
}
|
|
|
|
|
jclMap.setFIsVitual(0);
|
|
|
|
@ -145,15 +159,15 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|
|
|
|
|
|
|
|
|
if (1 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) {
|
|
|
|
|
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
|
|
|
|
if(null != jclOrgMapByObjID) {
|
|
|
|
|
updateParentPlanAndJob(currentDate, jclOrgMapByObjID.getFParentId().toString());
|
|
|
|
|
}
|
|
|
|
|
if(null != moveTarget){
|
|
|
|
|
updateParentPlanAndJob(currentDate, moveTarget);
|
|
|
|
|
}
|
|
|
|
|
if (null != oldFparentId) {
|
|
|
|
|
updateParentPlanAndJob(currentDate, oldFparentId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(null != jclOrgMapByObjID) {
|
|
|
|
|
updateParentPlanAndJob(currentDate, jclOrgMapByObjID.getFParentId().toString());
|
|
|
|
|
}
|
|
|
|
|
if(null != moveTarget){
|
|
|
|
|
updateParentPlanAndJob(currentDate, moveTarget);
|
|
|
|
|
}
|
|
|
|
|
if (null != oldFparentId) {
|
|
|
|
|
updateParentPlanAndJob(currentDate, oldFparentId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -164,13 +178,23 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|
|
|
|
if (null != parentJclOrgMap) {
|
|
|
|
|
// 上级部门当前在编、在岗数
|
|
|
|
|
JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
|
|
|
|
|
|
|
|
|
|
StaffPO staffPO = new StaffPO();
|
|
|
|
|
switch (parentJclOrgMap.getFType()) {
|
|
|
|
|
// 分部
|
|
|
|
|
case 1:
|
|
|
|
|
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,parentId, null, null);
|
|
|
|
|
break;
|
|
|
|
|
// 部门
|
|
|
|
|
case 2:
|
|
|
|
|
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2,null, parentId, null);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// 编制表jcl_org_staff中的编制数+下级编制数,工具类判断
|
|
|
|
|
if(null != jclOrgMapSum){
|
|
|
|
|
parentJclOrgMap.setFPlan(jclOrgMapSum.getFPlan());
|
|
|
|
|
parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0 ) + jclOrgMapSum.getFPlan());
|
|
|
|
|
parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
|
|
|
|
|
}else{
|
|
|
|
|
parentJclOrgMap.setFPlan(0);
|
|
|
|
|
parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
|
|
|
|
parentJclOrgMap.setFOnJob(0);
|
|
|
|
|
}
|
|
|
|
|
parentJclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
|
|
|
|