分部、部门、岗位禁用修复1024
This commit is contained in:
parent
771996f138
commit
65ccecce56
|
|
@ -66,5 +66,9 @@ public interface StaffMapper {
|
|||
|
||||
List<StaffPO> getStaffsByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
StaffPO getStaffsByParamId(@Param("compId") String compId,@Param("deptId") String deptId,@Param("jobId") String jobId);
|
||||
/**
|
||||
* 查询同维度的所有编制方案
|
||||
* @return
|
||||
*/
|
||||
StaffPO getStaffsByParamId(@Param("ftype") Integer ftype,@Param("compId") String compId,@Param("deptId") String deptId,@Param("jobId") String jobId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,18 +337,17 @@
|
|||
</update>
|
||||
|
||||
<select id="getStaffsByParamId" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_staff t
|
||||
WHERE t.delete_type = 0
|
||||
select sum(a.staff_num) as staff_num from jcl_org_staff a
|
||||
inner join jcl_org_staffplan b on a.plan_id = b.id
|
||||
WHERE a.delete_type = 0 and b.control_dimension = #{ftype}
|
||||
<if test="compId != null">
|
||||
and t.comp_id = #{compId}
|
||||
and a.comp_id = #{compId}
|
||||
</if>
|
||||
<if test="deptId != null">
|
||||
and t.dept_id = #{deptId}
|
||||
and a.dept_id = #{deptId}
|
||||
</if>
|
||||
<if test="jobId != null">
|
||||
and t.job_id = #{jobId}
|
||||
and a.job_id = #{jobId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -4,9 +4,11 @@ import com.engine.organization.entity.company.po.CompPO;
|
|||
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.comp.CompMapper;
|
||||
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.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
|
|
@ -94,13 +96,13 @@ public class CompanyTriggerRunnable implements Runnable {
|
|||
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
|
||||
|
||||
StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(jclMap.getFType(),jclMap.getFObjId().toString(),null, null);
|
||||
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, ModuleTypeEnum.subcompanyfielddefined.getValue().toString(), jclMap.getFObjId().toString());
|
||||
if (null != jclOrgMapByObjID) {
|
||||
jclMap.setFPlan(jclOrgMapByObjID.getFPlan());
|
||||
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
|
||||
} else {
|
||||
jclMap.setFPlan(0);
|
||||
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
jclMap.setFOnJob(0);
|
||||
}
|
||||
jclMap.setFIsVitual(0);
|
||||
|
|
@ -112,14 +114,17 @@ public class CompanyTriggerRunnable implements Runnable {
|
|||
getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
|
||||
getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
|
||||
|
||||
|
||||
if (1 != newCompany.getDeleteType() && 1 != newCompany.getForbiddenTag()) {
|
||||
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
||||
if(null != jclOrgMapByObjID.getFParentId()){
|
||||
updateParentPlanAndJob(currentDate,jclOrgMapByObjID.getFParentId().toString());
|
||||
}
|
||||
if (null != jclOrgMapByObjID) {
|
||||
if (null != jclOrgMapByObjID.getFParentId()) {
|
||||
updateParentPlanAndJob(currentDate, jclOrgMapByObjID.getFParentId().toString());
|
||||
}
|
||||
if(null!=oldCompany){
|
||||
updateParentPlanAndJob(currentDate,oldCompany.getId().toString());
|
||||
}
|
||||
if (null != oldCompany) {
|
||||
if(null != oldCompany.getId()){
|
||||
updateParentPlanAndJob(currentDate, oldCompany.getId().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -133,11 +138,12 @@ public class CompanyTriggerRunnable implements Runnable {
|
|||
if (null != parentJclOrgMap) {
|
||||
// 上级部门当前在编、在岗数
|
||||
JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
|
||||
StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(parentJclOrgMap.getFType(),parentId,null, null);
|
||||
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()));
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
|
|
|
|||
|
|
@ -92,17 +92,17 @@ public class JobTriggerRunnable implements Runnable {
|
|||
// 该岗位有下级岗位时,查询
|
||||
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, jclMap.getId().toString());
|
||||
|
||||
StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(jclMap.getFType(),null,null, jclMap.getFObjId().toString());
|
||||
if (null != jclOrgMapByObjID) {
|
||||
if (null != jclOrgMap) {
|
||||
StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(null,null, jclOrgMapByObjID.getFObjId().toString());
|
||||
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);
|
||||
|
|
@ -130,6 +130,8 @@ public class JobTriggerRunnable implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更新上级部门在编、在岗数
|
||||
*/
|
||||
|
|
@ -138,7 +140,7 @@ public class JobTriggerRunnable implements Runnable {
|
|||
if (null != parentJclOrgMap) {
|
||||
// 上级部门当前在编、在岗数
|
||||
JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
|
||||
StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(null,null,parentJclOrgMap.getFObjId().toString());
|
||||
StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(parentJclOrgMap.getFType(),null,null,parentJclOrgMap.getFObjId().toString());
|
||||
if (null != jclOrgMapSum) {
|
||||
parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
|
||||
parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
|
||||
|
|
|
|||
|
|
@ -11,9 +11,11 @@ import com.engine.organization.entity.job.param.JobMergeParam;
|
|||
import com.engine.organization.entity.job.param.JobSearchParam;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.entity.staff.po.StaffPO;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.staff.StaffMapper;
|
||||
import com.engine.organization.service.JobService;
|
||||
import com.engine.organization.service.impl.JobServiceImpl;
|
||||
import com.engine.organization.thread.JobTriggerRunnable;
|
||||
|
|
@ -167,6 +169,7 @@ public class JobWrapper extends OrganizationWrapper {
|
|||
JobPO newJobById = getJobMapper().getJobById(params.getId());
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), jobById.getJobNo(), JSON.toJSONString(params), jobById, newJobById);
|
||||
|
||||
// 更新组织架构图
|
||||
new Thread(new JobTriggerRunnable(jobById, newJobById)).start();
|
||||
return updateForbiddenTagById;
|
||||
|
|
|
|||
Loading…
Reference in New Issue