组织架构图编制显示优化

pull/3/head
dxfeng 3 years ago
parent 106d7e8bb8
commit 92d9a17d8c

@ -8,15 +8,15 @@ import org.apache.ibatis.annotations.Param;
* @version: 1.0
*/
public interface StaffTriggerMapper {
int countCompanyUsers(@Param("ecCompanyId") Long ecCompanyId);
Integer countCompanyUsers(@Param("ecCompanyId") Long ecCompanyId);
int countDepartmentUsers(@Param("ecDepartmentId") Long ecDepartmentId);
Integer countDepartmentUsers(@Param("ecDepartmentId") Long ecDepartmentId);
int countCompanyStaffNum(@Param("currentDate") String currentDate, @Param("companyId") Long companyId);
Integer countCompanyStaffNum(@Param("currentDate") String currentDate, @Param("companyId") Long companyId);
int countDepartmentStaffNum(@Param("currentDate") String currentDate, @Param("departmentId") Long departmentId);
Integer countDepartmentStaffNum(@Param("currentDate") String currentDate, @Param("departmentId") Long departmentId);
int countJobStaffNum(@Param("currentDate") String currentDate, @Param("jobId") Long jobId);
Integer countJobStaffNum(@Param("currentDate") String currentDate, @Param("jobId") Long jobId);
int updateOrgStaffs(@Param("currentDate") String currentDate, @Param("fType") String fType, @Param("fObjId") String fObjId, @Param("fPlan") Integer fPlan, @Param("fOnJob") Integer fOnJob);
Integer updateOrgStaffs(@Param("currentDate") String currentDate, @Param("fType") String fType, @Param("fObjId") String fObjId, @Param("fPlan") Integer fPlan, @Param("fOnJob") Integer fOnJob);
}

@ -31,7 +31,7 @@
where plan_id in (select id
from JCL_ORG_STAFFPLAN
where time_start <= #{currentDate}
and time_end >= #{currentDate})
and time_end >= #{currentDate} and delete_type = 0 )
and comp_id = #{companyId} and delete_type = 0
</select>
<select id="countDepartmentStaffNum" resultType="java.lang.Integer">
@ -40,7 +40,7 @@
where plan_id in (select id
from JCL_ORG_STAFFPLAN
where time_start &lt;= #{currentDate}
and time_end &gt;= #{currentDate})
and time_end &gt;= #{currentDate} and delete_type = 0)
and dept_id = #{departmentId} and delete_type = 0
</select>
<select id="countJobStaffNum" resultType="java.lang.Integer">
@ -49,7 +49,7 @@
where plan_id in (select id
from JCL_ORG_STAFFPLAN
where time_start &lt;= #{currentDate}
and time_end &gt;= #{currentDate})
and time_end &gt;= #{currentDate} and delete_type = 0)
and job_id = #{jobId} and delete_type = 0
</select>
</mapper>

@ -262,11 +262,15 @@ public class ExtServiceImpl extends Service implements ExtService {
List<ExtendInfoPO> dtInfoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, "", "");
List<Long> groupIds = dtInfoPOList.stream().map(ExtendInfoPO::getExtendGroupId).distinct().collect(Collectors.toList());
Map<Long, List<ExtendInfoPO>> poMaps = dtInfoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId));
// 删除原有明细表数据
getExtDTMapper().deleteByMainID(tableName, id);
boolean deleteFlag = true;
for (Long groupId : groupIds) {
int rowNum = Util.getIntValue((String) params.get("rownum" + groupId));
if (deleteFlag && rowNum > 0) {
// 删除原有明细表数据
getExtDTMapper().deleteByMainID(tableName, id);
deleteFlag = false;
}
List<ExtendInfoPO> filterS = poMaps.get(groupId);
for (int i = 0; i < rowNum; i++) {
Map<String, Object> map = new HashMap<>();

@ -67,6 +67,7 @@ public class OrganizationSyncEc {
this.user = user;
this.oldJobPO = oldJobPO;
}
public OrganizationSyncEc(User user, LogModuleNameEnum moduleName, OperateTypeEnum operateType, Map<String, Object> params, JobPO oldJobPO, boolean throwException) {
this.moduleName = moduleName;
this.operateType = operateType;
@ -204,7 +205,7 @@ public class OrganizationSyncEc {
// 修改后不存在共用、直接修改EC岗位表数据
if (EcHrmRelationUtil.isNotExistJob(newName, jclJobId)) {
// 查询ec表ID
RecordInfo hrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(oldName);
RecordInfo hrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(newName);
if (null != hrmJobTitle) {
map.put("id", Util.null2String(hrmJobTitle.getId()));
map.put("operateIp", Util.null2String(user.getLoginip()));
@ -235,7 +236,7 @@ public class OrganizationSyncEc {
RecordInfo hrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(newName);
// 查询原分部、原岗位下的人员并更新岗位ID
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIds(oldJobPO.getParentDept(), oldHrmJobTitle.getId());
if(CollectionUtils.isNotEmpty(hrmResourceIds)) {
if (CollectionUtils.isNotEmpty(hrmResourceIds)) {
getSystemDataMapper().updateResourceJobTitleByIds(Util.null2String(hrmJobTitle.getId()), hrmResourceIds);
}
// 封存原名称岗位

@ -30,18 +30,20 @@ public class StaffTriggerRunnable implements Runnable {
return MapperProxyFactory.getProxy(StaffTriggerMapper.class);
}
private final String currentDate;
public StaffTriggerRunnable(StaffPO staffPO) {
this.staffPO = staffPO;
currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
}
@Override
public void run() {
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
if (null != staffPO) {
StaffPlanPO staffPlanByID = getStaffPlanMapper().getStaffPlanByID(staffPO.getPlanId());
if (null != staffPlanByID && StringUtils.isNotBlank(staffPlanByID.getControlDimension())) {
String fType = staffPlanByID.getControlDimension();
int fPlan = 0;
Integer fPlan = 0;
int fOnJob = 0;
String fObjId = "";
switch (fType) {
@ -55,19 +57,22 @@ public class StaffTriggerRunnable implements Runnable {
// 更新部门编制
fObjId = Util.null2String(staffPO.getDeptId());
fOnJob = getStaffTriggerMapper().countDepartmentUsers(staffPO.getEcDepartment());
fPlan = getStaffTriggerMapper().countDepartmentStaffNum(currentDate, staffPO.getDeptId());
fPlan = getStaffTriggerMapper().countCompanyStaffNum(currentDate, staffPO.getCompId());
fPlan += getStaffTriggerMapper().countDepartmentStaffNum(currentDate, staffPO.getDeptId());
break;
case "3":
// 更新岗位编制
fObjId = Util.null2String(staffPO.getJobId());
fOnJob = 10;
fPlan = getStaffTriggerMapper().countJobStaffNum(currentDate, staffPO.getJobId());
fPlan = getStaffTriggerMapper().countCompanyStaffNum(currentDate, staffPO.getCompId());
fPlan += getStaffTriggerMapper().countDepartmentStaffNum(currentDate, staffPO.getDeptId());
fPlan += getStaffTriggerMapper().countJobStaffNum(currentDate, staffPO.getJobId());
break;
default:
break;
}
// 更新对应的编制数
getStaffTriggerMapper().updateOrgStaffs(currentDate, fType, fObjId, fPlan, fOnJob);
getStaffTriggerMapper().updateOrgStaffs(currentDate, fType, fObjId, fPlan < 0 ? 0 : fPlan, fOnJob);
}
}
}

Loading…
Cancel
Save