岗位关联关系调整

pull/89/head
dxfeng 2 years ago
parent b368c3ea27
commit 3470ba04cd

@ -21,11 +21,11 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@OrganizationTable(pageId = "80e7830c-18e8-4e14-8241-18821195ef31", @OrganizationTable(pageId = "80e7830c-18e8-4e14-8241-18821195ef31",
fields = "t.id," + fields = "t.id," +
"t.last_name," + "t.lastname," +
"t.mobile," + "t.mobile," +
"t.company_start_date," + "t.companystartdate," +
"t.sex", "t.sex",
fromSql = "FROM jcl_org_hrmresource t ", fromSql = "FROM hrmresource t ",
orderby = "id", orderby = "id",
primarykey = "id", primarykey = "id",
tableType = WeaTableType.NONE tableType = WeaTableType.NONE
@ -35,7 +35,7 @@ public class EmployeeTableVO {
@OrganizationTableColumn(column = "id", display = false) @OrganizationTableColumn(column = "id", display = false)
private Long id; private Long id;
@OrganizationTableColumn(text = "姓名", width = "25%", column = "last_name") @OrganizationTableColumn(text = "姓名", width = "25%", column = "lastname")
private String lastname; private String lastname;
@OrganizationTableColumn(text = "性别", width = "25%", column = "sex",transmethod = "com.engine.organization.transmethod.JobTransMethod.getSexName") @OrganizationTableColumn(text = "性别", width = "25%", column = "sex",transmethod = "com.engine.organization.transmethod.JobTransMethod.getSexName")
@ -44,7 +44,7 @@ public class EmployeeTableVO {
@OrganizationTableColumn(text = "手机", width = "25%", column = "mobile") @OrganizationTableColumn(text = "手机", width = "25%", column = "mobile")
private String mobile; private String mobile;
@OrganizationTableColumn(text = "入职日期", width = "25%", column = "company_start_date") @OrganizationTableColumn(text = "入职日期", width = "25%", column = "companystartdate")
private String companystartdate; private String companystartdate;

@ -5,11 +5,9 @@ import com.engine.organization.entity.job.param.JobSearchParam;
import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.job.vo.SingleJobTreeVO; import com.engine.organization.entity.job.vo.SingleJobTreeVO;
import com.engine.organization.entity.searchtree.SearchTree; import com.engine.organization.entity.searchtree.SearchTree;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.transmethod.JobTransMethod; import com.engine.organization.transmethod.JobTransMethod;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import weaver.general.Util; import weaver.hrm.job.JobTitlesComInfo;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -30,11 +28,10 @@ public class JobBO {
.builder() .builder()
.id(param.getId() == null ? 0 : param.getId()) .id(param.getId() == null ? 0 : param.getId())
.jobNo(param.getJobNo()) .jobNo(param.getJobNo())
.jobName(param.getJobName()) .jobTitleName(param.getJobTitleName())
.ecJobTitle(param.getEcJobTitle())
.ecCompany(param.getEcCompany()) .ecCompany(param.getEcCompany())
.ecDepartment(param.getEcDepartment()) .ecDepartment(param.getEcDepartment())
.parentComp(param.getSubcompanyid1())
.parentDept(param.getDepartmentid())
.sequenceId(param.getSequenceId()) .sequenceId(param.getSequenceId())
.schemeId(param.getSchemeId()) .schemeId(param.getSchemeId())
.parentJob(param.getParentJob()) .parentJob(param.getParentJob())
@ -64,10 +61,10 @@ public class JobBO {
.builder() .builder()
.id(e.getId()) .id(e.getId())
.jobNo(e.getJobNo()) .jobNo(e.getJobNo())
.jobName(e.getJobName()) .jobName(e.getJobTitleName())
.parentJobName(null == poMaps.get(e.getParentJob()) ? "" : poMaps.get(e.getParentJob()).getJobName()) .parentJobName(null == poMaps.get(e.getParentJob()) ? "" : poMaps.get(e.getParentJob()).getJobTitleName())
.parentJob(e.getParentJob()) .parentJob(e.getParentJob())
.parentDept(e.getParentDept()) .parentDept(e.getEcDepartment())
.build()).collect(Collectors.toList()); .build()).collect(Collectors.toList());
//获取非一级部门 //获取非一级部门
Map<Long, List<SingleJobTreeVO>> collects = singleJobTreeVOS.stream().filter(item -> null != item.getParentJob()).collect(Collectors.groupingBy(SingleJobTreeVO::getParentJob)); Map<Long, List<SingleJobTreeVO>> collects = singleJobTreeVOS.stream().filter(item -> null != item.getParentJob()).collect(Collectors.groupingBy(SingleJobTreeVO::getParentJob));
@ -82,31 +79,23 @@ public class JobBO {
JobListDTO.builder() JobListDTO.builder()
.id(e.getId()) .id(e.getId())
.jobNo(e.getJobNo()) .jobNo(e.getJobNo())
.jobName(e.getJobName()) .jobTitleName(e.getJobTitleName())
.subCompanyName(e.getSubCompanyName()) .subCompanyName(e.getSubCompanyName())
.departmentName(e.getDepartmentName()) .departmentName(e.getDepartmentName())
.sequenceName(e.getSequenceName()) //.sequenceName(e.getSequenceName())
.schemeName(e.getSchemeName()) //.schemeName(e.getSchemeName())
//.parentJob(e.getParentJob()) //.parentJob(e.getParentJob())
//.parentJobName(null == poMaps.get(e.getParentJob()) ? "" : poMaps.get(e.getParentJob()).getJobName()) //.parentJobName(null == poMaps.get(e.getParentJob()) ? "" : poMaps.get(e.getParentJob()).getJobName())
.isKey(JobTransMethod.getIsKeySpan(e.getIsKey())) .isKey(JobTransMethod.getIsKeySpan(e.getIsKey()))
.showOrder(e.getShowOrder()) .showOrder(e.getShowOrder())
.forbiddenTag(e.getForbiddenTag()) //.forbiddenTag(e.getForbiddenTag())
.isUsed(0)
.build()).collect(Collectors.toList()); .build()).collect(Collectors.toList());
Map<Long, List<JobListDTO>> collects = dtoList.stream().filter(item -> null != item.getParentJob() && 0 != item.getParentJob()).collect(Collectors.groupingBy(JobListDTO::getParentJob)); Map<Long, List<JobListDTO>> collects = dtoList.stream().filter(item -> null != item.getParentJob() && 0 != item.getParentJob()).collect(Collectors.groupingBy(JobListDTO::getParentJob));
// 处理被引用数据
List<String> usedIds = MapperProxyFactory.getProxy(JobMapper.class).listUsedId();
return dtoList.stream().peek(e -> { return dtoList.stream().peek(e -> {
List<JobListDTO> childList = collects.get(e.getId()); List<JobListDTO> childList = collects.get(e.getId());
if (CollectionUtils.isNotEmpty(childList)) { if (CollectionUtils.isNotEmpty(childList)) {
e.setChildren(childList); e.setChildren(childList);
e.setIsUsed(1);
} else {
if (usedIds.contains(Util.null2String(e.getId()))) {
e.setIsUsed(1);
} else {
e.setIsUsed(0);
}
} }
}).filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList()); }).filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
} }
@ -154,14 +143,18 @@ public class JobBO {
tree.setId(item.getId().toString()); tree.setId(item.getId().toString());
tree.setIsParent(false); tree.setIsParent(false);
tree.setIsVirtual("0"); tree.setIsVirtual("0");
tree.setName(item.getJobName()); tree.setName(item.getJobTitleName());
tree.setPid(null == item.getParentJob() ? "0" : item.getParentJob().toString()); tree.setPid(null == item.getParentJob() ? "0" : item.getParentJob().toString());
tree.setSelected(false); tree.setSelected(false);
tree.setType("3"); tree.setType("3");
tree.setParentComp(null == item.getParentDept() ? "0" : item.getParentDept().toString()); tree.setParentComp(null == item.getEcDepartment() ? "0" : item.getEcDepartment().toString());
tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder()); tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder());
return tree; return tree;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
public static String getJobTitleNameByEcJobTitle(String ecJobTitle) {
return new JobTitlesComInfo().getJobTitlesname(ecJobTitle);
}
} }

