分部、部门版本控制写入逻辑

pull/90/head^2
Mlin 3 years ago
parent 1bdc7e2fa4
commit 32e8eb4890

@ -44,8 +44,8 @@
insert into hrmdepartment_version insert into hrmdepartment_version
(departmentid, departmentmark, departmentcode, departmentname, subcompanyid1, supdepid, (departmentid, departmentmark, departmentcode, departmentname, subcompanyid1, supdepid,
bmfzr, showorder, canceled, description, operator, version, operate_time) bmfzr, showorder, canceled, description, operator, version, operate_time)
VALUES (#{departmentid}, #{departmentmark}, #{departmentcode}, #{departmentname}, #{subcompanyid1}, #{supdepid}, VALUES (#{departmentId}, #{departmentMark}, #{departmentCode}, #{departmentName}, #{subCompanyId1}, #{supDepId},
#{bmfzr}, #{showorder}, #{canceled}, #{description}, #{operator}, #{version}, #{operateTime}) #{bmfzr}, #{showOrder}, #{canceled}, #{description}, #{operator}, #{version}, #{operateTime})
</insert> </insert>
<select id="getMaxHrmVersion" resultType="com.engine.organization.entity.version.HrmResourceVersion"> <select id="getMaxHrmVersion" resultType="com.engine.organization.entity.version.HrmResourceVersion">

@ -1,17 +1,20 @@
package com.engine.organization.service.impl; package com.engine.organization.service.impl;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
import com.engine.organization.entity.map.JclOrgMap; import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.entity.version.HrmDepartmentVersion; import com.engine.organization.entity.version.HrmDepartmentVersion;
import com.engine.organization.entity.version.HrmResourceVersion; import com.engine.organization.entity.version.HrmResourceVersion;
import com.engine.organization.entity.version.HrmSubCompanyVersion; import com.engine.organization.entity.version.HrmSubCompanyVersion;
import com.engine.organization.enums.ModuleTypeEnum; import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.jclorgmap.JclOrgMapper; import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.mapper.trigger.CompTriggerMapper; import com.engine.organization.mapper.trigger.CompTriggerMapper;
import com.engine.organization.mapper.version.CompanyVersionMapper; import com.engine.organization.mapper.version.CompanyVersionMapper;
import com.engine.organization.service.VersionManageService; import com.engine.organization.service.VersionManageService;
import com.engine.organization.util.OrganizationDateUtil; import com.engine.organization.util.OrganizationDateUtil;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil; import weaver.common.DateUtil;
import weaver.general.Util; import weaver.general.Util;
import weaver.hrm.User; import weaver.hrm.User;
@ -46,6 +49,7 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
break; break;
case 2: case 2:
saveComToVersion(params, user); saveComToVersion(params, user);
saveDeptToMap(params);
break; break;
case 4: case 4:
break; break;
@ -97,7 +101,7 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
/** /**
* map * map
*/ */
void saveDeptToMap(Map<String, Object> params){ void saveDeptToMap(Map<String, Object> params) {
String id = (String) params.get("id"); String id = (String) params.get("id");
int st = 100000000; int st = 100000000;
int sj = 200000000; int sj = 200000000;
@ -110,17 +114,25 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
jclOrgMap.setFObjId(Integer.parseInt(id)); jclOrgMap.setFObjId(Integer.parseInt(id));
jclOrgMap.setFClass(0); jclOrgMap.setFClass(0);
jclOrgMap.setFClassName("行政维度"); jclOrgMap.setFClassName("行政维度");
String bmfzr = (String) params.get("bmfzr");
if (StringUtils.isNotBlank(bmfzr)) {
jclOrgMap.setFLeader(Integer.parseInt(bmfzr));
HrmResourcePO hrmResourcePO = MapperProxyFactory.getProxy(ResourceMapper.class).getResourceById(bmfzr);
jclOrgMap.setFLeaderImg(hrmResourcePO.getResourceImageId());
jclOrgMap.setFLeaderName(hrmResourcePO.getLastName());
jclOrgMap.setFLeaderJobId(Math.toIntExact(hrmResourcePO.getJobTitle()));
}
jclOrgMap.setFName((String) params.get("departmentName")); jclOrgMap.setFName((String) params.get("departmentName"));
jclOrgMap.setFParentId(Integer.parseInt((String) params.get("supSubComId"))); jclOrgMap.setFParentId(Integer.parseInt((String) params.get("subCompanyId1")));
jclOrgMap.setFIsVitual(0);
jclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime())); jclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
jclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2022-12-31").getTime())); jclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2022-12-31").getTime()));
jclOrgMap.setFIsVitual(0);
JclOrgMap jclOrgMapByFParentId = getJclOrgMapMapper().getSumPlanAndJobByFParentId(jclOrgMap.getFDateBegin(), String.valueOf(jclOrgMap.getId())); JclOrgMap jclOrgMapByFParentId = getJclOrgMapMapper().getSumPlanAndJobByFParentId(jclOrgMap.getFDateBegin(), String.valueOf(jclOrgMap.getId()));
if (null != jclOrgMapByFParentId){ if (null != jclOrgMapByFParentId) {
jclOrgMap.setFPlan(jclOrgMapByFParentId.getFPlan()); jclOrgMap.setFPlan(jclOrgMapByFParentId.getFPlan());
jclOrgMap.setFOnJob(jclOrgMapByFParentId.getFOnJob()); jclOrgMap.setFOnJob(jclOrgMapByFParentId.getFOnJob());
}else { } else {
jclOrgMap.setFPlan(0); jclOrgMap.setFPlan(0);
jclOrgMap.setFOnJob(0); jclOrgMap.setFOnJob(0);
} }
@ -153,7 +165,7 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
hrmSubCompanyVersion.setShowOrder(null==showOrder ? null : Integer.parseInt(showOrder)); hrmSubCompanyVersion.setShowOrder(null==showOrder ? null : Integer.parseInt(showOrder));
hrmSubCompanyVersion.setCanceled(Integer.parseInt((String) params.get("canceled"))); hrmSubCompanyVersion.setCanceled(Integer.parseInt((String) params.get("canceled")));
// hrmSubCompanyVersion.setDescription((String) params.get("description")); hrmSubCompanyVersion.setDescription((String) params.get("description"));
hrmSubCompanyVersion.setOperator(user.getUsername()); hrmSubCompanyVersion.setOperator(user.getUsername());
hrmSubCompanyVersion.setVersion(genVersionId(1,id)); hrmSubCompanyVersion.setVersion(genVersionId(1,id));
hrmSubCompanyVersion.setOperateTime(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime())); hrmSubCompanyVersion.setOperateTime(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
@ -174,15 +186,20 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
hrmDepartmentVersion.setDepartmentCode((String) params.get("departmentCode")); hrmDepartmentVersion.setDepartmentCode((String) params.get("departmentCode"));
hrmDepartmentVersion.setDepartmentName((String) params.get("departmentName")); hrmDepartmentVersion.setDepartmentName((String) params.get("departmentName"));
hrmDepartmentVersion.setSubCompanyId1(Integer.parseInt((String) params.get("subCompanyId1"))); hrmDepartmentVersion.setSubCompanyId1(Integer.parseInt((String) params.get("subCompanyId1")));
hrmDepartmentVersion.setSupDepId((int) params.get("supDepId")); hrmDepartmentVersion.setSupDepId(Integer.parseInt((String) params.get("supDepId")));
hrmDepartmentVersion.setBmfzr((int) params.get("bmfzr")); String bmfzr = (String) params.get("bmfzr");
if (!"".equals(bmfzr)){
hrmDepartmentVersion.setBmfzr(Integer.parseInt(bmfzr));
}
String showOrder = (String) params.get("showOrder"); String showOrder = (String) params.get("showOrder");
hrmDepartmentVersion.setShowOrder(null==showOrder ? null : Integer.parseInt(showOrder)); hrmDepartmentVersion.setShowOrder(null==showOrder ? null : Integer.parseInt(showOrder));
hrmDepartmentVersion.setCanceled((int)params.get("canceled")); hrmDepartmentVersion.setCanceled(Integer.parseInt((String) params.get("canceled")));
hrmDepartmentVersion.setDescription((String) params.get("description")); hrmDepartmentVersion.setDescription((String) params.get("description"));
hrmDepartmentVersion.setOperator(user.getLastname()); hrmDepartmentVersion.setOperator(user.getLastname());
hrmDepartmentVersion.setVersion(genVersionId(2,id)); hrmDepartmentVersion.setVersion(genVersionId(2,id));
hrmDepartmentVersion.setOperateTime(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime())); hrmDepartmentVersion.setOperateTime(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
getCompanyVersionMapper().insertHrmDeptVersion(hrmDepartmentVersion);
} }
/** /**

Loading…
Cancel
Save