weaver-hrm-organization/src/com/engine/organization/thread/CompanyTriggerRunnable.java

141 lines
6.9 KiB
Java
Raw Normal View History

2022-08-31 14:24:00 +08:00
package com.engine.organization.thread;
/**
* @author:dxfeng
* @createTime: 2022/08/30
* @version: 1.0
*/
2022-11-28 11:15:54 +08:00
//public class CompanyTriggerRunnable implements Runnable {
//
// private final CompPO oldCompany;
// private final CompPO newCompany;
//
// private CompTriggerMapper getCompTriggerMapper() {
// return MapperProxyFactory.getProxy(CompTriggerMapper.class);
// }
//
// public CompanyTriggerRunnable(CompPO oldCompany, CompPO newCompany) {
// this.oldCompany = oldCompany;
// this.newCompany = newCompany;
// }
//
// public CompanyTriggerRunnable(Long companyId) {
// this.oldCompany = new CompPO();
// this.newCompany = MapperProxyFactory.getProxy(CompMapper.class).listById(companyId);
// }
//
// public CompanyTriggerRunnable(CompPO newCompany) {
// this.oldCompany = new CompPO();
// this.newCompany = newCompany;
// this.newCompany.setDeleteType(1);
// }
//
// @Override
// public void run() {
// // 判断
// JclOrgMap jclMap = new JclOrgMap();
//
// jclMap.setFType(1);
// // 更新逻辑
// jclMap.setFObjId(newCompany.getId().intValue());
// jclMap.setId(newCompany.getId().intValue());
// jclMap.setUuid(newCompany.getUuid());
// jclMap.setFNumber(newCompany.getCompNo());
// jclMap.setFName(newCompany.getCompName());
// jclMap.setFParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
// jclMap.setFObjParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
// jclMap.setFEcId(getCompTriggerMapper().getEcCompanyIdByUuid(jclMap.getUuid()));
//
//
// jclMap.setFClass(0);
// jclMap.setFClassName("行政维度");
//
// Integer ecResourceId = newCompany.getCompPrincipal();
// HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId);
// if (null != hrmResourcePO) {
// jclMap.setFLeader(hrmResourcePO.getId().intValue());
// jclMap.setFLeaderName(hrmResourcePO.getLastName());
// jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
// jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
// jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
// String image = UserCard.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
// jclMap.setFLeaderImg(image);
// if (null != hrmResourcePO.getJobTitle()) {
// JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());
// if (null != jobById) {
// jclMap.setFLeaderJob(jobById.getJobName());
// }
// }
// }
//
//
// String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
// 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(null != staffPO ? staffPO.getStaffNum() : 0);
// jclMap.setFOnJob(0);
// }
// jclMap.setFIsVitual(0);
//
// Calendar cal = Calendar.getInstance();
// cal.setTime(jclMap.getFDateBegin());
// Calendar calendar = DateUtil.addDay(cal, -1);
// Date time = new Date(calendar.getTime().getTime());
// 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) {
// if (null != jclOrgMapByObjID.getFParentId()) {
// updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
// }
// }
// if (null != oldCompany) {
// if (null != oldCompany.getId()) {
// updateParentPlanAndJob(jclMap.getFDateBegin(), oldCompany.getId().toString());
// }
// }
// }
//
// /**
// * 更新上级部门在编、在岗数
// */
// void updateParentPlanAndJob(Date currentDate, String parentId) {
// JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId);
// 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((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
// parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
// } else {
// parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
// parentJclOrgMap.setFOnJob(0);
// }
// parentJclOrgMap.setFDateBegin(currentDate);
// parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
//
// Calendar cal = Calendar.getInstance();
// cal.setTime(parentJclOrgMap.getFDateBegin());
// Calendar calendar = DateUtil.addDay(cal, -1);
// Date time = new Date(calendar.getTime().getTime());
// getCompTriggerMapper().deleteMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin());
// getCompTriggerMapper().updateMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin(), time);
// MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(parentJclOrgMap);
// if (null != parentJclOrgMap.getFParentId() && -1 != parentJclOrgMap.getFParentId()) {
// updateParentPlanAndJob(currentDate, parentJclOrgMap.getFParentId().toString());
// }
// }
// }
//}