@ -34,8 +34,8 @@ public class JobListDTO {
/** /**
* *
*/ */
@TableTitle(title = "名称", dataIndex = "jobName", key = "jobName", width = "150") @TableTitle(title = "名称", dataIndex = "jobTitleName", key = "jobTitleName", width = "150")
private String jobName; private String jobTitleName;
/** /**
* *
*/ */
@ -54,13 +54,13 @@ public class JobListDTO {
/** /**
* *
*/ */
@TableTitle(title = "岗位序列", dataIndex = "sequenceName", key = "sequenceName") //@TableTitle(title = "岗位序列", dataIndex = "sequenceName", key = "sequenceName")
private String sequenceName; //private String sequenceName;
/** /**
* *
*/ */
@TableTitle(title = "等级方案", dataIndex = "schemeName", key = "schemeName") //@TableTitle(title = "等级方案", dataIndex = "schemeName", key = "schemeName")
private String schemeName; //private String schemeName;
/** /**
* *
*/ */
@ -84,8 +84,8 @@ public class JobListDTO {
/** /**
* *
*/ */
@TableTitle(title = "是否启用", dataIndex = "forbiddenTag", key = "forbiddenTag") //@TableTitle(title = "是否启用", dataIndex = "forbiddenTag", key = "forbiddenTag")
private Integer forbiddenTag; //private Integer forbiddenTag;
/** /**
* *

@ -28,7 +28,7 @@ public class JobSearchParam extends BaseQueryParam {
/** /**
* *
*/ */
private String jobName; private String jobTitleName;
/** /**
* ec * ec
*/ */
@ -82,4 +82,6 @@ public class JobSearchParam extends BaseQueryParam {
private Integer subcompanyid1; private Integer subcompanyid1;
private Integer departmentid; private Integer departmentid;
private Integer ecJobTitle;
} }

@ -29,20 +29,20 @@ public class JobPO {
/** /**
* *
*/ */
private String jobName; private String jobTitleName;
/** ///**
* // * 所属分部
*/ // */
private Integer parentComp; //private Integer parentComp;
/** /**
* ec * ec
*/ */
private Integer ecCompany; private Integer ecCompany;
/** ///**
* // * 所属部门
*/ // */
private Integer parentDept; //private Integer parentDept;
/** /**
* ec * ec
*/ */
@ -93,6 +93,8 @@ public class JobPO {
private String levelId; private String levelId;
private Integer ecJobTitle;
private Long creator; private Long creator;
private int deleteType; private int deleteType;

@ -54,6 +54,7 @@
<if test=" CompanyPO.supSubComId != null "> <if test=" CompanyPO.supSubComId != null ">
and t.supSubComId = #{CompanyPO.supSubComId} and t.supSubComId = #{CompanyPO.supSubComId}
</if> </if>
<include refid="isCanceled"/>
order by ${orderSql} order by ${orderSql}
</select> </select>
@ -213,4 +214,17 @@
and isnull(canceled,0)=0 and isnull(canceled,0)=0
</sql> </sql>
<sql id="isCanceled">
and ifnull(canceled,0)=
#{CompanyPO.canceled}
</sql>
<sql id="isCanceled" databaseId="oracle">
and nvl(canceled,0)=
#{CompanyPO.canceled}
</sql>
<sql id="isCanceled" databaseId="sqlserver">
and isnull(canceled,0)=
#{CompanyPO.canceled}
</sql>
</mapper> </mapper>

@ -62,6 +62,7 @@
<if test=" departmentPO.departmentId != null "> <if test=" departmentPO.departmentId != null ">
and t.id = #{departmentPO.departmentId} and t.id = #{departmentPO.departmentId}
</if> </if>
<include refid="isCanceled"/>
order by ${orderSql} order by ${orderSql}
</select> </select>
@ -180,4 +181,17 @@
</if> </if>
</sql> </sql>
<sql id="isCanceled">
and ifnull(canceled,0)=
#{departmentPO.canceled}
</sql>
<sql id="isCanceled" databaseId="oracle">
and nvl(canceled,0)=
#{departmentPO.canceled}
</sql>
<sql id="isCanceled" databaseId="sqlserver">
and isnull(canceled,0)=
#{departmentPO.canceled}
</sql>
</mapper> </mapper>

@ -79,24 +79,6 @@ public interface JobMapper {
*/ */
List<JobPO> listByNo(@Param("jobNo") String jobNo); List<JobPO> listByNo(@Param("jobNo") String jobNo);
/**
*
*
* @param jobName
* @param id
* @return
*/
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") Integer ecDepartment);
/** /**
* *
@ -139,14 +121,6 @@ public interface JobMapper {
*/ */
int deleteByIds(@Param("ids") Collection<Long> ids); int deleteByIds(@Param("ids") Collection<Long> ids);
/**
* ID
*
* @return
*/
List<String> listUsedId();
/** /**
* *
* *
@ -165,18 +139,4 @@ public interface JobMapper {
*/ */
Long getIdByNameAndPid(@Param("jobName") String jobName, @Param("parentCompany") Integer parentCompany, @Param("parentDepartment") Integer parentDepartment, @Param("parentJob") Long parentJob); Long getIdByNameAndPid(@Param("jobName") String jobName, @Param("parentCompany") Integer parentCompany, @Param("parentDepartment") Integer parentDepartment, @Param("parentJob") Long parentJob);
Long getIdByNameAndEcId(@Param("jobName") String jobName, @Param("ecCompany") String ecCompany, @Param("ecDepartment") String ecDepartment);
int checkRepeatNo(@Param("jobNo") String jobNo, @Param("id") Long id);
/**
*
*
* @param ids
* @param parentCompany
* @return
*/
int updateJobCompany(@Param("ids") Collection<Long> ids, @Param("parentCompany") Integer parentCompany, @Param("ecCompany") Integer ecCompany);
int isHasResource(@Param("jobId") Long jobId);
} }

@ -4,9 +4,8 @@
<resultMap id="BaseResultMap" type="com.engine.organization.entity.job.po.JobPO"> <resultMap id="BaseResultMap" type="com.engine.organization.entity.job.po.JobPO">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="job_no" property="jobNo"/> <result column="job_no" property="jobNo"/>
<result column="job_name" property="jobName"/> <result column="jobtitlename" property="jobTitleName"/>
<result column="parent_comp" property="parentComp"/> <result column="ecJobTitle" property="ecJobTitle"/>
<result column="parent_dept" property="parentDept"/>
<result column="ec_company" property="ecCompany"/> <result column="ec_company" property="ecCompany"/>
<result column="ec_department" property="ecDepartment"/> <result column="ec_department" property="ecDepartment"/>
<result column="sequence_id" property="sequenceId"/> <result column="sequence_id" property="sequenceId"/>
@ -34,9 +33,8 @@
id id
, ,
t.job_no, t.job_no,
t.job_name, h.jobtitlename,
t.parent_comp, t.ec_jobTitle,
t.parent_dept,
t.ec_company, t.ec_company,
t.ec_department, t.ec_department,
t.sequence_id, t.sequence_id,
@ -73,15 +71,6 @@
<if test="jobNo != null "> <if test="jobNo != null ">
job_no, job_no,
</if> </if>
<if test="jobName != null ">
job_name,
</if>
<if test="parentComp != null ">
parent_comp,
</if>
<if test="parentDept != null ">
parent_dept,
</if>
<if test="sequenceId != null "> <if test="sequenceId != null ">
sequence_id, sequence_id,
</if> </if>
@ -133,16 +122,6 @@
<if test="jobNo != null "> <if test="jobNo != null ">
#{jobNo}, #{jobNo},
</if> </if>
<if test="jobName != null ">
#{jobName},
</if>
<if test="parentComp != null ">
#{parentComp},
</if>
<if test="parentDept != null ">
#{parentDept},
</if>
<if test="sequenceId != null "> <if test="sequenceId != null ">
#{sequenceId}, #{sequenceId},
</if> </if>
@ -202,15 +181,6 @@
<if test="jobNo != null "> <if test="jobNo != null ">
job_no, job_no,
</if> </if>
<if test="jobName != null ">
job_name,
</if>
<if test="parentComp != null ">
parent_comp,
</if>
<if test="parentDept != null ">
parent_dept,
</if>
<if test="sequenceId != null "> <if test="sequenceId != null ">
sequence_id, sequence_id,
</if> </if>
@ -262,16 +232,6 @@
<if test="jobNo != null "> <if test="jobNo != null ">
#{jobNo}, #{jobNo},
</if> </if>
<if test="jobName != null ">
#{jobName},
</if>
<if test="parentComp != null ">
#{parentComp},
</if>
<if test="parentDept != null ">
#{parentDept},
</if>
<if test="sequenceId != null "> <if test="sequenceId != null ">
#{sequenceId}, #{sequenceId},
</if> </if>
@ -314,9 +274,6 @@
<set> <set>
creator=#{creator}, creator=#{creator},
update_time=#{updateTime}, update_time=#{updateTime},
job_name=#{jobName},
parent_comp=#{parentComp},
parent_dept=#{parentDept},
ec_company=#{ecCompany}, ec_company=#{ecCompany},
ec_department=#{ecDepartment}, ec_department=#{ecDepartment},
sequence_id=#{sequenceId}, sequence_id=#{sequenceId},
@ -351,18 +308,7 @@
#{id} #{id}
</foreach> </foreach>
</update> </update>
<update id="updateJobCompany">
update jcl_org_job
<set>
parent_comp = #{parentCompany},
ec_company =#{ecCompany},
</set>
where delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<select id="listByFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO" <select id="listByFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO"
parameterType="com.engine.organization.entity.job.po.JobPO"> parameterType="com.engine.organization.entity.job.po.JobPO">
@ -373,6 +319,8 @@
d.scheme_name, d.scheme_name,
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM jcl_org_job t FROM jcl_org_job t
left join hrmjobtitles h on
t.ec_jobTitle = h.id
left join hrmsubcompany a on left join hrmsubcompany a on
t.ec_company = a.id t.ec_company = a.id
left join hrmdepartment b on left join hrmdepartment b on
@ -383,12 +331,6 @@
t.scheme_id = d.id t.scheme_id = d.id
WHERE t.delete_type = 0 WHERE t.delete_type = 0
<include refid="likeSQL"/> <include refid="likeSQL"/>
<if test=" jobPO.parentComp != null ">
and t.parent_comp = #{jobPO.parentComp}
</if>
<if test=" jobPO.parentDept != null ">
and t.parent_dept = #{jobPO.parentDept}
</if>
<if test=" jobPO.parentJob != null "> <if test=" jobPO.parentJob != null ">
and t.parent_job = #{jobPO.parentJob} and t.parent_job = #{jobPO.parentJob}
</if> </if>
@ -429,6 +371,7 @@
t.sequence_id = c.id t.sequence_id = c.id
left join jcl_org_scheme d on left join jcl_org_scheme d on
t.scheme_id = d.id t.scheme_id = d.id
left join hrmjobtitles h on t.ec_jobTitle = h.id
WHERE t.delete_type = 0 order by ${orderSql} WHERE t.delete_type = 0 order by ${orderSql}
</select> </select>
@ -436,16 +379,18 @@
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_job t from jcl_org_job t
where delete_type = 0 left join hrmjobtitles h on t.ec_jobTitle = h.id
and id = #{id} where t.delete_type = 0
and t.id = #{id}
</select> </select>
<select id="listJobsByIds" resultType="java.util.Map"> <select id="listJobsByIds" resultType="java.util.Map">
select select
id as "id", t.id as "id",
job_name as "name" h.jobtitlename as "name"
from jcl_org_job t from jcl_org_job t
WHERE delete_type = 0 left join hrmjobtitles h on t.ec_jobTitle = h.id
AND id IN WHERE t.delete_type = 0
AND t.id IN
<foreach collection="ids" open="(" item="id" separator="," close=")"> <foreach collection="ids" open="(" item="id" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
@ -453,50 +398,41 @@
<select id="listByNo" resultMap="BaseResultMap"> <select id="listByNo" resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_job t where job_no = #{jobNo} AND delete_type = 0 from jcl_org_job t
left join hrmjobtitles h on t.ec_jobTitle = h.id
where job_no = #{jobNo} AND delete_type = 0
</select> </select>
<select id="getJobsByPid" resultMap="BaseResultMap"> <select id="getJobsByPid" resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_job t from jcl_org_job t
left join hrmjobtitles h on t.ec_jobTitle = h.id
where delete_type = 0 where delete_type = 0
and parent_job = #{pid} and parent_job = #{pid}
</select> </select>
<select id="listUsedId" resultType="java.lang.String">
select job_id
from JCL_ORG_STAFF
where delete_type = 0
union
select job_title
from jcl_org_hrmresource
where STATUS &lt; 4
</select>
<select id="listJobsByDepartmentId" resultMap="BaseResultMap"> <select id="listJobsByDepartmentId" resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_job t from jcl_org_job t
left join hrmjobtitles h on t.ec_jobTitle = h.id
where delete_type = 0 where delete_type = 0
and parent_dept = #{departmentId} and ec_department = #{departmentId}
</select> </select>
<select id="listAll" resultMap="BaseResultMap"> <select id="listAll" resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_job t from jcl_org_job t
left join hrmjobtitles h on t.ec_jobTitle = h.id
where delete_type = 0 where delete_type = 0
</select> </select>
<select id="listPOsByFilter" resultMap="BaseResultMap"> <select id="listPOsByFilter" resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM jcl_org_job t FROM jcl_org_job t
left join hrmjobtitles h on t.ec_jobTitle = h.id
WHERE t.delete_type = 0 WHERE t.delete_type = 0
<include refid="likeSQL"/> <include refid="likeSQL"/>
<if test=" jobPO.parentComp != null ">
and t.parent_comp = #{jobPO.parentComp}
</if>
<if test=" jobPO.parentDept != null ">
and t.parent_dept = #{jobPO.parentDept}
</if>
<if test=" jobPO.sequenceId != null "> <if test=" jobPO.sequenceId != null ">
and t.sequence_id = #{jobPO.sequenceId} and t.sequence_id = #{jobPO.sequenceId}
</if> </if>
@ -515,94 +451,42 @@
from jcl_org_job from jcl_org_job
</select> </select>
<select id="getIdByNameAndPid" resultType="java.lang.Long"> <select id="getIdByNameAndPid" resultType="java.lang.Long">
select id select
from jcl_org_job t.id
where delete_type = 0 and job_name = #{jobName} from
and parent_comp = #{parentCompany} jcl_org_job t
left join hrmjobtitles h on t.ec_jobTitle = h.id
where
delete_type = 0
and h.JOBTITLENAME = #{jobName}
and ec_company = #{parentCompany}
<include refid="nullparentDept"/> <include refid="nullparentDept"/>
<include refid="nullparentJob"/>
</select> </select>
<select id="getJobsByIds" resultMap="BaseResultMap"> <select id="getJobsByIds" resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_job t from jcl_org_job t
left join hrmjobtitles h on t.ec_jobTitle = h.id
where delete_type = 0 where delete_type = 0
AND id IN AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")"> <foreach collection="ids" open="(" item="id" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="listByNameExceptId" resultType="com.engine.organization.entity.job.po.JobPO">
select
<include refid="baseColumns"/>
from jcl_org_job t
where delete_type = 0
AND job_name = #{jobName}
AND id != #{id}
</select>
<select id="checkRepeatNo" resultType="java.lang.Integer">
select count(1)
from jcl_org_job t
where t.delete_type = 0
AND job_no = #{jobNo}
<if test=" id != null ">
and t.id != #{id}
</if>
</select>
<select id="getIdByNameAndEcId" resultType="java.lang.Long">
select id
from jcl_org_job
where delete_type = 0
and job_name = #{jobName}
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>
<select id="isHasResource" resultType="java.lang.Integer">
select count(a.id)
from jcl_org_hrmresource a
inner join jcl_org_job b on a.job_title = b.id
where a.status &lt; 4
and b.id = #{jobId}
</select>
<sql id="nullparentJob">
and ifnull(parent_job,0) =
#{parentJob}
</sql>
<sql id="nullparentJob" databaseId="sqlserver">
and isnull(parent_job,0) =
#{parentJob}
</sql>
<sql id="nullparentJob" databaseId="oracle">
and NVL(parent_job,0) =
#{parentJob}
</sql>
<sql id="nullparentDept"> <sql id="nullparentDept">
and ifnull(parent_dept,0) = and ifnull(ec_department,0) =
#{parentDepartment} #{parentDepartment}
</sql> </sql>
<sql id="nullparentDept" databaseId="sqlserver"> <sql id="nullparentDept" databaseId="sqlserver">
and isnull(parent_dept,0) = and isnull(ec_department,0) =
#{parentDepartment} #{parentDepartment}
</sql> </sql>
<sql id="nullparentDept" databaseId="oracle"> <sql id="nullparentDept" databaseId="oracle">
and NVL(parent_dept,0) = and NVL(ec_department,0) =
#{parentDepartment} #{parentDepartment}
</sql> </sql>
@ -611,8 +495,8 @@
<if test=" jobPO.jobNo != null and jobPO.jobNo != '' "> <if test=" jobPO.jobNo != null and jobPO.jobNo != '' ">
and t.job_no like CONCAT('%',#{jobPO.jobNo},'%') and t.job_no like CONCAT('%',#{jobPO.jobNo},'%')
</if> </if>
<if test=" jobPO.jobName != null and jobPO.jobName != '' "> <if test=" jobPO.jobTitleName != null and jobPO.jobTitleName != '' ">
and t.job_name like CONCAT('%',#{jobPO.jobName},'%') and h.jobtitlename like CONCAT('%',#{jobPO.jobTitleName},'%')
</if> </if>
<if test=" jobPO.workplace != null and jobPO.workplace != '' "> <if test=" jobPO.workplace != null and jobPO.workplace != '' ">
and t.workplace like CONCAT('%',#{jobPO.workplace},'%') and t.workplace like CONCAT('%',#{jobPO.workplace},'%')
@ -632,8 +516,8 @@
<if test=" jobPO.jobNo != null and jobPO.jobNo != '' "> <if test=" jobPO.jobNo != null and jobPO.jobNo != '' ">
and t.job_no like '%'||#{jobPO.jobNo}||'%' and t.job_no like '%'||#{jobPO.jobNo}||'%'
</if> </if>
<if test=" jobPO.jobName != null and jobPO.jobName != '' "> <if test=" jobPO.jobTitleName != null and jobPO.jobTitleName != '' ">
and t.job_name like '%'||#{jobPO.jobName}||'%' and h.jobtitlename like '%'||#{jobPO.jobTitleName}||'%'
</if> </if>
<if test=" jobPO.workplace != null and jobPO.workplace != '' "> <if test=" jobPO.workplace != null and jobPO.workplace != '' ">
and t.workplace like '%'||#{jobPO.workplace}||'%' and t.workplace like '%'||#{jobPO.workplace}||'%'
@ -653,8 +537,8 @@
<if test=" jobPO.jobNo != null and jobPO.jobNo != '' "> <if test=" jobPO.jobNo != null and jobPO.jobNo != '' ">
and t.job_no like '%'+#{jobPO.jobNo}+'%' and t.job_no like '%'+#{jobPO.jobNo}+'%'
</if> </if>
<if test=" jobPO.jobName != null and jobPO.jobName != '' "> <if test=" jobPO.jobTitleName != null and jobPO.jobTitleName != '' ">
and t.job_name like '%'+#{jobPO.jobName}+'%' and h.jobTitleName like '%'+#{jobPO.jobTitleName}+'%'
</if> </if>
<if test=" jobPO.workplace != null and jobPO.workplace != '' "> <if test=" jobPO.workplace != null and jobPO.workplace != '' ">
and t.workplace like '%'+#{jobPO.workplace}+'%' and t.workplace like '%'+#{jobPO.workplace}+'%'

@ -38,16 +38,9 @@ import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.hrmresource.HrmRelationMapper; import com.engine.organization.mapper.hrmresource.HrmRelationMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper; import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.post.PostInfoMapper;
import com.engine.organization.mapper.post.PostMapper;
import com.engine.organization.mapper.resource.ResourceMapper; import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.mapper.scheme.GradeMapper;
import com.engine.organization.mapper.scheme.LevelMapper;
import com.engine.organization.mapper.scheme.SchemeMapper;
import com.engine.organization.mapper.sequence.SequenceMapper;
import com.engine.organization.service.ExtService; import com.engine.organization.service.ExtService;
import com.engine.organization.service.HrmResourceService; import com.engine.organization.service.HrmResourceService;
import com.engine.organization.thread.HrmResourceTriggerRunnable;
import com.engine.organization.thread.OrganizationSyncEc; import com.engine.organization.thread.OrganizationSyncEc;
import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.MenuBtn; import com.engine.organization.util.MenuBtn;
@ -68,7 +61,6 @@ import weaver.hrm.User;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* @author:dxfeng * @author:dxfeng
@ -117,30 +109,6 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
private static final String RIGHT_NAME = "Roster:All"; private static final String RIGHT_NAME = "Roster:All";
private SchemeMapper getSchemeMapper() {
return MapperProxyFactory.getProxy(SchemeMapper.class);
}
private LevelMapper getLevelMapper() {
return MapperProxyFactory.getProxy(LevelMapper.class);
}
private GradeMapper getGradeMapper() {
return MapperProxyFactory.getProxy(GradeMapper.class);
}
private SequenceMapper getSequenceMapper() {
return MapperProxyFactory.getProxy(SequenceMapper.class);
}
private PostMapper getPostMapper() {
return MapperProxyFactory.getProxy(PostMapper.class);
}
private PostInfoMapper getPostInfoMapper() {
return MapperProxyFactory.getProxy(PostInfoMapper.class);
}
private HrmRelationMapper getHrmRelationMapper() { private HrmRelationMapper getHrmRelationMapper() {
return MapperProxyFactory.getProxy(HrmRelationMapper.class); return MapperProxyFactory.getProxy(HrmRelationMapper.class);
} }
@ -229,7 +197,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_RESOURCE, ecResourceId); RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_RESOURCE, ecResourceId);
params.put("uuid", recordInfo.getUuid()); params.put("uuid", recordInfo.getUuid());
Long resourceId = getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", null); Long resourceId = getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", null);
new HrmResourceTriggerRunnable(resourceId).run(); // TODO new HrmResourceTriggerRunnable(resourceId).run();
return resourceId; return resourceId;
} }
@ -300,7 +268,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
// 更新主表数据 // 更新主表数据
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", id); updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", id);
new HrmResourceTriggerRunnable(id).run(); // TODO new HrmResourceTriggerRunnable(id).run();
} else { } else {
// 更新主表拓展表 // 更新主表拓展表
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRMEXT, params, "", id); getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRMEXT, params, "", id);
@ -367,61 +335,61 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
int viewAttr = Integer.parseInt(viewAttrStr); int viewAttr = Integer.parseInt(viewAttrStr);
Map<String, Object> apiDatas = new HashMap<>(); Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionGroup> addGroups = new ArrayList<>(); //List<SearchConditionGroup> addGroups = new ArrayList<>();
SearchConditionItem schemeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "等级方案", "161", "schemeId", "schemeBrowser"); //SearchConditionItem schemeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "等级方案", "161", "schemeId", "schemeBrowser");
schemeId.setRules("required"); //schemeId.setRules("required");
SearchConditionItem gradeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职级", "161", "gradeId", "gradeBrowser"); //SearchConditionItem gradeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职级", "161", "gradeId", "gradeBrowser");
gradeId.setRules("required"); //gradeId.setRules("required");
SearchConditionItem levelId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职等", "162", "levelId", "levelBrowser"); //SearchConditionItem levelId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职等", "162", "levelId", "levelBrowser");
levelId.setRules("required"); //levelId.setRules("required");
SearchConditionItem sequenceId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位序列", "161", "sequenceId", "sequenceBrowser"); //SearchConditionItem sequenceId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位序列", "161", "sequenceId", "sequenceBrowser");
sequenceId.setRules("required"); //sequenceId.setRules("required");
SearchConditionItem postId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务分类", "161", "postId", "postBrowser"); //SearchConditionItem postId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务分类", "161", "postId", "postBrowser");
postId.setRules("required"); //postId.setRules("required");
SearchConditionItem postInfoId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务信息", "161", "postInfoId", "postInfoBrowser"); //SearchConditionItem postInfoId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务信息", "161", "postInfoId", "postInfoBrowser");
postInfoId.setRules("required"); //postInfoId.setRules("required");
SearchConditionItem companyId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "分部", "164", "companyId", ""); //SearchConditionItem companyId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "分部", "164", "companyId", "");
companyId.setRules("required"); //companyId.setRules("required");
SearchConditionItem departmentId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "部门", "4", "departmentId", ""); //SearchConditionItem departmentId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "部门", "4", "departmentId", "");
departmentId.setRules("required"); //departmentId.setRules("required");
SearchConditionItem jobId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位", "161", "jobId", "jobBrowser"); //SearchConditionItem jobId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位", "161", "jobId", "jobBrowser");
jobId.setRules("required"); //jobId.setRules("required");
//
//
// 编辑状态下赋值操作 //// 编辑状态下赋值操作
HrmRelationPO relationPO = getHrmRelationMapper().getRelationById(Long.parseLong(id)); //HrmRelationPO relationPO = getHrmRelationMapper().getRelationById(Long.parseLong(id));
if (null != relationPO) { //if (null != relationPO) {
setBrowserValue(schemeId, relationPO.getSchemeId(), getSchemeMapper().listSchemesByIds(Stream.of(relationPO.getSchemeId()).collect(Collectors.toList())), null, null); // setBrowserValue(schemeId, relationPO.getSchemeId(), getSchemeMapper().listSchemesByIds(Stream.of(relationPO.getSchemeId()).collect(Collectors.toList())), null, null);
setBrowserValue(gradeId, relationPO.getGradeId(), getGradeMapper().listGradessByIds(Stream.of(relationPO.getGradeId()).collect(Collectors.toList())), "scheme_id", relationPO.getSchemeId()); // setBrowserValue(gradeId, relationPO.getGradeId(), getGradeMapper().listGradessByIds(Stream.of(relationPO.getGradeId()).collect(Collectors.toList())), "scheme_id", relationPO.getSchemeId());
setBrowserValue(levelId, relationPO.getLevelId(), getLevelMapper().listLevelsByIds(DeleteParam.builder().ids(relationPO.getLevelId()).build().getIds()), "grade_id", relationPO.getGradeId()); // setBrowserValue(levelId, relationPO.getLevelId(), getLevelMapper().listLevelsByIds(DeleteParam.builder().ids(relationPO.getLevelId()).build().getIds()), "grade_id", relationPO.getGradeId());
setBrowserValue(sequenceId, relationPO.getSequenceId(), getSequenceMapper().listSequencesByIds(Stream.of(relationPO.getSequenceId()).collect(Collectors.toList())), "scheme_id", relationPO.getSchemeId()); // setBrowserValue(sequenceId, relationPO.getSequenceId(), getSequenceMapper().listSequencesByIds(Stream.of(relationPO.getSequenceId()).collect(Collectors.toList())), "scheme_id", relationPO.getSchemeId());
setBrowserValue(postId, relationPO.getPostId(), getPostMapper().listPostsByIds(Stream.of(relationPO.getPostId()).collect(Collectors.toList())), null, null); // setBrowserValue(postId, relationPO.getPostId(), getPostMapper().listPostsByIds(Stream.of(relationPO.getPostId()).collect(Collectors.toList())), null, null);
setBrowserValue(postInfoId, relationPO.getPostInfoId(), getPostInfoMapper().listPostInfosByIds(Stream.of(relationPO.getPostInfoId()).collect(Collectors.toList())), "post_id", relationPO.getPostId()); // setBrowserValue(postInfoId, relationPO.getPostInfoId(), getPostInfoMapper().listPostInfosByIds(Stream.of(relationPO.getPostInfoId()).collect(Collectors.toList())), "post_id", relationPO.getPostId());
//
List<Map<String, Object>> companyMaps = new ArrayList<>(); // List<Map<String, Object>> companyMaps = new ArrayList<>();
String scCompanyNameById = MapperProxyFactory.getProxy(SystemDataMapper.class).getScCompanyNameById(relationPO.getCompanyId().toString()); // String scCompanyNameById = MapperProxyFactory.getProxy(SystemDataMapper.class).getScCompanyNameById(relationPO.getCompanyId().toString());
Map<String, Object> companyMap = new HashMap<>(); // Map<String, Object> companyMap = new HashMap<>();
companyMap.put(relationPO.getCompanyId().toString(), scCompanyNameById); // companyMap.put(relationPO.getCompanyId().toString(), scCompanyNameById);
companyMaps.add(companyMap); // companyMaps.add(companyMap);
setBrowserValue(companyId, relationPO.getCompanyId(), companyMaps, null, null); // setBrowserValue(companyId, relationPO.getCompanyId(), companyMaps, null, null);
//
List<Map<String, Object>> departmentMaps = new ArrayList<>(); // List<Map<String, Object>> departmentMaps = new ArrayList<>();
String departmentNameById = MapperProxyFactory.getProxy(SystemDataMapper.class).getScDepartmentNameById(relationPO.getDepartmentId().toString()); // String departmentNameById = MapperProxyFactory.getProxy(SystemDataMapper.class).getScDepartmentNameById(relationPO.getDepartmentId().toString());
Map<String, Object> departmentMap = new HashMap<>(); // Map<String, Object> departmentMap = new HashMap<>();
departmentMap.put(relationPO.getDepartmentId().toString(), departmentNameById); // departmentMap.put(relationPO.getDepartmentId().toString(), departmentNameById);
departmentMaps.add(departmentMap); // departmentMaps.add(departmentMap);
setBrowserValue(departmentId, relationPO.getDepartmentId(), departmentMaps, "subcompany1", relationPO.getCompanyId()); // setBrowserValue(departmentId, relationPO.getDepartmentId(), departmentMaps, "subcompany1", relationPO.getCompanyId());
//
setBrowserValue(jobId, relationPO.getJobId(), getJobMapper().listJobsByIds(Stream.of(relationPO.getJobId()).collect(Collectors.toList())), "departmentid", relationPO.getDepartmentId()); // setBrowserValue(jobId, relationPO.getJobId(), getJobMapper().listJobsByIds(Stream.of(relationPO.getJobId()).collect(Collectors.toList())), "departmentid", relationPO.getDepartmentId());
} //}
//
addGroups.add(new SearchConditionGroup("岗职位体系", true, Stream.of(schemeId, gradeId, levelId, sequenceId, postId, postInfoId).collect(Collectors.toList()))); //addGroups.add(new SearchConditionGroup("岗职位体系", true, Stream.of(schemeId, gradeId, levelId, sequenceId, postId, postInfoId).collect(Collectors.toList())));
addGroups.add(new SearchConditionGroup("组织机构", true, Stream.of(companyId, departmentId, jobId).collect(Collectors.toList()))); //addGroups.add(new SearchConditionGroup("组织机构", true, Stream.of(companyId, departmentId, jobId).collect(Collectors.toList())));
HashMap<String, Object> buttonsMap = new HashMap<>(); //HashMap<String, Object> buttonsMap = new HashMap<>();
buttonsMap.put("hasEdit", true); //buttonsMap.put("hasEdit", true);
buttonsMap.put("hasSave", true); //buttonsMap.put("hasSave", true);
apiDatas.put("buttons", buttonsMap); //apiDatas.put("buttons", buttonsMap);
apiDatas.put("conditions", addGroups); //apiDatas.put("conditions", addGroups);
return apiDatas; return apiDatas;
} }
@ -455,36 +423,6 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
return hrmRelationPO.getId(); return hrmRelationPO.getId();
} }
/**
*
*
* @param browserItem
* @param browserValue
* @param maps
*/
private void setBrowserValue(SearchConditionItem browserItem, Object browserValue, List<Map<String, Object>> maps, String relateField, Object relatedValue) {
browserItem.setValue(browserValue);
BrowserBean browserBean = browserItem.getBrowserConditionParam();
browserBean.setReplaceDatas(maps);
browserItem.setBrowserConditionParam(browserBean);
if (StringUtils.isNotBlank(relateField) && 1 != browserItem.getViewAttr()) {
long l = System.currentTimeMillis();
Map<String, Object> completeParams = browserBean.getCompleteParams();
completeParams.put("currenttime", l);
completeParams.put(relateField + "_" + l, relatedValue);
Map<String, Object> conditionDataParams = browserBean.getConditionDataParams();
conditionDataParams.put("currenttime", l);
conditionDataParams.put(relateField + "_" + l, relatedValue);
Map<String, Object> dataParams = browserBean.getDataParams();
dataParams.put("currenttime", l);
dataParams.put(relateField + "_" + l, relatedValue);
Map<String, Object> destDataParams = browserBean.getDestDataParams();
destDataParams.put("currenttime", l);
destDataParams.put(relateField + "_" + l, relatedValue);
}
}
/** /**
* *
* *
@ -496,23 +434,23 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
String sqlWhere = " where 1=1 "; String sqlWhere = " where 1=1 ";
String lastName = params.getLastName(); String lastName = params.getLastName();
if (StringUtils.isNotBlank(lastName)) { if (StringUtils.isNotBlank(lastName)) {
sqlWhere += " AND t.last_name " + dbType.like(lastName); sqlWhere += " AND t.lastname " + dbType.like(lastName);
} }
Long companyId = params.getCompanyId(); Long companyId = params.getCompanyId();
if (null != companyId) { if (null != companyId) {
sqlWhere += " AND t.company_id = '" + companyId + "'"; sqlWhere += " AND t.subcompanyid1 = '" + companyId + "'";
} }
Long departmentId = params.getDepartmentId(); Long departmentId = params.getDepartmentId();
if (null != departmentId) { if (null != departmentId) {
sqlWhere += " AND t.department_id = '" + departmentId + "'"; sqlWhere += " AND t.departmentid = '" + departmentId + "'";
} }
Long ecCompany = params.getEcCompany(); Long ecCompany = params.getEcCompany();
if (null != ecCompany) { if (null != ecCompany) {
sqlWhere += " AND t.ec_company = '" + ecCompany + "'"; sqlWhere += " AND t.subcompanyid1 = '" + ecCompany + "'";
} }
Long ecDepartment = params.getEcDepartment(); Long ecDepartment = params.getEcDepartment();
if (null != ecDepartment) { if (null != ecDepartment) {
sqlWhere += " AND t.ec_department = '" + ecDepartment + "'"; sqlWhere += " AND t.departmentid = '" + ecDepartment + "'";
} }
String telephone = params.getTelephone(); String telephone = params.getTelephone();
if (StringUtils.isNotBlank(telephone)) { if (StringUtils.isNotBlank(telephone)) {
@ -524,14 +462,15 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
} }
Long jobTitle = params.getJobTitle(); Long jobTitle = params.getJobTitle();
if (null != jobTitle) { if (null != jobTitle) {
sqlWhere += " AND t.job_title = '" + jobTitle + "'"; // TODO BUG修复
sqlWhere += " AND t.jobtitle = '" + jobTitle + "'";
} }
// 分权查询 // 分权查询
DetachUtil detachUtil = new DetachUtil(user.getUID()); DetachUtil detachUtil = new DetachUtil(user.getUID());
String parentCompanyIds = detachUtil.getJclRoleLevels(); String parentCompanyIds = detachUtil.getJclRoleLevels();
if (detachUtil.isDETACH()) { if (detachUtil.isDETACH()) {
sqlWhere += " And t.company_id in(" + parentCompanyIds + ")"; sqlWhere += " And t.subcompanyid1 in(" + parentCompanyIds + ")";
} }
return sqlWhere; return sqlWhere;
@ -542,21 +481,21 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
// 通过分部、公司 组装数据 // 通过分部、公司 组装数据
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) { if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id); Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).subCompanyId1(parentCompId).build(); DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).subCompanyId1(parentCompId).canceled(0).build();
CompPO compBuild = CompPO.builder().subCompanyName(keyword).supSubComId(parentCompId).build(); CompPO compBuild = CompPO.builder().subCompanyName(keyword).supSubComId(parentCompId).canceled(0).build();
// 所属分部下的岗位 // 所属分部下的岗位
JobPO jobBuild = JobPO.builder().jobName(keyword).parentComp(parentCompId).build(); JobPO jobBuild = JobPO.builder().jobTitleName(keyword).ecCompany(parentCompId).forbiddenTag(0).build();
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild, jobBuild); searchTree = buildTreeByCompAndDept(departmentBuild, compBuild, jobBuild);
} else if (TYPE_DEPT.equals(type)) { } else if (TYPE_DEPT.equals(type)) {
Integer parentDeptId = Integer.parseInt(id); Integer parentDeptId = Integer.parseInt(id);
DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).supDepId(parentDeptId).build(); DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).supDepId(parentDeptId).canceled(0).build();
// 所属分部下的岗位 // 所属分部下的岗位
JobPO jobBuild = JobPO.builder().jobName(keyword).parentDept(parentDeptId).build(); JobPO jobBuild = JobPO.builder().jobTitleName(keyword).ecDepartment(parentDeptId).forbiddenTag(0).build();
searchTree = buildTreeByDeptAndJob(departmentBuild, jobBuild); searchTree = buildTreeByDeptAndJob(departmentBuild, jobBuild);
} else if (TYPE_JOB.equals(type)) { } else if (TYPE_JOB.equals(type)) {
// 查询部门信息 // 查询部门信息
List<JobPO> filterDeparts = getJobMapper().listPOsByFilter(JobPO.builder().jobName(keyword).parentJob(Long.parseLong(id)).build()); List<JobPO> filterDeparts = getJobMapper().listPOsByFilter(JobPO.builder().jobTitleName(keyword).parentJob(Long.parseLong(id)).forbiddenTag(0).build());
Set<JobPO> builderJobs = new HashSet<>(); Set<JobPO> builderJobs = new HashSet<>();
for (JobPO departmentPO : filterDeparts) { for (JobPO departmentPO : filterDeparts) {
buildParentJobs(departmentPO, builderJobs); buildParentJobs(departmentPO, builderJobs);
@ -589,7 +528,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
String parentDeptS = jobTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(",")); String parentDeptS = jobTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
if (!StringUtil.isEmpty(parentDeptS)) { if (!StringUtil.isEmpty(parentDeptS)) {
// 兼容SQLServer每次最多in,2100条数据 // 兼容SQLServer每次最多in,2100条数据
List<Long> ids = (List<Long>) DeleteParam.builder().ids(parentDeptS).build().getIds(); List<Long> ids = DeleteParam.builder().ids(parentDeptS).build().getIds();
int ceilCount = (int) Math.ceil((double) ids.size() / 1000); int ceilCount = (int) Math.ceil((double) ids.size() / 1000);
List<DepartmentPO> departmentsByIds = new ArrayList<>(); List<DepartmentPO> departmentsByIds = new ArrayList<>();
for (int i = 1; i < ceilCount + 1; i++) { for (int i = 1; i < ceilCount + 1; i++) {
@ -716,8 +655,8 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
String jobId = Util.null2String(params.get("job_title")); String jobId = Util.null2String(params.get("job_title"));
if (StringUtils.isNotBlank(jobId)) { if (StringUtils.isNotBlank(jobId)) {
JobPO jobById = getJobMapper().getJobById(Long.parseLong(jobId)); JobPO jobById = getJobMapper().getJobById(Long.parseLong(jobId));
params.put("department_id", jobById.getParentDept()); params.put("department_id", jobById.getEcDepartment());
params.put("company_id", jobById.getParentComp()); params.put("company_id", jobById.getEcCompany());
params.put("ec_department", jobById.getEcDepartment()); params.put("ec_department", jobById.getEcDepartment());
params.put("ec_company", jobById.getEcCompany()); params.put("ec_company", jobById.getEcCompany());
// 等级方案、岗位序列、职等、职级 // 等级方案、岗位序列、职等、职级

@ -16,12 +16,10 @@ import com.engine.organization.entity.scheme.po.GradePO;
import com.engine.organization.entity.scheme.po.LevelPO; import com.engine.organization.entity.scheme.po.LevelPO;
import com.engine.organization.entity.scheme.po.SchemePO; import com.engine.organization.entity.scheme.po.SchemePO;
import com.engine.organization.enums.OrgImportEnum; import com.engine.organization.enums.OrgImportEnum;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.employee.EmployeeMapper; import com.engine.organization.mapper.employee.EmployeeMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper; import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper; import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper; import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.resource.ResourceMapper; import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.mapper.scheme.GradeMapper; import com.engine.organization.mapper.scheme.GradeMapper;
import com.engine.organization.mapper.scheme.LevelMapper; import com.engine.organization.mapper.scheme.LevelMapper;
@ -753,27 +751,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
/**
*
*/
private boolean checkRepeatNo(String no, Long extendType, Long id) {
if (StringUtils.isBlank(no)) {
return true;
}
if (null != extendType) {
switch (extendType.toString()) {
case "1":
// return 0 == MapperProxyFactory.getProxy(CompMapper.class).checkRepeatNo(no, id);
case "2":
return 0 == MapperProxyFactory.getProxy(DepartmentMapper.class).checkRepeatNo(no, id);
case "3":
return 0 == MapperProxyFactory.getProxy(JobMapper.class).checkRepeatNo(no, id);
default:
return false;
}
}
return false;
}
/** /**
* *

@ -21,7 +21,6 @@ import com.engine.organization.entity.department.bo.DepartmentBO;
import com.engine.organization.entity.department.po.DepartmentPO; import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.employee.vo.EmployeeTableVO; import com.engine.organization.entity.employee.vo.EmployeeTableVO;
import com.engine.organization.entity.extend.po.ExtendTitlePO; import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
import com.engine.organization.entity.job.bo.JobBO; import com.engine.organization.entity.job.bo.JobBO;
import com.engine.organization.entity.job.dto.JobListDTO; import com.engine.organization.entity.job.dto.JobListDTO;
import com.engine.organization.entity.job.param.JobMergeParam; import com.engine.organization.entity.job.param.JobMergeParam;
@ -32,6 +31,7 @@ import com.engine.organization.entity.searchtree.SearchTree;
import com.engine.organization.entity.searchtree.SearchTreeParams; import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.enums.LogModuleNameEnum; import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum; import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.mapper.codesetting.CodeRuleMapper; import com.engine.organization.mapper.codesetting.CodeRuleMapper;
import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper; import com.engine.organization.mapper.department.DepartmentMapper;
@ -44,8 +44,6 @@ import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.mapper.scheme.GradeMapper; import com.engine.organization.mapper.scheme.GradeMapper;
import com.engine.organization.service.ExtService; import com.engine.organization.service.ExtService;
import com.engine.organization.service.JobService; import com.engine.organization.service.JobService;
import com.engine.organization.thread.HrmResourceTriggerRunnable;
import com.engine.organization.thread.JobTriggerRunnable;
import com.engine.organization.thread.OrganizationSyncEc; import com.engine.organization.thread.OrganizationSyncEc;
import com.engine.organization.util.*; import com.engine.organization.util.*;
import com.engine.organization.util.coderule.CodeRuleUtil; import com.engine.organization.util.coderule.CodeRuleUtil;
@ -57,7 +55,6 @@ import com.engine.organization.util.page.PageUtil;
import com.engine.organization.util.tree.SearchTreeUtil; import com.engine.organization.util.tree.SearchTreeUtil;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.StringUtil; import weaver.general.StringUtil;
import weaver.general.Util; import weaver.general.Util;
import weaver.hrm.User; import weaver.hrm.User;
@ -203,7 +200,16 @@ public class JobServiceImpl extends Service implements JobService {
@Override @Override
public Map<String, List<MenuBtn>> getHasRight() { public Map<String, List<MenuBtn>> getHasRight() {
return MenuBtn.getDatasNoBtnColum(); Map<String, List<MenuBtn>> btnDatas = new HashMap<>();
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
// 批量删除
topMenuList.add(MenuBtn.topMenu_batchDelete());
btnDatas.put("topMenu", topMenuList);
// 日志
rightMenuList.add(MenuBtn.rightMenu_btnLog());
btnDatas.put("rightMenu", rightMenuList);
return btnDatas;
} }
@Override @Override
@ -214,23 +220,11 @@ public class JobServiceImpl extends Service implements JobService {
// 编号 // 编号
SearchConditionItem jobNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "编号", "jobNo"); SearchConditionItem jobNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "编号", "jobNo");
// 名称 // 名称
SearchConditionItem jobNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "jobName"); SearchConditionItem jobTitleNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "jobTitleName");
// 所属分部 // 所属分部
SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "164", "ecCompany", ""); SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "164", "ecCompany", "");
// 所属部门 // 所属部门
SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属部门", "4", "ecDepartment", ""); SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属部门", "4", "ecDepartment", "");
// 岗位序列
SearchConditionItem sequenceBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位序列", "161", "sequenceId", "sequenceBrowser");
// 等级方案
SearchConditionItem schemeBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "等级方案", "161", "schemeId", "schemeBrowser");
// 上级岗位
SearchConditionItem parentJobBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级岗位", "666", "parentJob", "");
BrowserBean browserBean = parentJobBrowserItem.getBrowserConditionParam();
String s = JSONObject.toJSONString(browserBean);
CustomBrowserBean customBrowserBean = JSONObject.parseObject(s, CustomBrowserBean.class);
customBrowserBean.setHasLeftTree(true);
customBrowserBean.setLeftToSearchKey("treeKey");
parentJobBrowserItem.setBrowserConditionParam(customBrowserBean);
// 是否关键岗 // 是否关键岗
List<SearchConditionOption> isKeyOptions = new ArrayList<>(); List<SearchConditionOption> isKeyOptions = new ArrayList<>();
SearchConditionOption yesOption = new SearchConditionOption("0", "否"); SearchConditionOption yesOption = new SearchConditionOption("0", "否");
@ -249,12 +243,9 @@ public class JobServiceImpl extends Service implements JobService {
SearchConditionItem forbiddenTagItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "禁用标记", "forbiddenTag"); SearchConditionItem forbiddenTagItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "禁用标记", "forbiddenTag");
conditionItems.add(jobNoItem); conditionItems.add(jobNoItem);
conditionItems.add(jobNameItem); conditionItems.add(jobTitleNameItem);
conditionItems.add(parentCompBrowserItem); conditionItems.add(parentCompBrowserItem);
conditionItems.add(parentDeptBrowserItem); conditionItems.add(parentDeptBrowserItem);
conditionItems.add(sequenceBrowserItem);
conditionItems.add(schemeBrowserItem);
conditionItems.add(parentJobBrowserItem);
conditionItems.add(isKeyItem); conditionItems.add(isKeyItem);
conditionItems.add(workplaceItem); conditionItems.add(workplaceItem);
conditionItems.add(forbiddenTagItem); conditionItems.add(forbiddenTagItem);
@ -321,7 +312,7 @@ public class JobServiceImpl extends Service implements JobService {
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(Long.parseLong(groupId), "1"); List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(Long.parseLong(groupId), "1");
if (CollectionUtils.isNotEmpty(extendTitles)) { if (CollectionUtils.isNotEmpty(extendTitles)) {
for (ExtendTitlePO extendTitle : extendTitles) { for (ExtendTitlePO extendTitle : extendTitles) {
List<SearchConditionItem> items = getExtService(user).getExtForm(user, EXTEND_TYPE + "", GROUP_ID.equals(Long.parseLong(groupId)) ? JCL_ORG_JOB : JCL_ORG_JOBEXT, viewAttr, id, extendTitle.getId().toString(), "scheme_id", "parent_comp"); List<SearchConditionItem> items = getExtService(user).getExtForm(user, EXTEND_TYPE + "", GROUP_ID.equals(Long.parseLong(groupId)) ? JCL_ORG_JOB : JCL_ORG_JOBEXT, viewAttr, id, extendTitle.getId().toString(), "ec_jobTitle", "ec_department", "ec_company");
if (CollectionUtils.isNotEmpty(items)) { if (CollectionUtils.isNotEmpty(items)) {
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items)); addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
} }
@ -357,7 +348,6 @@ public class JobServiceImpl extends Service implements JobService {
public Long saveBaseForm(Map<String, Object> params) { public Long saveBaseForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class); JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
assertNameRepeat(null, searchParam.getEcDepartment(), searchParam.getParentJob(), searchParam.getJobName());
String jobNo = (String) params.get("job_no"); String jobNo = (String) params.get("job_no");
// 判断是否开启自动编号 // 判断是否开启自动编号
jobNo = repeatDetermine(jobNo); jobNo = repeatDetermine(jobNo);
@ -365,18 +355,13 @@ public class JobServiceImpl extends Service implements JobService {
params.put("is_key", null == searchParam.getIsKey() ? 0 : searchParam.getIsKey()); params.put("is_key", null == searchParam.getIsKey() ? 0 : searchParam.getIsKey());
if (null != searchParam.getParentJob()) { if (null != searchParam.getParentJob()) {
JobPO parentJob = getJobMapper().getJobById(searchParam.getParentJob()); JobPO parentJob = getJobMapper().getJobById(searchParam.getParentJob());
params.put("parent_dept", parentJob.getParentDept());
params.put("parent_comp", parentJob.getParentComp());
params.put("ec_company", parentJob.getEcCompany()); params.put("ec_company", parentJob.getEcCompany());
params.put("ec_department", parentJob.getEcDepartment()); params.put("ec_department", parentJob.getEcDepartment());
} else { } else {
Integer ecDepartment = searchParam.getEcDepartment(); Integer ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment); DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
params.put("parent_dept", jclDepartment.getId()); params.put("ec_company", jclDepartment.getId());
params.put("parent_comp", jclDepartment.getSubCompanyId1()); params.put("ec_department", jclDepartment.getSubCompanyId1());
if (null != jclDepartment.getSubCompanyId1()) {
params.put("ec_company", jclDepartment.getSubCompanyId1());
}
} }
if (StringUtils.isBlank(params.get("show_order").toString())) { if (StringUtils.isBlank(params.get("show_order").toString())) {
@ -395,7 +380,6 @@ public class JobServiceImpl extends Service implements JobService {
public Long updateForm(Map<String, Object> params) { public Long updateForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class); JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
assertNameRepeat(searchParam.getId(), searchParam.getEcDepartment(), searchParam.getParentJob(), searchParam.getJobName());
String groupId = (String) params.get("viewCondition"); String groupId = (String) params.get("viewCondition");
searchParam.setIsKey(null == searchParam.getIsKey() ? 0 : searchParam.getIsKey()); searchParam.setIsKey(null == searchParam.getIsKey() ? 0 : searchParam.getIsKey());
// 上级岗位不能选择本身 // 上级岗位不能选择本身
@ -416,27 +400,22 @@ public class JobServiceImpl extends Service implements JobService {
params.put("is_key", searchParam.getIsKey()); params.put("is_key", searchParam.getIsKey());
if (null != searchParam.getParentJob()) { if (null != searchParam.getParentJob()) {
JobPO parentJob = getJobMapper().getJobById(searchParam.getParentJob()); JobPO parentJob = getJobMapper().getJobById(searchParam.getParentJob());
params.put("parent_dept", parentJob.getParentDept());
params.put("parent_comp", parentJob.getParentComp());
params.put("ec_company", parentJob.getEcCompany()); params.put("ec_company", parentJob.getEcCompany());
params.put("ec_department", parentJob.getEcDepartment()); params.put("ec_department", parentJob.getEcDepartment());
} else { } else {
Integer ecDepartment = searchParam.getEcDepartment(); Integer ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment); DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
params.put("parent_dept", jclDepartment.getId()); params.put("ec_department", jclDepartment.getId());
params.put("parent_comp", jclDepartment.getSubCompanyId1());
if (null != jclDepartment.getSubCompanyId1()) {
params.put("ec_company", jclDepartment.getSubCompanyId1()); params.put("ec_company", jclDepartment.getSubCompanyId1());
} }
}
params.put("jobactivityid", JOB_ACTIVITY_ID); params.put("jobactivityid", JOB_ACTIVITY_ID);
new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, params, oldJobPO).sync(); new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, params, oldJobPO).sync();
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOB, params, "", searchParam.getId()); getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOB, params, "", searchParam.getId());
JobPO jobById = getJobMapper().getJobById(searchParam.getId()); JobPO jobById = getJobMapper().getJobById(searchParam.getId());
new JobTriggerRunnable(oldJobPO, jobById).run(); //TODO new JobTriggerRunnable(oldJobPO, jobById).run();
// 更新人员关联字段 // 更新人员关联字段
updateResourceJob(jobById); // updateResourceJob(jobById);
} }
// 更新主表拓展表 // 更新主表拓展表
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOBEXT, params, "", searchParam.getId()); getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOBEXT, params, "", searchParam.getId());
@ -463,18 +442,15 @@ public class JobServiceImpl extends Service implements JobService {
jobById.setEcDepartment(Integer.parseInt(department)); jobById.setEcDepartment(Integer.parseInt(department));
DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(jobById.getEcDepartment()); DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(jobById.getEcDepartment());
if (null != jclDepartmentId) { if (null != jclDepartmentId) {
jobById.setParentDept(jclDepartmentId.getId());
//分部赋值 //分部赋值
jobById.setEcCompany(jclDepartmentId.getSubCompanyId1()); jobById.setEcCompany(jclDepartmentId.getSubCompanyId1());
jobById.setParentComp(jclDepartmentId.getSubCompanyId1());
} }
// 清空上级岗位 // 清空上级岗位
jobById.setParentJob(null); jobById.setParentJob(null);
jobById.setShowOrder(orderNum); jobById.setShowOrder(orderNum);
assertNameRepeat(null, jobById.getEcDepartment(), jobById.getParentJob(), jobById.getJobName());
insertCount += getJobMapper().insertIgnoreNull(jobById); insertCount += getJobMapper().insertIgnoreNull(jobById);
// 更新组织架构图 // 更新组织架构图
new JobTriggerRunnable(jobById.getId()).run(); //TODO new JobTriggerRunnable(jobById.getId()).run();
} }
return insertCount; return insertCount;
@ -484,10 +460,10 @@ public class JobServiceImpl extends Service implements JobService {
public int updateForbiddenTagById(JobSearchParam params) { public int updateForbiddenTagById(JobSearchParam params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
JobPO jobById = getJobMapper().getJobById(params.getId()); JobPO jobById = getJobMapper().getJobById(params.getId());
JobPO jobPO = JobPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).jobName(jobById.getJobName()).build(); JobPO jobPO = JobPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build();
if (params.getForbiddenTag()) { if (params.getForbiddenTag()) {
// 启用:判断上级部门是否启用,上级部门启用,岗位才可启用 // 启用:判断上级部门是否启用,上级部门启用,岗位才可启用
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(jobById.getParentDept()); DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(jobById.getEcDepartment());
OrganizationAssert.isTrue(0 == parentDepartment.getCanceled(), "该岗位不能解封,请先解封上级部门"); OrganizationAssert.isTrue(0 == parentDepartment.getCanceled(), "该岗位不能解封,请先解封上级部门");
// 启用:判断上级岗位是否启用,上级岗位启用,岗位才可启用 // 启用:判断上级岗位是否启用,上级岗位启用,岗位才可启用
@ -497,8 +473,9 @@ public class JobServiceImpl extends Service implements JobService {
} }
} else { } else {
//禁用:判断当前岗位下是否有人员,如有人员则不能禁用 //禁用:判断当前岗位下是否有人员,如有人员则不能禁用
int hasResource = getJobMapper().isHasResource(params.getId()); // int hasResource = getJobMapper().isHasResource(params.getId());
OrganizationAssert.isTrue(hasResource == 0, "该岗位存在人员,不能封存"); // OrganizationAssert.isTrue(hasResource == 0, "该岗位存在人员,不能封存");
throw new OrganizationRunTimeException("该岗位不能封存");
} }
new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.CANCELED, null, jobPO).sync(); new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.CANCELED, null, jobPO).sync();
return getJobMapper().updateForbiddenTagById(jobPO.getId(), jobPO.getForbiddenTag()); return getJobMapper().updateForbiddenTagById(jobPO.getId(), jobPO.getForbiddenTag());
@ -522,7 +499,8 @@ public class JobServiceImpl extends Service implements JobService {
@Override @Override
public Map<String, Object> getHrmListByJobId(Long jobId) { public Map<String, Object> getHrmListByJobId(Long jobId) {
OrganizationWeaTable<EmployeeTableVO> table = new OrganizationWeaTable<>(user, EmployeeTableVO.class); OrganizationWeaTable<EmployeeTableVO> table = new OrganizationWeaTable<>(user, EmployeeTableVO.class);
table.setSqlwhere(" where job_title = '" + jobId + "' and status<4"); // TODO BUG修复
table.setSqlwhere(" where jobtitle = '" + jobId + "' and status<4");
WeaResultMsg result = new WeaResultMsg(false); WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult()); result.putAll(table.makeDataResult());
result.success(); result.success();
@ -543,11 +521,6 @@ public class JobServiceImpl extends Service implements JobService {
deptBrowserItem.setBrowserConditionParam(customBrowserBean); deptBrowserItem.setBrowserConditionParam(customBrowserBean);
SearchConditionItem mergeNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "合并后名称", "mergeName"); SearchConditionItem mergeNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "合并后名称", "mergeName");
mergeNameItem.setRules("required|string"); mergeNameItem.setRules("required|string");
JobPO jobById = getJobMapper().getJobById(id);
if (null != jobById) {
String jobName = jobById.getJobName();
mergeNameItem.setValue(jobName);
}
condition.add(deptBrowserItem); condition.add(deptBrowserItem);
condition.add(mergeNameItem); condition.add(mergeNameItem);
addGroups.add(new SearchConditionGroup("", true, condition)); addGroups.add(new SearchConditionGroup("", true, condition));
@ -576,45 +549,42 @@ public class JobServiceImpl extends Service implements JobService {
// 待合并的部门 // 待合并的部门
JobPO jobById = getJobMapper().getJobById(mergeParam.getId()); 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()); recursionMergeJob(jobs, targetJob.getEcCompany(), targetJob.getEcDepartment(), targetJob.getId());
// 人员信息变动,更新分部、部门、岗位 // 人员信息变动,更新分部、部门、岗位
updateResourceJob(jobById, targetJob); // updateResourceJob(jobById, targetJob);
// 更新合并后的岗位,更新组织架构图 // 更新合并后的岗位,更新组织架构图
updateEcJob(targetJob, mergeParam.getMergeName()); // updateEcJob(targetJob, mergeParam.getMergeName());
targetJob.setJobName(mergeParam.getMergeName()); // TODO targetJob.setJobName(mergeParam.getMergeName());
getJobMapper().updateBaseJob(targetJob); getJobMapper().updateBaseJob(targetJob);
new JobTriggerRunnable(jobById.getId(), targetJob.getId()).run(); //TODO new JobTriggerRunnable(jobById.getId(), targetJob.getId()).run();
// 原岗位删除 // 原岗位删除
new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.CANCELED, null, jobById).sync(); new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.CANCELED, null, jobById).sync();
getJobMapper().deleteByIds(Collections.singletonList(jobById.getId())); getJobMapper().deleteByIds(Collections.singletonList(jobById.getId()));
// 更新组织架构图 // 更新组织架构图
new JobTriggerRunnable(jobById).run(); //TODO new JobTriggerRunnable(jobById).run();
return updateCount; return updateCount;
} }
void recursionMergeJob(List<JobPO> jobs, Integer parentCompany, Integer ecCompany, Integer parentDepartment, Integer ecDepartment, Long parentJob) { void recursionMergeJob(List<JobPO> jobs, Integer ecCompany, Integer ecDepartment, Long parentJob) {
for (JobPO job : jobs) { for (JobPO job : jobs) {
job.setParentComp(parentCompany);
job.setEcCompany(ecCompany); job.setEcCompany(ecCompany);
job.setParentDept(parentDepartment);
job.setEcDepartment(ecDepartment); job.setEcDepartment(ecDepartment);
job.setParentJob(parentJob); job.setParentJob(parentJob);
getJobMapper().updateBaseJob(job); getJobMapper().updateBaseJob(job);
// 更新人员信息 // 更新人员信息
updateResourceJob(job); // updateResourceJob(job);
// 更新组织架构图 // 更新组织架构图
new JobTriggerRunnable(job.getId()).run(); //TODO new JobTriggerRunnable(job.getId()).run();
// 递归处理子级元素 // 递归处理子级元素
List<JobPO> jobsByPid = getJobMapper().getJobsByPid(job.getId()); List<JobPO> jobsByPid = getJobMapper().getJobsByPid(job.getId());
recursionMergeJob(jobsByPid, parentCompany, ecCompany, parentDepartment, ecDepartment, parentJob); recursionMergeJob(jobsByPid, ecCompany, ecDepartment, parentJob);
} }
} }
@ -724,13 +694,11 @@ public class JobServiceImpl extends Service implements JobService {
*/ */
private boolean isFilter(JobPO jobPO) { private boolean isFilter(JobPO jobPO) {
return !(StringUtil.isEmpty(jobPO.getJobNo()) return !(StringUtil.isEmpty(jobPO.getJobNo())
&& StringUtil.isEmpty(jobPO.getJobName()) && StringUtil.isEmpty(jobPO.getJobTitleName())
&& StringUtil.isEmpty(jobPO.getWorkplace()) && StringUtil.isEmpty(jobPO.getWorkplace())
&& StringUtil.isEmpty(jobPO.getDescription()) && StringUtil.isEmpty(jobPO.getDescription())
&& StringUtil.isEmpty(jobPO.getWorkDuty()) && StringUtil.isEmpty(jobPO.getWorkDuty())
&& StringUtil.isEmpty(jobPO.getWorkAuthority()) && StringUtil.isEmpty(jobPO.getWorkAuthority())
&& null == jobPO.getParentComp()
&& null == jobPO.getParentDept()
&& null == jobPO.getParentJob() && null == jobPO.getParentJob()
&& null == jobPO.getSequenceId() && null == jobPO.getSequenceId()
&& null == jobPO.getSchemeId() && null == jobPO.getSchemeId()
@ -738,6 +706,7 @@ public class JobServiceImpl extends Service implements JobService {
&& null == jobPO.getForbiddenTag() && null == jobPO.getForbiddenTag()
&& null == jobPO.getEcCompany() && null == jobPO.getEcCompany()
&& null == jobPO.getEcDepartment() && null == jobPO.getEcDepartment()
&& null == jobPO.getEcJobTitle()
); );
} }
@ -787,95 +756,19 @@ public class JobServiceImpl extends Service implements JobService {
} }
} }
/** ///**
* EC // * 更新EC岗位
* // *
* @param jobPO // * @param jobPO
*/ // */
private void updateEcJob(JobPO jobPO, String newName) { //private void updateEcJob(JobPO jobPO, String newName) {
Map<String, Object> params = new HashMap<>(); // Map<String, Object> params = new HashMap<>();
params.put("job_name", newName); // params.put("job_name", newName);
params.put("jobactivityid", JOB_ACTIVITY_ID); // params.put("jobactivityid", JOB_ACTIVITY_ID);
params.put("work_duty", jobPO.getWorkDuty()); // params.put("work_duty", jobPO.getWorkDuty());
params.put("work_authority", jobPO.getWorkAuthority()); // params.put("work_authority", jobPO.getWorkAuthority());
params.put("description", jobPO.getDescription()); // params.put("description", jobPO.getDescription());
params.put("job_no", jobPO.getJobNo()); // params.put("job_no", jobPO.getJobNo());
new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, params, jobPO).sync(); // new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, params, jobPO).sync();
} //}
/**
*
*/
public static void assertNameRepeat(Long jobId, Integer 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 : Integer.parseInt(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, Integer departmentId, Long parentJobId, String jobName, boolean throwException) {
int count;
// 有上级岗位、判断相同层级下有无相同名称岗位
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;
}
/**
*
*
* @param originalJob
* @param targetJob
*/
private void updateResourceJob(JobPO originalJob, JobPO targetJob) {
// 更新岗位下的人员
Long originalJobId = originalJob.getId();
Long targetJobId = targetJob.getId();
Integer parentComp = targetJob.getParentComp();
Integer parentDept = targetJob.getParentDept();
Integer ecCompany = targetJob.getEcCompany();
Integer ecDepartment = targetJob.getEcDepartment();
List<HrmResourcePO> resourceList = getResourceMapper().getResourceListByJobId(originalJobId);
getResourceMapper().updateResourceJob(originalJobId, targetJobId, parentComp, parentDept, ecCompany, ecDepartment);
// 更新Ec人员分部、部门、岗位
for (HrmResourcePO hrmResourcePO : resourceList) {
new RecordSet().executeUpdate("UPDATE HRMRESOURCE SET SUBCOMPANYID1 = ? , DEPARTMENTID = ? WHERE UUID =? ", ecCompany, ecDepartment, hrmResourcePO.getUuid());
// 更新人员Map表信息
new HrmResourceTriggerRunnable(hrmResourcePO.getId()).run();
}
}
/**
*
*
* @param job
*/
private void updateResourceJob(JobPO job) {
updateResourceJob(job, job);
}
} }

