|
|
@ -33,6 +33,7 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|
|
|
private final DepartmentPO newDepartment;
|
|
|
|
private final DepartmentPO newDepartment;
|
|
|
|
private String oldFparentId;
|
|
|
|
private String oldFparentId;
|
|
|
|
private String moveTarget;
|
|
|
|
private String moveTarget;
|
|
|
|
|
|
|
|
private Boolean forbiddenTag = false;
|
|
|
|
|
|
|
|
|
|
|
|
private CompTriggerMapper getCompTriggerMapper() {
|
|
|
|
private CompTriggerMapper getCompTriggerMapper() {
|
|
|
|
return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
|
|
|
return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
|
|
@ -47,10 +48,17 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|
|
|
this.newDepartment = newDepartment;
|
|
|
|
this.newDepartment = newDepartment;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DepartmentTriggerRunnable(Boolean forbiddenTag,DepartmentPO oldDepartment, DepartmentPO newDepartment) {
|
|
|
|
|
|
|
|
this.oldDepartment = oldDepartment;
|
|
|
|
|
|
|
|
this.newDepartment = newDepartment;
|
|
|
|
|
|
|
|
this.forbiddenTag = forbiddenTag;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DepartmentTriggerRunnable(Long departmentId) {
|
|
|
|
public DepartmentTriggerRunnable(Long departmentId) {
|
|
|
|
this.oldDepartment = new DepartmentPO();
|
|
|
|
this.oldDepartment = new DepartmentPO();
|
|
|
|
this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
|
|
|
|
this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DepartmentTriggerRunnable(String moveTarget,DepartmentPO newDepartment) {
|
|
|
|
public DepartmentTriggerRunnable(String moveTarget,DepartmentPO newDepartment) {
|
|
|
|
this.oldDepartment = new DepartmentPO();
|
|
|
|
this.oldDepartment = new DepartmentPO();
|
|
|
|
this.newDepartment = newDepartment;
|
|
|
|
this.newDepartment = newDepartment;
|
|
|
@ -117,26 +125,25 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|
|
|
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
|
|
|
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
|
|
|
|
|
|
|
|
|
|
|
// 获取当前生效的本部门map记录
|
|
|
|
// 获取当前生效的本部门map记录
|
|
|
|
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
|
|
|
|
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
|
|
|
|
StaffPO staffPO = new StaffPO();
|
|
|
|
StaffPO staffPO = new StaffPO();
|
|
|
|
// StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(null,jclMap.getFObjId().toString(), null);
|
|
|
|
// StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(null,jclMap.getFObjId().toString(), null);
|
|
|
|
|
|
|
|
switch (jclMap.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;
|
|
|
|
|
|
|
|
}
|
|
|
|
// 取出以该部门为上级部门的在编、在岗数,转移无需计算
|
|
|
|
// 取出以该部门为上级部门的在编、在岗数,转移无需计算
|
|
|
|
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, jclMap.getId().toString());
|
|
|
|
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
|
|
|
|
if (null != moveTarget) {
|
|
|
|
if (null != moveTarget) {
|
|
|
|
jclOrgMap = null;
|
|
|
|
jclOrgMap = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (null != jclOrgMapByObjID) {
|
|
|
|
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) {
|
|
|
|
if (null != jclOrgMap) {
|
|
|
|
jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
|
|
|
|
jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
|
|
|
|
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob() + jclOrgMap.getFOnJob());
|
|
|
|
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob() + jclOrgMap.getFOnJob());
|
|
|
@ -161,18 +168,22 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|
|
|
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
|
|
|
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(null != jclOrgMapByObjID) {
|
|
|
|
if(null != jclOrgMapByObjID) {
|
|
|
|
updateParentPlanAndJob(currentDate, jclOrgMapByObjID.getFParentId().toString());
|
|
|
|
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 部门启用,刷新上级数据
|
|
|
|
|
|
|
|
if(forbiddenTag){
|
|
|
|
|
|
|
|
updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(null != moveTarget){
|
|
|
|
if(null != moveTarget){
|
|
|
|
updateParentPlanAndJob(currentDate, moveTarget);
|
|
|
|
updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (null != oldFparentId) {
|
|
|
|
if (null != oldFparentId) {
|
|
|
|
updateParentPlanAndJob(currentDate, oldFparentId);
|
|
|
|
updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void updateParentPlanAndJob(String currentDate, String parentId) {
|
|
|
|
private void updateParentPlanAndJob(Date currentDate, String parentId) {
|
|
|
|
// 获取上级部门
|
|
|
|
// 获取上级部门
|
|
|
|
JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId);
|
|
|
|
JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId);
|
|
|
|
if (null != parentJclOrgMap) {
|
|
|
|
if (null != parentJclOrgMap) {
|
|
|
@ -180,7 +191,6 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|
|
|
JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
|
|
|
|
JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
|
|
|
|
StaffPO staffPO = new StaffPO();
|
|
|
|
StaffPO staffPO = new StaffPO();
|
|
|
|
switch (parentJclOrgMap.getFType()) {
|
|
|
|
switch (parentJclOrgMap.getFType()) {
|
|
|
|
// 分部
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,parentId, null, null);
|
|
|
|
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,parentId, null, null);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -191,13 +201,13 @@ public class DepartmentTriggerRunnable implements Runnable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 编制表jcl_org_staff中的编制数+下级编制数,工具类判断
|
|
|
|
// 编制表jcl_org_staff中的编制数+下级编制数,工具类判断
|
|
|
|
if(null != jclOrgMapSum){
|
|
|
|
if(null != jclOrgMapSum){
|
|
|
|
parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0 ) + jclOrgMapSum.getFPlan());
|
|
|
|
parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
|
|
|
|
parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
|
|
|
|
parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
|
|
|
parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
|
|
|
parentJclOrgMap.setFOnJob(0);
|
|
|
|
parentJclOrgMap.setFOnJob(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
parentJclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
|
|
|
parentJclOrgMap.setFDateBegin(currentDate);
|
|
|
|
parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
|
|
|
parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
|
|
|
|
|
|
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
|