岗位名称校验、编制展示优化、BUG修复
This commit is contained in:
parent
92d9a17d8c
commit
02836ce37d
|
|
@ -110,7 +110,7 @@ public class JobBrowserService extends BrowserService {
|
|||
*/
|
||||
private String buildSqlWhere(Map<String, Object> params) {
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
String sqlWhere = " where t.delete_type ='0' ";
|
||||
String sqlWhere = " where t.delete_type ='0' and forbidden_tag ='0' ";
|
||||
String jobNo = Util.null2String(params.get("jobNo"));
|
||||
if (StringUtils.isNotBlank(jobNo)) {
|
||||
sqlWhere += " AND t.job_no " + dbType.like(jobNo);
|
||||
|
|
|
|||
|
|
@ -88,6 +88,16 @@ public interface JobMapper {
|
|||
*/
|
||||
List<JobPO> listByNameExceptId(@Param("jobName") String jobName, @Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 统计同一层级下是否有重名岗位
|
||||
* @param jobName
|
||||
* @param id
|
||||
* @param parentJob
|
||||
* @param ecDepartment
|
||||
* @return
|
||||
*/
|
||||
Integer countRepeatNameByPid(@Param("jobName") String jobName, @Param("id") Long id, @Param("parentJob") Long parentJob, @Param("ecDepartment") Long ecDepartment);
|
||||
|
||||
/**
|
||||
* 根据所属部门查询数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -556,6 +556,18 @@
|
|||
and ec_company = #{ecCompany}
|
||||
and ec_department = #{ecDepartment}
|
||||
</select>
|
||||
<select id="countRepeatNameByPid" resultType="java.lang.Integer">
|
||||
select count(1) from jcl_org_job
|
||||
where delete_type = 0
|
||||
AND job_name = #{jobName}
|
||||
<if test="id != null">
|
||||
AND id != #{id}
|
||||
</if>
|
||||
AND ec_department =#{ecDepartment}
|
||||
<if test="parentJob != null">
|
||||
AND parent_job = #{parentJob}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<sql id="nullparentJob">
|
||||
and ifnull(parent_job,0) =
|
||||
|
|
|
|||
|
|
@ -8,9 +8,13 @@ import org.apache.ibatis.annotations.Param;
|
|||
* @version: 1.0
|
||||
*/
|
||||
public interface StaffTriggerMapper {
|
||||
Integer countCompanyUsers(@Param("ecCompanyId") Long ecCompanyId);
|
||||
Integer countCompanyUsers(@Param("ecCompanyId") String ecCompanyId);
|
||||
|
||||
Integer countDepartmentUsers(@Param("ecDepartmentId") Long ecDepartmentId);
|
||||
Integer countDepartmentUsers(@Param("ecDepartmentId") String ecDepartmentId);
|
||||
|
||||
Integer countJobUsers(@Param("jobTitle") String jobTitle);
|
||||
|
||||
Integer countAllusers();
|
||||
|
||||
Integer countCompanyStaffNum(@Param("currentDate") String currentDate, @Param("companyId") Long companyId);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,14 +25,28 @@
|
|||
where status <= 3
|
||||
and departmentid = #{ecDepartmentId}
|
||||
</select>
|
||||
|
||||
<select id="countJobUsers" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from hrmresource
|
||||
where status <= 3
|
||||
and jobtitle = #{jobTitle}
|
||||
</select>
|
||||
<select id="countAllusers" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from hrmresource
|
||||
where status <= 3
|
||||
</select>
|
||||
<select id="countCompanyStaffNum" resultType="java.lang.Integer">
|
||||
select sum(staff_num)
|
||||
from JCL_ORG_STAFF
|
||||
where plan_id in (select id
|
||||
from JCL_ORG_STAFFPLAN
|
||||
where time_start <= #{currentDate}
|
||||
and time_end >= #{currentDate} and delete_type = 0 )
|
||||
and comp_id = #{companyId} and delete_type = 0
|
||||
and time_end >= #{currentDate}
|
||||
and delete_type = 0)
|
||||
and comp_id = #{companyId}
|
||||
and delete_type = 0
|
||||
</select>
|
||||
<select id="countDepartmentStaffNum" resultType="java.lang.Integer">
|
||||
select sum(staff_num)
|
||||
|
|
@ -40,8 +54,10 @@
|
|||
where plan_id in (select id
|
||||
from JCL_ORG_STAFFPLAN
|
||||
where time_start <= #{currentDate}
|
||||
and time_end >= #{currentDate} and delete_type = 0)
|
||||
and dept_id = #{departmentId} and delete_type = 0
|
||||
and time_end >= #{currentDate}
|
||||
and delete_type = 0)
|
||||
and dept_id = #{departmentId}
|
||||
and delete_type = 0
|
||||
</select>
|
||||
<select id="countJobStaffNum" resultType="java.lang.Integer">
|
||||
select sum(staff_num)
|
||||
|
|
@ -49,7 +65,9 @@
|
|||
where plan_id in (select id
|
||||
from JCL_ORG_STAFFPLAN
|
||||
where time_start <= #{currentDate}
|
||||
and time_end >= #{currentDate} and delete_type = 0)
|
||||
and job_id = #{jobId} and delete_type = 0
|
||||
and time_end >= #{currentDate}
|
||||
and delete_type = 0)
|
||||
and job_id = #{jobId}
|
||||
and delete_type = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -205,7 +205,10 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
// 上级分部
|
||||
String ecCompany = Util.null2String(params.get("ec_company"));
|
||||
if (StringUtils.isNotBlank(ecCompany)) {
|
||||
params.put("parent_company", EcHrmRelationUtil.getJclCompanyId(ecCompany).getId());
|
||||
Long parent_company = Objects.requireNonNull(EcHrmRelationUtil.getJclCompanyId(ecCompany)).getId();
|
||||
// 上级分部不能选择本身
|
||||
OrganizationAssert.isFalse(parent_company.equals(searchParam.getId()), "上级分部不能选择本身");
|
||||
params.put("parent_company", parent_company);
|
||||
}else{
|
||||
params.put("parent_company", "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -291,6 +291,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
if (StringUtils.isNotBlank(ecDepartment)) {
|
||||
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(ecDepartment);
|
||||
if (null != jclDepartmentId) {
|
||||
// 上级部门不能选择本身
|
||||
OrganizationAssert.isFalse(jclDepartmentId.getId().equals(searchParam.getId()), "上级部门不能选择本身");
|
||||
params.put("parent_dept", jclDepartmentId.getId());
|
||||
// 部门不为空,自动指定所属分部
|
||||
params.put("parent_comp", jclDepartmentId.getParentComp());
|
||||
|
|
|
|||
|
|
@ -1157,13 +1157,19 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
map.put("id", infoParams.getId());
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.ADD, map, false).sync();
|
||||
if (isThrowError(syncMap)) {
|
||||
map.remove("id");
|
||||
map.remove("jobactivityid");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams);
|
||||
// 更新组织架构图
|
||||
new Thread(new JobTriggerRunnable(jobId)).start();
|
||||
historyDetailPO.setOperateDetail("添加成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
boolean assertNameRepeat = JobServiceImpl.assertNameRepeat(null, Util.null2String(map.get("ec_department")), Util.null2String(map.get("parent_job")), Util.null2String(map.get("job_name")));
|
||||
if (assertNameRepeat) {
|
||||
map.remove("id");
|
||||
map.remove("jobactivityid");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams);
|
||||
// 更新组织架构图
|
||||
new Thread(new JobTriggerRunnable(jobId)).start();
|
||||
historyDetailPO.setOperateDetail("添加成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail("岗位名称已存在");
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
|
||||
historyDetailPO.setStatus("0");
|
||||
|
|
@ -1183,13 +1189,19 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
map.put("id", jobId);
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, map, MapperProxyFactory.getProxy(JobMapper.class).getJobById(jobId), false).sync();
|
||||
if (isThrowError(syncMap)) {
|
||||
map.remove("id");
|
||||
map.remove("jobactivityid");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(jobId).tableName("JCL_ORG_JOB").params(map).build());
|
||||
// 更新组织架构图
|
||||
new Thread(new JobTriggerRunnable(jobId)).start();
|
||||
historyDetailPO.setOperateDetail("更新成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
boolean assertNameRepeat = JobServiceImpl.assertNameRepeat(null, Util.null2String(map.get("ec_department")), Util.null2String(map.get("parent_job")), Util.null2String(map.get("job_name")));
|
||||
if (assertNameRepeat) {
|
||||
map.remove("id");
|
||||
map.remove("jobactivityid");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(jobId).tableName("JCL_ORG_JOB").params(map).build());
|
||||
// 更新组织架构图
|
||||
new Thread(new JobTriggerRunnable(jobId)).start();
|
||||
historyDetailPO.setOperateDetail("更新成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail("岗位名称已存在");
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
|
||||
historyDetailPO.setStatus("0");
|
||||
|
|
|
|||
|
|
@ -348,12 +348,12 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
@Override
|
||||
public Long saveBaseForm(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
|
||||
assertNameRepeat(null, searchParam.getEcDepartment(), searchParam.getParentJob(), searchParam.getJobName());
|
||||
String jobNo = (String) params.get("job_no");
|
||||
// 判断是否开启自动编号
|
||||
jobNo = repeatDetermine(jobNo);
|
||||
params.put("job_no", jobNo);
|
||||
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
|
||||
|
||||
params.put("is_key", null == searchParam.getIsKey() ? 0 : searchParam.getIsKey());
|
||||
Long ecDepartment = searchParam.getEcDepartment();
|
||||
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecDepartment));
|
||||
|
|
@ -379,8 +379,14 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
public Long updateForm(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
|
||||
assertNameRepeat(searchParam.getId(), searchParam.getEcDepartment(), searchParam.getParentJob(), searchParam.getJobName());
|
||||
String groupId = (String) params.get("viewCondition");
|
||||
searchParam.setIsKey(null == searchParam.getIsKey() ? 0 : searchParam.getIsKey());
|
||||
// 上级岗位不能选择本身
|
||||
String parent_job = Util.null2String(params.get("parent_job"));
|
||||
if (StringUtils.isNotBlank(parent_job)) {
|
||||
OrganizationAssert.isFalse(parent_job.equals(searchParam.getId().toString()), "上级岗位不能选择本身");
|
||||
}
|
||||
if ("0".equals(groupId)) {
|
||||
groupId = GROUP_ID.toString();
|
||||
}
|
||||
|
|
@ -436,6 +442,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 清空上级岗位
|
||||
jobById.setParentJob(null);
|
||||
jobById.setShowOrder(orderNum);
|
||||
assertNameRepeat(null, jobById.getEcDepartment(), jobById.getParentJob(), jobById.getJobName());
|
||||
insertCount += getJobMapper().insertIgnoreNull(jobById);
|
||||
// 更新组织架构图
|
||||
new Thread(new JobTriggerRunnable(jobById.getId())).start();
|
||||
|
|
@ -472,14 +479,14 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
OrganizationWeaTable<EmployeeTableVO> table = new OrganizationWeaTable<>(user, EmployeeTableVO.class);
|
||||
RecordSet rs = new RecordSet();
|
||||
List<String> ids = new ArrayList<>();
|
||||
rs.executeQuery("select id from cus_fielddata where field100002 = ?",jobId);
|
||||
rs.executeQuery("select id from cus_fielddata where field100002 = ?", jobId);
|
||||
while (rs.next()) {
|
||||
ids.add(Util.null2String(rs.getString("id")));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)){
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
ids.add("-1");
|
||||
}
|
||||
table.setSqlwhere(" where id in ("+StringUtils.join(ids,",")+") and status<4");
|
||||
table.setSqlwhere(" where id in (" + StringUtils.join(ids, ",") + ") and status<4");
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
|
|
@ -533,6 +540,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
|
||||
// 待合并的部门
|
||||
JobPO jobById = getJobMapper().getJobById(mergeParam.getId());
|
||||
assertNameRepeat(targetJob.getId(), targetJob.getEcDepartment(), targetJob.getParentJob(), mergeParam.getMergeName());
|
||||
|
||||
// 递归处理子岗位所属分部、所部部门、上级岗位
|
||||
recursionMergeJob(jobs, targetJob.getParentComp(), targetJob.getEcCompany(), targetJob.getParentDept(), targetJob.getEcDepartment(), targetJob.getId());
|
||||
|
|
@ -548,7 +556,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 更新人员组织架构图
|
||||
}
|
||||
// 更新合并后的岗位,更新组织架构图
|
||||
updateEcJob(targetJob,mergeParam.getMergeName());
|
||||
updateEcJob(targetJob, mergeParam.getMergeName());
|
||||
|
||||
targetJob.setJobName(mergeParam.getMergeName());
|
||||
getJobMapper().updateBaseJob(targetJob);
|
||||
|
|
@ -782,9 +790,10 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
|
||||
/**
|
||||
* 更新EC岗位
|
||||
*
|
||||
* @param jobPO
|
||||
*/
|
||||
private void updateEcJob(JobPO jobPO,String newName){
|
||||
private void updateEcJob(JobPO jobPO, String newName) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("job_name", newName);
|
||||
params.put("jobactivityid", JOB_ACTIVITY_ID);
|
||||
|
|
@ -795,4 +804,43 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, params, jobPO).sync();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断相同层级下有无同名岗位
|
||||
*/
|
||||
public static void assertNameRepeat(Long jobId, Long departmentId, Long parentJobId, String jobName) {
|
||||
assertNameRepeat(jobId, departmentId, parentJobId, jobName, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断相同层级下有无同名岗位
|
||||
*/
|
||||
public static boolean assertNameRepeat(String jobId, String departmentId, String parentJobId, String jobName) {
|
||||
return assertNameRepeat(StringUtils.isBlank(jobId) ? null : Long.parseLong(jobId), StringUtils.isBlank(departmentId) ? null : Long.parseLong(departmentId), StringUtils.isBlank(parentJobId) ? null : Long.parseLong(parentJobId), jobName, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断相同层级下有无同名岗位
|
||||
*
|
||||
* @param jobId
|
||||
* @param departmentId
|
||||
* @param parentJobId
|
||||
* @param jobName
|
||||
* @param throwException
|
||||
* @return
|
||||
*/
|
||||
public static boolean assertNameRepeat(Long jobId, Long departmentId, Long parentJobId, String jobName, boolean throwException) {
|
||||
int count = 0;
|
||||
// 有上级岗位、判断相同层级下有无相同名称岗位
|
||||
if (null != jobId) {
|
||||
count = getJobMapper().countRepeatNameByPid(jobName, jobId, parentJobId, departmentId);
|
||||
} else {
|
||||
// 无上级岗位,判断当前部门下,有无同名岗位
|
||||
count = getJobMapper().countRepeatNameByPid(jobName, jobId, null, departmentId);
|
||||
}
|
||||
if (throwException) {
|
||||
OrganizationAssert.isTrue(count == 0, "岗位名称已存在");
|
||||
}
|
||||
return count == 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,20 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.staff.po.StaffPO;
|
||||
import com.engine.organization.entity.staff.po.StaffPlanPO;
|
||||
import com.engine.organization.mapper.staff.StaffMapper;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.staff.StaffPlanMapper;
|
||||
import com.engine.organization.mapper.trigger.StaffTriggerMapper;
|
||||
import com.engine.organization.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.general.Util;
|
||||
|
||||
|
|
@ -18,10 +26,6 @@ import weaver.general.Util;
|
|||
public class StaffTriggerRunnable implements Runnable {
|
||||
StaffPO staffPO;
|
||||
|
||||
private StaffMapper getStaffMapper() {
|
||||
return MapperProxyFactory.getProxy(StaffMapper.class);
|
||||
}
|
||||
|
||||
private StaffPlanMapper getStaffPlanMapper() {
|
||||
return MapperProxyFactory.getProxy(StaffPlanMapper.class);
|
||||
}
|
||||
|
|
@ -30,6 +34,18 @@ public class StaffTriggerRunnable implements Runnable {
|
|||
return MapperProxyFactory.getProxy(StaffTriggerMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
private DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
||||
private JobMapper getJobMapper() {
|
||||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
||||
private final String currentDate;
|
||||
|
||||
public StaffTriggerRunnable(StaffPO staffPO) {
|
||||
|
|
@ -43,37 +59,87 @@ public class StaffTriggerRunnable implements Runnable {
|
|||
StaffPlanPO staffPlanByID = getStaffPlanMapper().getStaffPlanByID(staffPO.getPlanId());
|
||||
if (null != staffPlanByID && StringUtils.isNotBlank(staffPlanByID.getControlDimension())) {
|
||||
String fType = staffPlanByID.getControlDimension();
|
||||
Integer fPlan = 0;
|
||||
int fOnJob = 0;
|
||||
String fObjId = "";
|
||||
switch (fType) {
|
||||
case "1":
|
||||
// 更新分部编制
|
||||
fObjId = Util.null2String(staffPO.getCompId());
|
||||
fOnJob = getStaffTriggerMapper().countCompanyUsers(staffPO.getEcCompany());
|
||||
fPlan = getStaffTriggerMapper().countCompanyStaffNum(currentDate, staffPO.getCompId());
|
||||
refreshCompanyStaff(staffPO.getCompId(), 0);
|
||||
break;
|
||||
case "2":
|
||||
// 更新部门编制
|
||||
fObjId = Util.null2String(staffPO.getDeptId());
|
||||
fOnJob = getStaffTriggerMapper().countDepartmentUsers(staffPO.getEcDepartment());
|
||||
fPlan = getStaffTriggerMapper().countCompanyStaffNum(currentDate, staffPO.getCompId());
|
||||
fPlan += getStaffTriggerMapper().countDepartmentStaffNum(currentDate, staffPO.getDeptId());
|
||||
refreshCompanyStaff(staffPO.getCompId(), 0);
|
||||
refreshDepartmentStaff(staffPO.getDeptId(), 0);
|
||||
break;
|
||||
case "3":
|
||||
// 更新岗位编制
|
||||
fObjId = Util.null2String(staffPO.getJobId());
|
||||
fOnJob = 10;
|
||||
fPlan = getStaffTriggerMapper().countCompanyStaffNum(currentDate, staffPO.getCompId());
|
||||
fPlan += getStaffTriggerMapper().countDepartmentStaffNum(currentDate, staffPO.getDeptId());
|
||||
fPlan += getStaffTriggerMapper().countJobStaffNum(currentDate, staffPO.getJobId());
|
||||
refreshCompanyStaff(staffPO.getCompId(), 0);
|
||||
refreshDepartmentStaff(staffPO.getDeptId(), 0);
|
||||
refreshJobStaff(staffPO.getJobId(), 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// 更新对应的编制数
|
||||
getStaffTriggerMapper().updateOrgStaffs(currentDate, fType, fObjId, fPlan < 0 ? 0 : fPlan, fOnJob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshCompanyStaff(Long companyId, Integer fPlan) {
|
||||
if (null == companyId) {
|
||||
return;
|
||||
}
|
||||
CompPO compPO = getCompMapper().listById(companyId);
|
||||
if (null != compPO) {
|
||||
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(Util.null2String(companyId));
|
||||
String fObjId = Util.null2String(companyId);
|
||||
int fOnJob = getStaffTriggerMapper().countCompanyUsers(ecCompanyId);
|
||||
Integer staffSum = getStaffTriggerMapper().countCompanyStaffNum(currentDate, companyId);
|
||||
fPlan += null == staffSum ? 0 : staffSum;
|
||||
getStaffTriggerMapper().updateOrgStaffs(currentDate, "1", fObjId, fPlan < 0 ? 0 : fPlan, fOnJob);
|
||||
if (null != compPO.getParentCompany() && 0 != compPO.getParentCompany()) {
|
||||
refreshCompanyStaff(compPO.getParentCompany(), fPlan);
|
||||
} else {
|
||||
refreshGroupStaff(fPlan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshDepartmentStaff(Long departmentId, Integer fPlan) {
|
||||
if (null == departmentId) {
|
||||
return;
|
||||
}
|
||||
DepartmentPO deptById = getDepartmentMapper().getDeptById(departmentId);
|
||||
if (null != deptById) {
|
||||
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(Util.null2String(departmentId));
|
||||
String fObjId = Util.null2String(departmentId);
|
||||
int fOnJob = getStaffTriggerMapper().countDepartmentUsers(ecDepartmentId);
|
||||
Integer staffSum = getStaffTriggerMapper().countDepartmentStaffNum(currentDate, departmentId);
|
||||
fPlan += null == staffSum ? 0 : staffSum;
|
||||
getStaffTriggerMapper().updateOrgStaffs(currentDate, "2", fObjId, fPlan < 0 ? 0 : fPlan, fOnJob);
|
||||
if (null != deptById.getParentDept() && 0 != deptById.getParentDept()) {
|
||||
refreshDepartmentStaff(deptById.getParentDept(), fPlan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshJobStaff(Long jobId, Integer fPlan) {
|
||||
if (null == jobId) {
|
||||
return;
|
||||
}
|
||||
JobPO jobById = getJobMapper().getJobById(jobId);
|
||||
if (null != jobById) {
|
||||
String fObjId = Util.null2String(jobId);
|
||||
RecordInfo hrmJobTitleByName = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmJobTitleByName(jobById.getJobName());
|
||||
int fOnJob = getStaffTriggerMapper().countJobUsers(hrmJobTitleByName.getId());
|
||||
Integer staffSum = getStaffTriggerMapper().countJobStaffNum(currentDate, jobId);
|
||||
fPlan += null == staffSum ? 0 : staffSum;
|
||||
getStaffTriggerMapper().updateOrgStaffs(currentDate, "3", fObjId, fPlan < 0 ? 0 : fPlan, fOnJob);
|
||||
//if (null != jobById.getParentJob() && 0 != jobById.getParentJob()) {
|
||||
// refreshJobStaff(jobById.getParentJob(), fPlan);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshGroupStaff(Integer fPlan) {
|
||||
Integer fOnJob = getStaffTriggerMapper().countAllusers();
|
||||
getStaffTriggerMapper().updateOrgStaffs(currentDate, "0", "0", fPlan < 0 ? 0 : fPlan, fOnJob);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,15 +98,21 @@ public class StaffChangeAction implements Action {
|
|||
break;
|
||||
case "4":// 冻结释放,比如面试不通过,offer不接受等
|
||||
if (changeNum > staffPO.getFreezeNum()) {
|
||||
return "冻结释放不能大于冻结数";
|
||||
return "调整不能大于冻结数";
|
||||
}
|
||||
staffPO.setFreezeNum(staffPO.getFreezeNum() - changeNum);
|
||||
break;
|
||||
case "5":// 扣减,比如正式入职,调入等
|
||||
staffPO.setPermanentNum(staffPO.getPermanentNum() + changeNum);
|
||||
if (staffPO.getPermanentNum() > staffPO.getStaffNum()) {
|
||||
return "在编数不能大于编制数";
|
||||
}
|
||||
break;
|
||||
case "6":// 减员释放,比如离职、调出等
|
||||
staffPO.setPermanentNum(staffPO.getPermanentNum() - changeNum);
|
||||
if (staffPO.getPermanentNum() < 0) {
|
||||
return "调整数量不可大于在编数";
|
||||
}
|
||||
break;
|
||||
case "1":// 编制
|
||||
case "2":// 变更
|
||||
|
|
|
|||
Loading…
Reference in New Issue