@ -448,9 +448,9 @@ public class StaffServiceImpl extends Service implements StaffService {
OrganizationAssert.notNull(staffPO.getJobId(), "编制维度选择岗位时,岗位必填!"); OrganizationAssert.notNull(staffPO.getJobId(), "编制维度选择岗位时,岗位必填!");
JobPO jobById = getJobMapper().getJobById(staffPO.getJobId()); JobPO jobById = getJobMapper().getJobById(staffPO.getJobId());
if (null != jobById) { if (null != jobById) {
staffPO.setDeptId(jobById.getParentDept()); staffPO.setDeptId(jobById.getEcDepartment());
staffPO.setEcDepartment(jobById.getEcDepartment()); staffPO.setEcDepartment(jobById.getEcDepartment());
staffPO.setCompId(jobById.getParentComp()); staffPO.setCompId(jobById.getEcCompany());
staffPO.setEcCompany(jobById.getEcCompany()); staffPO.setEcCompany(jobById.getEcCompany());
} }
break; break;

@ -1,27 +1,20 @@
package com.engine.organization.thread; package com.engine.organization.thread;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.hrm.service.impl.HrmJobServiceImpl;
import com.engine.hrm.service.impl.OrganizationServiceImpl; import com.engine.hrm.service.impl.OrganizationServiceImpl;
import com.engine.organization.entity.commom.RecordInfo;
import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.enums.LogModuleNameEnum; import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum; import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.mapper.hrmresource.SystemDataMapper; import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.relation.ResourceSyncUtil; import com.engine.organization.util.relation.ResourceSyncUtil;
import org.apache.commons.collections.CollectionUtils;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.general.Util; import weaver.general.Util;
import weaver.hrm.User; import weaver.hrm.User;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author:dxfeng * @author:dxfeng
@ -81,9 +74,6 @@ public class OrganizationSyncEc {
case DEPARTMENT: case DEPARTMENT:
refreshDepartment(); refreshDepartment();
break; break;
case JOB:
refreshJob();
break;
case RESOURCE: case RESOURCE:
refreshResource(); refreshResource();
default: default:
@ -134,21 +124,6 @@ public class OrganizationSyncEc {
} }
} }
private void refreshJob() {
switch (operateType) {
case ADD:
addJob();
break;
case UPDATE:
updateJob();
break;
case CANCELED:
cancelJob();
break;
default:
break;
}
}
private void refreshResource() { private void refreshResource() {
switch (operateType) { switch (operateType) {
@ -175,173 +150,6 @@ public class OrganizationSyncEc {
} }
/**
*
*
* <p>
* 1ECHrmJobTitles
* <p>
* 2sql
* <p>
* 3jobtitlename
* <p>
* 4--
*/
private void addJob() {
// 判断是否存在同名岗位、存在不做处理,不存在,在“默认职务分类--默认职务”下新建岗位
String jobName = Util.null2String(params.get("job_name"));
RecordInfo hrmJobActivity = getSystemDataMapper().getHrmJobTitleByName(jobName);
Map<String, Object> map = new HashMap<>();
//存在且已封存,对岗位解封
if (null != hrmJobActivity) {
map.put("ids", hrmJobActivity.getId());
map.put("canceled", "docanceled");
this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).doCanceled(map, user);
} else {
// 不存在则新建职务
map.put("operateIp", Util.null2String(user.getLoginip()));
map.put("jobtitlemark", jobName);
map.put("jobtitlename", jobName);
map.put("jobactivityid", Util.null2String(params.get("jobactivityid")));
map.put("jobresponsibility", Util.null2String(params.get("work_duty")));
map.put("jobcompetency", Util.null2String(params.get("work_authority")));
map.put("jobtitleremark", Util.null2String(params.get("description")));
map.put("jobtitlecode", Util.null2String(params.get("job_no")));
this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).addJobTitle(map, user);
}
}
/**
*
*/
private void updateJob() {
Long jclJobId = oldJobPO.getId();
String oldName = oldJobPO.getJobName();
String newName = Util.null2String(params.get("job_name"));
if (newName.equals(oldName)) {
this.resultMap = new HashMap<>();
this.resultMap.put("sign", "1");
return;
}
RecordInfo oldHrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(oldName);
Map<String, Object> map = new HashMap<>();
// 修改前不存在共用
if (EcHrmRelationUtil.isNotExistJob(oldName, jclJobId)) {
// 修改后不存在共用、直接修改EC岗位表数据
if (EcHrmRelationUtil.isNotExistJob(newName, jclJobId)) {
// 查询ec表ID
RecordInfo hrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(newName);
if (null != hrmJobTitle) {
map.put("id", Util.null2String(hrmJobTitle.getId()));
map.put("operateIp", Util.null2String(user.getLoginip()));
map.put("jobtitlemark", newName);
map.put("jobtitlename", newName);
map.put("jobactivityid", Util.null2String(params.get("jobactivityid")));
map.put("jobresponsibility", Util.null2String(params.get("work_duty")));
map.put("jobcompetency", Util.null2String(params.get("work_authority")));
map.put("jobtitleremark", Util.null2String(params.get("description")));
map.put("jobtitlecode", Util.null2String(params.get("job_no")) + "_" + System.currentTimeMillis());
// 修改岗位表数据
this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).editJobTitle(map, user);
} else {
// 不存在则新建职务
map.put("operateIp", Util.null2String(user.getLoginip()));
map.put("jobtitlemark", newName);
map.put("jobtitlename", newName);
map.put("jobactivityid", Util.null2String(params.get("jobactivityid")));
map.put("jobresponsibility", Util.null2String(params.get("work_duty")));
map.put("jobcompetency", Util.null2String(params.get("work_authority")));
map.put("jobtitleremark", Util.null2String(params.get("description")));
map.put("jobtitlecode", Util.null2String(params.get("job_no")) + "_" + System.currentTimeMillis());
this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).addJobTitle(map, user);
}
} else {
// 修改后存在共用、不修改岗位表数据更新对应人员的岗位信息为当前岗位的ID
RecordInfo hrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(newName);
// 查询原分部、原岗位下的人员并更新岗位ID
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIds(oldJobPO.getParentDept(), oldHrmJobTitle.getId());
if (CollectionUtils.isNotEmpty(hrmResourceIds)) {
getSystemDataMapper().updateResourceJobTitleByIds(Util.null2String(hrmJobTitle.getId()), hrmResourceIds);
}
// 封存原名称岗位
map.put("ids", oldHrmJobTitle.getId());
map.put("canceled", "canceled");
this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).doCanceled(map, user);
}
} else {
// 修改前存在共用,不对原有数据进行操作。
// 修改后不存在共用、新建岗位更新原有岗位下人员的岗位ID
if (EcHrmRelationUtil.isNotExistJob(newName, jclJobId)) {
RecordInfo hrmJobActivity = getSystemDataMapper().getHrmJobTitleByName(newName);
//存在且已封存,对岗位解封
if (null != hrmJobActivity) {
map.put("ids", hrmJobActivity.getId());
map.put("canceled", "docanceled");
this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).doCanceled(map, user);
} else {
// 不存在则新建职务
map.put("operateIp", Util.null2String(user.getLoginip()));
map.put("jobtitlemark", newName);
map.put("jobtitlename", newName);
map.put("jobactivityid", Util.null2String(params.get("jobactivityid")));
map.put("jobresponsibility", Util.null2String(params.get("work_duty")));
map.put("jobcompetency", Util.null2String(params.get("work_authority")));
map.put("jobtitleremark", Util.null2String(params.get("description")));
map.put("jobtitlecode", Util.null2String(params.get("job_no")));
this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).addJobTitle(map, user);
}
} else {
this.resultMap = new HashMap<>();
this.resultMap.put("sign", "1");
}
// 查询原分部、原岗位下的人员并更新岗位ID
RecordInfo hrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(newName);
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIds(oldJobPO.getParentDept(), oldHrmJobTitle.getId());
if (CollectionUtils.isNotEmpty(hrmResourceIds)) {
getSystemDataMapper().updateResourceJobTitleByIds(Util.null2String(hrmJobTitle.getId()), hrmResourceIds);
}
}
}
/**
*
*/
private void cancelJob() {
Map<String, Object> map = new HashMap<>();
RecordInfo hrmJobTitleByName = getSystemDataMapper().getHrmJobTitleByName(oldJobPO.getJobName());
if (null == hrmJobTitleByName) {
return;
}
if (0 == oldJobPO.getForbiddenTag()) {
// 启用
map.put("ids", hrmJobTitleByName.getId());
map.put("canceled", "docanceled");
this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).doCanceled(map, user);
} else {
// 禁用
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listByNameExceptId(oldJobPO.getJobName(), oldJobPO.getId());
// 不存在共用
if (CollectionUtils.isEmpty(jobPOS)) {
map.put("ids", hrmJobTitleByName.getId());
map.put("canceled", "canceled");
this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).doCanceled(map, user);
} else {
List<JobPO> collect = jobPOS.stream().filter(item -> 0 == item.getForbiddenTag()).collect(Collectors.toList());
// 不存在非禁用
if (CollectionUtils.isEmpty(collect)) {
map.put("ids", hrmJobTitleByName.getId());
map.put("canceled", "canceled");
this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).doCanceled(map, user);
}
}
}
}
/** /**
* *
*/ */

