pull/25/head
dxfeng 3 years ago
commit eeb21315c7

@ -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>

@ -867,7 +867,7 @@ public class JobServiceImpl extends Service implements JobService {
for (HrmResourcePO hrmResourcePO : resourceList) {
new RecordSet().executeUpdate("UPDATE HRMRESOURCE SET SUBCOMPANYID1 = ? , DEPARTMENTID = ? WHERE UUID =? ", ecCompany, ecDepartment, hrmResourcePO.getUuid());
// 更新人员Map表信息
new Thread(new HrmResourceTriggerRunnable(hrmResourcePO.getId())).start();
new HrmResourceTriggerRunnable(hrmResourcePO.getId()).run();
}
}

@ -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(jclMap.getFDateBegin(), 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(jclMap.getFDateBegin(),jclOrgMapByObjID.getFParentId().toString());
}
if (null != jclOrgMapByObjID) {
if (null != jclOrgMapByObjID.getFParentId()) {
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
}
if(null!=oldCompany){
updateParentPlanAndJob(jclMap.getFDateBegin(),oldCompany.getId().toString());
}
if (null != oldCompany) {
if(null != oldCompany.getId()){
updateParentPlanAndJob(jclMap.getFDateBegin(), 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(currentDate);

@ -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;
@ -31,6 +33,7 @@ public class DepartmentTriggerRunnable implements Runnable {
private final DepartmentPO newDepartment;
private String oldFparentId;
private String moveTarget;
private Boolean forbiddenTag = false;
private CompTriggerMapper getCompTriggerMapper() {
return MapperProxyFactory.getProxy(CompTriggerMapper.class);
@ -45,10 +48,17 @@ public class DepartmentTriggerRunnable implements Runnable {
this.newDepartment = newDepartment;
}
public DepartmentTriggerRunnable(Boolean forbiddenTag,DepartmentPO oldDepartment, DepartmentPO newDepartment) {
this.oldDepartment = oldDepartment;
this.newDepartment = newDepartment;
this.forbiddenTag = forbiddenTag;
}
public DepartmentTriggerRunnable(Long departmentId) {
this.oldDepartment = new DepartmentPO();
this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
}
public DepartmentTriggerRunnable(String moveTarget,DepartmentPO newDepartment) {
this.oldDepartment = new DepartmentPO();
this.newDepartment = newDepartment;
@ -116,7 +126,18 @@ public class DepartmentTriggerRunnable implements Runnable {
// 获取当前生效的本部门map记录
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
StaffPO staffPO = new StaffPO();
// 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(jclMap.getFDateBegin(), jclMap.getId().toString());
if (null != moveTarget) {
@ -124,14 +145,14 @@ public class DepartmentTriggerRunnable implements Runnable {
}
if (null != jclOrgMapByObjID) {
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 +166,19 @@ public class DepartmentTriggerRunnable implements Runnable {
if (1 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) {
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
if(null != jclOrgMapByObjID) {
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
}
if(null != moveTarget){
updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget);
}
if (null != oldFparentId) {
updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId);
}
}
if(null != jclOrgMapByObjID) {
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
}
// 部门启用,刷新上级数据
if(forbiddenTag){
updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
}
if(null != moveTarget){
updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget);
}
if (null != oldFparentId) {
updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId);
}
}
}
@ -164,13 +189,22 @@ 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(currentDate);

@ -28,6 +28,7 @@ public class JobTriggerRunnable implements Runnable {
private final JobPO oldJob;
private final JobPO newJob;
private Boolean forbiddenTag = false;
private CompTriggerMapper getCompTriggerMapper() {
return MapperProxyFactory.getProxy(CompTriggerMapper.class);
@ -41,6 +42,11 @@ public class JobTriggerRunnable implements Runnable {
this.oldJob = oldJob;
this.newJob = newJob;
}
public JobTriggerRunnable(Boolean forbiddenTag,JobPO oldJob, JobPO newJob) {
this.oldJob = oldJob;
this.newJob = newJob;
this.forbiddenTag = forbiddenTag;
}
public JobTriggerRunnable(Long jobId) {
this.oldJob = new JobPO();
@ -91,17 +97,29 @@ public class JobTriggerRunnable implements Runnable {
// 该岗位有下级岗位时,查询
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
StaffPO staffPO = new StaffPO();
switch (jclMap.getFType()) {
// 部门
case 2:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2,null, jclMap.getFObjId().toString(), null);
break;
// 岗位
case 3:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(3,null, null, jclMap.getFObjId().toString());
break;
default:
break;
}
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);
@ -115,15 +133,19 @@ public class JobTriggerRunnable implements Runnable {
if (1 != newJob.getDeleteType() && 1 != newJob.getForbiddenTag()) {
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
if (null != jclOrgMapByObjID) {
if(null != jclOrgMapByObjID.getFParentId()){
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
}
}
if (null != jclOrgMapByObjID) {
if(null != jclOrgMapByObjID.getFParentId()){
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
}
if (null != oldJob) {
if (null != oldJob.getId()){
updateParentPlanAndJob(jclMap.getFDateBegin(), oldJob.getId().toString());
}
}
// 部门启用,刷新上级数据
if(forbiddenTag){
updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
}
if (null != oldJob) {
if (null != oldJob.getId()){
updateParentPlanAndJob(jclMap.getFDateBegin(), oldJob.getId().toString());
}
}
}
@ -137,12 +159,28 @@ 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 = new StaffPO();
switch (parentJclOrgMap.getFType()) {
// 分部
case 1:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1, parentJclOrgMap.getFObjId().toString(), null, null);
break;
// 部门
case 2:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, parentJclOrgMap.getFObjId().toString(), null);
break;
// 岗位
case 3:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(3, null, parentJclOrgMap.getFObjId().toString(), null);
break;
default:
break;
}
if (null != jclOrgMapSum) {
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(currentDate);

@ -115,7 +115,7 @@ public class DepartmentWrapper extends OrganizationWrapper {
DepartmentPO newDeptById = getDepartmentMapper().getDeptById(params.getId());
writeOperateLog(new Object() {
}.getClass(), deptById.getDeptName(), JSON.toJSONString(params), deptById, newDeptById);
new Thread(new DepartmentTriggerRunnable(deptById, newDeptById)).start();
new Thread(new DepartmentTriggerRunnable(params.getForbiddenTag(),deptById, newDeptById)).start();
return updateForbiddenTagById;
}

@ -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…
Cancel
Save