@ -68,7 +68,7 @@ public class StaffTriggerRunnable implements Runnable {
if (null != jclJobId) { if (null != jclJobId) {
JobPO jobById = getJobMapper().getJobById((long) jclJobId); JobPO jobById = getJobMapper().getJobById((long) jclJobId);
if (null != jobById) { if (null != jobById) {
this.staffPO = StaffPO.builder().compId(jobById.getParentComp()).deptId(jobById.getParentDept()).jobId(jobById.getId()).build(); this.staffPO = StaffPO.builder().compId(jobById.getEcCompany()).deptId(jobById.getEcDepartment()).jobId(jobById.getId()).build();
this.staffPlanByID = StaffPlanPO.builder().controlDimension("3").build(); this.staffPlanByID = StaffPlanPO.builder().controlDimension("3").build();
} }
} }

@ -1,9 +1,9 @@
package com.engine.organization.transmethod; package com.engine.organization.transmethod;
import com.engine.organization.entity.job.bo.JobBO;
import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper; import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper; import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import weaver.hrm.User; import weaver.hrm.User;
@ -21,8 +21,9 @@ public class HrmResourceTransMethod {
public static String getCompanyName(String companyId) { public static String getCompanyName(String companyId) {
return MapperProxyFactory.getProxy(CompMapper.class).listById(Integer.parseInt(companyId)).getSubCompanyName(); return MapperProxyFactory.getProxy(CompMapper.class).listById(Integer.parseInt(companyId)).getSubCompanyName();
} }
public static String getJobName(String jobTitle) { public static String getJobName(String jobTitle) {
return MapperProxyFactory.getProxy(JobMapper.class).getJobById(Long.parseLong(jobTitle)).getJobName(); return JobBO.getJobTitleNameByEcJobTitle(jobTitle);
} }
public static String getManagerName(String managerId) { public static String getManagerName(String managerId) {

@ -1,6 +1,7 @@
package com.engine.organization.transmethod; package com.engine.organization.transmethod;
import com.engine.organization.entity.DeleteParam; import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.scheme.GradeMapper; import com.engine.organization.mapper.scheme.GradeMapper;
import com.engine.organization.mapper.scheme.LevelMapper; import com.engine.organization.mapper.scheme.LevelMapper;
@ -20,18 +21,16 @@ import java.util.stream.Collectors;
*/ */
public class JobTransMethod { public class JobTransMethod {
public static String getSpanById(String planId) { public static String getSpanById(String jobId) {
JobMapper jobMapper = MapperProxyFactory.getProxy(JobMapper.class); JobMapper jobMapper = MapperProxyFactory.getProxy(JobMapper.class);
List<Map<String, Object>> maps = jobMapper.listJobsByIds(DeleteParam.builder().ids(planId).build().getIds()); List<JobPO> jobsByIds = jobMapper.getJobsByIds(DeleteParam.builder().ids(jobId).build().getIds());
String names = maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(",")); return jobsByIds.stream().map(JobPO::getJobTitleName).collect(Collectors.joining(","));
return names;
} }
public static String getLevelName(String levelId) { public static String getLevelName(String levelId) {
LevelMapper levelMapper = MapperProxyFactory.getProxy(LevelMapper.class); LevelMapper levelMapper = MapperProxyFactory.getProxy(LevelMapper.class);
List<Map<String, Object>> maps = levelMapper.listLevelsByIds(DeleteParam.builder().ids(levelId).build().getIds()); List<Map<String, Object>> maps = levelMapper.listLevelsByIds(DeleteParam.builder().ids(levelId).build().getIds());
String levelName = maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(",")); return maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(","));
return levelName;
} }
public static String getGradeName(String gradeId) { public static String getGradeName(String gradeId) {

@ -65,7 +65,7 @@ public class DetachUtil {
*/ */
public void filterJobList(List<JobPO> jobList) { public void filterJobList(List<JobPO> jobList) {
if (DETACH && CollectionUtils.isNotEmpty(jobList)) { if (DETACH && CollectionUtils.isNotEmpty(jobList)) {
jobList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp())); jobList.removeIf(item -> !jclRoleLevels.contains(item.getEcCompany()));
} }
} }

@ -1,15 +1,9 @@
package com.engine.organization.util.relation; package com.engine.organization.util.relation;
import com.engine.organization.entity.commom.RecordInfo;
import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.job.po.JobPO;
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.job.JobMapper;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils; import weaver.general.Util;
import java.util.List;
/** /**
* @author:dxfeng * @author:dxfeng
@ -18,22 +12,6 @@ import java.util.List;
*/ */
public class EcHrmRelationUtil { public class EcHrmRelationUtil {
private static final String HRM_COMPANY = "hrmsubcompany";
private static final String HRM_DEPARTMENT = "hrmdepartment";
private static SystemDataMapper getSystemDataMapper() {
return MapperProxyFactory.getProxy(SystemDataMapper.class);
}
private static CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class);
}
private static DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class);
}
private static JobMapper getJobMapper() { private static JobMapper getJobMapper() {
return MapperProxyFactory.getProxy(JobMapper.class); return MapperProxyFactory.getProxy(JobMapper.class);
} }
@ -43,37 +21,9 @@ public class EcHrmRelationUtil {
if (null == jobById) { if (null == jobById) {
return ""; return "";
} }
RecordInfo hrmJobTitleByName = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmJobTitleByName(jobById.getJobName());
if (null == hrmJobTitleByName) {
return "";
}
return hrmJobTitleByName.getId();
}
return Util.null2String(jobById.getEcJobTitle());
/**
*
* <p>true</p>
*
* @param jobName
* @param id
* @return
*/
public static boolean isExistJob(String jobName, Long id) {
List<JobPO> jobPOS = getJobMapper().listByNameExceptId(jobName, id);
return CollectionUtils.isNotEmpty(jobPOS);
} }
/**
*
* <p>true</p>
*
* @param jobName
* @param id
* @return
*/
public static boolean isNotExistJob(String jobName, Long id) {
return !isExistJob(jobName, id);
}
} }

@ -273,9 +273,9 @@ public class StaffInfoImportUtil {
if (null == jobPO) { if (null == jobPO) {
checkMsg = "未找到对应岗位!"; checkMsg = "未找到对应岗位!";
} else { } else {
param.setCompId(jobPO.getParentComp()); param.setCompId(jobPO.getEcCompany());
param.setEcCompany(jobPO.getEcCompany()); param.setEcCompany(jobPO.getEcCompany());
param.setDeptId(jobPO.getParentDept()); param.setDeptId(jobPO.getEcDepartment());
param.setEcDepartment(jobPO.getEcDepartment()); param.setEcDepartment(jobPO.getEcDepartment());
} }
} }

@ -11,14 +11,11 @@ import com.engine.organization.entity.job.param.JobMergeParam;
import com.engine.organization.entity.job.param.JobSearchParam; import com.engine.organization.entity.job.param.JobSearchParam;
import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.searchtree.SearchTreeParams; 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.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum; import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.mapper.job.JobMapper; 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.JobService;
import com.engine.organization.service.impl.JobServiceImpl; import com.engine.organization.service.impl.JobServiceImpl;
import com.engine.organization.thread.JobTriggerRunnable;
import com.engine.organization.util.MenuBtn; import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationFormItemUtil; import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.OrganizationWrapper; import com.engine.organization.util.OrganizationWrapper;
@ -116,7 +113,7 @@ public class JobWrapper extends OrganizationWrapper {
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), params.get("job_name").toString(), JSON.toJSONString(params), "新增岗位"); }.getClass(), params.get("job_name").toString(), JSON.toJSONString(params), "新增岗位");
// 更新组织架构图 // 更新组织架构图
new Thread(new JobTriggerRunnable(jobId)).start(); //TODO new Thread(new JobTriggerRunnable(jobId)).start();
return jobId; return jobId;
} }
@ -133,7 +130,7 @@ public class JobWrapper extends OrganizationWrapper {
Long jobId = getJobService(user).updateForm(params); Long jobId = getJobService(user).updateForm(params);
JobPO newJobById = getJobMapper().getJobById(id); JobPO newJobById = getJobMapper().getJobById(id);
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), jobById.getJobName(), JSON.toJSONString(params), jobById, newJobById); }.getClass(), jobById.getJobTitleName(), JSON.toJSONString(params), jobById, newJobById);
// 更新组织架构图 // 更新组织架构图
return jobId; return jobId;
@ -151,7 +148,7 @@ public class JobWrapper extends OrganizationWrapper {
int copyJobItem = getJobService(user).copyJobItem(param.getIds(), param.getDepartment()); int copyJobItem = getJobService(user).copyJobItem(param.getIds(), param.getDepartment());
for (JobPO jobPO : jobPOS) { for (JobPO jobPO : jobPOS) {
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), jobPO.getJobName(), JSON.toJSONString(param), "复制岗位[" + jobPO.getJobName() + "]"); }.getClass(), jobPO.getJobTitleName(), JSON.toJSONString(param), "复制岗位[" + jobPO.getJobTitleName() + "]");
} }
return copyJobItem; return copyJobItem;
} }
@ -171,7 +168,7 @@ public class JobWrapper extends OrganizationWrapper {
}.getClass(), jobById.getJobNo(), JSON.toJSONString(params), jobById, newJobById); }.getClass(), jobById.getJobNo(), JSON.toJSONString(params), jobById, newJobById);
// 更新组织架构图 // 更新组织架构图
new Thread(new JobTriggerRunnable(jobById, newJobById)).start(); //TODO new Thread(new JobTriggerRunnable(jobById, newJobById)).start();
return updateForbiddenTagById; return updateForbiddenTagById;
} }
@ -187,9 +184,9 @@ public class JobWrapper extends OrganizationWrapper {
int deleteByIds = getJobService(user).deleteByIds(ids); int deleteByIds = getJobService(user).deleteByIds(ids);
for (JobPO jobPO : jobPOS) { for (JobPO jobPO : jobPOS) {
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), jobPO.getJobName(), JSON.toJSONString(ids), "删除岗位"); }.getClass(), jobPO.getJobTitleName(), JSON.toJSONString(ids), "删除岗位");
// 更新组织架构图 // 更新组织架构图
new JobTriggerRunnable(jobPO).run(); // TODO new JobTriggerRunnable(jobPO).run();
} }
return deleteByIds; return deleteByIds;
} }

Loading…
Cancel
Save